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,180 +0,0 @@
1
- import React, { useState } from "react";
2
- import {
3
- Box,
4
- Flex,
5
- Button,
6
- TextInput,
7
- Typography,
8
- Select,
9
- Option,
10
- } from "@strapi/design-system";
11
- import { ArrowLeft, ArrowRight, ChevronLeft, ChevronRight } from "@strapi/icons";
12
-
13
- const TransactionHistoryTablePagination = ({
14
- currentPage,
15
- totalPages,
16
- pageSize,
17
- totalItems,
18
- onPageChange,
19
- onPageSizeChange,
20
- isLoading,
21
- }) => {
22
- const [pageInput, setPageInput] = useState(currentPage.toString());
23
-
24
- // Update input when currentPage changes externally
25
- React.useEffect(() => {
26
- setPageInput(currentPage.toString());
27
- }, [currentPage]);
28
-
29
- const handlePageInputChange = (e) => {
30
- const value = e.target.value;
31
- // Allow empty input or valid numbers
32
- if (value === "" || /^\d+$/.test(value)) {
33
- setPageInput(value);
34
- }
35
- };
36
-
37
- const handlePageInputBlur = () => {
38
- const pageNum = parseInt(pageInput, 10);
39
- if (pageNum && pageNum >= 1 && pageNum <= totalPages) {
40
- onPageChange(pageNum);
41
- } else {
42
- // Reset to current page if invalid
43
- setPageInput(currentPage.toString());
44
- }
45
- };
46
-
47
- const handlePageInputKeyPress = (e) => {
48
- if (e.key === "Enter") {
49
- handlePageInputBlur();
50
- }
51
- };
52
-
53
- const goToFirstPage = () => {
54
- if (currentPage > 1) {
55
- onPageChange(1);
56
- }
57
- };
58
-
59
- const goToLastPage = () => {
60
- if (currentPage < totalPages) {
61
- onPageChange(totalPages);
62
- }
63
- };
64
-
65
- const goToPreviousPage = () => {
66
- if (currentPage > 1) {
67
- onPageChange(currentPage - 1);
68
- }
69
- };
70
-
71
- const goToNextPage = () => {
72
- if (currentPage < totalPages) {
73
- onPageChange(currentPage + 1);
74
- }
75
- };
76
-
77
- const startItem = totalItems > 0 ? (currentPage - 1) * pageSize + 1 : 0;
78
- const endItem = Math.min(currentPage * pageSize, totalItems);
79
-
80
- return (
81
- <Box>
82
- <Flex
83
- justifyContent="space-between"
84
- alignItems="center"
85
- gap={4}
86
- wrap="wrap"
87
- >
88
- <Flex alignItems="center" gap={2}>
89
- <Typography variant="pi" textColor="neutral600">
90
- {totalItems > 0
91
- ? `Showing ${startItem}-${endItem} of ${totalItems} transactions`
92
- : `No transactions`}
93
- </Typography>
94
- <Flex alignItems="center" gap={2}>
95
- <Typography variant="pi" textColor="neutral600">
96
- Page size:
97
- </Typography>
98
- <Select
99
- value={pageSize.toString()}
100
- onChange={(value) => onPageSizeChange(parseInt(value, 10))}
101
- disabled={isLoading}
102
- style={{ width: "80px", minWidth: "80px" }}
103
- >
104
- <Option value="10">10</Option>
105
- <Option value="20">20</Option>
106
- <Option value="30">30</Option>
107
- <Option value="50">50</Option>
108
- <Option value="100">100</Option>
109
- </Select>
110
- </Flex>
111
- </Flex>
112
-
113
- {totalPages > 1 && (
114
- <Flex alignItems="center" gap={2}>
115
- <Button
116
- variant="tertiary"
117
- onClick={goToFirstPage}
118
- disabled={currentPage === 1 || isLoading}
119
- startIcon={<ChevronLeft />}
120
- size="S"
121
- >
122
- First
123
- </Button>
124
-
125
- <Button
126
- variant="tertiary"
127
- onClick={goToPreviousPage}
128
- disabled={currentPage === 1 || isLoading}
129
- startIcon={<ArrowLeft />}
130
- size="S"
131
- >
132
- Prev
133
- </Button>
134
-
135
- <Flex alignItems="center" gap={2}>
136
- <Typography variant="pi" textColor="neutral600">
137
- Page
138
- </Typography>
139
- <TextInput
140
- value={pageInput}
141
- onChange={handlePageInputChange}
142
- onBlur={handlePageInputBlur}
143
- onKeyPress={handlePageInputKeyPress}
144
- disabled={isLoading}
145
- aria-label="Page number"
146
- style={{ width: "60px", textAlign: "center" }}
147
- />
148
- <Typography variant="pi" textColor="neutral600">
149
- of {totalPages}
150
- </Typography>
151
- </Flex>
152
-
153
- <Button
154
- variant="tertiary"
155
- onClick={goToNextPage}
156
- disabled={currentPage === totalPages || isLoading}
157
- endIcon={<ArrowRight />}
158
- size="S"
159
- >
160
- Next
161
- </Button>
162
-
163
- <Button
164
- variant="tertiary"
165
- onClick={goToLastPage}
166
- disabled={currentPage === totalPages || isLoading}
167
- endIcon={<ChevronRight />}
168
- size="S"
169
- >
170
- Last
171
- </Button>
172
- </Flex>
173
- )}
174
- </Flex>
175
- </Box>
176
- );
177
- };
178
-
179
- export default TransactionHistoryTablePagination;
180
-
@@ -1,225 +0,0 @@
1
- import React from "react";
2
- import {
3
- Box,
4
- Table,
5
- Thead,
6
- Tbody,
7
- Tr,
8
- Th,
9
- Td,
10
- Typography,
11
- Button,
12
- Flex,
13
- } from "@strapi/design-system";
14
- import { User, File, ArrowUp, ArrowDown } from "@strapi/icons";
15
- import StatusBadge from "../StatusBadge";
16
- import CustomerInfoPopover from "../CustomerInfoPopover";
17
- import RawDataPopover from "../RawDataPopover";
18
- import TransactionHistoryTableFilters from "./TransactionHistoryTableFilters";
19
- import TransactionHistoryTablePagination from "./TransactionHistoryTablePagination";
20
-
21
- const TransactionHistoryTable = ({
22
- transactions,
23
- isLoading,
24
- filters,
25
- onFilterChange,
26
- onFilterApply,
27
- sorting,
28
- onSort,
29
- currentPage,
30
- totalPages,
31
- pageSize,
32
- totalItems,
33
- onPageChange,
34
- onPageSizeChange,
35
- }) => {
36
- const SortableHeader = ({ column, label, sortable = true }) => {
37
- const isActive = sorting?.sortBy === column;
38
- const sortOrder = isActive ? sorting?.sortOrder : null;
39
-
40
- const handleClick = () => {
41
- if (sortable && onSort) {
42
- onSort(column);
43
- }
44
- };
45
-
46
- return (
47
- <Th>
48
- <Flex
49
- alignItems="center"
50
- gap={2}
51
- onClick={handleClick}
52
- style={{ cursor: sortable ? "pointer" : "default" }}
53
- >
54
- <Typography fontWeight="bold" textColor="primary500">
55
- {label}
56
- </Typography>
57
- {sortable && (
58
- <Box style={{ display: "flex", alignItems: "center" }}>
59
- {sortOrder === "asc" && <ArrowUp size={8} />}
60
- {sortOrder === "desc" && <ArrowDown size={8} />}
61
- {!isActive && (
62
- <Box style={{ opacity: 0.3 }}>
63
- <ArrowUp size={8} />
64
- </Box>
65
- )}
66
- </Box>
67
- )}
68
- </Flex>
69
- </Th>
70
- );
71
- };
72
- const getCardTypeName = (cardtype) => {
73
- switch (cardtype) {
74
- case "V":
75
- return "Visa";
76
- case "M":
77
- return "MasterCard";
78
- default:
79
- return cardtype || "";
80
- }
81
- };
82
-
83
- const getPaymentMethodName = (clearingtype, wallettype, cardtype) => {
84
- switch (clearingtype) {
85
- case "cc":
86
- const cardTypeName = getCardTypeName(cardtype);
87
- return cardTypeName ? `CC / ${cardTypeName}` : "Credit Card";
88
- case "sb":
89
- return "Online Banking";
90
- case "wlt":
91
- return wallettype === "PPE" ? "PayPal" : "Wallet";
92
- case "elv":
93
- return "Direct Debit (SEPA)";
94
- default:
95
- return "Unknown";
96
- }
97
- };
98
-
99
- const formatAmount = (amount, currency) => {
100
- return `${(amount / 100).toFixed(2)} ${currency}`;
101
- };
102
-
103
- const formatDate = (dateString) => {
104
- return new Date(dateString).toLocaleString("de-DE", {
105
- year: "numeric",
106
- month: "2-digit",
107
- day: "2-digit",
108
- hour: "2-digit",
109
- minute: "2-digit",
110
- });
111
- };
112
-
113
- return (
114
- <Box>
115
- {/* Table Filters */}
116
- <TransactionHistoryTableFilters
117
- filters={filters}
118
- onFilterChange={onFilterChange}
119
- onFilterApply={onFilterApply}
120
- isLoading={isLoading}
121
- />
122
-
123
-
124
- <Box style={{ maxHeight: "600px", overflow: "auto", marginBottom: "1rem" }}>
125
- <Table colCount={6} rowCount={transactions.length}>
126
- <Thead>
127
- <Tr>
128
- <SortableHeader column="amount" label="Amount" />
129
- <SortableHeader column="created_at" label="Created At" />
130
- <SortableHeader column="status" label="Status" />
131
- <SortableHeader column="reference" label="Reference" />
132
- <SortableHeader column="method" label="Method" />
133
- <Th>
134
- <Typography fontWeight="bold" textColor="primary500">
135
- Actions
136
- </Typography>
137
- </Th>
138
- </Tr>
139
- </Thead>
140
- <Tbody>
141
- {transactions.length === 0 && !isLoading ? (
142
- <Tr>
143
- <Td colSpan={6}>
144
- <Box padding={6}>
145
- <Typography textAlign="center" textColor="neutral600">
146
- No transactions found
147
- </Typography>
148
- </Box>
149
- </Td>
150
- </Tr>
151
- ) : (
152
- transactions.map((transaction) => (
153
- <Tr key={transaction.id}>
154
- <Td>
155
- <Typography variant="pi" fontWeight="bold" textColor="primary600">
156
- {formatAmount(transaction.amount, transaction.currency)}
157
- </Typography>
158
- </Td>
159
- <Td>
160
- <Typography variant="pi" textColor="neutral800">
161
- {formatDate(transaction.created_at)}
162
- </Typography>
163
- </Td>
164
- <Td>
165
- <StatusBadge status={transaction.status} transaction={transaction} />
166
- </Td>
167
- <Td>
168
- <Typography variant="pi" textColor="neutral800">
169
- {transaction.reference}
170
- </Typography>
171
- </Td>
172
- <Td>
173
- <Typography variant="pi" textColor="neutral800">
174
- {getPaymentMethodName(
175
- transaction.raw_request?.clearingtype,
176
- transaction.raw_request?.wallettype,
177
- transaction.raw_request?.cardtype
178
- )}
179
- </Typography>
180
- </Td>
181
- <Td>
182
- <Flex gap={2} justifyContent="flex-start">
183
- <CustomerInfoPopover transaction={transaction}>
184
- <Button
185
- variant="secondary"
186
- size="S"
187
- startIcon={<User />}
188
- >
189
- View Customer
190
- </Button>
191
- </CustomerInfoPopover>
192
- <RawDataPopover transaction={transaction}>
193
- <Button
194
- variant="secondary"
195
- size="S"
196
- startIcon={<File />}
197
- >
198
- View Raw Data
199
- </Button>
200
- </RawDataPopover>
201
- </Flex>
202
- </Td>
203
- </Tr>
204
- ))
205
- )}
206
- </Tbody>
207
- </Table>
208
- </Box>
209
-
210
- {/* Pagination */}
211
- <TransactionHistoryTablePagination
212
- currentPage={currentPage}
213
- totalPages={totalPages}
214
- pageSize={pageSize}
215
- totalItems={totalItems}
216
- onPageChange={onPageChange}
217
- onPageSizeChange={onPageSizeChange}
218
- isLoading={isLoading}
219
- />
220
- </Box>
221
- );
222
- };
223
-
224
- export default TransactionHistoryTable;
225
-
@@ -1,197 +0,0 @@
1
- import React from "react";
2
- import {
3
- Box,
4
- Flex,
5
- Typography,
6
- TextInput,
7
- Button,
8
- } from "@strapi/design-system";
9
- import { Play } from "@strapi/icons";
10
- import GooglePayButton from "../GooglePaybutton";
11
- import ApplePayBtn from "../ApplePayBtn";
12
- import CardDetailsInput from "./CardDetailsInput";
13
-
14
- const AuthorizationForm = ({
15
- paymentAmount,
16
- setPaymentAmount,
17
- authReference,
18
- setAuthReference,
19
- isProcessingPayment,
20
- onAuthorization,
21
- paymentMethod,
22
- settings,
23
- setGooglePayToken,
24
- applePayToken,
25
- setApplePayToken,
26
- cardtype,
27
- setCardtype,
28
- cardpan,
29
- setCardpan,
30
- cardexpiredate,
31
- setCardexpiredate,
32
- cardcvc2,
33
- setCardcvc2,
34
- }) => {
35
- const handleGooglePayToken = (token, paymentData) => {
36
- if (!token) {
37
- return;
38
- }
39
- setGooglePayToken(token);
40
- onAuthorization(token);
41
- };
42
-
43
- const handleGooglePayError = (error) => {
44
- console.error("[AuthorizationForm] Google Pay error:", error);
45
- };
46
-
47
- const handleApplePayToken = async (token, paymentData) => {
48
- if (!token) {
49
- return Promise.reject(new Error("Token is missing"));
50
- }
51
-
52
- setApplePayToken(token);
53
-
54
- return Promise.resolve({
55
- success: true,
56
- message:
57
- "Token received successfully. Please click 'Process Authorization' to complete the payment.",
58
- });
59
- };
60
-
61
- const handleApplePayError = (error) => {
62
- console.error("[AuthorizationForm] Apple Pay error:", error);
63
- };
64
-
65
- return (
66
- <Flex direction="column" alignItems="stretch" gap={4}>
67
- <Flex direction="row" gap={2}>
68
- <Typography
69
- variant="omega"
70
- fontWeight="semiBold"
71
- textColor="neutral800"
72
- className="payment-form-title"
73
- >
74
- Authorization
75
- </Typography>
76
- <Typography
77
- variant="pi"
78
- textColor="neutral600"
79
- className="payment-form-description"
80
- >
81
- Authorize and capture an amount immediately.
82
- </Typography>
83
- </Flex>
84
-
85
- <Flex gap={4} wrap="wrap">
86
- <TextInput
87
- label="Amount (in cents) *"
88
- name="authAmount"
89
- value={paymentAmount}
90
- onChange={(e) => setPaymentAmount(e.target.value)}
91
- placeholder="Enter amount (e.g., 1000 for €10.00)"
92
- hint="Amount in cents (e.g., 1000 = €10.00)"
93
- required
94
- className="payment-input"
95
- style={{ flex: 1, minWidth: "250px" }}
96
- />
97
-
98
- <TextInput
99
- label="Reference *"
100
- name="authReference"
101
- value={authReference}
102
- onChange={(e) => setAuthReference(e.target.value)}
103
- placeholder="Auto-generated if empty"
104
- hint="Reference will be auto-generated if left empty"
105
- className="payment-input"
106
- style={{ flex: 1, minWidth: "250px" }}
107
- />
108
- </Flex>
109
-
110
- {paymentMethod === "cc" && settings?.enable3DSecure && (
111
- <Box marginTop={4}>
112
- <CardDetailsInput
113
- cardtype={cardtype}
114
- setCardtype={setCardtype}
115
- cardpan={cardpan}
116
- setCardpan={setCardpan}
117
- cardexpiredate={cardexpiredate}
118
- setCardexpiredate={setCardexpiredate}
119
- cardcvc2={cardcvc2}
120
- setCardcvc2={setCardcvc2}
121
- />
122
- </Box>
123
- )}
124
-
125
- {paymentMethod === "gpp" ? (
126
- <GooglePayButton
127
- amount={paymentAmount}
128
- currency="EUR"
129
- onTokenReceived={handleGooglePayToken}
130
- onError={handleGooglePayError}
131
- settings={settings}
132
- />
133
- ) : paymentMethod === "apl" ? (
134
- <Box>
135
- <ApplePayBtn
136
- amount={paymentAmount}
137
- onTokenReceived={handleApplePayToken}
138
- onError={handleApplePayError}
139
- settings={settings}
140
- />
141
- {applePayToken && (
142
- <Box
143
- marginTop={3}
144
- style={{
145
- width: "100%",
146
- display: "flex",
147
- flexDirection: "column",
148
- alignItems: "flex-start",
149
- gap: "8px",
150
- }}
151
- >
152
- <Typography
153
- variant="pi"
154
- textColor="success600"
155
- style={{ marginBottom: "8px", fontWeight: "bold" }}
156
- >
157
- ✓ Apple Pay token received. You can now process the
158
- authorization:
159
- </Typography>
160
- <Button
161
- variant="default"
162
- onClick={() => onAuthorization(applePayToken)}
163
- loading={isProcessingPayment}
164
- startIcon={<Play />}
165
- style={{ maxWidth: "200px" }}
166
- disabled={!paymentAmount.trim() || !authReference.trim()}
167
- className="payment-button payment-button-primary"
168
- >
169
- Process Authorization
170
- </Button>
171
- </Box>
172
- )}
173
- </Box>
174
- ) : (
175
- <Button
176
- variant="default"
177
- onClick={onAuthorization}
178
- loading={isProcessingPayment}
179
- startIcon={<Play />}
180
- style={{ maxWidth: "200px" }}
181
- className="payment-button payment-button-primary"
182
- disabled={
183
- !paymentAmount.trim() ||
184
- (paymentMethod === "cc" &&
185
- settings?.enable3DSecure !== false &&
186
- (!cardtype || !cardpan || !cardexpiredate || !cardcvc2)) ||
187
- (paymentMethod === "apl" && !applePayToken)
188
- }
189
- >
190
- Process Authorization
191
- </Button>
192
- )}
193
- </Flex>
194
- );
195
- };
196
-
197
- export default AuthorizationForm;