strapi-plugin-payone-provider 4.6.10 → 4.6.12
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.
- package/README.md +64 -0
- package/admin/src/pages/App/components/AppHeader.jsx +3 -2
- package/admin/src/pages/App/components/AppTabs.jsx +34 -88
- package/admin/src/pages/App/components/DocsPanel.jsx +1726 -1726
- package/admin/src/pages/App/components/GooglePaybutton.jsx +300 -300
- package/admin/src/pages/App/components/StatusBadge.jsx +1 -1
- package/admin/src/pages/App/components/common/InfoTooltip.jsx +16 -0
- package/admin/src/pages/App/components/{ApplePayConfig.jsx → configuration/ApplePayConfig.jsx} +191 -62
- package/admin/src/pages/App/components/{ApplePayConfigPanel.jsx → configuration/ApplePayConfigPanel.jsx} +71 -70
- package/admin/src/pages/App/components/configuration/ConfigurationFields.jsx +408 -0
- package/admin/src/pages/App/components/configuration/ConfigurationPanel.jsx +67 -0
- package/admin/src/pages/App/components/{GooglePayConfig.jsx → configuration/GooglePayConfig.jsx} +254 -254
- package/admin/src/pages/App/components/{GooglePayConfigPanel.jsx → configuration/GooglePayConfigPanel.jsx} +82 -82
- package/admin/src/pages/App/components/configuration/TestConnection.jsx +129 -0
- package/admin/src/pages/App/components/paymentActions/ApplePayPanel.jsx +137 -95
- package/admin/src/pages/App/components/paymentActions/CaptureForm.jsx +119 -14
- package/admin/src/pages/App/components/paymentActions/CardDetailsInput.jsx +85 -24
- package/admin/src/pages/App/components/paymentActions/PaymentActionsPanel.jsx +361 -0
- package/admin/src/pages/App/components/paymentActions/PaymentMethodSelector.jsx +22 -4
- package/admin/src/pages/App/components/paymentActions/RefundForm.jsx +91 -20
- package/admin/src/pages/App/components/paymentActions/authorization/AuthorizationForm.jsx +157 -0
- package/admin/src/pages/App/components/paymentActions/authorization/AuthorizationFormFields.jsx +308 -0
- package/admin/src/pages/App/components/paymentActions/authorization/AuthorizationFormHeader.jsx +27 -0
- package/admin/src/pages/App/components/paymentActions/authorization/AuthorizationPaymentButtons.jsx +93 -0
- package/admin/src/pages/App/components/paymentActions/preauthorization/PreauthorizationForm.jsx +134 -0
- package/admin/src/pages/App/components/paymentActions/preauthorization/PreauthorizationFormFields.jsx +295 -0
- package/admin/src/pages/App/components/paymentActions/preauthorization/PreauthorizationFormHeader.jsx +27 -0
- package/admin/src/pages/App/components/paymentActions/preauthorization/PreauthorizationPaymentButtons.jsx +53 -0
- package/admin/src/pages/App/components/transaction-history/FiltersPanel.jsx +182 -0
- package/admin/src/pages/App/components/transaction-history/HistoryPanel.jsx +49 -0
- package/admin/src/pages/App/components/transaction-history/TransactionTable.jsx +199 -0
- package/admin/src/pages/App/components/transaction-history/TransactionTablePagination.jsx +28 -0
- package/admin/src/pages/App/components/transaction-history/details/TransactionDetails.jsx +155 -0
- package/admin/src/pages/App/index.jsx +5 -29
- package/admin/src/pages/hooks/usePaymentActions.js +87 -11
- package/admin/src/pages/hooks/useSettings.js +64 -22
- package/admin/src/pages/hooks/useTransactionHistory.js +121 -85
- package/admin/src/pages/utils/api.js +31 -3
- package/admin/src/pages/utils/countryLanguageUtils.js +236 -0
- package/admin/src/pages/utils/transactionTableUtils.js +60 -0
- package/package.json +2 -2
- package/server/bootstrap.js +6 -6
- package/server/content-types/index.js +5 -0
- package/server/content-types/transactions/index.js +5 -0
- package/server/content-types/transactions/schema.json +87 -0
- package/server/controllers/payone.js +29 -3
- package/server/index.js +2 -1
- package/server/policies/index.js +2 -1
- package/server/policies/is-payone-notification.js +31 -0
- package/server/routes/index.js +10 -0
- package/server/services/applePayService.js +0 -2
- package/server/services/payone.js +16 -4
- package/server/services/settingsService.js +8 -2
- package/server/services/testConnectionService.js +11 -72
- package/server/services/transactionService.js +147 -154
- package/server/services/transactionStatusService.js +63 -0
- package/server/utils/sanitize.js +41 -0
- package/admin/src/pages/App/components/ConfigurationPanel.jsx +0 -517
- package/admin/src/pages/App/components/CustomerInfoPopover.jsx +0 -147
- package/admin/src/pages/App/components/HistoryPanel.jsx +0 -94
- package/admin/src/pages/App/components/PaymentActionsPanel.jsx +0 -280
- package/admin/src/pages/App/components/RawDataPopover.jsx +0 -113
- package/admin/src/pages/App/components/TransactionHistoryItem.jsx +0 -522
- package/admin/src/pages/App/components/TransactionHistoryTable/TransactionHistoryTableFilters.jsx +0 -113
- package/admin/src/pages/App/components/TransactionHistoryTable/TransactionHistoryTablePagination.jsx +0 -180
- package/admin/src/pages/App/components/TransactionHistoryTable/index.jsx +0 -225
- package/admin/src/pages/App/components/paymentActions/AuthorizationForm.jsx +0 -197
- package/admin/src/pages/App/components/paymentActions/PreauthorizationForm.jsx +0 -142
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Box, Divider, Flex, Typography } from "@strapi/design-system";
|
|
2
|
+
import TransactionTable from "./TransactionTable";
|
|
3
|
+
|
|
4
|
+
const HistoryPanel = () => {
|
|
5
|
+
return (
|
|
6
|
+
<Box
|
|
7
|
+
className="payment-container"
|
|
8
|
+
paddingTop={8}
|
|
9
|
+
paddingBottom={8}
|
|
10
|
+
paddingLeft={8}
|
|
11
|
+
paddingRight={8}
|
|
12
|
+
>
|
|
13
|
+
<Flex direction="column" alignItems="stretch" gap={8}>
|
|
14
|
+
<Box>
|
|
15
|
+
<Typography
|
|
16
|
+
variant="beta"
|
|
17
|
+
as="h2"
|
|
18
|
+
className="payment-title"
|
|
19
|
+
style={{ fontSize: "20px", marginBottom: "4px" }}
|
|
20
|
+
>
|
|
21
|
+
Transaction Management
|
|
22
|
+
</Typography>
|
|
23
|
+
<Typography
|
|
24
|
+
variant="pi"
|
|
25
|
+
textColor="neutral600"
|
|
26
|
+
className="payment-subtitle"
|
|
27
|
+
style={{ fontSize: "14px", marginTop: "4px" }}
|
|
28
|
+
>
|
|
29
|
+
View and filter all payment transactions processed through Payone
|
|
30
|
+
</Typography>
|
|
31
|
+
</Box>
|
|
32
|
+
|
|
33
|
+
<Divider />
|
|
34
|
+
|
|
35
|
+
<TransactionTable />
|
|
36
|
+
|
|
37
|
+
<Box paddingTop={4}>
|
|
38
|
+
<Typography variant="sigma" textColor="neutral600">
|
|
39
|
+
Note: This shows all Payone transactions processed through this
|
|
40
|
+
plugin. Transactions are automatically logged with detailed
|
|
41
|
+
request/response data.
|
|
42
|
+
</Typography>
|
|
43
|
+
</Box>
|
|
44
|
+
</Flex>
|
|
45
|
+
</Box>
|
|
46
|
+
);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export default HistoryPanel;
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Box, Button, Flex, Typography, Tr, Td } from "@strapi/design-system";
|
|
3
|
+
import { Table } from "@strapi/helper-plugin";
|
|
4
|
+
import { ChevronDown, ChevronUp, ArrowUp, ArrowDown } from "@strapi/icons";
|
|
5
|
+
|
|
6
|
+
import StatusBadge from "../StatusBadge";
|
|
7
|
+
import FiltersPanel from "./FiltersPanel";
|
|
8
|
+
import TransactionDetails from "./details/TransactionDetails";
|
|
9
|
+
import TransactionTablePagination from "./TransactionTablePagination";
|
|
10
|
+
import useTransactionHistory from "../../../hooks/useTransactionHistory";
|
|
11
|
+
import {
|
|
12
|
+
formatAmount,
|
|
13
|
+
formatDate,
|
|
14
|
+
getPaymentMethodName,
|
|
15
|
+
} from "../../../utils/transactionTableUtils";
|
|
16
|
+
|
|
17
|
+
const TransactionTable = () => {
|
|
18
|
+
const {
|
|
19
|
+
transactions,
|
|
20
|
+
isLoadingHistory,
|
|
21
|
+
selectedTransaction,
|
|
22
|
+
filters,
|
|
23
|
+
handleFiltersChange,
|
|
24
|
+
handleTransactionSelect,
|
|
25
|
+
pagination,
|
|
26
|
+
sort,
|
|
27
|
+
handleSort,
|
|
28
|
+
} = useTransactionHistory();
|
|
29
|
+
|
|
30
|
+
const headers = [
|
|
31
|
+
{ name: "txid", label: "TxId", sortKey: "txid", sortable: true },
|
|
32
|
+
{ name: "reference", label: "Reference", sortKey: "reference", sortable: true },
|
|
33
|
+
{ name: "amount", label: "Amount", sortKey: "amount", sortable: true },
|
|
34
|
+
{ name: "paymentMethod", label: "Payment Method", sortKey: null, sortable: false },
|
|
35
|
+
{ name: "type", label: "Type", sortKey: "request_type", sortable: true },
|
|
36
|
+
{ name: "status", label: "Status", sortKey: "status", sortable: true },
|
|
37
|
+
{ name: "created_at", label: "Created At", sortKey: "createdAt", sortable: true },
|
|
38
|
+
{ name: "updated_at", label: "Updated At", sortKey: "updatedAt", sortable: true },
|
|
39
|
+
{ name: "details", label: "Details", sortKey: null, sortable: false },
|
|
40
|
+
];
|
|
41
|
+
|
|
42
|
+
const renderHeaderLabel = (header) => {
|
|
43
|
+
const isSorted = header.sortKey && sort.sort_by === header.sortKey;
|
|
44
|
+
const SortIcon = isSorted && sort.sort_order === "asc" ? ArrowUp : ArrowDown;
|
|
45
|
+
|
|
46
|
+
if (!header.sortable || !header.sortKey) {
|
|
47
|
+
return header.label;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<Flex
|
|
52
|
+
alignItems="center"
|
|
53
|
+
gap={1}
|
|
54
|
+
onClick={() => handleSort(header.sortKey)}
|
|
55
|
+
style={{ cursor: "pointer", userSelect: "none" }}
|
|
56
|
+
title={`Sort by ${header.label}`}
|
|
57
|
+
>
|
|
58
|
+
<Typography variant="sigma" textColor="neutral600">
|
|
59
|
+
{header.label}
|
|
60
|
+
</Typography>
|
|
61
|
+
{isSorted ? (
|
|
62
|
+
<SortIcon width={12} height={12} />
|
|
63
|
+
) : (
|
|
64
|
+
<Box width={12} height={12} aria-hidden />
|
|
65
|
+
)}
|
|
66
|
+
</Flex>
|
|
67
|
+
);
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<Flex direction="column" alignItems="stretch" gap={4} minHeight={"800px"}>
|
|
72
|
+
<FiltersPanel
|
|
73
|
+
filters={filters}
|
|
74
|
+
handleFiltersChange={handleFiltersChange}
|
|
75
|
+
isLoading={isLoadingHistory}
|
|
76
|
+
/>
|
|
77
|
+
<Box>
|
|
78
|
+
<Table.Root
|
|
79
|
+
colCount={9}
|
|
80
|
+
rows={transactions}
|
|
81
|
+
isLoading={isLoadingHistory}
|
|
82
|
+
isFetching={isLoadingHistory}
|
|
83
|
+
>
|
|
84
|
+
<Table.Content footer={null}>
|
|
85
|
+
<Table.Head>
|
|
86
|
+
{headers.map((header) => (
|
|
87
|
+
<Table.HeaderCell
|
|
88
|
+
fieldSchemaType="custom"
|
|
89
|
+
isSortable={header.sortable}
|
|
90
|
+
key={header.name}
|
|
91
|
+
label={renderHeaderLabel(header)}
|
|
92
|
+
name={header.name}
|
|
93
|
+
/>
|
|
94
|
+
))}
|
|
95
|
+
</Table.Head>
|
|
96
|
+
<Table.Body>
|
|
97
|
+
<Table.LoadingBody />
|
|
98
|
+
{transactions.length === 0 && !isLoadingHistory && (
|
|
99
|
+
<Tr>
|
|
100
|
+
<Td colSpan={9}>
|
|
101
|
+
<Box padding={6}>
|
|
102
|
+
<Typography textAlign="center" textColor="neutral600">
|
|
103
|
+
No transactions found
|
|
104
|
+
</Typography>
|
|
105
|
+
</Box>
|
|
106
|
+
</Td>
|
|
107
|
+
</Tr>
|
|
108
|
+
)}
|
|
109
|
+
{transactions.length > 0 &&
|
|
110
|
+
transactions.map((transaction) => {
|
|
111
|
+
const isSelected = selectedTransaction?.id === transaction.id;
|
|
112
|
+
return (
|
|
113
|
+
<React.Fragment key={transaction.id}>
|
|
114
|
+
<Tr>
|
|
115
|
+
<Td>
|
|
116
|
+
<Typography variant="pi" textColor="neutral600">
|
|
117
|
+
{transaction.txid || "N/A"}
|
|
118
|
+
</Typography>
|
|
119
|
+
</Td>
|
|
120
|
+
<Td>
|
|
121
|
+
<Typography variant="pi" fontWeight="medium">
|
|
122
|
+
{transaction.reference || "N/A"}
|
|
123
|
+
</Typography>
|
|
124
|
+
</Td>
|
|
125
|
+
<Td>
|
|
126
|
+
<Typography variant="pi" textColor="neutral600">
|
|
127
|
+
{formatAmount(
|
|
128
|
+
transaction.amount,
|
|
129
|
+
transaction.currency
|
|
130
|
+
)}
|
|
131
|
+
</Typography>
|
|
132
|
+
</Td>
|
|
133
|
+
<Td>
|
|
134
|
+
<Typography variant="pi">
|
|
135
|
+
{getPaymentMethodName(
|
|
136
|
+
transaction.raw_request?.clearingtype,
|
|
137
|
+
transaction.raw_request?.wallettype,
|
|
138
|
+
transaction.raw_request?.cardtype
|
|
139
|
+
)}
|
|
140
|
+
</Typography>
|
|
141
|
+
</Td>
|
|
142
|
+
<Td>
|
|
143
|
+
<Typography variant="pi" fontWeight="semiBold">
|
|
144
|
+
{transaction.request_type || "N/A"}
|
|
145
|
+
</Typography>
|
|
146
|
+
</Td>
|
|
147
|
+
<Td>
|
|
148
|
+
<StatusBadge
|
|
149
|
+
status={transaction?.status}
|
|
150
|
+
transaction={transaction}
|
|
151
|
+
/>
|
|
152
|
+
</Td>
|
|
153
|
+
<Td>
|
|
154
|
+
<Typography variant="pi" textColor="neutral600">
|
|
155
|
+
{formatDate(transaction.createdAt ?? transaction.created_at)}
|
|
156
|
+
</Typography>
|
|
157
|
+
</Td>
|
|
158
|
+
<Td>
|
|
159
|
+
<Typography variant="pi" textColor="neutral600">
|
|
160
|
+
{formatDate(transaction.updatedAt ?? transaction.updated_at)}
|
|
161
|
+
</Typography>
|
|
162
|
+
</Td>
|
|
163
|
+
<Td>
|
|
164
|
+
<Button
|
|
165
|
+
variant="tertiary"
|
|
166
|
+
size="S"
|
|
167
|
+
minWidth="100px"
|
|
168
|
+
startIcon={
|
|
169
|
+
isSelected ? <ChevronUp /> : <ChevronDown />
|
|
170
|
+
}
|
|
171
|
+
onClick={() => handleTransactionSelect(transaction)}
|
|
172
|
+
>
|
|
173
|
+
{isSelected ? "Hide" : "Details"}
|
|
174
|
+
</Button>
|
|
175
|
+
</Td>
|
|
176
|
+
</Tr>
|
|
177
|
+
{isSelected && (
|
|
178
|
+
<Tr>
|
|
179
|
+
<Td colSpan={9}>
|
|
180
|
+
<TransactionDetails transaction={transaction} />
|
|
181
|
+
</Td>
|
|
182
|
+
</Tr>
|
|
183
|
+
)}
|
|
184
|
+
</React.Fragment>
|
|
185
|
+
);
|
|
186
|
+
})}
|
|
187
|
+
</Table.Body>
|
|
188
|
+
</Table.Content>
|
|
189
|
+
</Table.Root>
|
|
190
|
+
</Box>
|
|
191
|
+
|
|
192
|
+
{transactions.length > 0 && (
|
|
193
|
+
<TransactionTablePagination pageCount={pagination.pageCount} />
|
|
194
|
+
)}
|
|
195
|
+
</Flex>
|
|
196
|
+
);
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
export default TransactionTable;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Flex, Box } from "@strapi/design-system";
|
|
2
|
+
import { PageSizeURLQuery, PaginationURLQuery } from "@strapi/helper-plugin";
|
|
3
|
+
|
|
4
|
+
const TransactionHistoryTablePagination = ({ pageCount }) => {
|
|
5
|
+
return (
|
|
6
|
+
<Box paddingTop={6} paddingBottom={4}>
|
|
7
|
+
<Flex
|
|
8
|
+
direction="row"
|
|
9
|
+
gap={2}
|
|
10
|
+
alignItems="center"
|
|
11
|
+
justifyContent="space-between"
|
|
12
|
+
wrap="wrap"
|
|
13
|
+
>
|
|
14
|
+
<PageSizeURLQuery
|
|
15
|
+
options={["5", "10", "20", "50", "100"]}
|
|
16
|
+
defaultValue={"10"}
|
|
17
|
+
/>
|
|
18
|
+
<PaginationURLQuery
|
|
19
|
+
pagination={{ pageCount }}
|
|
20
|
+
boundaryCount={1}
|
|
21
|
+
siblingCount={1}
|
|
22
|
+
/>
|
|
23
|
+
</Flex>
|
|
24
|
+
</Box>
|
|
25
|
+
);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export default TransactionHistoryTablePagination;
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import JsonView from "@uiw/react-json-view";
|
|
2
|
+
import { githubDarkTheme } from "@uiw/react-json-view/githubDark";
|
|
3
|
+
import { Box, Flex, Typography } from "@strapi/design-system";
|
|
4
|
+
import { getCardTypeName } from "../../../../utils/transactionTableUtils";
|
|
5
|
+
|
|
6
|
+
const TransactionDetails = ({ transaction }) => {
|
|
7
|
+
return (
|
|
8
|
+
<Flex direction="column" gap={4} alignItems={"stretch"} marginTop={4}>
|
|
9
|
+
{transaction.status === "ERROR" && (
|
|
10
|
+
<Box padding={3} background="danger100" hasRadius>
|
|
11
|
+
<Typography
|
|
12
|
+
variant="pi"
|
|
13
|
+
fontWeight="bold"
|
|
14
|
+
textColor="danger600"
|
|
15
|
+
marginBottom={1}
|
|
16
|
+
>
|
|
17
|
+
Error: {transaction.error_message || "Unknown error"}
|
|
18
|
+
</Typography>
|
|
19
|
+
{transaction.customer_message && (
|
|
20
|
+
<Typography variant="pi" textColor="danger600">
|
|
21
|
+
Customer Message: {transaction.customer_message}
|
|
22
|
+
</Typography>
|
|
23
|
+
)}
|
|
24
|
+
</Box>
|
|
25
|
+
)}
|
|
26
|
+
|
|
27
|
+
<Box
|
|
28
|
+
style={{
|
|
29
|
+
display: "grid",
|
|
30
|
+
gridTemplateColumns: "repeat(auto-fit,minmax(400px,1fr))",
|
|
31
|
+
gap: "16px",
|
|
32
|
+
marginBottom: "1.5rem",
|
|
33
|
+
}}
|
|
34
|
+
>
|
|
35
|
+
<Flex direction="column" gap={2} alignItems={"stretch"}>
|
|
36
|
+
<Typography
|
|
37
|
+
variant="pi"
|
|
38
|
+
fontWeight="bold"
|
|
39
|
+
textColor="neutral800"
|
|
40
|
+
marginBottom={3}
|
|
41
|
+
>
|
|
42
|
+
Customer Information
|
|
43
|
+
</Typography>
|
|
44
|
+
<Flex gap={3}>
|
|
45
|
+
<Typography variant="pi" textColor="neutral600" fontWeight="medium">
|
|
46
|
+
Name:
|
|
47
|
+
</Typography>
|
|
48
|
+
<Typography variant="pi" textColor="neutral800">
|
|
49
|
+
{transaction.raw_request?.firstname}{" "}
|
|
50
|
+
{transaction.raw_request?.lastname}
|
|
51
|
+
</Typography>
|
|
52
|
+
</Flex>
|
|
53
|
+
<Flex gap={3}>
|
|
54
|
+
<Typography variant="pi" textColor="neutral600" fontWeight="medium">
|
|
55
|
+
Email:
|
|
56
|
+
</Typography>
|
|
57
|
+
<Typography variant="pi" textColor="neutral800">
|
|
58
|
+
{transaction.raw_request?.email || "N/A"}
|
|
59
|
+
</Typography>
|
|
60
|
+
</Flex>
|
|
61
|
+
<Flex gap={3}>
|
|
62
|
+
<Typography variant="pi" textColor="neutral600" fontWeight="medium">
|
|
63
|
+
Phone:
|
|
64
|
+
</Typography>
|
|
65
|
+
<Typography variant="pi" textColor="neutral800">
|
|
66
|
+
{transaction.raw_request?.telephonenumber || "N/A"}
|
|
67
|
+
</Typography>
|
|
68
|
+
</Flex>
|
|
69
|
+
<Flex gap={3}>
|
|
70
|
+
<Typography variant="pi" textColor="neutral600" fontWeight="medium">
|
|
71
|
+
Address:
|
|
72
|
+
</Typography>
|
|
73
|
+
<Typography variant="pi" textColor="neutral800">
|
|
74
|
+
{transaction.raw_request?.street}, {transaction.raw_request?.zip}{" "}
|
|
75
|
+
{transaction.raw_request?.city}
|
|
76
|
+
</Typography>
|
|
77
|
+
</Flex>
|
|
78
|
+
</Flex>
|
|
79
|
+
<Flex direction="column" gap={2} alignItems={"stretch"}>
|
|
80
|
+
<Typography
|
|
81
|
+
variant="pi"
|
|
82
|
+
fontWeight="bold"
|
|
83
|
+
textColor="neutral800"
|
|
84
|
+
marginBottom={3}
|
|
85
|
+
>
|
|
86
|
+
Payment Details
|
|
87
|
+
</Typography>
|
|
88
|
+
<Flex gap={3}>
|
|
89
|
+
<Typography variant="pi" textColor="neutral600" fontWeight="medium">
|
|
90
|
+
TX ID:
|
|
91
|
+
</Typography>
|
|
92
|
+
<Typography variant="pi" textColor="neutral800">
|
|
93
|
+
{transaction.txid || "N/A"}
|
|
94
|
+
</Typography>
|
|
95
|
+
</Flex>
|
|
96
|
+
{transaction.raw_request?.clearingtype === "cc" && (
|
|
97
|
+
<>
|
|
98
|
+
<Flex gap={3}>
|
|
99
|
+
<Typography
|
|
100
|
+
variant="pi"
|
|
101
|
+
textColor="neutral600"
|
|
102
|
+
fontWeight="medium"
|
|
103
|
+
>
|
|
104
|
+
Card Type:
|
|
105
|
+
</Typography>
|
|
106
|
+
<Typography variant="pi" textColor="neutral800">
|
|
107
|
+
{getCardTypeName(transaction.raw_request?.cardtype)}
|
|
108
|
+
</Typography>
|
|
109
|
+
</Flex>
|
|
110
|
+
<Flex gap={3}>
|
|
111
|
+
<Typography
|
|
112
|
+
variant="pi"
|
|
113
|
+
textColor="neutral600"
|
|
114
|
+
fontWeight="medium"
|
|
115
|
+
>
|
|
116
|
+
Card Number:
|
|
117
|
+
</Typography>
|
|
118
|
+
<Typography variant="pi" textColor="neutral800">
|
|
119
|
+
**** **** ****{" "}
|
|
120
|
+
{transaction.raw_request?.cardpan?.slice(-4) || "****"}
|
|
121
|
+
</Typography>
|
|
122
|
+
</Flex>
|
|
123
|
+
</>
|
|
124
|
+
)}
|
|
125
|
+
<Flex gap={3}>
|
|
126
|
+
<Typography variant="pi" textColor="neutral600" fontWeight="medium">
|
|
127
|
+
Mode:
|
|
128
|
+
</Typography>
|
|
129
|
+
<Typography variant="pi" textColor="neutral800">
|
|
130
|
+
{transaction.raw_request?.mode || "N/A"}
|
|
131
|
+
</Typography>
|
|
132
|
+
</Flex>
|
|
133
|
+
</Flex>
|
|
134
|
+
</Box>
|
|
135
|
+
|
|
136
|
+
<Box>
|
|
137
|
+
<Typography variant="pi" fontWeight="bold" textColor="neutral800">
|
|
138
|
+
Transaction Data
|
|
139
|
+
</Typography>
|
|
140
|
+
<Box marginTop={4}>
|
|
141
|
+
<JsonView
|
|
142
|
+
value={transaction?.body || transaction?.raw_request || {}}
|
|
143
|
+
style={githubDarkTheme}
|
|
144
|
+
displayDataTypes={false}
|
|
145
|
+
enableClipboard
|
|
146
|
+
collapsed={false}
|
|
147
|
+
displayObjectSize={false}
|
|
148
|
+
/>
|
|
149
|
+
</Box>
|
|
150
|
+
</Box>
|
|
151
|
+
</Flex>
|
|
152
|
+
);
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
export default TransactionDetails;
|
|
@@ -2,12 +2,11 @@ import React, { useState, useEffect } from "react";
|
|
|
2
2
|
import { useLocation, useHistory } from "react-router-dom";
|
|
3
3
|
import { Layout, ContentLayout, Box } from "@strapi/design-system";
|
|
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
|
-
import ApplePayConfigPanel from "./components/ApplePayConfigPanel";
|
|
10
|
-
import GooglePayConfigPanel from "./components/GooglePayConfigPanel";
|
|
8
|
+
import ApplePayConfigPanel from "./components/configuration/ApplePayConfigPanel";
|
|
9
|
+
import GooglePayConfigPanel from "./components/configuration/GooglePayConfigPanel";
|
|
11
10
|
import "./styles.css";
|
|
12
11
|
import pluginId from "../../pluginId";
|
|
13
12
|
|
|
@@ -18,7 +17,6 @@ const App = () => {
|
|
|
18
17
|
|
|
19
18
|
// Custom hooks
|
|
20
19
|
const settings = useSettings();
|
|
21
|
-
const transactionHistory = useTransactionHistory();
|
|
22
20
|
const paymentActions = usePaymentActions();
|
|
23
21
|
|
|
24
22
|
useEffect(() => {
|
|
@@ -44,13 +42,11 @@ const App = () => {
|
|
|
44
42
|
|
|
45
43
|
if (isApplePayConfigPage) {
|
|
46
44
|
return (
|
|
47
|
-
<Layout>
|
|
45
|
+
<Layout sideNav={null}>
|
|
48
46
|
<AppHeader
|
|
49
|
-
title="Apple Pay Configuration"
|
|
50
47
|
activeTab={null}
|
|
51
48
|
isSaving={settings.isSaving}
|
|
52
49
|
onSave={settings.handleSave}
|
|
53
|
-
onBack={() => history.push(`/plugins/${pluginId}`)}
|
|
54
50
|
/>
|
|
55
51
|
<ContentLayout>
|
|
56
52
|
<Box padding={6}>
|
|
@@ -68,13 +64,11 @@ const App = () => {
|
|
|
68
64
|
|
|
69
65
|
if (isGooglePayConfigPage) {
|
|
70
66
|
return (
|
|
71
|
-
<Layout>
|
|
67
|
+
<Layout sideNav={null}>
|
|
72
68
|
<AppHeader
|
|
73
|
-
title="Google Pay Configuration"
|
|
74
69
|
activeTab={null}
|
|
75
70
|
isSaving={settings.isSaving}
|
|
76
71
|
onSave={settings.handleSave}
|
|
77
|
-
onBack={() => history.push(`/plugins/${pluginId}`)}
|
|
78
72
|
/>
|
|
79
73
|
<ContentLayout>
|
|
80
74
|
<Box padding={6}>
|
|
@@ -92,7 +86,7 @@ const App = () => {
|
|
|
92
86
|
}
|
|
93
87
|
|
|
94
88
|
return (
|
|
95
|
-
<Layout>
|
|
89
|
+
<Layout sideNav={null}>
|
|
96
90
|
<AppHeader
|
|
97
91
|
activeTab={activeTab}
|
|
98
92
|
isSaving={settings.isSaving}
|
|
@@ -104,29 +98,11 @@ const App = () => {
|
|
|
104
98
|
activeTab={activeTab}
|
|
105
99
|
setActiveTab={setActiveTab}
|
|
106
100
|
settings={settings.settings}
|
|
107
|
-
isSaving={settings.isSaving}
|
|
108
101
|
isTesting={settings.isTesting}
|
|
109
102
|
testResult={settings.testResult}
|
|
110
|
-
onSave={settings.handleSave}
|
|
111
103
|
onTestConnection={settings.handleTestConnection}
|
|
112
104
|
onInputChange={settings.handleInputChange}
|
|
113
105
|
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}
|
|
130
106
|
paymentActions={paymentActions}
|
|
131
107
|
history={history}
|
|
132
108
|
/>
|
|
@@ -52,6 +52,26 @@ const usePaymentActions = () => {
|
|
|
52
52
|
const [cardexpiredate, setCardexpiredate] = useState("");
|
|
53
53
|
const [cardcvc2, setCardcvc2] = useState("");
|
|
54
54
|
|
|
55
|
+
// Additional customer fields
|
|
56
|
+
const [firstname, setFirstname] = useState("");
|
|
57
|
+
const [lastname, setLastname] = useState("");
|
|
58
|
+
const [email, setEmail] = useState("");
|
|
59
|
+
const [telephonenumber, setTelephonenumber] = useState("");
|
|
60
|
+
const [gender, setGender] = useState("");
|
|
61
|
+
const [salutation, setSalutation] = useState("");
|
|
62
|
+
const [country, setCountry] = useState("");
|
|
63
|
+
const [currency, setCurrency] = useState("EUR");
|
|
64
|
+
const [city, setCity] = useState("");
|
|
65
|
+
const [street, setStreet] = useState("");
|
|
66
|
+
const [zip, setZip] = useState("");
|
|
67
|
+
|
|
68
|
+
// Capture form fields
|
|
69
|
+
const [captureCurrency, setCaptureCurrency] = useState("EUR");
|
|
70
|
+
const [captureSequenceNumber, setCaptureSequenceNumber] = useState("1");
|
|
71
|
+
|
|
72
|
+
// Refund form fields
|
|
73
|
+
const [refundCurrency, setRefundCurrency] = useState("EUR");
|
|
74
|
+
|
|
55
75
|
const [isProcessingPayment, setIsProcessingPayment] = useState(false);
|
|
56
76
|
const [paymentResult, setPaymentResult] = useState(null);
|
|
57
77
|
const [paymentError, setPaymentError] = useState(null);
|
|
@@ -85,16 +105,27 @@ const usePaymentActions = () => {
|
|
|
85
105
|
setPreauthReference(finalPreauthReference);
|
|
86
106
|
}
|
|
87
107
|
|
|
88
|
-
const
|
|
108
|
+
const finalCurrency = currency || ((paymentMethod === "cc" && cardtype === "A") ? "USD" : "EUR");
|
|
89
109
|
|
|
90
110
|
const baseParams = {
|
|
91
111
|
amount: parseInt(paymentAmount),
|
|
92
|
-
currency:
|
|
112
|
+
currency: finalCurrency,
|
|
93
113
|
reference: finalPreauthReference,
|
|
94
114
|
enable3DSecure: settings.enable3DSecure !== false,
|
|
95
115
|
invoiceid: finalPreauthReference,
|
|
96
116
|
narrative_text: "Preauthorization for order " + finalPreauthReference,
|
|
97
|
-
...DEFAULT_PAYMENT_DATA
|
|
117
|
+
...DEFAULT_PAYMENT_DATA,
|
|
118
|
+
// Override with form values if provided
|
|
119
|
+
...(firstname && { firstname }),
|
|
120
|
+
...(lastname && { lastname }),
|
|
121
|
+
...(email && { email }),
|
|
122
|
+
...(telephonenumber && { telephonenumber }),
|
|
123
|
+
...(gender && { gender }),
|
|
124
|
+
...(salutation && { salutation }),
|
|
125
|
+
...(country && { country }),
|
|
126
|
+
...(city && { city }),
|
|
127
|
+
...(street && { street }),
|
|
128
|
+
...(zip && { zip }),
|
|
98
129
|
};
|
|
99
130
|
|
|
100
131
|
if (paymentMethod === "cc" && settings.enable3DSecure !== false) {
|
|
@@ -210,16 +241,27 @@ const usePaymentActions = () => {
|
|
|
210
241
|
setAuthReference(finalAuthReference);
|
|
211
242
|
}
|
|
212
243
|
|
|
213
|
-
const
|
|
244
|
+
const finalCurrency = currency || ((paymentMethod === "cc" && cardtype === "A") ? "USD" : "EUR");
|
|
214
245
|
|
|
215
246
|
const baseParams = {
|
|
216
247
|
amount: parseInt(paymentAmount),
|
|
217
|
-
currency:
|
|
248
|
+
currency: finalCurrency,
|
|
218
249
|
reference: finalAuthReference,
|
|
219
250
|
enable3DSecure: settings.enable3DSecure !== false,
|
|
220
251
|
invoiceid: finalAuthReference,
|
|
221
252
|
narrative_text: "Authorization for order " + finalAuthReference,
|
|
222
|
-
...DEFAULT_PAYMENT_DATA
|
|
253
|
+
...DEFAULT_PAYMENT_DATA,
|
|
254
|
+
// Override with form values if provided
|
|
255
|
+
...(firstname && { firstname }),
|
|
256
|
+
...(lastname && { lastname }),
|
|
257
|
+
...(email && { email }),
|
|
258
|
+
...(telephonenumber && { telephonenumber }),
|
|
259
|
+
...(gender && { gender }),
|
|
260
|
+
...(salutation && { salutation }),
|
|
261
|
+
...(country && { country }),
|
|
262
|
+
...(city && { city }),
|
|
263
|
+
...(street && { street }),
|
|
264
|
+
...(zip && { zip }),
|
|
223
265
|
};
|
|
224
266
|
|
|
225
267
|
if (paymentMethod === "cc" && settings.enable3DSecure !== false) {
|
|
@@ -337,9 +379,9 @@ const usePaymentActions = () => {
|
|
|
337
379
|
const params = getCaptureParams(paymentMethod, {
|
|
338
380
|
txid: captureTxid,
|
|
339
381
|
amount: parseInt(paymentAmount),
|
|
340
|
-
currency: "EUR",
|
|
382
|
+
currency: captureCurrency || "EUR",
|
|
341
383
|
captureMode: captureMode,
|
|
342
|
-
sequencenumber: 1
|
|
384
|
+
sequencenumber: parseInt(captureSequenceNumber) || 1
|
|
343
385
|
});
|
|
344
386
|
|
|
345
387
|
const result = await payoneRequests.capture(params);
|
|
@@ -363,9 +405,9 @@ const usePaymentActions = () => {
|
|
|
363
405
|
try {
|
|
364
406
|
const params = getRefundParams(paymentMethod, {
|
|
365
407
|
txid: refundTxid,
|
|
366
|
-
sequencenumber: parseInt(refundSequenceNumber),
|
|
408
|
+
sequencenumber: parseInt(refundSequenceNumber) || 2,
|
|
367
409
|
amount: parseInt(paymentAmount),
|
|
368
|
-
currency: "EUR",
|
|
410
|
+
currency: refundCurrency || "EUR",
|
|
369
411
|
reference: refundReference || `REFUND-${Date.now()}`
|
|
370
412
|
});
|
|
371
413
|
|
|
@@ -427,7 +469,41 @@ const usePaymentActions = () => {
|
|
|
427
469
|
cardexpiredate,
|
|
428
470
|
setCardexpiredate,
|
|
429
471
|
cardcvc2,
|
|
430
|
-
setCardcvc2
|
|
472
|
+
setCardcvc2,
|
|
473
|
+
|
|
474
|
+
// Customer fields
|
|
475
|
+
firstname,
|
|
476
|
+
setFirstname,
|
|
477
|
+
lastname,
|
|
478
|
+
setLastname,
|
|
479
|
+
email,
|
|
480
|
+
setEmail,
|
|
481
|
+
telephonenumber,
|
|
482
|
+
setTelephonenumber,
|
|
483
|
+
gender,
|
|
484
|
+
setGender,
|
|
485
|
+
salutation,
|
|
486
|
+
setSalutation,
|
|
487
|
+
country,
|
|
488
|
+
setCountry,
|
|
489
|
+
currency,
|
|
490
|
+
setCurrency,
|
|
491
|
+
city,
|
|
492
|
+
setCity,
|
|
493
|
+
street,
|
|
494
|
+
setStreet,
|
|
495
|
+
zip,
|
|
496
|
+
setZip,
|
|
497
|
+
|
|
498
|
+
// Capture form fields
|
|
499
|
+
captureCurrency,
|
|
500
|
+
setCaptureCurrency,
|
|
501
|
+
captureSequenceNumber,
|
|
502
|
+
setCaptureSequenceNumber,
|
|
503
|
+
|
|
504
|
+
// Refund form fields
|
|
505
|
+
refundCurrency,
|
|
506
|
+
setRefundCurrency,
|
|
431
507
|
};
|
|
432
508
|
};
|
|
433
509
|
|