Balanced payments API test marketplace bank account verification - ruby-on-rails

I am trying to verify a bank account on a TEST marketplace. I am using the Ruby client to work with the Balanced API.
I am creating a bank account with the test routing/account number. I then create a verification and finally confirm it using amount_1 = 1 and amount_2 = 1.
If I look in my marketplace logs everything looks great. All requests are 200, and I see the response from the confirmation as "succeeded" except the marketplace dashboard still shows the verification as pending.
If I try to debit the account it fails because
funding-source-not-debitable: Funding instrument cannot be debited
which I've been told is because it's not verified.
I'm not sure what else to try as the logs show it's working, but everything else acts as if it's not verified.
My Ruby code looks like this:
#account = Balanced::BankAccount.fetch("/bank_accounts/#{balanced_id}")
#for test marketplace auto verify
if !Rails.env.production?
verification = #account.verify
verification.confirm(
amount_1 = 1,
amount_2 = 1
)
end

That is the correct syntax, however, I believe you are later associating this bank account to a customer. Doing so resets the can_debit field to False. You should therefore associate your customer before creating a verification.

Related

Microsoft Graph returning Resource Not Found

I've registered an app in Azure AD and given it API permissions(both Application and delegated) to read all AD groups (Group.Read.All, also Directory.Read.All etc). Using this app I am using Graph Service Client to make a call to get user's AD groups.
public async Task<IEnumerable<GroupInfo>> GetAllGroupsOfUser(string mail)
{
IList<GroupInfo> result = new List<GroupInfo>();
IUserMemberOfCollectionWithReferencesPage memberOfGroups = await _graphServiceClient.Users[mail].MemberOf.Request().GetAsync();
.......... More code ........
}
It works fine for most of the users email but for few emails, which are present in the active directory, I'm getting the following exception
Code: Request_ResourceNotFound Message: Resource 'someuser#somedomain.co' does not exist or one of its queried reference-property objects are not present.
Your error is not that you lack certain permissions, and it has nothing to do with which api testing tool you are using. Your error is very simple. As your error message says, it is that you entered the wrong user email.
Your error message has clearly stated that there is no'someuser#somedomain.co' email, because this is not a correct email, it should be .com instead of .co.
So you must make sure that you enter the correct email without special characters or spaces.
This is my test result:
1.
2.

How to handle payment success in stripe?

