@easypayment/medusa-paypal 0.4.1 → 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 +27 -132
- package/.medusa/server/src/admin/index.mjs +27 -132
- 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 +32 -6
- 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 +34 -7
- 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 };
|
|
@@ -326,6 +325,9 @@ function AdvancedCardPaymentsTab() {
|
|
|
326
325
|
function PayPalApplePayPage() {
|
|
327
326
|
return /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: "/settings/paypal/connection", replace: true });
|
|
328
327
|
}
|
|
328
|
+
function PayPalGooglePayPage() {
|
|
329
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: "/settings/paypal/connection", replace: true });
|
|
330
|
+
}
|
|
329
331
|
const config = adminSdk.defineRouteConfig({
|
|
330
332
|
label: "PayPal Connection",
|
|
331
333
|
hide: true
|
|
@@ -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,7 +905,7 @@ function PayPalConnectionPage() {
|
|
|
910
905
|
` })
|
|
911
906
|
] });
|
|
912
907
|
}
|
|
913
|
-
function
|
|
908
|
+
function PayPalPayLaterMessagingPage() {
|
|
914
909
|
return /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: "/settings/paypal/connection", replace: true });
|
|
915
910
|
}
|
|
916
911
|
async function adminFetch(path, opts = {}) {
|
|
@@ -946,21 +941,6 @@ async function adminFetch(path, opts = {}) {
|
|
|
946
941
|
return {};
|
|
947
942
|
}
|
|
948
943
|
}
|
|
949
|
-
const DISABLE_BUTTON_OPTIONS = [
|
|
950
|
-
{ value: "paypal", label: "PayPal" },
|
|
951
|
-
{ value: "paylater", label: "Pay Later" },
|
|
952
|
-
{ value: "card", label: "Debit / Credit Card" },
|
|
953
|
-
{ value: "venmo", label: "Venmo" },
|
|
954
|
-
{ value: "applepay", label: "Apple Pay" },
|
|
955
|
-
{ value: "googlepay", label: "Google Pay" }
|
|
956
|
-
];
|
|
957
|
-
const HIDDEN_DISABLE_BUTTONS = /* @__PURE__ */ new Set(["applepay", "googlepay", "paylater"]);
|
|
958
|
-
const VISIBLE_DISABLE_BUTTON_OPTIONS = DISABLE_BUTTON_OPTIONS.filter(
|
|
959
|
-
(option) => !HIDDEN_DISABLE_BUTTONS.has(option.value)
|
|
960
|
-
);
|
|
961
|
-
function filterHiddenDisableButtons(list = []) {
|
|
962
|
-
return list.filter((value) => !HIDDEN_DISABLE_BUTTONS.has(value));
|
|
963
|
-
}
|
|
964
944
|
const COLOR_OPTIONS = [
|
|
965
945
|
{ value: "gold", label: "Gold (Recommended)" },
|
|
966
946
|
{ value: "blue", label: "Blue" },
|
|
@@ -980,42 +960,11 @@ const WIDTH_OPTIONS = [
|
|
|
980
960
|
];
|
|
981
961
|
const HEIGHT_OPTIONS = [32, 36, 40, 44, 48, 52, 56];
|
|
982
962
|
const LABEL_OPTIONS = [
|
|
983
|
-
{ value: "paypal", label: "PayPal
|
|
963
|
+
{ value: "paypal", label: "PayPal" },
|
|
984
964
|
{ value: "checkout", label: "Checkout" },
|
|
985
965
|
{ value: "buynow", label: "Buy Now" },
|
|
986
966
|
{ value: "pay", label: "Pay" }
|
|
987
967
|
];
|
|
988
|
-
function cx(...parts) {
|
|
989
|
-
return parts.filter(Boolean).join(" ");
|
|
990
|
-
}
|
|
991
|
-
function Pill({
|
|
992
|
-
children,
|
|
993
|
-
onRemove,
|
|
994
|
-
disabled
|
|
995
|
-
}) {
|
|
996
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
997
|
-
"span",
|
|
998
|
-
{
|
|
999
|
-
className: cx(
|
|
1000
|
-
"inline-flex items-center gap-1 rounded-md border px-2 py-1 text-sm",
|
|
1001
|
-
disabled ? "opacity-60" : "opacity-100"
|
|
1002
|
-
),
|
|
1003
|
-
children: [
|
|
1004
|
-
children,
|
|
1005
|
-
onRemove ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1006
|
-
"button",
|
|
1007
|
-
{
|
|
1008
|
-
type: "button",
|
|
1009
|
-
onClick: onRemove,
|
|
1010
|
-
className: "ml-1 rounded px-1 text-ui-fg-subtle hover:text-ui-fg-base",
|
|
1011
|
-
"aria-label": "Remove",
|
|
1012
|
-
children: "×"
|
|
1013
|
-
}
|
|
1014
|
-
) : null
|
|
1015
|
-
]
|
|
1016
|
-
}
|
|
1017
|
-
);
|
|
1018
|
-
}
|
|
1019
968
|
function SectionCard({
|
|
1020
969
|
title,
|
|
1021
970
|
description,
|
|
@@ -1051,7 +1000,6 @@ function PayPalSettingsTab() {
|
|
|
1051
1000
|
enabled: true,
|
|
1052
1001
|
title: "PayPal",
|
|
1053
1002
|
description: "Pay via PayPal; you can pay with your credit card if you don't have a PayPal account",
|
|
1054
|
-
disableButtons: [],
|
|
1055
1003
|
buttonColor: "gold",
|
|
1056
1004
|
buttonShape: "rect",
|
|
1057
1005
|
buttonWidth: "medium",
|
|
@@ -1076,8 +1024,7 @@ function PayPalSettingsTab() {
|
|
|
1076
1024
|
if (saved && typeof saved === "object") {
|
|
1077
1025
|
setForm((prev) => ({
|
|
1078
1026
|
...prev,
|
|
1079
|
-
...saved
|
|
1080
|
-
disableButtons: filterHiddenDisableButtons(saved.disableButtons)
|
|
1027
|
+
...saved
|
|
1081
1028
|
}));
|
|
1082
1029
|
}
|
|
1083
1030
|
} catch {
|
|
@@ -1089,10 +1036,7 @@ function PayPalSettingsTab() {
|
|
|
1089
1036
|
async function onSave() {
|
|
1090
1037
|
try {
|
|
1091
1038
|
setSaving(true);
|
|
1092
|
-
const cleaned = {
|
|
1093
|
-
...form,
|
|
1094
|
-
disableButtons: filterHiddenDisableButtons(form.disableButtons)
|
|
1095
|
-
};
|
|
1039
|
+
const cleaned = { ...form };
|
|
1096
1040
|
const json = await adminFetch(
|
|
1097
1041
|
"/admin/paypal/settings",
|
|
1098
1042
|
{
|
|
@@ -1105,8 +1049,7 @@ function PayPalSettingsTab() {
|
|
|
1105
1049
|
if (saved && typeof saved === "object") {
|
|
1106
1050
|
setForm((prev) => ({
|
|
1107
1051
|
...prev,
|
|
1108
|
-
...saved
|
|
1109
|
-
disableButtons: filterHiddenDisableButtons(saved.disableButtons)
|
|
1052
|
+
...saved
|
|
1110
1053
|
}));
|
|
1111
1054
|
}
|
|
1112
1055
|
setToast({ type: "success", message: "Settings saved" });
|
|
@@ -1121,20 +1064,6 @@ function PayPalSettingsTab() {
|
|
|
1121
1064
|
setSaving(false);
|
|
1122
1065
|
}
|
|
1123
1066
|
}
|
|
1124
|
-
function toggleMulti(key, value) {
|
|
1125
|
-
setForm((prev) => {
|
|
1126
|
-
const list = prev[key] || [];
|
|
1127
|
-
const exists = list.includes(value);
|
|
1128
|
-
const next = exists ? list.filter((v) => v !== value) : [...list, value];
|
|
1129
|
-
return { ...prev, [key]: next };
|
|
1130
|
-
});
|
|
1131
|
-
}
|
|
1132
|
-
function removeMulti(key, value) {
|
|
1133
|
-
setForm((prev) => {
|
|
1134
|
-
const list = prev[key] || [];
|
|
1135
|
-
return { ...prev, [key]: list.filter((v) => v !== value) };
|
|
1136
|
-
});
|
|
1137
|
-
}
|
|
1138
1067
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-6", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-6", children: [
|
|
1139
1068
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start justify-between gap-4", children: [
|
|
1140
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" }) }),
|
|
@@ -1197,39 +1126,8 @@ function PayPalSettingsTab() {
|
|
|
1197
1126
|
SectionCard,
|
|
1198
1127
|
{
|
|
1199
1128
|
title: "Button Appearance",
|
|
1200
|
-
description: "Control PayPal Smart Button styling (color/shape/size/label)
|
|
1129
|
+
description: "Control PayPal Smart Button styling (color/shape/size/label).",
|
|
1201
1130
|
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "divide-y divide-ui-border-base", children: [
|
|
1202
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1203
|
-
FieldRow,
|
|
1204
|
-
{
|
|
1205
|
-
label: "Disable Specific Payment Buttons",
|
|
1206
|
-
hint: "Hide individual funding sources (ex: Card, Venmo).",
|
|
1207
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
1208
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap gap-2", children: [
|
|
1209
|
-
filterHiddenDisableButtons(form.disableButtons).map((v) => {
|
|
1210
|
-
const opt = VISIBLE_DISABLE_BUTTON_OPTIONS.find((o) => o.value === v);
|
|
1211
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Pill, { onRemove: () => removeMulti("disableButtons", v), children: (opt == null ? void 0 : opt.label) ?? v }, v);
|
|
1212
|
-
}),
|
|
1213
|
-
filterHiddenDisableButtons(form.disableButtons).length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-subtle", children: "No buttons disabled." }) : null
|
|
1214
|
-
] }),
|
|
1215
|
-
/* @__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) => {
|
|
1216
|
-
const checked = form.disableButtons.includes(o.value);
|
|
1217
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "flex items-center gap-2 rounded-md p-2 hover:bg-ui-bg-subtle", children: [
|
|
1218
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1219
|
-
"input",
|
|
1220
|
-
{
|
|
1221
|
-
type: "checkbox",
|
|
1222
|
-
checked,
|
|
1223
|
-
onChange: () => toggleMulti("disableButtons", o.value),
|
|
1224
|
-
className: "h-4 w-4 rounded border-ui-border-base"
|
|
1225
|
-
}
|
|
1226
|
-
),
|
|
1227
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-ui-fg-base", children: o.label })
|
|
1228
|
-
] }, o.value);
|
|
1229
|
-
}) }) })
|
|
1230
|
-
] })
|
|
1231
|
-
}
|
|
1232
|
-
),
|
|
1233
1131
|
/* @__PURE__ */ jsxRuntime.jsx(FieldRow, { label: "Button Color", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1234
1132
|
"select",
|
|
1235
1133
|
{
|
|
@@ -1305,9 +1203,6 @@ function PayPalSettingsTab() {
|
|
|
1305
1203
|
] })
|
|
1306
1204
|
] }) });
|
|
1307
1205
|
}
|
|
1308
|
-
function PayPalPayLaterMessagingPage() {
|
|
1309
|
-
return /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: "/settings/paypal/connection", replace: true });
|
|
1310
|
-
}
|
|
1311
1206
|
const widgetModule = { widgets: [] };
|
|
1312
1207
|
const routeModule = {
|
|
1313
1208
|
routes: [
|
|
@@ -1327,21 +1222,21 @@ const routeModule = {
|
|
|
1327
1222
|
Component: PayPalApplePayPage,
|
|
1328
1223
|
path: "/settings/paypal/apple-pay"
|
|
1329
1224
|
},
|
|
1330
|
-
{
|
|
1331
|
-
Component: PayPalConnectionPage,
|
|
1332
|
-
path: "/settings/paypal/connection"
|
|
1333
|
-
},
|
|
1334
1225
|
{
|
|
1335
1226
|
Component: PayPalGooglePayPage,
|
|
1336
1227
|
path: "/settings/paypal/google-pay"
|
|
1337
1228
|
},
|
|
1338
1229
|
{
|
|
1339
|
-
Component:
|
|
1340
|
-
path: "/settings/paypal/
|
|
1230
|
+
Component: PayPalConnectionPage,
|
|
1231
|
+
path: "/settings/paypal/connection"
|
|
1341
1232
|
},
|
|
1342
1233
|
{
|
|
1343
1234
|
Component: PayPalPayLaterMessagingPage,
|
|
1344
1235
|
path: "/settings/paypal/pay-later-messaging"
|
|
1236
|
+
},
|
|
1237
|
+
{
|
|
1238
|
+
Component: PayPalSettingsTab,
|
|
1239
|
+
path: "/settings/paypal/paypal-settings"
|
|
1345
1240
|
}
|
|
1346
1241
|
]
|
|
1347
1242
|
};
|
|
@@ -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 };
|
|
@@ -325,6 +324,9 @@ function AdvancedCardPaymentsTab() {
|
|
|
325
324
|
function PayPalApplePayPage() {
|
|
326
325
|
return /* @__PURE__ */ jsx(Navigate, { to: "/settings/paypal/connection", replace: true });
|
|
327
326
|
}
|
|
327
|
+
function PayPalGooglePayPage() {
|
|
328
|
+
return /* @__PURE__ */ jsx(Navigate, { to: "/settings/paypal/connection", replace: true });
|
|
329
|
+
}
|
|
328
330
|
const config = defineRouteConfig({
|
|
329
331
|
label: "PayPal Connection",
|
|
330
332
|
hide: true
|
|
@@ -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,7 +904,7 @@ function PayPalConnectionPage() {
|
|
|
909
904
|
` })
|
|
910
905
|
] });
|
|
911
906
|
}
|
|
912
|
-
function
|
|
907
|
+
function PayPalPayLaterMessagingPage() {
|
|
913
908
|
return /* @__PURE__ */ jsx(Navigate, { to: "/settings/paypal/connection", replace: true });
|
|
914
909
|
}
|
|
915
910
|
async function adminFetch(path, opts = {}) {
|
|
@@ -945,21 +940,6 @@ async function adminFetch(path, opts = {}) {
|
|
|
945
940
|
return {};
|
|
946
941
|
}
|
|
947
942
|
}
|
|
948
|
-
const DISABLE_BUTTON_OPTIONS = [
|
|
949
|
-
{ value: "paypal", label: "PayPal" },
|
|
950
|
-
{ value: "paylater", label: "Pay Later" },
|
|
951
|
-
{ value: "card", label: "Debit / Credit Card" },
|
|
952
|
-
{ value: "venmo", label: "Venmo" },
|
|
953
|
-
{ value: "applepay", label: "Apple Pay" },
|
|
954
|
-
{ value: "googlepay", label: "Google Pay" }
|
|
955
|
-
];
|
|
956
|
-
const HIDDEN_DISABLE_BUTTONS = /* @__PURE__ */ new Set(["applepay", "googlepay", "paylater"]);
|
|
957
|
-
const VISIBLE_DISABLE_BUTTON_OPTIONS = DISABLE_BUTTON_OPTIONS.filter(
|
|
958
|
-
(option) => !HIDDEN_DISABLE_BUTTONS.has(option.value)
|
|
959
|
-
);
|
|
960
|
-
function filterHiddenDisableButtons(list = []) {
|
|
961
|
-
return list.filter((value) => !HIDDEN_DISABLE_BUTTONS.has(value));
|
|
962
|
-
}
|
|
963
943
|
const COLOR_OPTIONS = [
|
|
964
944
|
{ value: "gold", label: "Gold (Recommended)" },
|
|
965
945
|
{ value: "blue", label: "Blue" },
|
|
@@ -979,42 +959,11 @@ const WIDTH_OPTIONS = [
|
|
|
979
959
|
];
|
|
980
960
|
const HEIGHT_OPTIONS = [32, 36, 40, 44, 48, 52, 56];
|
|
981
961
|
const LABEL_OPTIONS = [
|
|
982
|
-
{ value: "paypal", label: "PayPal
|
|
962
|
+
{ value: "paypal", label: "PayPal" },
|
|
983
963
|
{ value: "checkout", label: "Checkout" },
|
|
984
964
|
{ value: "buynow", label: "Buy Now" },
|
|
985
965
|
{ value: "pay", label: "Pay" }
|
|
986
966
|
];
|
|
987
|
-
function cx(...parts) {
|
|
988
|
-
return parts.filter(Boolean).join(" ");
|
|
989
|
-
}
|
|
990
|
-
function Pill({
|
|
991
|
-
children,
|
|
992
|
-
onRemove,
|
|
993
|
-
disabled
|
|
994
|
-
}) {
|
|
995
|
-
return /* @__PURE__ */ jsxs(
|
|
996
|
-
"span",
|
|
997
|
-
{
|
|
998
|
-
className: cx(
|
|
999
|
-
"inline-flex items-center gap-1 rounded-md border px-2 py-1 text-sm",
|
|
1000
|
-
disabled ? "opacity-60" : "opacity-100"
|
|
1001
|
-
),
|
|
1002
|
-
children: [
|
|
1003
|
-
children,
|
|
1004
|
-
onRemove ? /* @__PURE__ */ jsx(
|
|
1005
|
-
"button",
|
|
1006
|
-
{
|
|
1007
|
-
type: "button",
|
|
1008
|
-
onClick: onRemove,
|
|
1009
|
-
className: "ml-1 rounded px-1 text-ui-fg-subtle hover:text-ui-fg-base",
|
|
1010
|
-
"aria-label": "Remove",
|
|
1011
|
-
children: "×"
|
|
1012
|
-
}
|
|
1013
|
-
) : null
|
|
1014
|
-
]
|
|
1015
|
-
}
|
|
1016
|
-
);
|
|
1017
|
-
}
|
|
1018
967
|
function SectionCard({
|
|
1019
968
|
title,
|
|
1020
969
|
description,
|
|
@@ -1050,7 +999,6 @@ function PayPalSettingsTab() {
|
|
|
1050
999
|
enabled: true,
|
|
1051
1000
|
title: "PayPal",
|
|
1052
1001
|
description: "Pay via PayPal; you can pay with your credit card if you don't have a PayPal account",
|
|
1053
|
-
disableButtons: [],
|
|
1054
1002
|
buttonColor: "gold",
|
|
1055
1003
|
buttonShape: "rect",
|
|
1056
1004
|
buttonWidth: "medium",
|
|
@@ -1075,8 +1023,7 @@ function PayPalSettingsTab() {
|
|
|
1075
1023
|
if (saved && typeof saved === "object") {
|
|
1076
1024
|
setForm((prev) => ({
|
|
1077
1025
|
...prev,
|
|
1078
|
-
...saved
|
|
1079
|
-
disableButtons: filterHiddenDisableButtons(saved.disableButtons)
|
|
1026
|
+
...saved
|
|
1080
1027
|
}));
|
|
1081
1028
|
}
|
|
1082
1029
|
} catch {
|
|
@@ -1088,10 +1035,7 @@ function PayPalSettingsTab() {
|
|
|
1088
1035
|
async function onSave() {
|
|
1089
1036
|
try {
|
|
1090
1037
|
setSaving(true);
|
|
1091
|
-
const cleaned = {
|
|
1092
|
-
...form,
|
|
1093
|
-
disableButtons: filterHiddenDisableButtons(form.disableButtons)
|
|
1094
|
-
};
|
|
1038
|
+
const cleaned = { ...form };
|
|
1095
1039
|
const json = await adminFetch(
|
|
1096
1040
|
"/admin/paypal/settings",
|
|
1097
1041
|
{
|
|
@@ -1104,8 +1048,7 @@ function PayPalSettingsTab() {
|
|
|
1104
1048
|
if (saved && typeof saved === "object") {
|
|
1105
1049
|
setForm((prev) => ({
|
|
1106
1050
|
...prev,
|
|
1107
|
-
...saved
|
|
1108
|
-
disableButtons: filterHiddenDisableButtons(saved.disableButtons)
|
|
1051
|
+
...saved
|
|
1109
1052
|
}));
|
|
1110
1053
|
}
|
|
1111
1054
|
setToast({ type: "success", message: "Settings saved" });
|
|
@@ -1120,20 +1063,6 @@ function PayPalSettingsTab() {
|
|
|
1120
1063
|
setSaving(false);
|
|
1121
1064
|
}
|
|
1122
1065
|
}
|
|
1123
|
-
function toggleMulti(key, value) {
|
|
1124
|
-
setForm((prev) => {
|
|
1125
|
-
const list = prev[key] || [];
|
|
1126
|
-
const exists = list.includes(value);
|
|
1127
|
-
const next = exists ? list.filter((v) => v !== value) : [...list, value];
|
|
1128
|
-
return { ...prev, [key]: next };
|
|
1129
|
-
});
|
|
1130
|
-
}
|
|
1131
|
-
function removeMulti(key, value) {
|
|
1132
|
-
setForm((prev) => {
|
|
1133
|
-
const list = prev[key] || [];
|
|
1134
|
-
return { ...prev, [key]: list.filter((v) => v !== value) };
|
|
1135
|
-
});
|
|
1136
|
-
}
|
|
1137
1066
|
return /* @__PURE__ */ jsx("div", { className: "p-6", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-6", children: [
|
|
1138
1067
|
/* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-4", children: [
|
|
1139
1068
|
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("h1", { className: "text-xl font-semibold text-ui-fg-base", children: "PayPal Gateway By Easy Payment" }) }),
|
|
@@ -1196,39 +1125,8 @@ function PayPalSettingsTab() {
|
|
|
1196
1125
|
SectionCard,
|
|
1197
1126
|
{
|
|
1198
1127
|
title: "Button Appearance",
|
|
1199
|
-
description: "Control PayPal Smart Button styling (color/shape/size/label)
|
|
1128
|
+
description: "Control PayPal Smart Button styling (color/shape/size/label).",
|
|
1200
1129
|
children: /* @__PURE__ */ jsxs("div", { className: "divide-y divide-ui-border-base", children: [
|
|
1201
|
-
/* @__PURE__ */ jsx(
|
|
1202
|
-
FieldRow,
|
|
1203
|
-
{
|
|
1204
|
-
label: "Disable Specific Payment Buttons",
|
|
1205
|
-
hint: "Hide individual funding sources (ex: Card, Venmo).",
|
|
1206
|
-
children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
1207
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-2", children: [
|
|
1208
|
-
filterHiddenDisableButtons(form.disableButtons).map((v) => {
|
|
1209
|
-
const opt = VISIBLE_DISABLE_BUTTON_OPTIONS.find((o) => o.value === v);
|
|
1210
|
-
return /* @__PURE__ */ jsx(Pill, { onRemove: () => removeMulti("disableButtons", v), children: (opt == null ? void 0 : opt.label) ?? v }, v);
|
|
1211
|
-
}),
|
|
1212
|
-
filterHiddenDisableButtons(form.disableButtons).length === 0 ? /* @__PURE__ */ jsx("span", { className: "text-sm text-ui-fg-subtle", children: "No buttons disabled." }) : null
|
|
1213
|
-
] }),
|
|
1214
|
-
/* @__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) => {
|
|
1215
|
-
const checked = form.disableButtons.includes(o.value);
|
|
1216
|
-
return /* @__PURE__ */ jsxs("label", { className: "flex items-center gap-2 rounded-md p-2 hover:bg-ui-bg-subtle", children: [
|
|
1217
|
-
/* @__PURE__ */ jsx(
|
|
1218
|
-
"input",
|
|
1219
|
-
{
|
|
1220
|
-
type: "checkbox",
|
|
1221
|
-
checked,
|
|
1222
|
-
onChange: () => toggleMulti("disableButtons", o.value),
|
|
1223
|
-
className: "h-4 w-4 rounded border-ui-border-base"
|
|
1224
|
-
}
|
|
1225
|
-
),
|
|
1226
|
-
/* @__PURE__ */ jsx("span", { className: "text-sm text-ui-fg-base", children: o.label })
|
|
1227
|
-
] }, o.value);
|
|
1228
|
-
}) }) })
|
|
1229
|
-
] })
|
|
1230
|
-
}
|
|
1231
|
-
),
|
|
1232
1130
|
/* @__PURE__ */ jsx(FieldRow, { label: "Button Color", children: /* @__PURE__ */ jsx(
|
|
1233
1131
|
"select",
|
|
1234
1132
|
{
|
|
@@ -1304,9 +1202,6 @@ function PayPalSettingsTab() {
|
|
|
1304
1202
|
] })
|
|
1305
1203
|
] }) });
|
|
1306
1204
|
}
|
|
1307
|
-
function PayPalPayLaterMessagingPage() {
|
|
1308
|
-
return /* @__PURE__ */ jsx(Navigate, { to: "/settings/paypal/connection", replace: true });
|
|
1309
|
-
}
|
|
1310
1205
|
const widgetModule = { widgets: [] };
|
|
1311
1206
|
const routeModule = {
|
|
1312
1207
|
routes: [
|
|
@@ -1326,21 +1221,21 @@ const routeModule = {
|
|
|
1326
1221
|
Component: PayPalApplePayPage,
|
|
1327
1222
|
path: "/settings/paypal/apple-pay"
|
|
1328
1223
|
},
|
|
1329
|
-
{
|
|
1330
|
-
Component: PayPalConnectionPage,
|
|
1331
|
-
path: "/settings/paypal/connection"
|
|
1332
|
-
},
|
|
1333
1224
|
{
|
|
1334
1225
|
Component: PayPalGooglePayPage,
|
|
1335
1226
|
path: "/settings/paypal/google-pay"
|
|
1336
1227
|
},
|
|
1337
1228
|
{
|
|
1338
|
-
Component:
|
|
1339
|
-
path: "/settings/paypal/
|
|
1229
|
+
Component: PayPalConnectionPage,
|
|
1230
|
+
path: "/settings/paypal/connection"
|
|
1340
1231
|
},
|
|
1341
1232
|
{
|
|
1342
1233
|
Component: PayPalPayLaterMessagingPage,
|
|
1343
1234
|
path: "/settings/paypal/pay-later-messaging"
|
|
1235
|
+
},
|
|
1236
|
+
{
|
|
1237
|
+
Component: PayPalSettingsTab,
|
|
1238
|
+
path: "/settings/paypal/paypal-settings"
|
|
1344
1239
|
}
|
|
1345
1240
|
]
|
|
1346
1241
|
};
|
|
@@ -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) {
|