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
@@ -0,0 +1,163 @@
1
+ import * as React from "react";
2
+ import { Typography, Box, Button, Flex } from "@strapi/design-system";
3
+ import { Table, Pagination } from "@strapi/strapi/admin";
4
+ import { ChevronDownIcon, ChevronUpIcon } from "../icons";
5
+ import {
6
+ formatAmount,
7
+ formatDate,
8
+ getPaymentMethodName,
9
+ } from "../../../utils/transactionTableUtils";
10
+ import TransactionDetails from "./details/TransactionDetails";
11
+ import FiltersPanel from "./FiltersPanel";
12
+ import useTransactionHistory from "../../../hooks/useTransactionHistory";
13
+ import StatusBadge from "../StatusBadge";
14
+ const TransactionTable = () => {
15
+ const {
16
+ transactions,
17
+ isLoadingHistory,
18
+ selectedTransaction,
19
+ handleTransactionSelect,
20
+ filters,
21
+ handleFiltersChange,
22
+ pagination,
23
+ } = useTransactionHistory();
24
+
25
+ const headers = [
26
+ { name: "txid", label: "TxId" },
27
+ { name: "reference", label: "Reference" },
28
+ { name: "amount", label: "Amount" },
29
+ { name: "paymentMethod", label: "Payment Method" },
30
+ { name: "type", label: "Type" },
31
+ { name: "status", label: "Status" },
32
+ { name: "created_at", label: "Created At" },
33
+ { name: "updated_at", label: "Updated At" },
34
+ { name: "details", label: "Details" },
35
+ ];
36
+
37
+ return (
38
+ <Flex direction="column" alignItems="stretch" gap={4} minHeight={"800px"}>
39
+ <FiltersPanel
40
+ filters={filters}
41
+ handleFiltersChange={handleFiltersChange}
42
+ />
43
+
44
+ <Box>
45
+ <Table.Root
46
+ rows={transactions}
47
+ headers={headers}
48
+ isLoading={isLoadingHistory}
49
+ >
50
+ <Table.Content>
51
+ <Table.Head>
52
+ {headers.map((header) => (
53
+ <Table.HeaderCell
54
+ key={header.name}
55
+ name={header.name}
56
+ label={header.label}
57
+ />
58
+ ))}
59
+ </Table.Head>
60
+ <Table.Body>
61
+ <Table.Loading />
62
+ <Table.Empty />
63
+ {transactions.length > 0 &&
64
+ transactions.map((transaction) => {
65
+ const isSelected = selectedTransaction?.id === transaction.id;
66
+ return (
67
+ <React.Fragment key={transaction.id}>
68
+ <Table.Row>
69
+ <Table.Cell>
70
+ <Typography variant="pi" textColor="neutral600">
71
+ {transaction.txid || "N/A"}
72
+ </Typography>
73
+ </Table.Cell>
74
+ <Table.Cell>
75
+ <Typography variant="pi" fontWeight="medium">
76
+ {transaction.reference || "N/A"}
77
+ </Typography>
78
+ </Table.Cell>
79
+ <Table.Cell>
80
+ <Typography variant="pi" textColor="neutral600">
81
+ {formatAmount(
82
+ transaction.amount,
83
+ transaction.currency
84
+ )}
85
+ </Typography>
86
+ </Table.Cell>
87
+ <Table.Cell>
88
+ <Typography variant="pi">
89
+ {getPaymentMethodName(
90
+ transaction.raw_request?.clearingtype,
91
+ transaction.raw_request?.wallettype
92
+ )}
93
+ </Typography>
94
+ </Table.Cell>
95
+ <Table.Cell>
96
+ <Typography variant="pi" fontWeight="semiBold">
97
+ {transaction.request_type || "N/A"}
98
+ </Typography>
99
+ </Table.Cell>
100
+ <Table.Cell>
101
+ <StatusBadge status={transaction?.status} size="M" />
102
+ </Table.Cell>
103
+ <Table.Cell>
104
+ <Typography variant="pi" textColor="neutral600">
105
+ {formatDate(transaction.created_at)}
106
+ </Typography>
107
+ </Table.Cell>
108
+ <Table.Cell>
109
+ <Typography variant="pi" textColor="neutral600">
110
+ {formatDate(transaction.updated_at)}
111
+ </Typography>
112
+ </Table.Cell>
113
+ <Table.Cell>
114
+ <Button
115
+ size="S"
116
+ variant="tertiary"
117
+ minWidth="100px"
118
+ onClick={() => handleTransactionSelect(transaction)}
119
+ startIcon={
120
+ isSelected ? (
121
+ <ChevronUpIcon size={16} />
122
+ ) : (
123
+ <ChevronDownIcon size={16} />
124
+ )
125
+ }
126
+ >
127
+ {isSelected ? "Hide" : "Details"}
128
+ </Button>
129
+ </Table.Cell>
130
+ </Table.Row>
131
+ {isSelected && (
132
+ <Table.Row>
133
+ <Table.Cell colSpan={10}>
134
+ <TransactionDetails transaction={transaction} />
135
+ </Table.Cell>
136
+ </Table.Row>
137
+ )}
138
+ </React.Fragment>
139
+ );
140
+ })}
141
+ </Table.Body>
142
+ </Table.Content>
143
+ </Table.Root>
144
+ </Box>
145
+
146
+ {transactions.length > 0 && (
147
+ <Box paddingTop={6} paddingBottom={4}>
148
+ <Pagination.Root
149
+ pageCount={pagination.pageCount}
150
+ defaultPage={pagination.page}
151
+ defaultPageSize={pagination.pageSize}
152
+ total={pagination.total}
153
+ >
154
+ <Pagination.PageSize options={["5", "10", "20", "50", "100"]} />
155
+ <Pagination.Links boundaryCount={1} siblingCount={1} />
156
+ </Pagination.Root>
157
+ </Box>
158
+ )}
159
+ </Flex>
160
+ );
161
+ };
162
+
163
+ export default TransactionTable;
@@ -0,0 +1,156 @@
1
+ import * as React from "react";
2
+ import JsonView from "@uiw/react-json-view";
3
+ import { githubDarkTheme } from "@uiw/react-json-view/githubDark";
4
+ import { Box, Flex, Typography } from "@strapi/design-system";
5
+ import { getCardTypeName } from "../../../../utils/transactionTableUtils";
6
+
7
+ const TransactionDetails = ({ transaction }) => {
8
+ return (
9
+ <Flex direction="column" gap={4} alignItems={"stretch"} marginTop={4}>
10
+ {transaction.status === "ERROR" && (
11
+ <Box padding={3} background="danger100" hasRadius>
12
+ <Typography
13
+ variant="pi"
14
+ fontWeight="bold"
15
+ textColor="danger600"
16
+ marginBottom={1}
17
+ >
18
+ Error: {transaction.error_message || "Unknown error"}
19
+ </Typography>
20
+ {transaction.customer_message && (
21
+ <Typography variant="pi" textColor="danger600">
22
+ Customer Message: {transaction.customer_message}
23
+ </Typography>
24
+ )}
25
+ </Box>
26
+ )}
27
+
28
+ <Box
29
+ style={{
30
+ display: "grid",
31
+ gridTemplateColumns: "repeat(auto-fit,minmax(400px,1fr))",
32
+ gap: "16px",
33
+ marginBottom: "1.5rem",
34
+ }}
35
+ >
36
+ <Flex direction="column" gap={2} alignItems={"stretch"}>
37
+ <Typography
38
+ variant="pi"
39
+ fontWeight="bold"
40
+ textColor="neutral800"
41
+ marginBottom={3}
42
+ >
43
+ Customer Information
44
+ </Typography>
45
+ <Flex gap={3}>
46
+ <Typography variant="pi" textColor="neutral600" fontWeight="medium">
47
+ Name:
48
+ </Typography>
49
+ <Typography variant="pi" textColor="neutral800">
50
+ {transaction.raw_request?.firstname}{" "}
51
+ {transaction.raw_request?.lastname}
52
+ </Typography>
53
+ </Flex>
54
+ <Flex gap={3}>
55
+ <Typography variant="pi" textColor="neutral600" fontWeight="medium">
56
+ Email:
57
+ </Typography>
58
+ <Typography variant="pi" textColor="neutral800">
59
+ {transaction.raw_request?.email || "N/A"}
60
+ </Typography>
61
+ </Flex>
62
+ <Flex gap={3}>
63
+ <Typography variant="pi" textColor="neutral600" fontWeight="medium">
64
+ Phone:
65
+ </Typography>
66
+ <Typography variant="pi" textColor="neutral800">
67
+ {transaction.raw_request?.telephonenumber || "N/A"}
68
+ </Typography>
69
+ </Flex>
70
+ <Flex gap={3}>
71
+ <Typography variant="pi" textColor="neutral600" fontWeight="medium">
72
+ Address:
73
+ </Typography>
74
+ <Typography variant="pi" textColor="neutral800">
75
+ {transaction.raw_request?.street}, {transaction.raw_request?.zip}{" "}
76
+ {transaction.raw_request?.city}
77
+ </Typography>
78
+ </Flex>
79
+ </Flex>
80
+ <Flex direction="column" gap={2} alignItems={"stretch"}>
81
+ <Typography
82
+ variant="pi"
83
+ fontWeight="bold"
84
+ textColor="neutral800"
85
+ marginBottom={3}
86
+ >
87
+ Payment Details
88
+ </Typography>
89
+ <Flex gap={3}>
90
+ <Typography variant="pi" textColor="neutral600" fontWeight="medium">
91
+ TX ID:
92
+ </Typography>
93
+ <Typography variant="pi" textColor="neutral800">
94
+ {transaction.txid || "N/A"}
95
+ </Typography>
96
+ </Flex>
97
+ {transaction.raw_request?.clearingtype === "cc" && (
98
+ <>
99
+ <Flex gap={3}>
100
+ <Typography
101
+ variant="pi"
102
+ textColor="neutral600"
103
+ fontWeight="medium"
104
+ >
105
+ Card Type:
106
+ </Typography>
107
+ <Typography variant="pi" textColor="neutral800">
108
+ {getCardTypeName(transaction.raw_request?.cardtype)}
109
+ </Typography>
110
+ </Flex>
111
+ <Flex gap={3}>
112
+ <Typography
113
+ variant="pi"
114
+ textColor="neutral600"
115
+ fontWeight="medium"
116
+ >
117
+ Card Number:
118
+ </Typography>
119
+ <Typography variant="pi" textColor="neutral800">
120
+ **** **** ****{" "}
121
+ {transaction.raw_request?.cardpan?.slice(-4) || "****"}
122
+ </Typography>
123
+ </Flex>
124
+ </>
125
+ )}
126
+ <Flex gap={3}>
127
+ <Typography variant="pi" textColor="neutral600" fontWeight="medium">
128
+ Mode:
129
+ </Typography>
130
+ <Typography variant="pi" textColor="neutral800">
131
+ {transaction.raw_request?.mode || "N/A"}
132
+ </Typography>
133
+ </Flex>
134
+ </Flex>
135
+ </Box>
136
+
137
+ <Box>
138
+ <Typography variant="pi" fontWeight="bold" textColor="neutral800">
139
+ Transaction Data
140
+ </Typography>
141
+ <Box marginTop={4}>
142
+ <JsonView
143
+ value={transaction?.body}
144
+ style={githubDarkTheme}
145
+ displayDataTypes={false}
146
+ enableClipboard
147
+ collapsed={false}
148
+ displayObjectSize={false}
149
+ />
150
+ </Box>
151
+ </Box>
152
+ </Flex>
153
+ );
154
+ };
155
+
156
+ export default TransactionDetails;
@@ -1,17 +1,17 @@
1
- import React, { useState } from "react";
1
+ import * as React from "react";
2
2
  import {
3
3
  Box,
4
4
  Card,
5
5
  CardBody,
6
6
  Flex,
7
- Stack,
8
7
  Typography,
9
8
  Badge,
10
9
  Button,
11
10
  } from "@strapi/design-system";
