812 lines
34 KiB
TypeScript
812 lines
34 KiB
TypeScript
// Metro module 3839 (f3840).
|
|
import Record from "../lib/Record";
|
|
import { IRREDEEMABLE_PAYMENT_SOURCES, PaymentGateways, PaymentSourceTypes } from "../Constants";
|
|
import { assertNever } from "../utils/GlobalUtils";
|
|
import * as _Module1384 from "../_bundle/Module1384";
|
|
import { $callWithNewTarget } from "../_hermes/prelude";
|
|
let PaypalSourceRecord, SofortSourceRecord, GiropaySourceRecord, Przelewy24SourceRecord, EPSSourceRecord, IdealSourceRecord, PaysafeSourceRecord, GcashSourceRecord, GrabPayMySourceRecord, MomoWalletSourceRecord, VenmoSourceRecord, KaKaoPaySourceRecord, GoPayWalletSourceRecord, BancontactSourceRecord, CashAppSourceRecord, TDSWalletSourceRecord;
|
|
class PaymentSourceRecord extends Record {
|
|
constructor(a0) {
|
|
super();
|
|
if (Object.values(PaymentSourceTypes).includes(a0.type)) {
|
|
this.id = a0.id;
|
|
this.type = a0.type;
|
|
this.paymentGateway = a0.paymentGateway;
|
|
let invalid = a0.invalid;
|
|
if (invalid == null) {
|
|
invalid = false;
|
|
}
|
|
this.invalid = invalid;
|
|
let billingAddress = a0.billingAddress;
|
|
if (billingAddress == null) {
|
|
billingAddress = {};
|
|
}
|
|
this.billingAddress = billingAddress;
|
|
this.isDefault = a0.isDefault;
|
|
let flags = a0.flags;
|
|
if (flags == null) {
|
|
flags = 0;
|
|
}
|
|
this.flags = flags;
|
|
let country = a0.country;
|
|
if (country == null) {
|
|
country = "";
|
|
}
|
|
this.country = country;
|
|
this.pixMetadata = a0.pixMetadata;
|
|
return this;
|
|
}
|
|
throw new Error(`Unrecognized payment source type ${a0.type}`);
|
|
}
|
|
static createFromServer(a0) {
|
|
let billing_address = a0.billing_address;
|
|
if (billing_address == null) {
|
|
billing_address = {};
|
|
}
|
|
const r9 = {
|
|
id: a0.id,
|
|
type: a0.type,
|
|
paymentGateway: a0.payment_gateway,
|
|
invalid: a0.invalid,
|
|
isDefault: a0.default,
|
|
billingAddress: {
|
|
name: billing_address.name,
|
|
line1: billing_address.line_1,
|
|
line2: billing_address.line_2,
|
|
city: billing_address.city,
|
|
postalCode: billing_address.postal_code,
|
|
state: billing_address.state,
|
|
country: billing_address.country
|
|
},
|
|
country: a0.country,
|
|
flags: a0.flags,
|
|
pixMetadata: a0.pix != null ? {
|
|
taxId: a0.pix.tax_id
|
|
} : void 0
|
|
};
|
|
const type = a0.type;
|
|
if (PaymentSourceTypes.CARD === type) {
|
|
const r607 = {
|
|
...r9,
|
|
brand: a0.brand,
|
|
last4: a0.last_4,
|
|
expiresMonth: a0.expires_month,
|
|
expiresYear: a0.expires_year
|
|
};
|
|
const prototypeOf18 = Object.getPrototypeOf(CreditCardSourceRecord);
|
|
const r620 = Object.create(CreditCardSourceRecord.prototype);
|
|
const r623 = $callWithNewTarget(prototypeOf18, r620, CreditCardSourceRecord, r607);
|
|
if (r607.type !== PaymentSourceTypes.CARD) {
|
|
throw new Error(`Cannot instantiate CreditCardSourceRecord with type: ${r607.type}, must be ${PaymentSourceTypes.CARD}`);
|
|
}
|
|
let brand = r607.brand;
|
|
if (brand == null) {
|
|
brand = "";
|
|
}
|
|
const r628 = r623 instanceof Object ? r623 : r620;
|
|
r628.brand = brand;
|
|
let last4 = r607.last4;
|
|
if (last4 == null) {
|
|
last4 = "";
|
|
}
|
|
r628.last4 = last4;
|
|
let expiresMonth = r607.expiresMonth;
|
|
if (expiresMonth == null) {
|
|
expiresMonth = 0;
|
|
}
|
|
r628.expiresMonth = expiresMonth;
|
|
let expiresYear = r607.expiresYear;
|
|
if (expiresYear == null) {
|
|
expiresYear = 0;
|
|
}
|
|
r628.expiresYear = expiresYear;
|
|
return r628;
|
|
}
|
|
if (PaymentSourceTypes.PAYPAL === type) {
|
|
const r574 = {
|
|
...r9,
|
|
email: a0.email
|
|
};
|
|
const prototypeOf17 = Object.getPrototypeOf(PaypalSourceRecord);
|
|
const r584 = Object.create(PaypalSourceRecord.prototype);
|
|
const r587 = $callWithNewTarget(prototypeOf17, r584, PaypalSourceRecord, r574);
|
|
if (r574.type !== PaymentSourceTypes.PAYPAL) {
|
|
throw new Error(`Cannot instantiate PaypalSourceRecord with type: ${r574.type}, must be ${PaymentSourceTypes.PAYPAL}`);
|
|
}
|
|
const email3 = r574.email || "";
|
|
const r592 = r587 instanceof Object ? r587 : r584;
|
|
r592.email = email3;
|
|
return r592;
|
|
}
|
|
if (PaymentSourceTypes.VENMO === type) {
|
|
const r541 = {
|
|
...r9,
|
|
username: a0.username
|
|
};
|
|
const prototypeOf16 = Object.getPrototypeOf(VenmoSourceRecord);
|
|
const r551 = Object.create(VenmoSourceRecord.prototype);
|
|
const r554 = $callWithNewTarget(prototypeOf16, r551, VenmoSourceRecord, r541);
|
|
if (r541.type !== PaymentSourceTypes.VENMO) {
|
|
throw new Error(`Cannot instantiate VenmoSourceRecord with type: ${r541.type}, must be ${PaymentSourceTypes.VENMO}`);
|
|
}
|
|
const username2 = r541.username || "";
|
|
const r559 = r554 instanceof Object ? r554 : r551;
|
|
r559.username = username2;
|
|
return r559;
|
|
}
|
|
if (PaymentSourceTypes.SEPA_DEBIT !== type && PaymentSourceTypes.SOFORT !== type) {
|
|
if (PaymentSourceTypes.GIROPAY === type) {
|
|
const r474 = {
|
|
...r9
|
|
};
|
|
const prototypeOf14 = Object.getPrototypeOf(GiropaySourceRecord);
|
|
const r483 = Object.create(GiropaySourceRecord.prototype);
|
|
const r486 = $callWithNewTarget(prototypeOf14, r483, GiropaySourceRecord, r474);
|
|
if (r474.type !== PaymentSourceTypes.GIROPAY) {
|
|
throw new Error(`Cannot instantiate GiropaySourceRecord with type: ${r474.type}, must be ${PaymentSourceTypes.GIROPAY}`);
|
|
}
|
|
return r486 instanceof Object ? r486 : r483;
|
|
}
|
|
if (PaymentSourceTypes.PRZELEWY24 === type) {
|
|
const r439 = {
|
|
...r9,
|
|
email: a0.email,
|
|
bank: a0.bank
|
|
};
|
|
const prototypeOf13 = Object.getPrototypeOf(Przelewy24SourceRecord);
|
|
const r450 = Object.create(Przelewy24SourceRecord.prototype);
|
|
const r453 = $callWithNewTarget(prototypeOf13, r450, Przelewy24SourceRecord, r439);
|
|
if (r439.type !== PaymentSourceTypes.PRZELEWY24) {
|
|
throw new Error(`Cannot instantiate Przelewy24SourceRecord with type: ${r439.type}, must be ${PaymentSourceTypes.PRZELEWY24}`);
|
|
}
|
|
const email = r439.email || "";
|
|
const r458 = r453 instanceof Object ? r453 : r450;
|
|
r458.email = email;
|
|
r458.bank = r439.bank;
|
|
return r458;
|
|
}
|
|
if (PaymentSourceTypes.EPS === type) {
|
|
const r406 = {
|
|
...r9,
|
|
bank: a0.bank
|
|
};
|
|
const prototypeOf12 = Object.getPrototypeOf(EPSSourceRecord);
|
|
const r416 = Object.create(EPSSourceRecord.prototype);
|
|
const r419 = $callWithNewTarget(prototypeOf12, r416, EPSSourceRecord, r406);
|
|
if (r406.type !== PaymentSourceTypes.EPS) {
|
|
throw new Error(`Cannot instantiate EPSSourceRecord with type: ${r406.type}, must be ${PaymentSourceTypes.EPS}`);
|
|
}
|
|
const r423 = r419 instanceof Object ? r419 : r416;
|
|
r423.bank = r406.bank;
|
|
return r423;
|
|
}
|
|
if (PaymentSourceTypes.PAYSAFE_CARD === type) {
|
|
const r375 = {
|
|
...r9
|
|
};
|
|
const prototypeOf11 = Object.getPrototypeOf(PaysafeSourceRecord);
|
|
const r384 = Object.create(PaysafeSourceRecord.prototype);
|
|
const r387 = $callWithNewTarget(prototypeOf11, r384, PaysafeSourceRecord, r375);
|
|
if (r375.type !== PaymentSourceTypes.PAYSAFE_CARD) {
|
|
throw new Error(`Cannot instantiate PaysafeSourceRecord with type: ${r375.type}, must be ${PaymentSourceTypes.PAYSAFE_CARD}`);
|
|
}
|
|
return r387 instanceof Object ? r387 : r384;
|
|
}
|
|
if (PaymentSourceTypes.GCASH === type) {
|
|
const r344 = {
|
|
...r9
|
|
};
|
|
const prototypeOf10 = Object.getPrototypeOf(GcashSourceRecord);
|
|
const r353 = Object.create(GcashSourceRecord.prototype);
|
|
const r356 = $callWithNewTarget(prototypeOf10, r353, GcashSourceRecord, r344);
|
|
if (r344.type !== PaymentSourceTypes.GCASH) {
|
|
throw new Error(`Cannot instantiate GcashSourceRecord with type: ${r344.type}, must be ${PaymentSourceTypes.GCASH}`);
|
|
}
|
|
return r356 instanceof Object ? r356 : r353;
|
|
}
|
|
if (PaymentSourceTypes.GRABPAY_MY === type) {
|
|
const r313 = {
|
|
...r9
|
|
};
|
|
const prototypeOf9 = Object.getPrototypeOf(GrabPayMySourceRecord);
|
|
const r322 = Object.create(GrabPayMySourceRecord.prototype);
|
|
const r325 = $callWithNewTarget(prototypeOf9, r322, GrabPayMySourceRecord, r313);
|
|
if (r313.type !== PaymentSourceTypes.GRABPAY_MY) {
|
|
throw new Error(`Cannot instantiate GrabPayMySourceRecord with type: ${r313.type}, must be ${PaymentSourceTypes.GRABPAY_MY}`);
|
|
}
|
|
return r325 instanceof Object ? r325 : r322;
|
|
}
|
|
if (PaymentSourceTypes.MOMO_WALLET === type) {
|
|
const r282 = {
|
|
...r9
|
|
};
|
|
const prototypeOf8 = Object.getPrototypeOf(MomoWalletSourceRecord);
|
|
const r291 = Object.create(MomoWalletSourceRecord.prototype);
|
|
const r294 = $callWithNewTarget(prototypeOf8, r291, MomoWalletSourceRecord, r282);
|
|
if (r282.type !== PaymentSourceTypes.MOMO_WALLET) {
|
|
throw new Error(`Cannot instantiate MomoWalletSourceRecord with type: ${r282.type}, must be ${PaymentSourceTypes.MOMO_WALLET}`);
|
|
}
|
|
return r294 instanceof Object ? r294 : r291;
|
|
}
|
|
if (PaymentSourceTypes.KAKAOPAY === type) {
|
|
const r251 = {
|
|
...r9
|
|
};
|
|
const prototypeOf7 = Object.getPrototypeOf(KaKaoPaySourceRecord);
|
|
const r260 = Object.create(KaKaoPaySourceRecord.prototype);
|
|
const r263 = $callWithNewTarget(prototypeOf7, r260, KaKaoPaySourceRecord, r251);
|
|
if (r251.type !== PaymentSourceTypes.KAKAOPAY) {
|
|
throw new Error(`Cannot instantiate KaKaoPaySourceRecord with type: ${r251.type}, must be ${PaymentSourceTypes.KAKAOPAY}`);
|
|
}
|
|
return r263 instanceof Object ? r263 : r260;
|
|
}
|
|
if (PaymentSourceTypes.GOPAY_WALLET === type) {
|
|
const r220 = {
|
|
...r9
|
|
};
|
|
const prototypeOf6 = Object.getPrototypeOf(GoPayWalletSourceRecord);
|
|
const r229 = Object.create(GoPayWalletSourceRecord.prototype);
|
|
const r232 = $callWithNewTarget(prototypeOf6, r229, GoPayWalletSourceRecord, r220);
|
|
if (r220.type !== PaymentSourceTypes.GOPAY_WALLET) {
|
|
throw new Error(`Cannot instantiate GoPayWalletSourceRecord with type: ${r220.type}, must be ${PaymentSourceTypes.GOPAY_WALLET}`);
|
|
}
|
|
return r232 instanceof Object ? r232 : r229;
|
|
}
|
|
if (PaymentSourceTypes.BANCONTACT === type) {
|
|
const r189 = {
|
|
...r9
|
|
};
|
|
const prototypeOf5 = Object.getPrototypeOf(BancontactSourceRecord);
|
|
const r198 = Object.create(BancontactSourceRecord.prototype);
|
|
const r201 = $callWithNewTarget(prototypeOf5, r198, BancontactSourceRecord, r189);
|
|
if (r189.type !== PaymentSourceTypes.BANCONTACT) {
|
|
throw new Error(`Cannot instantiate BancontactSourceRecord with type: ${r189.type}, must be ${PaymentSourceTypes.BANCONTACT}`);
|
|
}
|
|
return r201 instanceof Object ? r201 : r198;
|
|
}
|
|
if (PaymentSourceTypes.IDEAL === type) {
|
|
const r156 = {
|
|
...r9,
|
|
bank: a0.bank
|
|
};
|
|
const prototypeOf4 = Object.getPrototypeOf(IdealSourceRecord);
|
|
const r166 = Object.create(IdealSourceRecord.prototype);
|
|
const r169 = $callWithNewTarget(prototypeOf4, r166, IdealSourceRecord, r156);
|
|
if (r156.type !== PaymentSourceTypes.IDEAL) {
|
|
throw new Error(`Cannot instantiate IdealSourceRecord with type: ${r156.type}, must be ${PaymentSourceTypes.IDEAL}`);
|
|
}
|
|
const r173 = r169 instanceof Object ? r169 : r166;
|
|
r173.bank = r156.bank;
|
|
return r173;
|
|
}
|
|
if (PaymentSourceTypes.CASH_APP === type) {
|
|
const r123 = {
|
|
...r9,
|
|
username: a0.username
|
|
};
|
|
const prototypeOf3 = Object.getPrototypeOf(CashAppSourceRecord);
|
|
const r133 = Object.create(CashAppSourceRecord.prototype);
|
|
const r136 = $callWithNewTarget(prototypeOf3, r133, CashAppSourceRecord, r123);
|
|
if (r123.type !== PaymentSourceTypes.CASH_APP) {
|
|
throw new Error(`Cannot instantiate Cashapp with type: ${r123.type}, must be ${PaymentSourceTypes.CASH_APP}`);
|
|
}
|
|
const username = r123.username || "";
|
|
const r141 = r136 instanceof Object ? r136 : r133;
|
|
r141.username = username;
|
|
return r141;
|
|
}
|
|
if (PaymentSourceTypes.TDS_WALLET === type) {
|
|
const r92 = {
|
|
...r9
|
|
};
|
|
const prototypeOf2 = Object.getPrototypeOf(TDSWalletSourceRecord);
|
|
const r101 = Object.create(TDSWalletSourceRecord.prototype);
|
|
const r104 = $callWithNewTarget(prototypeOf2, r101, TDSWalletSourceRecord, r92);
|
|
if (r92.type !== PaymentSourceTypes.TDS_WALLET) {
|
|
throw new Error(`Cannot instantiate TDSWalletSourceRecord with type: ${r92.type}, must be ${PaymentSourceTypes.TDS_WALLET}`);
|
|
}
|
|
return r104 instanceof Object ? r104 : r101;
|
|
}
|
|
if (PaymentSourceTypes.PIX === type) {
|
|
const r65 = {
|
|
...r9,
|
|
email: a0.email
|
|
};
|
|
const prototypeOf = Object.getPrototypeOf(PixSourceRecord);
|
|
const r10 = Object.create(PixSourceRecord.prototype);
|
|
const r74 = $callWithNewTarget(prototypeOf, r10, PixSourceRecord, r65);
|
|
if (r65.type !== PaymentSourceTypes.PIX) {
|
|
throw new Error(`Cannot instantiate PixSourceRecord with type: ${r65.type}, must be ${PaymentSourceTypes.PIX}`);
|
|
}
|
|
const r77 = r74 instanceof Object ? r74 : r10;
|
|
r77.email = r65.email;
|
|
return r77;
|
|
}
|
|
assertNever(a0);
|
|
return void 0;
|
|
}
|
|
const r505 = {
|
|
...r9,
|
|
email: a0.email
|
|
};
|
|
const prototypeOf15 = Object.getPrototypeOf(SofortSourceRecord);
|
|
const r515 = Object.create(SofortSourceRecord.prototype);
|
|
const r518 = $callWithNewTarget(prototypeOf15, r515, SofortSourceRecord, r505);
|
|
if (r505.type !== PaymentSourceTypes.SOFORT && r505.type !== PaymentSourceTypes.SEPA_DEBIT) {
|
|
throw new Error(`Cannot instantiate SofortSourceRecord with type: ${r505.type}, must be ${PaymentSourceTypes.SOFORT} or ` + PaymentSourceTypes.SEPA_DEBIT);
|
|
}
|
|
const email2 = r505.email || "";
|
|
const r525 = r518 instanceof Object ? r518 : r515;
|
|
r525.email = email2;
|
|
return r525;
|
|
}
|
|
static createFromSerialized(a0) {
|
|
const type = a0.type;
|
|
if (PaymentSourceTypes.CARD === type) {
|
|
const prototypeOf18 = Object.getPrototypeOf(CreditCardSourceRecord);
|
|
const r511 = Object.create(CreditCardSourceRecord.prototype);
|
|
const r514 = $callWithNewTarget(prototypeOf18, r511, CreditCardSourceRecord, a0);
|
|
if (a0.type !== PaymentSourceTypes.CARD) {
|
|
throw new Error(`Cannot instantiate CreditCardSourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.CARD}`);
|
|
}
|
|
let brand = a0.brand;
|
|
if (brand == null) {
|
|
brand = "";
|
|
}
|
|
const r520 = r514 instanceof Object ? r514 : r511;
|
|
r520.brand = brand;
|
|
let last4 = a0.last4;
|
|
if (last4 == null) {
|
|
last4 = "";
|
|
}
|
|
r520.last4 = last4;
|
|
let expiresMonth = a0.expiresMonth;
|
|
if (expiresMonth == null) {
|
|
expiresMonth = 0;
|
|
}
|
|
r520.expiresMonth = expiresMonth;
|
|
let expiresYear = a0.expiresYear;
|
|
if (expiresYear == null) {
|
|
expiresYear = 0;
|
|
}
|
|
r520.expiresYear = expiresYear;
|
|
return r520;
|
|
}
|
|
if (PaymentSourceTypes.PAYPAL === type) {
|
|
const prototypeOf17 = Object.getPrototypeOf(PaypalSourceRecord);
|
|
const r483 = Object.create(PaypalSourceRecord.prototype);
|
|
const r486 = $callWithNewTarget(prototypeOf17, r483, PaypalSourceRecord, a0);
|
|
if (a0.type !== PaymentSourceTypes.PAYPAL) {
|
|
throw new Error(`Cannot instantiate PaypalSourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.PAYPAL}`);
|
|
}
|
|
const email3 = a0.email || "";
|
|
const r491 = r486 instanceof Object ? r486 : r483;
|
|
r491.email = email3;
|
|
return r491;
|
|
}
|
|
if (PaymentSourceTypes.SOFORT !== type && PaymentSourceTypes.SEPA_DEBIT !== type) {
|
|
if (PaymentSourceTypes.GIROPAY === type) {
|
|
const prototypeOf15 = Object.getPrototypeOf(GiropaySourceRecord);
|
|
const r426 = Object.create(GiropaySourceRecord.prototype);
|
|
const r429 = $callWithNewTarget(prototypeOf15, r426, GiropaySourceRecord, a0);
|
|
if (a0.type !== PaymentSourceTypes.GIROPAY) {
|
|
throw new Error(`Cannot instantiate GiropaySourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.GIROPAY}`);
|
|
}
|
|
return r429 instanceof Object ? r429 : r426;
|
|
}
|
|
if (PaymentSourceTypes.PRZELEWY24 === type) {
|
|
const prototypeOf14 = Object.getPrototypeOf(Przelewy24SourceRecord);
|
|
const r397 = Object.create(Przelewy24SourceRecord.prototype);
|
|
const r400 = $callWithNewTarget(prototypeOf14, r397, Przelewy24SourceRecord, a0);
|
|
if (a0.type !== PaymentSourceTypes.PRZELEWY24) {
|
|
throw new Error(`Cannot instantiate Przelewy24SourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.PRZELEWY24}`);
|
|
}
|
|
const email = a0.email || "";
|
|
const r405 = r400 instanceof Object ? r400 : r397;
|
|
r405.email = email;
|
|
r405.bank = a0.bank;
|
|
return r405;
|
|
}
|
|
if (PaymentSourceTypes.PAYSAFE_CARD === type) {
|
|
const prototypeOf13 = Object.getPrototypeOf(PaysafeSourceRecord);
|
|
const r370 = Object.create(PaysafeSourceRecord.prototype);
|
|
const r373 = $callWithNewTarget(prototypeOf13, r370, PaysafeSourceRecord, a0);
|
|
if (a0.type !== PaymentSourceTypes.PAYSAFE_CARD) {
|
|
throw new Error(`Cannot instantiate PaysafeSourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.PAYSAFE_CARD}`);
|
|
}
|
|
return r373 instanceof Object ? r373 : r370;
|
|
}
|
|
if (PaymentSourceTypes.GCASH === type) {
|
|
const prototypeOf12 = Object.getPrototypeOf(GcashSourceRecord);
|
|
const r343 = Object.create(GcashSourceRecord.prototype);
|
|
const r346 = $callWithNewTarget(prototypeOf12, r343, GcashSourceRecord, a0);
|
|
if (a0.type !== PaymentSourceTypes.GCASH) {
|
|
throw new Error(`Cannot instantiate GcashSourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.GCASH}`);
|
|
}
|
|
return r346 instanceof Object ? r346 : r343;
|
|
}
|
|
if (PaymentSourceTypes.GRABPAY_MY === type) {
|
|
const prototypeOf11 = Object.getPrototypeOf(GrabPayMySourceRecord);
|
|
const r316 = Object.create(GrabPayMySourceRecord.prototype);
|
|
const r319 = $callWithNewTarget(prototypeOf11, r316, GrabPayMySourceRecord, a0);
|
|
if (a0.type !== PaymentSourceTypes.GRABPAY_MY) {
|
|
throw new Error(`Cannot instantiate GrabPayMySourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.GRABPAY_MY}`);
|
|
}
|
|
return r319 instanceof Object ? r319 : r316;
|
|
}
|
|
if (PaymentSourceTypes.MOMO_WALLET === type) {
|
|
const prototypeOf10 = Object.getPrototypeOf(MomoWalletSourceRecord);
|
|
const r289 = Object.create(MomoWalletSourceRecord.prototype);
|
|
const r292 = $callWithNewTarget(prototypeOf10, r289, MomoWalletSourceRecord, a0);
|
|
if (a0.type !== PaymentSourceTypes.MOMO_WALLET) {
|
|
throw new Error(`Cannot instantiate MomoWalletSourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.MOMO_WALLET}`);
|
|
}
|
|
return r292 instanceof Object ? r292 : r289;
|
|
}
|
|
if (PaymentSourceTypes.VENMO === type) {
|
|
const prototypeOf9 = Object.getPrototypeOf(VenmoSourceRecord);
|
|
const r261 = Object.create(VenmoSourceRecord.prototype);
|
|
const r264 = $callWithNewTarget(prototypeOf9, r261, VenmoSourceRecord, a0);
|
|
if (a0.type !== PaymentSourceTypes.VENMO) {
|
|
throw new Error(`Cannot instantiate VenmoSourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.VENMO}`);
|
|
}
|
|
const username2 = a0.username || "";
|
|
const r269 = r264 instanceof Object ? r264 : r261;
|
|
r269.username = username2;
|
|
return r269;
|
|
}
|
|
if (PaymentSourceTypes.KAKAOPAY === type) {
|
|
const prototypeOf8 = Object.getPrototypeOf(KaKaoPaySourceRecord);
|
|
const r234 = Object.create(KaKaoPaySourceRecord.prototype);
|
|
const r237 = $callWithNewTarget(prototypeOf8, r234, KaKaoPaySourceRecord, a0);
|
|
if (a0.type !== PaymentSourceTypes.KAKAOPAY) {
|
|
throw new Error(`Cannot instantiate KaKaoPaySourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.KAKAOPAY}`);
|
|
}
|
|
return r237 instanceof Object ? r237 : r234;
|
|
}
|
|
if (PaymentSourceTypes.GOPAY_WALLET === type) {
|
|
const prototypeOf7 = Object.getPrototypeOf(GoPayWalletSourceRecord);
|
|
const r207 = Object.create(GoPayWalletSourceRecord.prototype);
|
|
const r210 = $callWithNewTarget(prototypeOf7, r207, GoPayWalletSourceRecord, a0);
|
|
if (a0.type !== PaymentSourceTypes.GOPAY_WALLET) {
|
|
throw new Error(`Cannot instantiate GoPayWalletSourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.GOPAY_WALLET}`);
|
|
}
|
|
return r210 instanceof Object ? r210 : r207;
|
|
}
|
|
if (PaymentSourceTypes.BANCONTACT === type) {
|
|
const prototypeOf6 = Object.getPrototypeOf(BancontactSourceRecord);
|
|
const r180 = Object.create(BancontactSourceRecord.prototype);
|
|
const r183 = $callWithNewTarget(prototypeOf6, r180, BancontactSourceRecord, a0);
|
|
if (a0.type !== PaymentSourceTypes.BANCONTACT) {
|
|
throw new Error(`Cannot instantiate BancontactSourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.BANCONTACT}`);
|
|
}
|
|
return r183 instanceof Object ? r183 : r180;
|
|
}
|
|
if (PaymentSourceTypes.EPS === type) {
|
|
const prototypeOf5 = Object.getPrototypeOf(EPSSourceRecord);
|
|
const r152 = Object.create(EPSSourceRecord.prototype);
|
|
const r155 = $callWithNewTarget(prototypeOf5, r152, EPSSourceRecord, a0);
|
|
if (a0.type !== PaymentSourceTypes.EPS) {
|
|
throw new Error(`Cannot instantiate EPSSourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.EPS}`);
|
|
}
|
|
const r159 = r155 instanceof Object ? r155 : r152;
|
|
r159.bank = a0.bank;
|
|
return r159;
|
|
}
|
|
if (PaymentSourceTypes.IDEAL === type) {
|
|
const prototypeOf4 = Object.getPrototypeOf(IdealSourceRecord);
|
|
const r124 = Object.create(IdealSourceRecord.prototype);
|
|
const r127 = $callWithNewTarget(prototypeOf4, r124, IdealSourceRecord, a0);
|
|
if (a0.type !== PaymentSourceTypes.IDEAL) {
|
|
throw new Error(`Cannot instantiate IdealSourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.IDEAL}`);
|
|
}
|
|
const r131 = r127 instanceof Object ? r127 : r124;
|
|
r131.bank = a0.bank;
|
|
return r131;
|
|
}
|
|
if (PaymentSourceTypes.CASH_APP === type) {
|
|
const prototypeOf3 = Object.getPrototypeOf(CashAppSourceRecord);
|
|
const r96 = Object.create(CashAppSourceRecord.prototype);
|
|
const r99 = $callWithNewTarget(prototypeOf3, r96, CashAppSourceRecord, a0);
|
|
if (a0.type !== PaymentSourceTypes.CASH_APP) {
|
|
throw new Error(`Cannot instantiate Cashapp with type: ${a0.type}, must be ${PaymentSourceTypes.CASH_APP}`);
|
|
}
|
|
const username = a0.username || "";
|
|
const r104 = r99 instanceof Object ? r99 : r96;
|
|
r104.username = username;
|
|
return r104;
|
|
}
|
|
if (PaymentSourceTypes.TDS_WALLET === type) {
|
|
const prototypeOf2 = Object.getPrototypeOf(TDSWalletSourceRecord);
|
|
const r69 = Object.create(TDSWalletSourceRecord.prototype);
|
|
const r72 = $callWithNewTarget(prototypeOf2, r69, TDSWalletSourceRecord, a0);
|
|
if (a0.type !== PaymentSourceTypes.TDS_WALLET) {
|
|
throw new Error(`Cannot instantiate TDSWalletSourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.TDS_WALLET}`);
|
|
}
|
|
return r72 instanceof Object ? r72 : r69;
|
|
}
|
|
if (PaymentSourceTypes.PIX === type) {
|
|
const prototypeOf = Object.getPrototypeOf(PixSourceRecord);
|
|
const r45 = Object.create(PixSourceRecord.prototype);
|
|
const r47 = $callWithNewTarget(prototypeOf, r45, PixSourceRecord, a0);
|
|
if (a0.type !== PaymentSourceTypes.PIX) {
|
|
throw new Error(`Cannot instantiate PixSourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.PIX}`);
|
|
}
|
|
const r50 = r47 instanceof Object ? r47 : r45;
|
|
r50.email = a0.email;
|
|
return r50;
|
|
}
|
|
assertNever(type);
|
|
return void 0;
|
|
}
|
|
const prototypeOf16 = Object.getPrototypeOf(SofortSourceRecord);
|
|
const r453 = Object.create(SofortSourceRecord.prototype);
|
|
const r456 = $callWithNewTarget(prototypeOf16, r453, SofortSourceRecord, a0);
|
|
if (a0.type !== PaymentSourceTypes.SOFORT && a0.type !== PaymentSourceTypes.SEPA_DEBIT) {
|
|
throw new Error(`Cannot instantiate SofortSourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.SOFORT} or ` + PaymentSourceTypes.SEPA_DEBIT);
|
|
}
|
|
const email2 = a0.email || "";
|
|
const r463 = r456 instanceof Object ? r456 : r453;
|
|
r463.email = email2;
|
|
return r463;
|
|
}
|
|
hasFlag(a0) {
|
|
return _Module1384.hasFlag(this.flags, a0);
|
|
}
|
|
get paymentMethodCountry() {
|
|
return this.country != null && this.country !== "" ? this.country : this.billingAddress.country;
|
|
}
|
|
canRedeemTrial() {
|
|
return !IRREDEEMABLE_PAYMENT_SOURCES.has(this.type);
|
|
}
|
|
}
|
|
class CreditCardSourceRecord extends PaymentSourceRecord {
|
|
constructor(a0) {
|
|
super(a0);
|
|
if (a0.type !== PaymentSourceTypes.CARD) {
|
|
throw new Error(`Cannot instantiate CreditCardSourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.CARD}`);
|
|
}
|
|
let brand = a0.brand;
|
|
if (brand == null) {
|
|
brand = "";
|
|
}
|
|
this.brand = brand;
|
|
let last4 = a0.last4;
|
|
if (last4 == null) {
|
|
last4 = "";
|
|
}
|
|
this.last4 = last4;
|
|
let expiresMonth = a0.expiresMonth;
|
|
if (expiresMonth == null) {
|
|
expiresMonth = 0;
|
|
}
|
|
this.expiresMonth = expiresMonth;
|
|
let expiresYear = a0.expiresYear;
|
|
if (expiresYear == null) {
|
|
expiresYear = 0;
|
|
}
|
|
this.expiresYear = expiresYear;
|
|
}
|
|
get isStripeLinkBankAccount() {
|
|
return this.brand === "link" && this.last4 === "0000";
|
|
}
|
|
}
|
|
const PaypalSourceRecord2 = class PaypalSourceRecord extends PaymentSourceRecord {
|
|
constructor(a0) {
|
|
super(a0);
|
|
if (a0.type !== PaymentSourceTypes.PAYPAL) {
|
|
throw new Error(`Cannot instantiate PaypalSourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.PAYPAL}`);
|
|
}
|
|
const email = a0.email || "";
|
|
this.email = email;
|
|
}
|
|
};
|
|
PaypalSourceRecord2.prototype;
|
|
PaypalSourceRecord = PaypalSourceRecord2;
|
|
const SofortSourceRecord2 = class SofortSourceRecord extends PaymentSourceRecord {
|
|
constructor(a0) {
|
|
super(a0);
|
|
if (a0.type !== PaymentSourceTypes.SOFORT && a0.type !== PaymentSourceTypes.SEPA_DEBIT) {
|
|
throw new Error(`Cannot instantiate SofortSourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.SOFORT} or ` + PaymentSourceTypes.SEPA_DEBIT);
|
|
}
|
|
const email = a0.email || "";
|
|
this.email = email;
|
|
}
|
|
};
|
|
SofortSourceRecord2.prototype;
|
|
SofortSourceRecord = SofortSourceRecord2;
|
|
const GiropaySourceRecord2 = class GiropaySourceRecord extends PaymentSourceRecord {
|
|
constructor(a0) {
|
|
super(a0);
|
|
if (a0.type !== PaymentSourceTypes.GIROPAY) {
|
|
throw new Error(`Cannot instantiate GiropaySourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.GIROPAY}`);
|
|
}
|
|
}
|
|
};
|
|
GiropaySourceRecord2.prototype;
|
|
GiropaySourceRecord = GiropaySourceRecord2;
|
|
const Przelewy24SourceRecord2 = class Przelewy24SourceRecord extends PaymentSourceRecord {
|
|
constructor(a0) {
|
|
super(a0);
|
|
if (a0.type !== PaymentSourceTypes.PRZELEWY24) {
|
|
throw new Error(`Cannot instantiate Przelewy24SourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.PRZELEWY24}`);
|
|
}
|
|
const email = a0.email || "";
|
|
this.email = email;
|
|
this.bank = a0.bank;
|
|
}
|
|
};
|
|
Przelewy24SourceRecord2.prototype;
|
|
Przelewy24SourceRecord = Przelewy24SourceRecord2;
|
|
const EPSSourceRecord2 = class EPSSourceRecord extends PaymentSourceRecord {
|
|
constructor(a0) {
|
|
super(a0);
|
|
if (a0.type !== PaymentSourceTypes.EPS) {
|
|
throw new Error(`Cannot instantiate EPSSourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.EPS}`);
|
|
}
|
|
this.bank = a0.bank;
|
|
}
|
|
};
|
|
EPSSourceRecord2.prototype;
|
|
EPSSourceRecord = EPSSourceRecord2;
|
|
const IdealSourceRecord2 = class IdealSourceRecord extends PaymentSourceRecord {
|
|
constructor(a0) {
|
|
super(a0);
|
|
if (a0.type !== PaymentSourceTypes.IDEAL) {
|
|
throw new Error(`Cannot instantiate IdealSourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.IDEAL}`);
|
|
}
|
|
this.bank = a0.bank;
|
|
}
|
|
};
|
|
IdealSourceRecord2.prototype;
|
|
IdealSourceRecord = IdealSourceRecord2;
|
|
const PaysafeSourceRecord2 = class PaysafeSourceRecord extends PaymentSourceRecord {
|
|
constructor(a0) {
|
|
super(a0);
|
|
if (a0.type !== PaymentSourceTypes.PAYSAFE_CARD) {
|
|
throw new Error(`Cannot instantiate PaysafeSourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.PAYSAFE_CARD}`);
|
|
}
|
|
}
|
|
};
|
|
PaysafeSourceRecord2.prototype;
|
|
PaysafeSourceRecord = PaysafeSourceRecord2;
|
|
const GcashSourceRecord2 = class GcashSourceRecord extends PaymentSourceRecord {
|
|
constructor(a0) {
|
|
super(a0);
|
|
if (a0.type !== PaymentSourceTypes.GCASH) {
|
|
throw new Error(`Cannot instantiate GcashSourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.GCASH}`);
|
|
}
|
|
}
|
|
};
|
|
GcashSourceRecord2.prototype;
|
|
GcashSourceRecord = GcashSourceRecord2;
|
|
const GrabPayMySourceRecord2 = class GrabPayMySourceRecord extends PaymentSourceRecord {
|
|
constructor(a0) {
|
|
super(a0);
|
|
if (a0.type !== PaymentSourceTypes.GRABPAY_MY) {
|
|
throw new Error(`Cannot instantiate GrabPayMySourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.GRABPAY_MY}`);
|
|
}
|
|
}
|
|
};
|
|
GrabPayMySourceRecord2.prototype;
|
|
GrabPayMySourceRecord = GrabPayMySourceRecord2;
|
|
const MomoWalletSourceRecord2 = class MomoWalletSourceRecord extends PaymentSourceRecord {
|
|
constructor(a0) {
|
|
super(a0);
|
|
if (a0.type !== PaymentSourceTypes.MOMO_WALLET) {
|
|
throw new Error(`Cannot instantiate MomoWalletSourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.MOMO_WALLET}`);
|
|
}
|
|
}
|
|
};
|
|
MomoWalletSourceRecord2.prototype;
|
|
MomoWalletSourceRecord = MomoWalletSourceRecord2;
|
|
const VenmoSourceRecord2 = class VenmoSourceRecord extends PaymentSourceRecord {
|
|
constructor(a0) {
|
|
super(a0);
|
|
if (a0.type !== PaymentSourceTypes.VENMO) {
|
|
throw new Error(`Cannot instantiate VenmoSourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.VENMO}`);
|
|
}
|
|
const username = a0.username || "";
|
|
this.username = username;
|
|
}
|
|
};
|
|
VenmoSourceRecord2.prototype;
|
|
VenmoSourceRecord = VenmoSourceRecord2;
|
|
const KaKaoPaySourceRecord2 = class KaKaoPaySourceRecord extends PaymentSourceRecord {
|
|
constructor(a0) {
|
|
super(a0);
|
|
if (a0.type !== PaymentSourceTypes.KAKAOPAY) {
|
|
throw new Error(`Cannot instantiate KaKaoPaySourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.KAKAOPAY}`);
|
|
}
|
|
}
|
|
};
|
|
KaKaoPaySourceRecord2.prototype;
|
|
KaKaoPaySourceRecord = KaKaoPaySourceRecord2;
|
|
const GoPayWalletSourceRecord2 = class GoPayWalletSourceRecord extends PaymentSourceRecord {
|
|
constructor(a0) {
|
|
super(a0);
|
|
if (a0.type !== PaymentSourceTypes.GOPAY_WALLET) {
|
|
throw new Error(`Cannot instantiate GoPayWalletSourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.GOPAY_WALLET}`);
|
|
}
|
|
}
|
|
};
|
|
GoPayWalletSourceRecord2.prototype;
|
|
GoPayWalletSourceRecord = GoPayWalletSourceRecord2;
|
|
const BancontactSourceRecord2 = class BancontactSourceRecord extends PaymentSourceRecord {
|
|
constructor(a0) {
|
|
super(a0);
|
|
if (a0.type !== PaymentSourceTypes.BANCONTACT) {
|
|
throw new Error(`Cannot instantiate BancontactSourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.BANCONTACT}`);
|
|
}
|
|
}
|
|
};
|
|
BancontactSourceRecord2.prototype;
|
|
BancontactSourceRecord = BancontactSourceRecord2;
|
|
const CashAppSourceRecord2 = class CashAppSourceRecord extends PaymentSourceRecord {
|
|
constructor(a0) {
|
|
super(a0);
|
|
if (a0.type !== PaymentSourceTypes.CASH_APP) {
|
|
throw new Error(`Cannot instantiate Cashapp with type: ${a0.type}, must be ${PaymentSourceTypes.CASH_APP}`);
|
|
}
|
|
const username = a0.username || "";
|
|
this.username = username;
|
|
}
|
|
};
|
|
CashAppSourceRecord2.prototype;
|
|
CashAppSourceRecord = CashAppSourceRecord2;
|
|
const TDSWalletSourceRecord2 = class TDSWalletSourceRecord extends PaymentSourceRecord {
|
|
constructor(a0) {
|
|
super(a0);
|
|
if (a0.type !== PaymentSourceTypes.TDS_WALLET) {
|
|
throw new Error(`Cannot instantiate TDSWalletSourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.TDS_WALLET}`);
|
|
}
|
|
}
|
|
};
|
|
TDSWalletSourceRecord2.prototype;
|
|
TDSWalletSourceRecord = TDSWalletSourceRecord2;
|
|
class PixSourceRecord extends PaymentSourceRecord {
|
|
constructor(a0) {
|
|
super(a0);
|
|
if (a0.type !== PaymentSourceTypes.PIX) {
|
|
throw new Error(`Cannot instantiate PixSourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.PIX}`);
|
|
}
|
|
this.email = a0.email;
|
|
}
|
|
}
|
|
export default PaymentSourceRecord;
|
|
export { CreditCardSourceRecord };
|
|
export { PaypalSourceRecord };
|
|
export { SofortSourceRecord };
|
|
export { GiropaySourceRecord };
|
|
export { Przelewy24SourceRecord };
|
|
export { EPSSourceRecord };
|
|
export { IdealSourceRecord };
|
|
export { PaysafeSourceRecord };
|
|
export { GcashSourceRecord };
|
|
export { GrabPayMySourceRecord };
|
|
export { MomoWalletSourceRecord };
|
|
export { VenmoSourceRecord };
|
|
export { KaKaoPaySourceRecord };
|
|
export { GoPayWalletSourceRecord };
|
|
export { BancontactSourceRecord };
|
|
export { CashAppSourceRecord };
|
|
class AppleSourceRecord extends PaymentSourceRecord {
|
|
constructor(a0) {
|
|
a0.id = "";
|
|
a0.paymentGateway = PaymentGateways.APPLE_PARTNER;
|
|
a0.type = PaymentSourceTypes.APPLE;
|
|
a0.billingAddress = {};
|
|
a0.country = "";
|
|
a0.invalid = false;
|
|
a0.isDefault = false;
|
|
a0.flags = 0;
|
|
super(a0);
|
|
if (a0.type !== PaymentSourceTypes.APPLE) {
|
|
throw new Error(`Cannot instantiate AppleSourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.APPLE}`);
|
|
}
|
|
}
|
|
}
|
|
export { AppleSourceRecord };
|
|
export { TDSWalletSourceRecord };
|
|
export { PixSourceRecord };
|