@brissoto/pay-react-native 0.0.0-stage → 1.4.5
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/LICENSE +21 -0
- package/README.md +180 -2
- package/assets/brand/paypal-wordmark.png +0 -0
- package/assets/fonts/Figtree-Bold.ttf +0 -0
- package/assets/fonts/Figtree-ExtraBold.ttf +0 -0
- package/assets/fonts/Figtree-Medium.ttf +0 -0
- package/assets/fonts/Figtree-Regular.ttf +0 -0
- package/assets/fonts/Figtree-SemiBold.ttf +0 -0
- package/assets/fonts/OFL.txt +93 -0
- package/assets/logos/airtel.png +0 -0
- package/assets/logos/app-store.png +0 -0
- package/assets/logos/apple-pay.png +0 -0
- package/assets/logos/at.png +0 -0
- package/assets/logos/bancontact.png +0 -0
- package/assets/logos/card.png +0 -0
- package/assets/logos/cb.png +0 -0
- package/assets/logos/celtiis.png +0 -0
- package/assets/logos/eps.png +0 -0
- package/assets/logos/feexpay.png +0 -0
- package/assets/logos/google-pay.png +0 -0
- package/assets/logos/google-play.png +0 -0
- package/assets/logos/iapkit.png +0 -0
- package/assets/logos/ideal.png +0 -0
- package/assets/logos/mastercard.png +0 -0
- package/assets/logos/mixx.png +0 -0
- package/assets/logos/moov.png +0 -0
- package/assets/logos/mtn.png +0 -0
- package/assets/logos/mybank.png +0 -0
- package/assets/logos/nexus.png +0 -0
- package/assets/logos/orange.png +0 -0
- package/assets/logos/pawapay.png +0 -0
- package/assets/logos/paypal.png +0 -0
- package/assets/logos/telecel.png +0 -0
- package/assets/logos/tnm.png +0 -0
- package/assets/logos/visa.png +0 -0
- package/assets/logos/vodacom.png +0 -0
- package/assets/logos/wave.png +0 -0
- package/dist/checkout-core/hooks/use-checkout-controller.d.ts +9 -0
- package/dist/checkout-core/hooks/use-checkout-controller.js +563 -0
- package/dist/checkout-core/hooks/use-checkout-payment.d.ts +9 -0
- package/dist/checkout-core/hooks/use-checkout-payment.js +136 -0
- package/dist/checkout-core/hooks/use-checkout-timers.d.ts +15 -0
- package/dist/checkout-core/hooks/use-checkout-timers.js +44 -0
- package/dist/checkout-core/hooks/use-phone-number.d.ts +7 -0
- package/dist/checkout-core/hooks/use-phone-number.js +82 -0
- package/dist/checkout-core/messages/en.d.ts +297 -0
- package/dist/checkout-core/messages/en.js +296 -0
- package/dist/checkout-core/messages/fr.d.ts +4 -0
- package/dist/checkout-core/messages/fr.js +297 -0
- package/dist/checkout-core/models/checkout.card.utils.d.ts +7 -0
- package/dist/checkout-core/models/checkout.card.utils.js +25 -0
- package/dist/checkout-core/models/checkout.constants.d.ts +101 -0
- package/dist/checkout-core/models/checkout.constants.js +339 -0
- package/dist/checkout-core/models/checkout.country.utils.d.ts +17 -0
- package/dist/checkout-core/models/checkout.country.utils.js +45 -0
- package/dist/checkout-core/models/checkout.enum.d.ts +230 -0
- package/dist/checkout-core/models/checkout.enum.js +256 -0
- package/dist/checkout-core/models/checkout.fetch.utils.d.ts +6 -0
- package/dist/checkout-core/models/checkout.fetch.utils.js +22 -0
- package/dist/checkout-core/models/checkout.interface.d.ts +696 -0
- package/dist/checkout-core/models/checkout.interface.js +1 -0
- package/dist/checkout-core/models/checkout.money.utils.d.ts +7 -0
- package/dist/checkout-core/models/checkout.money.utils.js +21 -0
- package/dist/checkout-core/models/checkout.phone.utils.d.ts +33 -0
- package/dist/checkout-core/models/checkout.phone.utils.js +159 -0
- package/dist/checkout-core/models/checkout.view.utils.d.ts +77 -0
- package/dist/checkout-core/models/checkout.view.utils.js +328 -0
- package/dist/checkout-core/models/domain.enum.d.ts +106 -0
- package/dist/checkout-core/models/domain.enum.js +113 -0
- package/dist/components/BrissotoPayProvider.d.ts +8 -0
- package/dist/components/BrissotoPayProvider.js +39 -0
- package/dist/components/PaymentSheetModal.d.ts +9 -0
- package/dist/components/PaymentSheetModal.js +106 -0
- package/dist/components/SheetBone.d.ts +3 -0
- package/dist/components/SheetBone.js +12 -0
- package/dist/components/SheetButton.d.ts +7 -0
- package/dist/components/SheetButton.js +47 -0
- package/dist/components/SheetCardFields.d.ts +10 -0
- package/dist/components/SheetCardFields.js +86 -0
- package/dist/components/SheetChosenMethod.d.ts +3 -0
- package/dist/components/SheetChosenMethod.js +60 -0
- package/dist/components/SheetCodeField.d.ts +8 -0
- package/dist/components/SheetCodeField.js +98 -0
- package/dist/components/SheetContent.d.ts +3 -0
- package/dist/components/SheetContent.js +132 -0
- package/dist/components/SheetDial.d.ts +7 -0
- package/dist/components/SheetDial.js +36 -0
- package/dist/components/SheetFailed.d.ts +3 -0
- package/dist/components/SheetFailed.js +44 -0
- package/dist/components/SheetForm.d.ts +8 -0
- package/dist/components/SheetForm.js +139 -0
- package/dist/components/SheetGrabber.d.ts +2 -0
- package/dist/components/SheetGrabber.js +17 -0
- package/dist/components/SheetHeader.d.ts +7 -0
- package/dist/components/SheetHeader.js +83 -0
- package/dist/components/SheetIcon.d.ts +3 -0
- package/dist/components/SheetIcon.js +78 -0
- package/dist/components/SheetLayout.d.ts +11 -0
- package/dist/components/SheetLayout.js +63 -0
- package/dist/components/SheetLogo.d.ts +3 -0
- package/dist/components/SheetLogo.js +20 -0
- package/dist/components/SheetMessage.d.ts +3 -0
- package/dist/components/SheetMessage.js +15 -0
- package/dist/components/SheetMethodCard.d.ts +3 -0
- package/dist/components/SheetMethodCard.js +71 -0
- package/dist/components/SheetNameField.d.ts +7 -0
- package/dist/components/SheetNameField.js +48 -0
- package/dist/components/SheetPaypalButton.d.ts +3 -0
- package/dist/components/SheetPaypalButton.js +23 -0
- package/dist/components/SheetPhoneField.d.ts +3 -0
- package/dist/components/SheetPhoneField.js +59 -0
- package/dist/components/SheetPillSelect.d.ts +7 -0
- package/dist/components/SheetPillSelect.js +134 -0
- package/dist/components/SheetRow.d.ts +3 -0
- package/dist/components/SheetRow.js +28 -0
- package/dist/components/SheetSimulator.d.ts +6 -0
- package/dist/components/SheetSimulator.js +40 -0
- package/dist/components/SheetSkeleton.d.ts +5 -0
- package/dist/components/SheetSkeleton.js +23 -0
- package/dist/components/SheetStep.d.ts +6 -0
- package/dist/components/SheetStep.js +21 -0
- package/dist/components/SheetStoreTab.d.ts +7 -0
- package/dist/components/SheetStoreTab.js +27 -0
- package/dist/components/SheetSuccess.d.ts +3 -0
- package/dist/components/SheetSuccess.js +51 -0
- package/dist/components/SheetSummary.d.ts +3 -0
- package/dist/components/SheetSummary.js +32 -0
- package/dist/components/SheetTerminal.d.ts +3 -0
- package/dist/components/SheetTerminal.js +21 -0
- package/dist/components/SheetText.d.ts +5 -0
- package/dist/components/SheetText.js +27 -0
- package/dist/components/SheetToast.d.ts +7 -0
- package/dist/components/SheetToast.js +71 -0
- package/dist/components/SheetWaiting.d.ts +7 -0
- package/dist/components/SheetWaiting.js +88 -0
- package/dist/hooks/use-native-platform.d.ts +10 -0
- package/dist/hooks/use-native-platform.js +71 -0
- package/dist/hooks/use-payment-sheet.d.ts +4 -0
- package/dist/hooks/use-payment-sheet.js +10 -0
- package/dist/hooks/use-shake.d.ts +3 -0
- package/dist/hooks/use-shake.js +18 -0
- package/dist/hooks/use-sheet-motion.d.ts +7 -0
- package/dist/hooks/use-sheet-motion.js +62 -0
- package/dist/hooks/use-sheet-resize.d.ts +6 -0
- package/dist/hooks/use-sheet-resize.js +15 -0
- package/dist/hooks/use-sheet-room.d.ts +4 -0
- package/dist/hooks/use-sheet-room.js +8 -0
- package/dist/hooks/use-sheet-theme.d.ts +4 -0
- package/dist/hooks/use-sheet-theme.js +12 -0
- package/dist/hooks/use-step-slide.d.ts +16 -0
- package/dist/hooks/use-step-slide.js +50 -0
- package/dist/hooks/use-store-recovery.d.ts +9 -0
- package/dist/hooks/use-store-recovery.js +50 -0
- package/dist/hooks/use-store-tab.d.ts +11 -0
- package/dist/hooks/use-store-tab.js +112 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +2 -0
- package/dist/models/sheet.constants.d.ts +125 -0
- package/dist/models/sheet.constants.js +204 -0
- package/dist/models/sheet.enum.d.ts +46 -0
- package/dist/models/sheet.enum.js +53 -0
- package/dist/models/sheet.interface.d.ts +423 -0
- package/dist/models/sheet.interface.js +1 -0
- package/dist/models/sheet.utils.d.ts +68 -0
- package/dist/models/sheet.utils.js +211 -0
- package/dist/services/checkout.service.d.ts +15 -0
- package/dist/services/checkout.service.js +96 -0
- package/dist/services/provider-window.service.d.ts +13 -0
- package/dist/services/provider-window.service.js +53 -0
- package/dist/services/store.service.d.ts +36 -0
- package/dist/services/store.service.js +107 -0
- package/package.json +73 -4
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
export declare enum CheckoutScreenEnum {
|
|
2
|
+
LOADING = "loading",
|
|
3
|
+
FORM = "form",
|
|
4
|
+
SUBMITTING = "submitting",
|
|
5
|
+
WAITING = "waiting",
|
|
6
|
+
/** The last attempt failed: why, a retry and another method. */
|
|
7
|
+
FAILED = "failed",
|
|
8
|
+
SUCCESS = "success",
|
|
9
|
+
EXPIRED = "expired",
|
|
10
|
+
CANCELLED = "cancelled",
|
|
11
|
+
LOCKED = "locked",
|
|
12
|
+
INVALID = "invalid",
|
|
13
|
+
/** Every method went off since the link was made: nothing to pay with. */
|
|
14
|
+
NO_METHOD = "no_method",
|
|
15
|
+
REDIRECT = "redirect"
|
|
16
|
+
}
|
|
17
|
+
/** The form's two steps: pick a method, then what it needs (the number and its code, or the card). */
|
|
18
|
+
export declare enum CheckoutStepEnum {
|
|
19
|
+
METHOD = "method",
|
|
20
|
+
DETAILS = "details"
|
|
21
|
+
}
|
|
22
|
+
/** The first two are the `preferredTab` an app may send; the store's is the payment sheet's own. */
|
|
23
|
+
export declare enum CheckoutTabEnum {
|
|
24
|
+
MOBILE_MONEY = "mobile_money",
|
|
25
|
+
CARD = "card",
|
|
26
|
+
/** The phone's store (App Store or Google Play): a product payment in the payment sheet only. */
|
|
27
|
+
STORE = "store"
|
|
28
|
+
}
|
|
29
|
+
/** GLOSSARY: Payment. Values are the API's. */
|
|
30
|
+
export declare enum CheckoutPaymentStatusEnum {
|
|
31
|
+
PENDING = "pending",
|
|
32
|
+
PAID = "paid",
|
|
33
|
+
EXPIRED = "expired",
|
|
34
|
+
LOCKED = "locked",
|
|
35
|
+
CANCELLED = "cancelled",
|
|
36
|
+
/** A store gave the payer their money back after it was paid. */
|
|
37
|
+
REFUNDED = "refunded"
|
|
38
|
+
}
|
|
39
|
+
/** Where a method stands on this payment: payable, greyed with a note, or not built yet. */
|
|
40
|
+
export declare enum MethodStateEnum {
|
|
41
|
+
AVAILABLE = "available",
|
|
42
|
+
MAINTENANCE = "maintenance",
|
|
43
|
+
SOON = "soon"
|
|
44
|
+
}
|
|
45
|
+
export declare enum MethodKindEnum {
|
|
46
|
+
MOBILE_MONEY = "mobile_money",
|
|
47
|
+
CARD = "card"
|
|
48
|
+
}
|
|
49
|
+
/** How the payer approves: a prompt on the phone, a one-time code, card fields, a store's own sheet, PayPal's approval page, or their bank's page. Values are the backend's. */
|
|
50
|
+
export declare enum MethodFlowEnum {
|
|
51
|
+
USSD_PUSH = "ussd_push",
|
|
52
|
+
OTP = "otp",
|
|
53
|
+
CARD_FIELDS = "card_fields",
|
|
54
|
+
STORE = "store",
|
|
55
|
+
PAYPAL = "paypal",
|
|
56
|
+
BANK_REDIRECT = "bank_redirect"
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Which Pay route opens a flow's attempt: a phone prompt, a payment code,
|
|
60
|
+
* card fields, PayPal's window, a bank redirect or a store's sheet. Values
|
|
61
|
+
* are the backend's.
|
|
62
|
+
*/
|
|
63
|
+
export declare enum PayRouteEnum {
|
|
64
|
+
PROMPT = "prompt",
|
|
65
|
+
CODE = "code",
|
|
66
|
+
CARD = "card",
|
|
67
|
+
PAYPAL = "paypal",
|
|
68
|
+
BANK = "bank",
|
|
69
|
+
STORE = "store"
|
|
70
|
+
}
|
|
71
|
+
/** What a flow's form asks the payer for before Pay. A code also means "new code" on retry. */
|
|
72
|
+
export declare enum FlowAskEnum {
|
|
73
|
+
PHONE = "phone",
|
|
74
|
+
CODE = "code",
|
|
75
|
+
CARD = "card",
|
|
76
|
+
NAME = "name"
|
|
77
|
+
}
|
|
78
|
+
/** The line under a method's name: its network, its country (a bank redirect), or the currency it charges in (PayPal). */
|
|
79
|
+
export declare enum MethodLineEnum {
|
|
80
|
+
NETWORK = "network",
|
|
81
|
+
COUNTRY = "country",
|
|
82
|
+
CHARGED_IN = "charged_in"
|
|
83
|
+
}
|
|
84
|
+
/** The network a Mobile Money number belongs to, from its first digits. Values are logo names. */
|
|
85
|
+
export declare enum MethodBrandEnum {
|
|
86
|
+
ORANGE = "orange",
|
|
87
|
+
MTN = "mtn",
|
|
88
|
+
MOOV = "moov"
|
|
89
|
+
}
|
|
90
|
+
/** Why Pay was refused. Values are the backend's. */
|
|
91
|
+
export declare enum PayRefusalEnum {
|
|
92
|
+
CLOSED = "closed",
|
|
93
|
+
METHOD = "method",
|
|
94
|
+
PHONE = "phone",
|
|
95
|
+
/** An OTP method came without a valid code. */
|
|
96
|
+
CODE = "code",
|
|
97
|
+
/** Earlier attempts still pending could use up the payment's tries. */
|
|
98
|
+
BUSY = "busy",
|
|
99
|
+
/** A bank redirect without the account holder's first and last name. */
|
|
100
|
+
NAME = "name"
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* What a provider's card fields page and the checkout tell each other through
|
|
104
|
+
* `postMessage`. The card itself never crosses: only whether it is complete,
|
|
105
|
+
* the page's height, and how a Pay went.
|
|
106
|
+
*/
|
|
107
|
+
export declare enum CardFieldsMessageEnum {
|
|
108
|
+
/** Page → checkout: `complete` says whether Pay can go. */
|
|
109
|
+
STATE = "card-fields:state",
|
|
110
|
+
/** Page → checkout: its content height, so the frame never scrolls. */
|
|
111
|
+
HEIGHT = "card-fields:height",
|
|
112
|
+
/** Checkout → page: Pay was pressed. */
|
|
113
|
+
SUBMIT = "card-fields:submit",
|
|
114
|
+
/** Page → checkout: the card is with the provider; the checkout waits for the status checks. */
|
|
115
|
+
DONE = "card-fields:done",
|
|
116
|
+
/** Page → checkout: Pay was refused (`reason`), or could not reach us (none). */
|
|
117
|
+
REFUSED = "card-fields:refused",
|
|
118
|
+
/** Page → checkout: the payer shut their bank's check; that attempt is closed, the card stays for another Pay. */
|
|
119
|
+
CLOSED = "card-fields:closed",
|
|
120
|
+
/** Page → checkout: a bank's 3D Secure page shows in it (`showing`), or went. */
|
|
121
|
+
BANK_PAGE = "card-fields:bank-page"
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* What PayPal's return page and the checkout that opened the bank's window
|
|
125
|
+
* say to each other (ADR 0014), by `postMessage` to the opener and on the
|
|
126
|
+
* reference's broadcast channel, which still reaches a window the bank
|
|
127
|
+
* page's opener policy cut off.
|
|
128
|
+
*/
|
|
129
|
+
export declare enum BankWindowMessageEnum {
|
|
130
|
+
/** Back on our return page, which tells the gateway itself. */
|
|
131
|
+
RETURNED = "bank-window:returned",
|
|
132
|
+
/** The checkout heard it: the return page may shut itself. */
|
|
133
|
+
HEARD = "bank-window:heard"
|
|
134
|
+
}
|
|
135
|
+
export declare enum CardFieldEnum {
|
|
136
|
+
NUMBER = "number",
|
|
137
|
+
EXPIRY = "expiry",
|
|
138
|
+
CVC = "cvc"
|
|
139
|
+
}
|
|
140
|
+
/** What a tester makes the Simulator answer. Values are the backend's. */
|
|
141
|
+
export declare enum SimulatorOutcomeEnum {
|
|
142
|
+
APPROVED = "approved",
|
|
143
|
+
DECLINED = "declined",
|
|
144
|
+
INSUFFICIENT_FUNDS = "insufficient_funds",
|
|
145
|
+
NO_ACCOUNT = "no_account",
|
|
146
|
+
WRONG_PIN = "wrong_pin",
|
|
147
|
+
WRONG_CODE = "wrong_code",
|
|
148
|
+
PROVIDER_ERROR = "provider_error",
|
|
149
|
+
WRONG_AMOUNT = "wrong_amount",
|
|
150
|
+
APPROVED_LATE = "approved_late",
|
|
151
|
+
REVERSED = "reversed",
|
|
152
|
+
/** A success on every send: a duplicate. Offered once there are several. */
|
|
153
|
+
APPROVED_ALL = "approved_all"
|
|
154
|
+
}
|
|
155
|
+
export declare enum PhoneErrorEnum {
|
|
156
|
+
START = "start",
|
|
157
|
+
SHORT = "short",
|
|
158
|
+
INVALID = "invalid",
|
|
159
|
+
EMPTY = "empty",
|
|
160
|
+
OPERATOR = "operator",
|
|
161
|
+
/** An international number of a country the payment is not offered in. */
|
|
162
|
+
COUNTRY = "country"
|
|
163
|
+
}
|
|
164
|
+
/** The store a phone buys from, as the gateway names it. */
|
|
165
|
+
export declare enum PhoneStoreEnum {
|
|
166
|
+
APP_STORE = "appStore",
|
|
167
|
+
GOOGLE_PLAY = "googlePlay"
|
|
168
|
+
}
|
|
169
|
+
/** How a store's sheet ended without a purchase. Values are the backend's. */
|
|
170
|
+
export declare enum StoreSheetOutcomeEnum {
|
|
171
|
+
/** The payer closed it: nothing was charged, and it never counts toward the lock. */
|
|
172
|
+
CANCELLED = "cancelled",
|
|
173
|
+
/** The store could not take the payment. */
|
|
174
|
+
ERROR = "error",
|
|
175
|
+
/** Someone must approve it first (Ask to Buy, cash at a shop): the attempt waits. */
|
|
176
|
+
PENDING = "pending"
|
|
177
|
+
}
|
|
178
|
+
export declare enum SupportChannelEnum {
|
|
179
|
+
WHATSAPP = "whatsapp",
|
|
180
|
+
EMAIL = "email"
|
|
181
|
+
}
|
|
182
|
+
/** Values are the keys of `faqs` in the checkout catalog. */
|
|
183
|
+
export declare enum FaqEnum {
|
|
184
|
+
NOT_RECEIVED = "not_received",
|
|
185
|
+
DEBITED = "debited"
|
|
186
|
+
}
|
|
187
|
+
/** Screens the payer cannot act on, each with its copy. Values are catalog keys. */
|
|
188
|
+
export declare enum TerminalKindEnum {
|
|
189
|
+
EXPIRED = "expired",
|
|
190
|
+
CANCELLED = "cancelled",
|
|
191
|
+
LOCKED = "locked",
|
|
192
|
+
INVALID = "invalid",
|
|
193
|
+
NO_METHOD = "no_method"
|
|
194
|
+
}
|
|
195
|
+
export declare enum CheckoutButtonVariantEnum {
|
|
196
|
+
PRIMARY = "primary",
|
|
197
|
+
SECONDARY = "secondary",
|
|
198
|
+
/** The second choice under Pay or Try again: the secondary's look, no border. */
|
|
199
|
+
PLAIN = "plain",
|
|
200
|
+
/** Gives something up: cancelling the payment. */
|
|
201
|
+
DANGER = "danger",
|
|
202
|
+
/** PayPal's own gold button, the same in both themes (ADR 0010). */
|
|
203
|
+
PAYPAL = "paypal",
|
|
204
|
+
/** A quiet action in a line of its own, in the brand colour ("Paying from another country?"), on the web and in the sheet. */
|
|
205
|
+
LINK = "link"
|
|
206
|
+
}
|
|
207
|
+
/** Values are the `theme` an app may send. */
|
|
208
|
+
export declare enum CheckoutThemeEnum {
|
|
209
|
+
LIGHT = "light",
|
|
210
|
+
DARK = "dark"
|
|
211
|
+
}
|
|
212
|
+
/** What a toast says: done, a problem, or just good to know. Sets its icon. */
|
|
213
|
+
export declare enum CheckoutToastToneEnum {
|
|
214
|
+
SUCCESS = "success",
|
|
215
|
+
WARNING = "warning",
|
|
216
|
+
INFO = "info"
|
|
217
|
+
}
|
|
218
|
+
/** How a provider's window ended (PayPal's, the bank's): the payer approved, or left it without approving. */
|
|
219
|
+
export declare enum ProviderWindowEndEnum {
|
|
220
|
+
APPROVED = "approved",
|
|
221
|
+
CLOSED = "closed",
|
|
222
|
+
/** Back on our return page, which told the gateway itself (a bank redirect on the web). */
|
|
223
|
+
RETURNED = "returned",
|
|
224
|
+
/**
|
|
225
|
+
* The bank's window reads shut with no word from our return page: shut,
|
|
226
|
+
* or cut off by the bank page's opener policy while the payer still pays
|
|
227
|
+
* there. Not proof of a cancel: the payer says so (ADR 0014).
|
|
228
|
+
*/
|
|
229
|
+
LOST = "lost"
|
|
230
|
+
}
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
export var CheckoutScreenEnum;
|
|
2
|
+
(function (CheckoutScreenEnum) {
|
|
3
|
+
CheckoutScreenEnum["LOADING"] = "loading";
|
|
4
|
+
CheckoutScreenEnum["FORM"] = "form";
|
|
5
|
+
CheckoutScreenEnum["SUBMITTING"] = "submitting";
|
|
6
|
+
CheckoutScreenEnum["WAITING"] = "waiting";
|
|
7
|
+
/** The last attempt failed: why, a retry and another method. */
|
|
8
|
+
CheckoutScreenEnum["FAILED"] = "failed";
|
|
9
|
+
CheckoutScreenEnum["SUCCESS"] = "success";
|
|
10
|
+
CheckoutScreenEnum["EXPIRED"] = "expired";
|
|
11
|
+
CheckoutScreenEnum["CANCELLED"] = "cancelled";
|
|
12
|
+
CheckoutScreenEnum["LOCKED"] = "locked";
|
|
13
|
+
CheckoutScreenEnum["INVALID"] = "invalid";
|
|
14
|
+
/** Every method went off since the link was made: nothing to pay with. */
|
|
15
|
+
CheckoutScreenEnum["NO_METHOD"] = "no_method";
|
|
16
|
+
CheckoutScreenEnum["REDIRECT"] = "redirect";
|
|
17
|
+
})(CheckoutScreenEnum || (CheckoutScreenEnum = {}));
|
|
18
|
+
/** The form's two steps: pick a method, then what it needs (the number and its code, or the card). */
|
|
19
|
+
export var CheckoutStepEnum;
|
|
20
|
+
(function (CheckoutStepEnum) {
|
|
21
|
+
CheckoutStepEnum["METHOD"] = "method";
|
|
22
|
+
CheckoutStepEnum["DETAILS"] = "details";
|
|
23
|
+
})(CheckoutStepEnum || (CheckoutStepEnum = {}));
|
|
24
|
+
/** The first two are the `preferredTab` an app may send; the store's is the payment sheet's own. */
|
|
25
|
+
export var CheckoutTabEnum;
|
|
26
|
+
(function (CheckoutTabEnum) {
|
|
27
|
+
CheckoutTabEnum["MOBILE_MONEY"] = "mobile_money";
|
|
28
|
+
CheckoutTabEnum["CARD"] = "card";
|
|
29
|
+
/** The phone's store (App Store or Google Play): a product payment in the payment sheet only. */
|
|
30
|
+
CheckoutTabEnum["STORE"] = "store";
|
|
31
|
+
})(CheckoutTabEnum || (CheckoutTabEnum = {}));
|
|
32
|
+
/** GLOSSARY: Payment. Values are the API's. */
|
|
33
|
+
export var CheckoutPaymentStatusEnum;
|
|
34
|
+
(function (CheckoutPaymentStatusEnum) {
|
|
35
|
+
CheckoutPaymentStatusEnum["PENDING"] = "pending";
|
|
36
|
+
CheckoutPaymentStatusEnum["PAID"] = "paid";
|
|
37
|
+
CheckoutPaymentStatusEnum["EXPIRED"] = "expired";
|
|
38
|
+
CheckoutPaymentStatusEnum["LOCKED"] = "locked";
|
|
39
|
+
CheckoutPaymentStatusEnum["CANCELLED"] = "cancelled";
|
|
40
|
+
/** A store gave the payer their money back after it was paid. */
|
|
41
|
+
CheckoutPaymentStatusEnum["REFUNDED"] = "refunded";
|
|
42
|
+
})(CheckoutPaymentStatusEnum || (CheckoutPaymentStatusEnum = {}));
|
|
43
|
+
/** Where a method stands on this payment: payable, greyed with a note, or not built yet. */
|
|
44
|
+
export var MethodStateEnum;
|
|
45
|
+
(function (MethodStateEnum) {
|
|
46
|
+
MethodStateEnum["AVAILABLE"] = "available";
|
|
47
|
+
MethodStateEnum["MAINTENANCE"] = "maintenance";
|
|
48
|
+
MethodStateEnum["SOON"] = "soon";
|
|
49
|
+
})(MethodStateEnum || (MethodStateEnum = {}));
|
|
50
|
+
export var MethodKindEnum;
|
|
51
|
+
(function (MethodKindEnum) {
|
|
52
|
+
MethodKindEnum["MOBILE_MONEY"] = "mobile_money";
|
|
53
|
+
MethodKindEnum["CARD"] = "card";
|
|
54
|
+
})(MethodKindEnum || (MethodKindEnum = {}));
|
|
55
|
+
/** How the payer approves: a prompt on the phone, a one-time code, card fields, a store's own sheet, PayPal's approval page, or their bank's page. Values are the backend's. */
|
|
56
|
+
export var MethodFlowEnum;
|
|
57
|
+
(function (MethodFlowEnum) {
|
|
58
|
+
MethodFlowEnum["USSD_PUSH"] = "ussd_push";
|
|
59
|
+
MethodFlowEnum["OTP"] = "otp";
|
|
60
|
+
MethodFlowEnum["CARD_FIELDS"] = "card_fields";
|
|
61
|
+
MethodFlowEnum["STORE"] = "store";
|
|
62
|
+
MethodFlowEnum["PAYPAL"] = "paypal";
|
|
63
|
+
MethodFlowEnum["BANK_REDIRECT"] = "bank_redirect";
|
|
64
|
+
})(MethodFlowEnum || (MethodFlowEnum = {}));
|
|
65
|
+
/**
|
|
66
|
+
* Which Pay route opens a flow's attempt: a phone prompt, a payment code,
|
|
67
|
+
* card fields, PayPal's window, a bank redirect or a store's sheet. Values
|
|
68
|
+
* are the backend's.
|
|
69
|
+
*/
|
|
70
|
+
export var PayRouteEnum;
|
|
71
|
+
(function (PayRouteEnum) {
|
|
72
|
+
PayRouteEnum["PROMPT"] = "prompt";
|
|
73
|
+
PayRouteEnum["CODE"] = "code";
|
|
74
|
+
PayRouteEnum["CARD"] = "card";
|
|
75
|
+
PayRouteEnum["PAYPAL"] = "paypal";
|
|
76
|
+
PayRouteEnum["BANK"] = "bank";
|
|
77
|
+
PayRouteEnum["STORE"] = "store";
|
|
78
|
+
})(PayRouteEnum || (PayRouteEnum = {}));
|
|
79
|
+
/** What a flow's form asks the payer for before Pay. A code also means "new code" on retry. */
|
|
80
|
+
export var FlowAskEnum;
|
|
81
|
+
(function (FlowAskEnum) {
|
|
82
|
+
FlowAskEnum["PHONE"] = "phone";
|
|
83
|
+
FlowAskEnum["CODE"] = "code";
|
|
84
|
+
FlowAskEnum["CARD"] = "card";
|
|
85
|
+
FlowAskEnum["NAME"] = "name";
|
|
86
|
+
})(FlowAskEnum || (FlowAskEnum = {}));
|
|
87
|
+
/** The line under a method's name: its network, its country (a bank redirect), or the currency it charges in (PayPal). */
|
|
88
|
+
export var MethodLineEnum;
|
|
89
|
+
(function (MethodLineEnum) {
|
|
90
|
+
MethodLineEnum["NETWORK"] = "network";
|
|
91
|
+
MethodLineEnum["COUNTRY"] = "country";
|
|
92
|
+
MethodLineEnum["CHARGED_IN"] = "charged_in";
|
|
93
|
+
})(MethodLineEnum || (MethodLineEnum = {}));
|
|
94
|
+
/** The network a Mobile Money number belongs to, from its first digits. Values are logo names. */
|
|
95
|
+
export var MethodBrandEnum;
|
|
96
|
+
(function (MethodBrandEnum) {
|
|
97
|
+
MethodBrandEnum["ORANGE"] = "orange";
|
|
98
|
+
MethodBrandEnum["MTN"] = "mtn";
|
|
99
|
+
MethodBrandEnum["MOOV"] = "moov";
|
|
100
|
+
})(MethodBrandEnum || (MethodBrandEnum = {}));
|
|
101
|
+
/** Why Pay was refused. Values are the backend's. */
|
|
102
|
+
export var PayRefusalEnum;
|
|
103
|
+
(function (PayRefusalEnum) {
|
|
104
|
+
PayRefusalEnum["CLOSED"] = "closed";
|
|
105
|
+
PayRefusalEnum["METHOD"] = "method";
|
|
106
|
+
PayRefusalEnum["PHONE"] = "phone";
|
|
107
|
+
/** An OTP method came without a valid code. */
|
|
108
|
+
PayRefusalEnum["CODE"] = "code";
|
|
109
|
+
/** Earlier attempts still pending could use up the payment's tries. */
|
|
110
|
+
PayRefusalEnum["BUSY"] = "busy";
|
|
111
|
+
/** A bank redirect without the account holder's first and last name. */
|
|
112
|
+
PayRefusalEnum["NAME"] = "name";
|
|
113
|
+
})(PayRefusalEnum || (PayRefusalEnum = {}));
|
|
114
|
+
/**
|
|
115
|
+
* What a provider's card fields page and the checkout tell each other through
|
|
116
|
+
* `postMessage`. The card itself never crosses: only whether it is complete,
|
|
117
|
+
* the page's height, and how a Pay went.
|
|
118
|
+
*/
|
|
119
|
+
export var CardFieldsMessageEnum;
|
|
120
|
+
(function (CardFieldsMessageEnum) {
|
|
121
|
+
/** Page → checkout: `complete` says whether Pay can go. */
|
|
122
|
+
CardFieldsMessageEnum["STATE"] = "card-fields:state";
|
|
123
|
+
/** Page → checkout: its content height, so the frame never scrolls. */
|
|
124
|
+
CardFieldsMessageEnum["HEIGHT"] = "card-fields:height";
|
|
125
|
+
/** Checkout → page: Pay was pressed. */
|
|
126
|
+
CardFieldsMessageEnum["SUBMIT"] = "card-fields:submit";
|
|
127
|
+
/** Page → checkout: the card is with the provider; the checkout waits for the status checks. */
|
|
128
|
+
CardFieldsMessageEnum["DONE"] = "card-fields:done";
|
|
129
|
+
/** Page → checkout: Pay was refused (`reason`), or could not reach us (none). */
|
|
130
|
+
CardFieldsMessageEnum["REFUSED"] = "card-fields:refused";
|
|
131
|
+
/** Page → checkout: the payer shut their bank's check; that attempt is closed, the card stays for another Pay. */
|
|
132
|
+
CardFieldsMessageEnum["CLOSED"] = "card-fields:closed";
|
|
133
|
+
/** Page → checkout: a bank's 3D Secure page shows in it (`showing`), or went. */
|
|
134
|
+
CardFieldsMessageEnum["BANK_PAGE"] = "card-fields:bank-page";
|
|
135
|
+
})(CardFieldsMessageEnum || (CardFieldsMessageEnum = {}));
|
|
136
|
+
/**
|
|
137
|
+
* What PayPal's return page and the checkout that opened the bank's window
|
|
138
|
+
* say to each other (ADR 0014), by `postMessage` to the opener and on the
|
|
139
|
+
* reference's broadcast channel, which still reaches a window the bank
|
|
140
|
+
* page's opener policy cut off.
|
|
141
|
+
*/
|
|
142
|
+
export var BankWindowMessageEnum;
|
|
143
|
+
(function (BankWindowMessageEnum) {
|
|
144
|
+
/** Back on our return page, which tells the gateway itself. */
|
|
145
|
+
BankWindowMessageEnum["RETURNED"] = "bank-window:returned";
|
|
146
|
+
/** The checkout heard it: the return page may shut itself. */
|
|
147
|
+
BankWindowMessageEnum["HEARD"] = "bank-window:heard";
|
|
148
|
+
})(BankWindowMessageEnum || (BankWindowMessageEnum = {}));
|
|
149
|
+
export var CardFieldEnum;
|
|
150
|
+
(function (CardFieldEnum) {
|
|
151
|
+
CardFieldEnum["NUMBER"] = "number";
|
|
152
|
+
CardFieldEnum["EXPIRY"] = "expiry";
|
|
153
|
+
CardFieldEnum["CVC"] = "cvc";
|
|
154
|
+
})(CardFieldEnum || (CardFieldEnum = {}));
|
|
155
|
+
/** What a tester makes the Simulator answer. Values are the backend's. */
|
|
156
|
+
export var SimulatorOutcomeEnum;
|
|
157
|
+
(function (SimulatorOutcomeEnum) {
|
|
158
|
+
SimulatorOutcomeEnum["APPROVED"] = "approved";
|
|
159
|
+
SimulatorOutcomeEnum["DECLINED"] = "declined";
|
|
160
|
+
SimulatorOutcomeEnum["INSUFFICIENT_FUNDS"] = "insufficient_funds";
|
|
161
|
+
SimulatorOutcomeEnum["NO_ACCOUNT"] = "no_account";
|
|
162
|
+
SimulatorOutcomeEnum["WRONG_PIN"] = "wrong_pin";
|
|
163
|
+
SimulatorOutcomeEnum["WRONG_CODE"] = "wrong_code";
|
|
164
|
+
SimulatorOutcomeEnum["PROVIDER_ERROR"] = "provider_error";
|
|
165
|
+
SimulatorOutcomeEnum["WRONG_AMOUNT"] = "wrong_amount";
|
|
166
|
+
SimulatorOutcomeEnum["APPROVED_LATE"] = "approved_late";
|
|
167
|
+
SimulatorOutcomeEnum["REVERSED"] = "reversed";
|
|
168
|
+
/** A success on every send: a duplicate. Offered once there are several. */
|
|
169
|
+
SimulatorOutcomeEnum["APPROVED_ALL"] = "approved_all";
|
|
170
|
+
})(SimulatorOutcomeEnum || (SimulatorOutcomeEnum = {}));
|
|
171
|
+
export var PhoneErrorEnum;
|
|
172
|
+
(function (PhoneErrorEnum) {
|
|
173
|
+
PhoneErrorEnum["START"] = "start";
|
|
174
|
+
PhoneErrorEnum["SHORT"] = "short";
|
|
175
|
+
PhoneErrorEnum["INVALID"] = "invalid";
|
|
176
|
+
PhoneErrorEnum["EMPTY"] = "empty";
|
|
177
|
+
PhoneErrorEnum["OPERATOR"] = "operator";
|
|
178
|
+
/** An international number of a country the payment is not offered in. */
|
|
179
|
+
PhoneErrorEnum["COUNTRY"] = "country";
|
|
180
|
+
})(PhoneErrorEnum || (PhoneErrorEnum = {}));
|
|
181
|
+
/** The store a phone buys from, as the gateway names it. */
|
|
182
|
+
export var PhoneStoreEnum;
|
|
183
|
+
(function (PhoneStoreEnum) {
|
|
184
|
+
PhoneStoreEnum["APP_STORE"] = "appStore";
|
|
185
|
+
PhoneStoreEnum["GOOGLE_PLAY"] = "googlePlay";
|
|
186
|
+
})(PhoneStoreEnum || (PhoneStoreEnum = {}));
|
|
187
|
+
/** How a store's sheet ended without a purchase. Values are the backend's. */
|
|
188
|
+
export var StoreSheetOutcomeEnum;
|
|
189
|
+
(function (StoreSheetOutcomeEnum) {
|
|
190
|
+
/** The payer closed it: nothing was charged, and it never counts toward the lock. */
|
|
191
|
+
StoreSheetOutcomeEnum["CANCELLED"] = "cancelled";
|
|
192
|
+
/** The store could not take the payment. */
|
|
193
|
+
StoreSheetOutcomeEnum["ERROR"] = "error";
|
|
194
|
+
/** Someone must approve it first (Ask to Buy, cash at a shop): the attempt waits. */
|
|
195
|
+
StoreSheetOutcomeEnum["PENDING"] = "pending";
|
|
196
|
+
})(StoreSheetOutcomeEnum || (StoreSheetOutcomeEnum = {}));
|
|
197
|
+
export var SupportChannelEnum;
|
|
198
|
+
(function (SupportChannelEnum) {
|
|
199
|
+
SupportChannelEnum["WHATSAPP"] = "whatsapp";
|
|
200
|
+
SupportChannelEnum["EMAIL"] = "email";
|
|
201
|
+
})(SupportChannelEnum || (SupportChannelEnum = {}));
|
|
202
|
+
/** Values are the keys of `faqs` in the checkout catalog. */
|
|
203
|
+
export var FaqEnum;
|
|
204
|
+
(function (FaqEnum) {
|
|
205
|
+
FaqEnum["NOT_RECEIVED"] = "not_received";
|
|
206
|
+
FaqEnum["DEBITED"] = "debited";
|
|
207
|
+
})(FaqEnum || (FaqEnum = {}));
|
|
208
|
+
/** Screens the payer cannot act on, each with its copy. Values are catalog keys. */
|
|
209
|
+
export var TerminalKindEnum;
|
|
210
|
+
(function (TerminalKindEnum) {
|
|
211
|
+
TerminalKindEnum["EXPIRED"] = "expired";
|
|
212
|
+
TerminalKindEnum["CANCELLED"] = "cancelled";
|
|
213
|
+
TerminalKindEnum["LOCKED"] = "locked";
|
|
214
|
+
TerminalKindEnum["INVALID"] = "invalid";
|
|
215
|
+
TerminalKindEnum["NO_METHOD"] = "no_method";
|
|
216
|
+
})(TerminalKindEnum || (TerminalKindEnum = {}));
|
|
217
|
+
export var CheckoutButtonVariantEnum;
|
|
218
|
+
(function (CheckoutButtonVariantEnum) {
|
|
219
|
+
CheckoutButtonVariantEnum["PRIMARY"] = "primary";
|
|
220
|
+
CheckoutButtonVariantEnum["SECONDARY"] = "secondary";
|
|
221
|
+
/** The second choice under Pay or Try again: the secondary's look, no border. */
|
|
222
|
+
CheckoutButtonVariantEnum["PLAIN"] = "plain";
|
|
223
|
+
/** Gives something up: cancelling the payment. */
|
|
224
|
+
CheckoutButtonVariantEnum["DANGER"] = "danger";
|
|
225
|
+
/** PayPal's own gold button, the same in both themes (ADR 0010). */
|
|
226
|
+
CheckoutButtonVariantEnum["PAYPAL"] = "paypal";
|
|
227
|
+
/** A quiet action in a line of its own, in the brand colour ("Paying from another country?"), on the web and in the sheet. */
|
|
228
|
+
CheckoutButtonVariantEnum["LINK"] = "link";
|
|
229
|
+
})(CheckoutButtonVariantEnum || (CheckoutButtonVariantEnum = {}));
|
|
230
|
+
/** Values are the `theme` an app may send. */
|
|
231
|
+
export var CheckoutThemeEnum;
|
|
232
|
+
(function (CheckoutThemeEnum) {
|
|
233
|
+
CheckoutThemeEnum["LIGHT"] = "light";
|
|
234
|
+
CheckoutThemeEnum["DARK"] = "dark";
|
|
235
|
+
})(CheckoutThemeEnum || (CheckoutThemeEnum = {}));
|
|
236
|
+
/** What a toast says: done, a problem, or just good to know. Sets its icon. */
|
|
237
|
+
export var CheckoutToastToneEnum;
|
|
238
|
+
(function (CheckoutToastToneEnum) {
|
|
239
|
+
CheckoutToastToneEnum["SUCCESS"] = "success";
|
|
240
|
+
CheckoutToastToneEnum["WARNING"] = "warning";
|
|
241
|
+
CheckoutToastToneEnum["INFO"] = "info";
|
|
242
|
+
})(CheckoutToastToneEnum || (CheckoutToastToneEnum = {}));
|
|
243
|
+
/** How a provider's window ended (PayPal's, the bank's): the payer approved, or left it without approving. */
|
|
244
|
+
export var ProviderWindowEndEnum;
|
|
245
|
+
(function (ProviderWindowEndEnum) {
|
|
246
|
+
ProviderWindowEndEnum["APPROVED"] = "approved";
|
|
247
|
+
ProviderWindowEndEnum["CLOSED"] = "closed";
|
|
248
|
+
/** Back on our return page, which told the gateway itself (a bank redirect on the web). */
|
|
249
|
+
ProviderWindowEndEnum["RETURNED"] = "returned";
|
|
250
|
+
/**
|
|
251
|
+
* The bank's window reads shut with no word from our return page: shut,
|
|
252
|
+
* or cut off by the bank page's opener policy while the payer still pays
|
|
253
|
+
* there. Not proof of a cancel: the payer says so (ADR 0014).
|
|
254
|
+
*/
|
|
255
|
+
ProviderWindowEndEnum["LOST"] = "lost";
|
|
256
|
+
})(ProviderWindowEndEnum || (ProviderWindowEndEnum = {}));
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A `fetch` that gives up after `timeoutMs`, so a half-open socket cannot
|
|
3
|
+
* hold a call for ever; the abort rejects like any failed call. The web
|
|
4
|
+
* checkout and the payment sheet both call the gateway through it.
|
|
5
|
+
*/
|
|
6
|
+
export declare function fetchWithTimeout(timeoutMs: number, call?: typeof fetch): typeof fetch;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A `fetch` that gives up after `timeoutMs`, so a half-open socket cannot
|
|
3
|
+
* hold a call for ever; the abort rejects like any failed call. The web
|
|
4
|
+
* checkout and the payment sheet both call the gateway through it.
|
|
5
|
+
*/
|
|
6
|
+
export function fetchWithTimeout(timeoutMs, call = (input, init) => fetch(input, init)) {
|
|
7
|
+
return (input, init) => call(input, { ...init, signal: timeoutSignal(timeoutMs) });
|
|
8
|
+
}
|
|
9
|
+
/** `AbortSignal.timeout`, or the same by hand where it is missing (some React Native versions, older browsers). */
|
|
10
|
+
function timeoutSignal(timeoutMs) {
|
|
11
|
+
if (typeof AbortSignal.timeout === 'function') {
|
|
12
|
+
return AbortSignal.timeout(timeoutMs);
|
|
13
|
+
}
|
|
14
|
+
const controller = new AbortController();
|
|
15
|
+
setTimeout(() => {
|
|
16
|
+
// No DOMException in React Native: the name is what callers read.
|
|
17
|
+
const reason = new Error('Timed out');
|
|
18
|
+
reason.name = 'TimeoutError';
|
|
19
|
+
controller.abort(reason);
|
|
20
|
+
}, timeoutMs);
|
|
21
|
+
return controller.signal;
|
|
22
|
+
}
|