After a user visits the payments page and successfully makes a payment, Stripe will redirect the customer to whatever url is provided to success_url
Stripe.api_key = 'sk_test_51HYHSFGtUKse83O9J4QeAib3cp8sHzGaOQRrn7sba92Hd8dCHE3AIHe5ModevMK7TVAUCyJU0ADSwIUoX00qxZmBI9r'
session = Stripe::Checkout::Session.create({
payment_method_types: ['card'],
line_items: [{
name: 'Kavholm rental',
amount: 1000,
currency: 'aud',
quantity: 1,
}],
payment_intent_data: {
application_fee_amount: 123,
transfer_data: {
destination: '{{CONNECTED_STRIPE_ACCOUNT_ID}}',
},
},
success_url: 'https://example.com/success',
cancel_url: 'https://example.com/failure',
})
Now the app/platform must arrange 'fulfillment':
After the payment is completed, you’ll need to handle any fulfillment necessary on your end. A home-rental company that requires payment upfront, for instance, would connect the homeowner with the renter after a successful payment.
Also (bold from me):
Do not rely on the redirect to the success_url param alone for fulfilling purchases as:
Malicious users could directly access the success_url without paying and gain access to your goods or services.
Customers may not always reach the success_url after a successful payment. It is possible they close their browser tab before the redirect occurs.
Up to this point, everything is very well explained in the stripe docs and very understandable.
But I want to know: what is the best thing to do next, noting that:
a payment may not go through immediately, so simply loading the success_url might be premature
a webhook can be (easily) configured to listen for events, however if the success_url is loaded even 1 second before the webhook receives a success message, then it won't know that the payment went through successfully (so, for example, displaying "Congrats, your product will be shipped!" message could be presumptuous
Question
So, finally, the question: what is best practice for the flow on from success_url? I am just confused as to what is the best pattern..
Ideas
Here are some things I've considered:
Upon routing to success_url, simply use sleep(5) and then check the webhook in the controller for the success_url so it takes 5 extra seconds to load giving the webhook a chance to receive incoming events, so you can display either "Congrats your product will be shipped!" or "Oh, no, something went wrong with your payment, please try again or contact your bank".
Routing directly to success_url, but then having a message saying "please refresh in a moment" (then listening for a webhook indicating the payment was successful, and then conditionally showing the "Congrats your product will be shipped!" message)
The documentation for fulfilling orders has this in an info box under the code snippet:
Your webhook endpoint redirects your customer to the success_url when you acknowledge you received the event. In scenarios where your endpoint is down or the event isn’t acknowledged properly, your handler redirects the customer to the success_url 10 seconds after a successful payment.
The event referenced above is the checkout.session.completed event sent to your webhook endpoint. The delay is designed to let you confirm the payment is successful and customize the success page based on the result of the Checkout Session's outcome.
In other words, Checkout won't send someone to your success_url until you've responded to the checkout.session.completed event request from your webhook endpoint with a successful (2xx) response, giving you time to customize the success page based on the outcome.
You can, for example, default to a "your payment is being processed" success page, but if you confirm the Checkout Session and payment succeeded after receiving the checkout.session.completed event, you can instead change the page to read "congrats your product will be shipped".
This approach means you can reliably present a success page that always has displays accurate information.

Paypal invalid token error when creating a recurring payment profile

