Skip to content

Instantly share code, notes, and snippets.

@makirby
Created September 12, 2019 19:42
Show Gist options
  • Save makirby/15684958210f24514b1982cee3b459fa to your computer and use it in GitHub Desktop.
Save makirby/15684958210f24514b1982cee3b459fa to your computer and use it in GitHub Desktop.
iff --git a/node_modules/tipsi-stripe/ios/TPSStripe/TPSStripeManager.m b/node_modules/tipsi-stripe/ios/TPSStripe/TPSStripeManager.m
index 733ec38..97d7dc0 100644
--- a/node_modules/tipsi-stripe/ios/TPSStripe/TPSStripeManager.m
+++ b/node_modules/tipsi-stripe/ios/TPSStripe/TPSStripeManager.m
@@ -358,8 +358,6 @@ - (NSDictionary *)constantsToExport
resolver:(RCTPromiseResolveBlock)resolve
rejecter:(RCTPromiseRejectBlock)reject) {
NSDictionary<TPSStripeType(confirmPaymentIntent), id> *params = untypedParams;
- NSString * returnURL = [RCTConvert NSString:TPSStripeParam(confirmPaymentIntent, returnURL)];
-
STPPaymentIntentParams * parsed = [self extractConfirmPaymentIntentParamsFromDictionary:params];
if(!requestIsCompleted) {
NSDictionary *error = [errorCodes valueForKey:kErrorKeyBusy];
@@ -386,7 +384,7 @@ - (NSDictionary *)constantsToExport
// From example in step 3 of https://stripe.com/docs/payments/payment-intents/ios#manual-confirmation-ios
[[STPPaymentHandler sharedHandler] handleNextActionForPayment:intent.clientSecret
withAuthenticationContext:self
- returnURL:returnURL
+ returnURL:parsed.returnURL
completion:^(STPPaymentHandlerActionStatus status, STPPaymentIntent * intent, NSError * error) {
self->requestIsCompleted = YES;
@@ -471,7 +469,6 @@ - (NSDictionary *)constantsToExport
resolver:(RCTPromiseResolveBlock)resolve
rejecter:(RCTPromiseRejectBlock)reject) {
NSDictionary<TPSStripeType(confirmSetupIntent), id> *params = untypedParams;
- NSString * returnURL = [RCTConvert NSString:TPSStripeParam(confirmSetupIntent, returnURL)];
STPSetupIntentConfirmParams * parsed = [self extractConfirmSetupIntentParamsFromDictionary:params];
if(!requestIsCompleted) {
@@ -499,7 +496,7 @@ - (NSDictionary *)constantsToExport
// From example in step 3 of https://stripe.com/docs/payments/payment-intents/ios#manual-confirmation-ios
[[STPPaymentHandler sharedHandler] handleNextActionForSetupIntent:intent.clientSecret
withAuthenticationContext:self
- returnURL:returnURL
+ returnURL:parsed.returnURL
completion:^(STPPaymentHandlerActionStatus status, STPSetupIntent * intent, NSError * error) {
self->requestIsCompleted = YES;
@@ -987,8 +984,10 @@ - (STPPaymentIntentParams*)extractConfirmPaymentIntentParamsFromDictionary:(NSDi
result.paymentMethodParams = methodParams;
simpleUnpack(sourceId);
- simpleUnpack(returnURL);
result.savePaymentMethod = @([RCTConvert BOOL:params[TPSStripeParam(confirmPaymentIntent, savePaymentMethod)]]);
+ NSString * returnURL = [RCTConvert NSString:params[TPSStripeParam(confirmSetupIntent, returnURL)]];
+ result.returnURL = returnURL;
+ result.useStripeSDK = @YES;
#undef simpleUnpack
return result;
}
@@ -1006,9 +1005,9 @@ - (STPSetupIntentConfirmParams*)extractConfirmSetupIntentParamsFromDictionary:(N
result.paymentMethodID = paymentMethodId;
result.paymentMethodParams = methodParams;
- simpleUnpack(returnURL);
NSString * returnURL = [RCTConvert NSString:params[TPSStripeParam(confirmSetupIntent, returnURL)]];
- result.useStripeSDK = (returnURL == nil || (id)returnURL == NSNull.null || [returnURL isEqualToString:@""] ) ? @YES : @NO;
+ result.returnURL = returnURL;
+ result.useStripeSDK = @YES;
#undef simpleUnpack
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment