@open-mercato/checkout 0.10.1-develop.8287.1.7313a0fe67 → 0.10.1-develop.8291.1.6ec3aee41c
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +1 -1
- package/dist/modules/checkout/__integration__/TC-CHK-CRUDFORM-001.spec.js +3 -3
- package/dist/modules/checkout/__integration__/TC-CHK-CRUDFORM-001.spec.js.map +2 -2
- package/dist/modules/checkout/__integration__/TC-CHKT-037-template-sync.spec.js +3 -1
- package/dist/modules/checkout/__integration__/TC-CHKT-037-template-sync.spec.js.map +2 -2
- package/dist/modules/checkout/__integration__/TC-CHKT-PRECISION-001.spec.js +259 -0
- package/dist/modules/checkout/__integration__/TC-CHKT-PRECISION-001.spec.js.map +7 -0
- package/dist/modules/checkout/__integration__/TC-CHKT-PRECISION-002-admin-round-trip.spec.js +85 -0
- package/dist/modules/checkout/__integration__/TC-CHKT-PRECISION-002-admin-round-trip.spec.js.map +7 -0
- package/dist/modules/checkout/api/pay/[slug]/submit/route.js +17 -2
- package/dist/modules/checkout/api/pay/[slug]/submit/route.js.map +2 -2
- package/dist/modules/checkout/backend/checkout/pay-links/page.js +9 -3
- package/dist/modules/checkout/backend/checkout/pay-links/page.js.map +2 -2
- package/dist/modules/checkout/commands/links.js +7 -10
- package/dist/modules/checkout/commands/links.js.map +2 -2
- package/dist/modules/checkout/commands/shared.js +43 -7
- package/dist/modules/checkout/commands/shared.js.map +2 -2
- package/dist/modules/checkout/commands/templates.js +12 -10
- package/dist/modules/checkout/commands/templates.js.map +2 -2
- package/dist/modules/checkout/commands/transactions.js +13 -1
- package/dist/modules/checkout/commands/transactions.js.map +2 -2
- package/dist/modules/checkout/components/LinkTemplateForm.js +47 -20
- package/dist/modules/checkout/components/LinkTemplateForm.js.map +2 -2
- package/dist/modules/checkout/components/PayPage.js +59 -55
- package/dist/modules/checkout/components/PayPage.js.map +2 -2
- package/dist/modules/checkout/data/entities.js +6 -5
- package/dist/modules/checkout/data/entities.js.map +2 -2
- package/dist/modules/checkout/data/validators.js +19 -2
- package/dist/modules/checkout/data/validators.js.map +2 -2
- package/dist/modules/checkout/i18n/de.json +1 -0
- package/dist/modules/checkout/i18n/en.json +1 -0
- package/dist/modules/checkout/i18n/es.json +1 -0
- package/dist/modules/checkout/i18n/ko.json +1 -0
- package/dist/modules/checkout/i18n/pl.json +1 -0
- package/dist/modules/checkout/lib/amountPrecision.js +98 -0
- package/dist/modules/checkout/lib/amountPrecision.js.map +7 -0
- package/dist/modules/checkout/lib/payPageAmount.js +56 -0
- package/dist/modules/checkout/lib/payPageAmount.js.map +7 -0
- package/dist/modules/checkout/lib/utils.js +63 -20
- package/dist/modules/checkout/lib/utils.js.map +2 -2
- package/dist/modules/checkout/migrations/Migration20261014082519_checkout.js +33 -0
- package/dist/modules/checkout/migrations/Migration20261014082519_checkout.js.map +7 -0
- package/dist/modules/checkout/workers/send-email.worker.js +8 -1
- package/dist/modules/checkout/workers/send-email.worker.js.map +2 -2
- package/package.json +10 -7
- package/src/modules/checkout/__integration__/TC-CHK-CRUDFORM-001.spec.ts +3 -3
- package/src/modules/checkout/__integration__/TC-CHKT-037-template-sync.spec.ts +2 -0
- package/src/modules/checkout/__integration__/TC-CHKT-PRECISION-001.spec.ts +320 -0
- package/src/modules/checkout/__integration__/TC-CHKT-PRECISION-002-admin-round-trip.spec.ts +112 -0
- package/src/modules/checkout/api/pay/[slug]/__tests__/route.test.ts +4 -0
- package/src/modules/checkout/api/pay/[slug]/submit/__tests__/route.test.ts +145 -0
- package/src/modules/checkout/api/pay/[slug]/submit/route.ts +19 -2
- package/src/modules/checkout/backend/checkout/pay-links/page.tsx +13 -3
- package/src/modules/checkout/commands/__tests__/configured-amount-precision.test.ts +180 -0
- package/src/modules/checkout/commands/__tests__/create-transaction-amount.test.ts +77 -0
- package/src/modules/checkout/commands/__tests__/template-sync.test.ts +145 -0
- package/src/modules/checkout/commands/links.ts +7 -10
- package/src/modules/checkout/commands/shared.ts +56 -7
- package/src/modules/checkout/commands/templates.ts +12 -10
- package/src/modules/checkout/commands/transactions.ts +15 -1
- package/src/modules/checkout/components/LinkTemplateForm.tsx +52 -21
- package/src/modules/checkout/components/PayPage.tsx +76 -58
- package/src/modules/checkout/components/__tests__/LinkTemplateForm.localeDecimalSeparator.test.tsx +35 -1
- package/src/modules/checkout/components/__tests__/LinkTemplateForm.priceListExactAmount.test.tsx +196 -0
- package/src/modules/checkout/components/__tests__/PayPage.amountPrecision.test.tsx +115 -0
- package/src/modules/checkout/components/__tests__/PayPagePricing.amountDisplay.test.tsx +98 -0
- package/src/modules/checkout/components/__tests__/__fixtures__/legacyPayPageContracts.ts +13 -0
- package/src/modules/checkout/components/__tests__/payPageContracts.backwardCompat.test.ts +32 -0
- package/src/modules/checkout/data/__tests__/validators.test.ts +91 -0
- package/src/modules/checkout/data/entities.ts +7 -6
- package/src/modules/checkout/data/validators.ts +26 -2
- package/src/modules/checkout/i18n/de.json +1 -0
- package/src/modules/checkout/i18n/en.json +1 -0
- package/src/modules/checkout/i18n/es.json +1 -0
- package/src/modules/checkout/i18n/ko.json +1 -0
- package/src/modules/checkout/i18n/pl.json +1 -0
- package/src/modules/checkout/lib/__tests__/amountPrecision.test.ts +169 -0
- package/src/modules/checkout/lib/__tests__/payPageAmount.test.ts +127 -0
- package/src/modules/checkout/lib/__tests__/utils.test.ts +72 -0
- package/src/modules/checkout/lib/amountPrecision.ts +152 -0
- package/src/modules/checkout/lib/payPageAmount.ts +99 -0
- package/src/modules/checkout/lib/utils.ts +85 -28
- package/src/modules/checkout/migrations/.snapshot-open-mercato.json +158 -27
- package/src/modules/checkout/migrations/Migration20261014082519_checkout.ts +35 -0
- package/src/modules/checkout/migrations/__tests__/Migration20261014082519_checkout.integration.test.ts +6 -0
- package/src/modules/checkout/workers/__tests__/send-email.worker.test.ts +43 -0
- package/src/modules/checkout/workers/send-email.worker.ts +8 -1
|
@@ -34,7 +34,16 @@ import {
|
|
|
34
34
|
getCheckoutCustomerFieldSemanticType,
|
|
35
35
|
validateCheckoutCustomerData
|
|
36
36
|
} from "../lib/customerDataValidation.js";
|
|
37
|
+
import {
|
|
38
|
+
applyPayPageAmountValue,
|
|
39
|
+
buildPayPageSubmitBody,
|
|
40
|
+
formatPayPageAmount,
|
|
41
|
+
parsePayPageAmountInput,
|
|
42
|
+
toPayPageAmount,
|
|
43
|
+
validatePayPageCustomAmount
|
|
44
|
+
} from "../lib/payPageAmount.js";
|
|
37
45
|
import { createLogger } from "@open-mercato/shared/lib/logger";
|
|
46
|
+
import { resolveExactDecimal } from "@open-mercato/shared/lib/decimal";
|
|
38
47
|
const logger = createLogger("checkout").child({ component: "PayPage" });
|
|
39
48
|
const PAGE_HANDLE = extensionPoints.hosts.payPage.componentId;
|
|
40
49
|
const HEADER_HANDLE = extensionPoints.hosts.header.componentId;
|
|
@@ -74,12 +83,6 @@ function readErrorMessage(error, fallback) {
|
|
|
74
83
|
function readTranslatedErrorMessage(error, translate, fallback) {
|
|
75
84
|
return translate(readErrorMessage(error, fallback), fallback);
|
|
76
85
|
}
|
|
77
|
-
function parseNumericInput(value) {
|
|
78
|
-
const trimmed = value.trim();
|
|
79
|
-
if (!trimmed) return null;
|
|
80
|
-
const parsed = Number(trimmed);
|
|
81
|
-
return Number.isFinite(parsed) ? parsed : null;
|
|
82
|
-
}
|
|
83
86
|
function setSubmitDataFieldValue(data, fieldPath, value) {
|
|
84
87
|
if (fieldPath.startsWith("customerData.")) {
|
|
85
88
|
const fieldKey = fieldPath.slice("customerData.".length);
|
|
@@ -107,7 +110,7 @@ function setSubmitDataFieldValue(data, fieldPath, value) {
|
|
|
107
110
|
if (fieldPath === "amount") {
|
|
108
111
|
return {
|
|
109
112
|
...data,
|
|
110
|
-
|
|
113
|
+
...applyPayPageAmountValue(data, value)
|
|
111
114
|
};
|
|
112
115
|
}
|
|
113
116
|
if (fieldPath === "selectedPriceItemId") {
|
|
@@ -615,6 +618,7 @@ function PayPageCustomerForm({
|
|
|
615
618
|
function PayPagePricing({
|
|
616
619
|
payload,
|
|
617
620
|
amount,
|
|
621
|
+
amountExact,
|
|
618
622
|
selectedPriceItemId,
|
|
619
623
|
fieldErrors,
|
|
620
624
|
inputsLocked,
|
|
@@ -631,8 +635,8 @@ function PayPagePricing({
|
|
|
631
635
|
/* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold", children: t("checkout.payPage.pricing.title", "Choose how you want to pay") })
|
|
632
636
|
] }),
|
|
633
637
|
payload.pricingMode === "fixed" ? /* @__PURE__ */ jsxs("div", { className: "rounded-xl border p-5", style: buildPanelStyle(themeTokens, "default"), children: [
|
|
634
|
-
typeof payload.fixedPriceOriginalAmount === "number" ? /* @__PURE__ */ jsx("div", { className: "text-sm line-through", style: { color: themeTokens.mutedText }, children: formatAmount(payload.fixedPriceOriginalAmount, payload.fixedPriceCurrencyCode) }) : null,
|
|
635
|
-
/* @__PURE__ */ jsx("div", { className: "mt-1 text-4xl font-semibold", children: formatAmount(payload.fixedPriceAmount, payload.fixedPriceCurrencyCode) })
|
|
638
|
+
typeof payload.fixedPriceOriginalAmount === "number" ? /* @__PURE__ */ jsx("div", { className: "text-sm line-through", style: { color: themeTokens.mutedText }, children: formatAmount(payload.fixedPriceOriginalAmount, payload.fixedPriceCurrencyCode, resolveExactDecimal(payload.fixedPriceOriginalAmountExact, payload.fixedPriceOriginalAmount)) }) : null,
|
|
639
|
+
/* @__PURE__ */ jsx("div", { className: "mt-1 text-4xl font-semibold", children: formatAmount(payload.fixedPriceAmount, payload.fixedPriceCurrencyCode, resolveExactDecimal(payload.fixedPriceAmountExact, payload.fixedPriceAmount)) })
|
|
636
640
|
] }) : null,
|
|
637
641
|
payload.pricingMode === "custom_amount" ? /* @__PURE__ */ jsxs("div", { className: "space-y-2 rounded-xl border p-5", style: buildPanelStyle(themeTokens, "default"), children: [
|
|
638
642
|
/* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children: t("checkout.payPage.fields.customAmount", "Amount") }),
|
|
@@ -641,12 +645,12 @@ function PayPagePricing({
|
|
|
641
645
|
{
|
|
642
646
|
className: READABLE_INPUT_CLASSNAME,
|
|
643
647
|
type: "number",
|
|
644
|
-
value: amount ?? "",
|
|
648
|
+
value: amountExact ?? amount ?? "",
|
|
645
649
|
disabled: inputsLocked,
|
|
646
650
|
onChange: (event) => onAmountChange(event.target.value),
|
|
647
651
|
placeholder: [
|
|
648
|
-
payload.customAmountMin != null ? formatAmount(payload.customAmountMin, payload.customAmountCurrencyCode) : null,
|
|
649
|
-
payload.customAmountMax != null ? formatAmount(payload.customAmountMax, payload.customAmountCurrencyCode) : null
|
|
652
|
+
payload.customAmountMin != null ? formatAmount(payload.customAmountMin, payload.customAmountCurrencyCode, resolveExactDecimal(payload.customAmountMinExact, payload.customAmountMin)) : null,
|
|
653
|
+
payload.customAmountMax != null ? formatAmount(payload.customAmountMax, payload.customAmountCurrencyCode, resolveExactDecimal(payload.customAmountMaxExact, payload.customAmountMax)) : null
|
|
650
654
|
].filter(Boolean).join(" - "),
|
|
651
655
|
style: buildReadableInputStyle(themeTokens, Boolean(fieldErrors.amount), inputsLocked)
|
|
652
656
|
}
|
|
@@ -683,7 +687,7 @@ function PayPagePricing({
|
|
|
683
687
|
),
|
|
684
688
|
/* @__PURE__ */ jsx("span", { className: "font-medium", children: item.description })
|
|
685
689
|
] }),
|
|
686
|
-
/* @__PURE__ */ jsx("span", { className: "whitespace-nowrap font-semibold", children: formatAmount(item.amount, item.currencyCode) })
|
|
690
|
+
/* @__PURE__ */ jsx("span", { className: "whitespace-nowrap font-semibold", children: formatAmount(item.amount, item.currencyCode, resolveExactDecimal(item.amountExact, item.amount)) })
|
|
687
691
|
]
|
|
688
692
|
},
|
|
689
693
|
item.id
|
|
@@ -697,13 +701,14 @@ function PayPagePricing({
|
|
|
697
701
|
function PayPageSummary({
|
|
698
702
|
payload,
|
|
699
703
|
selectedAmount,
|
|
704
|
+
selectedAmountExact,
|
|
700
705
|
currencyCode,
|
|
701
706
|
formatAmount,
|
|
702
707
|
preview,
|
|
703
708
|
themeTokens
|
|
704
709
|
}) {
|
|
705
710
|
const t = useT();
|
|
706
|
-
const amountLabel = selectedAmount != null && currencyCode ? formatAmount(selectedAmount, currencyCode) : t("checkout.payPage.summary.awaitingSelection", "Select an amount");
|
|
711
|
+
const amountLabel = selectedAmount != null && currencyCode ? formatAmount(selectedAmount, currencyCode, resolveExactDecimal(selectedAmountExact, selectedAmount)) : t("checkout.payPage.summary.awaitingSelection", "Select an amount");
|
|
707
712
|
return /* @__PURE__ */ jsx("section", { className: "rounded-xl border p-5", style: buildPanelStyle(themeTokens, "accent"), children: /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-3", children: [
|
|
708
713
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
709
714
|
/* @__PURE__ */ jsx("div", { className: "text-overline font-semibold uppercase tracking-widest text-current/70", children: t("checkout.payPage.summary.amountDue", "Amount due") }),
|
|
@@ -1070,6 +1075,7 @@ function PayPage({
|
|
|
1070
1075
|
const [customerData, setCustomerData] = React.useState({});
|
|
1071
1076
|
const [acceptedLegalConsents, setAcceptedLegalConsents] = React.useState({});
|
|
1072
1077
|
const [amount, setAmount] = React.useState(null);
|
|
1078
|
+
const [amountExact, setAmountExact] = React.useState(null);
|
|
1073
1079
|
const [selectedPriceItemId, setSelectedPriceItemId] = React.useState(null);
|
|
1074
1080
|
const [submissionError, setSubmissionError] = React.useState(null);
|
|
1075
1081
|
const [fieldErrors, setFieldErrors] = React.useState({});
|
|
@@ -1091,7 +1097,9 @@ function PayPage({
|
|
|
1091
1097
|
setPaymentSession(null);
|
|
1092
1098
|
setActiveTransactionId(null);
|
|
1093
1099
|
if (result.pricingMode === "fixed" && typeof result.fixedPriceAmount === "number") {
|
|
1094
|
-
|
|
1100
|
+
const fixedAmount = toPayPageAmount(result.fixedPriceAmount, result.fixedPriceAmountExact);
|
|
1101
|
+
setAmount(fixedAmount.amount);
|
|
1102
|
+
setAmountExact(fixedAmount.amountExact);
|
|
1095
1103
|
}
|
|
1096
1104
|
} catch (error) {
|
|
1097
1105
|
setPayload(null);
|
|
@@ -1108,34 +1116,24 @@ function PayPage({
|
|
|
1108
1116
|
React.useEffect(() => {
|
|
1109
1117
|
if (!payload) return;
|
|
1110
1118
|
if (payload.pricingMode === "fixed" && typeof payload.fixedPriceAmount === "number") {
|
|
1111
|
-
|
|
1119
|
+
const fixedAmount = toPayPageAmount(payload.fixedPriceAmount, payload.fixedPriceAmountExact);
|
|
1120
|
+
setAmount(fixedAmount.amount);
|
|
1121
|
+
setAmountExact(fixedAmount.amountExact);
|
|
1112
1122
|
return;
|
|
1113
1123
|
}
|
|
1114
1124
|
if (payload.pricingMode !== "price_list") {
|
|
1115
1125
|
setSelectedPriceItemId(null);
|
|
1116
1126
|
}
|
|
1117
1127
|
}, [payload]);
|
|
1118
|
-
const formatAmount = React.useCallback(
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
return new Intl.NumberFormat(locale, {
|
|
1123
|
-
style: "currency",
|
|
1124
|
-
currency: currencyCode
|
|
1125
|
-
}).format(normalizedValue);
|
|
1126
|
-
} catch {
|
|
1127
|
-
return `${normalizedValue.toFixed(2)} ${currencyCode}`;
|
|
1128
|
-
}
|
|
1129
|
-
}
|
|
1130
|
-
return new Intl.NumberFormat(locale, {
|
|
1131
|
-
minimumFractionDigits: 2,
|
|
1132
|
-
maximumFractionDigits: 2
|
|
1133
|
-
}).format(normalizedValue);
|
|
1134
|
-
}, [locale]);
|
|
1128
|
+
const formatAmount = React.useCallback(
|
|
1129
|
+
(value, currencyCode, exact) => formatPayPageAmount(value, currencyCode, locale, exact),
|
|
1130
|
+
[locale]
|
|
1131
|
+
);
|
|
1135
1132
|
const isPreview = payload?.preview === true || previewRequested;
|
|
1136
1133
|
const selectedPriceItem = payload?.priceListItems?.find((item) => item.id === selectedPriceItemId) ?? null;
|
|
1137
1134
|
const shouldCollectCustomerDetails = payload != null && payload.collectCustomerDetails !== false && (payload.customerFieldsSchema?.length ?? 0) > 0;
|
|
1138
1135
|
const effectiveAmount = selectedPriceItem?.amount ?? amount;
|
|
1136
|
+
const effectiveAmountExact = selectedPriceItem ? toPayPageAmount(selectedPriceItem.amount, selectedPriceItem.amountExact).amountExact : amountExact;
|
|
1139
1137
|
const effectiveCurrencyCode = selectedPriceItem?.currencyCode ?? payload?.fixedPriceCurrencyCode ?? payload?.customAmountCurrencyCode ?? null;
|
|
1140
1138
|
const inputsLocked = isSubmitting || paymentSession != null;
|
|
1141
1139
|
const publicCustomFields = payload?.publicCustomFields ?? [];
|
|
@@ -1143,8 +1141,9 @@ function PayPage({
|
|
|
1143
1141
|
customerData,
|
|
1144
1142
|
acceptedLegalConsents,
|
|
1145
1143
|
amount: effectiveAmount ?? null,
|
|
1144
|
+
amountExact: effectiveAmountExact ?? null,
|
|
1146
1145
|
selectedPriceItemId
|
|
1147
|
-
}), [acceptedLegalConsents, customerData, effectiveAmount, selectedPriceItemId]);
|
|
1146
|
+
}), [acceptedLegalConsents, customerData, effectiveAmount, effectiveAmountExact, selectedPriceItemId]);
|
|
1148
1147
|
const resolveFieldLabel = React.useCallback((fieldPath) => {
|
|
1149
1148
|
if (!payload) return t("checkout.payPage.validation.thisField", "this field");
|
|
1150
1149
|
if (fieldPath.startsWith("customerData.")) {
|
|
@@ -1191,6 +1190,7 @@ function PayPage({
|
|
|
1191
1190
|
setCustomerData(nextData.customerData);
|
|
1192
1191
|
setAcceptedLegalConsents(nextData.acceptedLegalConsents);
|
|
1193
1192
|
setAmount(nextData.amount);
|
|
1193
|
+
setAmountExact(nextData.amountExact ?? null);
|
|
1194
1194
|
setSelectedPriceItemId(nextData.selectedPriceItemId);
|
|
1195
1195
|
}, []);
|
|
1196
1196
|
const validateBeforeSubmit = React.useCallback(() => {
|
|
@@ -1203,23 +1203,24 @@ function PayPage({
|
|
|
1203
1203
|
);
|
|
1204
1204
|
}
|
|
1205
1205
|
if (payload.pricingMode === "custom_amount") {
|
|
1206
|
-
|
|
1206
|
+
const amountIssue = validatePayPageCustomAmount(payload, {
|
|
1207
|
+
amount: effectiveAmount ?? null,
|
|
1208
|
+
amountExact: effectiveAmountExact ?? null
|
|
1209
|
+
});
|
|
1210
|
+
if (amountIssue === "required") {
|
|
1207
1211
|
nextErrors.amount = "checkout.payPage.validation.amountRequired";
|
|
1208
|
-
} else {
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
{ amount: formatAmount(payload.customAmountMax, payload.customAmountCurrencyCode) }
|
|
1221
|
-
);
|
|
1222
|
-
}
|
|
1212
|
+
} else if (amountIssue === "min") {
|
|
1213
|
+
nextErrors.amount = t(
|
|
1214
|
+
"checkout.payPage.validation.amountMin",
|
|
1215
|
+
"Enter at least {amount}.",
|
|
1216
|
+
{ amount: formatAmount(payload.customAmountMin, payload.customAmountCurrencyCode, resolveExactDecimal(payload.customAmountMinExact, payload.customAmountMin)) }
|
|
1217
|
+
);
|
|
1218
|
+
} else if (amountIssue === "max") {
|
|
1219
|
+
nextErrors.amount = t(
|
|
1220
|
+
"checkout.payPage.validation.amountMax",
|
|
1221
|
+
"Enter no more than {amount}.",
|
|
1222
|
+
{ amount: formatAmount(payload.customAmountMax, payload.customAmountCurrencyCode, resolveExactDecimal(payload.customAmountMaxExact, payload.customAmountMax)) }
|
|
1223
|
+
);
|
|
1223
1224
|
}
|
|
1224
1225
|
}
|
|
1225
1226
|
if (payload.pricingMode === "price_list" && !selectedPriceItemId) {
|
|
@@ -1236,6 +1237,7 @@ function PayPage({
|
|
|
1236
1237
|
acceptedLegalConsents,
|
|
1237
1238
|
customerData,
|
|
1238
1239
|
effectiveAmount,
|
|
1240
|
+
effectiveAmountExact,
|
|
1239
1241
|
formatAmount,
|
|
1240
1242
|
payload,
|
|
1241
1243
|
selectedPriceItemId,
|
|
@@ -1464,7 +1466,7 @@ function PayPage({
|
|
|
1464
1466
|
"Idempotency-Key": crypto.randomUUID(),
|
|
1465
1467
|
"x-om-unauthorized-redirect": "0"
|
|
1466
1468
|
},
|
|
1467
|
-
body: JSON.stringify(nextSubmitData)
|
|
1469
|
+
body: JSON.stringify(buildPayPageSubmitBody(nextSubmitData))
|
|
1468
1470
|
}
|
|
1469
1471
|
);
|
|
1470
1472
|
const result = injectionRequestHeaders && Object.keys(injectionRequestHeaders).length > 0 ? await withScopedApiRequestHeaders(injectionRequestHeaders, runSubmit) : await runSubmit();
|
|
@@ -1674,22 +1676,23 @@ function PayPage({
|
|
|
1674
1676
|
{
|
|
1675
1677
|
payload,
|
|
1676
1678
|
amount,
|
|
1679
|
+
amountExact,
|
|
1677
1680
|
selectedPriceItemId,
|
|
1678
1681
|
fieldErrors,
|
|
1679
1682
|
inputsLocked,
|
|
1680
1683
|
formatAmount,
|
|
1681
1684
|
onAmountChange: (value) => {
|
|
1682
|
-
const nextAmount =
|
|
1683
|
-
const nextData =
|
|
1685
|
+
const nextAmount = parsePayPageAmountInput(value);
|
|
1686
|
+
const nextData = { ...submitDataRef.current, ...nextAmount };
|
|
1684
1687
|
applySubmitDataToState(nextData);
|
|
1685
1688
|
clearFieldError("amount");
|
|
1686
1689
|
setSubmissionError(null);
|
|
1687
|
-
dispatchFieldChange("amount", nextAmount, nextData);
|
|
1690
|
+
dispatchFieldChange("amount", nextAmount.amount, nextData);
|
|
1688
1691
|
},
|
|
1689
1692
|
onPriceItemSelect: (item) => {
|
|
1690
1693
|
const nextData = {
|
|
1691
1694
|
...submitDataRef.current,
|
|
1692
|
-
amount
|
|
1695
|
+
...toPayPageAmount(item.amount, item.amountExact),
|
|
1693
1696
|
selectedPriceItemId: item.id
|
|
1694
1697
|
};
|
|
1695
1698
|
applySubmitDataToState(nextData);
|
|
@@ -1708,6 +1711,7 @@ function PayPage({
|
|
|
1708
1711
|
{
|
|
1709
1712
|
payload,
|
|
1710
1713
|
selectedAmount: effectiveAmount,
|
|
1714
|
+
selectedAmountExact: effectiveAmountExact,
|
|
1711
1715
|
currencyCode: effectiveCurrencyCode,
|
|
1712
1716
|
formatAmount,
|
|
1713
1717
|
preview: isPreview,
|