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.
Files changed (83) hide show
  1. package/README.md +1191 -1191
  2. package/admin/src/components/Initializer/index.jsx +16 -16
  3. package/admin/src/components/PluginIcon/index.jsx +17 -17
  4. package/admin/src/index.js +57 -57
  5. package/admin/src/pages/App/components/AppHeader.jsx +45 -45
  6. package/admin/src/pages/App/components/AppTabs.jsx +105 -105
  7. package/admin/src/pages/App/components/ApplePayBtn.jsx +355 -355
  8. package/admin/src/pages/App/components/ApplePayConfig.jsx +357 -357
  9. package/admin/src/pages/App/components/DocsPanel.jsx +53 -53
  10. package/admin/src/pages/App/components/RenderInput.jsx +78 -78
  11. package/admin/src/pages/App/components/StatusBadge.jsx +87 -87
  12. package/admin/src/pages/App/components/icons/BankIcon.jsx +10 -10
  13. package/admin/src/pages/App/components/icons/ChevronDownIcon.jsx +9 -9
  14. package/admin/src/pages/App/components/icons/ChevronUpIcon.jsx +9 -9
  15. package/admin/src/pages/App/components/icons/CreditCardIcon.jsx +9 -9
  16. package/admin/src/pages/App/components/icons/ErrorIcon.jsx +10 -10
  17. package/admin/src/pages/App/components/icons/InfoIcon.jsx +9 -9
  18. package/admin/src/pages/App/components/icons/MarkCircle.jsx +19 -19
  19. package/admin/src/pages/App/components/icons/PaymentIcon.jsx +10 -10
  20. package/admin/src/pages/App/components/icons/PendingIcon.jsx +9 -9
  21. package/admin/src/pages/App/components/icons/PersonIcon.jsx +9 -9
  22. package/admin/src/pages/App/components/icons/SuccessIcon.jsx +9 -9
  23. package/admin/src/pages/App/components/icons/WalletIcon.jsx +9 -9
  24. package/admin/src/pages/App/components/icons/index.jsx +12 -12
  25. package/admin/src/pages/App/components/payment-actions/AuthorizationForm.jsx +334 -334
  26. package/admin/src/pages/App/components/payment-actions/CaptureForm.jsx +120 -120
  27. package/admin/src/pages/App/components/payment-actions/PaymentActionsPanel.jsx +183 -183
  28. package/admin/src/pages/App/components/payment-actions/PaymentMethodSelector.jsx +315 -315
  29. package/admin/src/pages/App/components/payment-actions/PaymentResult.jsx +129 -129
  30. package/admin/src/pages/App/components/payment-actions/PreauthorizationForm.jsx +273 -273
  31. package/admin/src/pages/App/components/payment-actions/RefundForm.jsx +114 -114
  32. package/admin/src/pages/App/components/transaction-history/ImportExportBar.jsx +153 -153
  33. package/admin/src/pages/App/components/transaction-history/details/TransactionHistoryItem.jsx +526 -526
  34. package/admin/src/pages/App/index.jsx +96 -96
  35. package/admin/src/pages/App/styles.css +176 -176
  36. package/admin/src/pages/constants/paymentConstants.js +71 -71
  37. package/admin/src/pages/hooks/use-system-theme.js +27 -27
  38. package/admin/src/pages/hooks/usePaymentActions.js +498 -498
  39. package/admin/src/pages/hooks/usePluginTranslations.js +12 -12
  40. package/admin/src/pages/hooks/useSettings.js +183 -183
  41. package/admin/src/pages/hooks/useTransactionHistory.js +148 -148
  42. package/admin/src/pages/utils/api.js +97 -97
  43. package/admin/src/pages/utils/applePayConstants.js +196 -196
  44. package/admin/src/pages/utils/formatTransactionData.js +15 -15
  45. package/admin/src/pages/utils/getInputComponent.jsx +200 -200
  46. package/admin/src/pages/utils/paymentUtils.js +661 -661
  47. package/admin/src/pages/utils/tooltipHelpers.js +18 -18
  48. package/admin/src/pages/utils/transactionTableUtils.js +71 -71
  49. package/admin/src/pluginId.js +9 -9
  50. package/admin/src/translations/de.json +235 -235
  51. package/admin/src/translations/en.json +235 -235
  52. package/admin/src/translations/fr.json +235 -235
  53. package/admin/src/translations/ru.json +235 -235
  54. package/admin/src/utils/prefixPluginTranslations.js +13 -13
  55. package/package.json +45 -45
  56. package/server/bootstrap.js +107 -107
  57. package/server/config/index.js +83 -83
  58. package/server/content-types/index.js +4 -4
  59. package/server/content-types/transactions/index.js +4 -4
  60. package/server/content-types/transactions/schema.json +86 -86
  61. package/server/controllers/index.js +7 -7
  62. package/server/controllers/payone.js +503 -506
  63. package/server/destroy.js +5 -5
  64. package/server/index.js +23 -23
  65. package/server/policies/index.js +7 -7
  66. package/server/policies/is-auth.js +29 -29
  67. package/server/policies/isSuperAdmin.js +20 -20
  68. package/server/register.js +5 -5
  69. package/server/routes/index.js +218 -218
  70. package/server/services/applePayService.js +295 -295
  71. package/server/services/index.js +9 -9
  72. package/server/services/paymentService.js +264 -223
  73. package/server/services/payone.js +78 -78
  74. package/server/services/settingsService.js +59 -59
  75. package/server/services/testConnectionService.js +115 -115
  76. package/server/services/transactionService.js +262 -262
  77. package/server/utils/csvTransactions.js +82 -82
  78. package/server/utils/normalize.js +39 -39
  79. package/server/utils/paymentMethodParams.js +288 -288
  80. package/server/utils/requestBuilder.js +115 -100
  81. package/server/utils/responseParser.js +141 -141
  82. package/strapi-admin.js +4 -4
  83. package/strapi-server.js +3 -3