I am trying to setup a recurring payment profile via the ExpressCheckout API of Paypal in Ruby on Rails with the help of paypal-express gem but i keep getting error code 11502 (Invalid token) => Paypal error code documentation
The documentation is a bit unclear because there it is not saying what's missing:
One or more subscription detail fields are missing from the request.
I have checked the required field in the documentation here but i don't think i missed any. No need for shipping details as we don't ship a product.
Here is a log of what is being sent to Paypal when i am doing the checkout and then creating the recurring profile:
SetExpressCheckout
Parameters:
{:RETURNURL=>"http://localhost:3000/paypal/validate",
:CANCELURL=>"http://localhost:3000/paypal/cancel",
:REQCONFIRMSHIPPING=>0, :NOSHIPPING=>1, :ALLOWNOTE=>0,
:PAYMENTREQUEST_0_AMT=>"88.00", :PAYMENTREQUEST_0_TAXAMT=>"0.00",
:PAYMENTREQUEST_0_SHIPPINGAMT=>"0.00",
:PAYMENTREQUEST_0_CURRENCYCODE=>"HKD", :PAYMENTREQUEST_0_DESC=>"Plus x
2-month subscription x 2 staff", :LOCALECODE=>:fr}
Response:
TOKEN=EC%2d0H440138VJ9552235&TIMESTAMP=2015%2d04%2d25T08%3a38%3a42Z&CORRELATIONID>=48742557da98&ACK=Success&VERSION=88%2e0&BUILD=16428450
CreateRecurringPaymentsProfile
Parameters:
{:TOKEN=>"EC-0H440138VJ9552235", :BILLINGPERIOD=>:Month,
:BILLINGFREQUENCY=>2, :TOTALBILLINGCYCLES=>0, :AMT=>"88.00",
:CURRENCYCODE=>"HKD", :SHIPPINGAMT=>"0.00", :TAXAMT=>"0.00",
:DESC=>"Plus x 2-month subscription x 2 staff", :MAXFAILEDPAYMENTS=>0,
:PROFILESTARTDATE=>"2015-04-25 16:39:24"}
Response:
TIMESTAMP=2015%2d04%2d25T08%3a39%3a26Z&CORRELATIONID=533964ff183a1&ACK=Failure&VE>RSION=88%2e0&BUILD=16398710&L_ERRORCODE0=11502&L_SHORTMESSAGE0=Invalid%20Token&L_>LONGMESSAGE0=The
%20token%20is%20invalid&L_SEVERITYCODE0=Error
Do you guys have any ideas of what could be wrong? I can execute a payment without any issue, the issue appear when creating a recurring profile.
Never mind!
I found what was wrong misread the gem wiki (https://github.com/nov/paypal-express/wiki/Recurring-Payment) and mistakenly mix instant payment request with recurring profile creation so there was no billing_agreement_description nor billing_agreements in the data sent to paypal...

Bigcommerce - How to request Authorization Code/Access Token

In my application, the user when installs the app, needs to fill a registration form. I need to save the access_token along with the user instance.
So, if the user is unregistered, I redirect to the signup form ie. I dont save the access_token, but at this time, the app is registered. Which means, suppose when the store admin logs back in to the app, he does not get the auth code again, but gets signed_payload.
Since, I dont want to store, unregistered users on my database, I prefer calling a api, that would grant me auth code and/or access_token.
Is there any such call I can make?
To answer your question, the access token can only be obtained at the point of the initial app install, when the user installs the app for the very first time. This is the only time that BigCommerce will send the information required to obtain the access token.
Therefore your app should always save the access_token at the point of install. Your registration page should be prompted after obtaining and saving the access token. If for some reason the user installs the app and does not complete the registration, then you should simply just check on your end if the registration was finished or not, and if it wasn't then you should display it during the app load phase as a requirement before displaying your main app dashboard.
Since you didn't specify a programming language, I'm going to illustrate one in Python.
There are two parts you mentioned, registration/access token and signed payload.
The initial callback flow would look something like this:
#app.route('/bigcommerce/callback')
def auth_callback():
# Put together params for token request
code = flask.request.args['code']
context = flask.request.args['context']
scope = flask.request.args['scope']
store_hash = context.split('/')[1]
redirect = app.config['APP_URL'] + flask.url_for('auth_callback')
# Fetch a permanent oauth token. This will throw an exception on error,
# which will get caught by our error handler above.
client = BigcommerceApi(client_id=client_id(), store_hash=store_hash)
token = client.oauth_fetch_token(client_secret(), code, context, scope, redirect)
bc_user_id = token['user']['id']
email = token['user']['email']
access_token = token['access_token']
The flow using a signed payload would look something like:
#app.route('/bigcommerce/load')
def load():
# Decode and verify payload
payload = flask.request.args['signed_payload']
user_data = BigcommerceApi.oauth_verify_payload(payload, client_secret())
if user_data is False:
return "Payload verification failed!", 401
bc_user_id = user_data['user']['id']
email = user_data['user']['email']
store_hash = user_data['store_hash']
When initially creating a user in your database, you can also denote the sign up date through a function of your code and then do a periodic cron job to check if they have a registered account with you. There's not an endpoint where we store whether they completed registration with you since that is a function of your app.

QuickBooks Target is not reimbursable creating a check

VB.2010, QBFC12, Windows 7, QuickBooks 2010 Premier and Enterprise 14
When trying to create a check for expense accounts with non-billable and a customer name we get a error from QuickBooks
Status: Code = 3210, Message = The "billable status" field has an invalid value "NotBillable". QuickBooks error message: Target is not reimbursable., Severity = Error
It seems that it depends upon the account. But every account we try is defined the same in QB. All Expense accounts and the name. Nothing else is defined in the Edit Account.
What does this error really mean?
What is the 'target'?
How can I get it to create the Check with it marked Non-billable?
It is really strange. It seems that it can depend on which account even thought they are all defined the same.
Can any shed some light on this?

Resources