Skip to content

Commit

Permalink
Remove AuthenticationError (#176)
Browse files Browse the repository at this point in the history
  • Loading branch information
markmur authored May 16, 2024
1 parent 78015e6 commit e65945b
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,6 @@ extension CartViewController: CheckoutDelegate {
errorMessage = message
}

/// Unauthorized checkout
if case .authenticationError(let message, _, _) = error {
errorMessage = message
}

print(errorMessage, "Recoverable: \(error.isRecoverable)")

if !error.isRecoverable {
Expand Down
2 changes: 1 addition & 1 deletion ShopifyCheckoutSheetKit.podspec
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Pod::Spec.new do |s|
s.version = "3.0.0-beta.4"
s.version = "3.0.0-beta.5"

s.name = "ShopifyCheckoutSheetKit"
s.summary = "Enables Swift apps to embed the Shopify's highest converting, customizable, one-page checkout."
Expand Down
1 change: 0 additions & 1 deletion Sources/ShopifyCheckoutSheetKit/CheckoutBridge.swift
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ enum CheckoutBridge {
extension CheckoutBridge {
enum WebEvent: Decodable {
/// Error types
case authenticationError(message: String?, code: CheckoutErrorCode)
case checkoutExpired(message: String?, code: CheckoutErrorCode)
case checkoutUnavailable(message: String?, code: CheckoutErrorCode)
case configurationError(message: String?, code: CheckoutErrorCode)
Expand Down
7 changes: 1 addition & 6 deletions Sources/ShopifyCheckoutSheetKit/CheckoutError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,6 @@ public enum CheckoutUnavailable {
/// A type representing Shopify Checkout specific errors.
/// "recoverable" indicates that though the request has failed, it should be retried in a fallback browser experience.
public enum CheckoutError: Swift.Error {
/// Issued when checkout has encountered an authentication error.
/// For example; the stonrefront is configured to enforce customer account login.
case authenticationError(message: String, code: CheckoutErrorCode, recoverable: Bool = false)

/// Issued when an internal error within Shopify Checkout SDK
/// In event of an sdkError you could use the stacktrace to inform you of how to proceed,
/// if the issue persists, it is recommended to open a bug report in http://github.com/Shopify/checkout-sheet-kit-swift
Expand All @@ -74,8 +70,7 @@ public enum CheckoutError: Swift.Error {

public var isRecoverable: Bool {
switch self {
case .authenticationError(_, _, let recoverable),
.checkoutExpired(_, _, let recoverable),
case .checkoutExpired(_, _, let recoverable),
.checkoutUnavailable(_, _, let recoverable),
.configurationError(_, _, let recoverable),
.sdkError(_, let recoverable):
Expand Down
9 changes: 0 additions & 9 deletions Sources/ShopifyCheckoutSheetKit/CheckoutWebView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -212,15 +212,6 @@ extension CheckoutWebView: WKScriptMessageHandler {
func userContentController(_ controller: WKUserContentController, didReceive message: WKScriptMessage) {
do {
switch try CheckoutBridge.decode(message) {
/// Error: authentication error
case .authenticationError(let message, let code):
viewDelegate?.checkoutViewDidFailWithError(
error: .authenticationError(
message: message ?? "Unauthorized",
code: code,
recoverable: false
)
)
/// Completed event
case let .checkoutComplete(checkoutCompletedEvent):
viewDelegate?.checkoutViewDidCompleteCheckout(event: checkoutCompletedEvent)
Expand Down

0 comments on commit e65945b

Please sign in to comment.