ordering-ui-react-native 0.17.18-release → 0.17.19-release

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-react-native",
3
- "version": "0.17.18-release",
3
+ "version": "0.17.19-release",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -25,9 +25,9 @@ export const StripeMethodForm = (props: StripeMethodFormParams) => {
25
25
  const [{ configs }] = useConfig()
26
26
  const applePay = ['global_apple_pay', 'apple_pay']
27
27
  const googlePay = ['global_google_pay', 'google_pay']
28
+
28
29
  useEffect(() => {
29
30
  if (Platform.OS === 'ios') {
30
- setErrors(t('GOOGLE_PAY_NOT_SUPPORTED', 'Google pay not supported'))
31
31
  setMethodPaySupported({
32
32
  enabled: false,
33
33
  loading: false
@@ -78,7 +78,7 @@ export const StripeMethodForm = (props: StripeMethodFormParams) => {
78
78
  setPlaceByMethodPay(false)
79
79
  }
80
80
  }
81
- if (googlePay.includes(paymethod)) {
81
+ if (googlePay.includes(paymethod) && !methodPaySupported?.enabled) {
82
82
  initialize();
83
83
  }
84
84
  }, [initGooglePay, paymethod]);
@@ -87,9 +87,8 @@ export const StripeMethodForm = (props: StripeMethodFormParams) => {
87
87
  if (applePay.includes(paymethod) && !paymethod) return
88
88
  if (Platform.OS === 'android') {
89
89
  setPlaceByMethodPay(false)
90
- setErrors(t('APPLE_PAY_NOT_SUPPORTED', 'Apple pay not supported'))
91
90
  setMethodPaySupported({
92
- enabled: false,
91
+ ...methodPaySupported,
93
92
  loading: false
94
93
  })
95
94
  return
@@ -111,7 +110,6 @@ export const StripeMethodForm = (props: StripeMethodFormParams) => {
111
110
  enabled: true,
112
111
  loading: false
113
112
  })
114
- return;
115
113
  } else if (paymentMethod) {
116
114
  setMethodPaySupported({
117
115
  enabled: true,
@@ -255,10 +255,18 @@ const LoginFormUI = (props: LoginParams) => {
255
255
  setOtpType(type)
256
256
  }
257
257
 
258
- const handleLoginOtp = (code: string) => {
258
+ const handleLoginOtp = async (code: string) => {
259
259
  if (!code) return
260
- handleButtonLoginClick({ code })
261
- setWillVerifyOtpState(false)
260
+ const logged = await handleButtonLoginClick({ code })
261
+ if (logged){
262
+ setWillVerifyOtpState(false)
263
+ } else {
264
+ setAlertState({
265
+ open: true,
266
+ title: '',
267
+ content: t('OTP_CODE_INCORRECT', 'Otp code incorrect')
268
+ })
269
+ }
262
270
  }
263
271
 
264
272
  const closeAlert = () => {
@@ -13,6 +13,7 @@ import { getIconCard, flatArray } from '../../utils'
13
13
  import { StripeElementsForm } from '../StripeElementsForm'
14
14
  import { StripeCardsList } from '../StripeCardsList'
15
15
  import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
16
+ import { useApplePay } from '@stripe/stripe-react-native';
16
17
 
17
18
  import {
18
19
  PMContainer,
@@ -44,6 +45,7 @@ const MultiCartsPaymethodsAndWalletsUI = (props: any) => {
44
45
  const [, t] = useLanguage()
45
46
  const [{ configs }] = useConfig()
46
47
  const [{ parsePrice }] = useUtils()
48
+ const { confirmApplePayPayment } = useApplePay()
47
49
 
48
50
  const [addCardOpen, setAddCardOpen] = useState({ stripe: false, stripeConnect: false });
49
51
 
@@ -92,7 +94,7 @@ const MultiCartsPaymethodsAndWalletsUI = (props: any) => {
92
94
  if (methodsPay.includes(paymethodSelected?.gateway)) {
93
95
  if (typeof paymethodSelected?.paymethod_data === 'string'){
94
96
  const sourceId = JSON.parse(paymethodSelected?.paymethod_data)?.source_id
95
- sourceId && handlePlaceOrder()
97
+ sourceId && handlePlaceOrder(confirmApplePayPayment)
96
98
  }
97
99
  }
98
100
  }, [JSON.stringify(paymethodSelected)])
@@ -100,7 +102,7 @@ const MultiCartsPaymethodsAndWalletsUI = (props: any) => {
100
102
  const renderPaymethods = ({ item }: any) => {
101
103
  return (
102
104
  <>
103
- {item?.gateway === 'apple_pay' ? (
105
+ {item?.gateway === 'global_apple_pay' ? (
104
106
  <TouchableOpacity
105
107
  onPress={() => handleSelectPaymethod({ ...item, paymethod: { gateway: item.gateway }, paymethod_id: item?.id })}
106
108
  >
@@ -123,7 +125,7 @@ const MultiCartsPaymethodsAndWalletsUI = (props: any) => {
123
125
  src={getPayIcon(item?.gateway ?? item.paymethod?.gateway)}
124
126
  width={20}
125
127
  height={20}
126
- color={item?.gateway === 'apple_pay' ? '' : paymethodSelected?.id === item.id ? theme.colors.white : theme.colors.backgroundDark}
128
+ color={item?.gateway === 'global_apple_pay' ? '' : paymethodSelected?.id === item.id ? theme.colors.white : theme.colors.backgroundDark}
127
129
  />
128
130
  <OText
129
131
  size={10}
@@ -166,9 +166,9 @@ const MultiCheckoutUI = (props: any) => {
166
166
  setPhoneUpdate(val)
167
167
  }
168
168
 
169
- const handlePlaceOrder = () => {
169
+ const handlePlaceOrder = (confirmPayment ?: any) => {
170
170
  if (!userErrors.length) {
171
- handleGroupPlaceOrder && handleGroupPlaceOrder()
171
+ handleGroupPlaceOrder && handleGroupPlaceOrder(confirmPayment)
172
172
  return
173
173
  }
174
174
  let stringError = ''