diff --git a/CHANGELOG.md b/CHANGELOG.md index c8bea1fe..ed74e087 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ * Add `vault(vaultRequest:completion(PayPalVaultResult?, Error?) -> Void)` to `PayPalWebCheckoutClient` * Add `start(request:) async throws -> PayPalCheckoutResult` * Add `vault(vaultRequest:) async throws -> PayPalVaultResult` + * Add `.checkoutCanceled` and `.vaultCanceled` to `PayPalWebCheckoutClientError` * CardPayments * Replace delegate pattern with completion handlers and Swift concurrency * Remove `CardDelegate` and `CardVaultDelegate` @@ -22,7 +23,8 @@ * Add `approveOrder(request:completion:(CardResult?, Error?) -> Void)` to `CardClient` * Add `vault(request:completion:(CardVaultResult?, Error?) -> Void)` to `CardClient` * Add `approveOrder(request:) async throws -> CardResult` - * Add `vault(vaultRequest:) async throws -> CardVaultResult` + * Add `vault(vaultRequest:) async throws -> CardVaultResult` + * Add `.threeDSecureCanceled` to `CardClientError` * PayPalWebPayments * Deprecate `PayPalVaultRequest(url:setupTokenID:)` * Add `PayPalVaultRequest(setupTokenID:)` diff --git a/Sources/CardPayments/CardClient.swift b/Sources/CardPayments/CardClient.swift index ab042b1d..9104f5c0 100644 --- a/Sources/CardPayments/CardClient.swift +++ b/Sources/CardPayments/CardClient.swift @@ -170,7 +170,7 @@ public class CardClient: NSObject { if let error = error { switch error { case ASWebAuthenticationSessionError.canceledLogin: - self.notifyCheckoutCancelWithError(with: CardClientError.threeDSecureCancellation, completion: completion) + self.notifyCheckoutCancelWithError(with: CardClientError.threeDSecureCanceled, completion: completion) return default: self.notifyCheckoutFailure(with: CardClientError.threeDSecureError(error), completion: completion) @@ -206,7 +206,7 @@ public class CardClient: NSObject { if let error = error { switch error { case ASWebAuthenticationSessionError.canceledLogin: - self.notifyVaultCancelWithError(with: CardClientError.threeDSecureCancellation, completion: completion) + self.notifyVaultCancelWithError(with: CardClientError.threeDSecureCanceled, completion: completion) return default: self.notifyVaultFailure(with: CardClientError.threeDSecureError(error), completion: completion) diff --git a/Sources/CardPayments/CardClientError.swift b/Sources/CardPayments/CardClientError.swift index d068833b..fa94319b 100644 --- a/Sources/CardPayments/CardClientError.swift +++ b/Sources/CardPayments/CardClientError.swift @@ -39,7 +39,7 @@ enum CardClientError { case malformedDeeplinkURLError /// 10. Cancellation from 3DS verification - case threeDSCancellation + case threeDSCancellationError } static let unknownError = CoreSDKError( @@ -68,10 +68,10 @@ enum CardClientError { errorDescription: "An invalid 3DS URL was returned. Contact developer.paypal.com/support." ) - static let threeDSecureCancellation = CoreSDKError( - code: Code.threeDSCancellation.rawValue, + static let threeDSecureCanceled = CoreSDKError( + code: Code.threeDSCancellationError.rawValue, domain: domain, - errorDescription: "3DS verification has been cancelled by the user." + errorDescription: "3DS verification has been canceled by the user." ) static let noVaultTokenDataError = CoreSDKError( diff --git a/Sources/PayPalWebPayments/PayPalWebCheckoutClient.swift b/Sources/PayPalWebPayments/PayPalWebCheckoutClient.swift index 4f1bde35..228424ed 100644 --- a/Sources/PayPalWebPayments/PayPalWebCheckoutClient.swift +++ b/Sources/PayPalWebPayments/PayPalWebCheckoutClient.swift @@ -64,7 +64,7 @@ public class PayPalWebCheckoutClient: NSObject { switch error { case ASWebAuthenticationSessionError.canceledLogin: self.notifyCheckoutCancelWithError( - with: PayPalWebCheckoutClientError.payPalCancellationError, + with: PayPalWebCheckoutClientError.checkoutCanceled, completion: completion ) return @@ -153,7 +153,7 @@ public class PayPalWebCheckoutClient: NSObject { switch error { case ASWebAuthenticationSessionError.canceledLogin: self.notifyVaultCancelWithError( - with: PayPalWebCheckoutClientError.payPalVaultCancellationError, + with: PayPalWebCheckoutClientError.vaultCanceled, completion: completion ) return diff --git a/Sources/PayPalWebPayments/PayPalWebCheckoutClientError.swift b/Sources/PayPalWebPayments/PayPalWebCheckoutClientError.swift index 8fc0146c..48f32bb0 100644 --- a/Sources/PayPalWebPayments/PayPalWebCheckoutClientError.swift +++ b/Sources/PayPalWebPayments/PayPalWebCheckoutClientError.swift @@ -57,15 +57,15 @@ enum PayPalWebCheckoutClientError { errorDescription: "Error parsing PayPal vault response" ) - static let payPalCancellationError = CoreSDKError( + static let checkoutCanceled = CoreSDKError( code: Code.payPalCancellationError.rawValue, domain: domain, - errorDescription: "PayPal checkout has been cancelled by the user" + errorDescription: "PayPal checkout has been canceled by the user" ) - static let payPalVaultCancellationError = CoreSDKError( + static let vaultCanceled = CoreSDKError( code: Code.payPalVaultCancellationError.rawValue, domain: domain, - errorDescription: "PayPal vault has been cancelled by the user" + errorDescription: "PayPal vault has been canceled by the user" ) } diff --git a/UnitTests/CardPaymentsTests/CardClient_Tests.swift b/UnitTests/CardPaymentsTests/CardClient_Tests.swift index e23065c7..53534faf 100644 --- a/UnitTests/CardPaymentsTests/CardClient_Tests.swift +++ b/UnitTests/CardPaymentsTests/CardClient_Tests.swift @@ -203,8 +203,8 @@ class CardClient_Tests: XCTestCase { XCTAssertNil(result) if let error = error as? CoreSDKError { XCTAssertEqual(error.domain, CardClientError.domain) - XCTAssertEqual(error.code, CardClientError.Code.threeDSCancellation.rawValue) - XCTAssertEqual(error.localizedDescription, CardClientError.threeDSecureCancellation.localizedDescription) + XCTAssertEqual(error.code, CardClientError.Code.threeDSCancellationError.rawValue) + XCTAssertEqual(error.localizedDescription, CardClientError.threeDSecureCanceled.localizedDescription) } else { XCTFail("Expected error to be of type CoreSDKError") } @@ -361,8 +361,8 @@ class CardClient_Tests: XCTestCase { XCTAssertNil(result) if let error = error as? CoreSDKError { XCTAssertEqual(error.domain, CardClientError.domain) - XCTAssertEqual(error.code, CardClientError.threeDSecureCancellation.code) - XCTAssertEqual(error.localizedDescription, CardClientError.threeDSecureCancellation.localizedDescription) + XCTAssertEqual(error.code, CardClientError.threeDSecureCanceled.code) + XCTAssertEqual(error.localizedDescription, CardClientError.threeDSecureCanceled.localizedDescription) } else { XCTFail("Expected error to be of type CoreSDKError") } diff --git a/UnitTests/PayPalWebPaymentsTests/PayPalWebCheckoutClient_Tests.swift b/UnitTests/PayPalWebPaymentsTests/PayPalWebCheckoutClient_Tests.swift index 6b43fa9b..12ca902b 100644 --- a/UnitTests/PayPalWebPaymentsTests/PayPalWebCheckoutClient_Tests.swift +++ b/UnitTests/PayPalWebPaymentsTests/PayPalWebCheckoutClient_Tests.swift @@ -80,7 +80,7 @@ class PayPalClient_Tests: XCTestCase { if let error = error as? CoreSDKError { XCTAssertEqual(error.domain, PayPalWebCheckoutClientError.domain) XCTAssertEqual(error.code, PayPalWebCheckoutClientError.Code.payPalVaultCancellationError.rawValue) - XCTAssertEqual(error.localizedDescription, "PayPal vault has been cancelled by the user") + XCTAssertEqual(error.localizedDescription, "PayPal vault has been canceled by the user") } else { XCTFail("Expected error to be of type CoreSDKError") } @@ -159,8 +159,8 @@ class PayPalClient_Tests: XCTestCase { XCTAssertNil(result) if let error = error as? CoreSDKError { XCTAssertEqual(error.domain, PayPalWebCheckoutClientError.domain) - XCTAssertEqual(error.code, PayPalWebCheckoutClientError.payPalCancellationError.code) - XCTAssertEqual(error.localizedDescription, PayPalWebCheckoutClientError.payPalCancellationError.localizedDescription) + XCTAssertEqual(error.code, PayPalWebCheckoutClientError.checkoutCanceled.code) + XCTAssertEqual(error.localizedDescription, PayPalWebCheckoutClientError.checkoutCanceled.localizedDescription) } else { XCTFail("Expected error to be of type CoreSDKError") }