Invalid billing_info when upgrading Recurly Gem - ruby-on-rails

Going from version 2.9.3 -> 2.18.0 for the ruby gem.
Have been using v4 for Recurly.js so that stays the same.
This has been working for years and I decided to upgrade the gem.
I am generating the front end token with:
recurly.configure({ publicKey: RECURLY_JS_PUBLIC_KEY })
It generates a token and pass it along to the backend where we do:
Recurly::Account.create!(
account_code: account_code,
billing_info: { token_id: params['recurly-token'] }
)
It keeps raising this error:
Recurly::Resource::Invalid (billing_info is invalid)
I've been messing around with this a lot. Putting in a random string as the token or waiting 20 minutes for the token to expire will throw a different error message:
Recurly::Resource::Invalid: Token (billing_info.token_id) is either invalid or expired
So I feel like it is reading my token correctly and the keys are correct. Could it be that maybe the billing info that I used to generate the token be bad? I've filled out so many different combinations of correct addresses and test credit card numbers.
I'm out of ideas and any help would be nice.

It does sound like the actual billing information might be bad. Are you using the correct test card number (4111-1111-1111-1111) with an expiration date in the future, and all the address information required by your site settings?

Figured out the issue.
There was a problem with the country input. Originally the ISO alpha-2 code worked for the country. But once I updated the gem, the ISO alpha-2 code no longer worked. The front end validation would work and it would create a token fine but the backend would not accept that token.
So using US did not work anymore but United States worked.
I ended up building a dropdown from this list: https://docs.recurly.com/docs/countries-provinces-and-states

Related

Use Tweepy to extract Twitter follower information (API incompatibility issues)?

I was following this tutorial, https://towardsdatascience.com/how-to-download-twitter-friends-or-followers-for-free-b9d5ac23812, which was written in 2021. It should've worked fine, however, they have to 'fix' the things that just work.
Specifically, running this line
for fid in Cursor(api.followers_ids, screen_name=screen_name, count=5000).items():
ids.append(fid)
gives the error:
"tweepy.error.TweepError: [{'message': 'You currently have Essential access which includes access to Twitter API v2 endpoints only. If you need access to this endpoint, you’ll need to apply for Elevated access via the Developer Portal. You can learn more here: https://developer.twitter.com/en/docs/twitter-api/getting-started/about-twitter-api#v2-access-leve', 'code': 453}]"
I could have pulled the data in five minutes. Now debugging this already cost one hour+ because they just break the things that work. Is there anyway to make this old code snippet work? The application to use API 1.1 takes weeks, and I don't have time to watch their bad documents of how to migrate from API 1.1 to 2.0 and then the documents of migrating from Tweepy 3.9.0 to 4.0.0. Five minutes' task would just become half a day. Thanks in advance for any help.
First of all, have you at least tried to apply for the Elevated access?
It can take some time, it's true, but it can also be instantaneous.
The other solution would be to use the Twitter API V2.
You don't need any tutorial, just read the documentation:
Here for the authentication ;
Here for the retrieval of the followers ;
Here for the pagination.
And you should get something like that:
import tweepy
client = tweepy.Client("Bearer Token here")
paginator = tweepy.Paginator(
client.get_users_followers,
id=..., # ID only, no screename
max_results=1000
).flatten()
for follower in paginator:
print(follower.id)
Finally, even if I understand your frustration (and developing Twitter applications can be very frustrating), I think that you should try to keep it out your SO questions. Good luck!

Vidyo SDK unexpected disconnection

I downloaded the Vidyo SDK for iOS. I followed the all the steps to generate a new token and succeeded on that. But at the time of joining the call it always prompting Unexpected disconnection. Even in the VidyoConnector Mac app also getting same error. Led to conference inability.
What are all the possibilities of hitting this error. Any help much appreciated!
Based on your description, it seems like the token you have generated is invalid. How did you generate it ? Here is a link that provides with token generation scripts samples in multiple languages.
https://support.vidyo.io/hc/en-us/articles/115003127747-Generate-a-Token
Another tip to validate your token - it's a long string that ends with "==" symbol.
Are you using the python script shared at https://static.vidyo.io/4.1.16.8/utils/generateToken.py
The syntax for using our pyton token generation:- python3 generateToken.py --key= --appID= --userName= --expiresInSecs=10000
Make sure that you do not include any special character like # in the user name

