decord/source/errors/BillingError.tsx
github-actions 4f02868c60 chore: update source for alpha 346.4
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4792.js (118.4 MB)
2026-09-11 10:30:06 +00:00

220 lines
12 KiB
TypeScript

// Module ID: 4286
// Function ID: 4287
// Name: BillingError
// Dependencies: [1272, 4287, 1114, 2]
// Exports: parseV8BillingAddressSkemaErrorToBillingError
// Module 4286 (BillingError)
import util from "util" /* 1114 */;
import HTTPUtils from "HTTPUtils" /* 1272 */;
import V6OrEarlierAPIError from "errors/V6OrEarlierAPIError" /* 4287 */;
require = fn;
const ErrorCodes = { UNKNOWN: 0, [0]: "UNKNOWN", UNKNOWN_BILLING_PROFILE: 100001, [100001]: "UNKNOWN_BILLING_PROFILE", UNKNOWN_PAYMENT_SOURCE: 100002, [100002]: "UNKNOWN_PAYMENT_SOURCE", UNKNOWN_SUBSCRIPTION: 100003, [100003]: "UNKNOWN_SUBSCRIPTION", ALREADY_SUBSCRIBED: 100004, [100004]: "ALREADY_SUBSCRIBED", INVALID_PLAN: 100005, [100005]: "INVALID_PLAN", PAYMENT_SOURCE_REQUIRED: 100006, [100006]: "PAYMENT_SOURCE_REQUIRED", ALREADY_CANCELED: 100007, [100007]: "ALREADY_CANCELED", INVALID_PAYMENT: 100008, [100008]: "INVALID_PAYMENT", ALREADY_REFUNDED: 100009, [100009]: "ALREADY_REFUNDED", INVALID_BILLING_ADDRESS: 100010, [100010]: "INVALID_BILLING_ADDRESS", ALREADY_PURCHASED: 100011, [100011]: "ALREADY_PURCHASED", DUPLICATE_PURCHASE_ATTEMPT: 100012, [100012]: "DUPLICATE_PURCHASE_ATTEMPT", BILLING_PURCHASE_REQUEST_INVALID: 100017, [100017]: "BILLING_PURCHASE_REQUEST_INVALID", NEGATIVE_INVOICE_AMOUNT: 100027, [100027]: "NEGATIVE_INVOICE_AMOUNT", AUTHENTICATION_REQUIRED: 100029, [100029]: "AUTHENTICATION_REQUIRED", SUBSCRIPTION_RENEWAL_IN_PROGRESS: 100042, [100042]: "SUBSCRIPTION_RENEWAL_IN_PROGRESS", CONFIRMATION_REQUIRED: 100047, [100047]: "CONFIRMATION_REQUIRED", CARD_DECLINED: 100054, [100054]: "CARD_DECLINED", INVALID_GIFT_REDEMPTION_FRAUD_REJECTED: 50097, [50097]: "INVALID_GIFT_REDEMPTION_FRAUD_REJECTED", PURCHASE_TOKEN_AUTHORIZATION_REQUIRED: 100056, [100056]: "PURCHASE_TOKEN_AUTHORIZATION_REQUIRED", INVALID_PAYMENT_SOURCE: 50048, [50048]: "INVALID_PAYMENT_SOURCE", INVALID_CURRENCY_FOR_PAYMENT_SOURCE: 100051, [100051]: "INVALID_CURRENCY_FOR_PAYMENT_SOURCE", BILLING_APPLE_SERVER_API_ERROR: 100070, [100070]: "BILLING_APPLE_SERVER_API_ERROR", BILLING_TRIAL_REDEMPTION_DISABLED: 100078, [100078]: "BILLING_TRIAL_REDEMPTION_DISABLED", BILLING_PAUSE_DISABLED: 100079, [100079]: "BILLING_PAUSE_DISABLED", BILLING_PAUSE_PENDING_ALREADY_SET: 100080, [100080]: "BILLING_PAUSE_PENDING_ALREADY_SET", BILLING_PAUSE_NOT_ELIGIBLE: 100081, [100081]: "BILLING_PAUSE_NOT_ELIGIBLE", BILLING_PAUSE_INVALID_INTERVAL: 100082, [100082]: "BILLING_PAUSE_INVALID_INTERVAL", BILLING_ALREADY_PAUSED: 100083, [100083]: "BILLING_ALREADY_PAUSED", BILLING_CANNOT_CHARGE_ZERO_AMOUNT: 100084, [100084]: "BILLING_CANNOT_CHARGE_ZERO_AMOUNT", BILLING_PAUSE_INVALID_UPDATE: 100094, [100094]: "BILLING_PAUSE_INVALID_UPDATE", BILLING_BUNDLE_ALREADY_PURCHASED: 100096, [100096]: "BILLING_BUNDLE_ALREADY_PURCHASED", BILLING_BUNDLE_PARTIALLY_OWNED: 100097, [100097]: "BILLING_BUNDLE_PARTIALLY_OWNED", BILLING_INSUFFICIENT_FUNDS: 100107, [100107]: "BILLING_INSUFFICIENT_FUNDS", BILLING_OUTDATED_REQUEST_PARAMETERS: 100111, [100111]: "BILLING_OUTDATED_REQUEST_PARAMETERS", BILLING_CURRENCY_NOT_ALLOWED_FOR_COUNTRY: 100144, [100144]: "BILLING_CURRENCY_NOT_ALLOWED_FOR_COUNTRY", BILLING_SPENDING_LIMIT_WILL_EXCEED: 100150, [100150]: "BILLING_SPENDING_LIMIT_WILL_EXCEED", BILLING_SPENDING_LIMIT_REACHED: 100151, [100151]: "BILLING_SPENDING_LIMIT_REACHED", BILLING_ORDER_NOT_SIGNABLE: 100152, [100152]: "BILLING_ORDER_NOT_SIGNABLE", BILLING_APPLE_STORE_COUNTRY_MISMATCH: 100153, [100153]: "BILLING_APPLE_STORE_COUNTRY_MISMATCH", BILLING_CLAIM_IN_GAME_BEFORE_REPURCHASE: 100155, [100155]: "BILLING_CLAIM_IN_GAME_BEFORE_REPURCHASE", VIRTUAL_CURRENCY_INSUFFICIENT_BALANCE: 590001, [590001]: "VIRTUAL_CURRENCY_INSUFFICIENT_BALANCE" };
const obj2 = { CARD_NUMBER: "cardNumber", CARD_CVC: "cvc", CARD_EXPIRATION_DATE: "expirationDate", CARD_NAME: "name", ADDRESS_NAME: "name", ADDRESS_LINE_1: "line1", ADDRESS_LINE_2: "line2", ADDRESS_CITY: "city", ADDRESS_STATE: "state", ADDRESS_POSTAL_CODE: "postalCode", ADDRESS_COUNTRY: "country" };
const obj3 = { ADDRESS_LINE_1: "address_line1", ADDRESS_LINE_2: "address_line2", ADDRESS_CITY: "address_city", ADDRESS_STATE: "address_state", ADDRESS_ZIP: "address_zip", ADDRESS_COUNTRY: "address_country", CARD_NUMBER: "number", CARD_EXPIRATION_DATE: "exp", CARD_EXPIRATION_MONTH: "exp_month", CARD_EXPIRATION_YEAR: "exp_year" };
const React3 = Object.freeze({ [obj3.ADDRESS_LINE_1]: obj2.ADDRESS_LINE_1, [obj3.ADDRESS_LINE_2]: obj2.ADDRESS_LINE_2, [obj3.ADDRESS_CITY]: obj2.ADDRESS_CITY, [obj3.ADDRESS_STATE]: obj2.ADDRESS_STATE, [obj3.ADDRESS_ZIP]: obj2.ADDRESS_POSTAL_CODE, [obj3.ADDRESS_COUNTRY]: obj2.ADDRESS_COUNTRY, [obj3.CARD_NUMBER]: obj2.CARD_NUMBER, [obj3.CARD_EXPIRATION_DATE]: obj2.CARD_EXPIRATION_DATE, [obj3.CARD_EXPIRATION_MONTH]: obj2.CARD_EXPIRATION_DATE, [obj3.CARD_EXPIRATION_YEAR]: obj2.CARD_EXPIRATION_DATE });
const React4 = Object.freeze({ line_1: obj2.ADDRESS_LINE_1, line_2: obj2.ADDRESS_LINE_2, postal_code: obj2.ADDRESS_POSTAL_CODE });
const items = [, , , ];
({ CARD_NUMBER: arr[0], CARD_CVC: arr[1], CARD_EXPIRATION_DATE: arr[2], CARD_NAME: arr[3] } = obj2);
const set = new Set(items);
const items1 = [, , , , , , ];
({ ADDRESS_NAME: arr2[0], ADDRESS_LINE_1: arr2[1], ADDRESS_LINE_2: arr2[2], ADDRESS_CITY: arr2[3], ADDRESS_STATE: arr2[4], ADDRESS_POSTAL_CODE: arr2[5], ADDRESS_COUNTRY: arr2[6] } = obj2);
const set1 = new Set(items1);
class BillingError extends tmp4 {
constructor(arg0, arg1) {
tmp1 = new tmp(global, fn, tmp6, tmp5, tmp4, tmp3, tmp2, new.target);
tmp1.paymentId = null;
tmp8 = closure_2;
if (tmp1.code === closure_2.NEGATIVE_INVOICE_AMOUNT) {
tmp40 = closure_0;
tmp41 = closure_1;
intl16 = closure_0(closure_1[2]).intl;
tmp1.message = intl16.string(closure_0(closure_1[2]).t["+4Empk"]);
} else if (tmp1.code === tmp8.INVALID_PAYMENT_SOURCE) {
tmp38 = closure_0;
tmp39 = closure_1;
intl15 = closure_0(closure_1[2]).intl;
tmp1.message = intl15.string(closure_0(closure_1[2]).t.DtFqEI);
} else if (tmp1.code === tmp8.UNKNOWN_PAYMENT_SOURCE) {
tmp36 = closure_0;
tmp37 = closure_1;
intl14 = closure_0(closure_1[2]).intl;
tmp1.message = intl14.string(closure_0(closure_1[2]).t.yNYvK1);
} else if (tmp1.code === tmp8.SUBSCRIPTION_RENEWAL_IN_PROGRESS) {
tmp34 = closure_0;
tmp35 = closure_1;
intl13 = closure_0(closure_1[2]).intl;
tmp1.message = intl13.string(closure_0(closure_1[2]).t["3jprCb"]);
} else if (tmp1.code === tmp8.BILLING_TRIAL_REDEMPTION_DISABLED) {
tmp32 = closure_0;
tmp33 = closure_1;
intl12 = closure_0(closure_1[2]).intl;
tmp1.message = intl12.string(closure_0(closure_1[2]).t.MHlpoJ);
} else if (tmp1.code === tmp8.BILLING_BUNDLE_ALREADY_PURCHASED) {
tmp30 = closure_0;
tmp31 = closure_1;
intl11 = closure_0(closure_1[2]).intl;
tmp1.message = intl11.string(closure_0(closure_1[2]).t.Hiwqua);
} else if (tmp1.code === tmp8.BILLING_BUNDLE_PARTIALLY_OWNED) {
tmp28 = closure_0;
tmp29 = closure_1;
intl10 = closure_0(closure_1[2]).intl;
tmp1.message = intl10.string(closure_0(closure_1[2]).t.c5zDr3);
} else if (tmp1.code === tmp8.BILLING_INSUFFICIENT_FUNDS) {
tmp26 = closure_0;
tmp27 = closure_1;
intl9 = closure_0(closure_1[2]).intl;
tmp1.message = intl9.string(closure_0(closure_1[2]).t.yX8s2v);
} else if (tmp1.code === tmp8.CARD_DECLINED) {
tmp24 = closure_0;
tmp25 = closure_1;
intl8 = closure_0(closure_1[2]).intl;
tmp1.message = intl8.string(closure_0(closure_1[2]).t.p0UBvU);
} else if (tmp1.code === tmp8.BILLING_OUTDATED_REQUEST_PARAMETERS) {
tmp22 = closure_0;
tmp23 = closure_1;
intl7 = closure_0(closure_1[2]).intl;
tmp1.message = intl7.string(closure_0(closure_1[2]).t.uhPY5p);
} else if (tmp1.code === tmp8.BILLING_CURRENCY_NOT_ALLOWED_FOR_COUNTRY) {
tmp20 = closure_0;
tmp21 = closure_1;
intl6 = closure_0(closure_1[2]).intl;
tmp1.message = intl6.string(closure_0(closure_1[2]).t.ckFebQ);
} else if (tmp1.code === tmp8.ALREADY_PURCHASED) {
tmp18 = closure_0;
tmp19 = closure_1;
intl5 = closure_0(closure_1[2]).intl;
tmp1.message = intl5.string(closure_0(closure_1[2]).t["3RT0Iu"]);
} else if (tmp1.code === tmp8.BILLING_CLAIM_IN_GAME_BEFORE_REPURCHASE) {
tmp16 = closure_0;
tmp17 = closure_1;
intl4 = closure_0(closure_1[2]).intl;
tmp1.message = intl4.string(closure_0(closure_1[2]).t.Zr0Z4K);
} else {
num2 = 429;
if (429 === tmp1.status) {
tmp14 = closure_0;
tmp15 = closure_1;
intl3 = closure_0(closure_1[2]).intl;
tmp1.message = intl3.string(closure_0(closure_1[2]).t.sUWxgR);
} else if (tmp1.code === tmp8.UNKNOWN) {
tmp12 = closure_0;
tmp13 = closure_1;
intl2 = closure_0(closure_1[2]).intl;
tmp1.message = intl2.string(closure_0(closure_1[2]).t["5mlOCW"]);
} else {
num = 400;
tmp9 = 400 === tmp1.status && null != tmp1.fields.captcha_key;
if (tmp9) {
tmp10 = closure_0;
tmp11 = closure_1;
intl = closure_0(closure_1[2]).intl;
tmp1.message = intl.string(closure_0(closure_1[2]).t["3s/vDN"]);
}
}
}
for (const key10213 in tmp1.fields) {
tmp45 = key10213;
tmp46 = closure_3;
tmp43 = closure_3[key10213];
if (tmp43) {
} else {
tmp42 = closure_4;
tmp43 = closure_4[key10213];
}
if (null == tmp43) {
continue;
} else {
fields = tmp1.fields;
delete tmp3[tmp6];
tmp1.fields[tmp43] = tmp1.fields[key10213];
continue;
}
continue;
}
tmp44 = null != global.body && typeof global.body.payment_id === "string";
if (tmp44) {
tmp1.paymentId = global.body.payment_id;
}
return tmp1;
}
}
const prototype = BillingError.prototype;
prototype["_isInFieldSet"] = function _isInFieldSet(set) {
for (const key10004 in this.fields) {
if (!arg0.has(key10004)) {
continue;
} else {
let flag = true;
return true;
}
}
};
prototype["hasCardError"] = function hasCardError() {
return this._isInFieldSet(set);
};
prototype["hasAddressError"] = function hasAddressError() {
return this._isInFieldSet(set1);
};
BillingError.ErrorCodes = ErrorCodes;
BillingError.Fields = obj2;
BillingError.Sections = { CARD: "card", ADDRESS: "address" };
BillingError.CARD_ERRORS = set;
BillingError.ADDRESS_ERRORS = set1;
const size = fn(2);
const result = size.fileFinishedImporting("errors/BillingError.tsx");
export default BillingError;
export { ErrorCodes };
export const parseV8BillingAddressSkemaErrorToBillingError = function parseV8BillingAddressSkemaErrorToBillingError(body) {
if (typeof body !== "string") {
let code;
if (body != null) {
body = body.body;
if (body != null) {
code = body.code;
}
}
if (code === HTTPUtils.INVALID_FORM_BODY_ERROR_CODE) {
let errors1;
if (body != null) {
const body2 = body.body;
if (body2 != null) {
errors1 = body2.errors;
}
}
if (!Array.isArray(errors1)) {
let billing_address1;
if (body != null) {
const body3 = body.body;
if (body3 != null) {
const errors = body3.errors;
if (errors != null) {
billing_address1 = errors.billing_address;
}
}
}
if (null != billing_address1) {
for (const key10023 in arg0.body.errors.billing_address) {
let billing_address = arg0.body.errors.billing_address;
delete tmp3[tmp4];
arg0.body.errors[key10023] = arg0.body.errors.billing_address[key10023];
continue;
}
const errors2 = body.body.errors;
delete tmp2[tmp];
}
}
const body4 = body.body;
let errors3;
if (body4 != null) {
errors3 = body4.errors;
}
if (null != errors3) {
body.body = HTTPUtils.convertSkemaError(body.body.errors);
}
}
}
return new BillingError(body);
};