@@ -32,32 +32,32 @@ export enum CheckoutErrorCode {
3232 /**
3333 * The app authentication payload passed could not be decoded.
3434 */
35- invalidPayload = 'invalid_payload ' ,
35+ invalidPayload = 'INVALID_PAYLOAD ' ,
3636
3737 /**
3838 * The app authentication JWT signature or encrypted token signature was invalid.
3939 */
40- invalidSignature = 'invalid_signature ' ,
40+ invalidSignature = 'INVALID_SIGNATURE ' ,
4141
4242 /**
4343 * The app authentication access token was not valid for the shop.
4444 */
45- notAuthorized = 'not_authorized ' ,
45+ notAuthorized = 'NOT_AUTHORIZED ' ,
4646
4747 /**
4848 * The provided app authentication payload has expired.
4949 */
50- payloadExpired = 'payload_expired ' ,
50+ payloadExpired = 'PAYLOAD_EXPIRED ' ,
5151
5252 /**
5353 * The buyer must be logged in to a customer account to proceed with checkout.
5454 */
55- customerAccountRequired = 'customer_account_required ' ,
55+ customerAccountRequired = 'CUSTOMER_ACCOUNT_REQUIRED ' ,
5656
5757 /**
5858 * The storefront requires a password to access checkout.
5959 */
60- storefrontPasswordRequired = 'storefront_password_required ' ,
60+ storefrontPasswordRequired = 'STOREFRONT_PASSWORD_REQUIRED ' ,
6161
6262 // ============================================================================
6363 // Cart errors
@@ -66,12 +66,12 @@ export enum CheckoutErrorCode {
6666 /**
6767 * The cart associated with the checkout has already been completed.
6868 */
69- cartCompleted = 'cart_completed ' ,
69+ cartCompleted = 'CART_COMPLETED ' ,
7070
7171 /**
7272 * The cart is invalid or no longer exists.
7373 */
74- invalidCart = 'invalid_cart ' ,
74+ invalidCart = 'INVALID_CART ' ,
7575
7676 // ============================================================================
7777 // Client errors
@@ -80,22 +80,22 @@ export enum CheckoutErrorCode {
8080 /**
8181 * Checkout preloading has been temporarily disabled via killswitch.
8282 */
83- killswitchEnabled = 'killswitch_enabled ' ,
83+ killswitchEnabled = 'KILLSWITCH_ENABLED ' ,
8484
8585 /**
8686 * An unrecoverable error occurred during checkout.
8787 */
88- unrecoverableFailure = 'unrecoverable_failure ' ,
88+ unrecoverableFailure = 'UNRECOVERABLE_FAILURE ' ,
8989
9090 /**
9191 * A policy violation was detected during checkout.
9292 */
93- policyViolation = 'policy_violation ' ,
93+ policyViolation = 'POLICY_VIOLATION ' ,
9494
9595 /**
9696 * An error occurred processing a vaulted payment method.
9797 */
98- vaultedPaymentError = 'vaulted_payment_error ' ,
98+ vaultedPaymentError = 'VAULTED_PAYMENT_ERROR ' ,
9999
100100 // ============================================================================
101101 // Internal errors
@@ -104,27 +104,27 @@ export enum CheckoutErrorCode {
104104 /**
105105 * A client-side error occurred in the SDK.
106106 */
107- clientError = 'client_error ' ,
107+ clientError = 'CLIENT_ERROR ' ,
108108
109109 /**
110110 * An HTTP error occurred while communicating with the checkout.
111111 */
112- httpError = 'http_error ' ,
112+ httpError = 'HTTP_ERROR ' ,
113113
114114 /**
115115 * Failed to send a message to the checkout bridge.
116116 */
117- sendingBridgeEventError = 'error_sending_message ' ,
117+ errorSendingMessage = 'ERROR_SENDING_MESSAGE ' ,
118118
119119 /**
120120 * Failed to receive a message from the checkout bridge.
121121 */
122- receivingBridgeEventError = 'error_receiving_message ' ,
122+ errorReceivingMessage = 'ERROR_RECEIVING_MESSAGE ' ,
123123
124124 /**
125125 * The WebView render process has terminated unexpectedly (Android only).
126126 */
127- renderProcessGone = 'render_process_gone ' ,
127+ renderProcessGone = 'RENDER_PROCESS_GONE ' ,
128128
129129 // ============================================================================
130130 // Fallback
@@ -133,7 +133,7 @@ export enum CheckoutErrorCode {
133133 /**
134134 * An unknown or unrecognized error code was received.
135135 */
136- unknown = 'unknown ' ,
136+ unknown = 'UNKNOWN ' ,
137137}
138138
139139export enum CheckoutNativeErrorType {
@@ -147,13 +147,14 @@ export enum CheckoutNativeErrorType {
147147
148148/**
149149 * Maps a native error code string to a CheckoutErrorCode enum value.
150+ * Handles both SCREAMING_SNAKE_CASE and snake_case formats for compatibility.
150151 */
151152function getCheckoutErrorCode ( code : string | undefined ) : CheckoutErrorCode {
152153 if ( ! code ) {
153154 return CheckoutErrorCode . unknown ;
154155 }
155156
156- const normalizedCode = code . toLowerCase ( ) ;
157+ const normalizedCode = code . toUpperCase ( ) ;
157158
158159 const codeKey = Object . keys ( CheckoutErrorCode ) . find (
159160 key => CheckoutErrorCode [ key as keyof typeof CheckoutErrorCode ] === normalizedCode ,
0 commit comments