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.
- package/README.md +156 -11
- package/admin/src/components/Initializer/index.jsx +3 -3
- package/admin/src/components/PluginIcon/index.jsx +3 -3
- package/admin/src/index.js +33 -11
- package/admin/src/pages/App/components/AppHeader.jsx +17 -32
- package/admin/src/pages/App/components/AppTabs.jsx +36 -162
- package/admin/src/pages/App/components/ApplePayBtn.jsx +9 -11
- package/admin/src/pages/App/components/ApplePayConfig.jsx +221 -161
- package/admin/src/pages/App/components/ApplePayConfigPanel.jsx +33 -45
- package/admin/src/pages/App/components/DocsPanel.jsx +66 -1726
- package/admin/src/pages/App/components/GooglePayConfig.jsx +136 -169
- package/admin/src/pages/App/components/GooglePayConfigPanel.jsx +37 -55
- package/admin/src/pages/App/components/GooglePaybutton.jsx +101 -43
- package/admin/src/pages/App/components/RenderInput.jsx +94 -0
- package/admin/src/pages/App/components/StatusBadge.jsx +24 -71
- package/admin/src/pages/App/components/configuration/ConfigurationFields.jsx +255 -0
- package/admin/src/pages/App/components/configuration/ConfigurationPanel.jsx +54 -0
- package/admin/src/pages/App/components/configuration/TestConnection.jsx +130 -0
- package/admin/src/pages/App/components/docs/ApplePaySection.jsx +260 -0
- package/admin/src/pages/App/components/docs/BaseUrlSection.jsx +53 -0
- package/admin/src/pages/App/components/docs/CaptureRefundSection.jsx +113 -0
- package/admin/src/pages/App/components/docs/CodeBlock.jsx +59 -0
- package/admin/src/pages/App/components/docs/CreditCardSection.jsx +93 -0
- package/admin/src/pages/App/components/docs/GooglePaySection.jsx +248 -0
- package/admin/src/pages/App/components/docs/PayPalSection.jsx +116 -0
- package/admin/src/pages/App/components/docs/PaymentMethodsSection.jsx +55 -0
- package/admin/src/pages/App/components/docs/TableOfContents.jsx +47 -0
- package/admin/src/pages/App/components/docs/TestCredentialsSection.jsx +304 -0
- package/admin/src/pages/App/components/docs/ThreeDSecureSection.jsx +188 -0
- package/admin/src/pages/App/components/icons/BankIcon.jsx +1 -1
- package/admin/src/pages/App/components/icons/ChevronDownIcon.jsx +1 -1
- package/admin/src/pages/App/components/icons/ChevronUpIcon.jsx +1 -1
- package/admin/src/pages/App/components/icons/CreditCardIcon.jsx +1 -1
- package/admin/src/pages/App/components/icons/ErrorIcon.jsx +1 -1
- package/admin/src/pages/App/components/icons/InfoIcon.jsx +1 -1
- package/admin/src/pages/App/components/icons/MarkCircle.jsx +19 -0
- package/admin/src/pages/App/components/icons/PaymentIcon.jsx +1 -1
- package/admin/src/pages/App/components/icons/PendingIcon.jsx +1 -1
- package/admin/src/pages/App/components/icons/PersonIcon.jsx +1 -1
- package/admin/src/pages/App/components/icons/SuccessIcon.jsx +1 -1
- package/admin/src/pages/App/components/icons/WalletIcon.jsx +1 -1
- package/admin/src/pages/App/components/payment-actions/ApplePayPanel.jsx +51 -0
- package/admin/src/pages/App/components/payment-actions/AuthorizationForm.jsx +341 -0
- package/admin/src/pages/App/components/payment-actions/CaptureForm.jsx +128 -0
- package/admin/src/pages/App/components/{paymentActions → payment-actions}/CardDetailsInput.jsx +77 -72
- package/admin/src/pages/App/components/payment-actions/PaymentActionsPanel.jsx +194 -0
- package/admin/src/pages/App/components/payment-actions/PaymentMethodSelector.jsx +313 -0
- package/admin/src/pages/App/components/payment-actions/PaymentResult.jsx +133 -0
- package/admin/src/pages/App/components/payment-actions/PreauthorizationForm.jsx +280 -0
- package/admin/src/pages/App/components/payment-actions/RefundForm.jsx +121 -0
- package/admin/src/pages/App/components/transaction-history/FiltersPanel.jsx +145 -0
- package/admin/src/pages/App/components/transaction-history/HistoryPanel.jsx +50 -0
- package/admin/src/pages/App/components/transaction-history/TransactionTable.jsx +163 -0
- package/admin/src/pages/App/components/transaction-history/details/TransactionDetails.jsx +156 -0
- package/admin/src/pages/App/components/{TransactionHistoryItem.jsx → transaction-history/details/TransactionHistoryItem.jsx} +16 -28
- package/admin/src/pages/App/index.jsx +27 -70
- package/admin/src/pages/App/styles.css +46 -169
- package/admin/src/pages/constants/paymentConstants.js +52 -16
- package/admin/src/pages/hooks/use-system-theme.js +27 -0
- package/admin/src/pages/hooks/usePaymentActions.js +273 -210
- package/admin/src/pages/hooks/useSettings.js +87 -48
- package/admin/src/pages/hooks/useTransactionHistory.js +105 -108
- package/admin/src/pages/utils/api.js +57 -72
- package/admin/src/pages/utils/applePayConstants.js +2 -28
- package/admin/src/pages/utils/countryLanguageUtils.js +280 -0
- package/admin/src/pages/utils/getInputComponent.jsx +225 -0
- package/admin/src/pages/utils/googlePayConstants.js +2 -9
- package/admin/src/pages/utils/paymentUtils.js +13 -26
- package/admin/src/pages/utils/tooltipHelpers.js +18 -0
- package/admin/src/pages/utils/transactionTableUtils.js +60 -0
- package/package.json +8 -14
- package/server/config/index.js +18 -2
- package/server/controllers/payone.js +98 -31
- package/server/policies/index.js +2 -1
- package/server/policies/is-auth.js +9 -3
- package/server/policies/is-payone-notification.js +31 -0
- package/server/policies/isSuperAdmin.js +7 -5
- package/server/routes/index.js +11 -0
- package/server/services/paymentService.js +6 -22
- package/server/services/payone.js +10 -3
- package/server/services/settingsService.js +13 -3
- package/server/services/testConnectionService.js +11 -73
- package/server/services/transactionService.js +62 -99
- package/server/services/transactionStatusService.js +87 -0
- package/server/utils/normalize.js +0 -12
- package/server/utils/paymentMethodParams.js +0 -1
- package/server/utils/requestBuilder.js +34 -5
- package/server/utils/responseParser.js +9 -14
- package/strapi-admin.js +3 -1
- 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/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/ApplePayPanel.jsx +0 -95
- package/admin/src/pages/App/components/paymentActions/AuthorizationForm.jsx +0 -197
- package/admin/src/pages/App/components/paymentActions/CaptureForm.jsx +0 -65
- package/admin/src/pages/App/components/paymentActions/PaymentMethodSelector.jsx +0 -306
- package/admin/src/pages/App/components/paymentActions/PaymentResult.jsx +0 -192
- package/admin/src/pages/App/components/paymentActions/PreauthorizationForm.jsx +0 -142
- package/admin/src/pages/App/components/paymentActions/RefundForm.jsx +0 -90
package/README.md
CHANGED
|
@@ -35,7 +35,9 @@ A comprehensive Strapi plugin that integrates the Payone payment gateway into yo
|
|
|
35
35
|
|
|
36
36
|
Before installing this plugin, ensure you have:
|
|
37
37
|
|
|
38
|
-
- **Strapi**:
|
|
38
|
+
- **Strapi**:
|
|
39
|
+
- Version 5.x.x for plugin version 5.x.x
|
|
40
|
+
- Version 4.6.0 or higher for plugin version 4.x.x
|
|
39
41
|
- **Node.js**: Version 18.0.0 to 20.x.x
|
|
40
42
|
- **npm**: Version 6.0.0 or higher
|
|
41
43
|
- **Payone Account**: Active Payone merchant account with API credentials
|
|
@@ -55,17 +57,29 @@ You will need the following credentials from your Payone account:
|
|
|
55
57
|
|
|
56
58
|
### Install from npm
|
|
57
59
|
|
|
58
|
-
|
|
59
|
-
# Using npm
|
|
60
|
-
npm install strapi-plugin-payone-provider
|
|
60
|
+
**Important**: Choose the correct version based on your Strapi version:
|
|
61
61
|
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
- **For Strapi 5.x.x**: Use plugin version `^5.x.x`
|
|
63
|
+
- **For Strapi 4.x.x**: Use plugin version `^4.x.x`
|
|
64
64
|
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
```bash
|
|
66
|
+
# For Strapi 5.x.x
|
|
67
|
+
npm install strapi-plugin-payone-provider@^5
|
|
68
|
+
# or
|
|
69
|
+
yarn add strapi-plugin-payone-provider@^5
|
|
70
|
+
# or
|
|
71
|
+
pnpm add strapi-plugin-payone-provider@^5
|
|
72
|
+
|
|
73
|
+
# For Strapi 4.x.x
|
|
74
|
+
npm install strapi-plugin-payone-provider@^4
|
|
75
|
+
# or
|
|
76
|
+
yarn add strapi-plugin-payone-provider@^4
|
|
77
|
+
# or
|
|
78
|
+
pnpm add strapi-plugin-payone-provider@^4
|
|
67
79
|
```
|
|
68
80
|
|
|
81
|
+
> ⚠️ **Version Compatibility**: Make sure to install the correct plugin version that matches your Strapi version. Using an incompatible version may cause errors or unexpected behavior.
|
|
82
|
+
|
|
69
83
|
## ⚙️ Configuration
|
|
70
84
|
|
|
71
85
|
After installation, you need to configure your Payone credentials:
|
|
@@ -799,9 +813,8 @@ paymentDataRequest.merchantInfo = {
|
|
|
799
813
|
const button = paymentsClient.createButton({
|
|
800
814
|
onClick: async () => {
|
|
801
815
|
try {
|
|
802
|
-
const paymentData =
|
|
803
|
-
paymentDataRequest
|
|
804
|
-
);
|
|
816
|
+
const paymentData =
|
|
817
|
+
await paymentsClient.loadPaymentData(paymentDataRequest);
|
|
805
818
|
const token = paymentData.paymentMethodData.tokenizationData.token;
|
|
806
819
|
|
|
807
820
|
// Token is a JSON string, encode it to Base64 for Payone
|
|
@@ -1553,3 +1566,135 @@ For wallet payments (PayPal, Google Pay, Apple Pay), you can specify:
|
|
|
1553
1566
|
|
|
1554
1567
|
- `capturemode: "full"`: Capture the entire preauthorized amount
|
|
1555
1568
|
- `capturemode: "partial"`: Capture less than the preauthorized amount
|
|
1569
|
+
|
|
1570
|
+
---
|
|
1571
|
+
|
|
1572
|
+
## 📢 TransactionStatus Notifications
|
|
1573
|
+
|
|
1574
|
+
The Payone platform provides an asynchronous way of notifying your system of changes to a transaction. These notifications are called "TransactionStatus" and are automatically handled by this plugin.
|
|
1575
|
+
|
|
1576
|
+
### What are TransactionStatus Notifications?
|
|
1577
|
+
|
|
1578
|
+
TransactionStatus notifications are POST requests sent from Payone's servers to your endpoint when transaction status changes occur. This is especially important for:
|
|
1579
|
+
|
|
1580
|
+
- **Redirect Payment Methods**: Verifying that payments were actually completed (prevents fraud)
|
|
1581
|
+
- **Chargeback Processes**: Being notified when customers initiate chargebacks
|
|
1582
|
+
- **Real-time Tracking**: Keeping your system updated with the latest transaction status
|
|
1583
|
+
|
|
1584
|
+
### How It Works
|
|
1585
|
+
|
|
1586
|
+
1. **Payone sends notification** → Your Strapi endpoint receives POST request
|
|
1587
|
+
2. **Plugin verifies request** → Checks IP address, User-Agent, and hash signature
|
|
1588
|
+
3. **Plugin processes notification** → Updates transaction history automatically
|
|
1589
|
+
4. **Plugin responds** → Returns `TSOK` to confirm receipt
|
|
1590
|
+
|
|
1591
|
+
### Endpoint Configuration
|
|
1592
|
+
|
|
1593
|
+
The plugin automatically provides the TransactionStatus endpoint at:
|
|
1594
|
+
|
|
1595
|
+
**URL**: `POST /api/strapi-plugin-payone-provider/transaction-status`
|
|
1596
|
+
|
|
1597
|
+
**No authentication required** - The endpoint is secured by:
|
|
1598
|
+
|
|
1599
|
+
- IP address verification (only Payone IPs allowed)
|
|
1600
|
+
- User-Agent verification (must be "PAYONE FinanceGate")
|
|
1601
|
+
- Hash signature verification (MD5 hash of transaction data)
|
|
1602
|
+
|
|
1603
|
+
### PMI Configuration
|
|
1604
|
+
|
|
1605
|
+
You need to configure this endpoint in your Payone Merchant Interface (PMI):
|
|
1606
|
+
|
|
1607
|
+
1. Log into your Payone Merchant Interface (PMI)
|
|
1608
|
+
2. Navigate to **Configuration** → **Payment Portals** → **[Your Portal]**
|
|
1609
|
+
3. Find the **TransactionStatus Endpoint** setting
|
|
1610
|
+
4. Enter your endpoint URL: `https://yourdomain.com/api/strapi-plugin-payone-provider/transaction-status`
|
|
1611
|
+
5. Save the configuration
|
|
1612
|
+
|
|
1613
|
+
> ⚠️ **Important**: The endpoint must be accessible via HTTPS. Payone will not send notifications to HTTP endpoints.
|
|
1614
|
+
|
|
1615
|
+
### Security Features
|
|
1616
|
+
|
|
1617
|
+
The plugin automatically verifies:
|
|
1618
|
+
|
|
1619
|
+
1. **IP Address**: Only accepts requests from Payone's IP ranges:
|
|
1620
|
+
|
|
1621
|
+
- `185.60.20.0/24`
|
|
1622
|
+
- `54.246.203.105`
|
|
1623
|
+
|
|
1624
|
+
2. **User-Agent**: Must be exactly `"PAYONE FinanceGate"`
|
|
1625
|
+
|
|
1626
|
+
3. **Hash Signature**: Verifies MD5 hash using your Portal Key:
|
|
1627
|
+
|
|
1628
|
+
```
|
|
1629
|
+
MD5(portalid + aid + txid + sequencenumber + price + currency + mode + key)
|
|
1630
|
+
```
|
|
1631
|
+
|
|
1632
|
+
4. **Credentials**: Verifies that `portalid` and `aid` match your configured settings
|
|
1633
|
+
|
|
1634
|
+
### Notification Parameters
|
|
1635
|
+
|
|
1636
|
+
Payone sends the following parameters (among others):
|
|
1637
|
+
|
|
1638
|
+
- `txaction`: Transaction action (appointed, paid, cancelation, etc.)
|
|
1639
|
+
- `txid`: Transaction ID
|
|
1640
|
+
- `reference`: Your reference number
|
|
1641
|
+
- `sequencenumber`: Sequence number for this transaction
|
|
1642
|
+
- `transaction_status`: Current transaction status
|
|
1643
|
+
- `price`: Transaction amount
|
|
1644
|
+
- `balance`: Current balance
|
|
1645
|
+
- `receivable`: Receivable amount
|
|
1646
|
+
- `currency`: Currency code
|
|
1647
|
+
- `key`: MD5 hash for verification
|
|
1648
|
+
|
|
1649
|
+
### Response Requirements
|
|
1650
|
+
|
|
1651
|
+
The endpoint **must** respond with exactly `TSOK` (4 characters, no HTML):
|
|
1652
|
+
|
|
1653
|
+
- Response time: Must be within 10 seconds
|
|
1654
|
+
- Response format: Plain text `TSOK`
|
|
1655
|
+
- No other characters allowed
|
|
1656
|
+
|
|
1657
|
+
> ℹ️ **Note**: Even if processing fails, the endpoint must return `TSOK` to prevent Payone from retrying. The plugin handles this automatically.
|
|
1658
|
+
|
|
1659
|
+
### Retry Mechanism
|
|
1660
|
+
|
|
1661
|
+
If Payone doesn't receive `TSOK` within 10 seconds:
|
|
1662
|
+
|
|
1663
|
+
- Payone will retry up to **12 times**
|
|
1664
|
+
- Retries occur over **48 hours**
|
|
1665
|
+
- First retry after ~1 hour
|
|
1666
|
+
- Retry intervals increase over time
|
|
1667
|
+
|
|
1668
|
+
### Transaction Updates
|
|
1669
|
+
|
|
1670
|
+
When a TransactionStatus notification is received:
|
|
1671
|
+
|
|
1672
|
+
1. The plugin finds the transaction in history by `txid`
|
|
1673
|
+
2. Updates the transaction with new status information
|
|
1674
|
+
3. Stores the full notification data for reference
|
|
1675
|
+
4. Updates `balance`, `receivable`, and `sequencenumber` fields
|
|
1676
|
+
|
|
1677
|
+
If the transaction is not found in history, a new entry is created.
|
|
1678
|
+
|
|
1679
|
+
### Example Notification Flow
|
|
1680
|
+
|
|
1681
|
+
**Scenario**: Customer completes PayPal payment
|
|
1682
|
+
|
|
1683
|
+
1. Customer redirected to PayPal → Completes payment
|
|
1684
|
+
2. Payone sends TransactionStatus: `txaction=appointed`, `transaction_status=completed`
|
|
1685
|
+
3. Plugin receives notification → Verifies and updates transaction
|
|
1686
|
+
4. Plugin responds: `TSOK`
|
|
1687
|
+
5. Customer redirected back to your `successurl`
|
|
1688
|
+
6. Later, Payone sends: `txaction=paid` (payment confirmed)
|
|
1689
|
+
7. Plugin updates transaction status to "paid"
|
|
1690
|
+
|
|
1691
|
+
### Testing
|
|
1692
|
+
|
|
1693
|
+
To test TransactionStatus notifications:
|
|
1694
|
+
|
|
1695
|
+
1. Configure the endpoint in PMI
|
|
1696
|
+
2. Make a test payment
|
|
1697
|
+
3. Check your Strapi logs for notification processing
|
|
1698
|
+
4. Verify transaction history is updated correctly
|
|
1699
|
+
|
|
1700
|
+
> 📖 **Reference**: For more details, see [Payone TransactionStatus Notification Documentation](https://docs.payone.com/integration/response-handling/transactionstatus-notification)
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from "react";
|
|
2
2
|
import pluginId from "../../pluginId";
|
|
3
3
|
|
|
4
4
|
const Initializer = ({ setPlugin }) => {
|
|
5
|
-
const ref = useRef(setPlugin);
|
|
5
|
+
const ref = React.useRef(setPlugin);
|
|
6
6
|
|
|
7
|
-
useEffect(() => {
|
|
7
|
+
React.useEffect(() => {
|
|
8
8
|
if (ref.current) {
|
|
9
9
|
ref.current(pluginId);
|
|
10
10
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import {
|
|
1
|
+
import * as React from '@strapi/strapi/admin';
|
|
2
|
+
import { PuzzlePiece } from "@strapi/icons";
|
|
3
3
|
|
|
4
|
-
const PluginIcon = () => <
|
|
4
|
+
const PluginIcon = () => <PuzzlePiece />;
|
|
5
5
|
|
|
6
6
|
export default PluginIcon;
|
package/admin/src/index.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
1
|
+
|
|
2
|
+
import pluginPkg from '../../package.json';
|
|
3
|
+
import pluginId from './pluginId';
|
|
3
4
|
import Initializer from "./components/Initializer/index.jsx";
|
|
4
5
|
import PluginIcon from "./components/PluginIcon/index.jsx";
|
|
5
6
|
import { injectGooglePayScript } from "./pages/utils/injectGooglePayScript";
|
|
6
7
|
import { injectApplePayScript } from "./pages/utils/injectApplePayScript";
|
|
7
8
|
|
|
9
|
+
|
|
8
10
|
const name = pluginPkg.strapi.name;
|
|
9
11
|
|
|
10
12
|
export default {
|
|
@@ -14,20 +16,20 @@ export default {
|
|
|
14
16
|
icon: PluginIcon,
|
|
15
17
|
intlLabel: {
|
|
16
18
|
id: `${pluginId}.plugin.name`,
|
|
17
|
-
defaultMessage:
|
|
19
|
+
defaultMessage: 'Payone Provider',
|
|
18
20
|
},
|
|
19
21
|
Component: async () => {
|
|
20
|
-
const
|
|
21
|
-
return
|
|
22
|
+
const App = await import('./pages/App');
|
|
23
|
+
return App;
|
|
22
24
|
},
|
|
23
|
-
permissions: []
|
|
25
|
+
permissions: [],
|
|
24
26
|
});
|
|
25
27
|
|
|
26
28
|
app.registerPlugin({
|
|
27
29
|
id: pluginId,
|
|
28
30
|
initializer: Initializer,
|
|
29
31
|
isReady: false,
|
|
30
|
-
name
|
|
32
|
+
name,
|
|
31
33
|
});
|
|
32
34
|
},
|
|
33
35
|
|
|
@@ -36,7 +38,27 @@ export default {
|
|
|
36
38
|
injectApplePayScript();
|
|
37
39
|
},
|
|
38
40
|
|
|
39
|
-
async registerTrads() {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
async registerTrads({ locales }) {
|
|
42
|
+
const importedTrads = await Promise.all(
|
|
43
|
+
locales.map(async (locale) => {
|
|
44
|
+
try {
|
|
45
|
+
const { default: data } = await import(
|
|
46
|
+
/* webpackChunkName: "[pluginId]-[request]" */ `./translations/${locale}.json`
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
return {
|
|
50
|
+
data,
|
|
51
|
+
locale,
|
|
52
|
+
};
|
|
53
|
+
} catch (error) {
|
|
54
|
+
return {
|
|
55
|
+
data: {},
|
|
56
|
+
locale,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
})
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
return Promise.resolve(importedTrads);
|
|
63
|
+
},
|
|
64
|
+
};
|
|
@@ -1,52 +1,37 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import {
|
|
1
|
+
import * as React from '@strapi/strapi/admin';
|
|
2
|
+
import { Button } from "@strapi/design-system";
|
|
3
|
+
import { Layouts } from "@strapi/strapi/admin";
|
|
3
4
|
import { Check, ArrowLeft } from "@strapi/icons";
|
|
4
|
-
import { useHistory, useLocation } from "react-router-dom";
|
|
5
|
-
import pluginId from "../../../pluginId";
|
|
6
5
|
|
|
7
|
-
const AppHeader = ({ activeTab, isSaving, onSave }) => {
|
|
8
|
-
const
|
|
9
|
-
const location = useLocation();
|
|
10
|
-
const isApplePayConfigPage = location.pathname.includes("/apple-pay-config");
|
|
11
|
-
const isGooglePayConfigPage = location.pathname.includes("/google-pay-config");
|
|
6
|
+
const AppHeader = ({ activeTab, isSaving, onSave, title, onBack }) => {
|
|
7
|
+
const isConfigPage = title && title !== "Payone Provider";
|
|
12
8
|
|
|
13
9
|
return (
|
|
14
|
-
<
|
|
15
|
-
title={
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
>
|
|
23
|
-
{isApplePayConfigPage
|
|
24
|
-
? "Apple Pay Configuration"
|
|
25
|
-
: "Payone Provider"}
|
|
26
|
-
</Typography>
|
|
27
|
-
<Typography variant="pi" marginTop={2} className="payment-subtitle">
|
|
28
|
-
{isApplePayConfigPage
|
|
29
|
-
? "Configure Apple Pay settings for your payment gateway"
|
|
30
|
-
: "Configure your Payone integration and manage payment transactions"}
|
|
31
|
-
</Typography>
|
|
32
|
-
</Box>
|
|
10
|
+
<Layouts.Header
|
|
11
|
+
title={title || "Payone Provider"}
|
|
12
|
+
subtitle={
|
|
13
|
+
title === "Apple Pay Configuration"
|
|
14
|
+
? "Configure Apple Pay settings for your payment gateway"
|
|
15
|
+
: title === "Google Pay Configuration"
|
|
16
|
+
? "Configure Google Pay settings for your payment gateway"
|
|
17
|
+
: "Configure your Payone integration and manage payment transactions"
|
|
33
18
|
}
|
|
34
19
|
primaryAction={
|
|
35
|
-
|
|
20
|
+
isConfigPage ? (
|
|
36
21
|
<Button
|
|
37
|
-
onClick={
|
|
22
|
+
onClick={onBack}
|
|
38
23
|
startIcon={<ArrowLeft />}
|
|
39
24
|
size="L"
|
|
40
25
|
variant="secondary"
|
|
41
26
|
>
|
|
42
27
|
Back to Main
|
|
43
28
|
</Button>
|
|
44
|
-
) : activeTab ===
|
|
29
|
+
) : activeTab === 1 ? (
|
|
45
30
|
<Button
|
|
46
31
|
loading={isSaving}
|
|
47
32
|
onClick={onSave}
|
|
48
33
|
startIcon={<Check />}
|
|
49
|
-
size="
|
|
34
|
+
size="M"
|
|
50
35
|
variant="default"
|
|
51
36
|
className="payment-button payment-button-success"
|
|
52
37
|
>
|
|
@@ -1,178 +1,52 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
TabPanels,
|
|
7
|
-
TabPanel,
|
|
8
|
-
} from "@strapi/design-system";
|
|
9
|
-
import pluginId from "../../../pluginId";
|
|
10
|
-
import ConfigurationPanel from "./ConfigurationPanel";
|
|
11
|
-
import HistoryPanel from "./HistoryPanel";
|
|
12
|
-
import PaymentActionsPanel from "./PaymentActionsPanel";
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Tabs } from "@strapi/design-system";
|
|
3
|
+
import ConfigurationPanel from "./configuration/ConfigurationPanel";
|
|
4
|
+
import HistoryPanel from "./transaction-history/HistoryPanel";
|
|
5
|
+
import PaymentActionsPanel from "./payment-actions/PaymentActionsPanel";
|
|
13
6
|
import DocsPanel from "./DocsPanel";
|
|
14
7
|
|
|
15
8
|
const AppTabs = ({
|
|
16
9
|
activeTab,
|
|
17
10
|
setActiveTab,
|
|
18
|
-
|
|
11
|
+
onNavigateToConfig,
|
|
19
12
|
settings,
|
|
20
|
-
isSaving,
|
|
21
|
-
isTesting,
|
|
22
|
-
testResult,
|
|
23
|
-
onSave,
|
|
24
|
-
onTestConnection,
|
|
25
|
-
onInputChange,
|
|
26
|
-
onPaymentMethodToggle,
|
|
27
|
-
// Transaction history props
|
|
28
|
-
filters,
|
|
29
|
-
onFilterChange,
|
|
30
|
-
onFilterApply,
|
|
31
|
-
sorting,
|
|
32
|
-
onSort,
|
|
33
|
-
isLoadingHistory,
|
|
34
|
-
transactionHistory,
|
|
35
|
-
paginatedTransactions,
|
|
36
|
-
currentPage,
|
|
37
|
-
totalPages,
|
|
38
|
-
pageSize,
|
|
39
|
-
onRefresh,
|
|
40
|
-
onPageChange,
|
|
41
|
-
onPageSizeChange,
|
|
42
|
-
selectedTransaction,
|
|
43
|
-
onTransactionSelect,
|
|
44
|
-
// Payment actions props
|
|
45
13
|
paymentActions,
|
|
46
|
-
history,
|
|
47
14
|
}) => {
|
|
48
|
-
const handleNavigateToConfig = (configType = "apple-pay") => {
|
|
49
|
-
if (history) {
|
|
50
|
-
if (configType === "google-pay") {
|
|
51
|
-
history.push(`/plugins/${pluginId}/google-pay-config`);
|
|
52
|
-
} else {
|
|
53
|
-
history.push(`/plugins/${pluginId}/apple-pay-config`);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
15
|
return (
|
|
58
|
-
<
|
|
59
|
-
|
|
60
|
-
|
|
16
|
+
<Tabs.Root
|
|
17
|
+
defaultValue={`tab-${activeTab}`}
|
|
18
|
+
value={`tab-${activeTab}`}
|
|
19
|
+
variant="regular"
|
|
20
|
+
onValueChange={(value) =>
|
|
21
|
+
setActiveTab(parseInt(value.replace("tab-", "")))
|
|
22
|
+
}
|
|
61
23
|
>
|
|
62
|
-
<Tabs style={{
|
|
63
|
-
<
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
className={`payment-tab ${
|
|
72
|
-
activeTab === 1 ? "payment-tab-active" : ""
|
|
73
|
-
}`}
|
|
74
|
-
>
|
|
75
|
-
Transaction History
|
|
76
|
-
</Tab>
|
|
77
|
-
<Tab
|
|
78
|
-
className={`payment-tab ${
|
|
79
|
-
activeTab === 2 ? "payment-tab-active" : ""
|
|
80
|
-
}`}
|
|
81
|
-
>
|
|
82
|
-
Payment Actions
|
|
83
|
-
</Tab>
|
|
84
|
-
<Tab
|
|
85
|
-
className={`payment-tab ${
|
|
86
|
-
activeTab === 3 ? "payment-tab-active" : ""
|
|
87
|
-
}`}
|
|
88
|
-
>
|
|
89
|
-
Documentation
|
|
90
|
-
</Tab>
|
|
91
|
-
</Tabs>
|
|
92
|
-
<TabPanels>
|
|
93
|
-
<TabPanel>
|
|
94
|
-
<ConfigurationPanel
|
|
95
|
-
settings={settings}
|
|
96
|
-
isSaving={isSaving}
|
|
97
|
-
isTesting={isTesting}
|
|
98
|
-
testResult={testResult}
|
|
99
|
-
onSave={onSave}
|
|
100
|
-
onTestConnection={onTestConnection}
|
|
101
|
-
onInputChange={onInputChange}
|
|
102
|
-
onPaymentMethodToggle={onPaymentMethodToggle}
|
|
103
|
-
/>
|
|
104
|
-
</TabPanel>
|
|
24
|
+
<Tabs.List style={{ width: "100%" }}>
|
|
25
|
+
<Tabs.Trigger value="tab-1">Configuration</Tabs.Trigger>
|
|
26
|
+
<Tabs.Trigger value="tab-2">Transaction History</Tabs.Trigger>
|
|
27
|
+
<Tabs.Trigger value="tab-3">Payment Actions</Tabs.Trigger>
|
|
28
|
+
<Tabs.Trigger value="tab-4">Documentation</Tabs.Trigger>
|
|
29
|
+
</Tabs.List>
|
|
30
|
+
<Tabs.Content value="tab-1">
|
|
31
|
+
<ConfigurationPanel settings={settings} />
|
|
32
|
+
</Tabs.Content>
|
|
105
33
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
onFilterChange={onFilterChange}
|
|
110
|
-
onFilterApply={onFilterApply}
|
|
111
|
-
sorting={sorting}
|
|
112
|
-
onSort={onSort}
|
|
113
|
-
isLoadingHistory={isLoadingHistory}
|
|
114
|
-
transactionHistory={transactionHistory}
|
|
115
|
-
paginatedTransactions={paginatedTransactions}
|
|
116
|
-
currentPage={currentPage}
|
|
117
|
-
totalPages={totalPages}
|
|
118
|
-
pageSize={pageSize}
|
|
119
|
-
onRefresh={onRefresh}
|
|
120
|
-
onPageChange={onPageChange}
|
|
121
|
-
onPageSizeChange={onPageSizeChange}
|
|
122
|
-
selectedTransaction={selectedTransaction}
|
|
123
|
-
onTransactionSelect={onTransactionSelect}
|
|
124
|
-
/>
|
|
125
|
-
</TabPanel>
|
|
34
|
+
<Tabs.Content value="tab-2">
|
|
35
|
+
<HistoryPanel />
|
|
36
|
+
</Tabs.Content>
|
|
126
37
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
setAuthReference={paymentActions.setAuthReference}
|
|
135
|
-
captureTxid={paymentActions.captureTxid}
|
|
136
|
-
setCaptureTxid={paymentActions.setCaptureTxid}
|
|
137
|
-
refundTxid={paymentActions.refundTxid}
|
|
138
|
-
setRefundTxid={paymentActions.setRefundTxid}
|
|
139
|
-
refundSequenceNumber={paymentActions.refundSequenceNumber}
|
|
140
|
-
setRefundSequenceNumber={paymentActions.setRefundSequenceNumber}
|
|
141
|
-
refundReference={paymentActions.refundReference}
|
|
142
|
-
setRefundReference={paymentActions.setRefundReference}
|
|
143
|
-
paymentMethod={paymentActions.paymentMethod}
|
|
144
|
-
setPaymentMethod={paymentActions.setPaymentMethod}
|
|
145
|
-
captureMode={paymentActions.captureMode}
|
|
146
|
-
setCaptureMode={paymentActions.setCaptureMode}
|
|
147
|
-
isProcessingPayment={paymentActions.isProcessingPayment}
|
|
148
|
-
paymentError={paymentActions.paymentError}
|
|
149
|
-
paymentResult={paymentActions.paymentResult}
|
|
150
|
-
onPreauthorization={paymentActions.handlePreauthorization}
|
|
151
|
-
onAuthorization={paymentActions.handleAuthorization}
|
|
152
|
-
onCapture={paymentActions.handleCapture}
|
|
153
|
-
onRefund={paymentActions.handleRefund}
|
|
154
|
-
settings={settings}
|
|
155
|
-
googlePayToken={paymentActions.googlePayToken}
|
|
156
|
-
setGooglePayToken={paymentActions.setGooglePayToken}
|
|
157
|
-
applePayToken={paymentActions.applePayToken}
|
|
158
|
-
setApplePayToken={paymentActions.setApplePayToken}
|
|
159
|
-
cardtype={paymentActions.cardtype}
|
|
160
|
-
setCardtype={paymentActions.setCardtype}
|
|
161
|
-
cardpan={paymentActions.cardpan}
|
|
162
|
-
setCardpan={paymentActions.setCardpan}
|
|
163
|
-
cardexpiredate={paymentActions.cardexpiredate}
|
|
164
|
-
setCardexpiredate={paymentActions.setCardexpiredate}
|
|
165
|
-
cardcvc2={paymentActions.cardcvc2}
|
|
166
|
-
setCardcvc2={paymentActions.setCardcvc2}
|
|
167
|
-
onNavigateToConfig={handleNavigateToConfig}
|
|
168
|
-
/>
|
|
169
|
-
</TabPanel>
|
|
38
|
+
<Tabs.Content value="tab-3">
|
|
39
|
+
<PaymentActionsPanel
|
|
40
|
+
onNavigateToConfig={onNavigateToConfig}
|
|
41
|
+
settings={settings}
|
|
42
|
+
paymentActions={paymentActions}
|
|
43
|
+
/>
|
|
44
|
+
</Tabs.Content>
|
|
170
45
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
</TabGroup>
|
|
46
|
+
<Tabs.Content value="tab-4">
|
|
47
|
+
<DocsPanel settings={settings} paymentActions={paymentActions} />
|
|
48
|
+
</Tabs.Content>
|
|
49
|
+
</Tabs.Root>
|
|
176
50
|
);
|
|
177
51
|
};
|
|
178
52
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React from
|
|
1
|
+
import * as React from '@strapi/strapi/admin';
|
|
2
2
|
import ApplePayButton from "apple-pay-button";
|
|
3
3
|
import { Box, Typography, Alert } from "@strapi/design-system";
|
|
4
|
-
import {
|
|
4
|
+
import { getFetchClient } from "@strapi/strapi/admin";
|
|
5
5
|
import pluginId from "../../../pluginId";
|
|
6
6
|
|
|
7
7
|
const ApplePayBtn = ({
|
|
@@ -20,17 +20,15 @@ const ApplePayBtn = ({
|
|
|
20
20
|
currencyCode || applePayConfig.currencyCode || "EUR";
|
|
21
21
|
const requestCountryCode = applePayConfig.countryCode || "DE";
|
|
22
22
|
|
|
23
|
-
const
|
|
23
|
+
const { post } = getFetchClient();
|
|
24
|
+
const merchantSession = await post(
|
|
24
25
|
`/${pluginId}/validate-apple-pay-merchant`,
|
|
25
26
|
{
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
countryCode: requestCountryCode,
|
|
32
|
-
mode: (settings?.mode || "test").toLowerCase() || "test",
|
|
33
|
-
},
|
|
27
|
+
domainName: settings?.domainName || window.location.hostname,
|
|
28
|
+
displayName: settings?.displayName || "Store",
|
|
29
|
+
currency: requestCurrency,
|
|
30
|
+
countryCode: requestCountryCode,
|
|
31
|
+
mode: (settings?.mode || "test").toLowerCase() || "test",
|
|
34
32
|
}
|
|
35
33
|
);
|
|
36
34
|
if (merchantSession.error) {
|