@easypayment/medusa-payment-paypal 0.9.10 → 0.9.12
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/.medusa/server/src/admin/index.js +94 -94
- package/.medusa/server/src/admin/index.mjs +94 -94
- package/.medusa/server/src/api/store/paypal/capture-order/route.d.ts.map +1 -1
- package/.medusa/server/src/api/store/paypal/capture-order/route.js +4 -5
- package/.medusa/server/src/api/store/paypal/capture-order/route.js.map +1 -1
- package/package.json +1 -1
- package/src/api/store/paypal/capture-order/route.ts +4 -8
|
@@ -224,10 +224,94 @@ function AdditionalSettingsTab() {
|
|
|
224
224
|
)
|
|
225
225
|
] }) });
|
|
226
226
|
}
|
|
227
|
-
function
|
|
227
|
+
function PayPalApplePayPage() {
|
|
228
228
|
return /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: "/settings/paypal/connection", replace: true });
|
|
229
229
|
}
|
|
230
|
-
|
|
230
|
+
const DEFAULT_FORM = {
|
|
231
|
+
enabled: true,
|
|
232
|
+
title: "Credit or Debit Card",
|
|
233
|
+
threeDS: "when_required"
|
|
234
|
+
};
|
|
235
|
+
function mergeWithDefaults(saved) {
|
|
236
|
+
if (!saved) return { ...DEFAULT_FORM };
|
|
237
|
+
const entries = Object.entries(saved).filter(([, value]) => value !== void 0);
|
|
238
|
+
return { ...DEFAULT_FORM, ...Object.fromEntries(entries) };
|
|
239
|
+
}
|
|
240
|
+
const THREE_DS_OPTIONS = [
|
|
241
|
+
{ value: "when_required", label: "3D Secure when required", hint: "Triggers 3DS only when the card / issuer requires it." },
|
|
242
|
+
{ value: "sli", label: "3D Secure (SCA) / liability shift (recommended)", hint: "Attempts to optimize for liability shift while remaining compliant." },
|
|
243
|
+
{ value: "always", label: "Always request 3D Secure", hint: "Forces 3DS challenge whenever possible (may reduce conversion)." }
|
|
244
|
+
];
|
|
245
|
+
function AdvancedCardPaymentsTab() {
|
|
246
|
+
var _a, _b;
|
|
247
|
+
const [form, setForm] = react.useState(() => ({ ...DEFAULT_FORM }));
|
|
248
|
+
const [loading, setLoading] = react.useState(false);
|
|
249
|
+
const [saving, setSaving] = react.useState(false);
|
|
250
|
+
const [toast, setToast] = react.useState(null);
|
|
251
|
+
const didInit = react.useRef(false);
|
|
252
|
+
const dismissToast = react.useCallback(() => setToast(null), []);
|
|
253
|
+
react.useEffect(() => {
|
|
254
|
+
if (didInit.current) return;
|
|
255
|
+
didInit.current = true;
|
|
256
|
+
(async () => {
|
|
257
|
+
try {
|
|
258
|
+
setLoading(true);
|
|
259
|
+
const json = await adminFetch("/admin/paypal/settings");
|
|
260
|
+
const payload = (json == null ? void 0 : json.data) ?? json;
|
|
261
|
+
const saved = payload == null ? void 0 : payload.advanced_card_payments;
|
|
262
|
+
if (saved && typeof saved === "object") setForm(mergeWithDefaults(saved));
|
|
263
|
+
} catch {
|
|
264
|
+
} finally {
|
|
265
|
+
setLoading(false);
|
|
266
|
+
}
|
|
267
|
+
})();
|
|
268
|
+
}, []);
|
|
269
|
+
async function onSave() {
|
|
270
|
+
try {
|
|
271
|
+
setSaving(true);
|
|
272
|
+
const json = await adminFetch("/admin/paypal/settings", {
|
|
273
|
+
method: "POST",
|
|
274
|
+
body: { advanced_card_payments: form }
|
|
275
|
+
});
|
|
276
|
+
const payload = (json == null ? void 0 : json.data) ?? json;
|
|
277
|
+
const saved = payload == null ? void 0 : payload.advanced_card_payments;
|
|
278
|
+
if (saved && typeof saved === "object") setForm(mergeWithDefaults(saved));
|
|
279
|
+
setToast({ kind: "success", message: "Settings saved" });
|
|
280
|
+
} catch (e) {
|
|
281
|
+
setToast({ kind: "error", message: (e instanceof Error ? e.message : "") || "Failed to save settings." });
|
|
282
|
+
} finally {
|
|
283
|
+
setSaving(false);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-6", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-6", children: [
|
|
287
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-start justify-between gap-4", children: /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-xl font-semibold text-ui-fg-base", children: "PayPal Gateway By Easy Payment" }) }) }),
|
|
288
|
+
/* @__PURE__ */ jsxRuntime.jsx(PayPalTabs, {}),
|
|
289
|
+
/* @__PURE__ */ jsxRuntime.jsx(Toast, { toast, onClose: dismissToast }),
|
|
290
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
291
|
+
SectionCard,
|
|
292
|
+
{
|
|
293
|
+
title: "Advanced Card Payments",
|
|
294
|
+
description: "Control card checkout settings and 3D Secure behavior.",
|
|
295
|
+
right: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
296
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: onSave, disabled: saving || loading, className: "transition-fg relative inline-flex w-fit items-center justify-center overflow-hidden rounded-md outline-none shadow-buttons-neutral text-ui-fg-base bg-ui-button-neutral after:transition-fg after:absolute after:inset-0 after:content-[''] after:button-neutral-gradient hover:bg-ui-button-neutral-hover hover:after:button-neutral-hover-gradient active:bg-ui-button-neutral-pressed active:after:button-neutral-pressed-gradient focus-visible:shadow-buttons-neutral-focus disabled:bg-ui-bg-disabled disabled:border-ui-border-base disabled:text-ui-fg-disabled disabled:shadow-buttons-neutral disabled:after:hidden txt-compact-small-plus px-3 py-1.5", children: saving ? "Saving..." : "Save settings" }),
|
|
297
|
+
loading ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-subtle", children: "Loading…" }) : null
|
|
298
|
+
] }),
|
|
299
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "divide-y divide-ui-border-base", children: [
|
|
300
|
+
/* @__PURE__ */ jsxRuntime.jsx(FieldRow, { label: "Enable/Disable", children: /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "inline-flex items-center gap-2", children: [
|
|
301
|
+
/* @__PURE__ */ jsxRuntime.jsx("input", { type: "checkbox", checked: form.enabled, onChange: (e) => setForm((p) => ({ ...p, enabled: e.target.checked })), className: "h-4 w-4 rounded border-ui-border-base" }),
|
|
302
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-base", children: "Enable Advanced Credit/Debit Card" })
|
|
303
|
+
] }) }),
|
|
304
|
+
/* @__PURE__ */ jsxRuntime.jsx(FieldRow, { label: "Title", htmlFor: "acp-title", children: /* @__PURE__ */ jsxRuntime.jsx("input", { id: "acp-title", value: form.title, onChange: (e) => setForm((p) => ({ ...p, title: e.target.value })), className: "w-full rounded-md border border-ui-border-base bg-ui-bg-base px-3 py-2 text-sm text-ui-fg-base outline-none focus:ring-2 focus:ring-ui-border-interactive", placeholder: "Credit or Debit Card" }) }),
|
|
305
|
+
/* @__PURE__ */ jsxRuntime.jsx(FieldRow, { label: "Contingency for 3D Secure", hint: "Choose when 3D Secure should be triggered during card payments.", htmlFor: "acp-threeds", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
306
|
+
/* @__PURE__ */ jsxRuntime.jsx("select", { id: "acp-threeds", value: form.threeDS, onChange: (e) => setForm((p) => ({ ...p, threeDS: e.target.value })), className: "w-full rounded-md border border-ui-border-base bg-ui-bg-base px-3 py-2 text-sm text-ui-fg-base outline-none focus:ring-2 focus:ring-ui-border-interactive", children: THREE_DS_OPTIONS.map((o) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: o.value, children: o.label }, o.value)) }),
|
|
307
|
+
((_a = THREE_DS_OPTIONS.find((o) => o.value === form.threeDS)) == null ? void 0 : _a.hint) ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs text-ui-fg-subtle", children: (_b = THREE_DS_OPTIONS.find((o) => o.value === form.threeDS)) == null ? void 0 : _b.hint }) : null
|
|
308
|
+
] }) })
|
|
309
|
+
] })
|
|
310
|
+
}
|
|
311
|
+
)
|
|
312
|
+
] }) });
|
|
313
|
+
}
|
|
314
|
+
function PayPalGooglePayPage() {
|
|
231
315
|
return /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: "/settings/paypal/connection", replace: true });
|
|
232
316
|
}
|
|
233
317
|
const config = adminSdk.defineRouteConfig({
|
|
@@ -814,90 +898,6 @@ function PayPalConnectionPage() {
|
|
|
814
898
|
` })
|
|
815
899
|
] });
|
|
816
900
|
}
|
|
817
|
-
const DEFAULT_FORM = {
|
|
818
|
-
enabled: true,
|
|
819
|
-
title: "Credit or Debit Card",
|
|
820
|
-
threeDS: "when_required"
|
|
821
|
-
};
|
|
822
|
-
function mergeWithDefaults(saved) {
|
|
823
|
-
if (!saved) return { ...DEFAULT_FORM };
|
|
824
|
-
const entries = Object.entries(saved).filter(([, value]) => value !== void 0);
|
|
825
|
-
return { ...DEFAULT_FORM, ...Object.fromEntries(entries) };
|
|
826
|
-
}
|
|
827
|
-
const THREE_DS_OPTIONS = [
|
|
828
|
-
{ value: "when_required", label: "3D Secure when required", hint: "Triggers 3DS only when the card / issuer requires it." },
|
|
829
|
-
{ value: "sli", label: "3D Secure (SCA) / liability shift (recommended)", hint: "Attempts to optimize for liability shift while remaining compliant." },
|
|
830
|
-
{ value: "always", label: "Always request 3D Secure", hint: "Forces 3DS challenge whenever possible (may reduce conversion)." }
|
|
831
|
-
];
|
|
832
|
-
function AdvancedCardPaymentsTab() {
|
|
833
|
-
var _a, _b;
|
|
834
|
-
const [form, setForm] = react.useState(() => ({ ...DEFAULT_FORM }));
|
|
835
|
-
const [loading, setLoading] = react.useState(false);
|
|
836
|
-
const [saving, setSaving] = react.useState(false);
|
|
837
|
-
const [toast, setToast] = react.useState(null);
|
|
838
|
-
const didInit = react.useRef(false);
|
|
839
|
-
const dismissToast = react.useCallback(() => setToast(null), []);
|
|
840
|
-
react.useEffect(() => {
|
|
841
|
-
if (didInit.current) return;
|
|
842
|
-
didInit.current = true;
|
|
843
|
-
(async () => {
|
|
844
|
-
try {
|
|
845
|
-
setLoading(true);
|
|
846
|
-
const json = await adminFetch("/admin/paypal/settings");
|
|
847
|
-
const payload = (json == null ? void 0 : json.data) ?? json;
|
|
848
|
-
const saved = payload == null ? void 0 : payload.advanced_card_payments;
|
|
849
|
-
if (saved && typeof saved === "object") setForm(mergeWithDefaults(saved));
|
|
850
|
-
} catch {
|
|
851
|
-
} finally {
|
|
852
|
-
setLoading(false);
|
|
853
|
-
}
|
|
854
|
-
})();
|
|
855
|
-
}, []);
|
|
856
|
-
async function onSave() {
|
|
857
|
-
try {
|
|
858
|
-
setSaving(true);
|
|
859
|
-
const json = await adminFetch("/admin/paypal/settings", {
|
|
860
|
-
method: "POST",
|
|
861
|
-
body: { advanced_card_payments: form }
|
|
862
|
-
});
|
|
863
|
-
const payload = (json == null ? void 0 : json.data) ?? json;
|
|
864
|
-
const saved = payload == null ? void 0 : payload.advanced_card_payments;
|
|
865
|
-
if (saved && typeof saved === "object") setForm(mergeWithDefaults(saved));
|
|
866
|
-
setToast({ kind: "success", message: "Settings saved" });
|
|
867
|
-
} catch (e) {
|
|
868
|
-
setToast({ kind: "error", message: (e instanceof Error ? e.message : "") || "Failed to save settings." });
|
|
869
|
-
} finally {
|
|
870
|
-
setSaving(false);
|
|
871
|
-
}
|
|
872
|
-
}
|
|
873
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-6", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-6", children: [
|
|
874
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-start justify-between gap-4", children: /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-xl font-semibold text-ui-fg-base", children: "PayPal Gateway By Easy Payment" }) }) }),
|
|
875
|
-
/* @__PURE__ */ jsxRuntime.jsx(PayPalTabs, {}),
|
|
876
|
-
/* @__PURE__ */ jsxRuntime.jsx(Toast, { toast, onClose: dismissToast }),
|
|
877
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
878
|
-
SectionCard,
|
|
879
|
-
{
|
|
880
|
-
title: "Advanced Card Payments",
|
|
881
|
-
description: "Control card checkout settings and 3D Secure behavior.",
|
|
882
|
-
right: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
883
|
-
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: onSave, disabled: saving || loading, className: "transition-fg relative inline-flex w-fit items-center justify-center overflow-hidden rounded-md outline-none shadow-buttons-neutral text-ui-fg-base bg-ui-button-neutral after:transition-fg after:absolute after:inset-0 after:content-[''] after:button-neutral-gradient hover:bg-ui-button-neutral-hover hover:after:button-neutral-hover-gradient active:bg-ui-button-neutral-pressed active:after:button-neutral-pressed-gradient focus-visible:shadow-buttons-neutral-focus disabled:bg-ui-bg-disabled disabled:border-ui-border-base disabled:text-ui-fg-disabled disabled:shadow-buttons-neutral disabled:after:hidden txt-compact-small-plus px-3 py-1.5", children: saving ? "Saving..." : "Save settings" }),
|
|
884
|
-
loading ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-subtle", children: "Loading…" }) : null
|
|
885
|
-
] }),
|
|
886
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "divide-y divide-ui-border-base", children: [
|
|
887
|
-
/* @__PURE__ */ jsxRuntime.jsx(FieldRow, { label: "Enable/Disable", children: /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "inline-flex items-center gap-2", children: [
|
|
888
|
-
/* @__PURE__ */ jsxRuntime.jsx("input", { type: "checkbox", checked: form.enabled, onChange: (e) => setForm((p) => ({ ...p, enabled: e.target.checked })), className: "h-4 w-4 rounded border-ui-border-base" }),
|
|
889
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-base", children: "Enable Advanced Credit/Debit Card" })
|
|
890
|
-
] }) }),
|
|
891
|
-
/* @__PURE__ */ jsxRuntime.jsx(FieldRow, { label: "Title", htmlFor: "acp-title", children: /* @__PURE__ */ jsxRuntime.jsx("input", { id: "acp-title", value: form.title, onChange: (e) => setForm((p) => ({ ...p, title: e.target.value })), className: "w-full rounded-md border border-ui-border-base bg-ui-bg-base px-3 py-2 text-sm text-ui-fg-base outline-none focus:ring-2 focus:ring-ui-border-interactive", placeholder: "Credit or Debit Card" }) }),
|
|
892
|
-
/* @__PURE__ */ jsxRuntime.jsx(FieldRow, { label: "Contingency for 3D Secure", hint: "Choose when 3D Secure should be triggered during card payments.", htmlFor: "acp-threeds", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
893
|
-
/* @__PURE__ */ jsxRuntime.jsx("select", { id: "acp-threeds", value: form.threeDS, onChange: (e) => setForm((p) => ({ ...p, threeDS: e.target.value })), className: "w-full rounded-md border border-ui-border-base bg-ui-bg-base px-3 py-2 text-sm text-ui-fg-base outline-none focus:ring-2 focus:ring-ui-border-interactive", children: THREE_DS_OPTIONS.map((o) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: o.value, children: o.label }, o.value)) }),
|
|
894
|
-
((_a = THREE_DS_OPTIONS.find((o) => o.value === form.threeDS)) == null ? void 0 : _a.hint) ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs text-ui-fg-subtle", children: (_b = THREE_DS_OPTIONS.find((o) => o.value === form.threeDS)) == null ? void 0 : _b.hint }) : null
|
|
895
|
-
] }) })
|
|
896
|
-
] })
|
|
897
|
-
}
|
|
898
|
-
)
|
|
899
|
-
] }) });
|
|
900
|
-
}
|
|
901
901
|
function PayPalPayLaterMessagingPage() {
|
|
902
902
|
return /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: "/settings/paypal/connection", replace: true });
|
|
903
903
|
}
|
|
@@ -1119,22 +1119,22 @@ const routeModule = {
|
|
|
1119
1119
|
Component: AdditionalSettingsTab,
|
|
1120
1120
|
path: "/settings/paypal/additional-settings"
|
|
1121
1121
|
},
|
|
1122
|
-
{
|
|
1123
|
-
Component: PayPalGooglePayPage,
|
|
1124
|
-
path: "/settings/paypal/google-pay"
|
|
1125
|
-
},
|
|
1126
1122
|
{
|
|
1127
1123
|
Component: PayPalApplePayPage,
|
|
1128
1124
|
path: "/settings/paypal/apple-pay"
|
|
1129
1125
|
},
|
|
1130
|
-
{
|
|
1131
|
-
Component: PayPalConnectionPage,
|
|
1132
|
-
path: "/settings/paypal/connection"
|
|
1133
|
-
},
|
|
1134
1126
|
{
|
|
1135
1127
|
Component: AdvancedCardPaymentsTab,
|
|
1136
1128
|
path: "/settings/paypal/advanced-card-payments"
|
|
1137
1129
|
},
|
|
1130
|
+
{
|
|
1131
|
+
Component: PayPalGooglePayPage,
|
|
1132
|
+
path: "/settings/paypal/google-pay"
|
|
1133
|
+
},
|
|
1134
|
+
{
|
|
1135
|
+
Component: PayPalConnectionPage,
|
|
1136
|
+
path: "/settings/paypal/connection"
|
|
1137
|
+
},
|
|
1138
1138
|
{
|
|
1139
1139
|
Component: PayPalPayLaterMessagingPage,
|
|
1140
1140
|
path: "/settings/paypal/pay-later-messaging"
|
|
@@ -223,10 +223,94 @@ function AdditionalSettingsTab() {
|
|
|
223
223
|
)
|
|
224
224
|
] }) });
|
|
225
225
|
}
|
|
226
|
-
function
|
|
226
|
+
function PayPalApplePayPage() {
|
|
227
227
|
return /* @__PURE__ */ jsx(Navigate, { to: "/settings/paypal/connection", replace: true });
|
|
228
228
|
}
|
|
229
|
-
|
|
229
|
+
const DEFAULT_FORM = {
|
|
230
|
+
enabled: true,
|
|
231
|
+
title: "Credit or Debit Card",
|
|
232
|
+
threeDS: "when_required"
|
|
233
|
+
};
|
|
234
|
+
function mergeWithDefaults(saved) {
|
|
235
|
+
if (!saved) return { ...DEFAULT_FORM };
|
|
236
|
+
const entries = Object.entries(saved).filter(([, value]) => value !== void 0);
|
|
237
|
+
return { ...DEFAULT_FORM, ...Object.fromEntries(entries) };
|
|
238
|
+
}
|
|
239
|
+
const THREE_DS_OPTIONS = [
|
|
240
|
+
{ value: "when_required", label: "3D Secure when required", hint: "Triggers 3DS only when the card / issuer requires it." },
|
|
241
|
+
{ value: "sli", label: "3D Secure (SCA) / liability shift (recommended)", hint: "Attempts to optimize for liability shift while remaining compliant." },
|
|
242
|
+
{ value: "always", label: "Always request 3D Secure", hint: "Forces 3DS challenge whenever possible (may reduce conversion)." }
|
|
243
|
+
];
|
|
244
|
+
function AdvancedCardPaymentsTab() {
|
|
245
|
+
var _a, _b;
|
|
246
|
+
const [form, setForm] = useState(() => ({ ...DEFAULT_FORM }));
|
|
247
|
+
const [loading, setLoading] = useState(false);
|
|
248
|
+
const [saving, setSaving] = useState(false);
|
|
249
|
+
const [toast, setToast] = useState(null);
|
|
250
|
+
const didInit = useRef(false);
|
|
251
|
+
const dismissToast = useCallback(() => setToast(null), []);
|
|
252
|
+
useEffect(() => {
|
|
253
|
+
if (didInit.current) return;
|
|
254
|
+
didInit.current = true;
|
|
255
|
+
(async () => {
|
|
256
|
+
try {
|
|
257
|
+
setLoading(true);
|
|
258
|
+
const json = await adminFetch("/admin/paypal/settings");
|
|
259
|
+
const payload = (json == null ? void 0 : json.data) ?? json;
|
|
260
|
+
const saved = payload == null ? void 0 : payload.advanced_card_payments;
|
|
261
|
+
if (saved && typeof saved === "object") setForm(mergeWithDefaults(saved));
|
|
262
|
+
} catch {
|
|
263
|
+
} finally {
|
|
264
|
+
setLoading(false);
|
|
265
|
+
}
|
|
266
|
+
})();
|
|
267
|
+
}, []);
|
|
268
|
+
async function onSave() {
|
|
269
|
+
try {
|
|
270
|
+
setSaving(true);
|
|
271
|
+
const json = await adminFetch("/admin/paypal/settings", {
|
|
272
|
+
method: "POST",
|
|
273
|
+
body: { advanced_card_payments: form }
|
|
274
|
+
});
|
|
275
|
+
const payload = (json == null ? void 0 : json.data) ?? json;
|
|
276
|
+
const saved = payload == null ? void 0 : payload.advanced_card_payments;
|
|
277
|
+
if (saved && typeof saved === "object") setForm(mergeWithDefaults(saved));
|
|
278
|
+
setToast({ kind: "success", message: "Settings saved" });
|
|
279
|
+
} catch (e) {
|
|
280
|
+
setToast({ kind: "error", message: (e instanceof Error ? e.message : "") || "Failed to save settings." });
|
|
281
|
+
} finally {
|
|
282
|
+
setSaving(false);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
return /* @__PURE__ */ jsx("div", { className: "p-6", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-6", children: [
|
|
286
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-start justify-between gap-4", children: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("h1", { className: "text-xl font-semibold text-ui-fg-base", children: "PayPal Gateway By Easy Payment" }) }) }),
|
|
287
|
+
/* @__PURE__ */ jsx(PayPalTabs, {}),
|
|
288
|
+
/* @__PURE__ */ jsx(Toast, { toast, onClose: dismissToast }),
|
|
289
|
+
/* @__PURE__ */ jsx(
|
|
290
|
+
SectionCard,
|
|
291
|
+
{
|
|
292
|
+
title: "Advanced Card Payments",
|
|
293
|
+
description: "Control card checkout settings and 3D Secure behavior.",
|
|
294
|
+
right: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
295
|
+
/* @__PURE__ */ jsx("button", { type: "button", onClick: onSave, disabled: saving || loading, className: "transition-fg relative inline-flex w-fit items-center justify-center overflow-hidden rounded-md outline-none shadow-buttons-neutral text-ui-fg-base bg-ui-button-neutral after:transition-fg after:absolute after:inset-0 after:content-[''] after:button-neutral-gradient hover:bg-ui-button-neutral-hover hover:after:button-neutral-hover-gradient active:bg-ui-button-neutral-pressed active:after:button-neutral-pressed-gradient focus-visible:shadow-buttons-neutral-focus disabled:bg-ui-bg-disabled disabled:border-ui-border-base disabled:text-ui-fg-disabled disabled:shadow-buttons-neutral disabled:after:hidden txt-compact-small-plus px-3 py-1.5", children: saving ? "Saving..." : "Save settings" }),
|
|
296
|
+
loading ? /* @__PURE__ */ jsx("span", { className: "text-sm text-ui-fg-subtle", children: "Loading…" }) : null
|
|
297
|
+
] }),
|
|
298
|
+
children: /* @__PURE__ */ jsxs("div", { className: "divide-y divide-ui-border-base", children: [
|
|
299
|
+
/* @__PURE__ */ jsx(FieldRow, { label: "Enable/Disable", children: /* @__PURE__ */ jsxs("label", { className: "inline-flex items-center gap-2", children: [
|
|
300
|
+
/* @__PURE__ */ jsx("input", { type: "checkbox", checked: form.enabled, onChange: (e) => setForm((p) => ({ ...p, enabled: e.target.checked })), className: "h-4 w-4 rounded border-ui-border-base" }),
|
|
301
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm text-ui-fg-base", children: "Enable Advanced Credit/Debit Card" })
|
|
302
|
+
] }) }),
|
|
303
|
+
/* @__PURE__ */ jsx(FieldRow, { label: "Title", htmlFor: "acp-title", children: /* @__PURE__ */ jsx("input", { id: "acp-title", value: form.title, onChange: (e) => setForm((p) => ({ ...p, title: e.target.value })), className: "w-full rounded-md border border-ui-border-base bg-ui-bg-base px-3 py-2 text-sm text-ui-fg-base outline-none focus:ring-2 focus:ring-ui-border-interactive", placeholder: "Credit or Debit Card" }) }),
|
|
304
|
+
/* @__PURE__ */ jsx(FieldRow, { label: "Contingency for 3D Secure", hint: "Choose when 3D Secure should be triggered during card payments.", htmlFor: "acp-threeds", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
305
|
+
/* @__PURE__ */ jsx("select", { id: "acp-threeds", value: form.threeDS, onChange: (e) => setForm((p) => ({ ...p, threeDS: e.target.value })), className: "w-full rounded-md border border-ui-border-base bg-ui-bg-base px-3 py-2 text-sm text-ui-fg-base outline-none focus:ring-2 focus:ring-ui-border-interactive", children: THREE_DS_OPTIONS.map((o) => /* @__PURE__ */ jsx("option", { value: o.value, children: o.label }, o.value)) }),
|
|
306
|
+
((_a = THREE_DS_OPTIONS.find((o) => o.value === form.threeDS)) == null ? void 0 : _a.hint) ? /* @__PURE__ */ jsx("div", { className: "text-xs text-ui-fg-subtle", children: (_b = THREE_DS_OPTIONS.find((o) => o.value === form.threeDS)) == null ? void 0 : _b.hint }) : null
|
|
307
|
+
] }) })
|
|
308
|
+
] })
|
|
309
|
+
}
|
|
310
|
+
)
|
|
311
|
+
] }) });
|
|
312
|
+
}
|
|
313
|
+
function PayPalGooglePayPage() {
|
|
230
314
|
return /* @__PURE__ */ jsx(Navigate, { to: "/settings/paypal/connection", replace: true });
|
|
231
315
|
}
|
|
232
316
|
const config = defineRouteConfig({
|
|
@@ -813,90 +897,6 @@ function PayPalConnectionPage() {
|
|
|
813
897
|
` })
|
|
814
898
|
] });
|
|
815
899
|
}
|
|
816
|
-
const DEFAULT_FORM = {
|
|
817
|
-
enabled: true,
|
|
818
|
-
title: "Credit or Debit Card",
|
|
819
|
-
threeDS: "when_required"
|
|
820
|
-
};
|
|
821
|
-
function mergeWithDefaults(saved) {
|
|
822
|
-
if (!saved) return { ...DEFAULT_FORM };
|
|
823
|
-
const entries = Object.entries(saved).filter(([, value]) => value !== void 0);
|
|
824
|
-
return { ...DEFAULT_FORM, ...Object.fromEntries(entries) };
|
|
825
|
-
}
|
|
826
|
-
const THREE_DS_OPTIONS = [
|
|
827
|
-
{ value: "when_required", label: "3D Secure when required", hint: "Triggers 3DS only when the card / issuer requires it." },
|
|
828
|
-
{ value: "sli", label: "3D Secure (SCA) / liability shift (recommended)", hint: "Attempts to optimize for liability shift while remaining compliant." },
|
|
829
|
-
{ value: "always", label: "Always request 3D Secure", hint: "Forces 3DS challenge whenever possible (may reduce conversion)." }
|
|
830
|
-
];
|
|
831
|
-
function AdvancedCardPaymentsTab() {
|
|
832
|
-
var _a, _b;
|
|
833
|
-
const [form, setForm] = useState(() => ({ ...DEFAULT_FORM }));
|
|
834
|
-
const [loading, setLoading] = useState(false);
|
|
835
|
-
const [saving, setSaving] = useState(false);
|
|
836
|
-
const [toast, setToast] = useState(null);
|
|
837
|
-
const didInit = useRef(false);
|
|
838
|
-
const dismissToast = useCallback(() => setToast(null), []);
|
|
839
|
-
useEffect(() => {
|
|
840
|
-
if (didInit.current) return;
|
|
841
|
-
didInit.current = true;
|
|
842
|
-
(async () => {
|
|
843
|
-
try {
|
|
844
|
-
setLoading(true);
|
|
845
|
-
const json = await adminFetch("/admin/paypal/settings");
|
|
846
|
-
const payload = (json == null ? void 0 : json.data) ?? json;
|
|
847
|
-
const saved = payload == null ? void 0 : payload.advanced_card_payments;
|
|
848
|
-
if (saved && typeof saved === "object") setForm(mergeWithDefaults(saved));
|
|
849
|
-
} catch {
|
|
850
|
-
} finally {
|
|
851
|
-
setLoading(false);
|
|
852
|
-
}
|
|
853
|
-
})();
|
|
854
|
-
}, []);
|
|
855
|
-
async function onSave() {
|
|
856
|
-
try {
|
|
857
|
-
setSaving(true);
|
|
858
|
-
const json = await adminFetch("/admin/paypal/settings", {
|
|
859
|
-
method: "POST",
|
|
860
|
-
body: { advanced_card_payments: form }
|
|
861
|
-
});
|
|
862
|
-
const payload = (json == null ? void 0 : json.data) ?? json;
|
|
863
|
-
const saved = payload == null ? void 0 : payload.advanced_card_payments;
|
|
864
|
-
if (saved && typeof saved === "object") setForm(mergeWithDefaults(saved));
|
|
865
|
-
setToast({ kind: "success", message: "Settings saved" });
|
|
866
|
-
} catch (e) {
|
|
867
|
-
setToast({ kind: "error", message: (e instanceof Error ? e.message : "") || "Failed to save settings." });
|
|
868
|
-
} finally {
|
|
869
|
-
setSaving(false);
|
|
870
|
-
}
|
|
871
|
-
}
|
|
872
|
-
return /* @__PURE__ */ jsx("div", { className: "p-6", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-6", children: [
|
|
873
|
-
/* @__PURE__ */ jsx("div", { className: "flex items-start justify-between gap-4", children: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("h1", { className: "text-xl font-semibold text-ui-fg-base", children: "PayPal Gateway By Easy Payment" }) }) }),
|
|
874
|
-
/* @__PURE__ */ jsx(PayPalTabs, {}),
|
|
875
|
-
/* @__PURE__ */ jsx(Toast, { toast, onClose: dismissToast }),
|
|
876
|
-
/* @__PURE__ */ jsx(
|
|
877
|
-
SectionCard,
|
|
878
|
-
{
|
|
879
|
-
title: "Advanced Card Payments",
|
|
880
|
-
description: "Control card checkout settings and 3D Secure behavior.",
|
|
881
|
-
right: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
882
|
-
/* @__PURE__ */ jsx("button", { type: "button", onClick: onSave, disabled: saving || loading, className: "transition-fg relative inline-flex w-fit items-center justify-center overflow-hidden rounded-md outline-none shadow-buttons-neutral text-ui-fg-base bg-ui-button-neutral after:transition-fg after:absolute after:inset-0 after:content-[''] after:button-neutral-gradient hover:bg-ui-button-neutral-hover hover:after:button-neutral-hover-gradient active:bg-ui-button-neutral-pressed active:after:button-neutral-pressed-gradient focus-visible:shadow-buttons-neutral-focus disabled:bg-ui-bg-disabled disabled:border-ui-border-base disabled:text-ui-fg-disabled disabled:shadow-buttons-neutral disabled:after:hidden txt-compact-small-plus px-3 py-1.5", children: saving ? "Saving..." : "Save settings" }),
|
|
883
|
-
loading ? /* @__PURE__ */ jsx("span", { className: "text-sm text-ui-fg-subtle", children: "Loading…" }) : null
|
|
884
|
-
] }),
|
|
885
|
-
children: /* @__PURE__ */ jsxs("div", { className: "divide-y divide-ui-border-base", children: [
|
|
886
|
-
/* @__PURE__ */ jsx(FieldRow, { label: "Enable/Disable", children: /* @__PURE__ */ jsxs("label", { className: "inline-flex items-center gap-2", children: [
|
|
887
|
-
/* @__PURE__ */ jsx("input", { type: "checkbox", checked: form.enabled, onChange: (e) => setForm((p) => ({ ...p, enabled: e.target.checked })), className: "h-4 w-4 rounded border-ui-border-base" }),
|
|
888
|
-
/* @__PURE__ */ jsx("span", { className: "text-sm text-ui-fg-base", children: "Enable Advanced Credit/Debit Card" })
|
|
889
|
-
] }) }),
|
|
890
|
-
/* @__PURE__ */ jsx(FieldRow, { label: "Title", htmlFor: "acp-title", children: /* @__PURE__ */ jsx("input", { id: "acp-title", value: form.title, onChange: (e) => setForm((p) => ({ ...p, title: e.target.value })), className: "w-full rounded-md border border-ui-border-base bg-ui-bg-base px-3 py-2 text-sm text-ui-fg-base outline-none focus:ring-2 focus:ring-ui-border-interactive", placeholder: "Credit or Debit Card" }) }),
|
|
891
|
-
/* @__PURE__ */ jsx(FieldRow, { label: "Contingency for 3D Secure", hint: "Choose when 3D Secure should be triggered during card payments.", htmlFor: "acp-threeds", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
892
|
-
/* @__PURE__ */ jsx("select", { id: "acp-threeds", value: form.threeDS, onChange: (e) => setForm((p) => ({ ...p, threeDS: e.target.value })), className: "w-full rounded-md border border-ui-border-base bg-ui-bg-base px-3 py-2 text-sm text-ui-fg-base outline-none focus:ring-2 focus:ring-ui-border-interactive", children: THREE_DS_OPTIONS.map((o) => /* @__PURE__ */ jsx("option", { value: o.value, children: o.label }, o.value)) }),
|
|
893
|
-
((_a = THREE_DS_OPTIONS.find((o) => o.value === form.threeDS)) == null ? void 0 : _a.hint) ? /* @__PURE__ */ jsx("div", { className: "text-xs text-ui-fg-subtle", children: (_b = THREE_DS_OPTIONS.find((o) => o.value === form.threeDS)) == null ? void 0 : _b.hint }) : null
|
|
894
|
-
] }) })
|
|
895
|
-
] })
|
|
896
|
-
}
|
|
897
|
-
)
|
|
898
|
-
] }) });
|
|
899
|
-
}
|
|
900
900
|
function PayPalPayLaterMessagingPage() {
|
|
901
901
|
return /* @__PURE__ */ jsx(Navigate, { to: "/settings/paypal/connection", replace: true });
|
|
902
902
|
}
|
|
@@ -1118,22 +1118,22 @@ const routeModule = {
|
|
|
1118
1118
|
Component: AdditionalSettingsTab,
|
|
1119
1119
|
path: "/settings/paypal/additional-settings"
|
|
1120
1120
|
},
|
|
1121
|
-
{
|
|
1122
|
-
Component: PayPalGooglePayPage,
|
|
1123
|
-
path: "/settings/paypal/google-pay"
|
|
1124
|
-
},
|
|
1125
1121
|
{
|
|
1126
1122
|
Component: PayPalApplePayPage,
|
|
1127
1123
|
path: "/settings/paypal/apple-pay"
|
|
1128
1124
|
},
|
|
1129
|
-
{
|
|
1130
|
-
Component: PayPalConnectionPage,
|
|
1131
|
-
path: "/settings/paypal/connection"
|
|
1132
|
-
},
|
|
1133
1125
|
{
|
|
1134
1126
|
Component: AdvancedCardPaymentsTab,
|
|
1135
1127
|
path: "/settings/paypal/advanced-card-payments"
|
|
1136
1128
|
},
|
|
1129
|
+
{
|
|
1130
|
+
Component: PayPalGooglePayPage,
|
|
1131
|
+
path: "/settings/paypal/google-pay"
|
|
1132
|
+
},
|
|
1133
|
+
{
|
|
1134
|
+
Component: PayPalConnectionPage,
|
|
1135
|
+
path: "/settings/paypal/connection"
|
|
1136
|
+
},
|
|
1137
1137
|
{
|
|
1138
1138
|
Component: PayPalPayLaterMessagingPage,
|
|
1139
1139
|
path: "/settings/paypal/pay-later-messaging"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../../../src/api/store/paypal/capture-order/route.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../../../src/api/store/paypal/capture-order/route.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AA8K7E,wBAAsB,IAAI,CAAC,GAAG,EAAE,aAAa,EAAE,GAAG,EAAE,cAAc,2BA8GjE"}
|
|
@@ -51,7 +51,7 @@ async function findPayPalSessionForCart(cartId, scope) {
|
|
|
51
51
|
return null;
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
-
async function
|
|
54
|
+
async function updatePayPalSessionData(sessionId, extraData, scope) {
|
|
55
55
|
try {
|
|
56
56
|
const paymentModule = scope.resolve(utils_1.Modules.PAYMENT);
|
|
57
57
|
const [existing] = await paymentModule.listPaymentSessions({ id: [sessionId] }, { take: 1 });
|
|
@@ -59,13 +59,12 @@ async function updatePayPalSession(sessionId, status, extraData, scope) {
|
|
|
59
59
|
await paymentModule.updatePaymentSession({
|
|
60
60
|
id: sessionId,
|
|
61
61
|
data: mergedData,
|
|
62
|
-
status: status,
|
|
63
62
|
amount: existing?.amount,
|
|
64
63
|
currency_code: existing?.currency_code,
|
|
65
64
|
});
|
|
66
65
|
}
|
|
67
66
|
catch (e) {
|
|
68
|
-
console.error("[PayPal]
|
|
67
|
+
console.error("[PayPal] updatePayPalSessionData failed:", e?.message);
|
|
69
68
|
}
|
|
70
69
|
}
|
|
71
70
|
async function attachPayPalCaptureToSession(cartId, orderId, capture, scope) {
|
|
@@ -76,7 +75,7 @@ async function attachPayPalCaptureToSession(cartId, orderId, capture, scope) {
|
|
|
76
75
|
return;
|
|
77
76
|
}
|
|
78
77
|
const captureId = capture?.purchase_units?.[0]?.payments?.captures?.[0]?.id || capture?.id;
|
|
79
|
-
await
|
|
78
|
+
await updatePayPalSessionData(session.session_id, {
|
|
80
79
|
paypal: {
|
|
81
80
|
...((session.session_data || {}).paypal || {}),
|
|
82
81
|
order_id: orderId,
|
|
@@ -96,7 +95,7 @@ async function attachPayPalAuthorizationToSession(cartId, orderId, authorization
|
|
|
96
95
|
return;
|
|
97
96
|
}
|
|
98
97
|
const authorizationId = authorization?.purchase_units?.[0]?.payments?.authorizations?.[0]?.id;
|
|
99
|
-
await
|
|
98
|
+
await updatePayPalSessionData(session.session_id, {
|
|
100
99
|
paypal: {
|
|
101
100
|
...((session.session_data || {}).paypal || {}),
|
|
102
101
|
order_id: orderId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.js","sourceRoot":"","sources":["../../../../../../../src/api/store/paypal/capture-order/route.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"route.js","sourceRoot":"","sources":["../../../../../../../src/api/store/paypal/capture-order/route.ts"],"names":[],"mappings":";;AA8KA,oBA8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a,KAAK,WAAW,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC,CAAC,uBAAuB,CACpF,CAAA;QACH,CAAC;QAAC,MAAM,CAAC;QACT,CAAC;QAED,OAAO,aAAa,KAAK,WAAW;YAClC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,aAAa,EAAE,OAAO,EAAE,CAAC;YACtC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAA;IACpC,CAAC;IAAC,OAAO,CAAM,EAAE,CAAC;QAChB,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,CAAC,GAAG,CAAC,IAAI,IAAI,EAAE,CAAS,CAAA;YACrC,MAAM,MAAM,CAAC,gBAAgB,CAAC,sBAAsB,EAAE;gBACpD,OAAO,EAAE,IAAI,CAAC,OAAO;gBACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,QAAQ,EAAE,OAAO;gBACjB,OAAO,EAAE,CAAC,EAAE,OAAO,IAAI,MAAM,CAAC,CAAC,CAAC;aACjC,CAAC,CAAA;YACF,MAAM,MAAM,CAAC,YAAY,CAAC,sBAAsB,CAAC,CAAA;QACnD,CAAC;QAAC,MAAM,CAAC;QACT,CAAC;QACD,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,gCAAgC,EAAE,CAAC,CAAA;IAC5E,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -72,9 +72,8 @@ async function findPayPalSessionForCart(
|
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
async function
|
|
75
|
+
async function updatePayPalSessionData(
|
|
76
76
|
sessionId: string,
|
|
77
|
-
status: string,
|
|
78
77
|
extraData: Record<string, any>,
|
|
79
78
|
scope: any
|
|
80
79
|
): Promise<void> {
|
|
@@ -85,12 +84,11 @@ async function updatePayPalSession(
|
|
|
85
84
|
await (paymentModule as any).updatePaymentSession({
|
|
86
85
|
id: sessionId,
|
|
87
86
|
data: mergedData,
|
|
88
|
-
status: status as any,
|
|
89
87
|
amount: existing?.amount,
|
|
90
88
|
currency_code: existing?.currency_code,
|
|
91
89
|
})
|
|
92
90
|
} catch (e: any) {
|
|
93
|
-
console.error("[PayPal]
|
|
91
|
+
console.error("[PayPal] updatePayPalSessionData failed:", e?.message)
|
|
94
92
|
}
|
|
95
93
|
}
|
|
96
94
|
|
|
@@ -109,9 +107,8 @@ async function attachPayPalCaptureToSession(
|
|
|
109
107
|
|
|
110
108
|
const captureId = capture?.purchase_units?.[0]?.payments?.captures?.[0]?.id || capture?.id
|
|
111
109
|
|
|
112
|
-
await
|
|
110
|
+
await updatePayPalSessionData(
|
|
113
111
|
session.session_id,
|
|
114
|
-
"captured",
|
|
115
112
|
{
|
|
116
113
|
paypal: {
|
|
117
114
|
...((session.session_data || {}).paypal || {}),
|
|
@@ -142,9 +139,8 @@ async function attachPayPalAuthorizationToSession(
|
|
|
142
139
|
|
|
143
140
|
const authorizationId = authorization?.purchase_units?.[0]?.payments?.authorizations?.[0]?.id
|
|
144
141
|
|
|
145
|
-
await
|
|
142
|
+
await updatePayPalSessionData(
|
|
146
143
|
session.session_id,
|
|
147
|
-
"authorized",
|
|
148
144
|
{
|
|
149
145
|
paypal: {
|
|
150
146
|
...((session.session_data || {}).paypal || {}),
|