strapi-plugin-payone-provider 4.6.10 → 4.6.11

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 (62) hide show
  1. package/README.md +64 -0
  2. package/admin/src/pages/App/components/AppHeader.jsx +3 -2
  3. package/admin/src/pages/App/components/AppTabs.jsx +34 -88
  4. package/admin/src/pages/App/components/DocsPanel.jsx +1726 -1726
  5. package/admin/src/pages/App/components/GooglePaybutton.jsx +300 -300
  6. package/admin/src/pages/App/components/StatusBadge.jsx +1 -1
  7. package/admin/src/pages/App/components/common/InfoTooltip.jsx +16 -0
  8. package/admin/src/pages/App/components/{ApplePayConfig.jsx → configuration/ApplePayConfig.jsx} +191 -62
  9. package/admin/src/pages/App/components/{ApplePayConfigPanel.jsx → configuration/ApplePayConfigPanel.jsx} +71 -70
  10. package/admin/src/pages/App/components/configuration/ConfigurationFields.jsx +408 -0
  11. package/admin/src/pages/App/components/configuration/ConfigurationPanel.jsx +67 -0
  12. package/admin/src/pages/App/components/{GooglePayConfig.jsx → configuration/GooglePayConfig.jsx} +254 -254
  13. package/admin/src/pages/App/components/{GooglePayConfigPanel.jsx → configuration/GooglePayConfigPanel.jsx} +82 -82
  14. package/admin/src/pages/App/components/configuration/TestConnection.jsx +129 -0
  15. package/admin/src/pages/App/components/paymentActions/ApplePayPanel.jsx +137 -95
  16. package/admin/src/pages/App/components/paymentActions/CaptureForm.jsx +119 -14
  17. package/admin/src/pages/App/components/paymentActions/CardDetailsInput.jsx +85 -24
  18. package/admin/src/pages/App/components/paymentActions/PaymentActionsPanel.jsx +361 -0
  19. package/admin/src/pages/App/components/paymentActions/PaymentMethodSelector.jsx +22 -4
  20. package/admin/src/pages/App/components/paymentActions/RefundForm.jsx +91 -20
  21. package/admin/src/pages/App/components/paymentActions/authorization/AuthorizationForm.jsx +157 -0
  22. package/admin/src/pages/App/components/paymentActions/authorization/AuthorizationFormFields.jsx +308 -0
  23. package/admin/src/pages/App/components/paymentActions/authorization/AuthorizationFormHeader.jsx +27 -0
  24. package/admin/src/pages/App/components/paymentActions/authorization/AuthorizationPaymentButtons.jsx +93 -0
  25. package/admin/src/pages/App/components/paymentActions/preauthorization/PreauthorizationForm.jsx +134 -0
  26. package/admin/src/pages/App/components/paymentActions/preauthorization/PreauthorizationFormFields.jsx +295 -0
  27. package/admin/src/pages/App/components/paymentActions/preauthorization/PreauthorizationFormHeader.jsx +27 -0
  28. package/admin/src/pages/App/components/paymentActions/preauthorization/PreauthorizationPaymentButtons.jsx +53 -0
  29. package/admin/src/pages/App/components/transaction-history/FiltersPanel.jsx +182 -0
  30. package/admin/src/pages/App/components/transaction-history/HistoryPanel.jsx +49 -0
  31. package/admin/src/pages/App/components/transaction-history/TransactionTable.jsx +169 -0
  32. package/admin/src/pages/App/components/transaction-history/TransactionTablePagination.jsx +28 -0
  33. package/admin/src/pages/App/components/transaction-history/details/TransactionDetails.jsx +155 -0
  34. package/admin/src/pages/App/index.jsx +5 -29
  35. package/admin/src/pages/hooks/usePaymentActions.js +87 -11
  36. package/admin/src/pages/hooks/useSettings.js +64 -22
  37. package/admin/src/pages/hooks/useTransactionHistory.js +100 -88
  38. package/admin/src/pages/utils/api.js +31 -3
  39. package/admin/src/pages/utils/countryLanguageUtils.js +236 -0
  40. package/admin/src/pages/utils/transactionTableUtils.js +60 -0
  41. package/package.json +1 -1
  42. package/server/bootstrap.js +6 -6
  43. package/server/controllers/payone.js +27 -3
  44. package/server/policies/index.js +2 -1
  45. package/server/policies/is-payone-notification.js +31 -0
  46. package/server/routes/index.js +10 -0
  47. package/server/services/payone.js +11 -4
  48. package/server/services/settingsService.js +8 -2
  49. package/server/services/testConnectionService.js +11 -72
  50. package/server/services/transactionService.js +58 -78
  51. package/server/services/transactionStatusService.js +87 -0
  52. package/admin/src/pages/App/components/ConfigurationPanel.jsx +0 -517
  53. package/admin/src/pages/App/components/CustomerInfoPopover.jsx +0 -147
  54. package/admin/src/pages/App/components/HistoryPanel.jsx +0 -94
  55. package/admin/src/pages/App/components/PaymentActionsPanel.jsx +0 -280
  56. package/admin/src/pages/App/components/RawDataPopover.jsx +0 -113
  57. package/admin/src/pages/App/components/TransactionHistoryItem.jsx +0 -522
  58. package/admin/src/pages/App/components/TransactionHistoryTable/TransactionHistoryTableFilters.jsx +0 -113
  59. package/admin/src/pages/App/components/TransactionHistoryTable/TransactionHistoryTablePagination.jsx +0 -180
  60. package/admin/src/pages/App/components/TransactionHistoryTable/index.jsx +0 -225
  61. package/admin/src/pages/App/components/paymentActions/AuthorizationForm.jsx +0 -197
  62. package/admin/src/pages/App/components/paymentActions/PreauthorizationForm.jsx +0 -142
