@easypayment/medusa-paypal 0.4.0 → 0.4.2
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 +24 -129
- package/.medusa/server/src/admin/index.mjs +24 -129
- package/.medusa/server/src/api/admin/paypal/environment/route.js +1 -1
- package/.medusa/server/src/api/admin/paypal/environment/route.js.map +1 -1
- package/.medusa/server/src/api/admin/paypal/onboarding-status/route.js +1 -1
- package/.medusa/server/src/api/admin/paypal/onboarding-status/route.js.map +1 -1
- package/.medusa/server/src/api/store/paypal/config/route.d.ts.map +1 -1
- package/.medusa/server/src/api/store/paypal/config/route.js +0 -4
- package/.medusa/server/src/api/store/paypal/config/route.js.map +1 -1
- package/.medusa/server/src/api/store/paypal/create-order/route.d.ts.map +1 -1
- package/.medusa/server/src/api/store/paypal/create-order/route.js +36 -11
- package/.medusa/server/src/api/store/paypal/create-order/route.js.map +1 -1
- package/.medusa/server/src/modules/paypal/migrations/20270101090000_set_paypal_environment_default_live.d.ts +6 -0
- package/.medusa/server/src/modules/paypal/migrations/20270101090000_set_paypal_environment_default_live.d.ts.map +1 -0
- package/.medusa/server/src/modules/paypal/migrations/20270101090000_set_paypal_environment_default_live.js +14 -0
- package/.medusa/server/src/modules/paypal/migrations/20270101090000_set_paypal_environment_default_live.js.map +1 -0
- package/.medusa/server/src/modules/paypal/service.d.ts +2 -4
- package/.medusa/server/src/modules/paypal/service.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/service.js +8 -46
- package/.medusa/server/src/modules/paypal/service.js.map +1 -1
- package/README.md +130 -102
- package/package.json +1 -1
- package/src/admin/routes/settings/paypal/additional-settings/page.tsx +0 -2
- package/src/admin/routes/settings/paypal/connection/page.tsx +11 -15
- package/src/admin/routes/settings/paypal/paypal-settings/page.tsx +3 -126
- package/src/api/admin/paypal/environment/route.ts +1 -1
- package/src/api/admin/paypal/onboarding-status/route.ts +1 -1
- package/src/api/store/paypal/config/route.ts +0 -4
- package/src/api/store/paypal/create-order/route.ts +43 -14
- package/src/modules/paypal/migrations/20270101090000_set_paypal_environment_default_live.ts +11 -0
- package/src/modules/paypal/service.ts +9 -51
|
@@ -77,8 +77,7 @@ const DEFAULT_FORM$1 = {
|
|
|
77
77
|
requireInstantPayment: false,
|
|
78
78
|
sendItemDetails: true,
|
|
79
79
|
invoicePrefix: "WC-",
|
|
80
|
-
creditCardStatementName: "PayPal"
|
|
81
|
-
logPath: "/uploads/wc-logs/"
|
|
80
|
+
creditCardStatementName: "PayPal"
|
|
82
81
|
};
|
|
83
82
|
function mergeWithDefaults$1(saved) {
|
|
84
83
|
if (!saved) return { ...DEFAULT_FORM$1 };
|
|
@@ -323,6 +322,9 @@ function AdvancedCardPaymentsTab() {
|
|
|
323
322
|
)
|
|
324
323
|
] }) });
|
|
325
324
|
}
|
|
325
|
+
function PayPalApplePayPage() {
|
|
326
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: "/settings/paypal/connection", replace: true });
|
|
327
|
+
}
|
|
326
328
|
function PayPalGooglePayPage() {
|
|
327
329
|
return /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: "/settings/paypal/connection", replace: true });
|
|
328
330
|
}
|
|
@@ -376,10 +378,10 @@ if (typeof window !== "undefined") {
|
|
|
376
378
|
}
|
|
377
379
|
}
|
|
378
380
|
function PayPalConnectionPage() {
|
|
379
|
-
const [env, setEnv] = react.useState("
|
|
381
|
+
const [env, setEnv] = react.useState("live");
|
|
380
382
|
react.useEffect(() => {
|
|
381
383
|
fetch("/admin/paypal/environment", { method: "GET" }).then((r) => r.json()).then((d) => {
|
|
382
|
-
const v = (d == null ? void 0 : d.environment) === "
|
|
384
|
+
const v = (d == null ? void 0 : d.environment) === "sandbox" ? "sandbox" : "live";
|
|
383
385
|
setEnv(v);
|
|
384
386
|
}).catch(() => {
|
|
385
387
|
});
|
|
@@ -390,7 +392,6 @@ function PayPalConnectionPage() {
|
|
|
390
392
|
const [showManual, setShowManual] = react.useState(false);
|
|
391
393
|
const [clientId, setClientId] = react.useState("");
|
|
392
394
|
const [secret, setSecret] = react.useState("");
|
|
393
|
-
const [merchantId, setMerchantId] = react.useState("");
|
|
394
395
|
const [statusInfo, setStatusInfo] = react.useState(null);
|
|
395
396
|
const [onboardingInProgress, setOnboardingInProgress] = react.useState(false);
|
|
396
397
|
const initLoaderRef = react.useRef(null);
|
|
@@ -707,7 +708,7 @@ function PayPalConnectionPage() {
|
|
|
707
708
|
]
|
|
708
709
|
}
|
|
709
710
|
) }),
|
|
710
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm font-medium pt-2", children: env === "sandbox" ? "Connect to PayPal Sandbox" : "Connect to PayPal
|
|
711
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm font-medium pt-2", children: env === "sandbox" ? "Connect to PayPal (Sandbox)" : "Connect to PayPal" }),
|
|
711
712
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "max-w-xl", children: connState === "connected" ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
712
713
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-sm text-green-600 bg-green-50 p-3 rounded border border-green-200", children: [
|
|
713
714
|
"✅ Successfully connected to PayPal!",
|
|
@@ -839,7 +840,7 @@ function PayPalConnectionPage() {
|
|
|
839
840
|
)
|
|
840
841
|
] }),
|
|
841
842
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
842
|
-
/* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-sm font-medium", children: "
|
|
843
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-sm font-medium", children: "Secret" }),
|
|
843
844
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
844
845
|
"input",
|
|
845
846
|
{
|
|
@@ -852,19 +853,13 @@ function PayPalConnectionPage() {
|
|
|
852
853
|
}
|
|
853
854
|
)
|
|
854
855
|
] }),
|
|
855
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "
|
|
856
|
-
/* @__PURE__ */ jsxRuntime.jsx("
|
|
857
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
onChange: (e) => setMerchantId(e.target.value),
|
|
863
|
-
disabled: onboardingInProgress,
|
|
864
|
-
className: "rounded-md border border-ui-border-base bg-transparent px-3 py-2 text-sm disabled:opacity-50",
|
|
865
|
-
placeholder: "Merchant ID"
|
|
866
|
-
}
|
|
867
|
-
)
|
|
856
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "md:col-span-2 text-sm text-ui-fg-subtle", children: [
|
|
857
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { children: "Here's how to get your client ID and client secret:" }),
|
|
858
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { children: "Select Log in to Dashboard and log in or sign up." }),
|
|
859
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { children: "Select Apps & Credentials." }),
|
|
860
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { children: "New accounts come with a Default Application in the REST API apps section. To create a new project, select Create App." }),
|
|
861
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { children: "Copy the Client ID and Client Secret for your app." }),
|
|
862
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { children: "Paste them into the fields on this page and click Save Changes." })
|
|
868
863
|
] }),
|
|
869
864
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "md:col-span-2 flex items-center gap-2 mt-2", children: [
|
|
870
865
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -910,9 +905,6 @@ function PayPalConnectionPage() {
|
|
|
910
905
|
` })
|
|
911
906
|
] });
|
|
912
907
|
}
|
|
913
|
-
function PayPalApplePayPage() {
|
|
914
|
-
return /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: "/settings/paypal/connection", replace: true });
|
|
915
|
-
}
|
|
916
908
|
function PayPalPayLaterMessagingPage() {
|
|
917
909
|
return /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: "/settings/paypal/connection", replace: true });
|
|
918
910
|
}
|
|
@@ -949,21 +941,6 @@ async function adminFetch(path, opts = {}) {
|
|
|
949
941
|
return {};
|
|
950
942
|
}
|
|
951
943
|
}
|
|
952
|
-
const DISABLE_BUTTON_OPTIONS = [
|
|
953
|
-
{ value: "paypal", label: "PayPal" },
|
|
954
|
-
{ value: "paylater", label: "Pay Later" },
|
|
955
|
-
{ value: "card", label: "Debit / Credit Card" },
|
|
956
|
-
{ value: "venmo", label: "Venmo" },
|
|
957
|
-
{ value: "applepay", label: "Apple Pay" },
|
|
958
|
-
{ value: "googlepay", label: "Google Pay" }
|
|
959
|
-
];
|
|
960
|
-
const HIDDEN_DISABLE_BUTTONS = /* @__PURE__ */ new Set(["applepay", "googlepay", "paylater"]);
|
|
961
|
-
const VISIBLE_DISABLE_BUTTON_OPTIONS = DISABLE_BUTTON_OPTIONS.filter(
|
|
962
|
-
(option) => !HIDDEN_DISABLE_BUTTONS.has(option.value)
|
|
963
|
-
);
|
|
964
|
-
function filterHiddenDisableButtons(list = []) {
|
|
965
|
-
return list.filter((value) => !HIDDEN_DISABLE_BUTTONS.has(value));
|
|
966
|
-
}
|
|
967
944
|
const COLOR_OPTIONS = [
|
|
968
945
|
{ value: "gold", label: "Gold (Recommended)" },
|
|
969
946
|
{ value: "blue", label: "Blue" },
|
|
@@ -983,42 +960,11 @@ const WIDTH_OPTIONS = [
|
|
|
983
960
|
];
|
|
984
961
|
const HEIGHT_OPTIONS = [32, 36, 40, 44, 48, 52, 56];
|
|
985
962
|
const LABEL_OPTIONS = [
|
|
986
|
-
{ value: "paypal", label: "PayPal
|
|
963
|
+
{ value: "paypal", label: "PayPal" },
|
|
987
964
|
{ value: "checkout", label: "Checkout" },
|
|
988
965
|
{ value: "buynow", label: "Buy Now" },
|
|
989
966
|
{ value: "pay", label: "Pay" }
|
|
990
967
|
];
|
|
991
|
-
function cx(...parts) {
|
|
992
|
-
return parts.filter(Boolean).join(" ");
|
|
993
|
-
}
|
|
994
|
-
function Pill({
|
|
995
|
-
children,
|
|
996
|
-
onRemove,
|
|
997
|
-
disabled
|
|
998
|
-
}) {
|
|
999
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1000
|
-
"span",
|
|
1001
|
-
{
|
|
1002
|
-
className: cx(
|
|
1003
|
-
"inline-flex items-center gap-1 rounded-md border px-2 py-1 text-sm",
|
|
1004
|
-
disabled ? "opacity-60" : "opacity-100"
|
|
1005
|
-
),
|
|
1006
|
-
children: [
|
|
1007
|
-
children,
|
|
1008
|
-
onRemove ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1009
|
-
"button",
|
|
1010
|
-
{
|
|
1011
|
-
type: "button",
|
|
1012
|
-
onClick: onRemove,
|
|
1013
|
-
className: "ml-1 rounded px-1 text-ui-fg-subtle hover:text-ui-fg-base",
|
|
1014
|
-
"aria-label": "Remove",
|
|
1015
|
-
children: "×"
|
|
1016
|
-
}
|
|
1017
|
-
) : null
|
|
1018
|
-
]
|
|
1019
|
-
}
|
|
1020
|
-
);
|
|
1021
|
-
}
|
|
1022
968
|
function SectionCard({
|
|
1023
969
|
title,
|
|
1024
970
|
description,
|
|
@@ -1054,7 +1000,6 @@ function PayPalSettingsTab() {
|
|
|
1054
1000
|
enabled: true,
|
|
1055
1001
|
title: "PayPal",
|
|
1056
1002
|
description: "Pay via PayPal; you can pay with your credit card if you don't have a PayPal account",
|
|
1057
|
-
disableButtons: [],
|
|
1058
1003
|
buttonColor: "gold",
|
|
1059
1004
|
buttonShape: "rect",
|
|
1060
1005
|
buttonWidth: "medium",
|
|
@@ -1079,8 +1024,7 @@ function PayPalSettingsTab() {
|
|
|
1079
1024
|
if (saved && typeof saved === "object") {
|
|
1080
1025
|
setForm((prev) => ({
|
|
1081
1026
|
...prev,
|
|
1082
|
-
...saved
|
|
1083
|
-
disableButtons: filterHiddenDisableButtons(saved.disableButtons)
|
|
1027
|
+
...saved
|
|
1084
1028
|
}));
|
|
1085
1029
|
}
|
|
1086
1030
|
} catch {
|
|
@@ -1092,10 +1036,7 @@ function PayPalSettingsTab() {
|
|
|
1092
1036
|
async function onSave() {
|
|
1093
1037
|
try {
|
|
1094
1038
|
setSaving(true);
|
|
1095
|
-
const cleaned = {
|
|
1096
|
-
...form,
|
|
1097
|
-
disableButtons: filterHiddenDisableButtons(form.disableButtons)
|
|
1098
|
-
};
|
|
1039
|
+
const cleaned = { ...form };
|
|
1099
1040
|
const json = await adminFetch(
|
|
1100
1041
|
"/admin/paypal/settings",
|
|
1101
1042
|
{
|
|
@@ -1108,8 +1049,7 @@ function PayPalSettingsTab() {
|
|
|
1108
1049
|
if (saved && typeof saved === "object") {
|
|
1109
1050
|
setForm((prev) => ({
|
|
1110
1051
|
...prev,
|
|
1111
|
-
...saved
|
|
1112
|
-
disableButtons: filterHiddenDisableButtons(saved.disableButtons)
|
|
1052
|
+
...saved
|
|
1113
1053
|
}));
|
|
1114
1054
|
}
|
|
1115
1055
|
setToast({ type: "success", message: "Settings saved" });
|
|
@@ -1124,20 +1064,6 @@ function PayPalSettingsTab() {
|
|
|
1124
1064
|
setSaving(false);
|
|
1125
1065
|
}
|
|
1126
1066
|
}
|
|
1127
|
-
function toggleMulti(key, value) {
|
|
1128
|
-
setForm((prev) => {
|
|
1129
|
-
const list = prev[key] || [];
|
|
1130
|
-
const exists = list.includes(value);
|
|
1131
|
-
const next = exists ? list.filter((v) => v !== value) : [...list, value];
|
|
1132
|
-
return { ...prev, [key]: next };
|
|
1133
|
-
});
|
|
1134
|
-
}
|
|
1135
|
-
function removeMulti(key, value) {
|
|
1136
|
-
setForm((prev) => {
|
|
1137
|
-
const list = prev[key] || [];
|
|
1138
|
-
return { ...prev, [key]: list.filter((v) => v !== value) };
|
|
1139
|
-
});
|
|
1140
|
-
}
|
|
1141
1067
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-6", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-6", children: [
|
|
1142
1068
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start justify-between gap-4", children: [
|
|
1143
1069
|
/* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-xl font-semibold text-ui-fg-base", children: "PayPal Gateway By Easy Payment" }) }),
|
|
@@ -1200,39 +1126,8 @@ function PayPalSettingsTab() {
|
|
|
1200
1126
|
SectionCard,
|
|
1201
1127
|
{
|
|
1202
1128
|
title: "Button Appearance",
|
|
1203
|
-
description: "Control PayPal Smart Button styling (color/shape/size/label)
|
|
1129
|
+
description: "Control PayPal Smart Button styling (color/shape/size/label).",
|
|
1204
1130
|
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "divide-y divide-ui-border-base", children: [
|
|
1205
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1206
|
-
FieldRow,
|
|
1207
|
-
{
|
|
1208
|
-
label: "Disable Specific Payment Buttons",
|
|
1209
|
-
hint: "Hide individual funding sources (ex: Card, Venmo).",
|
|
1210
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
1211
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap gap-2", children: [
|
|
1212
|
-
filterHiddenDisableButtons(form.disableButtons).map((v) => {
|
|
1213
|
-
const opt = VISIBLE_DISABLE_BUTTON_OPTIONS.find((o) => o.value === v);
|
|
1214
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Pill, { onRemove: () => removeMulti("disableButtons", v), children: (opt == null ? void 0 : opt.label) ?? v }, v);
|
|
1215
|
-
}),
|
|
1216
|
-
filterHiddenDisableButtons(form.disableButtons).length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-subtle", children: "No buttons disabled." }) : null
|
|
1217
|
-
] }),
|
|
1218
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-md border border-ui-border-base p-3", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid gap-2 md:grid-cols-2", children: VISIBLE_DISABLE_BUTTON_OPTIONS.map((o) => {
|
|
1219
|
-
const checked = form.disableButtons.includes(o.value);
|
|
1220
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "flex items-center gap-2 rounded-md p-2 hover:bg-ui-bg-subtle", children: [
|
|
1221
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1222
|
-
"input",
|
|
1223
|
-
{
|
|
1224
|
-
type: "checkbox",
|
|
1225
|
-
checked,
|
|
1226
|
-
onChange: () => toggleMulti("disableButtons", o.value),
|
|
1227
|
-
className: "h-4 w-4 rounded border-ui-border-base"
|
|
1228
|
-
}
|
|
1229
|
-
),
|
|
1230
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-base", children: o.label })
|
|
1231
|
-
] }, o.value);
|
|
1232
|
-
}) }) })
|
|
1233
|
-
] })
|
|
1234
|
-
}
|
|
1235
|
-
),
|
|
1236
1131
|
/* @__PURE__ */ jsxRuntime.jsx(FieldRow, { label: "Button Color", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1237
1132
|
"select",
|
|
1238
1133
|
{
|
|
@@ -1323,6 +1218,10 @@ const routeModule = {
|
|
|
1323
1218
|
Component: AdvancedCardPaymentsTab,
|
|
1324
1219
|
path: "/settings/paypal/advanced-card-payments"
|
|
1325
1220
|
},
|
|
1221
|
+
{
|
|
1222
|
+
Component: PayPalApplePayPage,
|
|
1223
|
+
path: "/settings/paypal/apple-pay"
|
|
1224
|
+
},
|
|
1326
1225
|
{
|
|
1327
1226
|
Component: PayPalGooglePayPage,
|
|
1328
1227
|
path: "/settings/paypal/google-pay"
|
|
@@ -1331,10 +1230,6 @@ const routeModule = {
|
|
|
1331
1230
|
Component: PayPalConnectionPage,
|
|
1332
1231
|
path: "/settings/paypal/connection"
|
|
1333
1232
|
},
|
|
1334
|
-
{
|
|
1335
|
-
Component: PayPalApplePayPage,
|
|
1336
|
-
path: "/settings/paypal/apple-pay"
|
|
1337
|
-
},
|
|
1338
1233
|
{
|
|
1339
1234
|
Component: PayPalPayLaterMessagingPage,
|
|
1340
1235
|
path: "/settings/paypal/pay-later-messaging"
|
|
@@ -76,8 +76,7 @@ const DEFAULT_FORM$1 = {
|
|
|
76
76
|
requireInstantPayment: false,
|
|
77
77
|
sendItemDetails: true,
|
|
78
78
|
invoicePrefix: "WC-",
|
|
79
|
-
creditCardStatementName: "PayPal"
|
|
80
|
-
logPath: "/uploads/wc-logs/"
|
|
79
|
+
creditCardStatementName: "PayPal"
|
|
81
80
|
};
|
|
82
81
|
function mergeWithDefaults$1(saved) {
|
|
83
82
|
if (!saved) return { ...DEFAULT_FORM$1 };
|
|
@@ -322,6 +321,9 @@ function AdvancedCardPaymentsTab() {
|
|
|
322
321
|
)
|
|
323
322
|
] }) });
|
|
324
323
|
}
|
|
324
|
+
function PayPalApplePayPage() {
|
|
325
|
+
return /* @__PURE__ */ jsx(Navigate, { to: "/settings/paypal/connection", replace: true });
|
|
326
|
+
}
|
|
325
327
|
function PayPalGooglePayPage() {
|
|
326
328
|
return /* @__PURE__ */ jsx(Navigate, { to: "/settings/paypal/connection", replace: true });
|
|
327
329
|
}
|
|
@@ -375,10 +377,10 @@ if (typeof window !== "undefined") {
|
|
|
375
377
|
}
|
|
376
378
|
}
|
|
377
379
|
function PayPalConnectionPage() {
|
|
378
|
-
const [env, setEnv] = useState("
|
|
380
|
+
const [env, setEnv] = useState("live");
|
|
379
381
|
useEffect(() => {
|
|
380
382
|
fetch("/admin/paypal/environment", { method: "GET" }).then((r) => r.json()).then((d) => {
|
|
381
|
-
const v = (d == null ? void 0 : d.environment) === "
|
|
383
|
+
const v = (d == null ? void 0 : d.environment) === "sandbox" ? "sandbox" : "live";
|
|
382
384
|
setEnv(v);
|
|
383
385
|
}).catch(() => {
|
|
384
386
|
});
|
|
@@ -389,7 +391,6 @@ function PayPalConnectionPage() {
|
|
|
389
391
|
const [showManual, setShowManual] = useState(false);
|
|
390
392
|
const [clientId, setClientId] = useState("");
|
|
391
393
|
const [secret, setSecret] = useState("");
|
|
392
|
-
const [merchantId, setMerchantId] = useState("");
|
|
393
394
|
const [statusInfo, setStatusInfo] = useState(null);
|
|
394
395
|
const [onboardingInProgress, setOnboardingInProgress] = useState(false);
|
|
395
396
|
const initLoaderRef = useRef(null);
|
|
@@ -706,7 +707,7 @@ function PayPalConnectionPage() {
|
|
|
706
707
|
]
|
|
707
708
|
}
|
|
708
709
|
) }),
|
|
709
|
-
/* @__PURE__ */ jsx("div", { className: "text-sm font-medium pt-2", children: env === "sandbox" ? "Connect to PayPal Sandbox" : "Connect to PayPal
|
|
710
|
+
/* @__PURE__ */ jsx("div", { className: "text-sm font-medium pt-2", children: env === "sandbox" ? "Connect to PayPal (Sandbox)" : "Connect to PayPal" }),
|
|
710
711
|
/* @__PURE__ */ jsx("div", { className: "max-w-xl", children: connState === "connected" ? /* @__PURE__ */ jsxs("div", { children: [
|
|
711
712
|
/* @__PURE__ */ jsxs("div", { className: "text-sm text-green-600 bg-green-50 p-3 rounded border border-green-200", children: [
|
|
712
713
|
"✅ Successfully connected to PayPal!",
|
|
@@ -838,7 +839,7 @@ function PayPalConnectionPage() {
|
|
|
838
839
|
)
|
|
839
840
|
] }),
|
|
840
841
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
841
|
-
/* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children: "
|
|
842
|
+
/* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children: "Secret" }),
|
|
842
843
|
/* @__PURE__ */ jsx(
|
|
843
844
|
"input",
|
|
844
845
|
{
|
|
@@ -851,19 +852,13 @@ function PayPalConnectionPage() {
|
|
|
851
852
|
}
|
|
852
853
|
)
|
|
853
854
|
] }),
|
|
854
|
-
/* @__PURE__ */ jsxs("div", { className: "
|
|
855
|
-
/* @__PURE__ */ jsx("
|
|
856
|
-
/* @__PURE__ */ jsx(
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
onChange: (e) => setMerchantId(e.target.value),
|
|
862
|
-
disabled: onboardingInProgress,
|
|
863
|
-
className: "rounded-md border border-ui-border-base bg-transparent px-3 py-2 text-sm disabled:opacity-50",
|
|
864
|
-
placeholder: "Merchant ID"
|
|
865
|
-
}
|
|
866
|
-
)
|
|
855
|
+
/* @__PURE__ */ jsxs("div", { className: "md:col-span-2 text-sm text-ui-fg-subtle", children: [
|
|
856
|
+
/* @__PURE__ */ jsx("p", { children: "Here's how to get your client ID and client secret:" }),
|
|
857
|
+
/* @__PURE__ */ jsx("p", { children: "Select Log in to Dashboard and log in or sign up." }),
|
|
858
|
+
/* @__PURE__ */ jsx("p", { children: "Select Apps & Credentials." }),
|
|
859
|
+
/* @__PURE__ */ jsx("p", { children: "New accounts come with a Default Application in the REST API apps section. To create a new project, select Create App." }),
|
|
860
|
+
/* @__PURE__ */ jsx("p", { children: "Copy the Client ID and Client Secret for your app." }),
|
|
861
|
+
/* @__PURE__ */ jsx("p", { children: "Paste them into the fields on this page and click Save Changes." })
|
|
867
862
|
] }),
|
|
868
863
|
/* @__PURE__ */ jsxs("div", { className: "md:col-span-2 flex items-center gap-2 mt-2", children: [
|
|
869
864
|
/* @__PURE__ */ jsx(
|
|
@@ -909,9 +904,6 @@ function PayPalConnectionPage() {
|
|
|
909
904
|
` })
|
|
910
905
|
] });
|
|
911
906
|
}
|
|
912
|
-
function PayPalApplePayPage() {
|
|
913
|
-
return /* @__PURE__ */ jsx(Navigate, { to: "/settings/paypal/connection", replace: true });
|
|
914
|
-
}
|
|
915
907
|
function PayPalPayLaterMessagingPage() {
|
|
916
908
|
return /* @__PURE__ */ jsx(Navigate, { to: "/settings/paypal/connection", replace: true });
|
|
917
909
|
}
|
|
@@ -948,21 +940,6 @@ async function adminFetch(path, opts = {}) {
|
|
|
948
940
|
return {};
|
|
949
941
|
}
|
|
950
942
|
}
|
|
951
|
-
const DISABLE_BUTTON_OPTIONS = [
|
|
952
|
-
{ value: "paypal", label: "PayPal" },
|
|
953
|
-
{ value: "paylater", label: "Pay Later" },
|
|
954
|
-
{ value: "card", label: "Debit / Credit Card" },
|
|
955
|
-
{ value: "venmo", label: "Venmo" },
|
|
956
|
-
{ value: "applepay", label: "Apple Pay" },
|
|
957
|
-
{ value: "googlepay", label: "Google Pay" }
|
|
958
|
-
];
|
|
959
|
-
const HIDDEN_DISABLE_BUTTONS = /* @__PURE__ */ new Set(["applepay", "googlepay", "paylater"]);
|
|
960
|
-
const VISIBLE_DISABLE_BUTTON_OPTIONS = DISABLE_BUTTON_OPTIONS.filter(
|
|
961
|
-
(option) => !HIDDEN_DISABLE_BUTTONS.has(option.value)
|
|
962
|
-
);
|
|
963
|
-
function filterHiddenDisableButtons(list = []) {
|
|
964
|
-
return list.filter((value) => !HIDDEN_DISABLE_BUTTONS.has(value));
|
|
965
|
-
}
|
|
966
943
|
const COLOR_OPTIONS = [
|
|
967
944
|
{ value: "gold", label: "Gold (Recommended)" },
|
|
968
945
|
{ value: "blue", label: "Blue" },
|
|
@@ -982,42 +959,11 @@ const WIDTH_OPTIONS = [
|
|
|
982
959
|
];
|
|
983
960
|
const HEIGHT_OPTIONS = [32, 36, 40, 44, 48, 52, 56];
|
|
984
961
|
const LABEL_OPTIONS = [
|
|
985
|
-
{ value: "paypal", label: "PayPal
|
|
962
|
+
{ value: "paypal", label: "PayPal" },
|
|
986
963
|
{ value: "checkout", label: "Checkout" },
|
|
987
964
|
{ value: "buynow", label: "Buy Now" },
|
|
988
965
|
{ value: "pay", label: "Pay" }
|
|
989
966
|
];
|
|
990
|
-
function cx(...parts) {
|
|
991
|
-
return parts.filter(Boolean).join(" ");
|
|
992
|
-
}
|
|
993
|
-
function Pill({
|
|
994
|
-
children,
|
|
995
|
-
onRemove,
|
|
996
|
-
disabled
|
|
997
|
-
}) {
|
|
998
|
-
return /* @__PURE__ */ jsxs(
|
|
999
|
-
"span",
|
|
1000
|
-
{
|
|
1001
|
-
className: cx(
|
|
1002
|
-
"inline-flex items-center gap-1 rounded-md border px-2 py-1 text-sm",
|
|
1003
|
-
disabled ? "opacity-60" : "opacity-100"
|
|
1004
|
-
),
|
|
1005
|
-
children: [
|
|
1006
|
-
children,
|
|
1007
|
-
onRemove ? /* @__PURE__ */ jsx(
|
|
1008
|
-
"button",
|
|
1009
|
-
{
|
|
1010
|
-
type: "button",
|
|
1011
|
-
onClick: onRemove,
|
|
1012
|
-
className: "ml-1 rounded px-1 text-ui-fg-subtle hover:text-ui-fg-base",
|
|
1013
|
-
"aria-label": "Remove",
|
|
1014
|
-
children: "×"
|
|
1015
|
-
}
|
|
1016
|
-
) : null
|
|
1017
|
-
]
|
|
1018
|
-
}
|
|
1019
|
-
);
|
|
1020
|
-
}
|
|
1021
967
|
function SectionCard({
|
|
1022
968
|
title,
|
|
1023
969
|
description,
|
|
@@ -1053,7 +999,6 @@ function PayPalSettingsTab() {
|
|
|
1053
999
|
enabled: true,
|
|
1054
1000
|
title: "PayPal",
|
|
1055
1001
|
description: "Pay via PayPal; you can pay with your credit card if you don't have a PayPal account",
|
|
1056
|
-
disableButtons: [],
|
|
1057
1002
|
buttonColor: "gold",
|
|
1058
1003
|
buttonShape: "rect",
|
|
1059
1004
|
buttonWidth: "medium",
|
|
@@ -1078,8 +1023,7 @@ function PayPalSettingsTab() {
|
|
|
1078
1023
|
if (saved && typeof saved === "object") {
|
|
1079
1024
|
setForm((prev) => ({
|
|
1080
1025
|
...prev,
|
|
1081
|
-
...saved
|
|
1082
|
-
disableButtons: filterHiddenDisableButtons(saved.disableButtons)
|
|
1026
|
+
...saved
|
|
1083
1027
|
}));
|
|
1084
1028
|
}
|
|
1085
1029
|
} catch {
|
|
@@ -1091,10 +1035,7 @@ function PayPalSettingsTab() {
|
|
|
1091
1035
|
async function onSave() {
|
|
1092
1036
|
try {
|
|
1093
1037
|
setSaving(true);
|
|
1094
|
-
const cleaned = {
|
|
1095
|
-
...form,
|
|
1096
|
-
disableButtons: filterHiddenDisableButtons(form.disableButtons)
|
|
1097
|
-
};
|
|
1038
|
+
const cleaned = { ...form };
|
|
1098
1039
|
const json = await adminFetch(
|
|
1099
1040
|
"/admin/paypal/settings",
|
|
1100
1041
|
{
|
|
@@ -1107,8 +1048,7 @@ function PayPalSettingsTab() {
|
|
|
1107
1048
|
if (saved && typeof saved === "object") {
|
|
1108
1049
|
setForm((prev) => ({
|
|
1109
1050
|
...prev,
|
|
1110
|
-
...saved
|
|
1111
|
-
disableButtons: filterHiddenDisableButtons(saved.disableButtons)
|
|
1051
|
+
...saved
|
|
1112
1052
|
}));
|
|
1113
1053
|
}
|
|
1114
1054
|
setToast({ type: "success", message: "Settings saved" });
|
|
@@ -1123,20 +1063,6 @@ function PayPalSettingsTab() {
|
|
|
1123
1063
|
setSaving(false);
|
|
1124
1064
|
}
|
|
1125
1065
|
}
|
|
1126
|
-
function toggleMulti(key, value) {
|
|
1127
|
-
setForm((prev) => {
|
|
1128
|
-
const list = prev[key] || [];
|
|
1129
|
-
const exists = list.includes(value);
|
|
1130
|
-
const next = exists ? list.filter((v) => v !== value) : [...list, value];
|
|
1131
|
-
return { ...prev, [key]: next };
|
|
1132
|
-
});
|
|
1133
|
-
}
|
|
1134
|
-
function removeMulti(key, value) {
|
|
1135
|
-
setForm((prev) => {
|
|
1136
|
-
const list = prev[key] || [];
|
|
1137
|
-
return { ...prev, [key]: list.filter((v) => v !== value) };
|
|
1138
|
-
});
|
|
1139
|
-
}
|
|
1140
1066
|
return /* @__PURE__ */ jsx("div", { className: "p-6", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-6", children: [
|
|
1141
1067
|
/* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-4", children: [
|
|
1142
1068
|
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("h1", { className: "text-xl font-semibold text-ui-fg-base", children: "PayPal Gateway By Easy Payment" }) }),
|
|
@@ -1199,39 +1125,8 @@ function PayPalSettingsTab() {
|
|
|
1199
1125
|
SectionCard,
|
|
1200
1126
|
{
|
|
1201
1127
|
title: "Button Appearance",
|
|
1202
|
-
description: "Control PayPal Smart Button styling (color/shape/size/label)
|
|
1128
|
+
description: "Control PayPal Smart Button styling (color/shape/size/label).",
|
|
1203
1129
|
children: /* @__PURE__ */ jsxs("div", { className: "divide-y divide-ui-border-base", children: [
|
|
1204
|
-
/* @__PURE__ */ jsx(
|
|
1205
|
-
FieldRow,
|
|
1206
|
-
{
|
|
1207
|
-
label: "Disable Specific Payment Buttons",
|
|
1208
|
-
hint: "Hide individual funding sources (ex: Card, Venmo).",
|
|
1209
|
-
children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
1210
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-2", children: [
|
|
1211
|
-
filterHiddenDisableButtons(form.disableButtons).map((v) => {
|
|
1212
|
-
const opt = VISIBLE_DISABLE_BUTTON_OPTIONS.find((o) => o.value === v);
|
|
1213
|
-
return /* @__PURE__ */ jsx(Pill, { onRemove: () => removeMulti("disableButtons", v), children: (opt == null ? void 0 : opt.label) ?? v }, v);
|
|
1214
|
-
}),
|
|
1215
|
-
filterHiddenDisableButtons(form.disableButtons).length === 0 ? /* @__PURE__ */ jsx("span", { className: "text-sm text-ui-fg-subtle", children: "No buttons disabled." }) : null
|
|
1216
|
-
] }),
|
|
1217
|
-
/* @__PURE__ */ jsx("div", { className: "rounded-md border border-ui-border-base p-3", children: /* @__PURE__ */ jsx("div", { className: "grid gap-2 md:grid-cols-2", children: VISIBLE_DISABLE_BUTTON_OPTIONS.map((o) => {
|
|
1218
|
-
const checked = form.disableButtons.includes(o.value);
|
|
1219
|
-
return /* @__PURE__ */ jsxs("label", { className: "flex items-center gap-2 rounded-md p-2 hover:bg-ui-bg-subtle", children: [
|
|
1220
|
-
/* @__PURE__ */ jsx(
|
|
1221
|
-
"input",
|
|
1222
|
-
{
|
|
1223
|
-
type: "checkbox",
|
|
1224
|
-
checked,
|
|
1225
|
-
onChange: () => toggleMulti("disableButtons", o.value),
|
|
1226
|
-
className: "h-4 w-4 rounded border-ui-border-base"
|
|
1227
|
-
}
|
|
1228
|
-
),
|
|
1229
|
-
/* @__PURE__ */ jsx("span", { className: "text-sm text-ui-fg-base", children: o.label })
|
|
1230
|
-
] }, o.value);
|
|
1231
|
-
}) }) })
|
|
1232
|
-
] })
|
|
1233
|
-
}
|
|
1234
|
-
),
|
|
1235
1130
|
/* @__PURE__ */ jsx(FieldRow, { label: "Button Color", children: /* @__PURE__ */ jsx(
|
|
1236
1131
|
"select",
|
|
1237
1132
|
{
|
|
@@ -1322,6 +1217,10 @@ const routeModule = {
|
|
|
1322
1217
|
Component: AdvancedCardPaymentsTab,
|
|
1323
1218
|
path: "/settings/paypal/advanced-card-payments"
|
|
1324
1219
|
},
|
|
1220
|
+
{
|
|
1221
|
+
Component: PayPalApplePayPage,
|
|
1222
|
+
path: "/settings/paypal/apple-pay"
|
|
1223
|
+
},
|
|
1325
1224
|
{
|
|
1326
1225
|
Component: PayPalGooglePayPage,
|
|
1327
1226
|
path: "/settings/paypal/google-pay"
|
|
@@ -1330,10 +1229,6 @@ const routeModule = {
|
|
|
1330
1229
|
Component: PayPalConnectionPage,
|
|
1331
1230
|
path: "/settings/paypal/connection"
|
|
1332
1231
|
},
|
|
1333
|
-
{
|
|
1334
|
-
Component: PayPalApplePayPage,
|
|
1335
|
-
path: "/settings/paypal/apple-pay"
|
|
1336
|
-
},
|
|
1337
1232
|
{
|
|
1338
1233
|
Component: PayPalPayLaterMessagingPage,
|
|
1339
1234
|
path: "/settings/paypal/pay-later-messaging"
|
|
@@ -11,7 +11,7 @@ async function POST(req, res) {
|
|
|
11
11
|
try {
|
|
12
12
|
const paypal = req.scope.resolve("paypal_onboarding");
|
|
13
13
|
const body = (req.body || {});
|
|
14
|
-
const env = body.environment === "
|
|
14
|
+
const env = body.environment === "sandbox" ? "sandbox" : "live";
|
|
15
15
|
await paypal.setEnvironment(env);
|
|
16
16
|
const status = await paypal.getStatus();
|
|
17
17
|
return res.json(status);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.js","sourceRoot":"","sources":["../../../../../../../src/api/admin/paypal/environment/route.ts"],"names":[],"mappings":";;AAOA,kBAIC;AAED,oBAWC;AAjBM,KAAK,UAAU,GAAG,CAAC,GAAkB,EAAE,GAAmB;IAC/D,MAAM,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,OAAO,CAAsB,mBAAmB,CAAC,CAAA;IAC1E,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,SAAS,EAAE,CAAA;IACvC,OAAO,GAAG,CAAC,IAAI,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,WAAW,EAAE,CAAC,CAAA;AACtD,CAAC;AAEM,KAAK,UAAU,IAAI,CAAC,GAAkB,EAAE,GAAmB;IAChE,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,OAAO,CAAsB,mBAAmB,CAAC,CAAA;QAC1E,MAAM,IAAI,GAAG,CAAC,GAAG,CAAC,IAAI,IAAI,EAAE,CAAS,CAAA;QACrC,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,KAAK,
|
|
1
|
+
{"version":3,"file":"route.js","sourceRoot":"","sources":["../../../../../../../src/api/admin/paypal/environment/route.ts"],"names":[],"mappings":";;AAOA,kBAIC;AAED,oBAWC;AAjBM,KAAK,UAAU,GAAG,CAAC,GAAkB,EAAE,GAAmB;IAC/D,MAAM,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,OAAO,CAAsB,mBAAmB,CAAC,CAAA;IAC1E,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,SAAS,EAAE,CAAA;IACvC,OAAO,GAAG,CAAC,IAAI,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,WAAW,EAAE,CAAC,CAAA;AACtD,CAAC;AAEM,KAAK,UAAU,IAAI,CAAC,GAAkB,EAAE,GAAmB;IAChE,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,OAAO,CAAsB,mBAAmB,CAAC,CAAA;QAC1E,MAAM,IAAI,GAAG,CAAC,GAAG,CAAC,IAAI,IAAI,EAAE,CAAS,CAAA;QACrC,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAA;QAC/D,MAAM,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,CAAA;QAChC,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,SAAS,EAAE,CAAA;QACvC,OAAO,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACzB,CAAC;IAAC,OAAO,CAAM,EAAE,CAAC;QAChB,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,IAAI,eAAe,EAAE,CAAC,CAAA;IACzE,CAAC;AACH,CAAC"}
|
|
@@ -11,7 +11,7 @@ async function GET(req, res) {
|
|
|
11
11
|
// ✅ Avoid breaking Admin UI with Medusa's generic "unknown_error"
|
|
12
12
|
console.error("[paypal_onboarding] onboarding-status error:", e?.message || e, e?.stack);
|
|
13
13
|
return res.json({
|
|
14
|
-
environment: "
|
|
14
|
+
environment: "live",
|
|
15
15
|
status: "disconnected",
|
|
16
16
|
error: e?.message || "Unknown error",
|
|
17
17
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.js","sourceRoot":"","sources":["../../../../../../../src/api/admin/paypal/onboarding-status/route.ts"],"names":[],"mappings":";;AAGA,kBAcC;AAdM,KAAK,UAAU,GAAG,CAAC,GAAkB,EAAE,GAAmB;IAC/D,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,OAAO,CAAsB,mBAAmB,CAAC,CAAA;QAC1E,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,SAAS,EAAE,CAAA;QACvC,OAAO,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACzB,CAAC;IAAC,OAAO,CAAM,EAAE,CAAC;QAChB,kEAAkE;QAClE,OAAO,CAAC,KAAK,CAAC,8CAA8C,EAAE,CAAC,EAAE,OAAO,IAAI,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAA;QACxF,OAAO,GAAG,CAAC,IAAI,CAAC;YACd,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"route.js","sourceRoot":"","sources":["../../../../../../../src/api/admin/paypal/onboarding-status/route.ts"],"names":[],"mappings":";;AAGA,kBAcC;AAdM,KAAK,UAAU,GAAG,CAAC,GAAkB,EAAE,GAAmB;IAC/D,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,OAAO,CAAsB,mBAAmB,CAAC,CAAA;QAC1E,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,SAAS,EAAE,CAAA;QACvC,OAAO,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACzB,CAAC;IAAC,OAAO,CAAM,EAAE,CAAC;QAChB,kEAAkE;QAClE,OAAO,CAAC,KAAK,CAAC,8CAA8C,EAAE,CAAC,EAAE,OAAO,IAAI,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAA;QACxF,OAAO,GAAG,CAAC,IAAI,CAAC;YACd,WAAW,EAAE,MAAM;YACnB,MAAM,EAAE,cAAc;YACtB,KAAK,EAAE,CAAC,EAAE,OAAO,IAAI,eAAe;SACrC,CAAC,CAAA;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../../../src/api/store/paypal/config/route.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAQ7E,wBAAsB,GAAG,CAAC,GAAG,EAAE,aAAa,EAAE,GAAG,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../../../src/api/store/paypal/config/route.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAQ7E,wBAAsB,GAAG,CAAC,GAAG,EAAE,aAAa,EAAE,GAAG,EAAE,cAAc,2BA8FhE"}
|
|
@@ -44,9 +44,6 @@ async function GET(req, res) {
|
|
|
44
44
|
if (paypalSettings.enabled === false) {
|
|
45
45
|
return res.status(403).json({ message: "PayPal is currently disabled." });
|
|
46
46
|
}
|
|
47
|
-
const disableButtons = Array.isArray(paypalSettings.disableButtons)
|
|
48
|
-
? paypalSettings.disableButtons.filter((value) => typeof value === "string")
|
|
49
|
-
: [];
|
|
50
47
|
// P2 — read advanced card payments settings
|
|
51
48
|
const advancedCardSettings = data && typeof data === "object"
|
|
52
49
|
? (data.advanced_card_payments || {})
|
|
@@ -74,7 +71,6 @@ async function GET(req, res) {
|
|
|
74
71
|
button_width: paypalSettings.buttonWidth || "responsive",
|
|
75
72
|
button_height: paypalSettings.buttonHeight ?? 45,
|
|
76
73
|
button_label: paypalSettings.buttonLabel || "paypal",
|
|
77
|
-
disable_buttons: disableButtons,
|
|
78
74
|
});
|
|
79
75
|
}
|
|
80
76
|
catch (e) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.js","sourceRoot":"","sources":["../../../../../../../src/api/store/paypal/config/route.ts"],"names":[],"mappings":";;AAQA,
|
|
1
|
+
{"version":3,"file":"route.js","sourceRoot":"","sources":["../../../../../../../src/api/store/paypal/config/route.ts"],"names":[],"mappings":";;AAQA,kBA8FC;AApGD,4EAIoD;AAE7C,KAAK,UAAU,GAAG,CAA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C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../../../src/api/store/paypal/create-order/route.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAuG7E,wBAAsB,IAAI,CAAC,GAAG,EAAE,aAAa,EAAE,GAAG,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../../../src/api/store/paypal/create-order/route.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAuG7E,wBAAsB,IAAI,CAAC,GAAG,EAAE,aAAa,EAAE,GAAG,EAAE,cAAc,2BA4SjE"}
|