strapi-plugin-payone-provider 4.6.9 → 5.6.10

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 (104) hide show
  1. package/README.md +156 -11
  2. package/admin/src/components/Initializer/index.jsx +3 -3
  3. package/admin/src/components/PluginIcon/index.jsx +3 -3
  4. package/admin/src/index.js +33 -11
  5. package/admin/src/pages/App/components/AppHeader.jsx +17 -32
  6. package/admin/src/pages/App/components/AppTabs.jsx +36 -162
  7. package/admin/src/pages/App/components/ApplePayBtn.jsx +9 -11
  8. package/admin/src/pages/App/components/ApplePayConfig.jsx +221 -161
  9. package/admin/src/pages/App/components/ApplePayConfigPanel.jsx +33 -45
  10. package/admin/src/pages/App/components/DocsPanel.jsx +66 -1726
  11. package/admin/src/pages/App/components/GooglePayConfig.jsx +136 -169
  12. package/admin/src/pages/App/components/GooglePayConfigPanel.jsx +37 -55
  13. package/admin/src/pages/App/components/GooglePaybutton.jsx +101 -43
  14. package/admin/src/pages/App/components/RenderInput.jsx +94 -0
  15. package/admin/src/pages/App/components/StatusBadge.jsx +24 -71
  16. package/admin/src/pages/App/components/configuration/ConfigurationFields.jsx +255 -0
  17. package/admin/src/pages/App/components/configuration/ConfigurationPanel.jsx +54 -0
  18. package/admin/src/pages/App/components/configuration/TestConnection.jsx +130 -0
  19. package/admin/src/pages/App/components/docs/ApplePaySection.jsx +260 -0
  20. package/admin/src/pages/App/components/docs/BaseUrlSection.jsx +53 -0
  21. package/admin/src/pages/App/components/docs/CaptureRefundSection.jsx +113 -0
  22. package/admin/src/pages/App/components/docs/CodeBlock.jsx +59 -0
  23. package/admin/src/pages/App/components/docs/CreditCardSection.jsx +93 -0
  24. package/admin/src/pages/App/components/docs/GooglePaySection.jsx +248 -0
  25. package/admin/src/pages/App/components/docs/PayPalSection.jsx +116 -0
  26. package/admin/src/pages/App/components/docs/PaymentMethodsSection.jsx +55 -0
  27. package/admin/src/pages/App/components/docs/TableOfContents.jsx +47 -0
  28. package/admin/src/pages/App/components/docs/TestCredentialsSection.jsx +304 -0
  29. package/admin/src/pages/App/components/docs/ThreeDSecureSection.jsx +188 -0
  30. package/admin/src/pages/App/components/icons/BankIcon.jsx +1 -1
  31. package/admin/src/pages/App/components/icons/ChevronDownIcon.jsx +1 -1
  32. package/admin/src/pages/App/components/icons/ChevronUpIcon.jsx +1 -1
  33. package/admin/src/pages/App/components/icons/CreditCardIcon.jsx +1 -1
  34. package/admin/src/pages/App/components/icons/ErrorIcon.jsx +1 -1
  35. package/admin/src/pages/App/components/icons/InfoIcon.jsx +1 -1
  36. package/admin/src/pages/App/components/icons/MarkCircle.jsx +19 -0
  37. package/admin/src/pages/App/components/icons/PaymentIcon.jsx +1 -1
  38. package/admin/src/pages/App/components/icons/PendingIcon.jsx +1 -1
  39. package/admin/src/pages/App/components/icons/PersonIcon.jsx +1 -1
  40. package/admin/src/pages/App/components/icons/SuccessIcon.jsx +1 -1
  41. package/admin/src/pages/App/components/icons/WalletIcon.jsx +1 -1
  42. package/admin/src/pages/App/components/payment-actions/ApplePayPanel.jsx +51 -0
  43. package/admin/src/pages/App/components/payment-actions/AuthorizationForm.jsx +341 -0
  44. package/admin/src/pages/App/components/payment-actions/CaptureForm.jsx +128 -0
  45. package/admin/src/pages/App/components/{paymentActions → payment-actions}/CardDetailsInput.jsx +77 -72
  46. package/admin/src/pages/App/components/payment-actions/PaymentActionsPanel.jsx +194 -0
  47. package/admin/src/pages/App/components/payment-actions/PaymentMethodSelector.jsx +313 -0
  48. package/admin/src/pages/App/components/payment-actions/PaymentResult.jsx +133 -0
  49. package/admin/src/pages/App/components/payment-actions/PreauthorizationForm.jsx +280 -0
  50. package/admin/src/pages/App/components/payment-actions/RefundForm.jsx +121 -0
  51. package/admin/src/pages/App/components/transaction-history/FiltersPanel.jsx +145 -0
  52. package/admin/src/pages/App/components/transaction-history/HistoryPanel.jsx +50 -0
  53. package/admin/src/pages/App/components/transaction-history/TransactionTable.jsx +163 -0
  54. package/admin/src/pages/App/components/transaction-history/details/TransactionDetails.jsx +156 -0
  55. package/admin/src/pages/App/components/{TransactionHistoryItem.jsx → transaction-history/details/TransactionHistoryItem.jsx} +16 -28
  56. package/admin/src/pages/App/index.jsx +27 -70
  57. package/admin/src/pages/App/styles.css +46 -169
  58. package/admin/src/pages/constants/paymentConstants.js +52 -16
  59. package/admin/src/pages/hooks/use-system-theme.js +27 -0
  60. package/admin/src/pages/hooks/usePaymentActions.js +273 -210
  61. package/admin/src/pages/hooks/useSettings.js +87 -48
  62. package/admin/src/pages/hooks/useTransactionHistory.js +105 -108
  63. package/admin/src/pages/utils/api.js +57 -72
  64. package/admin/src/pages/utils/applePayConstants.js +2 -28
  65. package/admin/src/pages/utils/countryLanguageUtils.js +280 -0
  66. package/admin/src/pages/utils/getInputComponent.jsx +225 -0
  67. package/admin/src/pages/utils/googlePayConstants.js +2 -9
  68. package/admin/src/pages/utils/paymentUtils.js +13 -26
  69. package/admin/src/pages/utils/tooltipHelpers.js +18 -0
  70. package/admin/src/pages/utils/transactionTableUtils.js +60 -0
  71. package/package.json +8 -14
  72. package/server/config/index.js +18 -2
  73. package/server/controllers/payone.js +98 -31
  74. package/server/policies/index.js +2 -1
  75. package/server/policies/is-auth.js +9 -3
  76. package/server/policies/is-payone-notification.js +31 -0
  77. package/server/policies/isSuperAdmin.js +7 -5
  78. package/server/routes/index.js +11 -0
  79. package/server/services/paymentService.js +6 -22
  80. package/server/services/payone.js +10 -3
  81. package/server/services/settingsService.js +13 -3
  82. package/server/services/testConnectionService.js +11 -73
  83. package/server/services/transactionService.js +62 -99
  84. package/server/services/transactionStatusService.js +87 -0
  85. package/server/utils/normalize.js +0 -12
  86. package/server/utils/paymentMethodParams.js +0 -1
  87. package/server/utils/requestBuilder.js +34 -5
  88. package/server/utils/responseParser.js +9 -14
  89. package/strapi-admin.js +3 -1
  90. package/admin/src/pages/App/components/ConfigurationPanel.jsx +0 -517
  91. package/admin/src/pages/App/components/CustomerInfoPopover.jsx +0 -147
  92. package/admin/src/pages/App/components/HistoryPanel.jsx +0 -94
  93. package/admin/src/pages/App/components/PaymentActionsPanel.jsx +0 -280
  94. package/admin/src/pages/App/components/RawDataPopover.jsx +0 -113
  95. package/admin/src/pages/App/components/TransactionHistoryTable/TransactionHistoryTableFilters.jsx +0 -113
  96. package/admin/src/pages/App/components/TransactionHistoryTable/TransactionHistoryTablePagination.jsx +0 -180
  97. package/admin/src/pages/App/components/TransactionHistoryTable/index.jsx +0 -225
  98. package/admin/src/pages/App/components/paymentActions/ApplePayPanel.jsx +0 -95
  99. package/admin/src/pages/App/components/paymentActions/AuthorizationForm.jsx +0 -197
  100. package/admin/src/pages/App/components/paymentActions/CaptureForm.jsx +0 -65
  101. package/admin/src/pages/App/components/paymentActions/PaymentMethodSelector.jsx +0 -306
  102. package/admin/src/pages/App/components/paymentActions/PaymentResult.jsx +0 -192
  103. package/admin/src/pages/App/components/paymentActions/PreauthorizationForm.jsx +0 -142
  104. package/admin/src/pages/App/components/paymentActions/RefundForm.jsx +0 -90
