ordering-ui-react-native 0.16.22 → 0.16.23
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/package.json
CHANGED
|
@@ -171,9 +171,9 @@ const CheckoutUI = (props: any) => {
|
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
-
const handlePlaceOrder = () => {
|
|
174
|
+
const handlePlaceOrder = (confirmPayment) => {
|
|
175
175
|
if (!userErrors.length) {
|
|
176
|
-
handlerClickPlaceOrder && handlerClickPlaceOrder()
|
|
176
|
+
handlerClickPlaceOrder && handlerClickPlaceOrder(null, null, confirmPayment)
|
|
177
177
|
return
|
|
178
178
|
}
|
|
179
179
|
let stringError = ''
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
import {
|
|
10
10
|
PaymentOptions as PaymentOptionsController,
|
|
11
11
|
useLanguage,
|
|
12
|
-
|
|
12
|
+
ToastType,
|
|
13
13
|
useToast,
|
|
14
14
|
} from 'ordering-components/native';
|
|
15
15
|
import { useTheme } from 'styled-components/native';
|
|
@@ -30,6 +30,7 @@ import {
|
|
|
30
30
|
PMCardItemContent
|
|
31
31
|
} from './styles'
|
|
32
32
|
import { getIconCard, flatArray } from '../../utils';
|
|
33
|
+
import { useApplePay } from '@stripe/stripe-react-native';
|
|
33
34
|
|
|
34
35
|
const stripeOptions: any = ['stripe_direct', 'stripe', 'stripe_connect']
|
|
35
36
|
const methodsPay = ['google_pay', 'apple_pay']
|
|
@@ -62,7 +63,8 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
62
63
|
} = props
|
|
63
64
|
|
|
64
65
|
const theme = useTheme();
|
|
65
|
-
|
|
66
|
+
const [, { showToast }] = useToast();
|
|
67
|
+
const { confirmApplePayPayment } = useApplePay()
|
|
66
68
|
|
|
67
69
|
const getPayIcon = (method: string) => {
|
|
68
70
|
switch (method) {
|
|
@@ -98,18 +100,18 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
98
100
|
// ]
|
|
99
101
|
|
|
100
102
|
const handlePaymentMethodClick = (paymethod: any) => {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
103
|
+
if (cart?.balance > 0) {
|
|
104
|
+
const isPopupMethod = ['stripe', 'stripe_direct', 'stripe_connect', 'stripe_redirect', 'paypal'].includes(paymethod?.gateway)
|
|
105
|
+
if (webViewPaymentGateway.includes(paymethod?.gateway)) {
|
|
106
|
+
handlePaymentMethodClickCustom(paymethod)
|
|
107
|
+
}
|
|
108
|
+
handlePaymethodClick(paymethod, isPopupMethod)
|
|
109
|
+
return
|
|
110
|
+
}
|
|
111
|
+
showToast(
|
|
110
112
|
ToastType.Error,
|
|
111
113
|
t('CART_BALANCE_ZERO', 'Sorry, the amount to pay is equal to zero and it is not necessary to select a payment method'))
|
|
112
|
-
|
|
114
|
+
;
|
|
113
115
|
}
|
|
114
116
|
|
|
115
117
|
useEffect(() => {
|
|
@@ -134,7 +136,7 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
134
136
|
|
|
135
137
|
useEffect(() => {
|
|
136
138
|
if (methodsPay.includes(paymethodSelected?.gateway) && paymethodData?.id && paymethodSelected?.data?.card) {
|
|
137
|
-
|
|
139
|
+
handlePlaceOrder(confirmApplePayPayment)
|
|
138
140
|
}
|
|
139
141
|
}, [paymethodData, paymethodSelected])
|
|
140
142
|
|