@swichpay/react-native 0.0.0-stage → 1.0.0
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/CHANGELOG.md +32 -0
- package/LICENSE +21 -0
- package/README.md +82 -2
- package/docs/checkouts.md +98 -0
- package/docs/getting-started.md +140 -0
- package/docs/going-live.md +45 -0
- package/docs/own-screen.md +81 -0
- package/docs/results-and-errors.md +75 -0
- package/docs/server.md +163 -0
- package/docs/troubleshooting.md +57 -0
- package/lib/commonjs/HostedCheckout.js +115 -0
- package/lib/commonjs/checkout-webview.js +85 -0
- package/lib/commonjs/checkouts/PaymentSheet.js +1317 -0
- package/lib/commonjs/checkouts/direct.js +671 -0
- package/lib/commonjs/context.js +64 -0
- package/lib/commonjs/core/api/direct-payment-api.js +425 -0
- package/lib/commonjs/core/api/discount-api.js +19 -0
- package/lib/commonjs/core/api/gateway-api.js +366 -0
- package/lib/commonjs/core/api/payments-api.js +79 -0
- package/lib/commonjs/core/api/repositories.js +5 -0
- package/lib/commonjs/core/assets/images.js +12 -0
- package/lib/commonjs/core/assets/method-logos.js +19 -0
- package/lib/commonjs/core/assets/pwa-images.js +13 -0
- package/lib/commonjs/core/browser/clipboard.js +30 -0
- package/lib/commonjs/core/browser/dom.js +71 -0
- package/lib/commonjs/core/browser/hosted-checkout.js +107 -0
- package/lib/commonjs/core/browser/index.js +119 -0
- package/lib/commonjs/core/browser/qr.js +109 -0
- package/lib/commonjs/core/browser/three-ds.js +151 -0
- package/lib/commonjs/core/client.js +344 -0
- package/lib/commonjs/core/config.js +132 -0
- package/lib/commonjs/core/environment.js +34 -0
- package/lib/commonjs/core/errors.js +138 -0
- package/lib/commonjs/core/events.js +57 -0
- package/lib/commonjs/core/flows/controller.js +106 -0
- package/lib/commonjs/core/flows/countdown.js +41 -0
- package/lib/commonjs/core/flows/direct-bank-transfer.js +236 -0
- package/lib/commonjs/core/flows/direct-card.js +354 -0
- package/lib/commonjs/core/flows/direct-ewallet.js +124 -0
- package/lib/commonjs/core/flows/direct-one-bill.js +172 -0
- package/lib/commonjs/core/flows/direct-qr.js +109 -0
- package/lib/commonjs/core/flows/direct-rtp.js +302 -0
- package/lib/commonjs/core/flows/discount-lookup.js +80 -0
- package/lib/commonjs/core/flows/headless.js +94 -0
- package/lib/commonjs/core/flows/payment-sheet.js +1321 -0
- package/lib/commonjs/core/flows/services.js +31 -0
- package/lib/commonjs/core/flows/shared.js +90 -0
- package/lib/commonjs/core/http/api-client.js +208 -0
- package/lib/commonjs/core/http/endpoints.js +61 -0
- package/lib/commonjs/core/http/token-manager.js +46 -0
- package/lib/commonjs/core/http/transport.js +134 -0
- package/lib/commonjs/core/index.js +688 -0
- package/lib/commonjs/core/models/category.js +113 -0
- package/lib/commonjs/core/models/discount.js +51 -0
- package/lib/commonjs/core/models/payment.js +95 -0
- package/lib/commonjs/core/models/session.js +131 -0
- package/lib/commonjs/core/server/index.js +64 -0
- package/lib/commonjs/core/server/node.js +60 -0
- package/lib/commonjs/core/server/proxy.js +194 -0
- package/lib/commonjs/core/server/verify.js +122 -0
- package/lib/commonjs/core/swichpay.js +72 -0
- package/lib/commonjs/core/utils/crypto.js +78 -0
- package/lib/commonjs/core/utils/formatters.js +68 -0
- package/lib/commonjs/core/utils/json.js +110 -0
- package/lib/commonjs/core/utils/log.js +75 -0
- package/lib/commonjs/core/utils/runtime.js +34 -0
- package/lib/commonjs/core/utils/validators.js +59 -0
- package/lib/commonjs/hooks.js +77 -0
- package/lib/commonjs/index.js +203 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/polyfills.js +3 -0
- package/lib/commonjs/presenter.js +61 -0
- package/lib/commonjs/provider.js +192 -0
- package/lib/commonjs/swichpay.js +192 -0
- package/lib/commonjs/theme.js +54 -0
- package/lib/commonjs/ui.js +1142 -0
- package/lib/commonjs/webviews.js +279 -0
- package/lib/module/HostedCheckout.js +111 -0
- package/lib/module/checkout-webview.js +83 -0
- package/lib/module/checkouts/PaymentSheet.js +1313 -0
- package/lib/module/checkouts/direct.js +661 -0
- package/lib/module/context.js +58 -0
- package/lib/module/core/api/direct-payment-api.js +413 -0
- package/lib/module/core/api/discount-api.js +14 -0
- package/lib/module/core/api/gateway-api.js +358 -0
- package/lib/module/core/api/payments-api.js +73 -0
- package/lib/module/core/api/repositories.js +3 -0
- package/lib/module/core/assets/images.js +8 -0
- package/lib/module/core/assets/method-logos.js +15 -0
- package/lib/module/core/assets/pwa-images.js +9 -0
- package/lib/module/core/browser/clipboard.js +27 -0
- package/lib/module/core/browser/dom.js +63 -0
- package/lib/module/core/browser/hosted-checkout.js +102 -0
- package/lib/module/core/browser/index.js +12 -0
- package/lib/module/core/browser/qr.js +100 -0
- package/lib/module/core/browser/three-ds.js +145 -0
- package/lib/module/core/client.js +338 -0
- package/lib/module/core/config.js +128 -0
- package/lib/module/core/environment.js +29 -0
- package/lib/module/core/errors.js +125 -0
- package/lib/module/core/events.js +51 -0
- package/lib/module/core/flows/controller.js +101 -0
- package/lib/module/core/flows/countdown.js +36 -0
- package/lib/module/core/flows/direct-bank-transfer.js +231 -0
- package/lib/module/core/flows/direct-card.js +349 -0
- package/lib/module/core/flows/direct-ewallet.js +119 -0
- package/lib/module/core/flows/direct-one-bill.js +167 -0
- package/lib/module/core/flows/direct-qr.js +104 -0
- package/lib/module/core/flows/direct-rtp.js +297 -0
- package/lib/module/core/flows/discount-lookup.js +75 -0
- package/lib/module/core/flows/headless.js +90 -0
- package/lib/module/core/flows/payment-sheet.js +1315 -0
- package/lib/module/core/flows/services.js +27 -0
- package/lib/module/core/flows/shared.js +78 -0
- package/lib/module/core/http/api-client.js +203 -0
- package/lib/module/core/http/endpoints.js +57 -0
- package/lib/module/core/http/token-manager.js +41 -0
- package/lib/module/core/http/transport.js +126 -0
- package/lib/module/core/index.js +52 -0
- package/lib/module/core/models/category.js +104 -0
- package/lib/module/core/models/discount.js +46 -0
- package/lib/module/core/models/payment.js +89 -0
- package/lib/module/core/models/session.js +120 -0
- package/lib/module/core/server/index.js +11 -0
- package/lib/module/core/server/node.js +56 -0
- package/lib/module/core/server/proxy.js +191 -0
- package/lib/module/core/server/verify.js +115 -0
- package/lib/module/core/swichpay.js +68 -0
- package/lib/module/core/utils/crypto.js +72 -0
- package/lib/module/core/utils/formatters.js +56 -0
- package/lib/module/core/utils/json.js +94 -0
- package/lib/module/core/utils/log.js +67 -0
- package/lib/module/core/utils/runtime.js +28 -0
- package/lib/module/core/utils/validators.js +54 -0
- package/lib/module/hooks.js +72 -0
- package/lib/module/index.js +36 -0
- package/lib/module/polyfills.js +4 -0
- package/lib/module/presenter.js +58 -0
- package/lib/module/provider.js +188 -0
- package/lib/module/swichpay.js +187 -0
- package/lib/module/theme.js +50 -0
- package/lib/module/ui.js +1116 -0
- package/lib/module/webviews.js +272 -0
- package/lib/typescript/commonjs/HostedCheckout.d.ts +17 -0
- package/lib/typescript/commonjs/checkout-webview.d.ts +14 -0
- package/lib/typescript/commonjs/checkouts/PaymentSheet.d.ts +14 -0
- package/lib/typescript/commonjs/checkouts/direct.d.ts +18 -0
- package/lib/typescript/commonjs/context.d.ts +20 -0
- package/lib/typescript/commonjs/core/api/direct-payment-api.d.ts +103 -0
- package/lib/typescript/commonjs/core/api/discount-api.d.ts +10 -0
- package/lib/typescript/commonjs/core/api/gateway-api.d.ts +150 -0
- package/lib/typescript/commonjs/core/api/payments-api.d.ts +22 -0
- package/lib/typescript/commonjs/core/api/repositories.d.ts +86 -0
- package/lib/typescript/commonjs/core/assets/images.d.ts +5 -0
- package/lib/typescript/commonjs/core/assets/method-logos.d.ts +12 -0
- package/lib/typescript/commonjs/core/assets/pwa-images.d.ts +7 -0
- package/lib/typescript/commonjs/core/browser/clipboard.d.ts +3 -0
- package/lib/typescript/commonjs/core/browser/dom.d.ts +11 -0
- package/lib/typescript/commonjs/core/browser/hosted-checkout.d.ts +27 -0
- package/lib/typescript/commonjs/core/browser/index.d.ts +11 -0
- package/lib/typescript/commonjs/core/browser/qr.d.ts +18 -0
- package/lib/typescript/commonjs/core/browser/three-ds.d.ts +45 -0
- package/lib/typescript/commonjs/core/client.d.ts +181 -0
- package/lib/typescript/commonjs/core/config.d.ts +86 -0
- package/lib/typescript/commonjs/core/environment.d.ts +22 -0
- package/lib/typescript/commonjs/core/errors.d.ts +78 -0
- package/lib/typescript/commonjs/core/events.d.ts +19 -0
- package/lib/typescript/commonjs/core/flows/controller.d.ts +41 -0
- package/lib/typescript/commonjs/core/flows/countdown.d.ts +15 -0
- package/lib/typescript/commonjs/core/flows/direct-bank-transfer.d.ts +49 -0
- package/lib/typescript/commonjs/core/flows/direct-card.d.ts +94 -0
- package/lib/typescript/commonjs/core/flows/direct-ewallet.d.ts +39 -0
- package/lib/typescript/commonjs/core/flows/direct-one-bill.d.ts +38 -0
- package/lib/typescript/commonjs/core/flows/direct-qr.d.ts +25 -0
- package/lib/typescript/commonjs/core/flows/direct-rtp.d.ts +72 -0
- package/lib/typescript/commonjs/core/flows/discount-lookup.d.ts +37 -0
- package/lib/typescript/commonjs/core/flows/headless.d.ts +38 -0
- package/lib/typescript/commonjs/core/flows/payment-sheet.d.ts +263 -0
- package/lib/typescript/commonjs/core/flows/services.d.ts +22 -0
- package/lib/typescript/commonjs/core/flows/shared.d.ts +40 -0
- package/lib/typescript/commonjs/core/http/api-client.d.ts +37 -0
- package/lib/typescript/commonjs/core/http/endpoints.d.ts +39 -0
- package/lib/typescript/commonjs/core/http/token-manager.d.ts +19 -0
- package/lib/typescript/commonjs/core/http/transport.d.ts +37 -0
- package/lib/typescript/commonjs/core/index.d.ts +42 -0
- package/lib/typescript/commonjs/core/models/category.d.ts +35 -0
- package/lib/typescript/commonjs/core/models/discount.d.ts +41 -0
- package/lib/typescript/commonjs/core/models/payment.d.ts +104 -0
- package/lib/typescript/commonjs/core/models/session.d.ts +87 -0
- package/lib/typescript/commonjs/core/server/index.d.ts +10 -0
- package/lib/typescript/commonjs/core/server/node.d.ts +19 -0
- package/lib/typescript/commonjs/core/server/proxy.d.ts +30 -0
- package/lib/typescript/commonjs/core/server/verify.d.ts +61 -0
- package/lib/typescript/commonjs/core/swichpay.d.ts +40 -0
- package/lib/typescript/commonjs/core/utils/crypto.d.ts +19 -0
- package/lib/typescript/commonjs/core/utils/formatters.d.ts +19 -0
- package/lib/typescript/commonjs/core/utils/json.d.ts +27 -0
- package/lib/typescript/commonjs/core/utils/log.d.ts +15 -0
- package/lib/typescript/commonjs/core/utils/runtime.d.ts +12 -0
- package/lib/typescript/commonjs/core/utils/validators.d.ts +23 -0
- package/lib/typescript/commonjs/hooks.d.ts +21 -0
- package/lib/typescript/commonjs/index.d.ts +26 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/polyfills.d.ts +2 -0
- package/lib/typescript/commonjs/presenter.d.ts +25 -0
- package/lib/typescript/commonjs/provider.d.ts +22 -0
- package/lib/typescript/commonjs/swichpay.d.ts +125 -0
- package/lib/typescript/commonjs/theme.d.ts +52 -0
- package/lib/typescript/commonjs/ui.d.ts +583 -0
- package/lib/typescript/commonjs/webviews.d.ts +40 -0
- package/lib/typescript/module/HostedCheckout.d.ts +17 -0
- package/lib/typescript/module/checkout-webview.d.ts +14 -0
- package/lib/typescript/module/checkouts/PaymentSheet.d.ts +14 -0
- package/lib/typescript/module/checkouts/direct.d.ts +18 -0
- package/lib/typescript/module/context.d.ts +20 -0
- package/lib/typescript/module/core/api/direct-payment-api.d.ts +103 -0
- package/lib/typescript/module/core/api/discount-api.d.ts +10 -0
- package/lib/typescript/module/core/api/gateway-api.d.ts +150 -0
- package/lib/typescript/module/core/api/payments-api.d.ts +22 -0
- package/lib/typescript/module/core/api/repositories.d.ts +86 -0
- package/lib/typescript/module/core/assets/images.d.ts +5 -0
- package/lib/typescript/module/core/assets/method-logos.d.ts +12 -0
- package/lib/typescript/module/core/assets/pwa-images.d.ts +7 -0
- package/lib/typescript/module/core/browser/clipboard.d.ts +3 -0
- package/lib/typescript/module/core/browser/dom.d.ts +11 -0
- package/lib/typescript/module/core/browser/hosted-checkout.d.ts +27 -0
- package/lib/typescript/module/core/browser/index.d.ts +11 -0
- package/lib/typescript/module/core/browser/qr.d.ts +18 -0
- package/lib/typescript/module/core/browser/three-ds.d.ts +45 -0
- package/lib/typescript/module/core/client.d.ts +181 -0
- package/lib/typescript/module/core/config.d.ts +86 -0
- package/lib/typescript/module/core/environment.d.ts +22 -0
- package/lib/typescript/module/core/errors.d.ts +78 -0
- package/lib/typescript/module/core/events.d.ts +19 -0
- package/lib/typescript/module/core/flows/controller.d.ts +41 -0
- package/lib/typescript/module/core/flows/countdown.d.ts +15 -0
- package/lib/typescript/module/core/flows/direct-bank-transfer.d.ts +49 -0
- package/lib/typescript/module/core/flows/direct-card.d.ts +94 -0
- package/lib/typescript/module/core/flows/direct-ewallet.d.ts +39 -0
- package/lib/typescript/module/core/flows/direct-one-bill.d.ts +38 -0
- package/lib/typescript/module/core/flows/direct-qr.d.ts +25 -0
- package/lib/typescript/module/core/flows/direct-rtp.d.ts +72 -0
- package/lib/typescript/module/core/flows/discount-lookup.d.ts +37 -0
- package/lib/typescript/module/core/flows/headless.d.ts +38 -0
- package/lib/typescript/module/core/flows/payment-sheet.d.ts +263 -0
- package/lib/typescript/module/core/flows/services.d.ts +22 -0
- package/lib/typescript/module/core/flows/shared.d.ts +40 -0
- package/lib/typescript/module/core/http/api-client.d.ts +37 -0
- package/lib/typescript/module/core/http/endpoints.d.ts +39 -0
- package/lib/typescript/module/core/http/token-manager.d.ts +19 -0
- package/lib/typescript/module/core/http/transport.d.ts +37 -0
- package/lib/typescript/module/core/index.d.ts +42 -0
- package/lib/typescript/module/core/models/category.d.ts +35 -0
- package/lib/typescript/module/core/models/discount.d.ts +41 -0
- package/lib/typescript/module/core/models/payment.d.ts +104 -0
- package/lib/typescript/module/core/models/session.d.ts +87 -0
- package/lib/typescript/module/core/server/index.d.ts +10 -0
- package/lib/typescript/module/core/server/node.d.ts +19 -0
- package/lib/typescript/module/core/server/proxy.d.ts +30 -0
- package/lib/typescript/module/core/server/verify.d.ts +61 -0
- package/lib/typescript/module/core/swichpay.d.ts +40 -0
- package/lib/typescript/module/core/utils/crypto.d.ts +19 -0
- package/lib/typescript/module/core/utils/formatters.d.ts +19 -0
- package/lib/typescript/module/core/utils/json.d.ts +27 -0
- package/lib/typescript/module/core/utils/log.d.ts +15 -0
- package/lib/typescript/module/core/utils/runtime.d.ts +12 -0
- package/lib/typescript/module/core/utils/validators.d.ts +23 -0
- package/lib/typescript/module/hooks.d.ts +21 -0
- package/lib/typescript/module/index.d.ts +26 -0
- package/lib/typescript/module/polyfills.d.ts +2 -0
- package/lib/typescript/module/presenter.d.ts +25 -0
- package/lib/typescript/module/provider.d.ts +22 -0
- package/lib/typescript/module/swichpay.d.ts +125 -0
- package/lib/typescript/module/theme.d.ts +52 -0
- package/lib/typescript/module/ui.d.ts +583 -0
- package/lib/typescript/module/webviews.d.ts +40 -0
- package/package.json +129 -4
|
@@ -0,0 +1,671 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.BankTransferCheckout = BankTransferCheckout;
|
|
7
|
+
exports.CardCheckout = CardCheckout;
|
|
8
|
+
exports.EwalletCheckout = EwalletCheckout;
|
|
9
|
+
exports.OneBillCheckout = OneBillCheckout;
|
|
10
|
+
exports.QrCheckout = QrCheckout;
|
|
11
|
+
exports.RtpEwalletCheckout = RtpEwalletCheckout;
|
|
12
|
+
exports.RtpNowCheckout = RtpNowCheckout;
|
|
13
|
+
var _react = require("react");
|
|
14
|
+
var _reactNative = require("react-native");
|
|
15
|
+
var _index = require("../core/index.js");
|
|
16
|
+
var _context = require("../context.js");
|
|
17
|
+
var _hooks = require("../hooks.js");
|
|
18
|
+
var _theme = require("../theme.js");
|
|
19
|
+
var _ui = require("../ui.js");
|
|
20
|
+
var _webviews = require("../webviews.js");
|
|
21
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
22
|
+
function amountLabel(details) {
|
|
23
|
+
return `${details.currency} ${(0, _index.formatAmountWhole)(details.amount)}`;
|
|
24
|
+
}
|
|
25
|
+
function useFinish(onFinish) {
|
|
26
|
+
const ref = (0, _hooks.useLatest)(onFinish);
|
|
27
|
+
return result => ref.current(result);
|
|
28
|
+
}
|
|
29
|
+
function Busy({
|
|
30
|
+
label
|
|
31
|
+
}) {
|
|
32
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
33
|
+
style: styles.busy,
|
|
34
|
+
accessibilityRole: "progressbar",
|
|
35
|
+
accessibilityLabel: label,
|
|
36
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.Spinner, {
|
|
37
|
+
dark: true,
|
|
38
|
+
large: true,
|
|
39
|
+
label: label
|
|
40
|
+
})
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// ── E-wallet ─────────────────────────────────────────────────────────────
|
|
45
|
+
|
|
46
|
+
function EwalletCheckout(props) {
|
|
47
|
+
const client = (0, _context.useSwichPayClient)();
|
|
48
|
+
const services = (0, _context.useFlowServices)(props.services);
|
|
49
|
+
const finish = useFinish(props.onFinish);
|
|
50
|
+
const [c, s] = (0, _hooks.useController)(() => new _index.DirectEwalletController(client, {
|
|
51
|
+
details: props.details,
|
|
52
|
+
onFinish: finish,
|
|
53
|
+
services
|
|
54
|
+
}));
|
|
55
|
+
(0, _context.useDismissHandler)(() => c.dismiss());
|
|
56
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
57
|
+
style: styles.fill,
|
|
58
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.SheetHeader, {
|
|
59
|
+
title: "Pay with Wallet",
|
|
60
|
+
onClose: () => c.cancel()
|
|
61
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ui.Screen, {
|
|
62
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.OrderSummary, {
|
|
63
|
+
item: s.details.item,
|
|
64
|
+
amount: amountLabel(s.details)
|
|
65
|
+
}), s.submitting ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.PendingApproval, {
|
|
66
|
+
message: "Enter MPIN on flash message or open your ewallet application and approve the request from approval/payment request sections"
|
|
67
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
68
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.ErrorBanner, {
|
|
69
|
+
message: s.error
|
|
70
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.Segmented, {
|
|
71
|
+
label: "Wallet",
|
|
72
|
+
value: s.walletType,
|
|
73
|
+
options: _index.WALLET_TYPES.map(w => ({
|
|
74
|
+
value: w.type,
|
|
75
|
+
label: w.label
|
|
76
|
+
})),
|
|
77
|
+
onChange: t => c.selectWallet(t)
|
|
78
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.TextField, {
|
|
79
|
+
label: "Account Number",
|
|
80
|
+
keyboardType: "phone-pad",
|
|
81
|
+
autoComplete: "tel",
|
|
82
|
+
placeholder: "Enter account number",
|
|
83
|
+
value: s.account,
|
|
84
|
+
error: s.errors.account,
|
|
85
|
+
onValueChange: v => c.setAccount(v)
|
|
86
|
+
}), s.usedUpFailure ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.RetryBlocked, {
|
|
87
|
+
onClose: () => c.closeWithFailure()
|
|
88
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.Button, {
|
|
89
|
+
onPress: () => void c.submit(),
|
|
90
|
+
children: s.payLabel
|
|
91
|
+
})]
|
|
92
|
+
})]
|
|
93
|
+
})]
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// ── Bank transfer ────────────────────────────────────────────────────────
|
|
98
|
+
|
|
99
|
+
function BankTransferCheckout(props) {
|
|
100
|
+
const client = (0, _context.useSwichPayClient)();
|
|
101
|
+
const services = (0, _context.useFlowServices)(props.services);
|
|
102
|
+
const finish = useFinish(props.onFinish);
|
|
103
|
+
const [c, s] = (0, _hooks.useController)(() => new _index.DirectBankTransferController(client, {
|
|
104
|
+
details: props.details,
|
|
105
|
+
onFinish: finish,
|
|
106
|
+
services
|
|
107
|
+
}), ctrl => void ctrl.start());
|
|
108
|
+
(0, _context.useDismissHandler)(() => c.dismiss());
|
|
109
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
110
|
+
style: styles.fill,
|
|
111
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.SheetHeader, {
|
|
112
|
+
title: "Pay with Bank Account",
|
|
113
|
+
onClose: () => c.cancel()
|
|
114
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ui.Screen, {
|
|
115
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.OrderSummary, {
|
|
116
|
+
item: s.details.item,
|
|
117
|
+
amount: amountLabel(s.details)
|
|
118
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.ErrorBanner, {
|
|
119
|
+
message: s.error
|
|
120
|
+
}), s.otpChallenge ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
121
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.TextField, {
|
|
122
|
+
label: "Enter OTP",
|
|
123
|
+
keyboardType: "number-pad",
|
|
124
|
+
autoComplete: "one-time-code",
|
|
125
|
+
textContentType: "oneTimeCode",
|
|
126
|
+
placeholder: "6-digit code",
|
|
127
|
+
maxLength: 6,
|
|
128
|
+
value: s.otp,
|
|
129
|
+
editable: !s.submitting,
|
|
130
|
+
error: s.errors.otp,
|
|
131
|
+
onValueChange: v => c.setOtp(v)
|
|
132
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
133
|
+
style: styles.right,
|
|
134
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.Button, {
|
|
135
|
+
variant: "ghost",
|
|
136
|
+
disabled: s.resendSecondsLeft !== 0 || s.submitting,
|
|
137
|
+
onPress: () => void c.resendOtp(),
|
|
138
|
+
children: s.resendSecondsLeft === 0 ? 'Resend OTP' : `Resend OTP in ${s.resendSecondsLeft}s`
|
|
139
|
+
})
|
|
140
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.Button, {
|
|
141
|
+
loading: s.submitting,
|
|
142
|
+
onPress: () => void c.confirmOtp(),
|
|
143
|
+
children: "CONFIRM"
|
|
144
|
+
})]
|
|
145
|
+
}) : s.loadingBanks ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Busy, {
|
|
146
|
+
label: "Loading banks"
|
|
147
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
148
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.SelectField, {
|
|
149
|
+
label: "Bank",
|
|
150
|
+
placeholder: "Choose your bank",
|
|
151
|
+
value: s.selectedBankCode,
|
|
152
|
+
options: s.banks.map(b => ({
|
|
153
|
+
value: b.code,
|
|
154
|
+
label: b.name
|
|
155
|
+
})),
|
|
156
|
+
disabled: s.submitting,
|
|
157
|
+
error: s.errors.bank,
|
|
158
|
+
onValueChange: v => c.selectBank(v)
|
|
159
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.TextField, {
|
|
160
|
+
label: "Account Number",
|
|
161
|
+
keyboardType: "number-pad",
|
|
162
|
+
placeholder: "Enter account number",
|
|
163
|
+
value: s.account,
|
|
164
|
+
editable: !s.submitting,
|
|
165
|
+
error: s.errors.account,
|
|
166
|
+
onValueChange: v => c.setAccount(v)
|
|
167
|
+
}), s.usedUpFailure ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.RetryBlocked, {
|
|
168
|
+
onClose: () => c.closeWithFailure()
|
|
169
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.Button, {
|
|
170
|
+
loading: s.submitting,
|
|
171
|
+
onPress: () => void c.requestOtp(),
|
|
172
|
+
children: s.payLabel
|
|
173
|
+
})]
|
|
174
|
+
})]
|
|
175
|
+
})]
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// ── Card ─────────────────────────────────────────────────────────────────
|
|
180
|
+
|
|
181
|
+
function CardCheckout(props) {
|
|
182
|
+
const client = (0, _context.useSwichPayClient)();
|
|
183
|
+
const services = (0, _context.useFlowServices)(props.services);
|
|
184
|
+
const finish = useFinish(props.onFinish);
|
|
185
|
+
const [c, s] = (0, _hooks.useController)(() => new _index.DirectCardController(client, {
|
|
186
|
+
details: props.details,
|
|
187
|
+
onFinish: finish,
|
|
188
|
+
services,
|
|
189
|
+
allowSaveCard: props.allowSaveCard ?? true
|
|
190
|
+
}));
|
|
191
|
+
(0, _context.useDismissHandler)(() => c.dismiss());
|
|
192
|
+
if (s.declinedResult) return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.DeclinedScreen, {
|
|
193
|
+
retryable: s.declinedResult.retryable,
|
|
194
|
+
message: s.declinedResult.message,
|
|
195
|
+
onClose: () => c.closeDeclined()
|
|
196
|
+
});
|
|
197
|
+
if (s.errorMessage != null) return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.ErrorScreen, {
|
|
198
|
+
onClose: () => c.closeError()
|
|
199
|
+
});
|
|
200
|
+
const header = /*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.SheetHeader, {
|
|
201
|
+
title: "Pay with Card",
|
|
202
|
+
onClose: () => c.cancel(),
|
|
203
|
+
closeDisabled: s.busy
|
|
204
|
+
});
|
|
205
|
+
const summary = /*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.OrderSummary, {
|
|
206
|
+
item: s.details.item,
|
|
207
|
+
amount: amountLabel(s.details)
|
|
208
|
+
});
|
|
209
|
+
if (s.verifyingCard) {
|
|
210
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
211
|
+
style: styles.fill,
|
|
212
|
+
children: [header, /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ui.Screen, {
|
|
213
|
+
children: [summary, /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
214
|
+
style: styles.busy,
|
|
215
|
+
accessibilityRole: "progressbar",
|
|
216
|
+
accessibilityLabel: "Verifying your card",
|
|
217
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.Spinner, {
|
|
218
|
+
dark: true,
|
|
219
|
+
large: true,
|
|
220
|
+
label: "Verifying your card"
|
|
221
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
222
|
+
style: styles.busyText,
|
|
223
|
+
children: "Verifying your card..."
|
|
224
|
+
})]
|
|
225
|
+
})]
|
|
226
|
+
})]
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
if (s.stepUp) {
|
|
230
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
231
|
+
style: styles.fill,
|
|
232
|
+
children: [header, /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ui.Screen, {
|
|
233
|
+
children: [summary, /*#__PURE__*/(0, _jsxRuntime.jsx)(_webviews.StepUpView, {
|
|
234
|
+
challenge: s.stepUp,
|
|
235
|
+
isCompletionUrl: c.isStepUpReturnUrl,
|
|
236
|
+
onComplete: d => void c.completeStepUp(d)
|
|
237
|
+
})]
|
|
238
|
+
})]
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
if (s.checkingStatus) {
|
|
242
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
243
|
+
style: styles.fill,
|
|
244
|
+
children: [header, /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ui.Screen, {
|
|
245
|
+
children: [summary, /*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.PendingApproval, {
|
|
246
|
+
message: s.statusMessage ?? 'Checking payment status...'
|
|
247
|
+
})]
|
|
248
|
+
})]
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
252
|
+
style: styles.fill,
|
|
253
|
+
children: [header, /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ui.Screen, {
|
|
254
|
+
children: [summary, /*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.TextField, {
|
|
255
|
+
label: "Card no.",
|
|
256
|
+
keyboardType: "number-pad",
|
|
257
|
+
autoComplete: "cc-number",
|
|
258
|
+
textContentType: "creditCardNumber",
|
|
259
|
+
placeholder: "Enter card no.",
|
|
260
|
+
value: s.number,
|
|
261
|
+
editable: !s.busy,
|
|
262
|
+
error: s.errors.number,
|
|
263
|
+
suffix: s.number ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.BrandBadge, {
|
|
264
|
+
brand: s.brand
|
|
265
|
+
}) : undefined,
|
|
266
|
+
onValueChange: v => c.setNumber(v)
|
|
267
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
268
|
+
style: styles.row,
|
|
269
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
270
|
+
style: styles.col,
|
|
271
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.TextField, {
|
|
272
|
+
label: "Expiry date",
|
|
273
|
+
keyboardType: "number-pad",
|
|
274
|
+
autoComplete: "cc-exp",
|
|
275
|
+
placeholder: "MM/YY",
|
|
276
|
+
maxLength: 5,
|
|
277
|
+
value: s.expiry,
|
|
278
|
+
editable: !s.busy,
|
|
279
|
+
error: s.errors.expiry,
|
|
280
|
+
onValueChange: v => c.setExpiry(v)
|
|
281
|
+
})
|
|
282
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
283
|
+
style: styles.col,
|
|
284
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.TextField, {
|
|
285
|
+
label: "CVC No.",
|
|
286
|
+
keyboardType: "number-pad",
|
|
287
|
+
autoComplete: "cc-csc",
|
|
288
|
+
secureTextEntry: true,
|
|
289
|
+
placeholder: "CVC",
|
|
290
|
+
maxLength: 4,
|
|
291
|
+
value: s.cvv,
|
|
292
|
+
editable: !s.busy,
|
|
293
|
+
error: s.errors.cvv,
|
|
294
|
+
onValueChange: v => c.setCvv(v)
|
|
295
|
+
})
|
|
296
|
+
})]
|
|
297
|
+
}), s.allowSaveCard ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.Checkbox, {
|
|
298
|
+
label: "Save this card for future payments",
|
|
299
|
+
checked: s.saveCard,
|
|
300
|
+
disabled: s.busy,
|
|
301
|
+
onChange: v => c.setSaveCard(v)
|
|
302
|
+
}) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.Button, {
|
|
303
|
+
loading: s.submitting,
|
|
304
|
+
onPress: () => void c.submit(),
|
|
305
|
+
children: s.payLabel
|
|
306
|
+
})]
|
|
307
|
+
})]
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
// ── 1Bill ────────────────────────────────────────────────────────────────
|
|
312
|
+
|
|
313
|
+
function OneBillCheckout(props) {
|
|
314
|
+
const client = (0, _context.useSwichPayClient)();
|
|
315
|
+
const services = (0, _context.useFlowServices)(props.services);
|
|
316
|
+
const finish = useFinish(props.onFinish);
|
|
317
|
+
const [c, s] = (0, _hooks.useController)(() => new _index.DirectOneBillController(client, {
|
|
318
|
+
details: props.details,
|
|
319
|
+
onFinish: finish,
|
|
320
|
+
services
|
|
321
|
+
}));
|
|
322
|
+
(0, _context.useDismissHandler)(() => c.dismiss());
|
|
323
|
+
const [copied, setCopied] = (0, _react.useState)(false);
|
|
324
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
325
|
+
style: styles.fill,
|
|
326
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.SheetHeader, {
|
|
327
|
+
title: "Pay via 1Bill",
|
|
328
|
+
onClose: () => c.cancel()
|
|
329
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ui.Screen, {
|
|
330
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.OrderSummary, {
|
|
331
|
+
item: s.details.item,
|
|
332
|
+
amount: amountLabel(s.details)
|
|
333
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.ErrorBanner, {
|
|
334
|
+
message: s.error
|
|
335
|
+
}), s.consumerNumber == null ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
336
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.TextField, {
|
|
337
|
+
label: "Mobile Number",
|
|
338
|
+
keyboardType: "phone-pad",
|
|
339
|
+
autoComplete: "tel",
|
|
340
|
+
placeholder: "Enter mobile number",
|
|
341
|
+
value: s.mobile,
|
|
342
|
+
editable: !s.submitting,
|
|
343
|
+
error: s.errors.mobile,
|
|
344
|
+
onValueChange: v => c.setMobile(v)
|
|
345
|
+
}), s.usedUpFailure ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.RetryBlocked, {
|
|
346
|
+
onClose: () => c.closeWithFailure()
|
|
347
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.Button, {
|
|
348
|
+
loading: s.submitting,
|
|
349
|
+
onPress: () => void c.generate(),
|
|
350
|
+
children: "GENERATE CONSUMER NUMBER"
|
|
351
|
+
})]
|
|
352
|
+
}) : s.expired ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
353
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.ErrorBanner, {
|
|
354
|
+
message: "This consumer number has expired."
|
|
355
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.Button, {
|
|
356
|
+
onPress: () => c.cancel(),
|
|
357
|
+
children: "CLOSE"
|
|
358
|
+
})]
|
|
359
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
360
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
361
|
+
style: styles.codeBox,
|
|
362
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
363
|
+
style: styles.codeLabel,
|
|
364
|
+
children: "Consumer Number"
|
|
365
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
366
|
+
style: styles.codeRow,
|
|
367
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
368
|
+
style: styles.codeValue,
|
|
369
|
+
selectable: true,
|
|
370
|
+
children: s.consumerNumber
|
|
371
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
|
|
372
|
+
accessibilityRole: "button",
|
|
373
|
+
accessibilityLabel: "Copy",
|
|
374
|
+
hitSlop: 8,
|
|
375
|
+
onPress: () => void c.copyConsumerNumber().then(setCopied),
|
|
376
|
+
style: styles.copy,
|
|
377
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
378
|
+
style: styles.copyText,
|
|
379
|
+
children: "\u29C9"
|
|
380
|
+
})
|
|
381
|
+
})]
|
|
382
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
|
|
383
|
+
style: styles.codeLabel,
|
|
384
|
+
accessibilityLiveRegion: "polite",
|
|
385
|
+
children: ["Time left: ", s.timeLeftLabel, copied ? ' · Copied' : '']
|
|
386
|
+
})]
|
|
387
|
+
}), s.statusMessage ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.Note, {
|
|
388
|
+
children: s.statusMessage
|
|
389
|
+
}) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.Button, {
|
|
390
|
+
loading: s.checkingStatus,
|
|
391
|
+
onPress: () => void c.checkStatus(),
|
|
392
|
+
children: "CHECK STATUS"
|
|
393
|
+
})]
|
|
394
|
+
})]
|
|
395
|
+
})]
|
|
396
|
+
});
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
// ── QR ───────────────────────────────────────────────────────────────────
|
|
400
|
+
|
|
401
|
+
function QrCheckout(props) {
|
|
402
|
+
const client = (0, _context.useSwichPayClient)();
|
|
403
|
+
const services = (0, _context.useFlowServices)(props.services);
|
|
404
|
+
const finish = useFinish(props.onFinish);
|
|
405
|
+
const [c, s] = (0, _hooks.useController)(() => new _index.DirectQrController(client, {
|
|
406
|
+
details: props.details,
|
|
407
|
+
onFinish: finish,
|
|
408
|
+
services
|
|
409
|
+
}), ctrl => void ctrl.start());
|
|
410
|
+
(0, _context.useDismissHandler)(() => c.dismiss());
|
|
411
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
412
|
+
style: styles.fill,
|
|
413
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.SheetHeader, {
|
|
414
|
+
title: "Pay with QR",
|
|
415
|
+
onClose: () => c.cancel()
|
|
416
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ui.Screen, {
|
|
417
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.OrderSummary, {
|
|
418
|
+
item: s.details.item,
|
|
419
|
+
amount: amountLabel(s.details)
|
|
420
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.ErrorBanner, {
|
|
421
|
+
message: s.error
|
|
422
|
+
}), s.generating ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Busy, {
|
|
423
|
+
label: "Generating QR code"
|
|
424
|
+
}) : s.qrPayload ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
425
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.QrCode, {
|
|
426
|
+
value: s.qrPayload
|
|
427
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
428
|
+
style: styles.linkRow,
|
|
429
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.Button, {
|
|
430
|
+
variant: "ghost",
|
|
431
|
+
onPress: () => void c.download(),
|
|
432
|
+
children: "\u2913 Download"
|
|
433
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.Button, {
|
|
434
|
+
variant: "ghost",
|
|
435
|
+
onPress: () => void c.share(),
|
|
436
|
+
children: "\u2934 Share"
|
|
437
|
+
})]
|
|
438
|
+
}), s.statusMessage ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.Note, {
|
|
439
|
+
children: s.statusMessage
|
|
440
|
+
}) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.Button, {
|
|
441
|
+
loading: s.checkingStatus,
|
|
442
|
+
onPress: () => void c.checkStatus(),
|
|
443
|
+
children: "I'VE COMPLETED THE PAYMENT"
|
|
444
|
+
})]
|
|
445
|
+
}) : null]
|
|
446
|
+
})]
|
|
447
|
+
});
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
// ── RTP Now ──────────────────────────────────────────────────────────────
|
|
451
|
+
|
|
452
|
+
function RtpNowCheckout(props) {
|
|
453
|
+
const client = (0, _context.useSwichPayClient)();
|
|
454
|
+
const services = (0, _context.useFlowServices)(props.services);
|
|
455
|
+
const finish = useFinish(props.onFinish);
|
|
456
|
+
const [c, s] = (0, _hooks.useController)(() => new _index.DirectRtpNowController(client, {
|
|
457
|
+
details: props.details,
|
|
458
|
+
onFinish: finish,
|
|
459
|
+
services
|
|
460
|
+
}), ctrl => void ctrl.start());
|
|
461
|
+
(0, _context.useDismissHandler)(() => c.dismiss());
|
|
462
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
463
|
+
style: styles.fill,
|
|
464
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.SheetHeader, {
|
|
465
|
+
title: "RTP Now",
|
|
466
|
+
onClose: () => c.cancel()
|
|
467
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ui.Screen, {
|
|
468
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.OrderSummary, {
|
|
469
|
+
item: s.details.item,
|
|
470
|
+
amount: amountLabel(s.details)
|
|
471
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.ErrorBanner, {
|
|
472
|
+
message: s.error
|
|
473
|
+
}), s.loadingBanks ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Busy, {
|
|
474
|
+
label: "Loading banks"
|
|
475
|
+
}) : s.submitting ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.PendingApproval, {
|
|
476
|
+
message: "Please approve the payment request on your banking application..."
|
|
477
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
478
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.Segmented, {
|
|
479
|
+
label: "Receive the request by",
|
|
480
|
+
value: s.mode,
|
|
481
|
+
options: [{
|
|
482
|
+
value: 'raastMobile',
|
|
483
|
+
label: 'Mobile'
|
|
484
|
+
}, {
|
|
485
|
+
value: 'raastIban',
|
|
486
|
+
label: 'IBAN'
|
|
487
|
+
}, {
|
|
488
|
+
value: 'bank',
|
|
489
|
+
label: 'Bank'
|
|
490
|
+
}],
|
|
491
|
+
onChange: m => c.setMode(m)
|
|
492
|
+
}), s.mode === 'raastMobile' ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.TextField, {
|
|
493
|
+
label: "Mobile Number",
|
|
494
|
+
keyboardType: "phone-pad",
|
|
495
|
+
placeholder: "Enter mobile number",
|
|
496
|
+
value: s.mobile,
|
|
497
|
+
error: s.errors.mobile,
|
|
498
|
+
onValueChange: v => c.setField('mobile', v)
|
|
499
|
+
}) : s.mode === 'raastIban' ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.TextField, {
|
|
500
|
+
label: "IBAN",
|
|
501
|
+
autoCapitalize: "characters",
|
|
502
|
+
autoCorrect: false,
|
|
503
|
+
placeholder: "Enter IBAN",
|
|
504
|
+
value: s.iban,
|
|
505
|
+
error: s.errors.iban,
|
|
506
|
+
onValueChange: v => c.setField('iban', v)
|
|
507
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
508
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.SelectField, {
|
|
509
|
+
label: "Bank",
|
|
510
|
+
placeholder: "Select bank",
|
|
511
|
+
value: s.selectedBankCode,
|
|
512
|
+
options: s.banks.map(b => ({
|
|
513
|
+
value: b.code,
|
|
514
|
+
label: b.name
|
|
515
|
+
})),
|
|
516
|
+
onValueChange: v => c.selectBank(v)
|
|
517
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.TextField, {
|
|
518
|
+
label: "Account Number",
|
|
519
|
+
keyboardType: "number-pad",
|
|
520
|
+
placeholder: "Enter account number",
|
|
521
|
+
value: s.bankAccount,
|
|
522
|
+
error: s.errors.bankAccount,
|
|
523
|
+
onValueChange: v => c.setField('bankAccount', v)
|
|
524
|
+
})]
|
|
525
|
+
}), s.usedUpFailure ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.RetryBlocked, {
|
|
526
|
+
onClose: () => c.closeWithFailure()
|
|
527
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.Button, {
|
|
528
|
+
onPress: () => void c.submit(),
|
|
529
|
+
children: s.payLabel
|
|
530
|
+
})]
|
|
531
|
+
})]
|
|
532
|
+
})]
|
|
533
|
+
});
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
// ── RTP E-wallet ─────────────────────────────────────────────────────────
|
|
537
|
+
|
|
538
|
+
function RtpEwalletCheckout(props) {
|
|
539
|
+
const client = (0, _context.useSwichPayClient)();
|
|
540
|
+
const services = (0, _context.useFlowServices)(props.services);
|
|
541
|
+
const finish = useFinish(props.onFinish);
|
|
542
|
+
const [c, s] = (0, _hooks.useController)(() => new _index.DirectRtpEwalletController(client, {
|
|
543
|
+
details: props.details,
|
|
544
|
+
onFinish: finish,
|
|
545
|
+
services
|
|
546
|
+
}), ctrl => void ctrl.start());
|
|
547
|
+
(0, _context.useDismissHandler)(() => c.dismiss());
|
|
548
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
549
|
+
style: styles.fill,
|
|
550
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.SheetHeader, {
|
|
551
|
+
title: "RTP E-Wallet",
|
|
552
|
+
onClose: () => c.cancel()
|
|
553
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ui.Screen, {
|
|
554
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.OrderSummary, {
|
|
555
|
+
item: s.details.item,
|
|
556
|
+
amount: amountLabel(s.details)
|
|
557
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.ErrorBanner, {
|
|
558
|
+
message: s.error
|
|
559
|
+
}), s.loadingBanks ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Busy, {
|
|
560
|
+
label: "Loading banks"
|
|
561
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
562
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.Segmented, {
|
|
563
|
+
label: "Pay with",
|
|
564
|
+
value: s.mode,
|
|
565
|
+
disabled: s.submitting,
|
|
566
|
+
options: [{
|
|
567
|
+
value: 'phone',
|
|
568
|
+
label: 'Phone'
|
|
569
|
+
}, {
|
|
570
|
+
value: 'iban',
|
|
571
|
+
label: 'IBAN'
|
|
572
|
+
}],
|
|
573
|
+
onChange: m => c.setMode(m)
|
|
574
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.SelectField, {
|
|
575
|
+
label: "Bank",
|
|
576
|
+
placeholder: "Select bank",
|
|
577
|
+
value: s.selectedBankCode,
|
|
578
|
+
disabled: s.submitting,
|
|
579
|
+
options: s.banks.map(b => ({
|
|
580
|
+
value: b.code,
|
|
581
|
+
label: b.name
|
|
582
|
+
})),
|
|
583
|
+
onValueChange: v => c.selectBank(v)
|
|
584
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.TextField, {
|
|
585
|
+
label: s.mode === 'phone' ? 'Mobile Number' : 'IBAN',
|
|
586
|
+
keyboardType: s.mode === 'phone' ? 'phone-pad' : 'default',
|
|
587
|
+
autoCapitalize: s.mode === 'phone' ? 'none' : 'characters',
|
|
588
|
+
placeholder: s.mode === 'phone' ? 'Enter mobile number' : 'Enter IBAN',
|
|
589
|
+
value: s.input,
|
|
590
|
+
editable: !s.submitting,
|
|
591
|
+
error: s.errors.input,
|
|
592
|
+
onValueChange: v => c.setInput(v)
|
|
593
|
+
}), s.usedUpFailure ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.RetryBlocked, {
|
|
594
|
+
onClose: () => c.closeWithFailure()
|
|
595
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.Button, {
|
|
596
|
+
loading: s.submitting,
|
|
597
|
+
onPress: () => void c.submit(),
|
|
598
|
+
children: s.payLabel
|
|
599
|
+
}), s.submitting ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.Note, {
|
|
600
|
+
children: s.mode === 'phone' ? 'Please approve this payment in your banking app. This can take a few minutes.' : 'Please approve this payment with your bank. This can take a few minutes.'
|
|
601
|
+
}) : null]
|
|
602
|
+
})]
|
|
603
|
+
})]
|
|
604
|
+
});
|
|
605
|
+
}
|
|
606
|
+
const styles = _reactNative.StyleSheet.create({
|
|
607
|
+
fill: {
|
|
608
|
+
flexGrow: 1,
|
|
609
|
+
flexShrink: 1,
|
|
610
|
+
backgroundColor: _theme.colors.surface
|
|
611
|
+
},
|
|
612
|
+
busy: {
|
|
613
|
+
alignItems: 'center',
|
|
614
|
+
justifyContent: 'center',
|
|
615
|
+
gap: _theme.space.md,
|
|
616
|
+
paddingVertical: _theme.space.xl
|
|
617
|
+
},
|
|
618
|
+
busyText: {
|
|
619
|
+
color: _theme.colors.muted,
|
|
620
|
+
fontSize: _theme.font.md
|
|
621
|
+
},
|
|
622
|
+
right: {
|
|
623
|
+
alignItems: 'flex-end'
|
|
624
|
+
},
|
|
625
|
+
row: {
|
|
626
|
+
flexDirection: 'row',
|
|
627
|
+
gap: _theme.space.md
|
|
628
|
+
},
|
|
629
|
+
col: {
|
|
630
|
+
flex: 1
|
|
631
|
+
},
|
|
632
|
+
linkRow: {
|
|
633
|
+
flexDirection: 'row',
|
|
634
|
+
justifyContent: 'center',
|
|
635
|
+
gap: _theme.space.sm
|
|
636
|
+
},
|
|
637
|
+
codeBox: {
|
|
638
|
+
padding: _theme.space.lg,
|
|
639
|
+
borderRadius: _theme.radius.md,
|
|
640
|
+
backgroundColor: _theme.colors.surfaceAlt,
|
|
641
|
+
gap: _theme.space.sm,
|
|
642
|
+
alignItems: 'center'
|
|
643
|
+
},
|
|
644
|
+
codeLabel: {
|
|
645
|
+
fontSize: _theme.font.sm + 1,
|
|
646
|
+
color: _theme.colors.muted
|
|
647
|
+
},
|
|
648
|
+
codeRow: {
|
|
649
|
+
flexDirection: 'row',
|
|
650
|
+
alignItems: 'center',
|
|
651
|
+
gap: _theme.space.md
|
|
652
|
+
},
|
|
653
|
+
codeValue: {
|
|
654
|
+
fontSize: _theme.font.xl + 2,
|
|
655
|
+
fontWeight: '700',
|
|
656
|
+
color: _theme.colors.text,
|
|
657
|
+
letterSpacing: 1
|
|
658
|
+
},
|
|
659
|
+
copy: {
|
|
660
|
+
width: 36,
|
|
661
|
+
height: 36,
|
|
662
|
+
borderRadius: 18,
|
|
663
|
+
alignItems: 'center',
|
|
664
|
+
justifyContent: 'center',
|
|
665
|
+
backgroundColor: _theme.colors.surface
|
|
666
|
+
},
|
|
667
|
+
copyText: {
|
|
668
|
+
fontSize: _theme.font.lg,
|
|
669
|
+
color: _theme.colors.blue
|
|
670
|
+
}
|
|
671
|
+
});
|