12
- import { ChevronDownIcon, ChevronUpIcon } from "./icons";
11
+ import { ChevronDownIcon, ChevronUpIcon } from "../icons";
12
+
13
13
  const TransactionHistoryItem = ({ transaction }) => {
14
- const [isExpanded, setIsExpanded] = useState(false);
14
+ const [isExpanded, setIsExpanded] = React.useState(false);
15
15
 
16
16
  const getStatusColor = (status) => {
17
17
  switch (status) {
@@ -82,9 +82,7 @@ const TransactionHistoryItem = ({ transaction }) => {
82
82
  padding={6}
83
83
  style={{ display: "flex", flexDirection: "column", gap: "6px" }}
84
84
  >
85
- {/* Main Values in Column Format */}
86
- <Stack spacing={3} marginBottom={4}>
87
- {/* Reference */}
85
+ <Flex direction="column" gap={3} style={{ marginBottom: "32px" }}>
88
86
  <Flex alignItems="center" gap={2}>
89
87
  <Typography variant="pi" textColor="neutral600" fontWeight="medium">
90
88
  Reference:
@@ -93,7 +91,6 @@ const TransactionHistoryItem = ({ transaction }) => {
93
91
  {transaction.reference}
94
92
  </Typography>
95
93
  </Flex>
96
- {/* Date */}
97
94
  <Flex alignItems="center" gap={2}>
98
95
  <Typography variant="pi" textColor="neutral600" fontWeight="medium">
99
96
  Date:
@@ -103,7 +100,6 @@ const TransactionHistoryItem = ({ transaction }) => {
103
100
  </Typography>
104
101
  </Flex>
105
102
 
106
- {/* Payment Method */}
107
103
  <Flex alignItems="center" gap={2}>
108
104
  <Typography variant="pi" textColor="neutral600" fontWeight="medium">
109
105
  Method:
@@ -126,7 +122,6 @@ const TransactionHistoryItem = ({ transaction }) => {
126
122
  )}
127
123
  </Flex>
128
124
 
129
- {/* Amount */}
130
125
  <Flex alignItems="center" gap={2}>
131
126
  <Typography variant="pi" textColor="neutral600" fontWeight="medium">
132
127
  Amount:
@@ -146,9 +141,8 @@ const TransactionHistoryItem = ({ transaction }) => {
146
141
  {transaction.status}
147
142
  </Badge>
148
143
  </Flex>
149
- </Stack>
144
+ </Flex>
150
145
 
151
- {/* Expand/Collapse Button */}
152
146
  <Flex justifyContent="center">
153
147
  <Button
154
148
  size="S"
@@ -166,7 +160,6 @@ const TransactionHistoryItem = ({ transaction }) => {
166
160
  </Button>
167
161
  </Flex>
168
162
 
169
- {/* Expanded Details */}
170
163
  {isExpanded && (
171
164
  <Flex
172
165
  marginTop={4}
@@ -175,11 +168,9 @@ const TransactionHistoryItem = ({ transaction }) => {
175
168
  gap: "32px",
176
169
  }}
177
170
  >
178
- <Stack spacing={4}>
179
- {/* Error Message */}
171
+ <Flex direction="column" gap={4}>
180
172
  {transaction.status === "ERROR" && (
181
173
  <Box
182
- marginBottom={4}
183
174
  padding={3}
184
175
  background="danger100"
185
176
  hasRadius
@@ -204,7 +195,6 @@ const TransactionHistoryItem = ({ transaction }) => {
204
195
  )}
205
196
  </Box>
206
197
  )}
207
- {/* Customer Information */}
208
198
  <Box>
209
199
  <Flex alignItems="center" gap={2} marginBottom={3}>
210
200
  <Typography
@@ -216,7 +206,7 @@ const TransactionHistoryItem = ({ transaction }) => {
216
206
  </Typography>
217
207
  </Flex>
218
208
  <Box paddingLeft={4}>
219
- <Stack spacing={2}>
209
+ <Flex direction="column" gap={2}>
220
210
  <Flex justifyContent="space-between" gap={3}>
221
211
  <Typography
222
212
  variant="pi"
@@ -280,11 +270,10 @@ const TransactionHistoryItem = ({ transaction }) => {
280
270
  {transaction.raw_request?.country}
281
271
  </Typography>
282
272
  </Flex>
283
- </Stack>
273
+ </Flex>
284
274
  </Box>
285
275
  </Box>
286
276
 
287
- {/* Payment Method Details */}
288
277
  <Box>
289
278
  <Flex alignItems="center" gap={2} marginBottom={3}>
290
279
  <Typography
@@ -296,7 +285,7 @@ const TransactionHistoryItem = ({ transaction }) => {
296
285
  </Typography>
297
286
  </Flex>
298
287
  <Box paddingLeft={4}>
299
- <Stack spacing={2}>
288
+ <Flex direction="column" gap={2}>
300
289
  <Flex justifyContent="space-between" gap={3}>
301
290
  <Typography
302
291
  variant="pi"
@@ -399,11 +388,10 @@ const TransactionHistoryItem = ({ transaction }) => {
399
388
  </Flex>
400
389
  </>
401
390
  )}
402
- </Stack>
391
+ </Flex>
403
392
  </Box>
404
393
  </Box>
405
394
 
406
- {/* Technical Details */}
407
395
  <Box>
408
396
  <Typography
409
397
  variant="pi"
@@ -414,7 +402,7 @@ const TransactionHistoryItem = ({ transaction }) => {
414
402
  Technical Details
415
403
  </Typography>
416
404
  <Box paddingLeft={4}>
417
- <Stack spacing={2}>
405
+ <Flex direction="column" gap={2}>
418
406
  <Flex justifyContent="space-between" gap={3}>
419
407
  <Typography
420
408
  variant="pi"
@@ -475,12 +463,12 @@ const TransactionHistoryItem = ({ transaction }) => {
475
463
  {transaction.raw_request?.customer_is_present}
476
464
  </Typography>
477
465
  </Flex>
478
- </Stack>
466
+ </Flex>
479
467
  </Box>
480
468
  </Box>
481
- </Stack>
469
+ </Flex>
482
470
 
483
- <Stack spacing={4}>
471
+ <Flex direction="column" gap={4}>
484
472
  <Typography variant="pi" fontWeight="bold" textColor="neutral800">
485
473
  Raw Body
486
474
  </Typography>
@@ -511,7 +499,7 @@ const TransactionHistoryItem = ({ transaction }) => {
511
499
  {JSON.stringify(transaction?.body || {}, null, 2)}
512
500
  </pre>
513
501
  </Box>
514
- </Stack>
502
+ </Flex>
515
503
  </Flex>
516
504
  )}
517
505
  </CardBody>
@@ -1,58 +1,38 @@
1
- import React, { useState, useEffect } from "react";
2
- import { useLocation, useHistory } from "react-router-dom";
3
- import { Layout, ContentLayout, Box } from "@strapi/design-system";
1
+ import * as React from "react";
2
+ import { Box } from "@strapi/design-system";
3
+ import { Layouts } from "@strapi/strapi/admin";
4
4
  import useSettings from "../hooks/useSettings";
5
- import useTransactionHistory from "../hooks/useTransactionHistory";
6
5
  import usePaymentActions from "../hooks/usePaymentActions";
7
6
  import AppHeader from "./components/AppHeader";
8
7
  import AppTabs from "./components/AppTabs";
9
8
  import ApplePayConfigPanel from "./components/ApplePayConfigPanel";
10
9
  import GooglePayConfigPanel from "./components/GooglePayConfigPanel";
11
10
  import "./styles.css";
12
- import pluginId from "../../pluginId";
13
11
 
14
12
  const App = () => {
15
- const location = useLocation();
16
- const history = useHistory();
17
- const [activeTab, setActiveTab] = useState(0);
18
-
19
- // Custom hooks
13
+ const [activeTab, setActiveTab] = React.useState(1);
14
+ const [currentView, setCurrentView] = React.useState("main");
20
15
  const settings = useSettings();
21
- const transactionHistory = useTransactionHistory();
22
16
  const paymentActions = usePaymentActions();
23
17
 
24
- useEffect(() => {
25
- if (
26
- location.pathname.includes("/apple-pay-config") ||
27
- location.pathname.includes("/google-pay-config")
28
- ) {
29
- } else {
30
- const tabFromPath = location.pathname.includes("/history")
31
- ? 1
32
- : location.pathname.includes("/payment-actions")
33
- ? 2
34
- : location.pathname.includes("/documentation")
35
- ? 3
36
- : 0;
37
- setActiveTab(tabFromPath);
38
- }
39
- }, [location.pathname]);
18
+ const handleNavigate = (view) => {
19
+ setCurrentView(view);
20
+ };
40
21
 
41
- const isApplePayConfigPage = location.pathname.includes("/apple-pay-config");
42
- const isGooglePayConfigPage =
43
- location.pathname.includes("/google-pay-config");
22
+ const isApplePayConfigPage = currentView === "apple-pay-config";
23
+ const isGooglePayConfigPage = currentView === "google-pay-config";
44
24
 
45
25
  if (isApplePayConfigPage) {
46
26
  return (
47
- <Layout>
27
+ <Layouts.Root>
48
28
  <AppHeader
49
29
  title="Apple Pay Configuration"
50
30
  activeTab={null}
51
31
  isSaving={settings.isSaving}
52
32
  onSave={settings.handleSave}
53
- onBack={() => history.push(`/plugins/${pluginId}`)}
33
+ onBack={() => handleNavigate("main")}
54
34
  />
55
- <ContentLayout>
35
+ <Layouts.Content>
56
36
  <Box padding={6}>
57
37
  <ApplePayConfigPanel
58
38
  settings={settings.settings}
@@ -61,78 +41,55 @@ const App = () => {
61
41
  onSave={settings.handleSave}
62
42
  />
63
43
  </Box>
64
- </ContentLayout>
65
- </Layout>
44
+ </Layouts.Content>
45
+ </Layouts.Root>
66
46
  );
67
47
  }
68
48
 
69
49
  if (isGooglePayConfigPage) {
70
50
  return (
71
- <Layout>
51
+ <Layouts.Root>
72
52
  <AppHeader
73
53
  title="Google Pay Configuration"
74
54
  activeTab={null}
75
55
  isSaving={settings.isSaving}
76
56
  onSave={settings.handleSave}
77
- onBack={() => history.push(`/plugins/${pluginId}`)}
57
+ onBack={() => handleNavigate("main")}
78
58
  />
79
- <ContentLayout>
59
+ <Layouts.Content>
80
60
  <Box padding={6}>
81
61
  <GooglePayConfigPanel
82
62
  settings={settings.settings}
83
63
  onInputChange={settings.handleInputChange}
84
64
  isSaving={settings.isSaving}
85
65
  onSave={settings.handleSave}
86
- onBack={() => history.push(`/plugins/${pluginId}`)}
66
+ onBack={() => handleNavigate("main")}
87
67
  />
88
68
  </Box>
89
- </ContentLayout>
90
- </Layout>
69
+ </Layouts.Content>
70
+ </Layouts.Root>
91
71
  );
92
72
  }
93
73
 
94
74
  return (
95
- <Layout>
75
+ <Layouts.Root>
96
76
  <AppHeader
97
77
  activeTab={activeTab}
98
78
  isSaving={settings.isSaving}
99
79
  onSave={settings.handleSave}
100
80
  />
101
- <ContentLayout>
81
+ <Layouts.Content>
102
82
  <Box padding={6}>
103
83
  <AppTabs
104
84
  activeTab={activeTab}
105
85
  setActiveTab={setActiveTab}
106
- settings={settings.settings}
107
- isSaving={settings.isSaving}
108
- isTesting={settings.isTesting}
109
- testResult={settings.testResult}
110
- onSave={settings.handleSave}
111
- onTestConnection={settings.handleTestConnection}
112
- onInputChange={settings.handleInputChange}
113
- onPaymentMethodToggle={settings.handlePaymentMethodToggle}
114
- filters={transactionHistory.filters}
115
- onFilterChange={transactionHistory.handleFilterChange}
116
- onFilterApply={transactionHistory.handleFilterApply}
117
- sorting={transactionHistory.sorting}
118
- onSort={transactionHistory.handleSort}
119
- isLoadingHistory={transactionHistory.isLoadingHistory}
120
- transactionHistory={transactionHistory.transactionHistory}
121
- paginatedTransactions={transactionHistory.paginatedTransactions}
122
- currentPage={transactionHistory.currentPage}
123
- totalPages={transactionHistory.totalPages}
124
- pageSize={transactionHistory.pageSize}
125
- onRefresh={transactionHistory.loadTransactionHistory}
126
- onPageChange={transactionHistory.handlePageChange}
127
- onPageSizeChange={transactionHistory.handlePageSizeChange}
128
- selectedTransaction={transactionHistory.selectedTransaction}
129
- onTransactionSelect={transactionHistory.handleTransactionSelect}
86
+ onNavigateToConfig={handleNavigate}
87
+ settings={settings}
130
88
  paymentActions={paymentActions}
131
- history={history}
132
89
  />
133
90
  </Box>
134
- </ContentLayout>
135
- </Layout>
91
+ </Layouts.Content>
92
+ </Layouts.Root>
136
93
  );
137
94
  };
138
95