@ancon/wildcat-utils 1.40.45 → 1.40.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -55,7 +55,8 @@ declare enum CheckoutPaymentErrorTranslationKey {
55
55
  PaymentPenguinNotEnoughLockers = "paymentPenguinNotEnoughLockers",
56
56
  PaymentPenguinTooManyItems = "paymentPenguinTooManyItems",
57
57
  PaymentPenguinProductInvalidUnits = "paymentPenguinProductInvalidUnits",
58
- PaymentCheckoutServiceTimeInPast = "paymentCheckoutServiceTimeInPast"
58
+ PaymentCheckoutServiceTimeInPast = "paymentCheckoutServiceTimeInPast",
59
+ PaymentNotAllowedForCompanyAccount = "paymentNotAllowedForCompanyAccount"
59
60
  }
60
61
  declare type CheckoutPaymentErrorTranslation = {
61
62
  title: string;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("@ancon/wildcat-types");require("axios");const l=require("../error/isSerializedAPIError.js");var s=(e=>(e.PaymentRefusalGeneral="paymentRefusalGeneral",e.PaymentRefusalTransactionRefused="paymentRefusalTransactionRefused",e.PaymentRefusalReferral="paymentRefusalReferral",e.PaymentRefusalAcquirer="paymentRefusalAcquirer",e.PaymentRefusalBlockedCard="paymentRefusalBlockedCard",e.PaymentRefusalExpiredCard="paymentRefusalExpiredCard",e.PaymentRefusalInvalidAmount="paymentRefusalInvalidAmount",e.PaymentRefusalInvalidCardnumber="paymentRefusalInvalidCardnumber",e.PaymentRefusalIssuerUnavailable="paymentRefusalIssuerUnavailable",e.PaymentRefusalBankNotSupported="paymentRefusalBankNotSupported",e.PaymentRefusal3dsecureAuthFailed="paymentRefusal3dsecureAuthFailed",e.PaymentRefusalNoEnoughBalance="paymentRefusalNoEnoughBalance",e.PaymentRefusalFraudDetected="paymentRefusalFraudDetected",e.PaymentRefusalCancelled="paymentRefusalCancelled",e.PaymentRefusalInvalidPin="paymentRefusalInvalidPin",e.PaymentRefusalPinRetryExceeded="paymentRefusalPinRetryExceeded",e.PaymentRefusalUnableValidatePin="paymentRefusalUnableValidatePin",e.PaymentRefusalSubmmissionAdyen="paymentRefusalSubmmissionAdyen",e.PaymentRefusalCvcDeclined="paymentRefusalCvcDeclined",e.PaymentRefusalRestrictedCard="paymentRefusalRestrictedCard",e.PaymentRefusalDoNotHonor="paymentRefusalDoNotHonor",e.PaymentRefusalWdrwAmountExceeded="paymentRefusalWdrwAmountExceeded",e.PaymentRefusalWdrwCountExceeded="paymentRefusalWdrwCountExceeded",e.PaymentRefusalAvsDeclined="paymentRefusalAvsDeclined",e.PaymentRefusalCardOnlinePin="paymentRefusalCardOnlinePin",e.PaymentRefusalNoAcctAtchdCard="paymentRefusalNoAcctAtchdCard",e.PaymentRefusalMobilePin="paymentRefusalMobilePin",e.PaymentRefusalContactlessFallback="paymentRefusalContactlessFallback",e.PaymentRefusalAuthRequired="paymentRefusalAuthRequired",e.PaymentResultCancelled="paymentResultCancelled",e.PaymentResultError="paymentResultError",e.PaymentResultRefused="paymentResultRefused",e.PaymentAuthorizeDataNotValid="paymentAuthorizeDataNotValid",e.PaymentAuthorizeErrorUnknownReason="paymentAuthorizeErrorUnknownReason",e.PaymentAuthorizeCheckoutCaptured="paymentAuthorizeCheckoutCaptured",e.PaymentAuthorizeCheckoutAuthorized="paymentAuthorizeCheckoutAuthorized",e.PaymentAuthorizeCaptureFailure="paymentAuthorizeCaptureFailure",e.PaymentAuthorizeCancelOrRefund="paymentAuthorizeCancelOrRefund",e.PaymentActionErrorUnknownReason="paymentActionErrorUnknownReason",e.PaymentActionInvalidData="paymentActionInvalidData",e.PaymentActionCaptureFailure="paymentActionCaptureFailure",e.PaymentActionCancelOrRefund="paymentActionCancelOrRefund",e.PaymentPaymentAppNotFound="paymentPaymentAppNotFound",e.PaymentPaymentCheckoutCreated="paymentPaymentCheckoutCreated",e.PaymentCheckoutPaymentFailure="paymentCheckoutPaymentFailure",e.PaymentDetailsNotSupported="paymentDetailsNotSupported",e.PaymentAuthorizeNoItems="paymentAuthorizeNoItems",e.PaymentAuthorizeInvalidCustomer="paymentAuthorizeInvalidCustomer",e.PaymentAuthorizeInvalidDelivery="paymentAuthorizeInvalidDelivery",e.PaymentPenguinInvalidStation="paymentPenguinInvalidStation",e.PaymentPenguinInvalidTimeSlot="paymentPenguinInvalidTimeSlot",e.PaymentPenguinNotEnoughLockers="paymentPenguinNotEnoughLockers",e.PaymentPenguinTooManyItems="paymentPenguinTooManyItems",e.PaymentPenguinProductInvalidUnits="paymentPenguinProductInvalidUnits",e.PaymentCheckoutServiceTimeInPast="paymentCheckoutServiceTimeInPast",e))(s||{});const d={paymentRefusalGeneral:()=>({title:"Payment failure",message:"The transaction was refused."}),paymentRefusalTransactionRefused:()=>({title:"Payment failure",message:"The transaction was refused."}),paymentRefusalReferral:({meta:e})=>({title:"Payment failure",message:`A referral error occurred. (${e.checkoutId})`}),paymentRefusalAcquirer:({meta:e})=>({title:"Payment failure",message:`An acquirer error occurred. (${e.checkoutId})`}),paymentRefusalBlockedCard:()=>({title:"Payment failure",message:"The provided card is blocked."}),paymentRefusalExpiredCard:()=>({title:"Payment failure",message:"The provided card is expired."}),paymentRefusalInvalidAmount:()=>({title:"Payment failure",message:"An invalid payment amount was provided."}),paymentRefusalInvalidCardnumber:()=>({title:"Payment failure",message:"An invalid card number was provided."}),paymentRefusalIssuerUnavailable:()=>({title:"Payment failure",message:"Card issuer not available."}),paymentRefusalBankNotSupported:()=>({title:"Payment failure",message:"CVC declined."}),paymentRefusal3dsecureAuthFailed:()=>({title:"Payment failure",message:"3D Secure was not authenticated."}),paymentRefusalNoEnoughBalance:()=>({title:"Payment failure",message:"Not enough balance."}),paymentRefusalFraudDetected:()=>({title:"Payment failure",message:"The provided card is not allowed."}),paymentRefusalCancelled:()=>({title:"Payment cancelled",message:"The payment was cancelled."}),paymentRefusalInvalidPin:()=>({title:"Payment failure",message:"Invalid PIN."}),paymentRefusalPinRetryExceeded:()=>({title:"Payment failure",message:"PIN tries exceeded."}),paymentRefusalUnableValidatePin:()=>({title:"Payment failure",message:"PIN validation was not possible."}),paymentRefusalSubmmissionAdyen:({meta:e})=>({title:"Payment failure",message:`Submission error. (${e.checkoutId})`}),paymentRefusalCvcDeclined:()=>({title:"Payment failure",message:"CVC declined."}),paymentRefusalRestrictedCard:()=>({title:"Payment failure",message:"Restricted card."}),paymentRefusalDoNotHonor:({meta:e})=>({title:"Payment failure",message:`The transaction was refused (do not honor). (${e.checkoutId})`}),paymentRefusalWdrwAmountExceeded:()=>({title:"Payment failure",message:"Withdrawal amount exceeded."}),paymentRefusalWdrwCountExceeded:()=>({title:"Payment failure",message:"Withdrawal count exceeded."}),paymentRefusalAvsDeclined:()=>({title:"Payment failure",message:"AVS declined."}),paymentRefusalCardOnlinePin:()=>({title:"Payment failure",message:"The provided card requires online PIN."}),paymentRefusalNoAcctAtchdCard:()=>({title:"Payment failure",message:"No account attached to the provided card."}),paymentRefusalMobilePin:()=>({title:"Payment failure",message:"Mobile PIN required."}),paymentRefusalContactlessFallback:()=>({title:"Payment failure",message:"Contactless fallback."}),paymentRefusalAuthRequired:()=>({title:"Payment failure",message:"Authentication required"}),paymentResultCancelled:()=>({title:"Payment cancelled",message:"The payment was cancelled."}),paymentResultError:({meta:e})=>({title:"Payment error",message:`There was an error processing your payment. (${e.checkoutId})`}),paymentResultRefused:()=>({title:"Payment refused",message:"The payment was refused."}),paymentAuthorizeDataNotValid:({meta:e})=>({title:"Authorization failed",message:`The provided data was invalid. (${e.checkoutId})`}),paymentAuthorizeErrorUnknownReason:({meta:e})=>({title:"Authorization failed",message:`Authorization failed because of an unknown error. (${e.checkoutId})`}),paymentAuthorizeCheckoutCaptured:({meta:e})=>({title:"Authorization failed",message:`The checkout has already been captured. (${e.checkoutId})`}),paymentAuthorizeCheckoutAuthorized:({meta:e})=>({title:"Authorization failed",message:`The checkout has already been authorized. (${e.checkoutId})`}),paymentAuthorizeCaptureFailure:({meta:e})=>({title:"Authorization failed",message:`Failed to capture checkout. (${e.checkoutId})`}),paymentAuthorizeCancelOrRefund:()=>({title:"Authorization failed",message:"The checkout has already been cancelled or refunded."}),paymentActionErrorUnknownReason:({meta:e})=>({title:"Action failed",message:`The action failed because of an unknown error. (${e.checkoutId})`}),paymentActionInvalidData:({meta:e})=>({title:"Action failed",message:`The provided data was invalid. (${e.checkoutId})`}),paymentActionCaptureFailure:({meta:e})=>({title:"Action failed",message:`Failed to capture checkout. (${e.checkoutId})`}),paymentActionCancelOrRefund:()=>({title:"Action failed",message:"The checkout has already been cancelled or refunded."}),paymentPaymentAppNotFound:()=>({title:"Payment failure",message:"The chosen payment method requires an app which is not installed."}),paymentPaymentCheckoutCreated:({meta:e})=>({title:"Payment failure",message:`The checkout is created, cannot make payment, make sure the customer is connected to this checkout. (${e.checkoutId})`}),paymentCheckoutPaymentFailure:({meta:e})=>({title:"Payment failure",message:`Unfortunately an error has occurred and your payment cannot be processed. (${e.checkoutId})`}),paymentDetailsNotSupported:()=>({title:"Payment failure",message:"The payment provider is not supported by this outlet."}),paymentAuthorizeNoItems:({meta:e})=>({title:"Payment failure",message:`The current checkout does not contain any products. (${e.checkoutId})`}),paymentAuthorizeInvalidCustomer:({meta:e})=>({title:"Payment failure",message:`Could not resolve the customer from database. (${e.checkoutId})`}),paymentAuthorizeInvalidDelivery:({meta:e})=>({title:"Payment failure",message:`Missing delivery information. (${e.checkoutId})`}),paymentPenguinInvalidStation:()=>({title:"Payment failure",message:"Invalid station."}),paymentPenguinInvalidTimeSlot:()=>({title:"Payment failure",message:"Invalid time slot."}),paymentPenguinNotEnoughLockers:()=>({title:"Payment failure",message:"Not enough lockers."}),paymentPenguinTooManyItems:()=>({title:"Payment failure",message:"The current checkout has too many items."}),paymentPenguinProductInvalidUnits:({meta:e})=>({title:"Payment failure",message:`The current checkout does not contain valid product storage configurations. (${e.checkoutId})`}),paymentCheckoutServiceTimeInPast:({meta:e})=>({title:"Payment failure",message:`The order time cannot be in the past. (${e.checkoutId})`})};function m(e){switch(e){case"0":return"paymentRefusalGeneral";case"2":case"23":return"paymentRefusalTransactionRefused";case"3":return"paymentRefusalReferral";case"4":return"paymentRefusalAcquirer";case"5":return"paymentRefusalBlockedCard";case"6":return"paymentRefusalExpiredCard";case"7":return"paymentRefusalInvalidAmount";case"8":return"paymentRefusalInvalidCardnumber";case"9":return"paymentRefusalIssuerUnavailable";case"10":return"paymentRefusalBankNotSupported";case"11":return"paymentRefusal3dsecureAuthFailed";case"12":return"paymentRefusalNoEnoughBalance";case"14":case"20":case"31":return"paymentRefusalFraudDetected";case"15":case"16":return"paymentRefusalCancelled";case"17":return"paymentRefusalInvalidPin";case"18":return"paymentRefusalPinRetryExceeded";case"19":return"paymentRefusalUnableValidatePin";case"21":return"paymentRefusalSubmmissionAdyen";case"24":return"paymentRefusalCvcDeclined";case"25":return"paymentRefusalRestrictedCard";case"27":return"paymentRefusalDoNotHonor";case"28":return"paymentRefusalWdrwAmountExceeded";case"29":return"paymentRefusalWdrwCountExceeded";case"32":return"paymentRefusalAvsDeclined";case"33":return"paymentRefusalCardOnlinePin";case"34":case"35":return"paymentRefusalNoAcctAtchdCard";case"36":return"paymentRefusalMobilePin";case"37":return"paymentRefusalContactlessFallback";case"38":return"paymentRefusalAuthRequired";default:return null}}function o(e){switch(e){case"Cancelled":return"paymentResultCancelled";case"Error":return"paymentResultError";case"Refused":return"paymentResultRefused";default:return null}}function c(e,a){if(l(e))switch(e.response.data.errorCode){case t.ErrorCode.AuthorizeDataNotValid:return["paymentAuthorizeDataNotValid",{checkoutId:a}];case t.ErrorCode.AuthorizeErrorUnknownReason:return["paymentAuthorizeErrorUnknownReason",{checkoutId:a}];case t.ErrorCode.AuthorizeCheckoutCaptured:return["paymentAuthorizeCheckoutCaptured",{checkoutId:a}];case t.ErrorCode.AuthorizeCheckoutAuthorized:return["paymentAuthorizeCheckoutAuthorized",{checkoutId:a}];case t.ErrorCode.AuthorizeCaptureFailure:return["paymentAuthorizeCaptureFailure",{checkoutId:a}];case t.ErrorCode.AuthorizeCancelOrRefund:return["paymentAuthorizeCancelOrRefund",{checkoutId:a}];case t.ErrorCode.ActionErrorUnknownReason:return["paymentActionErrorUnknownReason",{checkoutId:a}];case t.ErrorCode.ActionInvalidData:return["paymentActionInvalidData",{checkoutId:a}];case t.ErrorCode.ActionCaptureFailure:return["paymentActionCaptureFailure",{checkoutId:a}];case t.ErrorCode.ActionCancelOrRefund:return["paymentActionCancelOrRefund",{checkoutId:a}];case t.ErrorCode.AppNotFound:return["paymentPaymentAppNotFound",{checkoutId:a}];case t.ErrorCode.PaymentCheckoutCreated:return["paymentPaymentCheckoutCreated",{checkoutId:a}];case t.ErrorCode.PaymentAuthorizeNoItems:return["paymentAuthorizeNoItems",{checkoutId:a}];case t.ErrorCode.PaymentAuthorizeInvalidCustomer:return["paymentAuthorizeInvalidCustomer",{checkoutId:a}];case t.ErrorCode.PaymentAuthorizeInvalidDelivery:return["paymentAuthorizeInvalidDelivery",{checkoutId:a}];case t.ErrorCode.CheckoutPenguinInvalidStation:return["paymentCheckoutPaymentFailure",{checkoutId:a}];case t.ErrorCode.CheckoutPenguinInvalidTimeSlot:return["paymentPenguinInvalidTimeSlot",{checkoutId:a}];case t.ErrorCode.CheckoutPenguinNotEnoughLockers:return["paymentPenguinNotEnoughLockers",{checkoutId:a}];case t.ErrorCode.CheckoutPenguinTooManyItems:return["paymentPenguinTooManyItems",{checkoutId:a}];case t.ErrorCode.CheckoutPenguinProductInvalidUnits:return["paymentPenguinProductInvalidUnits",{checkoutId:a}];case t.ErrorCode.ServiceTimeInThePast:return["paymentCheckoutServiceTimeInPast",{checkoutId:a}]}else{const u=m(e==null?void 0:e.refusalReasonCode);if(u)return[u,{checkoutId:a}];const n=o(e==null?void 0:e.resultCode);if(n)return[n,{checkoutId:a}]}return["paymentCheckoutPaymentFailure",{checkoutId:a}]}function p(e,a,u=d){const[n,r]=c(e,a),i=u[n]({key:n,meta:r});if(!i)throw new Error("Could not resolve translation in getCheckoutPaymentErrorTexts()");return[i,n]}exports.CheckoutPaymentErrorTranslationKey=s;exports.default=p;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("@ancon/wildcat-types");require("axios");const l=require("../error/isSerializedAPIError.js");var r=(e=>(e.PaymentRefusalGeneral="paymentRefusalGeneral",e.PaymentRefusalTransactionRefused="paymentRefusalTransactionRefused",e.PaymentRefusalReferral="paymentRefusalReferral",e.PaymentRefusalAcquirer="paymentRefusalAcquirer",e.PaymentRefusalBlockedCard="paymentRefusalBlockedCard",e.PaymentRefusalExpiredCard="paymentRefusalExpiredCard",e.PaymentRefusalInvalidAmount="paymentRefusalInvalidAmount",e.PaymentRefusalInvalidCardnumber="paymentRefusalInvalidCardnumber",e.PaymentRefusalIssuerUnavailable="paymentRefusalIssuerUnavailable",e.PaymentRefusalBankNotSupported="paymentRefusalBankNotSupported",e.PaymentRefusal3dsecureAuthFailed="paymentRefusal3dsecureAuthFailed",e.PaymentRefusalNoEnoughBalance="paymentRefusalNoEnoughBalance",e.PaymentRefusalFraudDetected="paymentRefusalFraudDetected",e.PaymentRefusalCancelled="paymentRefusalCancelled",e.PaymentRefusalInvalidPin="paymentRefusalInvalidPin",e.PaymentRefusalPinRetryExceeded="paymentRefusalPinRetryExceeded",e.PaymentRefusalUnableValidatePin="paymentRefusalUnableValidatePin",e.PaymentRefusalSubmmissionAdyen="paymentRefusalSubmmissionAdyen",e.PaymentRefusalCvcDeclined="paymentRefusalCvcDeclined",e.PaymentRefusalRestrictedCard="paymentRefusalRestrictedCard",e.PaymentRefusalDoNotHonor="paymentRefusalDoNotHonor",e.PaymentRefusalWdrwAmountExceeded="paymentRefusalWdrwAmountExceeded",e.PaymentRefusalWdrwCountExceeded="paymentRefusalWdrwCountExceeded",e.PaymentRefusalAvsDeclined="paymentRefusalAvsDeclined",e.PaymentRefusalCardOnlinePin="paymentRefusalCardOnlinePin",e.PaymentRefusalNoAcctAtchdCard="paymentRefusalNoAcctAtchdCard",e.PaymentRefusalMobilePin="paymentRefusalMobilePin",e.PaymentRefusalContactlessFallback="paymentRefusalContactlessFallback",e.PaymentRefusalAuthRequired="paymentRefusalAuthRequired",e.PaymentResultCancelled="paymentResultCancelled",e.PaymentResultError="paymentResultError",e.PaymentResultRefused="paymentResultRefused",e.PaymentAuthorizeDataNotValid="paymentAuthorizeDataNotValid",e.PaymentAuthorizeErrorUnknownReason="paymentAuthorizeErrorUnknownReason",e.PaymentAuthorizeCheckoutCaptured="paymentAuthorizeCheckoutCaptured",e.PaymentAuthorizeCheckoutAuthorized="paymentAuthorizeCheckoutAuthorized",e.PaymentAuthorizeCaptureFailure="paymentAuthorizeCaptureFailure",e.PaymentAuthorizeCancelOrRefund="paymentAuthorizeCancelOrRefund",e.PaymentActionErrorUnknownReason="paymentActionErrorUnknownReason",e.PaymentActionInvalidData="paymentActionInvalidData",e.PaymentActionCaptureFailure="paymentActionCaptureFailure",e.PaymentActionCancelOrRefund="paymentActionCancelOrRefund",e.PaymentPaymentAppNotFound="paymentPaymentAppNotFound",e.PaymentPaymentCheckoutCreated="paymentPaymentCheckoutCreated",e.PaymentCheckoutPaymentFailure="paymentCheckoutPaymentFailure",e.PaymentDetailsNotSupported="paymentDetailsNotSupported",e.PaymentAuthorizeNoItems="paymentAuthorizeNoItems",e.PaymentAuthorizeInvalidCustomer="paymentAuthorizeInvalidCustomer",e.PaymentAuthorizeInvalidDelivery="paymentAuthorizeInvalidDelivery",e.PaymentPenguinInvalidStation="paymentPenguinInvalidStation",e.PaymentPenguinInvalidTimeSlot="paymentPenguinInvalidTimeSlot",e.PaymentPenguinNotEnoughLockers="paymentPenguinNotEnoughLockers",e.PaymentPenguinTooManyItems="paymentPenguinTooManyItems",e.PaymentPenguinProductInvalidUnits="paymentPenguinProductInvalidUnits",e.PaymentCheckoutServiceTimeInPast="paymentCheckoutServiceTimeInPast",e.PaymentNotAllowedForCompanyAccount="paymentNotAllowedForCompanyAccount",e))(r||{});const d={paymentRefusalGeneral:()=>({title:"Payment failure",message:"The transaction was refused."}),paymentRefusalTransactionRefused:()=>({title:"Payment failure",message:"The transaction was refused."}),paymentRefusalReferral:({meta:e})=>({title:"Payment failure",message:`A referral error occurred. (${e.checkoutId})`}),paymentRefusalAcquirer:({meta:e})=>({title:"Payment failure",message:`An acquirer error occurred. (${e.checkoutId})`}),paymentRefusalBlockedCard:()=>({title:"Payment failure",message:"The provided card is blocked."}),paymentRefusalExpiredCard:()=>({title:"Payment failure",message:"The provided card is expired."}),paymentRefusalInvalidAmount:()=>({title:"Payment failure",message:"An invalid payment amount was provided."}),paymentRefusalInvalidCardnumber:()=>({title:"Payment failure",message:"An invalid card number was provided."}),paymentRefusalIssuerUnavailable:()=>({title:"Payment failure",message:"Card issuer not available."}),paymentRefusalBankNotSupported:()=>({title:"Payment failure",message:"CVC declined."}),paymentRefusal3dsecureAuthFailed:()=>({title:"Payment failure",message:"3D Secure was not authenticated."}),paymentRefusalNoEnoughBalance:()=>({title:"Payment failure",message:"Not enough balance."}),paymentRefusalFraudDetected:()=>({title:"Payment failure",message:"The provided card is not allowed."}),paymentRefusalCancelled:()=>({title:"Payment cancelled",message:"The payment was cancelled."}),paymentRefusalInvalidPin:()=>({title:"Payment failure",message:"Invalid PIN."}),paymentRefusalPinRetryExceeded:()=>({title:"Payment failure",message:"PIN tries exceeded."}),paymentRefusalUnableValidatePin:()=>({title:"Payment failure",message:"PIN validation was not possible."}),paymentRefusalSubmmissionAdyen:({meta:e})=>({title:"Payment failure",message:`Submission error. (${e.checkoutId})`}),paymentRefusalCvcDeclined:()=>({title:"Payment failure",message:"CVC declined."}),paymentRefusalRestrictedCard:()=>({title:"Payment failure",message:"Restricted card."}),paymentRefusalDoNotHonor:({meta:e})=>({title:"Payment failure",message:`The transaction was refused (do not honor). (${e.checkoutId})`}),paymentRefusalWdrwAmountExceeded:()=>({title:"Payment failure",message:"Withdrawal amount exceeded."}),paymentRefusalWdrwCountExceeded:()=>({title:"Payment failure",message:"Withdrawal count exceeded."}),paymentRefusalAvsDeclined:()=>({title:"Payment failure",message:"AVS declined."}),paymentRefusalCardOnlinePin:()=>({title:"Payment failure",message:"The provided card requires online PIN."}),paymentRefusalNoAcctAtchdCard:()=>({title:"Payment failure",message:"No account attached to the provided card."}),paymentRefusalMobilePin:()=>({title:"Payment failure",message:"Mobile PIN required."}),paymentRefusalContactlessFallback:()=>({title:"Payment failure",message:"Contactless fallback."}),paymentRefusalAuthRequired:()=>({title:"Payment failure",message:"Authentication required"}),paymentResultCancelled:()=>({title:"Payment cancelled",message:"The payment was cancelled."}),paymentResultError:({meta:e})=>({title:"Payment error",message:`There was an error processing your payment. (${e.checkoutId})`}),paymentResultRefused:()=>({title:"Payment refused",message:"The payment was refused."}),paymentAuthorizeDataNotValid:({meta:e})=>({title:"Authorization failed",message:`The provided data was invalid. (${e.checkoutId})`}),paymentAuthorizeErrorUnknownReason:({meta:e})=>({title:"Authorization failed",message:`Authorization failed because of an unknown error. (${e.checkoutId})`}),paymentAuthorizeCheckoutCaptured:({meta:e})=>({title:"Authorization failed",message:`The checkout has already been captured. (${e.checkoutId})`}),paymentAuthorizeCheckoutAuthorized:({meta:e})=>({title:"Authorization failed",message:`The checkout has already been authorized. (${e.checkoutId})`}),paymentAuthorizeCaptureFailure:({meta:e})=>({title:"Authorization failed",message:`Failed to capture checkout. (${e.checkoutId})`}),paymentAuthorizeCancelOrRefund:()=>({title:"Authorization failed",message:"The checkout has already been cancelled or refunded."}),paymentActionErrorUnknownReason:({meta:e})=>({title:"Action failed",message:`The action failed because of an unknown error. (${e.checkoutId})`}),paymentActionInvalidData:({meta:e})=>({title:"Action failed",message:`The provided data was invalid. (${e.checkoutId})`}),paymentActionCaptureFailure:({meta:e})=>({title:"Action failed",message:`Failed to capture checkout. (${e.checkoutId})`}),paymentActionCancelOrRefund:()=>({title:"Action failed",message:"The checkout has already been cancelled or refunded."}),paymentPaymentAppNotFound:()=>({title:"Payment failure",message:"The chosen payment method requires an app which is not installed."}),paymentPaymentCheckoutCreated:({meta:e})=>({title:"Payment failure",message:`The checkout is created, cannot make payment, make sure the customer is connected to this checkout. (${e.checkoutId})`}),paymentCheckoutPaymentFailure:({meta:e})=>({title:"Payment failure",message:`Unfortunately an error has occurred and your payment cannot be processed. (${e.checkoutId})`}),paymentDetailsNotSupported:()=>({title:"Payment failure",message:"The payment provider is not supported by this outlet."}),paymentAuthorizeNoItems:({meta:e})=>({title:"Payment failure",message:`The current checkout does not contain any products. (${e.checkoutId})`}),paymentAuthorizeInvalidCustomer:({meta:e})=>({title:"Payment failure",message:`Could not resolve the customer from database. (${e.checkoutId})`}),paymentAuthorizeInvalidDelivery:({meta:e})=>({title:"Payment failure",message:`Missing delivery information. (${e.checkoutId})`}),paymentPenguinInvalidStation:()=>({title:"Payment failure",message:"Invalid station."}),paymentPenguinInvalidTimeSlot:()=>({title:"Payment failure",message:"Invalid time slot."}),paymentPenguinNotEnoughLockers:()=>({title:"Payment failure",message:"Not enough lockers."}),paymentPenguinTooManyItems:()=>({title:"Payment failure",message:"The current checkout has too many items."}),paymentPenguinProductInvalidUnits:({meta:e})=>({title:"Payment failure",message:`The current checkout does not contain valid product storage configurations. (${e.checkoutId})`}),paymentCheckoutServiceTimeInPast:({meta:e})=>({title:"Payment failure",message:`The order time cannot be in the past. (${e.checkoutId})`}),paymentNotAllowedForCompanyAccount:()=>({title:"Payment not allowed",message:"Your company account can't make payments on this outlet. Please use private account or switch to a company account of this outlet."})};function m(e){switch(e){case"0":return"paymentRefusalGeneral";case"2":case"23":return"paymentRefusalTransactionRefused";case"3":return"paymentRefusalReferral";case"4":return"paymentRefusalAcquirer";case"5":return"paymentRefusalBlockedCard";case"6":return"paymentRefusalExpiredCard";case"7":return"paymentRefusalInvalidAmount";case"8":return"paymentRefusalInvalidCardnumber";case"9":return"paymentRefusalIssuerUnavailable";case"10":return"paymentRefusalBankNotSupported";case"11":return"paymentRefusal3dsecureAuthFailed";case"12":return"paymentRefusalNoEnoughBalance";case"14":case"20":case"31":return"paymentRefusalFraudDetected";case"15":case"16":return"paymentRefusalCancelled";case"17":return"paymentRefusalInvalidPin";case"18":return"paymentRefusalPinRetryExceeded";case"19":return"paymentRefusalUnableValidatePin";case"21":return"paymentRefusalSubmmissionAdyen";case"24":return"paymentRefusalCvcDeclined";case"25":return"paymentRefusalRestrictedCard";case"27":return"paymentRefusalDoNotHonor";case"28":return"paymentRefusalWdrwAmountExceeded";case"29":return"paymentRefusalWdrwCountExceeded";case"32":return"paymentRefusalAvsDeclined";case"33":return"paymentRefusalCardOnlinePin";case"34":case"35":return"paymentRefusalNoAcctAtchdCard";case"36":return"paymentRefusalMobilePin";case"37":return"paymentRefusalContactlessFallback";case"38":return"paymentRefusalAuthRequired";default:return null}}function o(e){switch(e){case"Cancelled":return"paymentResultCancelled";case"Error":return"paymentResultError";case"Refused":return"paymentResultRefused";default:return null}}function c(e,a){if(l(e))switch(e.response.data.errorCode){case t.ErrorCode.AuthorizeDataNotValid:return["paymentAuthorizeDataNotValid",{checkoutId:a}];case t.ErrorCode.AuthorizeErrorUnknownReason:return["paymentAuthorizeErrorUnknownReason",{checkoutId:a}];case t.ErrorCode.AuthorizeCheckoutCaptured:return["paymentAuthorizeCheckoutCaptured",{checkoutId:a}];case t.ErrorCode.AuthorizeCheckoutAuthorized:return["paymentAuthorizeCheckoutAuthorized",{checkoutId:a}];case t.ErrorCode.AuthorizeCaptureFailure:return["paymentAuthorizeCaptureFailure",{checkoutId:a}];case t.ErrorCode.AuthorizeCancelOrRefund:return["paymentAuthorizeCancelOrRefund",{checkoutId:a}];case t.ErrorCode.ActionErrorUnknownReason:return["paymentActionErrorUnknownReason",{checkoutId:a}];case t.ErrorCode.ActionInvalidData:return["paymentActionInvalidData",{checkoutId:a}];case t.ErrorCode.ActionCaptureFailure:return["paymentActionCaptureFailure",{checkoutId:a}];case t.ErrorCode.ActionCancelOrRefund:return["paymentActionCancelOrRefund",{checkoutId:a}];case t.ErrorCode.AppNotFound:return["paymentPaymentAppNotFound",{checkoutId:a}];case t.ErrorCode.PaymentCheckoutCreated:return["paymentPaymentCheckoutCreated",{checkoutId:a}];case t.ErrorCode.PaymentAuthorizeNoItems:return["paymentAuthorizeNoItems",{checkoutId:a}];case t.ErrorCode.PaymentAuthorizeInvalidCustomer:return["paymentAuthorizeInvalidCustomer",{checkoutId:a}];case t.ErrorCode.PaymentAuthorizeInvalidDelivery:return["paymentAuthorizeInvalidDelivery",{checkoutId:a}];case t.ErrorCode.CheckoutPenguinInvalidStation:return["paymentCheckoutPaymentFailure",{checkoutId:a}];case t.ErrorCode.CheckoutPenguinInvalidTimeSlot:return["paymentPenguinInvalidTimeSlot",{checkoutId:a}];case t.ErrorCode.CheckoutPenguinNotEnoughLockers:return["paymentPenguinNotEnoughLockers",{checkoutId:a}];case t.ErrorCode.CheckoutPenguinTooManyItems:return["paymentPenguinTooManyItems",{checkoutId:a}];case t.ErrorCode.CheckoutPenguinProductInvalidUnits:return["paymentPenguinProductInvalidUnits",{checkoutId:a}];case t.ErrorCode.ServiceTimeInThePast:return["paymentCheckoutServiceTimeInPast",{checkoutId:a}];case t.ErrorCode.PaymentNotAllowedForProvidedCompanyAccount:return["paymentNotAllowedForCompanyAccount"]}else{const u=m(e==null?void 0:e.refusalReasonCode);if(u)return[u,{checkoutId:a}];const n=o(e==null?void 0:e.resultCode);if(n)return[n,{checkoutId:a}]}return["paymentCheckoutPaymentFailure",{checkoutId:a}]}function p(e,a,u=d){const[n,s]=c(e,a),i=u[n]({key:n,meta:s});if(!i)throw new Error("Could not resolve translation in getCheckoutPaymentErrorTexts()");return[i,n]}exports.CheckoutPaymentErrorTranslationKey=r;exports.default=p;
@@ -1,8 +1,8 @@
1
1
  import { ErrorCode as t } from "@ancon/wildcat-types";
2
2
  import "axios";
3
3
  import l from "../error/isSerializedAPIError.mjs";
4
- var r = /* @__PURE__ */ ((e) => (e.PaymentRefusalGeneral = "paymentRefusalGeneral", e.PaymentRefusalTransactionRefused = "paymentRefusalTransactionRefused", e.PaymentRefusalReferral = "paymentRefusalReferral", e.PaymentRefusalAcquirer = "paymentRefusalAcquirer", e.PaymentRefusalBlockedCard = "paymentRefusalBlockedCard", e.PaymentRefusalExpiredCard = "paymentRefusalExpiredCard", e.PaymentRefusalInvalidAmount = "paymentRefusalInvalidAmount", e.PaymentRefusalInvalidCardnumber = "paymentRefusalInvalidCardnumber", e.PaymentRefusalIssuerUnavailable = "paymentRefusalIssuerUnavailable", e.PaymentRefusalBankNotSupported = "paymentRefusalBankNotSupported", e.PaymentRefusal3dsecureAuthFailed = "paymentRefusal3dsecureAuthFailed", e.PaymentRefusalNoEnoughBalance = "paymentRefusalNoEnoughBalance", e.PaymentRefusalFraudDetected = "paymentRefusalFraudDetected", e.PaymentRefusalCancelled = "paymentRefusalCancelled", e.PaymentRefusalInvalidPin = "paymentRefusalInvalidPin", e.PaymentRefusalPinRetryExceeded = "paymentRefusalPinRetryExceeded", e.PaymentRefusalUnableValidatePin = "paymentRefusalUnableValidatePin", e.PaymentRefusalSubmmissionAdyen = "paymentRefusalSubmmissionAdyen", e.PaymentRefusalCvcDeclined = "paymentRefusalCvcDeclined", e.PaymentRefusalRestrictedCard = "paymentRefusalRestrictedCard", e.PaymentRefusalDoNotHonor = "paymentRefusalDoNotHonor", e.PaymentRefusalWdrwAmountExceeded = "paymentRefusalWdrwAmountExceeded", e.PaymentRefusalWdrwCountExceeded = "paymentRefusalWdrwCountExceeded", e.PaymentRefusalAvsDeclined = "paymentRefusalAvsDeclined", e.PaymentRefusalCardOnlinePin = "paymentRefusalCardOnlinePin", e.PaymentRefusalNoAcctAtchdCard = "paymentRefusalNoAcctAtchdCard", e.PaymentRefusalMobilePin = "paymentRefusalMobilePin", e.PaymentRefusalContactlessFallback = "paymentRefusalContactlessFallback", e.PaymentRefusalAuthRequired = "paymentRefusalAuthRequired", e.PaymentResultCancelled = "paymentResultCancelled", e.PaymentResultError = "paymentResultError", e.PaymentResultRefused = "paymentResultRefused", e.PaymentAuthorizeDataNotValid = "paymentAuthorizeDataNotValid", e.PaymentAuthorizeErrorUnknownReason = "paymentAuthorizeErrorUnknownReason", e.PaymentAuthorizeCheckoutCaptured = "paymentAuthorizeCheckoutCaptured", e.PaymentAuthorizeCheckoutAuthorized = "paymentAuthorizeCheckoutAuthorized", e.PaymentAuthorizeCaptureFailure = "paymentAuthorizeCaptureFailure", e.PaymentAuthorizeCancelOrRefund = "paymentAuthorizeCancelOrRefund", e.PaymentActionErrorUnknownReason = "paymentActionErrorUnknownReason", e.PaymentActionInvalidData = "paymentActionInvalidData", e.PaymentActionCaptureFailure = "paymentActionCaptureFailure", e.PaymentActionCancelOrRefund = "paymentActionCancelOrRefund", e.PaymentPaymentAppNotFound = "paymentPaymentAppNotFound", e.PaymentPaymentCheckoutCreated = "paymentPaymentCheckoutCreated", e.PaymentCheckoutPaymentFailure = "paymentCheckoutPaymentFailure", e.PaymentDetailsNotSupported = "paymentDetailsNotSupported", e.PaymentAuthorizeNoItems = "paymentAuthorizeNoItems", e.PaymentAuthorizeInvalidCustomer = "paymentAuthorizeInvalidCustomer", e.PaymentAuthorizeInvalidDelivery = "paymentAuthorizeInvalidDelivery", e.PaymentPenguinInvalidStation = "paymentPenguinInvalidStation", e.PaymentPenguinInvalidTimeSlot = "paymentPenguinInvalidTimeSlot", e.PaymentPenguinNotEnoughLockers = "paymentPenguinNotEnoughLockers", e.PaymentPenguinTooManyItems = "paymentPenguinTooManyItems", e.PaymentPenguinProductInvalidUnits = "paymentPenguinProductInvalidUnits", e.PaymentCheckoutServiceTimeInPast = "paymentCheckoutServiceTimeInPast", e))(r || {});
5
- const m = {
4
+ var m = /* @__PURE__ */ ((e) => (e.PaymentRefusalGeneral = "paymentRefusalGeneral", e.PaymentRefusalTransactionRefused = "paymentRefusalTransactionRefused", e.PaymentRefusalReferral = "paymentRefusalReferral", e.PaymentRefusalAcquirer = "paymentRefusalAcquirer", e.PaymentRefusalBlockedCard = "paymentRefusalBlockedCard", e.PaymentRefusalExpiredCard = "paymentRefusalExpiredCard", e.PaymentRefusalInvalidAmount = "paymentRefusalInvalidAmount", e.PaymentRefusalInvalidCardnumber = "paymentRefusalInvalidCardnumber", e.PaymentRefusalIssuerUnavailable = "paymentRefusalIssuerUnavailable", e.PaymentRefusalBankNotSupported = "paymentRefusalBankNotSupported", e.PaymentRefusal3dsecureAuthFailed = "paymentRefusal3dsecureAuthFailed", e.PaymentRefusalNoEnoughBalance = "paymentRefusalNoEnoughBalance", e.PaymentRefusalFraudDetected = "paymentRefusalFraudDetected", e.PaymentRefusalCancelled = "paymentRefusalCancelled", e.PaymentRefusalInvalidPin = "paymentRefusalInvalidPin", e.PaymentRefusalPinRetryExceeded = "paymentRefusalPinRetryExceeded", e.PaymentRefusalUnableValidatePin = "paymentRefusalUnableValidatePin", e.PaymentRefusalSubmmissionAdyen = "paymentRefusalSubmmissionAdyen", e.PaymentRefusalCvcDeclined = "paymentRefusalCvcDeclined", e.PaymentRefusalRestrictedCard = "paymentRefusalRestrictedCard", e.PaymentRefusalDoNotHonor = "paymentRefusalDoNotHonor", e.PaymentRefusalWdrwAmountExceeded = "paymentRefusalWdrwAmountExceeded", e.PaymentRefusalWdrwCountExceeded = "paymentRefusalWdrwCountExceeded", e.PaymentRefusalAvsDeclined = "paymentRefusalAvsDeclined", e.PaymentRefusalCardOnlinePin = "paymentRefusalCardOnlinePin", e.PaymentRefusalNoAcctAtchdCard = "paymentRefusalNoAcctAtchdCard", e.PaymentRefusalMobilePin = "paymentRefusalMobilePin", e.PaymentRefusalContactlessFallback = "paymentRefusalContactlessFallback", e.PaymentRefusalAuthRequired = "paymentRefusalAuthRequired", e.PaymentResultCancelled = "paymentResultCancelled", e.PaymentResultError = "paymentResultError", e.PaymentResultRefused = "paymentResultRefused", e.PaymentAuthorizeDataNotValid = "paymentAuthorizeDataNotValid", e.PaymentAuthorizeErrorUnknownReason = "paymentAuthorizeErrorUnknownReason", e.PaymentAuthorizeCheckoutCaptured = "paymentAuthorizeCheckoutCaptured", e.PaymentAuthorizeCheckoutAuthorized = "paymentAuthorizeCheckoutAuthorized", e.PaymentAuthorizeCaptureFailure = "paymentAuthorizeCaptureFailure", e.PaymentAuthorizeCancelOrRefund = "paymentAuthorizeCancelOrRefund", e.PaymentActionErrorUnknownReason = "paymentActionErrorUnknownReason", e.PaymentActionInvalidData = "paymentActionInvalidData", e.PaymentActionCaptureFailure = "paymentActionCaptureFailure", e.PaymentActionCancelOrRefund = "paymentActionCancelOrRefund", e.PaymentPaymentAppNotFound = "paymentPaymentAppNotFound", e.PaymentPaymentCheckoutCreated = "paymentPaymentCheckoutCreated", e.PaymentCheckoutPaymentFailure = "paymentCheckoutPaymentFailure", e.PaymentDetailsNotSupported = "paymentDetailsNotSupported", e.PaymentAuthorizeNoItems = "paymentAuthorizeNoItems", e.PaymentAuthorizeInvalidCustomer = "paymentAuthorizeInvalidCustomer", e.PaymentAuthorizeInvalidDelivery = "paymentAuthorizeInvalidDelivery", e.PaymentPenguinInvalidStation = "paymentPenguinInvalidStation", e.PaymentPenguinInvalidTimeSlot = "paymentPenguinInvalidTimeSlot", e.PaymentPenguinNotEnoughLockers = "paymentPenguinNotEnoughLockers", e.PaymentPenguinTooManyItems = "paymentPenguinTooManyItems", e.PaymentPenguinProductInvalidUnits = "paymentPenguinProductInvalidUnits", e.PaymentCheckoutServiceTimeInPast = "paymentCheckoutServiceTimeInPast", e.PaymentNotAllowedForCompanyAccount = "paymentNotAllowedForCompanyAccount", e))(m || {});
5
+ const r = {
6
6
  paymentRefusalGeneral: () => ({
7
7
  title: "Payment failure",
8
8
  message: "The transaction was refused."
@@ -222,6 +222,10 @@ const m = {
222
222
  paymentCheckoutServiceTimeInPast: ({ meta: e }) => ({
223
223
  title: "Payment failure",
224
224
  message: `The order time cannot be in the past. (${e.checkoutId})`
225
+ }),
226
+ paymentNotAllowedForCompanyAccount: () => ({
227
+ title: "Payment not allowed",
228
+ message: "Your company account can't make payments on this outlet. Please use private account or switch to a company account of this outlet."
225
229
  })
226
230
  };
227
231
  function d(e) {
@@ -413,6 +417,11 @@ function c(e, a) {
413
417
  "paymentCheckoutServiceTimeInPast",
414
418
  { checkoutId: a }
415
419
  ];
420
+ case t.PaymentNotAllowedForProvidedCompanyAccount:
421
+ return [
422
+ "paymentNotAllowedForCompanyAccount"
423
+ /* PaymentNotAllowedForCompanyAccount */
424
+ ];
416
425
  }
417
426
  else {
418
427
  const u = d(
@@ -432,7 +441,7 @@ function c(e, a) {
432
441
  { checkoutId: a }
433
442
  ];
434
443
  }
435
- function R(e, a, u = m) {
444
+ function R(e, a, u = r) {
436
445
  const [n, s] = c(e, a), i = u[n]({ key: n, meta: s });
437
446
  if (!i)
438
447
  throw new Error(
@@ -441,6 +450,6 @@ function R(e, a, u = m) {
441
450
  return [i, n];
442
451
  }
443
452
  export {
444
- r as CheckoutPaymentErrorTranslationKey,
453
+ m as CheckoutPaymentErrorTranslationKey,
445
454
  R as default
446
455
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ancon/wildcat-utils",
3
- "version": "1.40.45",
3
+ "version": "1.40.46",
4
4
  "private": false,
5
5
  "main": "index.js",
6
6
  "module": "index.mjs",