diff --git a/CHANGELOG.md b/CHANGELOG.md index d8de4966158..2940691c9b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 13.0.1 2018-05-17 +* Fixes bug in `STPRedirectContext` that'd close the `SFSafariViewController` during the initial redirects, but only in livemode. [#937](https://github.com/stripe/stripe-ios/pull/937) + ## 13.0.0 2018-04-26 * Removes Bitcoin source support. See MIGRATING.md. [#931](https://github.com/stripe/stripe-ios/pull/931) * Adds Masterpass support to `STPSourceParams` [#928](https://github.com/stripe/stripe-ios/pull/928) diff --git a/Example/Custom Integration (ObjC)/SofortExampleViewController.m b/Example/Custom Integration (ObjC)/SofortExampleViewController.m index 24d1eb5d1cb..7578ab53615 100644 --- a/Example/Custom Integration (ObjC)/SofortExampleViewController.m +++ b/Example/Custom Integration (ObjC)/SofortExampleViewController.m @@ -100,31 +100,35 @@ - (void)pay { // your app delegate to forward URLs to the Stripe SDK. // See `[Stripe handleStripeURLCallback:]` self.redirectContext = [[STPRedirectContext alloc] initWithSource:source completion:^(NSString *sourceID, NSString *clientSecret, NSError *error) { - [[STPAPIClient sharedClient] startPollingSourceWithId:sourceID - clientSecret:clientSecret - timeout:10 - completion:^(STPSource *source, NSError *error) { - [self updateUIForPaymentInProgress:NO]; - if (error) { - [self.delegate exampleViewController:self didFinishWithError:error]; - } else { - switch (source.status) { - case STPSourceStatusChargeable: - case STPSourceStatusConsumed: - [self.delegate exampleViewController:self didFinishWithMessage:@"Payment successfully created"]; - break; - case STPSourceStatusCanceled: - [self.delegate exampleViewController:self didFinishWithMessage:@"Payment failed"]; - break; - case STPSourceStatusPending: - case STPSourceStatusFailed: - case STPSourceStatusUnknown: - [self.delegate exampleViewController:self didFinishWithMessage:@"Order received"]; - break; + if (error) { + [self.delegate exampleViewController:self didFinishWithError:error]; + } else { + [[STPAPIClient sharedClient] startPollingSourceWithId:sourceID + clientSecret:clientSecret + timeout:10 + completion:^(STPSource *source, NSError *error) { + [self updateUIForPaymentInProgress:NO]; + if (error) { + [self.delegate exampleViewController:self didFinishWithError:error]; + } else { + switch (source.status) { + case STPSourceStatusChargeable: + case STPSourceStatusConsumed: + [self.delegate exampleViewController:self didFinishWithMessage:@"Payment successfully created"]; + break; + case STPSourceStatusCanceled: + [self.delegate exampleViewController:self didFinishWithMessage:@"Payment failed"]; + break; + case STPSourceStatusPending: + case STPSourceStatusFailed: + case STPSourceStatusUnknown: + [self.delegate exampleViewController:self didFinishWithMessage:@"Order received"]; + break; + } } - } - self.redirectContext = nil; - }]; + self.redirectContext = nil; + }]; + } }]; [self.redirectContext startRedirectFlowFromViewController:self]; } diff --git a/Example/Custom Integration (ObjC)/ThreeDSExampleViewController.m b/Example/Custom Integration (ObjC)/ThreeDSExampleViewController.m index 605ab6caca5..3fc44e6603d 100644 --- a/Example/Custom Integration (ObjC)/ThreeDSExampleViewController.m +++ b/Example/Custom Integration (ObjC)/ThreeDSExampleViewController.m @@ -129,31 +129,35 @@ - (void)pay { // your app delegate to forwards URLs to the Stripe SDK. // See `[Stripe handleStripeURLCallback:]` self.redirectContext = [[STPRedirectContext alloc] initWithSource:source completion:^(NSString *sourceID, NSString *clientSecret, NSError *error) { - [[STPAPIClient sharedClient] startPollingSourceWithId:sourceID - clientSecret:clientSecret - timeout:10 - completion:^(STPSource *source, NSError *error) { - [self updateUIForPaymentInProgress:NO]; - if (error) { - [self.delegate exampleViewController:self didFinishWithError:error]; - } else { - switch (source.status) { - case STPSourceStatusChargeable: - case STPSourceStatusConsumed: - [self.delegate exampleViewController:self didFinishWithMessage:@"Payment successfully created"]; - break; - case STPSourceStatusCanceled: - [self.delegate exampleViewController:self didFinishWithMessage:@"Payment failed"]; - break; - case STPSourceStatusPending: - case STPSourceStatusFailed: - case STPSourceStatusUnknown: - [self.delegate exampleViewController:self didFinishWithMessage:@"Order received"]; - break; + if (error) { + [self.delegate exampleViewController:self didFinishWithError:error]; + } else { + [[STPAPIClient sharedClient] startPollingSourceWithId:sourceID + clientSecret:clientSecret + timeout:10 + completion:^(STPSource *source, NSError *error) { + [self updateUIForPaymentInProgress:NO]; + if (error) { + [self.delegate exampleViewController:self didFinishWithError:error]; + } else { + switch (source.status) { + case STPSourceStatusChargeable: + case STPSourceStatusConsumed: + [self.delegate exampleViewController:self didFinishWithMessage:@"Payment successfully created"]; + break; + case STPSourceStatusCanceled: + [self.delegate exampleViewController:self didFinishWithMessage:@"Payment failed"]; + break; + case STPSourceStatusPending: + case STPSourceStatusFailed: + case STPSourceStatusUnknown: + [self.delegate exampleViewController:self didFinishWithMessage:@"Order received"]; + break; + } } - } - self.redirectContext = nil; - }]; + self.redirectContext = nil; + }]; + } }]; [self.redirectContext startRedirectFlowFromViewController:self]; } diff --git a/Stripe/STPRedirectContext.m b/Stripe/STPRedirectContext.m index 5146802dd54..77641af18d7 100644 --- a/Stripe/STPRedirectContext.m +++ b/Stripe/STPRedirectContext.m @@ -25,6 +25,8 @@ @interface STPRedirectContext ()