@@ -1,94 +0,0 @@
1
- import React from "react";
2
- import {
3
- Box,
4
- Button,
5
- Card,
6
- CardBody,
7
- Flex,
8
- Stack,
9
- Typography,
10
- TextInput,
11
- Select,
12
- Option,
13
- Divider,
14
- } from "@strapi/design-system";
15
- import { Search } from "@strapi/icons";
16
- import TransactionHistoryItem from "./TransactionHistoryItem";
17
- import TransactionHistoryTable from "./TransactionHistoryTable";
18
-
19
- const HistoryPanel = ({
20
- filters,
21
- onFilterChange,
22
- onFilterApply,
23
- sorting,
24
- onSort,
25
- isLoadingHistory,
26
- transactionHistory,
27
- paginatedTransactions,
28
- currentPage,
29
- totalPages,
30
- pageSize,
31
- onRefresh,
32
- onPageChange,
33
- onPageSizeChange,
34
- }) => {
35
- console.log(transactionHistory);
36
-
37
- return (
38
- <Box
39
- className="payment-container"
40
- paddingTop={8}
41
- paddingBottom={8}
42
- paddingLeft={8}
43
- paddingRight={8}
44
- >
45
- <Flex direction="column" alignItems="stretch" gap={8}>
46
- <Box>
47
- <Typography
48
- variant="beta"
49
- as="h2"
50
- className="payment-title"
51
- style={{ fontSize: "20px", marginBottom: "4px" }}
52
- >
53
- Transaction Management
54
- </Typography>
55
- <Typography
56
- variant="pi"
57
- textColor="neutral600"
58
- className="payment-subtitle"
59
- style={{ fontSize: "14px", marginTop: "4px" }}
60
- >
61
- View and filter all payment transactions processed through Payone
62
- </Typography>
63
- </Box>
64
-
65
- {/* Transaction Table */}
66
- <TransactionHistoryTable
67
- transactions={paginatedTransactions}
68
- isLoading={isLoadingHistory}
69
- filters={filters}
70
- onFilterChange={onFilterChange}
71
- onFilterApply={onFilterApply}
72
- sorting={sorting}
73
- onSort={onSort}
74
- currentPage={currentPage}
75
- totalPages={totalPages}
76
- pageSize={pageSize}
77
- totalItems={transactionHistory.length}
78
- onPageChange={onPageChange}
79
- onPageSizeChange={onPageSizeChange}
80
- />
81
-
82
- <Box paddingTop={4}>
83
- <Typography variant="sigma" textColor="neutral600">
84
- Note: This shows all Payone transactions processed through this
85
- plugin. Transactions are automatically logged with detailed
86
- request/response data.
87
- </Typography>
88
- </Box>
89
- </Flex>
90
- </Box>
91
- );
92
- };
93
-
94
- export default HistoryPanel;
@@ -1,280 +0,0 @@
1
- import React from "react";
2
- import { Box, Flex, Typography } from "@strapi/design-system";
3
- import PaymentMethodSelector from "./paymentActions/PaymentMethodSelector";
4
- import PreauthorizationForm from "./paymentActions/PreauthorizationForm";
5
- import AuthorizationForm from "./paymentActions/AuthorizationForm";
6
- import CaptureForm from "./paymentActions/CaptureForm";
7
- import RefundForm from "./paymentActions/RefundForm";
8
- import PaymentResult from "./paymentActions/PaymentResult";
9
- import ApplePayPanel from "./paymentActions/ApplePayPanel";
10
-
11
- const PaymentActionsPanel = ({
12
- paymentAmount,
13
- setPaymentAmount,
14
- preauthReference,
15
- setPreauthReference,
16
- authReference,
17
- setAuthReference,
18
- captureTxid,
19
- setCaptureTxid,
20
- refundTxid,
21
- setRefundTxid,
22
- refundSequenceNumber,
23
- setRefundSequenceNumber,
24
- refundReference,
25
- setRefundReference,
26
- paymentMethod,
27
- setPaymentMethod,
28
- captureMode,
29
- setCaptureMode,
30
- isProcessingPayment,
31
- paymentError,
32
- paymentResult,
33
- onPreauthorization,
34
- onAuthorization,
35
- onCapture,
36
- onRefund,
37
- settings,
38
- setGooglePayToken,
39
- applePayToken,
40
- setApplePayToken,
41
- cardtype,
42
- setCardtype,
43
- cardpan,
44
- setCardpan,
45
- cardexpiredate,
46
- setCardexpiredate,
47
- cardcvc2,
48
- setCardcvc2,
49
- onNavigateToConfig,
50
- }) => {
51
- const mode = (settings?.mode || "test").toLowerCase();
52
- const isLiveMode = mode === "live";
53
-
54
- React.useEffect(() => {
55
- if (isLiveMode && paymentMethod !== "apl") {
56
- setPaymentMethod("apl");
57
- }
58
- }, [isLiveMode, paymentMethod]);
59
-
60
- if (isLiveMode && paymentMethod !== "apl") {
61
- return (
62
- <Box
63
- style={{
64
- display: "flex",
65
- flexDirection: "column",
66
- alignItems: "center",
67
- justifyContent: "center",
68
- gap: "8px",
69
- marginTop: "44px",
70
- }}
71
- >
72
- <Typography variant="pi" textColor="neutral600">
73
- Test Payments are only works in test mode.
74
- </Typography>
75
- <Typography variant="pi" textColor="neutral600">
76
- Please switch to test mode in plugin settings to use test payments.
77
- </Typography>
78
- </Box>
79
- );
80
- }
81
-
82
- if (paymentMethod === "apl") {
83
- return (
84
- <ApplePayPanel
85
- paymentAmount={paymentAmount}
86
- setPaymentAmount={setPaymentAmount}
87
- authReference={authReference}
88
- setAuthReference={setAuthReference}
89
- isProcessingPayment={isProcessingPayment}
90
- onAuthorization={onAuthorization}
91
- paymentMethod={paymentMethod}
92
- setPaymentMethod={setPaymentMethod}
93
- captureMode={captureMode}
94
- setCaptureMode={setCaptureMode}
95
- settings={settings}
96
- setGooglePayToken={setGooglePayToken}
97
- applePayToken={applePayToken}
98
- setApplePayToken={setApplePayToken}
99
- cardtype={cardtype}
100
- setCardtype={setCardtype}
101
- cardpan={cardpan}
102
- setCardpan={setCardpan}
103
- cardexpiredate={cardexpiredate}
104
- setCardexpiredate={setCardexpiredate}
105
- cardcvc2={cardcvc2}
106
- setCardcvc2={setCardcvc2}
107
- onNavigateToConfig={onNavigateToConfig}
108
- isLiveMode={isLiveMode}
109
- />
110
- );
111
- }
112
-
113
- return (
114
- <Box
115
- className="payment-container"
116
- paddingTop={8}
117
- paddingBottom={8}
118
- paddingLeft={8}
119
- paddingRight={8}
120
- >
121
- <Flex direction="column" alignItems="stretch" gap={6}>
122
- <Box
123
- style={{
124
- display: "flex",
125
- flexDirection: "column",
126
- alignItems: "flex-start",
127
- gap: "8px",
128
- }}
129
- >
130
- <Typography
131
- variant="beta"
132
- as="h2"
133
- className="payment-title"
134
- style={{ fontSize: "20px", marginBottom: "4px" }}
135
- >
136
- Payment Actions
137
- </Typography>
138
- <Typography
139
- variant="pi"
140
- textColor="neutral600"
141
- className="payment-subtitle"
142
- style={{ fontSize: "14px" }}
143
- >
144
- Process payments, captures, and refunds with multiple payment
145
- methods
146
- </Typography>
147
- </Box>
148
-
149
- <PaymentMethodSelector
150
- paymentMethod={paymentMethod}
151
- setPaymentMethod={setPaymentMethod}
152
- captureMode={captureMode}
153
- setCaptureMode={setCaptureMode}
154
- onNavigateToConfig={onNavigateToConfig}
155
- settings={settings}
156
- isLiveMode={isLiveMode}
157
- />
158
-
159
- <hr className="payment-divider" />
160
-
161
- <Box
162
- className="payment-form-section"
163
- style={{
164
- opacity: isLiveMode ? 0.5 : 1,
165
- pointerEvents: isLiveMode ? "none" : "auto",
166
- }}
167
- >
168
- <PreauthorizationForm
169
- paymentAmount={paymentAmount}
170
- setPaymentAmount={setPaymentAmount}
171
- preauthReference={preauthReference}
172
- setPreauthReference={setPreauthReference}
173
- isProcessingPayment={isProcessingPayment}
174
- onPreauthorization={onPreauthorization}
175
- paymentMethod={paymentMethod}
176
- settings={settings}
177
- setGooglePayToken={setGooglePayToken}
178
- applePayToken={applePayToken}
179
- setApplePayToken={setApplePayToken}
180
- cardtype={cardtype}
181
- setCardtype={setCardtype}
182
- cardpan={cardpan}
183
- setCardpan={setCardpan}
184
- cardexpiredate={cardexpiredate}
185
- setCardexpiredate={setCardexpiredate}
186
- cardcvc2={cardcvc2}
187
- setCardcvc2={setCardcvc2}
188
- isLiveMode={isLiveMode}
189
- />
190
- </Box>
191
-
192
- <hr className="payment-divider" />
193
-
194
- <Box className="payment-form-section">
195
- <AuthorizationForm
196
- paymentAmount={paymentAmount}
197
- setPaymentAmount={setPaymentAmount}
198
- authReference={authReference}
199
- setAuthReference={setAuthReference}
200
- isProcessingPayment={isProcessingPayment}
201
- onAuthorization={onAuthorization}
202
- paymentMethod={paymentMethod}
203
- settings={settings}
204
- setGooglePayToken={setGooglePayToken}
205
- applePayToken={applePayToken}
206
- setApplePayToken={setApplePayToken}
207
- cardtype={cardtype}
208
- setCardtype={setCardtype}
209
- cardpan={cardpan}
210
- setCardpan={setCardpan}
211
- cardexpiredate={cardexpiredate}
212
- setCardexpiredate={setCardexpiredate}
213
- cardcvc2={cardcvc2}
214
- setCardcvc2={setCardcvc2}
215
- isLiveMode={isLiveMode}
216
- />
217
- </Box>
218
-
219
- <hr className="payment-divider" />
220
-
221
- <Box
222
- className="payment-form-section"
223
- style={{
224
- opacity: isLiveMode ? 0.5 : 1,
225
- pointerEvents: isLiveMode ? "none" : "auto",
226
- }}
227
- >
228
- <CaptureForm
229
- paymentAmount={paymentAmount}
230
- setPaymentAmount={setPaymentAmount}
231
- captureTxid={captureTxid}
232
- setCaptureTxid={setCaptureTxid}
233
- isProcessingPayment={isProcessingPayment}
234
- onCapture={onCapture}
235
- />
236
- </Box>
237
-
238
- <hr className="payment-divider" />
239
-
240
- <Box
241
- className="payment-form-section"
242
- style={{
243
- opacity: isLiveMode ? 0.5 : 1,
244
- pointerEvents: isLiveMode ? "none" : "auto",
245
- }}
246
- >
247
- <RefundForm
248
- paymentAmount={paymentAmount}
249
- setPaymentAmount={setPaymentAmount}
250
- refundTxid={refundTxid}
251
- setRefundTxid={setRefundTxid}
252
- refundSequenceNumber={refundSequenceNumber}
253
- setRefundSequenceNumber={setRefundSequenceNumber}
254
- refundReference={refundReference}
255
- setRefundReference={setRefundReference}
256
- isProcessingPayment={isProcessingPayment}
257
- onRefund={onRefund}
258
- />
259
- </Box>
260
-
261
- <hr className="payment-divider" />
262
-
263
- <PaymentResult
264
- paymentError={paymentError}
265
- paymentResult={paymentResult}
266
- />
267
-
268
- <Box paddingTop={4}>
269
- <Typography variant="sigma" textColor="neutral600">
270
- Note: These payment actions allow you to test the complete payment
271
- flow: Preauthorization → Capture → Refund. Make sure to use valid
272
- Transaction IDs for capture and refund operations.
273
- </Typography>
274
- </Box>
275
- </Flex>
276
- </Box>
277
- );
278
- };
279
-
280
- export default PaymentActionsPanel;
@@ -1,113 +0,0 @@
1
- import React, { useState, useRef, useEffect } from "react";
2
- import { Box, Typography } from "@strapi/design-system";
3
- import JsonView from "@uiw/react-json-view";
4
-
5
- const RawDataPopover = ({ transaction, children }) => {
6
- const [isOpen, setIsOpen] = useState(false);
7
- const [position, setPosition] = useState("top"); // 'top' or 'bottom'
8
- const popoverRef = useRef(null);
9
- const buttonRef = useRef(null);
10
-
11
- const calculatePosition = (buttonElement) => {
12
- if (!buttonElement) return "top";
13
-
14
- const buttonRect = buttonElement.getBoundingClientRect();
15
- // Find the scrollable parent container
16
- let scrollableParent = buttonElement.parentElement;
17
- while (scrollableParent && scrollableParent !== document.body) {
18
- const style = window.getComputedStyle(scrollableParent);
19
- if (style.overflow === 'auto' || style.overflowY === 'auto' || style.overflow === 'scroll' || style.overflowY === 'scroll') {
20
- const parentRect = scrollableParent.getBoundingClientRect();
21
- const spaceAbove = buttonRect.top - parentRect.top;
22
- const spaceBelow = parentRect.bottom - parentRect.bottom;
23
- // RawDataPopover can be up to 500px tall, so we need more space
24
- // If there's less space above than below (or less than 520px), show popover below
25
- return spaceAbove < 520 || spaceAbove < spaceBelow ? "bottom" : "top";
26
- }
27
- scrollableParent = scrollableParent.parentElement;
28
- }
29
- // Fallback: use viewport space
30
- const spaceAbove = buttonRect.top;
31
- return spaceAbove < 520 ? "bottom" : "top";
32
- };
33
-
34
- const handleButtonClick = () => {
35
- if (!isOpen && buttonRef.current) {
36
- // Calculate position before opening
37
- const newPosition = calculatePosition(buttonRef.current);
38
- setPosition(newPosition);
39
- }
40
- setIsOpen(!isOpen);
41
- };
42
-
43
- useEffect(() => {
44
- const handleClickOutside = (event) => {
45
- if (
46
- popoverRef.current &&
47
- buttonRef.current &&
48
- !popoverRef.current.contains(event.target) &&
49
- !buttonRef.current.contains(event.target)
50
- ) {
51
- setIsOpen(false);
52
- }
53
- };
54
-
55
- if (isOpen) {
56
- document.addEventListener("mousedown", handleClickOutside);
57
- return () => {
58
- document.removeEventListener("mousedown", handleClickOutside);
59
- };
60
- }
61
- }, [isOpen]);
62
-
63
- if (!transaction) {
64
- return children;
65
- }
66
-
67
- return (
68
- <Box position="relative" style={{ display: "inline-block" }}>
69
- <Box
70
- ref={buttonRef}
71
- onClick={handleButtonClick}
72
- style={{ display: "inline-block" }}
73
- >
74
- {children}
75
- </Box>
76
- {isOpen && (
77
- <Box
78
- ref={popoverRef}
79
- position="absolute"
80
- zIndex={1000}
81
- left={0}
82
- {...(position === "top"
83
- ? { bottom: "100%", marginBottom: 2 }
84
- : { top: "100%", marginTop: 2 }
85
- )}
86
- padding={3}
87
- background="neutral0"
88
- hasRadius
89
- style={{
90
- minWidth: "400px",
91
- maxWidth: "600px",
92
- maxHeight: "500px",
93
- overflow: "auto",
94
- boxShadow: "0 4px 12px rgba(0, 0, 0, 0.15)",
95
- border: "1px solid var(--strapi-colors-neutral200)",
96
- }}
97
- >
98
- <Box paddingBottom={2}>
99
- <Typography variant="pi" fontWeight="bold" textColor="neutral800">
100
- Raw Transaction Data
101
- </Typography>
102
- </Box>
103
- <Box>
104
- <JsonView value={transaction} style={{ fontSize: "12px" }} />
105
- </Box>
106
- </Box>
107
- )}
108
- </Box>
109
- );
110
- };
111
-
112
- export default RawDataPopover;
113
-