PayPal payment error - ruby-on-rails

I've got an app that has the possibility to do shopping, making the money transaction through paypal. I'm trying now to integrate the paypal stuff into my rails project and as I'm trying to learn how that's done I've downloaded this sample project that appears to show a good example of how this stuff is done.
I think I've got everything covered when talking about configuration. That app is now all configured with my paypal credentials.
My problem is that after making any payment, when making the callback, the app throws this error:
undefined method `recipientName=' for #<PayPal::SDK::REST::DataTypes::Address:0x007feb13a30ee8>
Even with the default configuration I'm having this issue.
Does anyone know what is that about? I guess is something about the gems included in the project that have to do with paypal:
# PayPal
gem 'paypal-sdk-core', :git => 'https://github.com/paypal/sdk-core-ruby.git'
gem 'paypal-sdk-rest', :git => 'https://github.com/paypal/rest-api-sdk-ruby.git'
But have any clue about how to fix it. Maybe someone does.
Thanks!

I found the solution. Definitely was something about the gem versions. Just updated them and problem solved.
Making this:
# PayPal
gem 'paypal-sdk-core', :git => 'https://github.com/paypal/sdk-core-ruby.git'
gem 'paypal-sdk-rest', :git => 'https://github.com/paypal/rest-api-sdk-ruby.git'
Didn't installed the latest version of both gems. I've just took out those git specification and after a bundle update the problem was solved.

Related

YouTube Data Api and Rails

I've been able to set up a toy app with the following code taken from YouTube's sample ruby projects. I'm looking to use YouTube to search for artists channels, playlists, videos. No issues with the sample toy app but can't get the same code working in Rails.
After successfully searching YouTube's API and manipulating the response, I've tried importing some of this code into an existing rails app.
I initially put the following code into a new initializer in my config directory but when trying to load rails console to play with the query, I'm receiving the following error:
"NameError: uninitialized constant Google"
require 'google/api_client
client = Google::APIClient.new(
:key => "XXXXXXXXXXX",
:authorization => nil,
:application_name => $PROGRAM_NAME,
:application_version => '1.0.0'
)
Gemfile:
gem 'google-api-client', '0.9'
I know there's been some updates to the API but having trouble tracking down exactly what I need to do.
Have you added require 'google/api_client' to the file where you're instantiating that client variable?
I had a the same error using Ruby 2.6.5 in a Rails 6 app. I found this similar issue on Github and downgrading the google-api-client gem solved it for me.
I used
gem 'google-api-client', '~> 0.7.1'

Paperclip aws-sdk error: uninitialized constant

I'm currently running into the uninitialized constant Paperclip::Storage::S3::AWS error when I attempt to upload files to my server. I understand this to be typically caused by running an older version of paperclip, before they added support for aws-sdk-v2. The strange thing is that I'm running the latest paperclip version (4.3.1) which, according to its github page, includes aws-sdk-v2 support.
Honestly, I'm not sure what more I can say about this. I checked the error log and the above is the only complaint it has. Do I need to do anything special to run v2 with paperclip? Thanks to anyone who can shine any light onto this matter.
the issue is written here:
http://ruby.awsblog.com/post/TxFKSK2QJE6RPZ/Upcoming-Stable-Release-of-AWS-SDK-for-Ruby-Version-2
try to change your Gemfile to:
gem 'aws-sdk', '< 2.0'
Figured it out with the help of some folks over at github. (See the thread here.)
Basically it seems that paperclip 4.3.1 doesn't entirely support v2 yet. A week after it was released or so, a commit was pushed to the master that gets past this error. It appears not to be perfect but here's how I made it work.
You can specify this particular revision of paperclip to bundler with the following line:
gem 'paperclip', :git=> 'https://github.com/thoughtbot/paperclip', :ref => '523bd46c768226893f23889079a7aa9c73b57d68'
More information on this sort of thing can be found here.
You will need to specify the REGION of your in your paperclip defaults. This can be done by dropping a :s3_region=> 'us-west-2' (or whatever your region is) into your paperclip_defaults. Simply specifying the endpoint or host will not be enough. You can look yours up here.
Also slightly confusing is the error message if the above isn't done properly:
missing region; use :region option or export region name to ENV['AWS_REGION']
I couldn't get the recommended environment variable to work.
The :region option is somewhat misleading as it needs to be written :s3_region

Integrate Indian Payment Gateway (CCAvenue) in Ruby on Rails e-commerce application supporting by Spree

Currently working on an e-commerce web-application. It is being developed by Spree on Ruby on Rails plateform. I am not able to integrate any Indian Payment Gateway in this app.
I tried CCAvenue but getting problem. Even I am not able to find any command for using it.
This is also not working https://github.com/meshbrain/active_merchant_ccavenue
I also tried Paypal but Paypal has stopped its services in India.
Please give suggestion quickly as I've less time for integrating it.
You have to try this gem if you r using Spree...
gem 'spree_gateway', :git => 'git://github.com/spree/spree_gateway.git', :branch => "1-1-stable" # make sure to include after spree

Building a new strategy for Omniauth, but Omniauth can't find it

I'm new to Rails and to Omniauth, so sorry in advance for the dumb
question.
I'm trying to do an Omniauth strategy for the Deezer website.
http://www.deezer.com/en/developers/simpleapi/oauth
First, I set up a basic rails application to test the Facebook strategy.
Here is my code in Github :
https://github.com/geoffroymontel/omniauth-test
And it works fine. Good.
Then I added those files in my app lib directory
lib/omniauth-deezer.rb
lib/omniauth/deezer.rb
lib/omniauth/deezer/version.rb
lib/omniauth/deezer/strategies/deezer.rb
and added
provider :deezer, ENV['DEEZER_APP_ID'],
ENV['DEEZER_APP_SECRET'], :perms => 'basic_access,email'
in
config/initializers/omniauth.rb
But when I start the app with
rails s
I get the following error message
/home/geoffroy/.rvm/gems/ruby-1.9.2-p290#rails3tutorial2ndEd/gems/omniauth-1.0.2/lib/omniauth/builder.rb:33:in `rescue in provider': Could not find matching strategy for :deezer. You may need to install an additional gem (such as omniauth-deezer). (LoadError) from /home/geoffroy/.rvm/gems/ruby-1.9.2-p290#rails3tutorial2ndEd/gems/omniauth-1.0.2/lib/omniauth/builder.rb:30:in `provider'
Thanks for your help
Best
Geoffroy
I added
require 'omniauth-deezer'
in initializers/omniauth.rb and it worked.
I don't really understand why I need it and Facebook doesn't.
In the Upgrading to 1.0 doc it is mentioned that Omniauth needs a gem for every provider now, so you'll have to move your provider to a gem eventually.
For future reference, if you want to add your own omniauth strategy, add this to your gemfile
gem 'omniauth-mystrategy', :path => '~/full-path-to-the-omniauth-folder/'
You´ll be using the local repository feauture of the gemfiles.
In the official bundler page you´ll see how to use remote repos also.
http://gembundler.com/v1.3/gemfile.html

Typus and Rails 3.1 - missing constant AdminsController

Gemfile:
gem 'rails', '3.1.0.rc4'
gem 'typus', :git => 'http://github.com/typus/typus', :branch => '3-1-unstable'
Obviously the name of the Git-branch suggests that it's error prone, but I think I might be missing something simple here. According to the documentation rails g typus and rails g typus:migration should be enough to get going.
My problem is that I'm missing the AdminsController, after migrating and navigating to 0.0.0.0:3000 I get greeted by
uninitialized constant AdminsController
and there is no AdminsController.rb in app/controllers. Is this a bug in the 3.1 branch or am I missing something in the documentation?
Teddy bear theory strikes again. Navigating to /admin/session/ greets me with a login page. I get the feeling that navigating to /admin/ should still produce some output and not an error message though.
Looking at the commits it's so bleeding edge that's probably a bug.
I see that you already notified developers by opening a ticket, hopefully they'll look into it soon.
Happens to me also all the time with stuff that is trying to be 3.1 compatible, for which I create a patch when it's possible.
Cheers
Turns out the problem was entirely my fault. I didn't have a clean admin namespace like I should have.

Resources