@brissoto/pay-react-native 1.6.3 → 1.6.4
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.
|
@@ -284,7 +284,7 @@ export interface CheckoutDerived {
|
|
|
284
284
|
mismatch: CheckoutMethod | null;
|
|
285
285
|
/** After a failure: another method of the same country the payer can use now. */
|
|
286
286
|
suggestion: CheckoutMethod | null;
|
|
287
|
-
/** What the payer pays: the picked method's price, else the last attempt's, else the payment's amount (ADR 0012). */
|
|
287
|
+
/** What the payer pays: the picked method's price, else the open tab's while choosing, else the last attempt's, else the payment's amount (ADR 0012). */
|
|
288
288
|
total: Price;
|
|
289
289
|
}
|
|
290
290
|
export interface CheckoutCoreActions {
|
|
@@ -157,7 +157,11 @@ export function deriveCheckout(view, ui, phone) {
|
|
|
157
157
|
? []
|
|
158
158
|
: view.methods.filter((method) => FLOW_TRAITS[method.flow].countryScheme && !home(method));
|
|
159
159
|
const onCard = ui.tab === CheckoutTabEnum.CARD;
|
|
160
|
-
const
|
|
160
|
+
const shown = onCard ? [...cards, ...otherBanks] : wallets;
|
|
161
|
+
const picked = shown.find((method) => method.id === ui.method);
|
|
162
|
+
// Nothing picked yet: the open tab's price (EUR on cards, XAF on Cameroon's wallets).
|
|
163
|
+
const tabPrice = (shown.find((method) => method.state === MethodStateEnum.AVAILABLE) ??
|
|
164
|
+
shown.at(0))?.price;
|
|
161
165
|
const selected = picked?.state === MethodStateEnum.AVAILABLE ? picked : null;
|
|
162
166
|
const missing = selected
|
|
163
167
|
? missingBeforePay(selected, payInputOf(ui, phone))
|
|
@@ -172,7 +176,7 @@ export function deriveCheckout(view, ui, phone) {
|
|
|
172
176
|
method.country === failed?.country &&
|
|
173
177
|
method.id !== failed.id) ?? null;
|
|
174
178
|
const screen = screenOf(view, ui);
|
|
175
|
-
// On the methods, nothing picked: the
|
|
179
|
+
// On the methods, nothing picked: the open tab's price, never a past attempt's.
|
|
176
180
|
const choosing = screen === CheckoutScreenEnum.FORM ||
|
|
177
181
|
screen === CheckoutScreenEnum.SUBMITTING;
|
|
178
182
|
return {
|
|
@@ -190,7 +194,7 @@ export function deriveCheckout(view, ui, phone) {
|
|
|
190
194
|
canPay: !!selected && missing.length === 0 && !ui.submitting && !ui.cardPaying,
|
|
191
195
|
detected,
|
|
192
196
|
total: selected?.price ??
|
|
193
|
-
(choosing ?
|
|
197
|
+
(choosing ? tabPrice : view.attempt?.price) ?? {
|
|
194
198
|
amount: view.amount,
|
|
195
199
|
currency: view.currency,
|
|
196
200
|
},
|