strapi-plugin-payone-provider 4.6.9 → 5.6.9
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 +24 -11
- package/admin/src/components/Initializer/index.jsx +3 -3
- package/admin/src/components/PluginIcon/index.jsx +3 -3
- package/admin/src/index.js +33 -11
- package/admin/src/pages/App/components/AppHeader.jsx +17 -32
- package/admin/src/pages/App/components/AppTabs.jsx +36 -162
- package/admin/src/pages/App/components/ApplePayBtn.jsx +9 -11
- package/admin/src/pages/App/components/ApplePayConfig.jsx +221 -161
- package/admin/src/pages/App/components/ApplePayConfigPanel.jsx +33 -45
- package/admin/src/pages/App/components/DocsPanel.jsx +66 -1726
- package/admin/src/pages/App/components/GooglePayConfig.jsx +136 -169
- package/admin/src/pages/App/components/GooglePayConfigPanel.jsx +37 -55
- package/admin/src/pages/App/components/GooglePaybutton.jsx +101 -43
- package/admin/src/pages/App/components/RenderInput.jsx +94 -0
- package/admin/src/pages/App/components/StatusBadge.jsx +24 -71
- package/admin/src/pages/App/components/configuration/ConfigurationFields.jsx +255 -0
- package/admin/src/pages/App/components/configuration/ConfigurationPanel.jsx +54 -0
- package/admin/src/pages/App/components/configuration/TestConnection.jsx +130 -0
- package/admin/src/pages/App/components/docs/ApplePaySection.jsx +260 -0
- package/admin/src/pages/App/components/docs/BaseUrlSection.jsx +53 -0
- package/admin/src/pages/App/components/docs/CaptureRefundSection.jsx +113 -0
- package/admin/src/pages/App/components/docs/CodeBlock.jsx +59 -0
- package/admin/src/pages/App/components/docs/CreditCardSection.jsx +93 -0
- package/admin/src/pages/App/components/docs/GooglePaySection.jsx +248 -0
- package/admin/src/pages/App/components/docs/PayPalSection.jsx +116 -0
- package/admin/src/pages/App/components/docs/PaymentMethodsSection.jsx +55 -0
- package/admin/src/pages/App/components/docs/TableOfContents.jsx +47 -0
- package/admin/src/pages/App/components/docs/TestCredentialsSection.jsx +304 -0
- package/admin/src/pages/App/components/docs/ThreeDSecureSection.jsx +188 -0
- package/admin/src/pages/App/components/icons/BankIcon.jsx +1 -1
- package/admin/src/pages/App/components/icons/ChevronDownIcon.jsx +1 -1
- package/admin/src/pages/App/components/icons/ChevronUpIcon.jsx +1 -1
- package/admin/src/pages/App/components/icons/CreditCardIcon.jsx +1 -1
- package/admin/src/pages/App/components/icons/ErrorIcon.jsx +1 -1
- package/admin/src/pages/App/components/icons/InfoIcon.jsx +1 -1
- package/admin/src/pages/App/components/icons/MarkCircle.jsx +19 -0
- package/admin/src/pages/App/components/icons/PaymentIcon.jsx +1 -1
- package/admin/src/pages/App/components/icons/PendingIcon.jsx +1 -1
- package/admin/src/pages/App/components/icons/PersonIcon.jsx +1 -1
- package/admin/src/pages/App/components/icons/SuccessIcon.jsx +1 -1
- package/admin/src/pages/App/components/icons/WalletIcon.jsx +1 -1
- package/admin/src/pages/App/components/payment-actions/ApplePayPanel.jsx +51 -0
- package/admin/src/pages/App/components/payment-actions/AuthorizationForm.jsx +341 -0
- package/admin/src/pages/App/components/payment-actions/CaptureForm.jsx +128 -0
- package/admin/src/pages/App/components/{paymentActions → payment-actions}/CardDetailsInput.jsx +77 -72
- package/admin/src/pages/App/components/payment-actions/PaymentActionsPanel.jsx +194 -0
- package/admin/src/pages/App/components/payment-actions/PaymentMethodSelector.jsx +313 -0
- package/admin/src/pages/App/components/payment-actions/PaymentResult.jsx +133 -0
- package/admin/src/pages/App/components/payment-actions/PreauthorizationForm.jsx +280 -0
- package/admin/src/pages/App/components/payment-actions/RefundForm.jsx +121 -0
- package/admin/src/pages/App/components/transaction-history/FiltersPanel.jsx +145 -0
- package/admin/src/pages/App/components/transaction-history/HistoryPanel.jsx +50 -0
- package/admin/src/pages/App/components/transaction-history/TransactionTable.jsx +163 -0
- package/admin/src/pages/App/components/transaction-history/details/TransactionDetails.jsx +156 -0
- package/admin/src/pages/App/components/{TransactionHistoryItem.jsx → transaction-history/details/TransactionHistoryItem.jsx} +16 -28
- package/admin/src/pages/App/index.jsx +27 -70
- package/admin/src/pages/App/styles.css +46 -169
- package/admin/src/pages/constants/paymentConstants.js +52 -16
- package/admin/src/pages/hooks/use-system-theme.js +27 -0
- package/admin/src/pages/hooks/usePaymentActions.js +273 -210
- package/admin/src/pages/hooks/useSettings.js +87 -48
- package/admin/src/pages/hooks/useTransactionHistory.js +105 -108
- package/admin/src/pages/utils/api.js +57 -72
- package/admin/src/pages/utils/applePayConstants.js +2 -28
- package/admin/src/pages/utils/countryLanguageUtils.js +280 -0
- package/admin/src/pages/utils/getInputComponent.jsx +225 -0
- package/admin/src/pages/utils/googlePayConstants.js +2 -9
- package/admin/src/pages/utils/paymentUtils.js +13 -25
- package/admin/src/pages/utils/tooltipHelpers.js +18 -0
- package/admin/src/pages/utils/transactionTableUtils.js +60 -0
- package/package.json +8 -14
- package/server/config/index.js +18 -2
- package/server/controllers/payone.js +80 -31
- package/server/policies/is-auth.js +9 -3
- package/server/policies/isSuperAdmin.js +7 -5
- package/server/services/paymentService.js +6 -22
- package/server/services/payone.js +3 -3
- package/server/services/settingsService.js +13 -3
- package/server/services/testConnectionService.js +11 -73
- package/server/services/transactionService.js +63 -98
- package/server/utils/normalize.js +0 -12
- package/server/utils/paymentMethodParams.js +0 -1
- package/server/utils/responseParser.js +9 -14
- package/strapi-admin.js +3 -1
- package/admin/src/pages/App/components/ConfigurationPanel.jsx +0 -517
- package/admin/src/pages/App/components/CustomerInfoPopover.jsx +0 -147
- package/admin/src/pages/App/components/HistoryPanel.jsx +0 -94
- package/admin/src/pages/App/components/PaymentActionsPanel.jsx +0 -280
- package/admin/src/pages/App/components/RawDataPopover.jsx +0 -113
- package/admin/src/pages/App/components/TransactionHistoryTable/TransactionHistoryTableFilters.jsx +0 -113
- package/admin/src/pages/App/components/TransactionHistoryTable/TransactionHistoryTablePagination.jsx +0 -180
- package/admin/src/pages/App/components/TransactionHistoryTable/index.jsx +0 -225
- package/admin/src/pages/App/components/paymentActions/ApplePayPanel.jsx +0 -95
- package/admin/src/pages/App/components/paymentActions/AuthorizationForm.jsx +0 -197
- package/admin/src/pages/App/components/paymentActions/CaptureForm.jsx +0 -65
- package/admin/src/pages/App/components/paymentActions/PaymentMethodSelector.jsx +0 -306
- package/admin/src/pages/App/components/paymentActions/PaymentResult.jsx +0 -192
- package/admin/src/pages/App/components/paymentActions/PreauthorizationForm.jsx +0 -142
- package/admin/src/pages/App/components/paymentActions/RefundForm.jsx +0 -90
|
@@ -54,82 +54,19 @@ const testConnection = async (strapi) => {
|
|
|
54
54
|
});
|
|
55
55
|
|
|
56
56
|
const result = parseResponse(response.data, strapi.log);
|
|
57
|
-
const status = result
|
|
58
|
-
const errorMessage =
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
result.ERRORMESSAGE ||
|
|
62
|
-
result.error ||
|
|
63
|
-
result.Error?.ErrorMessage ||
|
|
64
|
-
"";
|
|
65
|
-
const errorCode =
|
|
66
|
-
result.errorcode ||
|
|
67
|
-
result.Errorcode ||
|
|
68
|
-
result.ERRORCODE ||
|
|
69
|
-
result.Error?.ErrorCode ||
|
|
70
|
-
"";
|
|
71
|
-
const customErrorMessage =
|
|
72
|
-
result.customerrormessage ||
|
|
73
|
-
result.Customerrormessage ||
|
|
74
|
-
result.CUSTOMERRORMESSAGE ||
|
|
75
|
-
result.Error?.CustomerMessage ||
|
|
76
|
-
"";
|
|
57
|
+
const status = result?.status || result?.Status || result?.STATUS;
|
|
58
|
+
const errorMessage = result?.Error?.ErrorMessage;
|
|
59
|
+
const errorCode = result?.Error?.ErrorCode;
|
|
60
|
+
const customErrorMessage = result?.Error?.CustomerMessage;
|
|
77
61
|
|
|
78
62
|
if (status === "ERROR" || status === "error") {
|
|
79
|
-
if (["2006", "920", "921", "922", "401", "403"].includes(errorCode)) {
|
|
80
|
-
return {
|
|
81
|
-
success: false,
|
|
82
|
-
message: `Authentication failed: ${customErrorMessage || errorMessage || "Invalid credentials"}`,
|
|
83
|
-
errorcode: errorCode
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
const errorMessageStr = typeof errorMessage === "string" ? errorMessage : JSON.stringify(errorMessage);
|
|
88
|
-
const errorMessageLower = (errorMessageStr || "").toLowerCase();
|
|
89
|
-
const authErrorKeywords = [
|
|
90
|
-
"key incorrect",
|
|
91
|
-
"invalid key",
|
|
92
|
-
"portal key",
|
|
93
|
-
"unauthorized",
|
|
94
|
-
"not authorized",
|
|
95
|
-
"unknown aid",
|
|
96
|
-
"unknown account",
|
|
97
|
-
"unknown portal",
|
|
98
|
-
"unknown merchant",
|
|
99
|
-
"invalid aid",
|
|
100
|
-
"invalid mid",
|
|
101
|
-
"invalid portalid"
|
|
102
|
-
];
|
|
103
|
-
|
|
104
|
-
if (authErrorKeywords.some((keyword) => errorMessageLower.includes(keyword))) {
|
|
105
|
-
return {
|
|
106
|
-
success: false,
|
|
107
|
-
message: `Authentication failed: ${errorMessageStr}`,
|
|
108
|
-
errorcode: errorCode || "AUTH"
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
if (errorCode === "911") {
|
|
113
|
-
return {
|
|
114
|
-
success: true,
|
|
115
|
-
message: "Connection successful! Your Payone credentials are valid.",
|
|
116
|
-
details: {
|
|
117
|
-
mode: settings.mode,
|
|
118
|
-
aid: settings.aid,
|
|
119
|
-
portalid: settings.portalid,
|
|
120
|
-
mid: settings.mid
|
|
121
|
-
}
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
|
|
125
63
|
return {
|
|
126
64
|
success: false,
|
|
127
|
-
message: `
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
rawResponse: JSON.stringify(result).substring(0, 200)
|
|
65
|
+
message: `Test connection failed: ${errorCode}`,
|
|
66
|
+
error: {
|
|
67
|
+
ErrorCode: errorCode,
|
|
68
|
+
ErrorMessage: errorMessage,
|
|
69
|
+
CustomerMessage: customErrorMessage
|
|
133
70
|
}
|
|
134
71
|
};
|
|
135
72
|
}
|
|
@@ -157,11 +94,12 @@ const testConnection = async (strapi) => {
|
|
|
157
94
|
rawResponse: JSON.stringify(result).substring(0, 200)
|
|
158
95
|
}
|
|
159
96
|
};
|
|
97
|
+
|
|
160
98
|
} catch (error) {
|
|
161
99
|
strapi.log.error("Payone test connection error:", error);
|
|
162
100
|
return {
|
|
163
101
|
success: false,
|
|
164
|
-
message: `
|
|
102
|
+
message: `Test connection error: ${error.message || "Unknown error"}`,
|
|
165
103
|
error: error.toString(),
|
|
166
104
|
details: {
|
|
167
105
|
errorType: error.constructor.name,
|
|
@@ -2,20 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
const { getPluginStore } = require("./settingsService");
|
|
4
4
|
|
|
5
|
-
const sanitizeRawRequest = (rawRequest) => {
|
|
6
|
-
if (!rawRequest || typeof rawRequest !== "object") return rawRequest
|
|
7
|
-
const sanitized = { ...rawRequest };
|
|
8
|
-
const sensitiveFields = ["cardpan", "cardexpiredate", "cardcvc2"];
|
|
9
|
-
|
|
10
|
-
sensitiveFields.forEach((field) => {
|
|
11
|
-
if (sanitized[field] && typeof sanitized[field] === "string") {
|
|
12
|
-
sanitized[field] = "*".repeat(sanitized[field].length);
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
return sanitized;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
5
|
const logTransaction = async (strapi, transactionData) => {
|
|
20
6
|
const pluginStore = getPluginStore(strapi);
|
|
21
7
|
let transactionHistory =
|
|
@@ -42,19 +28,17 @@ const logTransaction = async (strapi, transactionData) => {
|
|
|
42
28
|
transactionData.customer_message ||
|
|
43
29
|
transactionData.Error?.CustomerMessage ||
|
|
44
30
|
null,
|
|
45
|
-
body: transactionData
|
|
46
|
-
raw_request: transactionData.raw_request
|
|
47
|
-
|
|
48
|
-
: null,
|
|
49
|
-
raw_response: sanitizeRawRequest(transactionData.raw_response) || transactionData,
|
|
31
|
+
body: transactionData || null,
|
|
32
|
+
raw_request: transactionData.raw_request || null,
|
|
33
|
+
raw_response: transactionData.raw_response || transactionData,
|
|
50
34
|
created_at: new Date().toISOString(),
|
|
51
35
|
updated_at: new Date().toISOString()
|
|
52
36
|
};
|
|
53
37
|
|
|
54
38
|
transactionHistory.unshift(logEntry);
|
|
55
39
|
|
|
56
|
-
if (transactionHistory.length >
|
|
57
|
-
transactionHistory = transactionHistory.slice(0,
|
|
40
|
+
if (transactionHistory.length > 1000) {
|
|
41
|
+
transactionHistory = transactionHistory.slice(0, 1000);
|
|
58
42
|
}
|
|
59
43
|
|
|
60
44
|
await pluginStore.set({
|
|
@@ -65,36 +49,32 @@ const logTransaction = async (strapi, transactionData) => {
|
|
|
65
49
|
strapi.log.info("Transaction logged:", logEntry);
|
|
66
50
|
};
|
|
67
51
|
|
|
68
|
-
const getTransactionHistory = async (strapi, filters = {}) => {
|
|
69
|
-
const pluginStore = getPluginStore(strapi);
|
|
70
|
-
let transactionHistory =
|
|
71
|
-
(await pluginStore.get({ key: "transactionHistory" })) || [];
|
|
72
52
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
return (
|
|
81
|
-
status.includes(searchLower) ||
|
|
82
|
-
txid.includes(searchLower) ||
|
|
83
|
-
reference.includes(searchLower)
|
|
84
|
-
);
|
|
53
|
+
const applyFilters = (transactions, filters = {}) => {
|
|
54
|
+
let result = [...transactions];
|
|
55
|
+
if (filters.search && typeof filters.search === 'string' && filters.search.trim() !== '') {
|
|
56
|
+
const search = filters.search.toLowerCase().trim();
|
|
57
|
+
result = result.filter((t) => {
|
|
58
|
+
const txid = (t.txid || "").toString().toLowerCase();
|
|
59
|
+
const reference = (t.reference || "").toString().toLowerCase();
|
|
60
|
+
return txid.includes(search) || reference.includes(search);
|
|
85
61
|
});
|
|
86
62
|
}
|
|
87
63
|
|
|
88
|
-
if (filters.
|
|
89
|
-
|
|
90
|
-
(
|
|
64
|
+
if (filters.status) {
|
|
65
|
+
result = result.filter(
|
|
66
|
+
(t) => (t.status || "").toUpperCase() === filters.status.toUpperCase()
|
|
91
67
|
);
|
|
92
68
|
}
|
|
93
69
|
|
|
70
|
+
if (filters.request_type) {
|
|
71
|
+
result = result.filter((t) => t.request_type === filters.request_type);
|
|
72
|
+
}
|
|
73
|
+
|
|
94
74
|
if (filters.payment_method) {
|
|
95
|
-
|
|
96
|
-
const clearingtype =
|
|
97
|
-
const wallettype =
|
|
75
|
+
result = result.filter((t) => {
|
|
76
|
+
const clearingtype = t.raw_request?.clearingtype;
|
|
77
|
+
const wallettype = t.raw_request?.wallettype;
|
|
98
78
|
|
|
99
79
|
switch (filters.payment_method) {
|
|
100
80
|
case "credit_card":
|
|
@@ -102,82 +82,67 @@ const getTransactionHistory = async (strapi, filters = {}) => {
|
|
|
102
82
|
case "paypal":
|
|
103
83
|
return clearingtype === "wlt" && wallettype === "PPE";
|
|
104
84
|
case "google_pay":
|
|
105
|
-
return clearingtype === "wlt" &&
|
|
85
|
+
return clearingtype === "wlt" && ["GPY", "GOOGLEPAY"].includes(wallettype);
|
|
106
86
|
case "apple_pay":
|
|
107
|
-
return clearingtype === "wlt" &&
|
|
87
|
+
return clearingtype === "wlt" && ["APL", "APPLEPAY"].includes(wallettype);
|
|
108
88
|
case "sofort":
|
|
109
89
|
return clearingtype === "sb";
|
|
110
90
|
case "sepa":
|
|
111
91
|
return clearingtype === "elv";
|
|
112
92
|
default:
|
|
113
|
-
return
|
|
93
|
+
return true;
|
|
114
94
|
}
|
|
115
95
|
});
|
|
116
96
|
}
|
|
117
97
|
|
|
118
98
|
if (filters.date_from) {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
99
|
+
const dateFrom = new Date(filters.date_from);
|
|
100
|
+
dateFrom.setHours(0, 0, 0, 0);
|
|
101
|
+
result = result.filter(
|
|
102
|
+
(t) => new Date(t.timestamp) >= dateFrom
|
|
122
103
|
);
|
|
123
104
|
}
|
|
124
105
|
|
|
125
106
|
if (filters.date_to) {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
107
|
+
const dateTo = new Date(filters.date_to);
|
|
108
|
+
dateTo.setHours(23, 59, 59, 999);
|
|
109
|
+
result = result.filter(
|
|
110
|
+
(t) => new Date(t.timestamp) <= dateTo
|
|
129
111
|
);
|
|
130
112
|
}
|
|
131
113
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
(transaction) => transaction.status === filters.status
|
|
135
|
-
);
|
|
136
|
-
}
|
|
114
|
+
return result;
|
|
115
|
+
};
|
|
137
116
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
const sortOrder = filters.sort_order === "desc" ? -1 : 1;
|
|
141
|
-
|
|
142
|
-
transactionHistory.sort((a, b) => {
|
|
143
|
-
let aValue, bValue;
|
|
144
|
-
|
|
145
|
-
switch (filters.sort_by) {
|
|
146
|
-
case "amount":
|
|
147
|
-
aValue = a.amount || 0;
|
|
148
|
-
bValue = b.amount || 0;
|
|
149
|
-
break;
|
|
150
|
-
case "created_at":
|
|
151
|
-
aValue = new Date(a.created_at || a.timestamp || 0).getTime();
|
|
152
|
-
bValue = new Date(b.created_at || b.timestamp || 0).getTime();
|
|
153
|
-
break;
|
|
154
|
-
case "status":
|
|
155
|
-
aValue = (a.status || "").toLowerCase();
|
|
156
|
-
bValue = (b.status || "").toLowerCase();
|
|
157
|
-
break;
|
|
158
|
-
case "reference":
|
|
159
|
-
aValue = (a.reference || "").toLowerCase();
|
|
160
|
-
bValue = (b.reference || "").toLowerCase();
|
|
161
|
-
break;
|
|
162
|
-
case "method":
|
|
163
|
-
const aClearingType = a.raw_request?.clearingtype || "";
|
|
164
|
-
const bClearingType = b.raw_request?.clearingtype || "";
|
|
165
|
-
const aWalletType = a.raw_request?.wallettype || "";
|
|
166
|
-
const bWalletType = b.raw_request?.wallettype || "";
|
|
167
|
-
aValue = `${aClearingType}_${aWalletType}`.toLowerCase();
|
|
168
|
-
bValue = `${bClearingType}_${bWalletType}`.toLowerCase();
|
|
169
|
-
break;
|
|
170
|
-
default:
|
|
171
|
-
return 0;
|
|
172
|
-
}
|
|
117
|
+
const getTransactionHistory = async (strapi, { filters = {}, pagination = {} }) => {
|
|
118
|
+
const pluginStore = getPluginStore(strapi);
|
|
173
119
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
120
|
+
let transactions =
|
|
121
|
+
(await pluginStore.get({ key: "transactionHistory" })) || [];
|
|
122
|
+
|
|
123
|
+
transactions = applyFilters(transactions, filters);
|
|
124
|
+
const page = Number(pagination.page) || 1;
|
|
125
|
+
const pageSize = Number(pagination.pageSize) || 10;
|
|
126
|
+
|
|
127
|
+
const total = transactions.length;
|
|
128
|
+
const pageCount = Math.max(1, Math.ceil(total / pageSize));
|
|
129
|
+
|
|
130
|
+
const validPage = Math.min(Math.max(1, page), pageCount);
|
|
179
131
|
|
|
180
|
-
|
|
132
|
+
const start = (validPage - 1) * pageSize;
|
|
133
|
+
const end = Math.min(start + pageSize, total);
|
|
134
|
+
|
|
135
|
+
const paginatedData = start < total ? transactions.slice(start, end) : [];
|
|
136
|
+
|
|
137
|
+
return {
|
|
138
|
+
data: paginatedData,
|
|
139
|
+
pagination: {
|
|
140
|
+
page: validPage,
|
|
141
|
+
pageSize,
|
|
142
|
+
pageCount,
|
|
143
|
+
total,
|
|
144
|
+
},
|
|
145
|
+
};
|
|
181
146
|
};
|
|
182
147
|
|
|
183
148
|
module.exports = {
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* Normalize reference string for Payone API
|
|
5
|
-
* @param {string} input - Input reference
|
|
6
|
-
* @param {string} fallbackPrefix - Fallback prefix if input is empty
|
|
7
|
-
* @returns {string} Normalized reference (max 20 chars)
|
|
8
|
-
*/
|
|
9
3
|
const normalizeReference = (input, fallbackPrefix = "REF") => {
|
|
10
4
|
try {
|
|
11
5
|
const raw = input == null ? "" : String(input);
|
|
@@ -22,12 +16,6 @@ const normalizeReference = (input, fallbackPrefix = "REF") => {
|
|
|
22
16
|
}
|
|
23
17
|
};
|
|
24
18
|
|
|
25
|
-
/**
|
|
26
|
-
* Normalize customer ID for Payone API (max 17 characters)
|
|
27
|
-
* @param {string|null} customerid - Customer ID
|
|
28
|
-
* @param {Object|null} logger - Logger instance
|
|
29
|
-
* @returns {string} Normalized customer ID
|
|
30
|
-
*/
|
|
31
19
|
const normalizeCustomerId = (customerid, logger = null) => {
|
|
32
20
|
if (!customerid) {
|
|
33
21
|
const timestamp = Date.now().toString().slice(-10);
|
|
@@ -56,7 +56,6 @@ const addPaymentMethodParams = (params, logger) => {
|
|
|
56
56
|
'clearingtype', 'paymentMethod', 'settings', 'enable3DSecure', 'ecommercemode'
|
|
57
57
|
]);
|
|
58
58
|
|
|
59
|
-
// Extract custom params that are not in known params
|
|
60
59
|
Object.keys(updated).forEach(key => {
|
|
61
60
|
if (!knownParams.has(key) && !key.startsWith('add_paydata[')) {
|
|
62
61
|
customParams[key] = updated[key];
|
|
@@ -20,17 +20,12 @@ const parseResponse = (responseText, logger) => {
|
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
// Parse URL-encoded response
|
|
24
23
|
const params = new URLSearchParams(responseText);
|
|
25
24
|
const response = {};
|
|
26
25
|
for (const [key, value] of params) {
|
|
27
|
-
// Store both lowercase and original case
|
|
28
26
|
response[key.toLowerCase()] = value;
|
|
29
27
|
response[key] = value;
|
|
30
|
-
|
|
31
|
-
// Also handle add_paydata fields with brackets
|
|
32
|
-
// Payone returns: add_paydata[applepay_payment_session]=BASE64_STRING
|
|
33
|
-
// URLSearchParams handles brackets, but we need to ensure we can access it
|
|
28
|
+
|
|
34
29
|
if (key.includes('add_paydata') || key.includes('addPaydata')) {
|
|
35
30
|
// Store with original key format
|
|
36
31
|
response[key] = value;
|
|
@@ -67,11 +62,11 @@ const extractTxId = (data) => {
|
|
|
67
62
|
const requires3DSRedirect = (data) => {
|
|
68
63
|
const status = (data.status || data.Status || "").toUpperCase();
|
|
69
64
|
const errorCode = data.errorcode || data.ErrorCode || data.Error?.ErrorCode;
|
|
70
|
-
|
|
65
|
+
|
|
71
66
|
// Check for redirect URL in various possible fields
|
|
72
|
-
const redirecturl =
|
|
73
|
-
data.redirecturl ||
|
|
74
|
-
data.RedirectUrl ||
|
|
67
|
+
const redirecturl =
|
|
68
|
+
data.redirecturl ||
|
|
69
|
+
data.RedirectUrl ||
|
|
75
70
|
data.redirect_url ||
|
|
76
71
|
data.redirectUrl ||
|
|
77
72
|
data.RedirectURL ||
|
|
@@ -96,7 +91,7 @@ const requires3DSRedirect = (data) => {
|
|
|
96
91
|
const isErrorResponse = (data) => {
|
|
97
92
|
const status = (data.status || data.Status || "").toUpperCase();
|
|
98
93
|
const errorCode = data.errorcode || data.ErrorCode || data.Error?.ErrorCode;
|
|
99
|
-
|
|
94
|
+
|
|
100
95
|
return status === "ERROR" || status === "INVALID" || !!errorCode;
|
|
101
96
|
};
|
|
102
97
|
|
|
@@ -107,9 +102,9 @@ const isErrorResponse = (data) => {
|
|
|
107
102
|
*/
|
|
108
103
|
const get3DSRedirectUrl = (data) => {
|
|
109
104
|
// Check all possible redirect URL fields
|
|
110
|
-
const redirecturl =
|
|
111
|
-
data.redirecturl ||
|
|
112
|
-
data.RedirectUrl ||
|
|
105
|
+
const redirecturl =
|
|
106
|
+
data.redirecturl ||
|
|
107
|
+
data.RedirectUrl ||
|
|
113
108
|
data.redirect_url ||
|
|
114
109
|
data.redirectUrl ||
|
|
115
110
|
data.RedirectURL ||
|
package/strapi-admin.js
CHANGED