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,223 +1,264 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const axios = require("axios");
|
|
4
|
-
const { buildClientRequestParams, toFormData } = require("../utils/requestBuilder");
|
|
5
|
-
const { addPaymentMethodParams } = require("../utils/paymentMethodParams");
|
|
6
|
-
const { parseResponse, extractTxId, requires3DSRedirect, get3DSRedirectUrl } = require("../utils/responseParser");
|
|
7
|
-
const { getSettings, validateSettings } = require("./settingsService");
|
|
8
|
-
const { logTransaction } = require("./transactionService");
|
|
9
|
-
|
|
10
|
-
const POST_GATEWAY_URL = "https://api.pay1.de/post-gateway/";
|
|
11
|
-
|
|
12
|
-
const getInvoiceIdObject = (invoiceid) => {
|
|
13
|
-
if (!invoiceid || typeof invoiceid !== 'string') {
|
|
14
|
-
return null;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const invoiceIdVariants = [
|
|
18
|
-
'invoiceid',
|
|
19
|
-
'invoiceId',
|
|
20
|
-
'invoice_id',
|
|
21
|
-
'invoiceID',
|
|
22
|
-
'InvoiceId',
|
|
23
|
-
'InvoiceID',
|
|
24
|
-
'Invoice_Id',
|
|
25
|
-
'INVOICEID',
|
|
26
|
-
'INVOICE_ID'
|
|
27
|
-
];
|
|
28
|
-
|
|
29
|
-
let invoiceIdObject = {}
|
|
30
|
-
for (const variant of invoiceIdVariants) {
|
|
31
|
-
invoiceIdObject[variant] = invoiceid;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return invoiceIdObject;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
const sendRequest = async (strapi, params) => {
|
|
38
|
-
try {
|
|
39
|
-
const settings = await getSettings(strapi);
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
responseData
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
...params
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
throw new Error(
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const axios = require("axios");
|
|
4
|
+
const { buildClientRequestParams, toFormData, is3dsViable } = require("../utils/requestBuilder");
|
|
5
|
+
const { addPaymentMethodParams } = require("../utils/paymentMethodParams");
|
|
6
|
+
const { parseResponse, extractTxId, requires3DSRedirect, get3DSRedirectUrl } = require("../utils/responseParser");
|
|
7
|
+
const { getSettings, validateSettings } = require("./settingsService");
|
|
8
|
+
const { logTransaction } = require("./transactionService");
|
|
9
|
+
|
|
10
|
+
const POST_GATEWAY_URL = "https://api.pay1.de/post-gateway/";
|
|
11
|
+
|
|
12
|
+
const getInvoiceIdObject = (invoiceid) => {
|
|
13
|
+
if (!invoiceid || typeof invoiceid !== 'string') {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const invoiceIdVariants = [
|
|
18
|
+
'invoiceid',
|
|
19
|
+
'invoiceId',
|
|
20
|
+
'invoice_id',
|
|
21
|
+
'invoiceID',
|
|
22
|
+
'InvoiceId',
|
|
23
|
+
'InvoiceID',
|
|
24
|
+
'Invoice_Id',
|
|
25
|
+
'INVOICEID',
|
|
26
|
+
'INVOICE_ID'
|
|
27
|
+
];
|
|
28
|
+
|
|
29
|
+
let invoiceIdObject = {}
|
|
30
|
+
for (const variant of invoiceIdVariants) {
|
|
31
|
+
invoiceIdObject[variant] = invoiceid;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return invoiceIdObject;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const sendRequest = async (strapi, params) => {
|
|
38
|
+
try {
|
|
39
|
+
const settings = await getSettings(strapi);
|
|
40
|
+
if (!validateSettings(settings)) throw new Error("Payone settings not configured");
|
|
41
|
+
|
|
42
|
+
const requestParams = buildClientRequestParams(settings, params, strapi.log);
|
|
43
|
+
|
|
44
|
+
const formData = toFormData(requestParams);
|
|
45
|
+
const response = await axios.post(POST_GATEWAY_URL, formData, {
|
|
46
|
+
headers: { "Content-Type": "application/x-www-form-urlencoded" },
|
|
47
|
+
timeout: 30000
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const responseData = parseResponse(response.data, strapi.log);
|
|
51
|
+
const errorCode = responseData?.Error?.ErrorCode;
|
|
52
|
+
const requires3DSErrorCodes = ["4219", 4219];
|
|
53
|
+
const is3DSRequiredError = requires3DSErrorCodes.includes(errorCode);
|
|
54
|
+
|
|
55
|
+
if (requires3DSRedirect(responseData) || is3DSRequiredError) {
|
|
56
|
+
const redirectUrl = get3DSRedirectUrl(responseData);
|
|
57
|
+
responseData.requires3DSRedirect = true;
|
|
58
|
+
responseData.redirectUrl = redirectUrl;
|
|
59
|
+
responseData.is3DSRequired = is3DSRequiredError;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const errorMessage = responseData?.Error?.ErrorMessage || null;
|
|
63
|
+
|
|
64
|
+
const customerMessage = responseData?.Error?.CustomerMessage || null;
|
|
65
|
+
|
|
66
|
+
const status = (responseData?.status || responseData?.Status || "unknown").toUpperCase() || null;
|
|
67
|
+
|
|
68
|
+
await logTransaction(strapi, {
|
|
69
|
+
txid: extractTxId(responseData) || params.txid || null,
|
|
70
|
+
reference: params.reference || null,
|
|
71
|
+
status: status,
|
|
72
|
+
request_type: params.request,
|
|
73
|
+
amount: params.amount || null,
|
|
74
|
+
currency: params.currency || "EUR",
|
|
75
|
+
raw_request: requestParams,
|
|
76
|
+
raw_response: responseData,
|
|
77
|
+
error_code: errorCode,
|
|
78
|
+
error_message: errorMessage,
|
|
79
|
+
customer_message: customerMessage
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
responseData.errorCode = errorCode;
|
|
83
|
+
responseData.errorMessage = errorMessage;
|
|
84
|
+
responseData.customerMessage = customerMessage;
|
|
85
|
+
responseData.status = status;
|
|
86
|
+
|
|
87
|
+
return responseData;
|
|
88
|
+
} catch (error) {
|
|
89
|
+
strapi.log.error("Payone sendRequest error:", error);
|
|
90
|
+
throw error;
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
const preauthorization = async (strapi, params) => {
|
|
95
|
+
const requestParams = {
|
|
96
|
+
request: "preauthorization",
|
|
97
|
+
clearingtype: params.clearingtype,
|
|
98
|
+
amount: params.amount,
|
|
99
|
+
currency: params.currency,
|
|
100
|
+
reference: params.reference,
|
|
101
|
+
firstname: params.firstname,
|
|
102
|
+
lastname: params.lastname,
|
|
103
|
+
street: params.street,
|
|
104
|
+
zip: params.zip,
|
|
105
|
+
city: params.city,
|
|
106
|
+
country: params.country,
|
|
107
|
+
email: params.email,
|
|
108
|
+
narrative_text: params.narrative_text,
|
|
109
|
+
...getInvoiceIdObject(params.invoiceid),
|
|
110
|
+
...params
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
const settings = await getSettings(strapi);
|
|
114
|
+
|
|
115
|
+
// Happnes only when CC-payment and 3DS is enabled and is Pre/Authorization request
|
|
116
|
+
if (is3dsViable(params, settings)) {
|
|
117
|
+
requestParams = await perform3DSCheck(strapi, requestParams);
|
|
118
|
+
if (!requestParams) throw new Error('3DS check failed');
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
requestParams = addPaymentMethodParams(requestParams, strapi.log);
|
|
122
|
+
return await sendRequest(strapi, requestParams);
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
const authorization = async (strapi, params) => {
|
|
126
|
+
let requestParams = {
|
|
127
|
+
request: "authorization",
|
|
128
|
+
clearingtype: params.clearingtype,
|
|
129
|
+
reference: params.reference,
|
|
130
|
+
firstname: params.firstname,
|
|
131
|
+
lastname: params.lastname,
|
|
132
|
+
street: params.street,
|
|
133
|
+
zip: params.zip,
|
|
134
|
+
city: params.city,
|
|
135
|
+
country: params.country,
|
|
136
|
+
email: params.email,
|
|
137
|
+
narrative_text: params.narrative_text,
|
|
138
|
+
...getInvoiceIdObject(params.invoiceid),
|
|
139
|
+
...params
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
const settings = await getSettings(strapi);
|
|
143
|
+
|
|
144
|
+
// Happnes only when CC-payment and 3DS is enabled and is Pre/Authorization request
|
|
145
|
+
if (is3dsViable(params, settings)) {
|
|
146
|
+
requestParams = await perform3DSCheck(strapi, requestParams);
|
|
147
|
+
if (!requestParams) throw new Error('3DS check failed');
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
requestParams = addPaymentMethodParams(requestParams, strapi.log);
|
|
151
|
+
return await sendRequest(strapi, requestParams);
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
const capture = async (strapi, params) => {
|
|
155
|
+
if (!params.txid) {
|
|
156
|
+
throw new Error("Transaction ID (txid) is required for capture");
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
const requiredParams = {
|
|
160
|
+
request: "capture",
|
|
161
|
+
txid: params.txid,
|
|
162
|
+
amount: params.amount || 1000,
|
|
163
|
+
currency: params.currency || "EUR",
|
|
164
|
+
...getInvoiceIdObject(params.invoiceid),
|
|
165
|
+
...params
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
return await sendRequest(strapi, requiredParams);
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
const refund = async (strapi, params) => {
|
|
172
|
+
if (!params.txid) {
|
|
173
|
+
throw new Error("Transaction ID (txid) is required for refund");
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
const requiredParams = {
|
|
177
|
+
request: "refund",
|
|
178
|
+
txid: params.txid,
|
|
179
|
+
amount: params.amount || 1000,
|
|
180
|
+
currency: params.currency || "EUR",
|
|
181
|
+
reference: params.reference || `REFUND-${Date.now()}`,
|
|
182
|
+
...getInvoiceIdObject(params.invoiceid),
|
|
183
|
+
...params
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
return await sendRequest(strapi, requiredParams);
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Performs a 3DS check and returns the modified params
|
|
191
|
+
* The modified params include the pseudocardpan if the 3DS check is valid
|
|
192
|
+
*
|
|
193
|
+
* @param strapi - Strapi instance
|
|
194
|
+
* @param params - Request params
|
|
195
|
+
* @returns The modified params
|
|
196
|
+
*/
|
|
197
|
+
const perform3DSCheck = async (strapi, params) => {
|
|
198
|
+
try {
|
|
199
|
+
const result = await sendRequest(strapi, {
|
|
200
|
+
...params,
|
|
201
|
+
request: "3dscheck",
|
|
202
|
+
exiturl: params.successurl ?? '',
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
if (result?.errorCode || result?.errorMessage || result?.Status === 'Failed' || result?.Status === 'Invalid')
|
|
206
|
+
throw new Error('3DS check failed');
|
|
207
|
+
|
|
208
|
+
const modifiedParams = {
|
|
209
|
+
...params,
|
|
210
|
+
pseudocardpan: result?.CreditCard?.PseudoCardPan,
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
if (result?.Status === 'Valid') modifiedParams.xid = result?.CreditCard?.ThreeDS?.Xid;
|
|
214
|
+
|
|
215
|
+
return modifiedParams;
|
|
216
|
+
} catch (error) {
|
|
217
|
+
strapi.log.error("3DS check error:", error);
|
|
218
|
+
return null;
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
const handle3DSCallback = async (strapi, callbackData, resultType = 'callback') => {
|
|
223
|
+
try {
|
|
224
|
+
const parsedData = callbackData && Object.keys(callbackData).length > 0
|
|
225
|
+
? parseResponse(callbackData, strapi.log)
|
|
226
|
+
: {};
|
|
227
|
+
|
|
228
|
+
const txid = extractTxId(parsedData);
|
|
229
|
+
const reference = parsedData.reference || parsedData.Reference || null;
|
|
230
|
+
|
|
231
|
+
let status;
|
|
232
|
+
if (resultType === 'success') {
|
|
233
|
+
status = 'APPROVED';
|
|
234
|
+
} else if (resultType === 'error') {
|
|
235
|
+
status = 'ERROR';
|
|
236
|
+
} else if (resultType === 'cancelled') {
|
|
237
|
+
status = 'CANCELLED';
|
|
238
|
+
} else {
|
|
239
|
+
status = parsedData.status || parsedData.Status || 'PENDING';
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
return {
|
|
243
|
+
success: resultType === 'success',
|
|
244
|
+
status: status,
|
|
245
|
+
txid: txid,
|
|
246
|
+
reference: reference,
|
|
247
|
+
data: parsedData
|
|
248
|
+
};
|
|
249
|
+
} catch (error) {
|
|
250
|
+
strapi.log.error("3DS callback processing error:", error);
|
|
251
|
+
throw error;
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
module.exports = {
|
|
256
|
+
sendRequest,
|
|
257
|
+
preauthorization,
|
|
258
|
+
authorization,
|
|
259
|
+
capture,
|
|
260
|
+
refund,
|
|
261
|
+
handle3DSCallback,
|
|
262
|
+
perform3DSCheck
|
|
263
|
+
};
|
|
264
|
+
|
|
@@ -1,78 +1,78 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const settingsService = require("./settingsService");
|
|
4
|
-
const transactionService = require("./transactionService");
|
|
5
|
-
const paymentService = require("./paymentService");
|
|
6
|
-
const testConnectionService = require("./testConnectionService");
|
|
7
|
-
const applePayService = require("./applePayService");
|
|
8
|
-
const transactionStatusService = require("./transactionStatusService");
|
|
9
|
-
|
|
10
|
-
module.exports = ({ strapi }) => ({
|
|
11
|
-
// Settings
|
|
12
|
-
async getSettings() {
|
|
13
|
-
return await settingsService.getSettings(strapi);
|
|
14
|
-
},
|
|
15
|
-
|
|
16
|
-
async updateSettings(settings) {
|
|
17
|
-
return await settingsService.updateSettings(strapi, settings);
|
|
18
|
-
},
|
|
19
|
-
|
|
20
|
-
async preauthorization(params) {
|
|
21
|
-
return await paymentService.preauthorization(strapi, params);
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
async authorization(params) {
|
|
25
|
-
return await paymentService.authorization(strapi, params);
|
|
26
|
-
},
|
|
27
|
-
|
|
28
|
-
async capture(params) {
|
|
29
|
-
return await paymentService.capture(strapi, params);
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
async refund(params) {
|
|
33
|
-
return await paymentService.refund(strapi, params);
|
|
34
|
-
},
|
|
35
|
-
|
|
36
|
-
// Transaction history
|
|
37
|
-
async logTransaction(transactionData) {
|
|
38
|
-
return await transactionService.logTransaction(strapi, transactionData);
|
|
39
|
-
},
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
async getTransactionHistory({ filters = {}, pagination = {} }) {
|
|
43
|
-
return await transactionService.getTransactionHistory(strapi, { filters, pagination });
|
|
44
|
-
},
|
|
45
|
-
|
|
46
|
-
async getTransactionsForExport({ filters = {}, sort_by, sort_order } = {}) {
|
|
47
|
-
return await transactionService.getTransactionsForExport(strapi, { filters, sort_by, sort_order });
|
|
48
|
-
},
|
|
49
|
-
|
|
50
|
-
async importTransactions(rows) {
|
|
51
|
-
return await transactionService.importTransactions(strapi, rows);
|
|
52
|
-
},
|
|
53
|
-
|
|
54
|
-
// Test connection
|
|
55
|
-
async testConnection() {
|
|
56
|
-
return await testConnectionService.testConnection(strapi);
|
|
57
|
-
},
|
|
58
|
-
|
|
59
|
-
// 3D Secure callback handler
|
|
60
|
-
async handle3DSCallback(callbackData, resultType) {
|
|
61
|
-
return await paymentService.handle3DSCallback(strapi, callbackData, resultType);
|
|
62
|
-
},
|
|
63
|
-
|
|
64
|
-
// Apple Pay
|
|
65
|
-
async validateApplePayMerchant(params) {
|
|
66
|
-
return await applePayService.validateApplePayMerchant(strapi, params);
|
|
67
|
-
},
|
|
68
|
-
|
|
69
|
-
async initializeApplePaySession(params) {
|
|
70
|
-
return await applePayService.initializeApplePaySession(strapi, params);
|
|
71
|
-
},
|
|
72
|
-
|
|
73
|
-
// TransactionStatus Notification
|
|
74
|
-
async processTransactionStatus(notificationData) {
|
|
75
|
-
return await transactionStatusService.processTransactionStatus(strapi, notificationData);
|
|
76
|
-
},
|
|
77
|
-
|
|
78
|
-
});
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const settingsService = require("./settingsService");
|
|
4
|
+
const transactionService = require("./transactionService");
|
|
5
|
+
const paymentService = require("./paymentService");
|
|
6
|
+
const testConnectionService = require("./testConnectionService");
|
|
7
|
+
const applePayService = require("./applePayService");
|
|
8
|
+
const transactionStatusService = require("./transactionStatusService");
|
|
9
|
+
|
|
10
|
+
module.exports = ({ strapi }) => ({
|
|
11
|
+
// Settings
|
|
12
|
+
async getSettings() {
|
|
13
|
+
return await settingsService.getSettings(strapi);
|
|
14
|
+
},
|
|
15
|
+
|
|
16
|
+
async updateSettings(settings) {
|
|
17
|
+
return await settingsService.updateSettings(strapi, settings);
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
async preauthorization(params) {
|
|
21
|
+
return await paymentService.preauthorization(strapi, params);
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
async authorization(params) {
|
|
25
|
+
return await paymentService.authorization(strapi, params);
|
|
26
|
+
},
|
|
27
|
+
|
|
28
|
+
async capture(params) {
|
|
29
|
+
return await paymentService.capture(strapi, params);
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
async refund(params) {
|
|
33
|
+
return await paymentService.refund(strapi, params);
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
// Transaction history
|
|
37
|
+
async logTransaction(transactionData) {
|
|
38
|
+
return await transactionService.logTransaction(strapi, transactionData);
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
async getTransactionHistory({ filters = {}, pagination = {} }) {
|
|
43
|
+
return await transactionService.getTransactionHistory(strapi, { filters, pagination });
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
async getTransactionsForExport({ filters = {}, sort_by, sort_order } = {}) {
|
|
47
|
+
return await transactionService.getTransactionsForExport(strapi, { filters, sort_by, sort_order });
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
async importTransactions(rows) {
|
|
51
|
+
return await transactionService.importTransactions(strapi, rows);
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
// Test connection
|
|
55
|
+
async testConnection() {
|
|
56
|
+
return await testConnectionService.testConnection(strapi);
|
|
57
|
+
},
|
|
58
|
+
|
|
59
|
+
// 3D Secure callback handler
|
|
60
|
+
async handle3DSCallback(callbackData, resultType) {
|
|
61
|
+
return await paymentService.handle3DSCallback(strapi, callbackData, resultType);
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
// Apple Pay
|
|
65
|
+
async validateApplePayMerchant(params) {
|
|
66
|
+
return await applePayService.validateApplePayMerchant(strapi, params);
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
async initializeApplePaySession(params) {
|
|
70
|
+
return await applePayService.initializeApplePaySession(strapi, params);
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
// TransactionStatus Notification
|
|
74
|
+
async processTransactionStatus(notificationData) {
|
|
75
|
+
return await transactionStatusService.processTransactionStatus(strapi, notificationData);
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
});
|