Skip to content

Commit

Permalink
Steven PR feedback: change back CardClientError.canceled to .threeDSe…
Browse files Browse the repository at this point in the history
…cureCanceled
  • Loading branch information
KunJeongPark committed Nov 7, 2024
1 parent 986eabd commit 83270ee
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Sources/CardPayments/CardClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public class CardClient: NSObject {
if let error = error {
switch error {
case ASWebAuthenticationSessionError.canceledLogin:
self.notifyCheckoutCancelWithError(with: CardClientError.canceled, completion: completion)
self.notifyCheckoutCancelWithError(with: CardClientError.threeDSecureCanceled, completion: completion)
return
default:
self.notifyCheckoutFailure(with: CardClientError.threeDSecureError(error), completion: completion)
Expand Down Expand Up @@ -206,7 +206,7 @@ public class CardClient: NSObject {
if let error = error {
switch error {
case ASWebAuthenticationSessionError.canceledLogin:
self.notifyVaultCancelWithError(with: CardClientError.canceled, completion: completion)
self.notifyVaultCancelWithError(with: CardClientError.threeDSecureCanceled, completion: completion)
return
default:
self.notifyVaultFailure(with: CardClientError.threeDSecureError(error), completion: completion)
Expand Down
6 changes: 3 additions & 3 deletions Sources/CardPayments/CardClientError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ enum CardClientError {
case malformedDeeplinkURLError

/// 10. Cancellation from 3DS verification
case canceledError
case threeDSCancellationError
}

static let unknownError = CoreSDKError(
Expand Down Expand Up @@ -68,8 +68,8 @@ enum CardClientError {
errorDescription: "An invalid 3DS URL was returned. Contact developer.paypal.com/support."
)

static let canceled = CoreSDKError(
code: Code.canceledError.rawValue,
static let threeDSecureCanceled = CoreSDKError(
code: Code.threeDSCancellationError.rawValue,
domain: domain,
errorDescription: "3DS verification has been canceled by the user."
)
Expand Down
8 changes: 4 additions & 4 deletions UnitTests/CardPaymentsTests/CardClient_Tests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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.canceledError.rawValue)
XCTAssertEqual(error.localizedDescription, CardClientError.canceled.localizedDescription)
XCTAssertEqual(error.code, CardClientError.Code.threeDSCancellationError.rawValue)
XCTAssertEqual(error.localizedDescription, CardClientError.threeDSecureCanceled.localizedDescription)
} else {
XCTFail("Expected error to be of type CoreSDKError")
}
Expand Down Expand Up @@ -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.canceled.code)
XCTAssertEqual(error.localizedDescription, CardClientError.canceled.localizedDescription)
XCTAssertEqual(error.code, CardClientError.threeDSecureCanceled.code)
XCTAssertEqual(error.localizedDescription, CardClientError.threeDSecureCanceled.localizedDescription)
} else {
XCTFail("Expected error to be of type CoreSDKError")
}
Expand Down

0 comments on commit 83270ee

Please sign in to comment.