Why I get error "Invalid merchant account"? - ruby-on-rails

I want to get PayPal reports and for this reason I installed paypal-report gem.
Can someone look are my credentials are correct or for Reporting API usage I need some special account ?
I have verified bussiness account.
Here is my code:
require 'paypal/report'
api = Paypal::Report.new("my secure account MerchantID", "mypassword", "my secure account MerchantID", "PayPalUK")
puts api.daily.inspect
I also tried to enter my email instead of MerchanID, but it didn't work.
and this gives me error:
C:/Ruby193/lib/ruby/gems/1.9.1/gems/paypal-report-0.1.2/lib/paypal/report.rb:141
:in `block in request': Invalid merchant account (RuntimeError)
I tried to inspect api value, by using puts api and here is result:
puts api
//and result:
#<Paypal::Report:0x27a4310>
Can someone help me ?

Seeing 'PayPalUK' in there, I've got a suspicion the gem you're using is for PayPal Payflow services (and when it comes to reporting, that would be XML Reporting).
Seeing as you mention having a regular 'verified business account', I don't think you'd have access to Payflow API calls. Thus, no correct credentials to enter there.
What PayPal API call are you trying to use? Is it TransactionSearch you're looking for?
If so, try the ruby-paypal gem.
(Note, I haven't tested it, but it's the first one a quick Google search for "PayPal TransactionSearch gem" returned.)

Related

Omnicontacts gem: Outlook invalid_request

Ruby gem works great for us for Gmail and Yahoo. When accessing via Outlook and their new API we are getting the error below.
NOTE: This happens after we successfully receive the params[:code] and are trying to get the token. Any ideas?
{
"error":"invalid_request",
"error_description":"AADSTS90019: No tenant-identifying information found in either the request or implied by any provided credentials.\r\nTrace ID: 791c90ec-0f53-46c8-b15d-a3fe9f07bf18\r\nCorrelation ID: e7e0d207-2c99-4f88-bb6b-2ea62ec19e1d\r\nTimestamp: 2016-05-17 17:07:43Z",
"error_codes":[
90019
],
"timestamp":"2016-05-17 17:07:43Z",
"trace_id":"791c90ec-0f53-46c8-b15d-a3fe9f07bf18",
"correlation_id":"e7e0d207-2c99-4f88-bb6b-2ea62ec19e1d"
}
Solution: Need to use an account that is #outlook.com to generate your credentials.
You can't use a personal or work email address... turns out it must be an actual #outlook.com account.

Change paypal acount in ActiveMerchant

I need to migrate to another PayPal account and start receiving payments there. The previous setup is working great but I cant see to figure out how to migrate to the new account.
The existing PayPal configuration is as follows:
test:
paypal_email: email#fake.com
paypal_secret: xxxxxxxxxx
paypal_cert_id: ASLJKDLA334LJ
paypal_url: "https://www.sandbox.paypal.com/cgi-bin/webscr"
key_pass: 0000
In my PayPal account I go to "Business Setup" -> "Get your API Credentials" -> "View API Signature" and I see some different information that looks like this:
API Username: somename.butnotemail
API Password: ALKSDFLADSJLKAJSDASDALKSDJ
Signature: afalksdjfal.asdflkjalsdfjalksfjqwefasdfaksdf.aksdjfhaksdfha
First of all they do not seem to match and if I try to replace them the payment is leading to "Sorry — your last action could not be completed" page.
Can you please give me some insight on this? Am I looking at the wrong place? Where can I find the credentials I need?
Any help would be really appreciated
Thanks, in advance
From reading around, it sounds like the API key isn't what you're looking for in Ruby On Rails. I found this on Kestrel Blackmore's site -- it's to do with what happens when your credentials expire, but hopefully you can turn it to your ends as well.
http://www.kestrelblackmore.com/blog/rails-paypal-certificate-expiration
Perhaps the data in your configuration is referring to a PayPal REST API App? Check the following link (while logged in) in your old account, or create an app with your new account and use the generated credentials
https://developer.paypal.com/developer/applications

How to check if some access_token of FB is valid in Rails?

I know that there is Koala gem for Rails to work with Facebook. I need to make clear 2 things:
How to check if some access_token is valid in Rails using Koala (or something else)?
How to generate some real access token (using some settings of my app or my login/password) for testing through RSpec?
Thanks in advance.
For #1 Use the Tool https://developers.facebook.com/tools/debug if you don't want to code a test. Otherwise hit this API and verify the response.
https://graph.facebook.com/oauth/access_token_info?client_id={APP_ID}&access_token={ACCESS_TOKEN}
For #2, Koala has a good API for accessing Facebook Test Users, which I recommend for use in Rspec.
We also support the test users API, allowing you to conjure up fake
users and command them to do your bidding using the Graph or REST API:
#test_users = Koala::Facebook::TestUsers.new(:app_id => id, :secret => secret)
user = #test_users.create(is_app_installed, desired_permissions)
user_graph_api = Koala::Facebook::API.new(user["access_token"])
# or, if you want to make a whole community:
#test_users.create_network(network_size, is_app_installed, common_permissions)
You can also create Test User in the App Settings from Facebook, and view thier details from this API :
https://graph.facebook.com/{APP_ID}/accounts/test-users?%20access_token={APP_TOKEN}

Soundcloud OAuth2 API: Getting invalid_scope error after user connection

I'm trying to implement Soundcloud connect and having a weird issue.
First thing I do is send my users to
https://soundcloud.com/connect?client_id=MY_CLIENT_ID&redirect_uri=http://myredirecturl.example.com&state=RANDOM_STRING&display=page&response_type=code&scope=email
When users connect they get redirected to
http://myredirecturl.example.com?error=invalid_scope&error_description=The+requested+scope+is+invalid%2C+unknown%2C+or+malformed.&state=RANDOM_STRING
The same happens if I use scope=*.
However, if I use scope=non-expiring it lets me go through, but I need the users email and that type of scope doesn't have enough grants.
I thought it had something to do with my app being in development mode, but Osman at Soundcloud said it doesn't.
Thanks.
The 'email' scope is not available to all integrations. It's used for a few custom integrations that have provided us with accepted terms of service / privacy policies. There is no way to get a user's email address using the SoundCloud API.
You should however be able to use the '*' scope to get an expiring access token. I'll check with our app team to see why this is giving you an error. I'll edit my answer once I have more information there.
For your purposes, I would stay with the 'non-expiring' scope and simply prompt a user for their email address (providing them with a way to agree to your terms of use / privacy information).
Using scope=* sometimes doesn't work because the url is not properly encoded. If you are getting this error while using the * wildcard, try properly encoding the url, using a function like urlencode() (for PHP).

Rails LinkedIn gem only gets first name and last name out of profile

I am currently trying to use this gem http://github.com/pengwynn/linkedin. Everything works fine (i.e. authentication and calling the method which gets the profile), except that the profile object only contains the first name and the last name.
I'm trying to get my own profile info through the LinkedIn API, So the necessary information is there. How to do that?
Thank you.
I just found out that in order to get more info rather that first name and last name, one needs to pass in the :fields param specifying the desired fields.
Link LinkedIn into your next Ruby application
Example from the site:
# get a profile for someone found in network via ID
client.profile(:id => 'gNma67_AdI', :fields => %w(first-name, last-name, headline, positions, education))
By design, the LinkedIn api does not give you the person's email address. (Unlike the Google oauth api).
What you can get from the LinkedIn api is information about the person's connections (friends) and more. See overview. Their profile api
Added: could be that the Rails LinkedIn gem does not yet expose all of the LinkedIn Profle api. That api has changed relatively recently. It may be that you'll need to find another gem or write you own sw to do it. Check on the LinkedIn api forum

Resources