strapi-plugin-payone-provider 1.6.7 → 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 -156
- 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 +27 -16
- 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 -67
- 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 +109 -47
- 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 +7 -12
- 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 +61 -32
- 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/HistoryPanel.jsx +0 -312
- package/admin/src/pages/App/components/PaymentActionsPanel.jsx +0 -280
- 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
|
@@ -49,36 +49,32 @@ const logTransaction = async (strapi, transactionData) => {
|
|
|
49
49
|
strapi.log.info("Transaction logged:", logEntry);
|
|
50
50
|
};
|
|
51
51
|
|
|
52
|
-
const getTransactionHistory = async (strapi, filters = {}) => {
|
|
53
|
-
const pluginStore = getPluginStore(strapi);
|
|
54
|
-
let transactionHistory =
|
|
55
|
-
(await pluginStore.get({ key: "transactionHistory" })) || [];
|
|
56
52
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
return (
|
|
65
|
-
status.includes(searchLower) ||
|
|
66
|
-
txid.includes(searchLower) ||
|
|
67
|
-
reference.includes(searchLower)
|
|
68
|
-
);
|
|
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);
|
|
69
61
|
});
|
|
70
62
|
}
|
|
71
63
|
|
|
72
|
-
if (filters.
|
|
73
|
-
|
|
74
|
-
(
|
|
64
|
+
if (filters.status) {
|
|
65
|
+
result = result.filter(
|
|
66
|
+
(t) => (t.status || "").toUpperCase() === filters.status.toUpperCase()
|
|
75
67
|
);
|
|
76
68
|
}
|
|
77
69
|
|
|
70
|
+
if (filters.request_type) {
|
|
71
|
+
result = result.filter((t) => t.request_type === filters.request_type);
|
|
72
|
+
}
|
|
73
|
+
|
|
78
74
|
if (filters.payment_method) {
|
|
79
|
-
|
|
80
|
-
const clearingtype =
|
|
81
|
-
const wallettype =
|
|
75
|
+
result = result.filter((t) => {
|
|
76
|
+
const clearingtype = t.raw_request?.clearingtype;
|
|
77
|
+
const wallettype = t.raw_request?.wallettype;
|
|
82
78
|
|
|
83
79
|
switch (filters.payment_method) {
|
|
84
80
|
case "credit_card":
|
|
@@ -86,34 +82,67 @@ const getTransactionHistory = async (strapi, filters = {}) => {
|
|
|
86
82
|
case "paypal":
|
|
87
83
|
return clearingtype === "wlt" && wallettype === "PPE";
|
|
88
84
|
case "google_pay":
|
|
89
|
-
return clearingtype === "wlt" &&
|
|
85
|
+
return clearingtype === "wlt" && ["GPY", "GOOGLEPAY"].includes(wallettype);
|
|
90
86
|
case "apple_pay":
|
|
91
|
-
return clearingtype === "wlt" &&
|
|
87
|
+
return clearingtype === "wlt" && ["APL", "APPLEPAY"].includes(wallettype);
|
|
92
88
|
case "sofort":
|
|
93
89
|
return clearingtype === "sb";
|
|
94
90
|
case "sepa":
|
|
95
91
|
return clearingtype === "elv";
|
|
96
92
|
default:
|
|
97
|
-
return
|
|
93
|
+
return true;
|
|
98
94
|
}
|
|
99
95
|
});
|
|
100
96
|
}
|
|
101
97
|
|
|
102
98
|
if (filters.date_from) {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
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
|
|
106
103
|
);
|
|
107
104
|
}
|
|
108
105
|
|
|
109
106
|
if (filters.date_to) {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
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
|
|
113
111
|
);
|
|
114
112
|
}
|
|
115
113
|
|
|
116
|
-
return
|
|
114
|
+
return result;
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
const getTransactionHistory = async (strapi, { filters = {}, pagination = {} }) => {
|
|
118
|
+
const pluginStore = getPluginStore(strapi);
|
|
119
|
+
|
|
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);
|
|
131
|
+
|
|
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
|
+
};
|
|
117
146
|
};
|
|
118
147
|
|
|
119
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