MCPcopy Create free account
hub / github.com/Tron521/codex-console-temp / normalizeTemplateData

Function normalizeTemplateData

static/js/payment.js:775–790  ·  view source on GitHub ↗
(data)

Source from the content-addressed store, hash-verified

773}
774
775function normalizeTemplateData(data) {
776 const source = data && typeof data === "object" ? data : {};
777 return {
778 card_number: String(source.card_number || "").replace(/\D/g, ""),
779 exp_month: normalizeMonth(source.exp_month),
780 exp_year: normalizeYear(source.exp_year),
781 cvc: String(source.cvc || source.cvv || "").replace(/\D/g, "").slice(0, 4),
782 billing_name: String(source.billing_name || "").trim(),
783 country_code: String(source.country_code || "US").trim().toUpperCase() || "US",
784 currency: String(source.currency || "").trim().toUpperCase(),
785 address_line1: String(source.address_line1 || "").trim(),
786 address_city: String(source.address_city || "").trim(),
787 address_state: String(source.address_state || "").trim(),
788 postal_code: String(source.postal_code || "").trim(),
789 };
790}
791
792function refreshBillingTemplateSelect(selectedId = "") {
793 const selectEl = document.getElementById("billing-template-select");

Callers 2

saveCurrentAsTemplateFunction · 0.85

Calls 2

normalizeMonthFunction · 0.85
normalizeYearFunction · 0.85

Tested by

no test coverage detected