From 4841ddd25b960e3caf6e9b722db90b41a3f97064 Mon Sep 17 00:00:00 2001 From: Victoria Park Date: Tue, 5 Nov 2024 16:43:43 -0800 Subject: [PATCH 01/16] v2 migration guide --- v2_MIGRATION_GUIDE.md | 198 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 198 insertions(+) create mode 100644 v2_MIGRATION_GUIDE.md diff --git a/v2_MIGRATION_GUIDE.md b/v2_MIGRATION_GUIDE.md new file mode 100644 index 00000000..5dfa0025 --- /dev/null +++ b/v2_MIGRATION_GUIDE.md @@ -0,0 +1,198 @@ +# Migrating from Delegates to Completion Handlers + +## Overview +Version 2.0-beta of the SDK transitions from the delgate-based payment flows to completion handler-based flows. This change simplifies the integration and provides better compatibility with modern async/await patterns. + +### Key Change + +### CardClient Changes + +```swift +// Old Delgate-based +class MyViewController: CardDelegate { + func setupPayment() { + let cardClient = CardClient(config: config) + cardClient.delegate = self + cardClient.approveOrder(request: cardRequest) + } + + func card(_ cardClient: CardClient, didFinishWithResult result: CardResult) { + // Handle success + } + + func card(_ cardClient: CardClient, didFinishWithError error: Error) { + // Handle error + } + + func cardDidCancel(_ cardClient: CardClient) { + // Handle cancellation + } +} + +// New (Completion-based) +class MyViewController { + func setupPayment() { + let cardClient = CardClient(config: config) + cardClient.approveOrder(request: cardRequest) { [weak self] result, error in + if let error = error { + // handle error + return + } + if let result = result { + // handle success + } + } + } +} +``` + +### PayPalWebCheckoutClient Changes + +```Swift +//Old (Delegate-based) +class MyViewController: PayPalWebCheckoutDelegate { + func startPayPalFlow() { + let payPalClient = PayPalWebCheckoutClient(config: config) + payPalClient.delegate = self + payPalClient.approveOrder(request: paypalRequest) + } + + func payPal(_ payPalClient: PayPalWebCheckoutClient, didFinishWithResult result: PayPalWebCheckoutResult) { + // Handle success + } + + func payPal(_ payPalClient: PayPalWebCheckoutClient, didFinishWithError error: Error) { + // Handle error + } + + func payPalDidCancel(_ payPalClient: PayPalCheckoutClient) { + // Handle cancellation + } +} + +// New (Completion-based) +class MyViewController { + func setupPayment() { + let payPalClient = PayPalWebCheckoutClient(config: config) + payPalClient.start(request: paypalRequest) { [weak self] result, error in + if let error = error { + // handle error + return + } + if let result = result { + // handle success + } + } + } +} +``` + +## Async/Await +The SDK now provides async/await support, offering a more concise way to handle asynchronous operations. + +### CardClient +```swift +class MyViewController { + func setupPayment() async { + let cardClient = CardClient(config: config) + do { + let result = try await cardClient.approveOrder(request: cardRequest) + // payment successful + handleSuccess(result) + } catch let error as CardClientError { + switch error { + case .threeDSecureCancellation: + handleCancellation() + default: + handleError(error) + } + } catch { + handleError(error) + } + } +} +``` + +### PayPalWebCheckoutClient +```swift +class MyViewController { + func startPayPalFlow() async { + let payPalClient = PayPalWebCheckoutClient(config: config) + do { + let result = try await payPalClient.start(request: paypalRequest) + /// Payment successful + handleSuccess(result) + } catch let error as PayPalWebCheckoutClientError { + switch error { + case .paypalCancellationError: + handleCancellation() + default: + handleError(error) + } + } catch { + handleError(error) + } + } +} +``` + +## Migration Steps + +### 1. Update SDK Version +- Update your dependency manager (CocoapPods, SPM, etc.) to the latest SDK version + +### 2. Remove Delegate Implementation +```swift +// Remove delegate protocol confirmance +- class MyViewController: CardDelegate { ++ class MyViewController { + +/// Remove delegate property assignment +-cardClient.delegate = self + +// Remove delegate methods +- func card(_ cardClient: CardClient, didFinishWithResult result: CardResult) { +- func card(_ cardClient: CardCliet, didFinishWithError error: Error) { +- func cardDidCancel(_ cardClient: CardClient ) { +``` + +### 3. Update SDK Flow Implementation +```swift +// Option 1: Using completion handlers +func processPayment() { + showLaodingIndicator() + + cardClient.approveORder(request: cardRequest) { [weak self] result, error in + guard let self = self else { return } + removeLoadingIndicator() + + if let error = error { + switch error { + case CardClientError.threeDSecureCancellation: + handleCancellation() + default: + handleError(erorr) + } + return + } + + if let result = result { + handleSuccess(result) + } + } +} +``` +// Option 2: Using async/await +```swift +func processPayment() async { + showLaodingIndicator() + defer { removeLoadingIndicator() } + + do { + let result = try await cardClient.approveOrder(request: cardReuqest) + handleSuccess(result) + } catch { + handleError(error) + } +} +``` \ No newline at end of file From 87f31110c24ebc21bb1b97261a0de46f30754897 Mon Sep 17 00:00:00 2001 From: Victoria Park Date: Tue, 5 Nov 2024 16:47:19 -0800 Subject: [PATCH 02/16] just cocoapods or SPM --- v2_MIGRATION_GUIDE.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/v2_MIGRATION_GUIDE.md b/v2_MIGRATION_GUIDE.md index 5dfa0025..d83ac6b9 100644 --- a/v2_MIGRATION_GUIDE.md +++ b/v2_MIGRATION_GUIDE.md @@ -139,7 +139,7 @@ class MyViewController { ## Migration Steps ### 1. Update SDK Version -- Update your dependency manager (CocoapPods, SPM, etc.) to the latest SDK version +- Update your dependency manager (CocoapPods or SPM) to the latest SDK version ### 2. Remove Delegate Implementation ```swift @@ -195,4 +195,4 @@ func processPayment() async { handleError(error) } } -``` \ No newline at end of file +``` From 66fc28f6b8d21fccfa6d02b9923e5cd1d2946e89 Mon Sep 17 00:00:00 2001 From: Victoria Park Date: Tue, 5 Nov 2024 16:55:56 -0800 Subject: [PATCH 03/16] fix typos --- v2_MIGRATION_GUIDE.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/v2_MIGRATION_GUIDE.md b/v2_MIGRATION_GUIDE.md index d83ac6b9..87dd39a1 100644 --- a/v2_MIGRATION_GUIDE.md +++ b/v2_MIGRATION_GUIDE.md @@ -3,7 +3,7 @@ ## Overview Version 2.0-beta of the SDK transitions from the delgate-based payment flows to completion handler-based flows. This change simplifies the integration and provides better compatibility with modern async/await patterns. -### Key Change +### Key Changes ### CardClient Changes @@ -139,11 +139,11 @@ class MyViewController { ## Migration Steps ### 1. Update SDK Version -- Update your dependency manager (CocoapPods or SPM) to the latest SDK version +- Update your dependency manager (CocoaPods or SPM) to the latest SDK version ### 2. Remove Delegate Implementation ```swift -// Remove delegate protocol confirmance +// Remove delegate protocol conformance - class MyViewController: CardDelegate { + class MyViewController { @@ -152,7 +152,7 @@ class MyViewController { // Remove delegate methods - func card(_ cardClient: CardClient, didFinishWithResult result: CardResult) { -- func card(_ cardClient: CardCliet, didFinishWithError error: Error) { +- func card(_ cardClient: CardClient, didFinishWithError error: Error) { - func cardDidCancel(_ cardClient: CardClient ) { ``` @@ -160,9 +160,9 @@ class MyViewController { ```swift // Option 1: Using completion handlers func processPayment() { - showLaodingIndicator() + showLoadingIndicator() - cardClient.approveORder(request: cardRequest) { [weak self] result, error in + cardClient.approveOrder(request: cardRequest) { [weak self] result, error in guard let self = self else { return } removeLoadingIndicator() @@ -171,7 +171,7 @@ func processPayment() { case CardClientError.threeDSecureCancellation: handleCancellation() default: - handleError(erorr) + handleError(error) } return } @@ -189,7 +189,7 @@ func processPayment() async { defer { removeLoadingIndicator() } do { - let result = try await cardClient.approveOrder(request: cardReuqest) + let result = try await cardClient.approveOrder(request: cardRequest) handleSuccess(result) } catch { handleError(error) From 97062705b9afe6d639876cba5aeb550c829eff4d Mon Sep 17 00:00:00 2001 From: Victoria Park Date: Tue, 5 Nov 2024 19:56:30 -0800 Subject: [PATCH 04/16] minor spacing changes --- v2_MIGRATION_GUIDE.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/v2_MIGRATION_GUIDE.md b/v2_MIGRATION_GUIDE.md index 87dd39a1..38b472b5 100644 --- a/v2_MIGRATION_GUIDE.md +++ b/v2_MIGRATION_GUIDE.md @@ -1,7 +1,7 @@ # Migrating from Delegates to Completion Handlers ## Overview -Version 2.0-beta of the SDK transitions from the delgate-based payment flows to completion handler-based flows. This change simplifies the integration and provides better compatibility with modern async/await patterns. +Version 2.0-beta of the SDK transitions from the delgate-based flows to completion handler-based flows. This change simplifies the integration and provides better compatibility with modern async/await patterns. ### Key Changes @@ -49,7 +49,7 @@ class MyViewController { ### PayPalWebCheckoutClient Changes ```Swift -//Old (Delegate-based) +// Old (Delegate-based) class MyViewController: PayPalWebCheckoutDelegate { func startPayPalFlow() { let payPalClient = PayPalWebCheckoutClient(config: config) @@ -120,7 +120,7 @@ class MyViewController { let payPalClient = PayPalWebCheckoutClient(config: config) do { let result = try await payPalClient.start(request: paypalRequest) - /// Payment successful + // Payment successful handleSuccess(result) } catch let error as PayPalWebCheckoutClientError { switch error { @@ -147,7 +147,7 @@ class MyViewController { - class MyViewController: CardDelegate { + class MyViewController { -/// Remove delegate property assignment +// Remove delegate property assignment -cardClient.delegate = self // Remove delegate methods @@ -157,8 +157,9 @@ class MyViewController { ``` ### 3. Update SDK Flow Implementation + + Option 1: Using completion handlers ```swift -// Option 1: Using completion handlers func processPayment() { showLoadingIndicator() @@ -182,7 +183,7 @@ func processPayment() { } } ``` -// Option 2: Using async/await + Option 2: Using async/await ```swift func processPayment() async { showLaodingIndicator() From bb4b85f859c3b1d1b13a4179214c9e0b76645c13 Mon Sep 17 00:00:00 2001 From: Victoria Park Date: Thu, 7 Nov 2024 07:10:33 -0800 Subject: [PATCH 05/16] Update with simplified cancel errors --- v2_MIGRATION_GUIDE.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/v2_MIGRATION_GUIDE.md b/v2_MIGRATION_GUIDE.md index 38b472b5..3402ae69 100644 --- a/v2_MIGRATION_GUIDE.md +++ b/v2_MIGRATION_GUIDE.md @@ -101,7 +101,7 @@ class MyViewController { handleSuccess(result) } catch let error as CardClientError { switch error { - case .threeDSecureCancellation: + case .canceled: handleCancellation() default: handleError(error) @@ -124,7 +124,7 @@ class MyViewController { handleSuccess(result) } catch let error as PayPalWebCheckoutClientError { switch error { - case .paypalCancellationError: + case .checkoutCanceled: handleCancellation() default: handleError(error) @@ -169,7 +169,7 @@ func processPayment() { if let error = error { switch error { - case CardClientError.threeDSecureCancellation: + case CardClientError.canceled: handleCancellation() default: handleError(error) From 6c9280b9ccdfc66213f5085698b8268cc514be8c Mon Sep 17 00:00:00 2001 From: Victoria Park Date: Thu, 7 Nov 2024 07:18:57 -0800 Subject: [PATCH 06/16] Steven PR feedback - diff to render green/red --- v2_MIGRATION_GUIDE.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/v2_MIGRATION_GUIDE.md b/v2_MIGRATION_GUIDE.md index 3402ae69..8bd75fd9 100644 --- a/v2_MIGRATION_GUIDE.md +++ b/v2_MIGRATION_GUIDE.md @@ -142,14 +142,15 @@ class MyViewController { - Update your dependency manager (CocoaPods or SPM) to the latest SDK version ### 2. Remove Delegate Implementation -```swift +```diff // Remove delegate protocol conformance - class MyViewController: CardDelegate { + class MyViewController { // Remove delegate property assignment -cardClient.delegate = self - +``` +```swift // Remove delegate methods - func card(_ cardClient: CardClient, didFinishWithResult result: CardResult) { - func card(_ cardClient: CardClient, didFinishWithError error: Error) { From 4bebe55e786a278e209275230a7ae81bccac9569 Mon Sep 17 00:00:00 2001 From: Victoria Park Date: Thu, 7 Nov 2024 07:21:18 -0800 Subject: [PATCH 07/16] include removal of delegate methods in delete block --- v2_MIGRATION_GUIDE.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/v2_MIGRATION_GUIDE.md b/v2_MIGRATION_GUIDE.md index 8bd75fd9..9dc73d4e 100644 --- a/v2_MIGRATION_GUIDE.md +++ b/v2_MIGRATION_GUIDE.md @@ -149,8 +149,7 @@ class MyViewController { // Remove delegate property assignment -cardClient.delegate = self -``` -```swift + // Remove delegate methods - func card(_ cardClient: CardClient, didFinishWithResult result: CardResult) { - func card(_ cardClient: CardClient, didFinishWithError error: Error) { From 251e8ceb47354d25d645c9d0972f3bf022add3ff Mon Sep 17 00:00:00 2001 From: Victoria Park Date: Thu, 7 Nov 2024 08:44:21 -0800 Subject: [PATCH 08/16] update with cardClient threeDSecureCanceled error --- v2_MIGRATION_GUIDE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/v2_MIGRATION_GUIDE.md b/v2_MIGRATION_GUIDE.md index 9dc73d4e..8a945e35 100644 --- a/v2_MIGRATION_GUIDE.md +++ b/v2_MIGRATION_GUIDE.md @@ -101,7 +101,7 @@ class MyViewController { handleSuccess(result) } catch let error as CardClientError { switch error { - case .canceled: + case .threeDSecureCanceled: handleCancellation() default: handleError(error) From 82268a7bd6de359c18eea5b271f83f252c52c0bf Mon Sep 17 00:00:00 2001 From: Victoria Park Date: Thu, 7 Nov 2024 08:58:28 -0800 Subject: [PATCH 09/16] change to threeDSecureCanceled in migration steps --- v2_MIGRATION_GUIDE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/v2_MIGRATION_GUIDE.md b/v2_MIGRATION_GUIDE.md index 8a945e35..16935ca7 100644 --- a/v2_MIGRATION_GUIDE.md +++ b/v2_MIGRATION_GUIDE.md @@ -169,7 +169,7 @@ func processPayment() { if let error = error { switch error { - case CardClientError.canceled: + case CardClientError.threeDSecureCanceled: handleCancellation() default: handleError(error) From 7c478c8628243739f8afd7eb27529ba5cfbca8e0 Mon Sep 17 00:00:00 2001 From: Victoria Park Date: Fri, 8 Nov 2024 11:00:56 -0800 Subject: [PATCH 10/16] add comment highlighting cancellation errors --- v2_MIGRATION_GUIDE.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/v2_MIGRATION_GUIDE.md b/v2_MIGRATION_GUIDE.md index 16935ca7..01cbcab3 100644 --- a/v2_MIGRATION_GUIDE.md +++ b/v2_MIGRATION_GUIDE.md @@ -5,6 +5,9 @@ Version 2.0-beta of the SDK transitions from the delgate-based flows to completi ### Key Changes +### Important Cahnge: Cancellation Handling +In v2.0-beta, cancellations (e.g., 3DS cancellations, PayPal web flow cancellations) are now returned as errors rather than as separate delegate methods. + ### CardClient Changes ```swift From cc95a8750cc42d881bebdc9591ee273b905aa024 Mon Sep 17 00:00:00 2001 From: Victoria Park Date: Fri, 8 Nov 2024 11:05:38 -0800 Subject: [PATCH 11/16] typo fix --- v2_MIGRATION_GUIDE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/v2_MIGRATION_GUIDE.md b/v2_MIGRATION_GUIDE.md index 01cbcab3..59fc90ae 100644 --- a/v2_MIGRATION_GUIDE.md +++ b/v2_MIGRATION_GUIDE.md @@ -5,7 +5,7 @@ Version 2.0-beta of the SDK transitions from the delgate-based flows to completi ### Key Changes -### Important Cahnge: Cancellation Handling +### Important Change: Cancellation Handling In v2.0-beta, cancellations (e.g., 3DS cancellations, PayPal web flow cancellations) are now returned as errors rather than as separate delegate methods. ### CardClient Changes From d047ffe8339ffc67763a840f3b15874a2485403e Mon Sep 17 00:00:00 2001 From: Victoria Park Date: Fri, 8 Nov 2024 12:31:42 -0800 Subject: [PATCH 12/16] clarify separating cancel cases in errors --- v2_MIGRATION_GUIDE.md | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/v2_MIGRATION_GUIDE.md b/v2_MIGRATION_GUIDE.md index 59fc90ae..48b3a567 100644 --- a/v2_MIGRATION_GUIDE.md +++ b/v2_MIGRATION_GUIDE.md @@ -102,15 +102,14 @@ class MyViewController { let result = try await cardClient.approveOrder(request: cardRequest) // payment successful handleSuccess(result) - } catch let error as CardClientError { + } catch { switch error { - case .threeDSecureCanceled: + // separate handling of cancel error if needed + case CardClientError.threeDSecureCanceled: handleCancellation() default: handleError(error) } - } catch { - handleError(error) } } } @@ -125,15 +124,14 @@ class MyViewController { let result = try await payPalClient.start(request: paypalRequest) // Payment successful handleSuccess(result) - } catch let error as PayPalWebCheckoutClientError { + } catch { switch error { - case .checkoutCanceled: + // separate handling of cancel error if needed + case PayPalWebCheckoutClientError.checkoutCanceled: handleCancellation() default: handleError(error) } - } catch { - handleError(error) } } } @@ -196,7 +194,12 @@ func processPayment() async { let result = try await cardClient.approveOrder(request: cardRequest) handleSuccess(result) } catch { - handleError(error) + switch error { + case CardClient.threeDSecureCanceled: + handleCancellation() + default: + handleError(error) + } } } ``` From 7e99123b0461d7253bb14eed0960a2a2ea575759 Mon Sep 17 00:00:00 2001 From: Victoria Park Date: Sat, 9 Nov 2024 20:12:07 -0800 Subject: [PATCH 13/16] revert cancel handling instructions --- v2_MIGRATION_GUIDE.md | 30 ++++-------------------------- 1 file changed, 4 insertions(+), 26 deletions(-) diff --git a/v2_MIGRATION_GUIDE.md b/v2_MIGRATION_GUIDE.md index 48b3a567..f3a3ab6a 100644 --- a/v2_MIGRATION_GUIDE.md +++ b/v2_MIGRATION_GUIDE.md @@ -103,13 +103,7 @@ class MyViewController { // payment successful handleSuccess(result) } catch { - switch error { - // separate handling of cancel error if needed - case CardClientError.threeDSecureCanceled: - handleCancellation() - default: - handleError(error) - } + handleError(error) } } } @@ -125,13 +119,7 @@ class MyViewController { // Payment successful handleSuccess(result) } catch { - switch error { - // separate handling of cancel error if needed - case PayPalWebCheckoutClientError.checkoutCanceled: - handleCancellation() - default: - handleError(error) - } + handleError() } } } @@ -169,12 +157,7 @@ func processPayment() { removeLoadingIndicator() if let error = error { - switch error { - case CardClientError.threeDSecureCanceled: - handleCancellation() - default: - handleError(error) - } + handleError() return } @@ -194,12 +177,7 @@ func processPayment() async { let result = try await cardClient.approveOrder(request: cardRequest) handleSuccess(result) } catch { - switch error { - case CardClient.threeDSecureCanceled: - handleCancellation() - default: - handleError(error) - } + handleError() } } ``` From 51daa8e8d7b4fc9cc8adce951d7733965e95ec0f Mon Sep 17 00:00:00 2001 From: Victoria Park Date: Wed, 13 Nov 2024 07:14:53 -0800 Subject: [PATCH 14/16] add changes for cancellation helper methods --- v2_MIGRATION_GUIDE.md | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/v2_MIGRATION_GUIDE.md b/v2_MIGRATION_GUIDE.md index f3a3ab6a..4a15fef1 100644 --- a/v2_MIGRATION_GUIDE.md +++ b/v2_MIGRATION_GUIDE.md @@ -6,7 +6,10 @@ Version 2.0-beta of the SDK transitions from the delgate-based flows to completi ### Key Changes ### Important Change: Cancellation Handling -In v2.0-beta, cancellations (e.g., 3DS cancellations, PayPal web flow cancellations) are now returned as errors rather than as separate delegate methods. +In v2.0-beta, cancellations (e.g., 3DS cancellations, PayPal web flow cancellations) are now returned as errors rather than as separate delegate methods. There are new helper methods, static functions, to help you discern threeDSecure cancellation errors and PayPal web flow cancellation errors. +- `CardError.threeDSecureCanceled(Error)` will return true for user cancellation during 3DS verification during card payment or card vaulting flows. +- `PayPalError.isCheckoutCaceled(Error)` will return true for user cancellation during PayPalWebCheckout session. +- `PayPalError.isVaultCanceled(Error)` will return true for user cancellation during PayPal vault session. ### CardClient Changes @@ -38,9 +41,14 @@ class MyViewController { let cardClient = CardClient(config: config) cardClient.approveOrder(request: cardRequest) { [weak self] result, error in if let error = error { - // handle error + // if threeDSecure is canceled by user + if CardError.isThreeDSecureCanceled(error) { + // handle cancel error + } else { + // handle other errors + } return - } + } if let result = result { // handle success } @@ -79,7 +87,12 @@ class MyViewController { let payPalClient = PayPalWebCheckoutClient(config: config) payPalClient.start(request: paypalRequest) { [weak self] result, error in if let error = error { - // handle error + // if PayPal webflow is canceled by user + if PayPalError.isCheckoutCanceled(error) { + // handle cancel error + } else { + // handle all other errors + } return } if let result = result { From 0b6ee2b3ad3662f9dc8edad5689187421449d213 Mon Sep 17 00:00:00 2001 From: Victoria Park Date: Wed, 13 Nov 2024 07:23:25 -0800 Subject: [PATCH 15/16] fix typo in PayPalError.isCheckoutCanceled --- v2_MIGRATION_GUIDE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/v2_MIGRATION_GUIDE.md b/v2_MIGRATION_GUIDE.md index 4a15fef1..a118851d 100644 --- a/v2_MIGRATION_GUIDE.md +++ b/v2_MIGRATION_GUIDE.md @@ -8,7 +8,7 @@ Version 2.0-beta of the SDK transitions from the delgate-based flows to completi ### Important Change: Cancellation Handling In v2.0-beta, cancellations (e.g., 3DS cancellations, PayPal web flow cancellations) are now returned as errors rather than as separate delegate methods. There are new helper methods, static functions, to help you discern threeDSecure cancellation errors and PayPal web flow cancellation errors. - `CardError.threeDSecureCanceled(Error)` will return true for user cancellation during 3DS verification during card payment or card vaulting flows. -- `PayPalError.isCheckoutCaceled(Error)` will return true for user cancellation during PayPalWebCheckout session. +- `PayPalError.isCheckoutCanceled(Error)` will return true for user cancellation during PayPalWebCheckout session. - `PayPalError.isVaultCanceled(Error)` will return true for user cancellation during PayPal vault session. ### CardClient Changes From 86d6afec4cfb2cbe211ffd9899102d682b627ce8 Mon Sep 17 00:00:00 2001 From: Victoria Park Date: Wed, 13 Nov 2024 08:57:45 -0800 Subject: [PATCH 16/16] Steven PR feedback --- v2_MIGRATION_GUIDE.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/v2_MIGRATION_GUIDE.md b/v2_MIGRATION_GUIDE.md index a118851d..07fff905 100644 --- a/v2_MIGRATION_GUIDE.md +++ b/v2_MIGRATION_GUIDE.md @@ -1,13 +1,13 @@ # Migrating from Delegates to Completion Handlers ## Overview -Version 2.0-beta of the SDK transitions from the delgate-based flows to completion handler-based flows. This change simplifies the integration and provides better compatibility with modern async/await patterns. +Version 2.0 of the SDK transitions from delgate-based flows to completion handler-based flows. This change simplifies the integration and provides better compatibility with modern async/await patterns. ### Key Changes ### Important Change: Cancellation Handling -In v2.0-beta, cancellations (e.g., 3DS cancellations, PayPal web flow cancellations) are now returned as errors rather than as separate delegate methods. There are new helper methods, static functions, to help you discern threeDSecure cancellation errors and PayPal web flow cancellation errors. -- `CardError.threeDSecureCanceled(Error)` will return true for user cancellation during 3DS verification during card payment or card vaulting flows. +In v2.0, cancellations (e.g., 3DS cancellations, PayPal web flow cancellations) are now returned as errors rather than as separate delegate methods. There are new helper static functions, to help you discern threeDSecure cancellation errors and PayPal web flow cancellation errors. +- `CardError.threeDSecureCanceled(Error)` will return true for 3DS cancellation errors received during card payment or card vaulting flows. - `PayPalError.isCheckoutCanceled(Error)` will return true for user cancellation during PayPalWebCheckout session. - `PayPalError.isVaultCanceled(Error)` will return true for user cancellation during PayPal vault session. @@ -183,7 +183,7 @@ func processPayment() { Option 2: Using async/await ```swift func processPayment() async { - showLaodingIndicator() + showLoadingIndicator() defer { removeLoadingIndicator() } do {