Google/Youtube API Server Key format for pre-validation

Context: I'm updating my WordPress plugin to authenticate against the YouTube v3 API using a server key that has to be requested and entered by the user of the plugin.
Problem: I would like to perform validation of some kind on that key before using it, but can't seem to find documentation of the format a Google API server key adheres to. Based on (a very limited) number of examples it seems as though a key is:
is 39 characters long
is case-sensitive
consists of letters, numbers and at least dashes
So the question, obviously: Is this documented somewhere? Can anyone confirm or expand?
thanks,
frank
I couldn’t find any published key format either. Maybe because they want to keep the freedom to change the format in the future. If you want to be on the safe side, you should probably just do sanity checks well above the observed format. For example <=1024 bytes and non-control ascii characters, or even base64, or just don’t do any validation at all and let Google do that.
How about taking the key and passing it to a server-side script that attempts to use the key for some call. Then if it works return a success, else fail and call this async for the validation. Just seems more reliable than trying to decoded or anticipate the format of the hash.

FedEx Track Web Service isn't recognizing any tracking numbers

I'm trying to use the FedEx API to track packages. I can authenticate to their test server successfully (using my user credentials, account number, and meter number). However, I receive the same unhelpful response for most tracking numbers that I use in my requests; both test tracking numbers (like 999999999999) and real tracking numbers (that work well on the FedEx website) return the following:
Error Code 9040.
No information for the following shipments has been received by our system yet. Please try again or contact Customer Service at 1.800.Go.FedEx(R) 800.463.3339.
The only requests that fetch a different response are the clearly invalid ones, like "test", which returns:
Error Code 5508.
Invalid tracking number.
I tried SOAP requests using their wsdl (TrackService_v5) as well as manual non-SOAP HTTP POST requests, but their responses are exactly the same in both cases. Is something wrong on their side, or am I doing something wrong?
It seems that FedEx has disabled any test tracking numbers, in the past 999999999999 would work just fine, but now that doesn't even work. To the best of my knowledge, the only way to resolve this is to move to production. Which IMHO is bad because you have to test the tracking part of your application until you move to production.
999999999999 worked for me, but I think I am already in production environment.

Activemerchant ogone => Merchant not active

I'm trying to implement a ogone test account in my rails development application, but I keep getting the error message 'Merchant not active'
After some investigation I believe it has something to do with the SHA encoding?
Problem is I don't really get how this works, Ogone has multple SHA parameters to fill out and I haven't found a way in activemerchant to put it in there.
Someone with some experience in this matter?
The reason you are getting the Merchant not active error is because your account is not configured to be able to use Direct Link or several other options. To activate this you should get a higher subscription or contact their support and ask them to activate it for you.
As for SHA, you need to configure a secret passphrase by which you separate the parameters you're sending. For instance:
Passphrase: ogonepass123
Post variables: CN=JohnDoeogonepass123AMOUNT=1000ogonepass123CURRENCY=EURogonepass123PSPID=MyPSPID
Eventually you Hash your post variables to SHA-1 and add that key to your post parameters as
....ogonepass123SHASIGN=<40-characters-SHA-key>
This way you secure your data and make sure nobody can tamper with those variables.
Also make sure that when you get a response from Ogone you re-form a SHA hash using the parameters they've send you and you then compare this own-formed SHA hash with the one sent to you by Ogone. If these two match you can be sure that the parameters have not been messed with.
Hope this helps you or others who come across this question.
to work with Ogone Direct Link with an account created after Mai 10, 2010 you will need this patches : https://github.com/Shopify/active_merchant/pull/85
(This also works with accounts created before this date.)
This will also give you more details on the aliases usage, fix some issues with new updates from Ogone, ... make sure to read the inline doc within the ogone gateway code : https://github.com/ZenCocoon/active_merchant/blob/master/lib/active_merchant/billing/gateways/ogone.rb
As of today, the SHA1 is supported and to be used.

Resources