strapi-plugin-payone-provider 5.7.24 → 5.7.26
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/README.md +1191 -1191
- package/admin/src/components/Initializer/index.jsx +16 -16
- package/admin/src/components/PluginIcon/index.jsx +17 -17
- package/admin/src/index.js +57 -57
- package/admin/src/pages/App/components/AppHeader.jsx +45 -45
- package/admin/src/pages/App/components/AppTabs.jsx +105 -105
- package/admin/src/pages/App/components/ApplePayBtn.jsx +355 -355
- package/admin/src/pages/App/components/ApplePayConfig.jsx +357 -357
- package/admin/src/pages/App/components/DocsPanel.jsx +53 -53
- package/admin/src/pages/App/components/RenderInput.jsx +78 -78
- package/admin/src/pages/App/components/StatusBadge.jsx +87 -87
- package/admin/src/pages/App/components/icons/BankIcon.jsx +10 -10
- package/admin/src/pages/App/components/icons/ChevronDownIcon.jsx +9 -9
- package/admin/src/pages/App/components/icons/ChevronUpIcon.jsx +9 -9
- package/admin/src/pages/App/components/icons/CreditCardIcon.jsx +9 -9
- package/admin/src/pages/App/components/icons/ErrorIcon.jsx +10 -10
- package/admin/src/pages/App/components/icons/InfoIcon.jsx +9 -9
- package/admin/src/pages/App/components/icons/MarkCircle.jsx +19 -19
- package/admin/src/pages/App/components/icons/PaymentIcon.jsx +10 -10
- package/admin/src/pages/App/components/icons/PendingIcon.jsx +9 -9
- package/admin/src/pages/App/components/icons/PersonIcon.jsx +9 -9
- package/admin/src/pages/App/components/icons/SuccessIcon.jsx +9 -9
- package/admin/src/pages/App/components/icons/WalletIcon.jsx +9 -9
- package/admin/src/pages/App/components/icons/index.jsx +12 -12
- package/admin/src/pages/App/components/payment-actions/AuthorizationForm.jsx +334 -334
- package/admin/src/pages/App/components/payment-actions/CaptureForm.jsx +120 -120
- package/admin/src/pages/App/components/payment-actions/PaymentActionsPanel.jsx +183 -183
- package/admin/src/pages/App/components/payment-actions/PaymentMethodSelector.jsx +315 -315
- package/admin/src/pages/App/components/payment-actions/PaymentResult.jsx +129 -129
- package/admin/src/pages/App/components/payment-actions/PreauthorizationForm.jsx +273 -273
- package/admin/src/pages/App/components/payment-actions/RefundForm.jsx +114 -114
- package/admin/src/pages/App/components/transaction-history/ImportExportBar.jsx +153 -153
- package/admin/src/pages/App/components/transaction-history/details/TransactionHistoryItem.jsx +526 -526
- package/admin/src/pages/App/index.jsx +96 -96
- package/admin/src/pages/App/styles.css +176 -176
- package/admin/src/pages/constants/paymentConstants.js +71 -71
- package/admin/src/pages/hooks/use-system-theme.js +27 -27
- package/admin/src/pages/hooks/usePaymentActions.js +498 -498
- package/admin/src/pages/hooks/usePluginTranslations.js +12 -12
- package/admin/src/pages/hooks/useSettings.js +183 -183
- package/admin/src/pages/hooks/useTransactionHistory.js +148 -148
- package/admin/src/pages/utils/api.js +97 -97
- package/admin/src/pages/utils/applePayConstants.js +196 -196
- package/admin/src/pages/utils/formatTransactionData.js +15 -15
- package/admin/src/pages/utils/getInputComponent.jsx +200 -200
- package/admin/src/pages/utils/paymentUtils.js +661 -661
- package/admin/src/pages/utils/tooltipHelpers.js +18 -18
- package/admin/src/pages/utils/transactionTableUtils.js +71 -71
- package/admin/src/pluginId.js +9 -9
- package/admin/src/translations/de.json +235 -235
- package/admin/src/translations/en.json +235 -235
- package/admin/src/translations/fr.json +235 -235
- package/admin/src/translations/ru.json +235 -235
- package/admin/src/utils/prefixPluginTranslations.js +13 -13
- package/package.json +45 -45
- package/server/bootstrap.js +107 -107
- package/server/config/index.js +83 -83
- package/server/content-types/index.js +4 -4
- package/server/content-types/transactions/index.js +4 -4
- package/server/content-types/transactions/schema.json +86 -86
- package/server/controllers/index.js +7 -7
- package/server/controllers/payone.js +506 -451
- package/server/destroy.js +5 -5
- package/server/index.js +23 -23
- package/server/policies/index.js +7 -7
- package/server/policies/is-auth.js +29 -29
- package/server/policies/isSuperAdmin.js +20 -20
- package/server/register.js +5 -5
- package/server/routes/index.js +218 -218
- package/server/services/applePayService.js +295 -295
- package/server/services/index.js +9 -9
- package/server/services/paymentService.js +223 -223
- package/server/services/payone.js +78 -78
- package/server/services/settingsService.js +59 -59
- package/server/services/testConnectionService.js +115 -115
- package/server/services/transactionService.js +262 -262
- package/server/utils/csvTransactions.js +82 -82
- package/server/utils/normalize.js +39 -39
- package/server/utils/paymentMethodParams.js +288 -288
- package/server/utils/requestBuilder.js +100 -100
- package/server/utils/responseParser.js +141 -141
- package/strapi-admin.js +4 -4
- package/strapi-server.js +3 -3
|
@@ -1,82 +1,82 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const TRANSACTION_ATTRS = [
|
|
4
|
-
"txid", "reference", "invoiceid", "amount", "currency", "status",
|
|
5
|
-
"error_code", "request_type", "error_message", "customer_message",
|
|
6
|
-
"body", "raw_request", "raw_response", "createdAt", "updatedAt"
|
|
7
|
-
];
|
|
8
|
-
|
|
9
|
-
function escapeCsvCell(val) {
|
|
10
|
-
if (val == null) return "";
|
|
11
|
-
const str = typeof val === "object" ? JSON.stringify(val) : String(val);
|
|
12
|
-
if (/[",\n\r]/.test(str)) return `"${str.replace(/"/g, '""')}"`;
|
|
13
|
-
return str;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function parseCsvLine(line) {
|
|
17
|
-
const out = [];
|
|
18
|
-
let cur = "";
|
|
19
|
-
let inQuotes = false;
|
|
20
|
-
for (let i = 0; i < line.length; i++) {
|
|
21
|
-
const c = line[i];
|
|
22
|
-
if (c === '"') {
|
|
23
|
-
if (inQuotes && line[i + 1] === '"') {
|
|
24
|
-
cur += '"';
|
|
25
|
-
i++;
|
|
26
|
-
} else {
|
|
27
|
-
inQuotes = !inQuotes;
|
|
28
|
-
}
|
|
29
|
-
} else if (inQuotes) {
|
|
30
|
-
cur += c;
|
|
31
|
-
} else if (c === ",") {
|
|
32
|
-
out.push(cur);
|
|
33
|
-
cur = "";
|
|
34
|
-
} else {
|
|
35
|
-
cur += c;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
out.push(cur);
|
|
39
|
-
return out;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function csvToRows(csvText) {
|
|
43
|
-
const lines = csvText.split(/\r?\n/).filter((l) => l.trim() !== "");
|
|
44
|
-
if (lines.length === 0) return [];
|
|
45
|
-
const headers = parseCsvLine(lines[0]).map((h) => h.trim());
|
|
46
|
-
const rows = [];
|
|
47
|
-
for (let i = 1; i < lines.length; i++) {
|
|
48
|
-
const cells = parseCsvLine(lines[i]);
|
|
49
|
-
const row = {};
|
|
50
|
-
headers.forEach((h, j) => {
|
|
51
|
-
let v = cells[j];
|
|
52
|
-
if (v !== undefined) v = v.trim();
|
|
53
|
-
if (v === "" && (h === "body" || h === "raw_request" || h === "raw_response")) {
|
|
54
|
-
row[h] = {};
|
|
55
|
-
} else if (h === "body" || h === "raw_request" || h === "raw_response") {
|
|
56
|
-
try {
|
|
57
|
-
row[h] = typeof v === "string" && v ? JSON.parse(v) : {};
|
|
58
|
-
} catch {
|
|
59
|
-
row[h] = {};
|
|
60
|
-
}
|
|
61
|
-
} else {
|
|
62
|
-
row[h] = v ?? "";
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
rows.push(row);
|
|
66
|
-
}
|
|
67
|
-
return rows;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
function rowsToCsv(rows, attrs = TRANSACTION_ATTRS) {
|
|
71
|
-
const headerLine = attrs.map(escapeCsvCell).join(",");
|
|
72
|
-
const dataLines = rows.map((r) =>
|
|
73
|
-
attrs.map((key) => escapeCsvCell(r[key])).join(",")
|
|
74
|
-
);
|
|
75
|
-
return [headerLine, ...dataLines].join("\n");
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
module.exports = {
|
|
79
|
-
TRANSACTION_ATTRS,
|
|
80
|
-
csvToRows,
|
|
81
|
-
rowsToCsv,
|
|
82
|
-
};
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const TRANSACTION_ATTRS = [
|
|
4
|
+
"txid", "reference", "invoiceid", "amount", "currency", "status",
|
|
5
|
+
"error_code", "request_type", "error_message", "customer_message",
|
|
6
|
+
"body", "raw_request", "raw_response", "createdAt", "updatedAt"
|
|
7
|
+
];
|
|
8
|
+
|
|
9
|
+
function escapeCsvCell(val) {
|
|
10
|
+
if (val == null) return "";
|
|
11
|
+
const str = typeof val === "object" ? JSON.stringify(val) : String(val);
|
|
12
|
+
if (/[",\n\r]/.test(str)) return `"${str.replace(/"/g, '""')}"`;
|
|
13
|
+
return str;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function parseCsvLine(line) {
|
|
17
|
+
const out = [];
|
|
18
|
+
let cur = "";
|
|
19
|
+
let inQuotes = false;
|
|
20
|
+
for (let i = 0; i < line.length; i++) {
|
|
21
|
+
const c = line[i];
|
|
22
|
+
if (c === '"') {
|
|
23
|
+
if (inQuotes && line[i + 1] === '"') {
|
|
24
|
+
cur += '"';
|
|
25
|
+
i++;
|
|
26
|
+
} else {
|
|
27
|
+
inQuotes = !inQuotes;
|
|
28
|
+
}
|
|
29
|
+
} else if (inQuotes) {
|
|
30
|
+
cur += c;
|
|
31
|
+
} else if (c === ",") {
|
|
32
|
+
out.push(cur);
|
|
33
|
+
cur = "";
|
|
34
|
+
} else {
|
|
35
|
+
cur += c;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
out.push(cur);
|
|
39
|
+
return out;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function csvToRows(csvText) {
|
|
43
|
+
const lines = csvText.split(/\r?\n/).filter((l) => l.trim() !== "");
|
|
44
|
+
if (lines.length === 0) return [];
|
|
45
|
+
const headers = parseCsvLine(lines[0]).map((h) => h.trim());
|
|
46
|
+
const rows = [];
|
|
47
|
+
for (let i = 1; i < lines.length; i++) {
|
|
48
|
+
const cells = parseCsvLine(lines[i]);
|
|
49
|
+
const row = {};
|
|
50
|
+
headers.forEach((h, j) => {
|
|
51
|
+
let v = cells[j];
|
|
52
|
+
if (v !== undefined) v = v.trim();
|
|
53
|
+
if (v === "" && (h === "body" || h === "raw_request" || h === "raw_response")) {
|
|
54
|
+
row[h] = {};
|
|
55
|
+
} else if (h === "body" || h === "raw_request" || h === "raw_response") {
|
|
56
|
+
try {
|
|
57
|
+
row[h] = typeof v === "string" && v ? JSON.parse(v) : {};
|
|
58
|
+
} catch {
|
|
59
|
+
row[h] = {};
|
|
60
|
+
}
|
|
61
|
+
} else {
|
|
62
|
+
row[h] = v ?? "";
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
rows.push(row);
|
|
66
|
+
}
|
|
67
|
+
return rows;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function rowsToCsv(rows, attrs = TRANSACTION_ATTRS) {
|
|
71
|
+
const headerLine = attrs.map(escapeCsvCell).join(",");
|
|
72
|
+
const dataLines = rows.map((r) =>
|
|
73
|
+
attrs.map((key) => escapeCsvCell(r[key])).join(",")
|
|
74
|
+
);
|
|
75
|
+
return [headerLine, ...dataLines].join("\n");
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
module.exports = {
|
|
79
|
+
TRANSACTION_ATTRS,
|
|
80
|
+
csvToRows,
|
|
81
|
+
rowsToCsv,
|
|
82
|
+
};
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const normalizeReference = (input, fallbackPrefix = "REF") => {
|
|
4
|
-
try {
|
|
5
|
-
const raw = input == null ? "" : String(input);
|
|
6
|
-
let normalized = raw.replace(/[^A-Za-z0-9]/g, "");
|
|
7
|
-
|
|
8
|
-
if (!normalized) {
|
|
9
|
-
normalized = `${fallbackPrefix}${Date.now()}`;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
return normalized.length > 20 ? normalized.slice(0, 20) : normalized;
|
|
13
|
-
} catch (_) {
|
|
14
|
-
const fallback = `${fallbackPrefix}${Date.now()}`;
|
|
15
|
-
return fallback.slice(0, 20);
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const normalizeCustomerId = (customerid, logger = null) => {
|
|
20
|
-
if (!customerid) {
|
|
21
|
-
const timestamp = Date.now().toString().slice(-10);
|
|
22
|
-
const random = Math.random().toString(36).substring(2, 6).toUpperCase();
|
|
23
|
-
return `${timestamp}${random}`.slice(0, 17);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const normalized = String(customerid).slice(0, 17);
|
|
27
|
-
if (customerid.length > 17 && logger) {
|
|
28
|
-
logger.warn(
|
|
29
|
-
`customerid exceeds 17 characters: ${customerid.length}, truncated to: ${normalized}`
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
return normalized;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
module.exports = {
|
|
36
|
-
normalizeReference,
|
|
37
|
-
normalizeCustomerId
|
|
38
|
-
};
|
|
39
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const normalizeReference = (input, fallbackPrefix = "REF") => {
|
|
4
|
+
try {
|
|
5
|
+
const raw = input == null ? "" : String(input);
|
|
6
|
+
let normalized = raw.replace(/[^A-Za-z0-9]/g, "");
|
|
7
|
+
|
|
8
|
+
if (!normalized) {
|
|
9
|
+
normalized = `${fallbackPrefix}${Date.now()}`;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return normalized.length > 20 ? normalized.slice(0, 20) : normalized;
|
|
13
|
+
} catch (_) {
|
|
14
|
+
const fallback = `${fallbackPrefix}${Date.now()}`;
|
|
15
|
+
return fallback.slice(0, 20);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const normalizeCustomerId = (customerid, logger = null) => {
|
|
20
|
+
if (!customerid) {
|
|
21
|
+
const timestamp = Date.now().toString().slice(-10);
|
|
22
|
+
const random = Math.random().toString(36).substring(2, 6).toUpperCase();
|
|
23
|
+
return `${timestamp}${random}`.slice(0, 17);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const normalized = String(customerid).slice(0, 17);
|
|
27
|
+
if (customerid.length > 17 && logger) {
|
|
28
|
+
logger.warn(
|
|
29
|
+
`customerid exceeds 17 characters: ${customerid.length}, truncated to: ${normalized}`
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
return normalized;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
module.exports = {
|
|
36
|
+
normalizeReference,
|
|
37
|
+
normalizeCustomerId
|
|
38
|
+
};
|
|
39
|
+
|