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,59 +1,59 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const PLUGIN_NAME = "strapi-plugin-payone-provider";
|
|
4
|
-
|
|
5
|
-
const getPluginStore = (strapi) => {
|
|
6
|
-
return strapi.store({
|
|
7
|
-
environment: "",
|
|
8
|
-
type: "plugin",
|
|
9
|
-
name: PLUGIN_NAME
|
|
10
|
-
});
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
const getSettings = async (strapi) => {
|
|
14
|
-
const pluginStore = getPluginStore(strapi);
|
|
15
|
-
const settings = await pluginStore.get({ key: "settings" }) || {};
|
|
16
|
-
|
|
17
|
-
return settings;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
const updateSettings = async (strapi, settings) => {
|
|
21
|
-
const pluginStore = getPluginStore(strapi);
|
|
22
|
-
const currentSettings = await getSettings(strapi) || {};
|
|
23
|
-
const mergedSettings = {
|
|
24
|
-
...currentSettings,
|
|
25
|
-
...settings
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
await pluginStore.set({
|
|
30
|
-
key: "settings",
|
|
31
|
-
value: mergedSettings
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
return mergedSettings;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
const validateSettings = (settings) => {
|
|
38
|
-
// Legacy post-gateway (PAY1): requires aid/portalid/key
|
|
39
|
-
const hasPostGateway = !!(settings && settings.aid && settings.portalid && settings.key);
|
|
40
|
-
|
|
41
|
-
// PAYONE Server API (Hosted Tokenization / REST): requires merchantId + apiKeyId + apiSecret
|
|
42
|
-
const hasServerApi = !!(
|
|
43
|
-
settings &&
|
|
44
|
-
(settings.serverApiMerchantId || settings.mid) &&
|
|
45
|
-
settings.serverApiKeyId &&
|
|
46
|
-
settings.serverApiSecret
|
|
47
|
-
);
|
|
48
|
-
|
|
49
|
-
return hasPostGateway || hasServerApi;
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
module.exports = {
|
|
53
|
-
getSettings,
|
|
54
|
-
updateSettings,
|
|
55
|
-
validateSettings,
|
|
56
|
-
getPluginStore,
|
|
57
|
-
PLUGIN_NAME
|
|
58
|
-
};
|
|
59
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const PLUGIN_NAME = "strapi-plugin-payone-provider";
|
|
4
|
+
|
|
5
|
+
const getPluginStore = (strapi) => {
|
|
6
|
+
return strapi.store({
|
|
7
|
+
environment: "",
|
|
8
|
+
type: "plugin",
|
|
9
|
+
name: PLUGIN_NAME
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const getSettings = async (strapi) => {
|
|
14
|
+
const pluginStore = getPluginStore(strapi);
|
|
15
|
+
const settings = await pluginStore.get({ key: "settings" }) || {};
|
|
16
|
+
|
|
17
|
+
return settings;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const updateSettings = async (strapi, settings) => {
|
|
21
|
+
const pluginStore = getPluginStore(strapi);
|
|
22
|
+
const currentSettings = await getSettings(strapi) || {};
|
|
23
|
+
const mergedSettings = {
|
|
24
|
+
...currentSettings,
|
|
25
|
+
...settings
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
await pluginStore.set({
|
|
30
|
+
key: "settings",
|
|
31
|
+
value: mergedSettings
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
return mergedSettings;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const validateSettings = (settings) => {
|
|
38
|
+
// Legacy post-gateway (PAY1): requires aid/portalid/key
|
|
39
|
+
const hasPostGateway = !!(settings && settings.aid && settings.portalid && settings.key);
|
|
40
|
+
|
|
41
|
+
// PAYONE Server API (Hosted Tokenization / REST): requires merchantId + apiKeyId + apiSecret
|
|
42
|
+
const hasServerApi = !!(
|
|
43
|
+
settings &&
|
|
44
|
+
(settings.serverApiMerchantId || settings.mid) &&
|
|
45
|
+
settings.serverApiKeyId &&
|
|
46
|
+
settings.serverApiSecret
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
return hasPostGateway || hasServerApi;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
module.exports = {
|
|
53
|
+
getSettings,
|
|
54
|
+
updateSettings,
|
|
55
|
+
validateSettings,
|
|
56
|
+
getPluginStore,
|
|
57
|
+
PLUGIN_NAME
|
|
58
|
+
};
|
|
59
|
+
|
|
@@ -1,115 +1,115 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const axios = require("axios");
|
|
4
|
-
const { buildClientRequestParams, toFormData } = require("../utils/requestBuilder");
|
|
5
|
-
const { parseResponse } = require("../utils/responseParser");
|
|
6
|
-
const { getSettings, validateSettings } = require("./settingsService");
|
|
7
|
-
const { addPaymentMethodParams } = require("../utils/paymentMethodParams");
|
|
8
|
-
|
|
9
|
-
const POST_GATEWAY_URL = "https://api.pay1.de/post-gateway/";
|
|
10
|
-
|
|
11
|
-
const testConnection = async (strapi) => {
|
|
12
|
-
try {
|
|
13
|
-
const settings = await getSettings(strapi);
|
|
14
|
-
|
|
15
|
-
if (!validateSettings(settings)) {
|
|
16
|
-
return {
|
|
17
|
-
success: false,
|
|
18
|
-
message: "Payone settings not configured. Please fill in all required fields."
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const timestamp = Date.now();
|
|
23
|
-
const testParams = {
|
|
24
|
-
request: "authorization",
|
|
25
|
-
amount: 100,
|
|
26
|
-
currency: "EUR",
|
|
27
|
-
reference: `TEST-${timestamp}`,
|
|
28
|
-
clearingtype: "cc",
|
|
29
|
-
cardtype: "V",
|
|
30
|
-
cardpan: "4111111111111111",
|
|
31
|
-
cardcvc2: "123",
|
|
32
|
-
firstname: "Test",
|
|
33
|
-
lastname: "User",
|
|
34
|
-
street: "Test Street 1",
|
|
35
|
-
zip: "12345",
|
|
36
|
-
city: "Test City",
|
|
37
|
-
country: "DE",
|
|
38
|
-
email: "test@example.com",
|
|
39
|
-
salutation: "Herr",
|
|
40
|
-
gender: "m",
|
|
41
|
-
telephonenumber: "01752345678",
|
|
42
|
-
ip: "127.0.0.1",
|
|
43
|
-
customer_is_present: "yes",
|
|
44
|
-
language: "de"
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
const updatedParams = addPaymentMethodParams(testParams, strapi.log);
|
|
48
|
-
const requestParams = buildClientRequestParams(settings, updatedParams, strapi.log);
|
|
49
|
-
const formData = toFormData(requestParams);
|
|
50
|
-
|
|
51
|
-
const response = await axios.post(POST_GATEWAY_URL, formData, {
|
|
52
|
-
headers: { "Content-Type": "application/x-www-form-urlencoded" },
|
|
53
|
-
timeout: 30000
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
const result = parseResponse(response.data, strapi.log);
|
|
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;
|
|
61
|
-
|
|
62
|
-
if (status === "ERROR" || status === "error") {
|
|
63
|
-
return {
|
|
64
|
-
success: false,
|
|
65
|
-
message: `Test connection failed: ${errorCode}`,
|
|
66
|
-
error: {
|
|
67
|
-
ErrorCode: errorCode,
|
|
68
|
-
ErrorMessage: errorMessage,
|
|
69
|
-
CustomerMessage: customErrorMessage
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
if (status === "APPROVED" || status === "approved") {
|
|
75
|
-
return {
|
|
76
|
-
success: true,
|
|
77
|
-
message: "Connection successful! Your Payone credentials are valid.",
|
|
78
|
-
details: {
|
|
79
|
-
mode: settings.mode,
|
|
80
|
-
aid: settings.aid,
|
|
81
|
-
portalid: settings.portalid,
|
|
82
|
-
mid: settings.mid
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
return {
|
|
88
|
-
success: false,
|
|
89
|
-
message: "Unexpected response format from Payone API",
|
|
90
|
-
response: result,
|
|
91
|
-
details: {
|
|
92
|
-
status,
|
|
93
|
-
keys: Object.keys(result),
|
|
94
|
-
rawResponse: JSON.stringify(result).substring(0, 200)
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
} catch (error) {
|
|
99
|
-
strapi.log.error("Payone test connection error:", error);
|
|
100
|
-
return {
|
|
101
|
-
success: false,
|
|
102
|
-
message: `Test connection error: ${error.message || "Unknown error"}`,
|
|
103
|
-
error: error.toString(),
|
|
104
|
-
details: {
|
|
105
|
-
errorType: error.constructor.name,
|
|
106
|
-
stack: error.stack ? error.stack.substring(0, 200) : "No stack trace"
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
module.exports = {
|
|
113
|
-
testConnection
|
|
114
|
-
};
|
|
115
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const axios = require("axios");
|
|
4
|
+
const { buildClientRequestParams, toFormData } = require("../utils/requestBuilder");
|
|
5
|
+
const { parseResponse } = require("../utils/responseParser");
|
|
6
|
+
const { getSettings, validateSettings } = require("./settingsService");
|
|
7
|
+
const { addPaymentMethodParams } = require("../utils/paymentMethodParams");
|
|
8
|
+
|
|
9
|
+
const POST_GATEWAY_URL = "https://api.pay1.de/post-gateway/";
|
|
10
|
+
|
|
11
|
+
const testConnection = async (strapi) => {
|
|
12
|
+
try {
|
|
13
|
+
const settings = await getSettings(strapi);
|
|
14
|
+
|
|
15
|
+
if (!validateSettings(settings)) {
|
|
16
|
+
return {
|
|
17
|
+
success: false,
|
|
18
|
+
message: "Payone settings not configured. Please fill in all required fields."
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const timestamp = Date.now();
|
|
23
|
+
const testParams = {
|
|
24
|
+
request: "authorization",
|
|
25
|
+
amount: 100,
|
|
26
|
+
currency: "EUR",
|
|
27
|
+
reference: `TEST-${timestamp}`,
|
|
28
|
+
clearingtype: "cc",
|
|
29
|
+
cardtype: "V",
|
|
30
|
+
cardpan: "4111111111111111",
|
|
31
|
+
cardcvc2: "123",
|
|
32
|
+
firstname: "Test",
|
|
33
|
+
lastname: "User",
|
|
34
|
+
street: "Test Street 1",
|
|
35
|
+
zip: "12345",
|
|
36
|
+
city: "Test City",
|
|
37
|
+
country: "DE",
|
|
38
|
+
email: "test@example.com",
|
|
39
|
+
salutation: "Herr",
|
|
40
|
+
gender: "m",
|
|
41
|
+
telephonenumber: "01752345678",
|
|
42
|
+
ip: "127.0.0.1",
|
|
43
|
+
customer_is_present: "yes",
|
|
44
|
+
language: "de"
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const updatedParams = addPaymentMethodParams(testParams, strapi.log);
|
|
48
|
+
const requestParams = buildClientRequestParams(settings, updatedParams, strapi.log);
|
|
49
|
+
const formData = toFormData(requestParams);
|
|
50
|
+
|
|
51
|
+
const response = await axios.post(POST_GATEWAY_URL, formData, {
|
|
52
|
+
headers: { "Content-Type": "application/x-www-form-urlencoded" },
|
|
53
|
+
timeout: 30000
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
const result = parseResponse(response.data, strapi.log);
|
|
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;
|
|
61
|
+
|
|
62
|
+
if (status === "ERROR" || status === "error") {
|
|
63
|
+
return {
|
|
64
|
+
success: false,
|
|
65
|
+
message: `Test connection failed: ${errorCode}`,
|
|
66
|
+
error: {
|
|
67
|
+
ErrorCode: errorCode,
|
|
68
|
+
ErrorMessage: errorMessage,
|
|
69
|
+
CustomerMessage: customErrorMessage
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (status === "APPROVED" || status === "approved") {
|
|
75
|
+
return {
|
|
76
|
+
success: true,
|
|
77
|
+
message: "Connection successful! Your Payone credentials are valid.",
|
|
78
|
+
details: {
|
|
79
|
+
mode: settings.mode,
|
|
80
|
+
aid: settings.aid,
|
|
81
|
+
portalid: settings.portalid,
|
|
82
|
+
mid: settings.mid
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return {
|
|
88
|
+
success: false,
|
|
89
|
+
message: "Unexpected response format from Payone API",
|
|
90
|
+
response: result,
|
|
91
|
+
details: {
|
|
92
|
+
status,
|
|
93
|
+
keys: Object.keys(result),
|
|
94
|
+
rawResponse: JSON.stringify(result).substring(0, 200)
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
} catch (error) {
|
|
99
|
+
strapi.log.error("Payone test connection error:", error);
|
|
100
|
+
return {
|
|
101
|
+
success: false,
|
|
102
|
+
message: `Test connection error: ${error.message || "Unknown error"}`,
|
|
103
|
+
error: error.toString(),
|
|
104
|
+
details: {
|
|
105
|
+
errorType: error.constructor.name,
|
|
106
|
+
stack: error.stack ? error.stack.substring(0, 200) : "No stack trace"
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
module.exports = {
|
|
113
|
+
testConnection
|
|
114
|
+
};
|
|
115
|
+
|