Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixe IOS issues #141

Merged
merged 3 commits into from
Sep 14, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions packages/nativescript-stripe/standard/index.ios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,15 @@ class StripePaymentDelegate extends NSObject implements STPPaymentContextDelegat
paymentContextDidCreatePaymentResultCompletion(paymentContext: STPPaymentContext, paymentResult: STPPaymentResult, completion: (p1: STPPaymentStatus, p2: NSError) => void): void {
StripeStandardConfig.shared.backendAPI
.capturePayment(paymentResult.paymentMethod.stripeId, paymentContext.paymentAmount, createShippingMethod(paymentContext), createAddress(paymentContext.shippingAddress))
.then((value) => {
completion(STPPaymentStatus.Success, null);
.then((value: any) => {
if(!value._native.lastPaymentError || value._native.lastPaymentError == "undefined") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kefahB @triniwiz I'm having trouble with this change. Every payment fails with the error originating from this line:
Cannot read property 'lastPaymentError' of undefined

In my case, the variable "value" is the result of the promise returned from capturePayment defined in my own code. This is referring to a _native property which my promise doesn't return. Seems like this line of code is supposed to call something else internal to the Stripe pod to get the lastPaymentError?

completion(STPPaymentStatus.Success, null);
return
}
completion(STPPaymentStatus.UserCancellation, null);
})
.catch((e) => {
completion(null, createError('PaymentError', 100, e));
completion(STPPaymentStatus.Error, createError('PaymentError', 100, e));
});
}

Expand Down