@@ -1,12 +1,12 @@
1
- /**
2
- * Plugin translations. Uses react-intl from Strapi admin (do NOT install react-intl).
3
- */
4
- import { useIntl } from 'react-intl';
5
- import pluginId from '../../pluginId';
6
-
7
- export function usePluginTranslations() {
8
- const { formatMessage } = useIntl();
9
- const t = (id, defaultMessage = '') =>
10
- formatMessage({ id: `${pluginId}.${id}`, defaultMessage });
11
- return { t, formatMessage };
12
- }
1
+ /**
2
+ * Plugin translations. Uses react-intl from Strapi admin (do NOT install react-intl).
3
+ */
4
+ import { useIntl } from 'react-intl';
5
+ import pluginId from '../../pluginId';
6
+
7
+ export function usePluginTranslations() {
8
+ const { formatMessage } = useIntl();
9
+ const t = (id, defaultMessage = '') =>
10
+ formatMessage({ id: `${pluginId}.${id}`, defaultMessage });
11
+ return { t, formatMessage };
12
+ }
@@ -1,183 +1,183 @@
1
- import * as React from "react";
2
- import { useNotification } from "@strapi/strapi/admin";
3
- import usePayoneRequests from "../utils/api";
4
-
5
- const useSettings = () => {
6
- const { toggleNotification } = useNotification();
7
- const [settings, setSettings] = React.useState({
8
- aid: "",
9
- portalid: "",
10
- mid: "",
11
- key: "",
12
- mode: "test",
13
- api_version: "3.10",
14
- serverApiMerchantId: "",
15
- serverApiKeyId: "",
16
- serverApiSecret: "",
17
- serverApiVersionPath: "/v2",
18
- defaultCountryCode: "DE",
19
- defaultCurrencyCode: "EUR",
20
- defaultLocale: "de_DE",
21
- enable3DSecure: false,
22
- enableCreditCard: false,
23
- enablePayPal: false,
24
- enableGooglePay: false,
25
- enableApplePay: false,
26
- enableSofort: false,
27
- enableSepaDirectDebit: false
28
- });
29
- const [isLoading, setIsLoading] = React.useState(false);
30
- const [isSaving, setIsSaving] = React.useState(false);
31
- const [isTesting, setIsTesting] = React.useState(false);
32
- const [testResult, setTestResult] = React.useState(null);
33
- const { getSettings, updateSettings, testConnection } = usePayoneRequests();
34
- const saveTimeoutRef = React.useRef(null);
35
-
36
-
37
- React.useEffect(() => {
38
- loadSettings();
39
- return () => {
40
- if (saveTimeoutRef.current) {
41
- clearTimeout(saveTimeoutRef.current);
42
- }
43
- };
44
- }, []);
45
-
46
- const loadSettings = async () => {
47
- setIsLoading(true);
48
- try {
49
- const response = await getSettings();
50
- const settingsData = response?.data?.data || response?.data;
51
- if (settingsData && typeof settingsData === 'object') {
52
- setSettings(settingsData);
53
- }
54
- } catch (error) {
55
- toggleNotification({
56
- type: "warning",
57
- message: "Failed to load settings"
58
- });
59
- } finally {
60
- setIsLoading(false);
61
- }
62
- };
63
-
64
- const handleInputChange = (field, value) => {
65
- setSettings((prev) => ({ ...prev, [field]: value }));
66
-
67
- if (saveTimeoutRef.current) {
68
- clearTimeout(saveTimeoutRef.current);
69
- }
70
-
71
- saveTimeoutRef.current = setTimeout(async () => {
72
- let updatedSettings;
73
- setSettings((prev) => {
74
- updatedSettings = { ...prev };
75
- return prev;
76
- });
77
-
78
- setIsSaving(true);
79
- try {
80
- await updateSettings(updatedSettings);
81
- await loadSettings();
82
- } catch (error) {
83
- setSettings((prev) => {
84
- const previousValue = prev[field];
85
- return { ...prev, [field]: previousValue };
86
- });
87
-
88
- toggleNotification({
89
- type: "danger",
90
- message: "Failed to update settings"
91
- });
92
-
93
- } finally {
94
- setIsSaving(false);
95
- }
96
- }, 1000);
97
- };
98
-
99
- const handlePaymentMethodToggle = async (field, value) => {
100
- const booleanValue = Boolean(value);
101
- let updatedSettings;
102
-
103
- setSettings((prev) => {
104
- updatedSettings = { ...prev, [field]: booleanValue };
105
- return updatedSettings;
106
- });
107
-
108
- setIsSaving(true);
109
- try {
110
- await updateSettings(updatedSettings);
111
- await loadSettings();
112
- } catch (error) {
113
- setSettings((prev) => ({ ...prev, [field]: !booleanValue }));
114
- toggleNotification({
115
- type: "danger",
116
- message: "Failed to update settings"
117
- });
118
- } finally {
119
- setIsSaving(false);
120
- }
121
- };
122
-
123
- const handleSave = async () => {
124
- setIsSaving(true);
125
- try {
126
- await updateSettings(settings);
127
- toggleNotification({
128
- type: "success",
129
- message: "Settings saved successfully"
130
- });
131
- await loadSettings();
132
- } catch (error) {
133
- toggleNotification({
134
- type: "danger",
135
- message: "Failed to save settings"
136
- });
137
- } finally {
138
- setIsSaving(false);
139
- }
140
- };
141
-
142
- const handleTestConnection = async () => {
143
- setIsTesting(true);
144
- setTestResult(null);
145
- try {
146
- const response = await testConnection();
147
- if (response.data && response.data.success) {
148
- setTestResult(response.data);
149
- toggleNotification({
150
- type: "success",
151
- message: response.data.message || "Test completed"
152
- });
153
- } else {
154
- setTestResult(response.data);
155
- toggleNotification({
156
- type: "danger",
157
- message: response.data.error.ErrorMessage || "Failed to test connection"
158
- });
159
-
160
- throw new Error(response.data.error.ErrorMessage);
161
- }
162
- } catch (error) {
163
- throw new Error(error.message);
164
- } finally {
165
- setIsTesting(false);
166
- }
167
- };
168
-
169
- return {
170
- settings,
171
- isLoading,
172
- isSaving,
173
- isTesting,
174
- testResult,
175
- handleInputChange,
176
- handlePaymentMethodToggle,
177
- handleSave,
178
- handleTestConnection
179
- };
180
- };
181
-
182
- export default useSettings;
183
-
1
+ import * as React from "react";
2
+ import { useNotification } from "@strapi/strapi/admin";
3
+ import usePayoneRequests from "../utils/api";
4
+
5
+ const useSettings = () => {
6
+ const { toggleNotification } = useNotification();
7
+ const [settings, setSettings] = React.useState({
8
+ aid: "",
9
+ portalid: "",
10
+ mid: "",
11
+ key: "",
12
+ mode: "test",
13
+ api_version: "3.10",
14
+ serverApiMerchantId: "",
15
+ serverApiKeyId: "",
16
+ serverApiSecret: "",
17
+ serverApiVersionPath: "/v2",
18
+ defaultCountryCode: "DE",
19
+ defaultCurrencyCode: "EUR",
20
+ defaultLocale: "de_DE",
21
+ enable3DSecure: false,
22
+ enableCreditCard: false,
23
+ enablePayPal: false,
24
+ enableGooglePay: false,
25
+ enableApplePay: false,
26
+ enableSofort: false,
27
+ enableSepaDirectDebit: false
28
+ });
29
+ const [isLoading, setIsLoading] = React.useState(false);
30
+ const [isSaving, setIsSaving] = React.useState(false);
31
+ const [isTesting, setIsTesting] = React.useState(false);
32
+ const [testResult, setTestResult] = React.useState(null);
33
+ const { getSettings, updateSettings, testConnection } = usePayoneRequests();
34
+ const saveTimeoutRef = React.useRef(null);
35
+
36
+
37
+ React.useEffect(() => {
38
+ loadSettings();
39
+ return () => {
40
+ if (saveTimeoutRef.current) {
41
+ clearTimeout(saveTimeoutRef.current);
42
+ }
43
+ };
44
+ }, []);
45
+
46
+ const loadSettings = async () => {
47
+ setIsLoading(true);
48
+ try {
49
+ const response = await getSettings();
50
+ const settingsData = response?.data?.data || response?.data;
51
+ if (settingsData && typeof settingsData === 'object') {
52
+ setSettings(settingsData);
53
+ }
54
+ } catch (error) {
55
+ toggleNotification({
56
+ type: "warning",
57
+ message: "Failed to load settings"
58
+ });
59
+ } finally {
60
+ setIsLoading(false);
61
+ }
62
+ };
63
+
64
+ const handleInputChange = (field, value) => {
65
+ setSettings((prev) => ({ ...prev, [field]: value }));
66
+
67
+ if (saveTimeoutRef.current) {
68
+ clearTimeout(saveTimeoutRef.current);
69
+ }
70
+
71
+ saveTimeoutRef.current = setTimeout(async () => {
72
+ let updatedSettings;
73
+ setSettings((prev) => {
74
+ updatedSettings = { ...prev };
75
+ return prev;
76
+ });
77
+
78
+ setIsSaving(true);
79
+ try {
80
+ await updateSettings(updatedSettings);
81
+ await loadSettings();
82
+ } catch (error) {
83
+ setSettings((prev) => {
84
+ const previousValue = prev[field];
85
+ return { ...prev, [field]: previousValue };
86
+ });
87
+
88
+ toggleNotification({
89
+ type: "danger",
90
+ message: "Failed to update settings"
91
+ });
92
+
93
+ } finally {
94
+ setIsSaving(false);
95
+ }
96
+ }, 1000);
97
+ };
98
+
99
+ const handlePaymentMethodToggle = async (field, value) => {
100
+ const booleanValue = Boolean(value);
101
+ let updatedSettings;
102
+
103
+ setSettings((prev) => {
104
+ updatedSettings = { ...prev, [field]: booleanValue };
105
+ return updatedSettings;
106
+ });
107
+
108
+ setIsSaving(true);
109
+ try {
110
+ await updateSettings(updatedSettings);
111
+ await loadSettings();
112
+ } catch (error) {
113
+ setSettings((prev) => ({ ...prev, [field]: !booleanValue }));
114
+ toggleNotification({
115
+ type: "danger",
116
+ message: "Failed to update settings"
117
+ });
118
+ } finally {
119
+ setIsSaving(false);
120
+ }
121
+ };
122
+
123
+ const handleSave = async () => {
124
+ setIsSaving(true);
125
+ try {
126
+ await updateSettings(settings);
127
+ toggleNotification({
128
+ type: "success",
129
+ message: "Settings saved successfully"
130
+ });
131
+ await loadSettings();
132
+ } catch (error) {
133
+ toggleNotification({
134
+ type: "danger",
135
+ message: "Failed to save settings"
136
+ });
137
+ } finally {
138
+ setIsSaving(false);
139
+ }
140
+ };
141
+
142
+ const handleTestConnection = async () => {
143
+ setIsTesting(true);
144
+ setTestResult(null);
145
+ try {
146
+ const response = await testConnection();
147
+ if (response.data && response.data.success) {
148
+ setTestResult(response.data);
149
+ toggleNotification({
150
+ type: "success",
151
+ message: response.data.message || "Test completed"
152
+ });
153
+ } else {
154
+ setTestResult(response.data);
155
+ toggleNotification({
156
+ type: "danger",
157
+ message: response.data.error.ErrorMessage || "Failed to test connection"
158
+ });
159
+
160
+ throw new Error(response.data.error.ErrorMessage);
161
+ }
162
+ } catch (error) {
163
+ throw new Error(error.message);
164
+ } finally {
165
+ setIsTesting(false);
166
+ }
167
+ };
168
+
169
+ return {
170
+ settings,
171
+ isLoading,
172
+ isSaving,
173
+ isTesting,
174
+ testResult,
175
+ handleInputChange,
176
+ handlePaymentMethodToggle,
177
+ handleSave,
178
+ handleTestConnection
179
+ };
180
+ };
181
+
182
+ export default useSettings;
183
+