'use strict';

exports.PAYMENT_MODE = void 0;
(function (PAYMENT_MODE) {
    PAYMENT_MODE["ECOM"] = "ecom";
    PAYMENT_MODE["BNPL"] = "bnpl";
    PAYMENT_MODE["APPLE_PAY"] = "apple_pay";
    PAYMENT_MODE["GOOGLE_PAY"] = "google_pay";
})(exports.PAYMENT_MODE || (exports.PAYMENT_MODE = {}));
// Maps the backend payment method types to the frontend payment method types
var PAYMENT_METHOD_TYPES;
(function (PAYMENT_METHOD_TYPES) {
    PAYMENT_METHOD_TYPES["CARD"] = "card";
    PAYMENT_METHOD_TYPES["BANK_ACCOUNT"] = "bank_account";
    PAYMENT_METHOD_TYPES["APPLE_PAY"] = "apple_pay";
    PAYMENT_METHOD_TYPES["GOOGLE_PAY"] = "google_pay";
    PAYMENT_METHOD_TYPES["SEZZLE"] = "sezzle";
    PAYMENT_METHOD_TYPES["PLAID"] = "plaid";
})(PAYMENT_METHOD_TYPES || (PAYMENT_METHOD_TYPES = {}));
// Available payment methods for the modular checkout component (differentiates between saved and new payment methods)
exports.PAYMENT_METHODS = void 0;
(function (PAYMENT_METHODS) {
    PAYMENT_METHODS["SAVED_CARD"] = "saved_card";
    PAYMENT_METHODS["NEW_CARD"] = "new_card";
    PAYMENT_METHODS["SAVED_BANK_ACCOUNT"] = "saved_bank_account";
    PAYMENT_METHODS["NEW_BANK_ACCOUNT"] = "new_bank_account";
    PAYMENT_METHODS["APPLE_PAY"] = "apple_pay";
    PAYMENT_METHODS["GOOGLE_PAY"] = "google_pay";
    PAYMENT_METHODS["SEZZLE"] = "sezzle";
    PAYMENT_METHODS["PLAID"] = "plaid";
})(exports.PAYMENT_METHODS || (exports.PAYMENT_METHODS = {}));
const mapPaymentMethodType = (type) => {
    switch (type) {
        case PAYMENT_METHOD_TYPES.CARD:
            return exports.PAYMENT_METHODS.SAVED_CARD;
        case PAYMENT_METHOD_TYPES.BANK_ACCOUNT:
            return exports.PAYMENT_METHODS.SAVED_BANK_ACCOUNT;
        default:
            return type;
    }
};
class PaymentMethod {
    constructor(paymentMethod) {
        this.id = paymentMethod.id;
        this.type = mapPaymentMethodType(paymentMethod.type);
        this.status = paymentMethod.status;
        this.invalid_reason = paymentMethod.invalid_reason;
        this.name = paymentMethod.name;
        this.brand = paymentMethod.brand;
        this.acct_last_four = paymentMethod.acct_last_four;
        this.account_type = paymentMethod.account_type;
        this.month = paymentMethod.month;
        this.year = paymentMethod.year;
        this.address_line1_check = paymentMethod.address_line1_check;
        this.address_postal_code_check = paymentMethod.address_postal_code_check;
        this.bin_details = paymentMethod.bin_details;
    }
}

exports.PaymentMethod = PaymentMethod;
