UNPKG

bc-payments-sdk

Version:

BetterCommerce's Payments NodeJS SDK is a complete solution for storefront clients that integrate payments. `bc-payments-sdk` is a single point interface for storefront clients for interacting with payment gateways.

275 lines (274 loc) 13.7 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Nuvei = exports.Juspay = exports.OmniCapital = exports.ClearPay = exports.Klarna = exports.Stripe = exports.Checkout = exports.PayPal = exports.PaymentStatus = void 0; /** * Enum {PaymentStatus} contains the list of payment statuses for a payment operation. * * These statuses are used to represent the current state of a payment operation. * * @enum {number} * @readonly * @memberof Payment * @ordinal {number} PENDING - Payment is in progress. * @ordinal {number} AUTHORIZED - Payment was authorized by the payment provider. * @ordinal {number} PAID - Payment was successfully paid. * @ordinal {number} DECLINED - Payment was declined by the payment provider. * @ordinal {number} CANCELLED - Payment was cancelled. * @ordinal {number} CANCELLED_BY_PSP - Payment was cancelled by the payment service provider. * @ordinal {number} REFUNDED - Payment was refunded. * @ordinal {number} CHARGING - Payment is being charged. * @ordinal {number} VOIDED - Payment was voided. * @ordinal {number} REQUIRE_PRE_AUTH - Pre-authorization is required for the payment. * @ordinal {number} PROBLEM_IN_REFUND - There was a problem refunding the payment. * @ordinal {number} PROBLEM_IN_POST_AUTH - There was a problem performing the post-authorization process. * @ordinal {number} AWAITING_POST_AUTH_RESPONSE - The payment is waiting for a response from the post-authorization process. * @ordinal {number} REQUEST_TO_CANCEL_PRE_AUTH - There was a request to cancel the pre-authorization. * @ordinal {number} PROBLEM_IN_CANCEL_PRE_AUTH - There was a problem cancelling the pre-authorization. * @ordinal {number} PO_RECEIVED - The purchase order was received. * @ordinal {number} DUPLICATE_REQUEST - The payment request was a duplicate. * @ordinal {number} INITIATED - The payment was initiated. * @ordinal {number} RETRY_REFUND - The payment refund should be retried. */ var PaymentStatus; (function (PaymentStatus) { PaymentStatus[PaymentStatus["NONE"] = -1] = "NONE"; PaymentStatus[PaymentStatus["PENDING"] = 0] = "PENDING"; PaymentStatus[PaymentStatus["AUTHORIZED"] = 1] = "AUTHORIZED"; PaymentStatus[PaymentStatus["PAID"] = 2] = "PAID"; PaymentStatus[PaymentStatus["DECLINED"] = 3] = "DECLINED"; PaymentStatus[PaymentStatus["CANCELLED"] = 4] = "CANCELLED"; PaymentStatus[PaymentStatus["CANCELLED_BY_PSP"] = 5] = "CANCELLED_BY_PSP"; PaymentStatus[PaymentStatus["REFUNDED"] = 6] = "REFUNDED"; PaymentStatus[PaymentStatus["CHARGING"] = 7] = "CHARGING"; PaymentStatus[PaymentStatus["VOIDED"] = 8] = "VOIDED"; PaymentStatus[PaymentStatus["REQUIRE_PRE_AUTH"] = 9] = "REQUIRE_PRE_AUTH"; PaymentStatus[PaymentStatus["PROBLEM_IN_REFUND"] = 10] = "PROBLEM_IN_REFUND"; PaymentStatus[PaymentStatus["PROBLEM_IN_POST_AUTH"] = 11] = "PROBLEM_IN_POST_AUTH"; PaymentStatus[PaymentStatus["AWAITING_POST_AUTH_RESPONSE"] = 12] = "AWAITING_POST_AUTH_RESPONSE"; PaymentStatus[PaymentStatus["REQUEST_TO_CANCEL_PRE_AUTH"] = 13] = "REQUEST_TO_CANCEL_PRE_AUTH"; PaymentStatus[PaymentStatus["PROBLEM_IN_CANCEL_PRE_AUTH"] = 14] = "PROBLEM_IN_CANCEL_PRE_AUTH"; PaymentStatus[PaymentStatus["PO_RECEIVED"] = 15] = "PO_RECEIVED"; PaymentStatus[PaymentStatus["DUPLICATE_REQUEST"] = 16] = "DUPLICATE_REQUEST"; PaymentStatus[PaymentStatus["INITIATED"] = 17] = "INITIATED"; PaymentStatus[PaymentStatus["RETRY_REFUND"] = 18] = "RETRY_REFUND"; PaymentStatus[PaymentStatus["AUTHORIZED_BY_WEBHOOK"] = 19] = "AUTHORIZED_BY_WEBHOOK"; PaymentStatus[PaymentStatus["PROCESSING"] = 20] = "PROCESSING"; })(PaymentStatus || (exports.PaymentStatus = PaymentStatus = {})); ; var PayPal; (function (PayPal) { /** * Enum {PaymentStatus} contains the list of payment statuses for a PayPal payment operation. * * These statuses are used to represent the current state of a PayPal payment operation. * * @enum {string} * @readonly * @memberof PayPal */ let PaymentStatus; (function (PaymentStatus) { // The order was created with the specified context. PaymentStatus["CREATED"] = "CREATED"; // The order was saved and persisted. The order status continues to be in progress until a capture is made with final_capture = true for all purchase units within the order. PaymentStatus["SAVED"] = "SAVED"; // The customer approved the payment through the PayPal wallet or another form of guest or unbranded payment. For example, a card, bank account, or so on. PaymentStatus["APPROVED"] = "APPROVED"; // All purchase units in the order are voided. PaymentStatus["VOIDED"] = "VOIDED"; // The payment was authorized or the authorized payment was captured for the order. PaymentStatus["COMPLETED"] = "COMPLETED"; // The order requires an action from the payer (e.g. 3DS authentication). Redirect the payer to the "rel":"payer-action" HATEOAS link returned as part of the response prior to authorizing or capturing the order. PaymentStatus["PAYER_ACTION_REQUIRED"] = "PAYER_ACTION_REQUIRED"; })(PaymentStatus = PayPal.PaymentStatus || (PayPal.PaymentStatus = {})); ; })(PayPal || (exports.PayPal = PayPal = {})); ; var Checkout; (function (Checkout) { /** * Enum {PaymentStatus} contains the list of payment statuses for a Checkout payment operation. * * These statuses are used to represent the current state of a Checkout payment operation. * * @enum {string} * @readonly * @memberof Checkout */ let PaymentStatus; (function (PaymentStatus) { PaymentStatus["PENDING"] = "Pending"; PaymentStatus["AUTHORIZED"] = "Authorized"; PaymentStatus["CARD_VERIFIED"] = "Card Verified"; PaymentStatus["VOIDED"] = "Voided"; PaymentStatus["PARTIALLY_CAPTURED"] = "Partially Captured"; PaymentStatus["CAPTURED"] = "Captured"; PaymentStatus["PARTIALLY_REFUNDED"] = "Partially Refunded"; PaymentStatus["REFUNDED"] = "Refunded"; PaymentStatus["DECLINED"] = "Declined"; PaymentStatus["CANCELED"] = "Canceled"; PaymentStatus["EXPIRED"] = "Expired"; PaymentStatus["PAID"] = "Paid"; })(PaymentStatus = Checkout.PaymentStatus || (Checkout.PaymentStatus = {})); ; })(Checkout || (exports.Checkout = Checkout = {})); ; var Stripe; (function (Stripe) { /** * Enum {PaymentStatus} contains the list of payment statuses for a Stripe payment operation. * * These statuses are used to represent the current state of a Stripe payment operation. * * @enum {string} * @readonly * @memberof Stripe */ let PaymentStatus; (function (PaymentStatus) { PaymentStatus["SUCCEEDED"] = "succeeded"; PaymentStatus["PROCESSING"] = "processing"; PaymentStatus["UNSUCCESSFUL"] = "requires_payment_method"; })(PaymentStatus = Stripe.PaymentStatus || (Stripe.PaymentStatus = {})); ; })(Stripe || (exports.Stripe = Stripe = {})); ; var Klarna; (function (Klarna) { /** * Enum {PaymentStatus} contains the list of payment statuses for a Klarna payment operation. * * These statuses are used to represent the current state of a Klarna payment operation. * * @enum {string} * @readonly * @memberof Klarna * * @ordinal {string} AUTHORIZED - The payment method has been authorized. * @ordinal {string} PART_CAPTURED - A partial capture has been taken. * @ordinal {string} CAPTURED - A full capture has been taken. * @ordinal {string} CANCELLED - The payment has been cancelled. * @ordinal {string} EXPIRED - The payment has expired. * @ordinal {string} CLOSED - The payment has been closed. */ let PaymentStatus; (function (PaymentStatus) { PaymentStatus["AUTHORIZED"] = "AUTHORIZED"; PaymentStatus["PART_CAPTURED"] = "PART_CAPTURED"; PaymentStatus["CAPTURED"] = "CAPTURED"; PaymentStatus["CANCELLED"] = "CANCELLED"; PaymentStatus["EXPIRED"] = "EXPIRED"; PaymentStatus["CLOSED"] = "CLOSED"; })(PaymentStatus = Klarna.PaymentStatus || (Klarna.PaymentStatus = {})); ; })(Klarna || (exports.Klarna = Klarna = {})); ; var ClearPay; (function (ClearPay) { /** * Enum {PaymentStatus} contains the list of payment statuses for a ClearPay payment operation. * * These statuses are used to represent the current state of a ClearPay payment operation. * * @enum {string} * @readonly * @memberof ClearPay * * @ordinal {string} APPROVED - The payment was approved. * @ordinal {string} DECLINED - The payment was declined. */ let PaymentStatus; (function (PaymentStatus) { PaymentStatus["APPROVED"] = "APPROVED"; PaymentStatus["DECLINED"] = "DECLINED"; })(PaymentStatus = ClearPay.PaymentStatus || (ClearPay.PaymentStatus = {})); ; })(ClearPay || (exports.ClearPay = ClearPay = {})); ; var OmniCapital; (function (OmniCapital) { /** * Enum {@link PaymentStatus} represents the various statuses a transaction can have * in the OmniCapital retail finance workflow. * * @readonly * @enum {string} */ let PaymentStatus; (function (PaymentStatus) { PaymentStatus["PENDING"] = "Pending"; PaymentStatus["IN_PROGRESS"] = "In Progress"; PaymentStatus["DECLINED"] = "Declined"; PaymentStatus["UNDERWRITER"] = "Underwriter"; PaymentStatus["CUSTOMER_ACTION_REQUIRED"] = "Customer Action Required"; PaymentStatus["REFERRAL_OVERRIDE_APPROVE"] = "Referral (Override - Approve)"; PaymentStatus["REFERRAL_OVERRIDE_RESCORE"] = "Referral (Override - Rescore)"; PaymentStatus["SIGN_DOCUMENTS"] = "Sign Documents"; PaymentStatus["SIGN_DOCUMENTS_AMENDMENT"] = "Sign Documents (Amendment)"; PaymentStatus["APPROVED"] = "Approved"; PaymentStatus["ORDER_FULFILLED"] = "order fulfilled"; PaymentStatus["AWAITING_FULFILMENT"] = "Awaiting fulfilment"; PaymentStatus["EXCEPTION"] = "Exception"; PaymentStatus["PAYMENT_REQUESTED"] = "Payment Requested"; PaymentStatus["CDS_NOTE_REQUIRED"] = "C.D.S. Note Required"; PaymentStatus["CDS_NOTE_REVIEW"] = "C.D.S. Note Review"; PaymentStatus["CDS_NOTE_REVIEW_CUSTOMER"] = "C.D.S. Note Review (Customer)"; PaymentStatus["CDS_NOTE_REVIEW_CUSTOMER_INVESTIGATION"] = "C.D.S. Note Review (Customer - Investigation)"; PaymentStatus["CDS_NOTE_REVIEW_CUSTOMER_ISSUE"] = "C.D.S. Note Review (Customer - Issue)"; PaymentStatus["COMPLETE"] = "Complete"; PaymentStatus["ORDER_CANCELLED"] = "Order cancelled"; PaymentStatus["FINANCE_OFFER_WITHDRAWN"] = "Finance offer withdrawn"; PaymentStatus["ORDER_REFUNDED"] = "Order refunded"; PaymentStatus["APPLICATION_LAPSED"] = "Application Lapsed"; PaymentStatus["CREDIT_CHECK_DECLINED"] = "Credit Check Declined"; PaymentStatus["CREDIT_CHECK_PRE_DECLINE"] = "Credit Check Pre Decline"; })(PaymentStatus = OmniCapital.PaymentStatus || (OmniCapital.PaymentStatus = {})); })(OmniCapital || (exports.OmniCapital = OmniCapital = {})); var Juspay; (function (Juspay) { /** * Enum {PaymentStatus} contains the list of payment statuses for a Juspay payment operation. * * These statuses are used to represent the current state of a Juspay payment operation. * * @enum {string} * @readonly * @memberof Juspay * * @property {string} AUTHORIZATION_FAILED - The authorization of the payment failed. * @property {string} AUTHENTICATION_FAILED - The authentication of the payment failed. * @property {string} PENDING - The payment is pending. * @property {string} VBV_SUCCESSFUL - The VBV (Verified by Visa) authentication of the payment was successful. * @property {string} CHARGED - The payment was charged. * @property {string} JUSPAY_DECLINED - The payment was declined by Juspay. * @property {string} AUTO_REFUNDED - The payment was automatically refunded. * @property {string} CAPTURE_FAILED - The capture of the payment failed. * @property {string} NOT_FOUND - The payment was not found. */ let PaymentOrderStatus; (function (PaymentOrderStatus) { PaymentOrderStatus["AUTHORIZATION_FAILED"] = "AUTHORIZATION_FAILED"; PaymentOrderStatus["AUTHENTICATION_FAILED"] = "AUTHENTICATION_FAILED"; PaymentOrderStatus["PENDING"] = "PENDING_VBV"; PaymentOrderStatus["VBV_SUCCESSFUL"] = "VBV_SUCCESSFUL"; PaymentOrderStatus["CHARGED"] = "CHARGED"; PaymentOrderStatus["JUSPAY_DECLINED"] = "JUSPAY_DECLINED"; PaymentOrderStatus["AUTO_REFUNDED"] = "AUTO_REFUNDED"; PaymentOrderStatus["CAPTURE_FAILED"] = "CAPTURE_FAILED"; PaymentOrderStatus["NOT_FOUND"] = "NOT_FOUND"; PaymentOrderStatus["AUTHORIZING"] = "AUTHORIZING"; PaymentOrderStatus["STARTED"] = "STARTED"; PaymentOrderStatus["CAPTURE_INITIATED"] = "CAPTURE_INITIATED"; })(PaymentOrderStatus = Juspay.PaymentOrderStatus || (Juspay.PaymentOrderStatus = {})); ; })(Juspay || (exports.Juspay = Juspay = {})); ; var Nuvei; (function (Nuvei) { let PaymentStatus; (function (PaymentStatus) { PaymentStatus["APPROVED"] = "APPROVED"; PaymentStatus["DECLINED"] = "DECLINED"; PaymentStatus["ERROR"] = "ERROR"; })(PaymentStatus = Nuvei.PaymentStatus || (Nuvei.PaymentStatus = {})); })(Nuvei || (exports.Nuvei = Nuvei = {}));