strapi-plugin-payone-provider 5.7.26 → 5.8.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 +503 -506
- 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 +264 -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 +115 -100
- package/server/utils/responseParser.js +141 -141
- package/strapi-admin.js +4 -4
- package/strapi-server.js +3 -3
|
@@ -1,100 +1,115 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const crypto = require("crypto");
|
|
4
|
-
const { normalizeCustomerId } = require("./normalize");
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const buildClientRequestParams = (settings, params, logger = null) => {
|
|
8
|
-
const requestParams = {
|
|
9
|
-
request: params.request,
|
|
10
|
-
aid: settings.aid,
|
|
11
|
-
mid: settings.mid,
|
|
12
|
-
portalid: settings.portalid,
|
|
13
|
-
mode: params.testOrder ? "test" : settings.mode || "test",
|
|
14
|
-
encoding: "UTF-8",
|
|
15
|
-
...params
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
requestParams.customerid = normalizeCustomerId(
|
|
19
|
-
requestParams.customerid,
|
|
20
|
-
logger
|
|
21
|
-
);
|
|
22
|
-
|
|
23
|
-
requestParams.key = crypto
|
|
24
|
-
.createHash("md5")
|
|
25
|
-
.update(settings.portalKey || settings.key)
|
|
26
|
-
.digest("hex");
|
|
27
|
-
|
|
28
|
-
const isCreditCard = requestParams.clearingtype === "cc";
|
|
29
|
-
const enable3DSecure = settings.enable3DSecure !== false;
|
|
30
|
-
|
|
31
|
-
if (
|
|
32
|
-
requestParams["3dsecure"] = "yes";
|
|
33
|
-
requestParams.ecommercemode = params.ecommercemode || "internet";
|
|
34
|
-
|
|
35
|
-
if (!requestParams.successurl) {
|
|
36
|
-
requestParams.successurl = params.successurl || "https://www.example.com/success";
|
|
37
|
-
}
|
|
38
|
-
if (!requestParams.errorurl) {
|
|
39
|
-
requestParams.errorurl = params.errorurl || "https://www.example.com/error";
|
|
40
|
-
}
|
|
41
|
-
if (!requestParams.backurl) {
|
|
42
|
-
requestParams.backurl = params.backurl || "https://www.example.com/back";
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if (logger) {
|
|
46
|
-
logger.info("3DS Redirect URLs:", {
|
|
47
|
-
successurl: requestParams.successurl,
|
|
48
|
-
errorurl: requestParams.errorurl,
|
|
49
|
-
backurl: requestParams.backurl
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
} else if (isCreditCard && !enable3DSecure) {
|
|
53
|
-
requestParams["3dsecure"] = "no";
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const defaults = {
|
|
57
|
-
salutation: "Herr",
|
|
58
|
-
gender: "m",
|
|
59
|
-
telephonenumber: "01752345678",
|
|
60
|
-
ip: "127.0.0.1",
|
|
61
|
-
language: "de",
|
|
62
|
-
customer_is_present: "yes"
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
Object.entries(defaults).forEach(([key, value]) => {
|
|
66
|
-
if (!requestParams[key]) {
|
|
67
|
-
requestParams[key] = value;
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
if (requestParams.clearingtype === "wlt" && requestParams.cardtype) {
|
|
72
|
-
delete requestParams.cardtype;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
if (requestParams.clearingtype === "wlt" && !requestParams.wallettype) {
|
|
76
|
-
if (requestParams["add_paydata[paymentmethod_token_data]"]) {
|
|
77
|
-
requestParams.wallettype = "GGP";
|
|
78
|
-
} else {
|
|
79
|
-
requestParams.wallettype = "PPE";
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
return requestParams;
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
const toFormData = (requestParams) => {
|
|
87
|
-
const formData = new URLSearchParams();
|
|
88
|
-
for (const [key, value] of Object.entries(requestParams)) {
|
|
89
|
-
if (value !== undefined && value !== null) {
|
|
90
|
-
formData.append(key, value);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
return formData;
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const crypto = require("crypto");
|
|
4
|
+
const { normalizeCustomerId } = require("./normalize");
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
const buildClientRequestParams = (settings, params, logger = null) => {
|
|
8
|
+
const requestParams = {
|
|
9
|
+
request: params.request,
|
|
10
|
+
aid: settings.aid,
|
|
11
|
+
mid: settings.mid,
|
|
12
|
+
portalid: settings.portalid,
|
|
13
|
+
mode: params.testOrder ? "test" : settings.mode || "test",
|
|
14
|
+
encoding: "UTF-8",
|
|
15
|
+
...params
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
requestParams.customerid = normalizeCustomerId(
|
|
19
|
+
requestParams.customerid,
|
|
20
|
+
logger
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
requestParams.key = crypto
|
|
24
|
+
.createHash("md5")
|
|
25
|
+
.update(settings.portalKey || settings.key)
|
|
26
|
+
.digest("hex");
|
|
27
|
+
|
|
28
|
+
const isCreditCard = requestParams.clearingtype === "cc";
|
|
29
|
+
const enable3DSecure = settings.enable3DSecure !== false;
|
|
30
|
+
|
|
31
|
+
if (is3dsViable(requestParams, settings)) {
|
|
32
|
+
requestParams["3dsecure"] = "yes";
|
|
33
|
+
requestParams.ecommercemode = params.ecommercemode || "internet";
|
|
34
|
+
|
|
35
|
+
if (!requestParams.successurl) {
|
|
36
|
+
requestParams.successurl = params.successurl || "https://www.example.com/success";
|
|
37
|
+
}
|
|
38
|
+
if (!requestParams.errorurl) {
|
|
39
|
+
requestParams.errorurl = params.errorurl || "https://www.example.com/error";
|
|
40
|
+
}
|
|
41
|
+
if (!requestParams.backurl) {
|
|
42
|
+
requestParams.backurl = params.backurl || "https://www.example.com/back";
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (logger) {
|
|
46
|
+
logger.info("3DS Redirect URLs:", {
|
|
47
|
+
successurl: requestParams.successurl,
|
|
48
|
+
errorurl: requestParams.errorurl,
|
|
49
|
+
backurl: requestParams.backurl
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
} else if (isCreditCard && !enable3DSecure) {
|
|
53
|
+
requestParams["3dsecure"] = "no";
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const defaults = {
|
|
57
|
+
salutation: "Herr",
|
|
58
|
+
gender: "m",
|
|
59
|
+
telephonenumber: "01752345678",
|
|
60
|
+
ip: "127.0.0.1",
|
|
61
|
+
language: "de",
|
|
62
|
+
customer_is_present: "yes"
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
Object.entries(defaults).forEach(([key, value]) => {
|
|
66
|
+
if (!requestParams[key]) {
|
|
67
|
+
requestParams[key] = value;
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
if (requestParams.clearingtype === "wlt" && requestParams.cardtype) {
|
|
72
|
+
delete requestParams.cardtype;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (requestParams.clearingtype === "wlt" && !requestParams.wallettype) {
|
|
76
|
+
if (requestParams["add_paydata[paymentmethod_token_data]"]) {
|
|
77
|
+
requestParams.wallettype = "GGP";
|
|
78
|
+
} else {
|
|
79
|
+
requestParams.wallettype = "PPE";
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return requestParams;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
const toFormData = (requestParams) => {
|
|
87
|
+
const formData = new URLSearchParams();
|
|
88
|
+
for (const [key, value] of Object.entries(requestParams)) {
|
|
89
|
+
if (value !== undefined && value !== null) {
|
|
90
|
+
formData.append(key, value);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return formData;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Checks if the request is viable for 3DS according to the settings
|
|
98
|
+
*
|
|
99
|
+
* @param params - Request params
|
|
100
|
+
* @param settings - Set up in admin
|
|
101
|
+
* @returns
|
|
102
|
+
*/
|
|
103
|
+
const is3dsViable = (params, settings) => {
|
|
104
|
+
const isCreditCard = params.clearingtype === "cc";
|
|
105
|
+
const enable3DSecure = settings.enable3DSecure !== false;
|
|
106
|
+
|
|
107
|
+
return isCreditCard && enable3DSecure && (params.request === "preauthorization" || params.request === "authorization")
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
module.exports = {
|
|
111
|
+
buildClientRequestParams,
|
|
112
|
+
toFormData,
|
|
113
|
+
is3dsViable
|
|
114
|
+
};
|
|
115
|
+
|
|
@@ -1,141 +1,141 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Parse Payone API response
|
|
5
|
-
* @param {string|Object} responseText - Response text or object
|
|
6
|
-
* @param {Object} logger - Logger instance
|
|
7
|
-
* @returns {Object} Parsed response
|
|
8
|
-
*/
|
|
9
|
-
const parseResponse = (responseText, logger) => {
|
|
10
|
-
try {
|
|
11
|
-
if (typeof responseText === "object") {
|
|
12
|
-
return responseText;
|
|
13
|
-
}
|
|
14
|
-
if (responseText.trim().startsWith("{")) {
|
|
15
|
-
return JSON.parse(responseText);
|
|
16
|
-
}
|
|
17
|
-
} catch (e) {
|
|
18
|
-
if (logger) {
|
|
19
|
-
logger.error("Payone parseResponse error:", e);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const params = new URLSearchParams(responseText);
|
|
24
|
-
const response = {};
|
|
25
|
-
for (const [key, value] of params) {
|
|
26
|
-
response[key.toLowerCase()] = value;
|
|
27
|
-
response[key] = value;
|
|
28
|
-
|
|
29
|
-
if (key.includes('add_paydata') || key.includes('addPaydata')) {
|
|
30
|
-
// Store with original key format
|
|
31
|
-
response[key] = value;
|
|
32
|
-
// Also try normalized versions
|
|
33
|
-
const normalizedKey = key.replace(/\[/g, '_').replace(/\]/g, '');
|
|
34
|
-
response[normalizedKey] = value;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
return response;
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Extract transaction ID from response
|
|
42
|
-
* @param {Object} data - Response data
|
|
43
|
-
* @returns {string|null} Transaction ID
|
|
44
|
-
*/
|
|
45
|
-
const extractTxId = (data) => {
|
|
46
|
-
return (
|
|
47
|
-
data.txid ||
|
|
48
|
-
data.TxId ||
|
|
49
|
-
data.tx_id ||
|
|
50
|
-
data.transactionid ||
|
|
51
|
-
data.transaction_id ||
|
|
52
|
-
data.id ||
|
|
53
|
-
null
|
|
54
|
-
);
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Check if response requires 3D Secure redirect
|
|
59
|
-
* @param {Object} data - Response data
|
|
60
|
-
* @returns {boolean} True if 3DS redirect is required
|
|
61
|
-
*/
|
|
62
|
-
const requires3DSRedirect = (data) => {
|
|
63
|
-
const status = (data.status || data.Status || "").toUpperCase();
|
|
64
|
-
const errorCode = data.errorcode || data.ErrorCode || data.Error?.ErrorCode;
|
|
65
|
-
|
|
66
|
-
// Check for redirect URL in various possible fields
|
|
67
|
-
const redirecturl =
|
|
68
|
-
data.redirecturl ||
|
|
69
|
-
data.RedirectUrl ||
|
|
70
|
-
data.redirect_url ||
|
|
71
|
-
data.redirectUrl ||
|
|
72
|
-
data.RedirectURL ||
|
|
73
|
-
data.redirectURL ||
|
|
74
|
-
data.url ||
|
|
75
|
-
data.Url ||
|
|
76
|
-
data.URL ||
|
|
77
|
-
null;
|
|
78
|
-
|
|
79
|
-
// 3DS required error codes (4219, etc.)
|
|
80
|
-
const requires3DSErrorCodes = ["4219", 4219];
|
|
81
|
-
const is3DSRequiredError = requires3DSErrorCodes.includes(errorCode);
|
|
82
|
-
|
|
83
|
-
return (status === "REDIRECT" && !!redirecturl) || is3DSRequiredError;
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Check if response indicates an error
|
|
88
|
-
* @param {Object} data - Response data
|
|
89
|
-
* @returns {boolean} True if response indicates error
|
|
90
|
-
*/
|
|
91
|
-
const isErrorResponse = (data) => {
|
|
92
|
-
const status = (data.status || data.Status || "").toUpperCase();
|
|
93
|
-
const errorCode = data.errorcode || data.ErrorCode || data.Error?.ErrorCode;
|
|
94
|
-
|
|
95
|
-
return status === "ERROR" || status === "INVALID" || !!errorCode;
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Extract 3D Secure redirect URL from response
|
|
100
|
-
* @param {Object} data - Response data
|
|
101
|
-
* @returns {string|null} Redirect URL
|
|
102
|
-
*/
|
|
103
|
-
const get3DSRedirectUrl = (data) => {
|
|
104
|
-
// Check all possible redirect URL fields
|
|
105
|
-
const redirecturl =
|
|
106
|
-
data.redirecturl ||
|
|
107
|
-
data.RedirectUrl ||
|
|
108
|
-
data.redirect_url ||
|
|
109
|
-
data.redirectUrl ||
|
|
110
|
-
data.RedirectURL ||
|
|
111
|
-
data.redirectURL ||
|
|
112
|
-
data.url ||
|
|
113
|
-
data.Url ||
|
|
114
|
-
data.URL ||
|
|
115
|
-
data.redirect ||
|
|
116
|
-
data.Redirect ||
|
|
117
|
-
null;
|
|
118
|
-
|
|
119
|
-
if (redirecturl) {
|
|
120
|
-
return redirecturl;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
// If 3DS required but no redirect URL, might need 3dscheck
|
|
124
|
-
const errorCode = data.errorcode || data.ErrorCode || data.Error?.ErrorCode;
|
|
125
|
-
const requires3DSErrorCodes = ["4219", 4219];
|
|
126
|
-
if (requires3DSErrorCodes.includes(errorCode)) {
|
|
127
|
-
// Return null - will need to handle 3dscheck separately
|
|
128
|
-
return null;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
return null;
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
module.exports = {
|
|
135
|
-
parseResponse,
|
|
136
|
-
extractTxId,
|
|
137
|
-
requires3DSRedirect,
|
|
138
|
-
get3DSRedirectUrl,
|
|
139
|
-
isErrorResponse
|
|
140
|
-
};
|
|
141
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Parse Payone API response
|
|
5
|
+
* @param {string|Object} responseText - Response text or object
|
|
6
|
+
* @param {Object} logger - Logger instance
|
|
7
|
+
* @returns {Object} Parsed response
|
|
8
|
+
*/
|
|
9
|
+
const parseResponse = (responseText, logger) => {
|
|
10
|
+
try {
|
|
11
|
+
if (typeof responseText === "object") {
|
|
12
|
+
return responseText;
|
|
13
|
+
}
|
|
14
|
+
if (responseText.trim().startsWith("{")) {
|
|
15
|
+
return JSON.parse(responseText);
|
|
16
|
+
}
|
|
17
|
+
} catch (e) {
|
|
18
|
+
if (logger) {
|
|
19
|
+
logger.error("Payone parseResponse error:", e);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const params = new URLSearchParams(responseText);
|
|
24
|
+
const response = {};
|
|
25
|
+
for (const [key, value] of params) {
|
|
26
|
+
response[key.toLowerCase()] = value;
|
|
27
|
+
response[key] = value;
|
|
28
|
+
|
|
29
|
+
if (key.includes('add_paydata') || key.includes('addPaydata')) {
|
|
30
|
+
// Store with original key format
|
|
31
|
+
response[key] = value;
|
|
32
|
+
// Also try normalized versions
|
|
33
|
+
const normalizedKey = key.replace(/\[/g, '_').replace(/\]/g, '');
|
|
34
|
+
response[normalizedKey] = value;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return response;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Extract transaction ID from response
|
|
42
|
+
* @param {Object} data - Response data
|
|
43
|
+
* @returns {string|null} Transaction ID
|
|
44
|
+
*/
|
|
45
|
+
const extractTxId = (data) => {
|
|
46
|
+
return (
|
|
47
|
+
data.txid ||
|
|
48
|
+
data.TxId ||
|
|
49
|
+
data.tx_id ||
|
|
50
|
+
data.transactionid ||
|
|
51
|
+
data.transaction_id ||
|
|
52
|
+
data.id ||
|
|
53
|
+
null
|
|
54
|
+
);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Check if response requires 3D Secure redirect
|
|
59
|
+
* @param {Object} data - Response data
|
|
60
|
+
* @returns {boolean} True if 3DS redirect is required
|
|
61
|
+
*/
|
|
62
|
+
const requires3DSRedirect = (data) => {
|
|
63
|
+
const status = (data.status || data.Status || "").toUpperCase();
|
|
64
|
+
const errorCode = data.errorcode || data.ErrorCode || data.Error?.ErrorCode;
|
|
65
|
+
|
|
66
|
+
// Check for redirect URL in various possible fields
|
|
67
|
+
const redirecturl =
|
|
68
|
+
data.redirecturl ||
|
|
69
|
+
data.RedirectUrl ||
|
|
70
|
+
data.redirect_url ||
|
|
71
|
+
data.redirectUrl ||
|
|
72
|
+
data.RedirectURL ||
|
|
73
|
+
data.redirectURL ||
|
|
74
|
+
data.url ||
|
|
75
|
+
data.Url ||
|
|
76
|
+
data.URL ||
|
|
77
|
+
null;
|
|
78
|
+
|
|
79
|
+
// 3DS required error codes (4219, etc.)
|
|
80
|
+
const requires3DSErrorCodes = ["4219", 4219];
|
|
81
|
+
const is3DSRequiredError = requires3DSErrorCodes.includes(errorCode);
|
|
82
|
+
|
|
83
|
+
return (status === "REDIRECT" && !!redirecturl) || is3DSRequiredError;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Check if response indicates an error
|
|
88
|
+
* @param {Object} data - Response data
|
|
89
|
+
* @returns {boolean} True if response indicates error
|
|
90
|
+
*/
|
|
91
|
+
const isErrorResponse = (data) => {
|
|
92
|
+
const status = (data.status || data.Status || "").toUpperCase();
|
|
93
|
+
const errorCode = data.errorcode || data.ErrorCode || data.Error?.ErrorCode;
|
|
94
|
+
|
|
95
|
+
return status === "ERROR" || status === "INVALID" || !!errorCode;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Extract 3D Secure redirect URL from response
|
|
100
|
+
* @param {Object} data - Response data
|
|
101
|
+
* @returns {string|null} Redirect URL
|
|
102
|
+
*/
|
|
103
|
+
const get3DSRedirectUrl = (data) => {
|
|
104
|
+
// Check all possible redirect URL fields
|
|
105
|
+
const redirecturl =
|
|
106
|
+
data.redirecturl ||
|
|
107
|
+
data.RedirectUrl ||
|
|
108
|
+
data.redirect_url ||
|
|
109
|
+
data.redirectUrl ||
|
|
110
|
+
data.RedirectURL ||
|
|
111
|
+
data.redirectURL ||
|
|
112
|
+
data.url ||
|
|
113
|
+
data.Url ||
|
|
114
|
+
data.URL ||
|
|
115
|
+
data.redirect ||
|
|
116
|
+
data.Redirect ||
|
|
117
|
+
null;
|
|
118
|
+
|
|
119
|
+
if (redirecturl) {
|
|
120
|
+
return redirecturl;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// If 3DS required but no redirect URL, might need 3dscheck
|
|
124
|
+
const errorCode = data.errorcode || data.ErrorCode || data.Error?.ErrorCode;
|
|
125
|
+
const requires3DSErrorCodes = ["4219", 4219];
|
|
126
|
+
if (requires3DSErrorCodes.includes(errorCode)) {
|
|
127
|
+
// Return null - will need to handle 3dscheck separately
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
return null;
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
module.exports = {
|
|
135
|
+
parseResponse,
|
|
136
|
+
extractTxId,
|
|
137
|
+
requires3DSRedirect,
|
|
138
|
+
get3DSRedirectUrl,
|
|
139
|
+
isErrorResponse
|
|
140
|
+
};
|
|
141
|
+
|
package/strapi-admin.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import admin from "./admin/src";
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import admin from "./admin/src";
|
|
4
|
+
|
|
5
5
|
export default admin;
|
package/strapi-server.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
module.exports = require("./server");
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
module.exports = require("./server");
|