@@ -1,13 +1,6 @@
1
- import React from "react";
2
- import {
3
- Box,
4
- Flex,
5
- Typography,
6
- Select,
7
- Option,
8
- Checkbox,
9
- Stack,
10
- } from "@strapi/design-system";
1
+ import * as React from "@strapi/strapi/admin";
2
+ import { Box, Flex, Typography, Checkbox } from "@strapi/design-system";
3
+ import RenderInput from "./RenderInput";
11
4
  import {
12
5
  GOOGLE_PAY_SUPPORTED_COUNTRIES,
13
6
  GOOGLE_PAY_SUPPORTED_CURRENCIES,
@@ -16,7 +9,7 @@ import {
16
9
  DEFAULT_GOOGLE_PAY_CONFIG,
17
10
  } from "../../utils/googlePayConstants";
18
11
 
19
- const GooglePayConfig = ({ config, onConfigChange, settings }) => {
12
+ const GooglePayConfig = ({ config, onConfigChange }) => {
20
13
  const {
21
14
  countryCode = DEFAULT_GOOGLE_PAY_CONFIG.countryCode,
22
15
  currencyCode = DEFAULT_GOOGLE_PAY_CONFIG.currencyCode,
@@ -64,190 +57,164 @@ const GooglePayConfig = ({ config, onConfigChange, settings }) => {
64
57
  };
65
58
 
66
59
  return (
67
- <Box>
68
- <Stack spacing={6}>
69
- {/* Country and Currency */}
70
- <Flex gap={4} wrap="wrap">
71
- <Box style={{ flex: 1, minWidth: "300px" }}>
72
- <Select
73
- label="Country Code"
74
- name="countryCode"
75
- value={countryCode}
76
- onChange={handleCountryChange}
77
- hint="Select the country where your business operates"
78
- required
79
- >
80
- {GOOGLE_PAY_SUPPORTED_COUNTRIES.map((country) => (
81
- <Option key={country.code} value={country.code}>
82
- {country.name} ({country.code})
83
- </Option>
84
- ))}
85
- </Select>
86
- </Box>
87
-
88
- <Box style={{ flex: 1, minWidth: "300px" }}>
89
- <Select
90
- label="Currency Code"
91
- name="currencyCode"
92
- value={currencyCode}
93
- onChange={handleCurrencyChange}
94
- hint="Select the currency for transactions"
95
- required
96
- >
97
- {GOOGLE_PAY_SUPPORTED_CURRENCIES.map((currency) => (
98
- <Option key={currency.code} value={currency.code}>
99
- {currency.name} ({currency.code}) {currency.symbol}
100
- </Option>
101
- ))}
102
- </Select>
103
- </Box>
104
- </Flex>
60
+ <Flex
61
+ direction="column"
62
+ gap={4}
63
+ alignItems={"center"}
64
+ justifyContent={"center"}
65
+ width="100%"
66
+ >
67
+ {/* Country and Currency */}
68
+ <Box
69
+ style={{
70
+ display: "grid",
71
+ gridTemplateColumns: "1fr",
72
+ gap: "16px",
73
+ width: "100%",
74
+ }}
75
+ >
76
+ <Box>
77
+ <RenderInput
78
+ name="countryCode"
79
+ label="Country Code"
80
+ value={countryCode || ""}
81
+ onChange={(e) => {
82
+ const value = e.target?.value || e;
83
+ handleCountryChange(value);
84
+ }}
85
+ inputType="select"
86
+ required
87
+ tooltipContent="Select the country where your business operates"
88
+ options={GOOGLE_PAY_SUPPORTED_COUNTRIES.map((country) => ({
89
+ value: country.code,
90
+ label: `${country.name} (${country.code})`,
91
+ }))}
92
+ />
93
+ </Box>
105
94
 
106
- {/* Merchant Name */}
107
95
  <Box>
108
- <Typography
109
- variant="pi"
110
- fontWeight="semiBold"
111
- style={{ marginLeft: "2px" }}
112
- >
113
- Merchant Name
114
- </Typography>
115
- <Typography
116
- variant="pi"
117
- textColor="neutral600"
118
- style={{ marginLeft: "2px" }}
119
- >
120
- The name of your business as it will appear in Google Pay
121
- </Typography>
122
- <input
123
- type="text"
124
- value={merchantName}
96
+ <RenderInput
97
+ name="currencyCode"
98
+ label="Currency Code"
99
+ value={currencyCode || ""}
100
+ onChange={(e) => {
101
+ const value = e.target?.value || e;
102
+ handleCurrencyChange(value);
103
+ }}
104
+ inputType="select"
105
+ required
106
+ tooltipContent="Select the currency for transactions"
107
+ options={GOOGLE_PAY_SUPPORTED_CURRENCIES.map((currency) => ({
108
+ value: currency.code,
109
+ label: `${currency.name} (${currency.code}) ${currency.symbol}`,
110
+ }))}
111
+ />
112
+ </Box>
113
+ <Box>
114
+ <RenderInput
115
+ name="merchantName"
116
+ label="Merchant Name"
117
+ value={merchantName || ""}
125
118
  onChange={(e) =>
126
119
  onConfigChange({ ...config, merchantName: e.target.value })
127
120
  }
128
- style={{
129
- width: "100%",
130
- padding: "8px 12px",
131
- marginTop: "8px",
132
- border: "1px solid #dcdce4",
133
- borderRadius: "4px",
134
- fontSize: "14px",
135
- }}
121
+ inputType="textInput"
136
122
  placeholder="Your Store Name"
123
+ tooltipContent="The name of your business as it will appear in Google Pay"
137
124
  />
138
125
  </Box>
126
+ </Box>
139
127
 
140
- {/* Allowed Card Networks */}
141
- <Box>
142
- <Typography
143
- variant="pi"
144
- fontWeight="semiBold"
145
- style={{ marginLeft: "2px" }}
146
- >
128
+ {/* Allowed Card Networks */}
129
+ <Box width="100%" marginBottom={4} marginTop={4}>
130
+ <div style={{ display: "flex", flexDirection: "column", gap: "4px" }}>
131
+ <Typography variant="pi" fontWeight="semiBold">
147
132
  Allowed Card Networks
148
133
  </Typography>
149
- <Typography
150
- variant="pi"
151
- textColor="neutral600"
152
- style={{ marginLeft: "2px" }}
153
- >
134
+ <Typography variant="pi" textColor="neutral600">
154
135
  Select payment card networks to accept
155
136
  </Typography>
156
- <Flex wrap="wrap" gap={4} style={{ marginTop: "12px" }}>
157
- {GOOGLE_PAY_SUPPORTED_NETWORKS.map((network) => {
158
- const isSelected = allowedCardNetworks?.includes(network.code);
159
-
160
- return (
161
- <Box
162
- key={network.code}
163
- style={{ flex: "0 0 calc(50% - 8px)", minWidth: "250px" }}
137
+ </div>
138
+ <Flex
139
+ direction="row"
140
+ wrap="wrap"
141
+ alignItems="stretch"
142
+ gap={4}
143
+ marginTop={2}
144
+ width="100%"
145
+ >
146
+ {GOOGLE_PAY_SUPPORTED_NETWORKS.map((network) => {
147
+ const isSelected = allowedCardNetworks?.includes(network.code);
148
+
149
+ return (
150
+ <Box key={network.code}>
151
+ <Checkbox
152
+ name={`network-${network.code}`}
153
+ checked={isSelected}
154
+ onCheckedChange={() => handleNetworkToggle(network.code)}
164
155
  >
165
- <Checkbox
166
- name={`network-${network.code}`}
167
- checked={isSelected}
168
- onChange={() => handleNetworkToggle(network.code)}
169
- >
170
- {network.name} ({network.code})
171
- </Checkbox>
172
- </Box>
173
- );
174
- })}
175
- </Flex>
176
- {allowedCardNetworks?.length === 0 && (
177
- <Typography
178
- variant="pi"
179
- textColor="danger600"
180
- style={{ marginTop: "8px" }}
181
- >
182
- At least one card network must be selected
183
- </Typography>
184
- )}
185
- </Box>
186
-
187
- {/* Allowed Authentication Methods */}
188
- <Box>
156
+ {network.name} ({network.code})
157
+ </Checkbox>
158
+ </Box>
159
+ );
160
+ })}
161
+ </Flex>
162
+ {allowedCardNetworks?.length === 0 && (
189
163
  <Typography
190
164
  variant="pi"
191
- fontWeight="semiBold"
192
- style={{ marginLeft: "2px" }}
165
+ textColor="danger600"
166
+ style={{ marginTop: "8px" }}
193
167
  >
168
+ At least one card network must be selected
169
+ </Typography>
170
+ )}
171
+ </Box>
172
+
173
+ {/* Allowed Authentication Methods */}
174
+ <Box width="100%">
175
+ <div style={{ display: "flex", flexDirection: "column", gap: "4px" }}>
176
+ <Typography variant="pi" fontWeight="semiBold">
194
177
  Allowed Authentication Methods
195
178
  </Typography>
196
- <Typography
197
- variant="pi"
198
- textColor="neutral600"
199
- style={{ marginLeft: "2px" }}
200
- >
179
+ <Typography variant="pi" textColor="neutral600">
201
180
  Select authentication methods for card payments
202
181
  </Typography>
203
- <Flex wrap="wrap" gap={4} style={{ marginTop: "12px" }}>
204
- {GOOGLE_PAY_AUTH_METHODS.map((method) => {
205
- const isSelected = allowedAuthMethods?.includes(method.code);
206
-
207
- return (
208
- <Box
209
- key={method.code}
210
- style={{ flex: "0 0 calc(50% - 8px)", minWidth: "250px" }}
182
+ </div>
183
+ <Flex
184
+ direction="row"
185
+ wrap="wrap"
186
+ gap={4}
187
+ marginTop={2}
188
+ alignItems="stretch"
189
+ width="100%"
190
+ >
191
+ {GOOGLE_PAY_AUTH_METHODS.map((method) => {
192
+ const isSelected = allowedAuthMethods?.includes(method.code);
193
+
194
+ return (
195
+ <Box key={method.code}>
196
+ <Checkbox
197
+ name={`auth-method-${method.code}`}
198
+ checked={isSelected}
199
+ onCheckedChange={() => handleAuthMethodToggle(method.code)}
211
200
  >
212
- <Checkbox
213
- name={`auth-method-${method.code}`}
214
- checked={isSelected}
215
- onChange={() => handleAuthMethodToggle(method.code)}
216
- >
217
- {method.name} - {method.description}
218
- </Checkbox>
219
- </Box>
220
- );
221
- })}
222
- </Flex>
223
- {allowedAuthMethods?.length === 0 && (
224
- <Typography
225
- variant="pi"
226
- textColor="danger600"
227
- style={{ marginTop: "8px" }}
228
- >
229
- At least one authentication method must be selected
230
- </Typography>
231
- )}
232
- </Box>
233
-
234
- {/* Gateway Merchant ID Info */}
235
- <Box>
201
+ {method.name} - {method.description}
202
+ </Checkbox>
203
+ </Box>
204
+ );
205
+ })}
206
+ </Flex>
207
+ {allowedAuthMethods?.length === 0 && (
236
208
  <Typography
237
209
  variant="pi"
238
- fontWeight="semiBold"
239
- style={{ marginLeft: "2px" }}
210
+ textColor="danger600"
211
+ style={{ marginTop: "8px" }}
240
212
  >
241
- Gateway Merchant ID
213
+ At least one authentication method must be selected
242
214
  </Typography>
243
- <Typography variant="pi" textColor="neutral600">
244
- {settings?.mid || settings?.portalid
245
- ? `Using: ${settings.mid || settings.portalid}`
246
- : "Gateway merchant ID will be obtained from your Payone Merchant ID (MID) or Portal ID. Make sure these are configured in the main Configuration tab."}
247
- </Typography>
248
- </Box>
249
- </Stack>
250
- </Box>
215
+ )}
216
+ </Box>
217
+ </Flex>
251
218
  );
252
219
  };
253
220
 
@@ -1,11 +1,11 @@
1
- import React, { useState, useEffect } from "react";
1
+ import * as React from "react";
2
2
  import {
3
3
  Box,
4
4
  Card,
5
5
  CardBody,
6
6
  Flex,
7
7
  Typography,
8
- Button
8
+ Button,
9
9
  } from "@strapi/design-system";
10
10
  import { Check } from "@strapi/icons";
11
11
  import GooglePayConfig from "./GooglePayConfig";
@@ -15,68 +15,50 @@ const GooglePayConfigPanel = ({
15
15
  onInputChange,
16
16
  isSaving,
17
17
  onSave,
18
- onBack
18
+ onBack,
19
19
  }) => {
20
- const [googlePayConfig, setGooglePayConfig] = useState(settings?.googlePayConfig || {});
20
+ const [googlePayConfig, setGooglePayConfig] = React.useState(
21
+ settings?.googlePayConfig || {}
22
+ );
21
23
 
22
- useEffect(() => {
24
+ React.useEffect(() => {
23
25
  setGooglePayConfig(settings?.googlePayConfig || {});
24
26
  }, [settings?.googlePayConfig]);
25
27
 
26
28
  return (
27
- <Box
28
- className="payment-container"
29
- paddingTop={8}
30
- paddingBottom={8}
31
- paddingLeft={8}
32
- paddingRight={8}
33
- >
34
- <Flex direction="column" alignItems="stretch" gap={8}>
35
- <Box>
36
- <Typography variant="beta" as="h2" fontWeight="bold" className="payment-title" style={{ fontSize: '20px', marginBottom: '4px' }}>
37
- Google Pay Configuration
38
- </Typography>
39
- <Typography variant="pi" textColor="neutral600" marginTop={2} className="payment-subtitle" style={{ fontSize: '14px' }}>
40
- Configure Google Pay settings for your payment gateway
41
- </Typography>
42
- </Box>
43
-
44
- <Box>
45
- <Card className="payment-card">
46
- <CardBody padding={6}>
47
- <GooglePayConfig
48
- config={googlePayConfig}
49
- onConfigChange={(newConfig) => {
50
- setGooglePayConfig(newConfig);
51
- onInputChange("googlePayConfig", newConfig);
52
- }}
53
- settings={settings}
54
- />
55
- </CardBody>
56
- </Card>
57
- </Box>
29
+ <Flex direction="column" alignItems="stretch" gap={8} padding={8}>
30
+ <Card>
31
+ <CardBody padding={6}>
32
+ <GooglePayConfig
33
+ config={googlePayConfig}
34
+ onConfigChange={(newConfig) => {
35
+ setGooglePayConfig(newConfig);
36
+ onInputChange("googlePayConfig", newConfig);
37
+ }}
38
+ settings={settings}
39
+ />
40
+ </CardBody>
41
+ </Card>
58
42
 
59
- <Box paddingTop={4}>
60
- <Flex direction="row" gap={4} alignItems="center">
61
- <Button
62
- loading={isSaving}
63
- onClick={onSave}
64
- startIcon={<Check />}
65
- size="L"
66
- variant="default"
67
- className="payment-button payment-button-success"
68
- >
69
- Save Google Pay Configuration
70
- </Button>
71
- <Typography variant="sigma" textColor="neutral600">
72
- Note: Google Pay configuration is used for Google Pay payment requests. Make sure to configure the correct card networks, authentication methods, and merchant information for your region.
73
- </Typography>
74
- </Flex>
75
- </Box>
43
+ <Flex direction="column" gap={4} alignItems="stretch" paddingTop={4}>
44
+ <Typography variant="sigma" textColor="neutral600">
45
+ Note: Google Pay configuration is used for Google Pay payment
46
+ requests. Make sure to configure the correct card networks,
47
+ authentication methods, and merchant information for your region.
48
+ </Typography>
49
+ <Button
50
+ loading={isSaving}
51
+ onClick={onSave}
52
+ startIcon={<Check />}
53
+ size="L"
54
+ variant="default"
55
+ maxWidth={"220px"}
56
+ >
57
+ Save Configuration
58
+ </Button>
76
59
  </Flex>
77
- </Box>
60
+ </Flex>
78
61
  );
79
62
  };
80
63
 
81
64
  export default GooglePayConfigPanel;
82
-