diff --git a/README.md b/README.md index 0f9b3bdd..c66fe6ee 100644 --- a/README.md +++ b/README.md @@ -105,8 +105,8 @@ extension MyViewController: ShopifyCheckoutDelegate { /// Issued when checkout is no longer available and will no longer be available with the checkout url supplied. /// This may happen when the user has paused on checkout for a long period (hours) and then attempted to proceed again with the same checkout url - /// In event of checkoutNotAvailable, a new checkout url will need to be generated - case checkoutNotAvailable(message: String) + /// In event of checkoutUnavailable, a new checkout url will need to be generated + case checkoutUnavailable(message: String) } func checkoutDidClickLink(url: URL) { diff --git a/Samples/MobileBuyIntegration/MobileBuyIntegration/CartViewController.swift b/Samples/MobileBuyIntegration/MobileBuyIntegration/CartViewController.swift index 56a51e50..899bc9f6 100644 --- a/Samples/MobileBuyIntegration/MobileBuyIntegration/CartViewController.swift +++ b/Samples/MobileBuyIntegration/MobileBuyIntegration/CartViewController.swift @@ -173,7 +173,7 @@ extension CartViewController: CheckoutDelegate { func checkoutDidFail(error: ShopifyCheckout.CheckoutError) { switch error { case .sdkError(let underlying): print(#function, underlying) - case .checkoutNotAvailable(let message): forceCloseCheckout(message) + case .checkoutUnavailable(let message): forceCloseCheckout(message) case .serverError(let message): forceCloseCheckout(message) } } diff --git a/Sources/ShopifyCheckout/CheckoutBridge.swift b/Sources/ShopifyCheckout/CheckoutBridge.swift index 0144426d..f9494b84 100644 --- a/Sources/ShopifyCheckout/CheckoutBridge.swift +++ b/Sources/ShopifyCheckout/CheckoutBridge.swift @@ -56,7 +56,7 @@ extension CheckoutBridge { enum WebEvent: Decodable { case checkoutComplete case checkoutCanceled - case checkoutNotAvailable + case checkoutUnavailable case unsupported(String) enum CodingKeys: String, CodingKey { @@ -75,7 +75,7 @@ extension CheckoutBridge { case "close": self = .checkoutCanceled case "error": - self = .checkoutNotAvailable + self = .checkoutUnavailable default: self = .unsupported(name) } diff --git a/Sources/ShopifyCheckout/CheckoutError.swift b/Sources/ShopifyCheckout/CheckoutError.swift index 1f5877ac..1e69c5c0 100644 --- a/Sources/ShopifyCheckout/CheckoutError.swift +++ b/Sources/ShopifyCheckout/CheckoutError.swift @@ -35,6 +35,6 @@ public enum CheckoutError: Swift.Error { /// Issued when checkout is no longer available and will no longer be available with the checkout url supplied. /// This may happen when the user has paused on checkout for a long period (hours) and then attempted to proceed again with the same checkout url - /// In event of checkoutNotAvailable, a new checkout url will need to be generated - case checkoutNotAvailable(message: String) + /// In event of checkoutUnavailable, a new checkout url will need to be generated + case checkoutUnavailable(message: String) } diff --git a/Sources/ShopifyCheckout/CheckoutView.swift b/Sources/ShopifyCheckout/CheckoutView.swift index c8759ca2..6975b299 100644 --- a/Sources/ShopifyCheckout/CheckoutView.swift +++ b/Sources/ShopifyCheckout/CheckoutView.swift @@ -101,9 +101,9 @@ extension CheckoutView: WKScriptMessageHandler { case .checkoutComplete: CheckoutView.cache = nil viewDelegate?.checkoutViewDidCompleteCheckout() - case .checkoutNotAvailable: + case .checkoutUnavailable: CheckoutView.cache = nil - viewDelegate?.checkoutViewDidFailWithError(error: .checkoutNotAvailable(message: "Checkout not available.")) + viewDelegate?.checkoutViewDidFailWithError(error: .checkoutUnavailable(message: "Checkout unavailable.")) default: () } @@ -149,7 +149,7 @@ extension CheckoutView: WKNavigationDelegate { } }() - viewDelegate?.checkoutViewDidFailWithError(error: .checkoutNotAvailable(message: message)) + viewDelegate?.checkoutViewDidFailWithError(error: .checkoutUnavailable(message: message)) return .cancel } diff --git a/Tests/ShopifyCheckoutTests/CheckoutBridgeTests.swift b/Tests/ShopifyCheckoutTests/CheckoutBridgeTests.swift index b4e0a6ee..1c533fbc 100644 --- a/Tests/ShopifyCheckoutTests/CheckoutBridgeTests.swift +++ b/Tests/ShopifyCheckoutTests/CheckoutBridgeTests.swift @@ -98,7 +98,7 @@ class CheckoutBridgeTests: XCTestCase { } } - func testDecodeSupportsCheckoutNotAvailableEvent() throws { + func testDecodeSupportsCheckoutUnavailableEvent() throws { let mock = WKScriptMessageMock(body: """ { "name": "error" @@ -107,8 +107,8 @@ class CheckoutBridgeTests: XCTestCase { let result = try CheckoutBridge.decode(mock) - guard case CheckoutBridge.WebEvent.checkoutNotAvailable = result else { - return XCTFail("expected CheckoutScriptMessage.checkoutNotAvailable, got \(result)") + guard case CheckoutBridge.WebEvent.checkoutUnavailable = result else { + return XCTFail("expected CheckoutScriptMessage.checkoutUnavailable, got \(result)") } } }