strapi-plugin-payone-provider 5.7.26 → 5.8.26
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 +1191 -1191
- package/admin/src/components/Initializer/index.jsx +16 -16
- package/admin/src/components/PluginIcon/index.jsx +17 -17
- package/admin/src/index.js +57 -57
- package/admin/src/pages/App/components/AppHeader.jsx +45 -45
- package/admin/src/pages/App/components/AppTabs.jsx +105 -105
- package/admin/src/pages/App/components/ApplePayBtn.jsx +355 -355
- package/admin/src/pages/App/components/ApplePayConfig.jsx +357 -357
- package/admin/src/pages/App/components/DocsPanel.jsx +53 -53
- package/admin/src/pages/App/components/RenderInput.jsx +78 -78
- package/admin/src/pages/App/components/StatusBadge.jsx +87 -87
- package/admin/src/pages/App/components/icons/BankIcon.jsx +10 -10
- package/admin/src/pages/App/components/icons/ChevronDownIcon.jsx +9 -9
- package/admin/src/pages/App/components/icons/ChevronUpIcon.jsx +9 -9
- package/admin/src/pages/App/components/icons/CreditCardIcon.jsx +9 -9
- package/admin/src/pages/App/components/icons/ErrorIcon.jsx +10 -10
- package/admin/src/pages/App/components/icons/InfoIcon.jsx +9 -9
- package/admin/src/pages/App/components/icons/MarkCircle.jsx +19 -19
- package/admin/src/pages/App/components/icons/PaymentIcon.jsx +10 -10
- package/admin/src/pages/App/components/icons/PendingIcon.jsx +9 -9
- package/admin/src/pages/App/components/icons/PersonIcon.jsx +9 -9
- package/admin/src/pages/App/components/icons/SuccessIcon.jsx +9 -9
- package/admin/src/pages/App/components/icons/WalletIcon.jsx +9 -9
- package/admin/src/pages/App/components/icons/index.jsx +12 -12
- package/admin/src/pages/App/components/payment-actions/AuthorizationForm.jsx +334 -334
- package/admin/src/pages/App/components/payment-actions/CaptureForm.jsx +120 -120
- package/admin/src/pages/App/components/payment-actions/PaymentActionsPanel.jsx +183 -183
- package/admin/src/pages/App/components/payment-actions/PaymentMethodSelector.jsx +315 -315
- package/admin/src/pages/App/components/payment-actions/PaymentResult.jsx +129 -129
- package/admin/src/pages/App/components/payment-actions/PreauthorizationForm.jsx +273 -273
- package/admin/src/pages/App/components/payment-actions/RefundForm.jsx +114 -114
- package/admin/src/pages/App/components/transaction-history/ImportExportBar.jsx +153 -153
- package/admin/src/pages/App/components/transaction-history/details/TransactionHistoryItem.jsx +526 -526
- package/admin/src/pages/App/index.jsx +96 -96
- package/admin/src/pages/App/styles.css +176 -176
- package/admin/src/pages/constants/paymentConstants.js +71 -71
- package/admin/src/pages/hooks/use-system-theme.js +27 -27
- package/admin/src/pages/hooks/usePaymentActions.js +498 -498
- package/admin/src/pages/hooks/usePluginTranslations.js +12 -12
- package/admin/src/pages/hooks/useSettings.js +183 -183
- package/admin/src/pages/hooks/useTransactionHistory.js +148 -148
- package/admin/src/pages/utils/api.js +97 -97
- package/admin/src/pages/utils/applePayConstants.js +196 -196
- package/admin/src/pages/utils/formatTransactionData.js +15 -15
- package/admin/src/pages/utils/getInputComponent.jsx +200 -200
- package/admin/src/pages/utils/paymentUtils.js +661 -661
- package/admin/src/pages/utils/tooltipHelpers.js +18 -18
- package/admin/src/pages/utils/transactionTableUtils.js +71 -71
- package/admin/src/pluginId.js +9 -9
- package/admin/src/translations/de.json +235 -235
- package/admin/src/translations/en.json +235 -235
- package/admin/src/translations/fr.json +235 -235
- package/admin/src/translations/ru.json +235 -235
- package/admin/src/utils/prefixPluginTranslations.js +13 -13
- package/package.json +45 -45
- package/server/bootstrap.js +107 -107
- package/server/config/index.js +83 -83
- package/server/content-types/index.js +4 -4
- package/server/content-types/transactions/index.js +4 -4
- package/server/content-types/transactions/schema.json +86 -86
- package/server/controllers/index.js +7 -7
- package/server/controllers/payone.js +503 -506
- package/server/destroy.js +5 -5
- package/server/index.js +23 -23
- package/server/policies/index.js +7 -7
- package/server/policies/is-auth.js +29 -29
- package/server/policies/isSuperAdmin.js +20 -20
- package/server/register.js +5 -5
- package/server/routes/index.js +218 -218
- package/server/services/applePayService.js +295 -295
- package/server/services/index.js +9 -9
- package/server/services/paymentService.js +264 -223
- package/server/services/payone.js +78 -78
- package/server/services/settingsService.js +59 -59
- package/server/services/testConnectionService.js +115 -115
- package/server/services/transactionService.js +262 -262
- package/server/utils/csvTransactions.js +82 -82
- package/server/utils/normalize.js +39 -39
- package/server/utils/paymentMethodParams.js +288 -288
- package/server/utils/requestBuilder.js +115 -100
- package/server/utils/responseParser.js +141 -141
- package/strapi-admin.js +4 -4
- package/strapi-server.js +3 -3
|
@@ -1,120 +1,120 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { Box, Flex, Typography, Button } from "@strapi/design-system";
|
|
3
|
-
import { Play } from "@strapi/icons";
|
|
4
|
-
import RenderInput from "../RenderInput";
|
|
5
|
-
import { getCurrencyOptions } from "../../../utils/countryLanguageUtils";
|
|
6
|
-
import { usePluginTranslations } from "../../../hooks/usePluginTranslations";
|
|
7
|
-
|
|
8
|
-
const CaptureForm = ({ paymentActions }) => {
|
|
9
|
-
const { t } = usePluginTranslations();
|
|
10
|
-
const currencyOptions = getCurrencyOptions();
|
|
11
|
-
return (
|
|
12
|
-
<Flex direction="column" alignItems="stretch" gap={4}>
|
|
13
|
-
<Flex direction="row" gap={2}>
|
|
14
|
-
<Typography variant="omega" fontWeight="semiBold" textColor="neutral800" className="payment-form-title">
|
|
15
|
-
{t("capture.title", "Capture")}
|
|
16
|
-
</Typography>
|
|
17
|
-
<Typography variant="pi" textColor="neutral600" className="payment-form-description">
|
|
18
|
-
{t("capture.description", "Capture a previously preauthorized amount.")}
|
|
19
|
-
</Typography>
|
|
20
|
-
</Flex>
|
|
21
|
-
|
|
22
|
-
<Box
|
|
23
|
-
style={{
|
|
24
|
-
display: "grid",
|
|
25
|
-
gridTemplateColumns: "repeat(auto-fit, minmax(250px, 1fr))",
|
|
26
|
-
gap: "16px",
|
|
27
|
-
}}
|
|
28
|
-
>
|
|
29
|
-
<RenderInput
|
|
30
|
-
name="captureTxid"
|
|
31
|
-
label={t("common.transactionId", "Transaction ID *")}
|
|
32
|
-
value={paymentActions.paymentState.captureTxid || ""}
|
|
33
|
-
onChange={(e) =>
|
|
34
|
-
paymentActions.handleFieldChange("captureTxid", e.target.value)
|
|
35
|
-
}
|
|
36
|
-
inputType="textInput"
|
|
37
|
-
placeholder={t("capture.placeholderTxid", "Enter TxId from preauthorization")}
|
|
38
|
-
required
|
|
39
|
-
tooltipContent={t("capture.tooltipTxid", "Transaction ID from a previous preauthorization")}
|
|
40
|
-
/>
|
|
41
|
-
|
|
42
|
-
<RenderInput
|
|
43
|
-
name="captureAmount"
|
|
44
|
-
label={t("common.amount", "Amount *")}
|
|
45
|
-
value={paymentActions.paymentState.paymentAmount || ""}
|
|
46
|
-
onChange={(e) =>
|
|
47
|
-
paymentActions.handleFieldChange("paymentAmount", e.target.value)
|
|
48
|
-
}
|
|
49
|
-
inputType="textInput"
|
|
50
|
-
placeholder="1000"
|
|
51
|
-
required
|
|
52
|
-
tooltipContent={t("capture.tooltipAmount", "Amount in cents to capture")}
|
|
53
|
-
/>
|
|
54
|
-
|
|
55
|
-
<RenderInput
|
|
56
|
-
name="captureCurrency"
|
|
57
|
-
label={t("common.currency", "Currency")}
|
|
58
|
-
value={paymentActions.paymentState.captureCurrency || "EUR"}
|
|
59
|
-
onChange={(e) =>
|
|
60
|
-
paymentActions.handleFieldChange("captureCurrency", e.target.value)
|
|
61
|
-
}
|
|
62
|
-
inputType="select"
|
|
63
|
-
options={currencyOptions}
|
|
64
|
-
placeholder="EUR"
|
|
65
|
-
tooltipContent="Currency code (e.g., EUR, USD)"
|
|
66
|
-
/>
|
|
67
|
-
|
|
68
|
-
<RenderInput
|
|
69
|
-
name="captureSequenceNumber"
|
|
70
|
-
label={t("capture.sequenceNumber", "Sequence Number")}
|
|
71
|
-
value={paymentActions.paymentState.captureSequenceNumber || "1"}
|
|
72
|
-
onChange={(e) =>
|
|
73
|
-
paymentActions.handleFieldChange(
|
|
74
|
-
"captureSequenceNumber",
|
|
75
|
-
e.target.value
|
|
76
|
-
)
|
|
77
|
-
}
|
|
78
|
-
inputType="textInput"
|
|
79
|
-
placeholder="1"
|
|
80
|
-
tooltipContent={t("capture.tooltipSequence", "Sequence number for this capture (1-127), default is 1")}
|
|
81
|
-
/>
|
|
82
|
-
|
|
83
|
-
{["wlt", "gpp", "apl"].includes(
|
|
84
|
-
paymentActions.paymentState.paymentMethod
|
|
85
|
-
) && (
|
|
86
|
-
<RenderInput
|
|
87
|
-
name="captureMode"
|
|
88
|
-
label="Capture Mode"
|
|
89
|
-
value={paymentActions.paymentState.captureMode || "full"}
|
|
90
|
-
onChange={(e) =>
|
|
91
|
-
paymentActions.handleFieldChange("captureMode", e.target.value)
|
|
92
|
-
}
|
|
93
|
-
inputType="select"
|
|
94
|
-
options={[
|
|
95
|
-
{ value: "full", label: "Full" },
|
|
96
|
-
{ value: "partial", label: "Partial" },
|
|
97
|
-
]}
|
|
98
|
-
tooltipContent="Capture mode for wallet payments: full or partial"
|
|
99
|
-
/>
|
|
100
|
-
)}
|
|
101
|
-
</Box>
|
|
102
|
-
|
|
103
|
-
<Button
|
|
104
|
-
variant="default"
|
|
105
|
-
onClick={() => paymentActions.handleCapture()}
|
|
106
|
-
loading={paymentActions.isProcessingPayment}
|
|
107
|
-
startIcon={<Play />}
|
|
108
|
-
style={{ maxWidth: "200px" }}
|
|
109
|
-
disabled={
|
|
110
|
-
!paymentActions.paymentState.captureTxid?.trim() ||
|
|
111
|
-
!paymentActions.paymentState.paymentAmount?.trim()
|
|
112
|
-
}
|
|
113
|
-
>
|
|
114
|
-
{t("capture.submit", "Capture")}
|
|
115
|
-
</Button>
|
|
116
|
-
</Flex>
|
|
117
|
-
);
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
export default CaptureForm;
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Box, Flex, Typography, Button } from "@strapi/design-system";
|
|
3
|
+
import { Play } from "@strapi/icons";
|
|
4
|
+
import RenderInput from "../RenderInput";
|
|
5
|
+
import { getCurrencyOptions } from "../../../utils/countryLanguageUtils";
|
|
6
|
+
import { usePluginTranslations } from "../../../hooks/usePluginTranslations";
|
|
7
|
+
|
|
8
|
+
const CaptureForm = ({ paymentActions }) => {
|
|
9
|
+
const { t } = usePluginTranslations();
|
|
10
|
+
const currencyOptions = getCurrencyOptions();
|
|
11
|
+
return (
|
|
12
|
+
<Flex direction="column" alignItems="stretch" gap={4}>
|
|
13
|
+
<Flex direction="row" gap={2}>
|
|
14
|
+
<Typography variant="omega" fontWeight="semiBold" textColor="neutral800" className="payment-form-title">
|
|
15
|
+
{t("capture.title", "Capture")}
|
|
16
|
+
</Typography>
|
|
17
|
+
<Typography variant="pi" textColor="neutral600" className="payment-form-description">
|
|
18
|
+
{t("capture.description", "Capture a previously preauthorized amount.")}
|
|
19
|
+
</Typography>
|
|
20
|
+
</Flex>
|
|
21
|
+
|
|
22
|
+
<Box
|
|
23
|
+
style={{
|
|
24
|
+
display: "grid",
|
|
25
|
+
gridTemplateColumns: "repeat(auto-fit, minmax(250px, 1fr))",
|
|
26
|
+
gap: "16px",
|
|
27
|
+
}}
|
|
28
|
+
>
|
|
29
|
+
<RenderInput
|
|
30
|
+
name="captureTxid"
|
|
31
|
+
label={t("common.transactionId", "Transaction ID *")}
|
|
32
|
+
value={paymentActions.paymentState.captureTxid || ""}
|
|
33
|
+
onChange={(e) =>
|
|
34
|
+
paymentActions.handleFieldChange("captureTxid", e.target.value)
|
|
35
|
+
}
|
|
36
|
+
inputType="textInput"
|
|
37
|
+
placeholder={t("capture.placeholderTxid", "Enter TxId from preauthorization")}
|
|
38
|
+
required
|
|
39
|
+
tooltipContent={t("capture.tooltipTxid", "Transaction ID from a previous preauthorization")}
|
|
40
|
+
/>
|
|
41
|
+
|
|
42
|
+
<RenderInput
|
|
43
|
+
name="captureAmount"
|
|
44
|
+
label={t("common.amount", "Amount *")}
|
|
45
|
+
value={paymentActions.paymentState.paymentAmount || ""}
|
|
46
|
+
onChange={(e) =>
|
|
47
|
+
paymentActions.handleFieldChange("paymentAmount", e.target.value)
|
|
48
|
+
}
|
|
49
|
+
inputType="textInput"
|
|
50
|
+
placeholder="1000"
|
|
51
|
+
required
|
|
52
|
+
tooltipContent={t("capture.tooltipAmount", "Amount in cents to capture")}
|
|
53
|
+
/>
|
|
54
|
+
|
|
55
|
+
<RenderInput
|
|
56
|
+
name="captureCurrency"
|
|
57
|
+
label={t("common.currency", "Currency")}
|
|
58
|
+
value={paymentActions.paymentState.captureCurrency || "EUR"}
|
|
59
|
+
onChange={(e) =>
|
|
60
|
+
paymentActions.handleFieldChange("captureCurrency", e.target.value)
|
|
61
|
+
}
|
|
62
|
+
inputType="select"
|
|
63
|
+
options={currencyOptions}
|
|
64
|
+
placeholder="EUR"
|
|
65
|
+
tooltipContent="Currency code (e.g., EUR, USD)"
|
|
66
|
+
/>
|
|
67
|
+
|
|
68
|
+
<RenderInput
|
|
69
|
+
name="captureSequenceNumber"
|
|
70
|
+
label={t("capture.sequenceNumber", "Sequence Number")}
|
|
71
|
+
value={paymentActions.paymentState.captureSequenceNumber || "1"}
|
|
72
|
+
onChange={(e) =>
|
|
73
|
+
paymentActions.handleFieldChange(
|
|
74
|
+
"captureSequenceNumber",
|
|
75
|
+
e.target.value
|
|
76
|
+
)
|
|
77
|
+
}
|
|
78
|
+
inputType="textInput"
|
|
79
|
+
placeholder="1"
|
|
80
|
+
tooltipContent={t("capture.tooltipSequence", "Sequence number for this capture (1-127), default is 1")}
|
|
81
|
+
/>
|
|
82
|
+
|
|
83
|
+
{["wlt", "gpp", "apl"].includes(
|
|
84
|
+
paymentActions.paymentState.paymentMethod
|
|
85
|
+
) && (
|
|
86
|
+
<RenderInput
|
|
87
|
+
name="captureMode"
|
|
88
|
+
label="Capture Mode"
|
|
89
|
+
value={paymentActions.paymentState.captureMode || "full"}
|
|
90
|
+
onChange={(e) =>
|
|
91
|
+
paymentActions.handleFieldChange("captureMode", e.target.value)
|
|
92
|
+
}
|
|
93
|
+
inputType="select"
|
|
94
|
+
options={[
|
|
95
|
+
{ value: "full", label: "Full" },
|
|
96
|
+
{ value: "partial", label: "Partial" },
|
|
97
|
+
]}
|
|
98
|
+
tooltipContent="Capture mode for wallet payments: full or partial"
|
|
99
|
+
/>
|
|
100
|
+
)}
|
|
101
|
+
</Box>
|
|
102
|
+
|
|
103
|
+
<Button
|
|
104
|
+
variant="default"
|
|
105
|
+
onClick={() => paymentActions.handleCapture()}
|
|
106
|
+
loading={paymentActions.isProcessingPayment}
|
|
107
|
+
startIcon={<Play />}
|
|
108
|
+
style={{ maxWidth: "200px" }}
|
|
109
|
+
disabled={
|
|
110
|
+
!paymentActions.paymentState.captureTxid?.trim() ||
|
|
111
|
+
!paymentActions.paymentState.paymentAmount?.trim()
|
|
112
|
+
}
|
|
113
|
+
>
|
|
114
|
+
{t("capture.submit", "Capture")}
|
|
115
|
+
</Button>
|
|
116
|
+
</Flex>
|
|
117
|
+
);
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
export default CaptureForm;
|
|
@@ -1,183 +1,183 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { Box, Flex, Typography, Accordion } from "@strapi/design-system";
|
|
3
|
-
import PaymentMethodSelector from "./PaymentMethodSelector";
|
|
4
|
-
import PreauthorizationForm from "./PreauthorizationForm";
|
|
5
|
-
import AuthorizationForm from "./AuthorizationForm";
|
|
6
|
-
import CaptureForm from "./CaptureForm";
|
|
7
|
-
import RefundForm from "./RefundForm";
|
|
8
|
-
import PaymentResult from "./PaymentResult";
|
|
9
|
-
import ApplePayPanel from "./ApplePayPanel";
|
|
10
|
-
import { usePluginTranslations } from "../../../hooks/usePluginTranslations";
|
|
11
|
-
|
|
12
|
-
const PaymentActionsPanel = ({
|
|
13
|
-
onNavigateToConfig,
|
|
14
|
-
settings,
|
|
15
|
-
paymentActions,
|
|
16
|
-
}) => {
|
|
17
|
-
const { t } = usePluginTranslations();
|
|
18
|
-
const mode = (settings?.settings?.mode || "test").toLowerCase();
|
|
19
|
-
const isLiveMode = mode === "live";
|
|
20
|
-
|
|
21
|
-
React.useEffect(() => {
|
|
22
|
-
if (isLiveMode && paymentActions.paymentState.paymentMethod !== "apl") {
|
|
23
|
-
paymentActions.handleFieldChange("paymentMethod", "apl");
|
|
24
|
-
}
|
|
25
|
-
}, [
|
|
26
|
-
isLiveMode,
|
|
27
|
-
paymentActions.paymentState.paymentMethod,
|
|
28
|
-
paymentActions.handleFieldChange,
|
|
29
|
-
]);
|
|
30
|
-
|
|
31
|
-
if (isLiveMode && paymentActions.paymentState.paymentMethod !== "apl") {
|
|
32
|
-
return (
|
|
33
|
-
<Box
|
|
34
|
-
style={{
|
|
35
|
-
display: "flex",
|
|
36
|
-
flexDirection: "column",
|
|
37
|
-
alignItems: "center",
|
|
38
|
-
justifyContent: "center",
|
|
39
|
-
gap: "8px",
|
|
40
|
-
marginTop: "44px",
|
|
41
|
-
}}
|
|
42
|
-
>
|
|
43
|
-
<Typography variant="pi" textColor="neutral600">
|
|
44
|
-
{t("paymentActions.testModeOnly", "Test Payments are only works in test mode.")}
|
|
45
|
-
</Typography>
|
|
46
|
-
<Typography variant="pi" textColor="neutral600">
|
|
47
|
-
{t("paymentActions.switchToTestMode", "Please switch to test mode in plugin settings to use test payments.")}
|
|
48
|
-
</Typography>
|
|
49
|
-
</Box>
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
if (paymentActions.paymentState.paymentMethod === "apl") {
|
|
54
|
-
return (
|
|
55
|
-
<ApplePayPanel
|
|
56
|
-
onNavigateToConfig={onNavigateToConfig}
|
|
57
|
-
isLiveMode={isLiveMode}
|
|
58
|
-
paymentActions={paymentActions}
|
|
59
|
-
settings={settings}
|
|
60
|
-
/>
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
return (
|
|
65
|
-
<Box
|
|
66
|
-
className="payment-container"
|
|
67
|
-
paddingTop={8}
|
|
68
|
-
paddingBottom={8}
|
|
69
|
-
paddingLeft={8}
|
|
70
|
-
paddingRight={8}
|
|
71
|
-
>
|
|
72
|
-
<Flex direction="column" alignItems="stretch" gap={6}>
|
|
73
|
-
<Box
|
|
74
|
-
style={{
|
|
75
|
-
display: "flex",
|
|
76
|
-
flexDirection: "column",
|
|
77
|
-
alignItems: "flex-start",
|
|
78
|
-
gap: "8px",
|
|
79
|
-
}}
|
|
80
|
-
>
|
|
81
|
-
<Typography variant="beta" as="h2" className="payment-title" style={{ fontSize: "20px", marginBottom: "4px" }}>
|
|
82
|
-
{t("paymentActions.title", "Payment Actions")}
|
|
83
|
-
</Typography>
|
|
84
|
-
<Typography variant="pi" textColor="neutral600" className="payment-subtitle" style={{ fontSize: "14px" }}>
|
|
85
|
-
{t("paymentActions.subtitle", "Perform preauthorization, capture, refund and other payment operations.")}
|
|
86
|
-
</Typography>
|
|
87
|
-
</Box>
|
|
88
|
-
|
|
89
|
-
<PaymentMethodSelector
|
|
90
|
-
paymentActions={paymentActions}
|
|
91
|
-
onNavigateToConfig={onNavigateToConfig}
|
|
92
|
-
isLiveMode={isLiveMode}
|
|
93
|
-
/>
|
|
94
|
-
|
|
95
|
-
<Accordion.Root>
|
|
96
|
-
{/* Preauthorization */}
|
|
97
|
-
<Accordion.Item value="preauthorization">
|
|
98
|
-
<Accordion.Header>
|
|
99
|
-
<Accordion.Trigger>{t("preauth.title", "Preauthorization")}</Accordion.Trigger>
|
|
100
|
-
</Accordion.Header>
|
|
101
|
-
<Accordion.Content>
|
|
102
|
-
<Box
|
|
103
|
-
className="payment-form-section"
|
|
104
|
-
style={{
|
|
105
|
-
opacity: isLiveMode ? 0.5 : 1,
|
|
106
|
-
pointerEvents: isLiveMode ? "none" : "auto",
|
|
107
|
-
}}
|
|
108
|
-
>
|
|
109
|
-
<PreauthorizationForm
|
|
110
|
-
paymentActions={paymentActions}
|
|
111
|
-
settings={settings}
|
|
112
|
-
/>
|
|
113
|
-
</Box>
|
|
114
|
-
</Accordion.Content>
|
|
115
|
-
</Accordion.Item>
|
|
116
|
-
{/* Authorization */}
|
|
117
|
-
<Accordion.Item value="authorization">
|
|
118
|
-
<Accordion.Header>
|
|
119
|
-
<Accordion.Trigger>{t("auth.title", "Authorization")}</Accordion.Trigger>
|
|
120
|
-
</Accordion.Header>
|
|
121
|
-
<Accordion.Content>
|
|
122
|
-
<Box className="payment-form-section">
|
|
123
|
-
<AuthorizationForm
|
|
124
|
-
paymentActions={paymentActions}
|
|
125
|
-
settings={settings}
|
|
126
|
-
/>
|
|
127
|
-
</Box>
|
|
128
|
-
</Accordion.Content>
|
|
129
|
-
</Accordion.Item>
|
|
130
|
-
{/* Capture */}
|
|
131
|
-
<Accordion.Item value="capture">
|
|
132
|
-
<Accordion.Header>
|
|
133
|
-
<Accordion.Trigger>{t("capture.title", "Capture")}</Accordion.Trigger>
|
|
134
|
-
</Accordion.Header>
|
|
135
|
-
<Accordion.Content>
|
|
136
|
-
<Box
|
|
137
|
-
className="payment-form-section"
|
|
138
|
-
style={{
|
|
139
|
-
opacity: isLiveMode ? 0.5 : 1,
|
|
140
|
-
pointerEvents: isLiveMode ? "none" : "auto",
|
|
141
|
-
}}
|
|
142
|
-
>
|
|
143
|
-
<CaptureForm paymentActions={paymentActions} />
|
|
144
|
-
</Box>
|
|
145
|
-
</Accordion.Content>
|
|
146
|
-
</Accordion.Item>
|
|
147
|
-
{/* Refund */}
|
|
148
|
-
<Accordion.Item value="refund">
|
|
149
|
-
<Accordion.Header>
|
|
150
|
-
<Accordion.Trigger>{t("refund.title", "Refund")}</Accordion.Trigger>
|
|
151
|
-
</Accordion.Header>
|
|
152
|
-
<Accordion.Content>
|
|
153
|
-
<Box
|
|
154
|
-
className="payment-form-section"
|
|
155
|
-
style={{
|
|
156
|
-
opacity: isLiveMode ? 0.5 : 1,
|
|
157
|
-
pointerEvents: isLiveMode ? "none" : "auto",
|
|
158
|
-
}}
|
|
159
|
-
>
|
|
160
|
-
<RefundForm paymentActions={paymentActions} />
|
|
161
|
-
</Box>
|
|
162
|
-
</Accordion.Content>
|
|
163
|
-
</Accordion.Item>
|
|
164
|
-
</Accordion.Root>
|
|
165
|
-
|
|
166
|
-
<hr className="payment-divider" />
|
|
167
|
-
|
|
168
|
-
<PaymentResult
|
|
169
|
-
paymentError={paymentActions.paymentError}
|
|
170
|
-
paymentResult={paymentActions.paymentResult}
|
|
171
|
-
/>
|
|
172
|
-
|
|
173
|
-
<Box paddingTop={4}>
|
|
174
|
-
<Typography variant="sigma" textColor="neutral600">
|
|
175
|
-
{t("paymentActions.note", "Note: These payment actions allow you to test the complete payment flow: Preauthorization → Capture → Refund. Make sure to use valid Transaction IDs for capture and refund operations.")}
|
|
176
|
-
</Typography>
|
|
177
|
-
</Box>
|
|
178
|
-
</Flex>
|
|
179
|
-
</Box>
|
|
180
|
-
);
|
|
181
|
-
};
|
|
182
|
-
|
|
183
|
-
export default PaymentActionsPanel;
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Box, Flex, Typography, Accordion } from "@strapi/design-system";
|
|
3
|
+
import PaymentMethodSelector from "./PaymentMethodSelector";
|
|
4
|
+
import PreauthorizationForm from "./PreauthorizationForm";
|
|
5
|
+
import AuthorizationForm from "./AuthorizationForm";
|
|
6
|
+
import CaptureForm from "./CaptureForm";
|
|
7
|
+
import RefundForm from "./RefundForm";
|
|
8
|
+
import PaymentResult from "./PaymentResult";
|
|
9
|
+
import ApplePayPanel from "./ApplePayPanel";
|
|
10
|
+
import { usePluginTranslations } from "../../../hooks/usePluginTranslations";
|
|
11
|
+
|
|
12
|
+
const PaymentActionsPanel = ({
|
|
13
|
+
onNavigateToConfig,
|
|
14
|
+
settings,
|
|
15
|
+
paymentActions,
|
|
16
|
+
}) => {
|
|
17
|
+
const { t } = usePluginTranslations();
|
|
18
|
+
const mode = (settings?.settings?.mode || "test").toLowerCase();
|
|
19
|
+
const isLiveMode = mode === "live";
|
|
20
|
+
|
|
21
|
+
React.useEffect(() => {
|
|
22
|
+
if (isLiveMode && paymentActions.paymentState.paymentMethod !== "apl") {
|
|
23
|
+
paymentActions.handleFieldChange("paymentMethod", "apl");
|
|
24
|
+
}
|
|
25
|
+
}, [
|
|
26
|
+
isLiveMode,
|
|
27
|
+
paymentActions.paymentState.paymentMethod,
|
|
28
|
+
paymentActions.handleFieldChange,
|
|
29
|
+
]);
|
|
30
|
+
|
|
31
|
+
if (isLiveMode && paymentActions.paymentState.paymentMethod !== "apl") {
|
|
32
|
+
return (
|
|
33
|
+
<Box
|
|
34
|
+
style={{
|
|
35
|
+
display: "flex",
|
|
36
|
+
flexDirection: "column",
|
|
37
|
+
alignItems: "center",
|
|
38
|
+
justifyContent: "center",
|
|
39
|
+
gap: "8px",
|
|
40
|
+
marginTop: "44px",
|
|
41
|
+
}}
|
|
42
|
+
>
|
|
43
|
+
<Typography variant="pi" textColor="neutral600">
|
|
44
|
+
{t("paymentActions.testModeOnly", "Test Payments are only works in test mode.")}
|
|
45
|
+
</Typography>
|
|
46
|
+
<Typography variant="pi" textColor="neutral600">
|
|
47
|
+
{t("paymentActions.switchToTestMode", "Please switch to test mode in plugin settings to use test payments.")}
|
|
48
|
+
</Typography>
|
|
49
|
+
</Box>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (paymentActions.paymentState.paymentMethod === "apl") {
|
|
54
|
+
return (
|
|
55
|
+
<ApplePayPanel
|
|
56
|
+
onNavigateToConfig={onNavigateToConfig}
|
|
57
|
+
isLiveMode={isLiveMode}
|
|
58
|
+
paymentActions={paymentActions}
|
|
59
|
+
settings={settings}
|
|
60
|
+
/>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return (
|
|
65
|
+
<Box
|
|
66
|
+
className="payment-container"
|
|
67
|
+
paddingTop={8}
|
|
68
|
+
paddingBottom={8}
|
|
69
|
+
paddingLeft={8}
|
|
70
|
+
paddingRight={8}
|
|
71
|
+
>
|
|
72
|
+
<Flex direction="column" alignItems="stretch" gap={6}>
|
|
73
|
+
<Box
|
|
74
|
+
style={{
|
|
75
|
+
display: "flex",
|
|
76
|
+
flexDirection: "column",
|
|
77
|
+
alignItems: "flex-start",
|
|
78
|
+
gap: "8px",
|
|
79
|
+
}}
|
|
80
|
+
>
|
|
81
|
+
<Typography variant="beta" as="h2" className="payment-title" style={{ fontSize: "20px", marginBottom: "4px" }}>
|
|
82
|
+
{t("paymentActions.title", "Payment Actions")}
|
|
83
|
+
</Typography>
|
|
84
|
+
<Typography variant="pi" textColor="neutral600" className="payment-subtitle" style={{ fontSize: "14px" }}>
|
|
85
|
+
{t("paymentActions.subtitle", "Perform preauthorization, capture, refund and other payment operations.")}
|
|
86
|
+
</Typography>
|
|
87
|
+
</Box>
|
|
88
|
+
|
|
89
|
+
<PaymentMethodSelector
|
|
90
|
+
paymentActions={paymentActions}
|
|
91
|
+
onNavigateToConfig={onNavigateToConfig}
|
|
92
|
+
isLiveMode={isLiveMode}
|
|
93
|
+
/>
|
|
94
|
+
|
|
95
|
+
<Accordion.Root>
|
|
96
|
+
{/* Preauthorization */}
|
|
97
|
+
<Accordion.Item value="preauthorization">
|
|
98
|
+
<Accordion.Header>
|
|
99
|
+
<Accordion.Trigger>{t("preauth.title", "Preauthorization")}</Accordion.Trigger>
|
|
100
|
+
</Accordion.Header>
|
|
101
|
+
<Accordion.Content>
|
|
102
|
+
<Box
|
|
103
|
+
className="payment-form-section"
|
|
104
|
+
style={{
|
|
105
|
+
opacity: isLiveMode ? 0.5 : 1,
|
|
106
|
+
pointerEvents: isLiveMode ? "none" : "auto",
|
|
107
|
+
}}
|
|
108
|
+
>
|
|
109
|
+
<PreauthorizationForm
|
|
110
|
+
paymentActions={paymentActions}
|
|
111
|
+
settings={settings}
|
|
112
|
+
/>
|
|
113
|
+
</Box>
|
|
114
|
+
</Accordion.Content>
|
|
115
|
+
</Accordion.Item>
|
|
116
|
+
{/* Authorization */}
|
|
117
|
+
<Accordion.Item value="authorization">
|
|
118
|
+
<Accordion.Header>
|
|
119
|
+
<Accordion.Trigger>{t("auth.title", "Authorization")}</Accordion.Trigger>
|
|
120
|
+
</Accordion.Header>
|
|
121
|
+
<Accordion.Content>
|
|
122
|
+
<Box className="payment-form-section">
|
|
123
|
+
<AuthorizationForm
|
|
124
|
+
paymentActions={paymentActions}
|
|
125
|
+
settings={settings}
|
|
126
|
+
/>
|
|
127
|
+
</Box>
|
|
128
|
+
</Accordion.Content>
|
|
129
|
+
</Accordion.Item>
|
|
130
|
+
{/* Capture */}
|
|
131
|
+
<Accordion.Item value="capture">
|
|
132
|
+
<Accordion.Header>
|
|
133
|
+
<Accordion.Trigger>{t("capture.title", "Capture")}</Accordion.Trigger>
|
|
134
|
+
</Accordion.Header>
|
|
135
|
+
<Accordion.Content>
|
|
136
|
+
<Box
|
|
137
|
+
className="payment-form-section"
|
|
138
|
+
style={{
|
|
139
|
+
opacity: isLiveMode ? 0.5 : 1,
|
|
140
|
+
pointerEvents: isLiveMode ? "none" : "auto",
|
|
141
|
+
}}
|
|
142
|
+
>
|
|
143
|
+
<CaptureForm paymentActions={paymentActions} />
|
|
144
|
+
</Box>
|
|
145
|
+
</Accordion.Content>
|
|
146
|
+
</Accordion.Item>
|
|
147
|
+
{/* Refund */}
|
|
148
|
+
<Accordion.Item value="refund">
|
|
149
|
+
<Accordion.Header>
|
|
150
|
+
<Accordion.Trigger>{t("refund.title", "Refund")}</Accordion.Trigger>
|
|
151
|
+
</Accordion.Header>
|
|
152
|
+
<Accordion.Content>
|
|
153
|
+
<Box
|
|
154
|
+
className="payment-form-section"
|
|
155
|
+
style={{
|
|
156
|
+
opacity: isLiveMode ? 0.5 : 1,
|
|
157
|
+
pointerEvents: isLiveMode ? "none" : "auto",
|
|
158
|
+
}}
|
|
159
|
+
>
|
|
160
|
+
<RefundForm paymentActions={paymentActions} />
|
|
161
|
+
</Box>
|
|
162
|
+
</Accordion.Content>
|
|
163
|
+
</Accordion.Item>
|
|
164
|
+
</Accordion.Root>
|
|
165
|
+
|
|
166
|
+
<hr className="payment-divider" />
|
|
167
|
+
|
|
168
|
+
<PaymentResult
|
|
169
|
+
paymentError={paymentActions.paymentError}
|
|
170
|
+
paymentResult={paymentActions.paymentResult}
|
|
171
|
+
/>
|
|
172
|
+
|
|
173
|
+
<Box paddingTop={4}>
|
|
174
|
+
<Typography variant="sigma" textColor="neutral600">
|
|
175
|
+
{t("paymentActions.note", "Note: These payment actions allow you to test the complete payment flow: Preauthorization → Capture → Refund. Make sure to use valid Transaction IDs for capture and refund operations.")}
|
|
176
|
+
</Typography>
|
|
177
|
+
</Box>
|
|
178
|
+
</Flex>
|
|
179
|
+
</Box>
|
|
180
|
+
);
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
export default PaymentActionsPanel;
|