ordering-ui-react-native 0.22.75 → 0.22.76-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.
Files changed (137) hide show
  1. package/package.json +5 -7
  2. package/src/components/BusinessesListing/index.tsx +1 -1
  3. package/src/components/Checkout/index.tsx +40 -39
  4. package/src/components/VerifyPhone/styles.tsx +1 -2
  5. package/src/context/OfflineActions/index.tsx +236 -0
  6. package/src/providers/AlertProvider.tsx +3 -1
  7. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +5 -3
  8. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +1 -0
  9. package/themes/business/src/components/BusinessController/index.tsx +8 -3
  10. package/themes/business/src/components/BusinessProductList/index.tsx +3 -2
  11. package/themes/business/src/components/Chat/index.tsx +15 -3
  12. package/themes/business/src/components/DriverMap/index.tsx +44 -33
  13. package/themes/business/src/components/FloatingButton/index.tsx +3 -2
  14. package/themes/business/src/components/LanguageSelector/index.tsx +1 -1
  15. package/themes/business/src/components/LoginForm/index.tsx +123 -98
  16. package/themes/business/src/components/LogoutButton/index.tsx +13 -4
  17. package/themes/business/src/components/MapView/RenderMarker.tsx +146 -0
  18. package/themes/business/src/components/MapView/index.tsx +68 -142
  19. package/themes/business/src/components/NewOrderNotification/index.tsx +38 -54
  20. package/themes/business/src/components/OrderDetails/Business.tsx +56 -20
  21. package/themes/business/src/components/OrderDetails/Delivery.tsx +111 -42
  22. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +146 -36
  23. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +51 -28
  24. package/themes/business/src/components/OrderDetails/styles.tsx +39 -3
  25. package/themes/business/src/components/OrderDetails/usePrinterCommands.tsx +17 -16
  26. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +3 -2
  27. package/themes/business/src/components/OrderSummary/index.tsx +271 -176
  28. package/themes/business/src/components/OrdersListManager/index.tsx +13 -1
  29. package/themes/business/src/components/OrdersOption/index.tsx +207 -144
  30. package/themes/business/src/components/OrdersOption/styles.tsx +14 -0
  31. package/themes/business/src/components/PreviousMessages/index.tsx +26 -3
  32. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +20 -8
  33. package/themes/business/src/components/PreviousOrders/index.tsx +74 -66
  34. package/themes/business/src/components/PreviousOrders/styles.tsx +2 -1
  35. package/themes/business/src/components/PrinterEdition/MessageAlert.tsx +33 -0
  36. package/themes/business/src/components/PrinterEdition/index.tsx +143 -75
  37. package/themes/business/src/components/PrinterEdition/printerList.tsx +23 -0
  38. package/themes/business/src/components/PrinterSettings/index.tsx +1 -1
  39. package/themes/business/src/components/ProductItemAccordion/index.tsx +15 -16
  40. package/themes/business/src/components/ReviewCustomer/index.tsx +2 -0
  41. package/themes/business/src/components/StoresList/index.tsx +2 -2
  42. package/themes/business/src/components/UserProfileForm/index.tsx +48 -10
  43. package/themes/business/src/components/UserProfileForm/styles.tsx +7 -0
  44. package/themes/business/src/components/WebsocketStatus/index.tsx +2 -2
  45. package/themes/business/src/config/currency.tsx +1010 -0
  46. package/themes/business/src/hooks/useLocation.tsx +16 -12
  47. package/themes/business/src/layouts/SafeAreaContainer.tsx +35 -19
  48. package/themes/business/src/types/index.tsx +26 -4
  49. package/themes/business/src/utils/index.tsx +26 -2
  50. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  51. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  52. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  53. package/themes/kiosk/src/components/Checkout/index.tsx +9 -5
  54. package/themes/kiosk/src/components/CustomerName/index.tsx +1 -1
  55. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  56. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  57. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  58. package/themes/kiosk/src/components/PaymentOptions/index.tsx +121 -57
  59. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  60. package/themes/original/index.tsx +223 -219
  61. package/themes/original/src/components/AddressForm/index.tsx +56 -17
  62. package/themes/original/src/components/AppleLogin/index.tsx +3 -4
  63. package/themes/original/src/components/BusinessController/index.tsx +4 -2
  64. package/themes/original/src/components/BusinessItemAccordion/index.tsx +8 -3
  65. package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +102 -90
  66. package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +7 -3
  67. package/themes/original/src/components/BusinessListingSearch/index.tsx +8 -13
  68. package/themes/original/src/components/BusinessPreorder/index.tsx +30 -17
  69. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +72 -69
  70. package/themes/original/src/components/BusinessProductsList/index.tsx +4 -5
  71. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  72. package/themes/original/src/components/BusinessProductsListing/index.tsx +5 -4
  73. package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +1 -0
  74. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +2 -1
  75. package/themes/original/src/components/Cart/index.tsx +43 -12
  76. package/themes/original/src/components/Checkout/index.tsx +126 -98
  77. package/themes/original/src/components/FloatingButton/index.tsx +1 -1
  78. package/themes/original/src/components/GPSButton/index.tsx +2 -1
  79. package/themes/original/src/components/GoogleMap/index.tsx +3 -2
  80. package/themes/original/src/components/Help/functions.tsx +76 -0
  81. package/themes/original/src/components/Help/index.tsx +74 -29
  82. package/themes/original/src/components/Help/styles.tsx +4 -1
  83. package/themes/original/src/components/HelpOptions/index.tsx +53 -0
  84. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +1 -1
  85. package/themes/original/src/components/Home/index.tsx +36 -11
  86. package/themes/original/src/components/LastOrder/index.tsx +1 -1
  87. package/themes/original/src/components/LoginForm/index.tsx +11 -5
  88. package/themes/original/src/components/MessageListing/index.tsx +1 -1
  89. package/themes/original/src/components/Messages/index.tsx +562 -555
  90. package/themes/original/src/components/MomentOption/TimeListItem.tsx +56 -0
  91. package/themes/original/src/components/MomentOption/index.tsx +141 -61
  92. package/themes/original/src/components/MomentOption/styles.tsx +1 -1
  93. package/themes/original/src/components/MomentSelector/index.tsx +5 -2
  94. package/themes/original/src/components/MultiCheckout/index.tsx +78 -33
  95. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +2 -2
  96. package/themes/original/src/components/MultiOrdersDetails/index.tsx +2 -2
  97. package/themes/original/src/components/NavBar/index.tsx +6 -2
  98. package/themes/original/src/components/NotFoundSource/index.tsx +40 -39
  99. package/themes/original/src/components/NotFoundSource/styles.tsx +18 -9
  100. package/themes/original/src/components/OrderDetails/OrderEta.tsx +4 -3
  101. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +11 -4
  102. package/themes/original/src/components/OrderDetails/index.tsx +44 -20
  103. package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
  104. package/themes/original/src/components/OrderProgress/index.tsx +5 -4
  105. package/themes/original/src/components/OrderSummary/index.tsx +32 -11
  106. package/themes/original/src/components/OrderTypeSelector/index.tsx +120 -120
  107. package/themes/original/src/components/OrdersOption/index.tsx +325 -325
  108. package/themes/original/src/components/PaymentOptionWallet/index.tsx +1 -0
  109. package/themes/original/src/components/PaymentOptions/index.tsx +471 -459
  110. package/themes/original/src/components/PhoneInputNumber/index.tsx +92 -7
  111. package/themes/original/src/components/ProductItemAccordion/index.tsx +28 -37
  112. package/themes/original/src/components/ProductOptionSubOption/index.tsx +15 -14
  113. package/themes/original/src/components/ServiceForm/index.tsx +2 -2
  114. package/themes/original/src/components/SignupForm/index.tsx +40 -24
  115. package/themes/original/src/components/SingleOrderCard/index.tsx +8 -5
  116. package/themes/original/src/components/SingleProductCard/index.tsx +2 -1
  117. package/themes/original/src/components/SingleProductCard/styles.tsx +0 -3
  118. package/themes/original/src/components/StripeCardsList/index.tsx +7 -1
  119. package/themes/original/src/components/StripeElementsForm/index.tsx +2 -2
  120. package/themes/original/src/components/TaxInformation/index.tsx +3 -2
  121. package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +7 -2
  122. package/themes/original/src/components/UserDetails/index.tsx +17 -16
  123. package/themes/original/src/components/UserFormDetails/index.tsx +109 -67
  124. package/themes/original/src/components/UserVerification/index.tsx +18 -5
  125. package/themes/original/src/components/VerifyPhone/index.tsx +1 -1
  126. package/themes/original/src/components/shared/OInput.tsx +97 -97
  127. package/themes/original/src/components/shared/OModal.tsx +7 -2
  128. package/themes/original/src/providers/AlertProvider.tsx +1 -1
  129. package/themes/original/src/types/index.tsx +700 -695
  130. package/themes/original/src/utils/index.tsx +50 -34
  131. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
  132. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +0 -62
  133. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +0 -12
  134. package/themes/original/src/components/HelpGuide/index.tsx +0 -68
  135. package/themes/original/src/components/HelpGuide/styles.tsx +0 -12
  136. package/themes/original/src/components/HelpOrder/index.tsx +0 -71
  137. package/themes/original/src/components/HelpOrder/styles.tsx +0 -13
@@ -1,17 +1,17 @@
1
1
  import React, { useEffect, useState } from 'react';
2
2
  import { FlatList, TouchableOpacity, View, StyleSheet, KeyboardAvoidingView, Platform } from 'react-native';
3
3
  import {
4
- Placeholder,
5
- PlaceholderLine,
6
- Fade
4
+ Placeholder,
5
+ PlaceholderLine,
6
+ Fade
7
7
  } from "rn-placeholder";
8
8
 
9
9
  import {
10
- PaymentOptions as PaymentOptionsController,
11
- useLanguage,
12
- ToastType,
13
- useToast,
14
- useSession
10
+ PaymentOptions as PaymentOptionsController,
11
+ useLanguage,
12
+ ToastType,
13
+ useToast,
14
+ useSession
15
15
  } from 'ordering-components/native';
16
16
  import { useTheme } from 'styled-components/native';
17
17
  import { PaymentOptionCash } from '../PaymentOptionCash';
@@ -27,10 +27,10 @@ import { PaymentOptionCard } from '../PaymentOptionCard'
27
27
  import { OText, OIcon, OModal, OButton } from '../shared';
28
28
 
29
29
  import {
30
- PMContainer,
31
- PMItem,
32
- PMCardSelected,
33
- PMCardItemContent
30
+ PMContainer,
31
+ PMItem,
32
+ PMCardSelected,
33
+ PMCardItemContent
34
34
  } from './styles'
35
35
  import { getIconCard, flatArray } from '../../utils';
36
36
  import { useApplePay } from '@stripe/stripe-react-native';
@@ -48,248 +48,258 @@ const stripeDirectMethods = ['stripe_direct']
48
48
  const webViewPaymentGateway: any = ['paypal', 'square']
49
49
  const multiCheckoutMethods = ['global_google_pay', 'global_apple_pay']
50
50
  const cardsPaymethods = ['credomatic']
51
+ const guestNotSupportedMethods = ['stripe', 'stripe_connect', 'stripe_redirect']
52
+ const popupMethods = [...guestNotSupportedMethods, 'stripe_direct', 'paypal']
51
53
 
52
54
  const PaymentOptionsUI = (props: any) => {
53
- const {
54
- cart,
55
- errorCash,
56
- isLoading,
57
- isDisabled,
58
- paymethodData,
59
- paymethodsList,
60
- setPaymethodData,
61
- onNavigationRedirect,
62
- handlePaymethodClick,
63
- handlePaymethodDataChange,
64
- isOpenMethod,
65
- handlePaymentMethodClickCustom,
66
- handlePlaceOrder,
67
- merchantId,
68
- urlscheme,
69
- setMethodPaySupported,
70
- placeByMethodPay,
71
- methodPaySupported,
72
- setPlaceByMethodPay,
73
- setCardList,
74
- onPaymentChange,
75
- requiredFields,
76
- openUserModal,
77
- paymethodClicked,
78
- setPaymethodClicked,
79
- androidAppId
80
- } = props
81
-
82
- const theme = useTheme();
83
- const [, { showToast }] = useToast();
84
- const [{ user }] = useSession()
85
- const { confirmApplePayPayment } = useApplePay()
86
-
87
- const getPayIcon = (method: string) => {
88
- switch (method) {
89
- case 'cash':
90
- return theme.images.general.cash
91
- case 'card_delivery':
92
- return theme.images.general.carddelivery
93
- case 'paypal':
94
- return theme.images.general.paypal
95
- case 'stripe':
96
- return theme.images.general.creditCard
97
- case 'stripe_direct':
98
- return theme.images.general.stripecc
99
- case 'stripe_connect':
100
- return theme.images.general.stripes
101
- case 'stripe_redirect':
102
- return theme.images.general.stripesb
103
- case 'apple_pay':
104
- return theme.images.general.applePayMark
105
- case 'google_pay':
106
- return theme.images.general.googlePayMark
107
- default:
108
- return theme.images.general.creditCard
109
- }
110
- }
111
-
112
- const [, t] = useLanguage();
113
-
114
- const [addCardOpen, setAddCardOpen] = useState({ stripe: false, stripeConnect: false, card: false });
115
- const paymethodSelected = props.paySelected || props.paymethodSelected || isOpenMethod?.paymethod
116
- // const [{ token }] = useSession()
117
-
118
- // const [card, setCard] = useState(null);
119
-
120
- // const stripeRedirectValues = [
121
- // { name: t('SELECT_A_PAYMENT_METHOD', 'Select a payment method'), value: '-1' },
122
- // ]
123
-
124
- const paymethodsFieldRequired = ['paypal', 'apple_pay', 'global_apple_pay']
125
-
126
- const handlePaymentMethodClick = (paymethod: any) => {
127
- if (cart?.balance > 0 || !!user?.guest_id) {
128
- if (paymethodsFieldRequired.includes(paymethod?.gateway) && requiredFields.length > 0) {
129
- openUserModal && openUserModal(true)
130
- setPaymethodClicked({
131
- confirmed: false,
132
- paymethod
133
- })
134
- return
135
- }
136
- const isPopupMethod = ['stripe', 'stripe_direct', 'stripe_connect', 'stripe_redirect', 'paypal'].includes(paymethod?.gateway)
137
- if (webViewPaymentGateway.includes(paymethod?.gateway)) {
138
- handlePaymentMethodClickCustom(paymethod)
139
- }
140
- handlePaymethodClick(paymethod, isPopupMethod)
141
- return
142
- }
143
- showToast(
144
- ToastType.Error,
145
- t('CART_BALANCE_ZERO', 'Sorry, the amount to pay is equal to zero and it is not necessary to select a payment method'))
146
- ;
147
- }
148
-
149
- useEffect(() => {
150
- if (cart?.balance === 0) {
151
- handlePaymethodClick(null)
152
- }
153
- }, [cart?.balance])
154
-
155
- useEffect(() => {
156
- if (paymethodsList.paymethods.length === 1) {
157
- handlePaymethodClick && handlePaymethodClick(paymethodsList.paymethods[0])
158
- }
159
- }, [paymethodsList.paymethods])
160
-
161
- useEffect(() => {
162
- if (paymethodSelected?.gateway !== 'cash' && errorCash) {
163
- props.setErrorCash(false)
164
- }
165
- }, [paymethodSelected])
166
-
167
- useEffect(() => {
168
- if (props.paySelected && props.paySelected?.data) {
169
- requestAnimationFrame(() => {
170
- setPaymethodData && setPaymethodData(props.paySelected?.data)
171
- })
172
- }
173
- }, [props.paySelected])
174
-
175
- useEffect(() => {
176
- if (methodsPay.includes(paymethodSelected?.gateway) && paymethodData?.id && paymethodSelected?.data?.card) {
177
- handlePlaceOrder(confirmApplePayPayment)
178
- }
179
- }, [paymethodData, paymethodSelected])
180
-
181
- useEffect(() => {
182
- if (paymethodClicked?.confirmed) {
183
- handlePaymentMethodClickCustom(paymethodClicked?.paymethod)
184
- }
185
- }, [paymethodClicked?.confirmed])
186
-
187
-
188
- const renderPaymethods = ({ item }: any) => {
189
- return (
190
- <>
191
- {methodsPay.includes(item?.gateway) ? (
192
- <TouchableOpacity
193
- onPress={() => handlePaymentMethodClick(item)}
194
- >
195
- <OIcon
196
- src={getPayIcon(item.gateway)}
197
- width={70}
198
- height={70}
199
- style={{ marginRight: 10 }}
200
- />
201
- </TouchableOpacity>
202
- ) : (
203
- <TouchableOpacity
204
- onPress={() => handlePaymentMethodClick(item)}
205
- >
206
- <PMItem
207
- key={item.id}
208
- isDisabled={isDisabled}
209
- isActive={paymethodSelected?.id === item.id}
210
- >
211
- <OIcon
212
- src={getPayIcon(item.gateway)}
213
- width={20}
214
- height={20}
215
- color={item?.gateway === 'apple_pay' ? '' : paymethodSelected?.id === item.id ? theme.colors.white : theme.colors.backgroundDark}
216
- />
217
- <OText
218
- size={10}
219
- style={{ margin: 0, marginTop: 4 }}
220
- color={paymethodSelected?.id === item.id ? theme.colors.white : '#000'}
221
- >
222
- {t(item?.gateway?.toUpperCase(), item.name)}
223
- </OText>
224
- </PMItem>
225
- </TouchableOpacity>
226
- )}
227
- </>
228
-
229
- )
230
- }
231
-
232
- const excludeIds: any = [32]; //exclude paypal & connect & redirect
233
- const filterMethodsPay = (gateway: string) => Platform.OS === 'ios' ? gateway !== 'google_pay' : gateway !== 'apple_pay'
234
-
235
- return (
236
- <PMContainer>
237
- {paymethodsList.paymethods.length > 0 && (
238
- <FlatList
239
- horizontal
240
- showsHorizontalScrollIndicator={false}
241
- // data={paymethodsList.paymethods.sort((a: any, b: any) => a.id - b.id)}
242
- data={paymethodsList.paymethods.sort((a: any, b: any) => a.id - b.id)
243
- .filter((p: any) =>
244
- !multiCheckoutMethods.includes(p.gateway) &&
245
- filterMethodsPay(p.gateway) &&
246
- !excludeIds.includes(p.id))}
247
- renderItem={renderPaymethods}
248
- keyExtractor={(paymethod: any) => paymethod?.id?.toString?.()}
249
- />
250
- )}
251
-
252
- {(paymethodsList.loading || isLoading) && (
253
- <Placeholder style={{ marginTop: 10 }} Animation={Fade}>
254
- <View style={{ display: 'flex', flexDirection: 'row' }}>
255
- {[...Array(3)].map((_, i) => (
256
- <PlaceholderLine
257
- key={i}
258
- width={37}
259
- height={80}
260
- noMargin
261
- style={{ borderRadius: 10, marginRight: 10 }}
262
- />
263
- ))}
264
- </View>
265
- </Placeholder>
266
- )}
267
-
268
- {paymethodsList.error && paymethodsList.error.length > 0 && (
269
- <OText size={12} style={{ margin: 0 }}>
270
- {paymethodsList?.error[0]?.message || paymethodsList?.error[0]}
271
- </OText>
272
- )}
273
-
274
- {!(paymethodsList.loading || isLoading) &&
275
- !paymethodsList.error &&
276
- (!paymethodsList?.paymethods || paymethodsList.paymethods.length === 0) &&
277
- (
278
- <OText size={12} style={{ margin: 0 }}>
279
- {t('NO_PAYMENT_METHODS', 'No payment methods!')}
280
- </OText>
281
- )}
282
-
283
- {paymethodSelected?.gateway === 'cash' && (
284
- <PaymentOptionCash
285
- orderTotal={cart.balance ?? cart.total}
286
- defaultValue={paymethodSelected?.data?.cash}
287
- onChangeData={handlePaymethodDataChange}
288
- setErrorCash={props.setErrorCash}
289
- />
290
- )}
291
-
292
- {/* {stripeOptions.includes(paymethodSelected?.gateway) &&
55
+ const {
56
+ cart,
57
+ errorCash,
58
+ isLoading,
59
+ isDisabled,
60
+ paymethodData,
61
+ paymethodsList,
62
+ setPaymethodData,
63
+ onNavigationRedirect,
64
+ handlePaymethodClick,
65
+ handlePaymethodDataChange,
66
+ isOpenMethod,
67
+ handlePaymentMethodClickCustom,
68
+ handlePlaceOrder,
69
+ merchantId,
70
+ urlscheme,
71
+ setMethodPaySupported,
72
+ placeByMethodPay,
73
+ methodPaySupported,
74
+ setPlaceByMethodPay,
75
+ setCardList,
76
+ onPaymentChange,
77
+ requiredFields,
78
+ openUserModal,
79
+ paymethodClicked,
80
+ setPaymethodClicked,
81
+ androidAppId,
82
+ setUserHasCards,
83
+ guestDisabledError,
84
+ handleOpenGuestSignup
85
+ } = props
86
+
87
+ const theme = useTheme();
88
+ const [, { showToast }] = useToast();
89
+ const [{ user }] = useSession()
90
+ const { confirmApplePayPayment } = useApplePay()
91
+
92
+ const getPayIcon = (method: string) => {
93
+ switch (method) {
94
+ case 'cash':
95
+ return theme.images.general.cash
96
+ case 'card_delivery':
97
+ return theme.images.general.carddelivery
98
+ case 'paypal':
99
+ return theme.images.general.paypal
100
+ case 'stripe':
101
+ return theme.images.general.creditCard
102
+ case 'stripe_direct':
103
+ return theme.images.general.stripecc
104
+ case 'stripe_connect':
105
+ return theme.images.general.stripes
106
+ case 'stripe_redirect':
107
+ return theme.images.general.stripesb
108
+ case 'apple_pay':
109
+ return theme.images.general.applePayMark
110
+ case 'google_pay':
111
+ return theme.images.general.googlePayMark
112
+ default:
113
+ return theme.images.general.creditCard
114
+ }
115
+ }
116
+
117
+ const [, t] = useLanguage();
118
+
119
+ const [addCardOpen, setAddCardOpen] = useState({ stripe: false, stripeConnect: false, card: false });
120
+ const paymethodSelected = props.paySelected || props.paymethodSelected || isOpenMethod?.paymethod
121
+ // const [{ token }] = useSession()
122
+
123
+ // const [card, setCard] = useState(null);
124
+
125
+ // const stripeRedirectValues = [
126
+ // { name: t('SELECT_A_PAYMENT_METHOD', 'Select a payment method'), value: '-1' },
127
+ // ]
128
+
129
+ const paymethodsFieldRequired = ['paypal', 'apple_pay', 'global_apple_pay']
130
+
131
+ const handlePaymentMethodClick = (paymethod: any) => {
132
+ const _guestNotSupportedMethods = guestDisabledError ? popupMethods : guestNotSupportedMethods
133
+ if (handleOpenGuestSignup && _guestNotSupportedMethods.includes(paymethod?.gateway) && !!user?.guest_id) {
134
+ handleOpenGuestSignup()
135
+ return
136
+ }
137
+ if (cart?.balance > 0 || !!user?.guest_id) {
138
+ if (paymethodsFieldRequired.includes(paymethod?.gateway) && requiredFields.length > 0) {
139
+ openUserModal && openUserModal(true)
140
+ setPaymethodClicked({
141
+ confirmed: false,
142
+ paymethod
143
+ })
144
+ return
145
+ }
146
+ const isPopupMethod = ['stripe', 'stripe_direct', 'stripe_connect', 'stripe_redirect', 'paypal'].includes(paymethod?.gateway)
147
+ if (webViewPaymentGateway.includes(paymethod?.gateway)) {
148
+ handlePaymentMethodClickCustom(paymethod)
149
+ }
150
+ handlePaymethodClick(paymethod, isPopupMethod)
151
+ return
152
+ }
153
+ showToast(
154
+ ToastType.Error,
155
+ t('CART_BALANCE_ZERO', 'Sorry, the amount to pay is equal to zero and it is not necessary to select a payment method'))
156
+ ;
157
+ }
158
+
159
+ useEffect(() => {
160
+ if (cart?.balance === 0) {
161
+ handlePaymethodClick(null)
162
+ }
163
+ }, [cart?.balance])
164
+
165
+ useEffect(() => {
166
+ if (paymethodsList.paymethods.length === 1) {
167
+ handlePaymethodClick && handlePaymethodClick(paymethodsList.paymethods[0])
168
+ }
169
+ }, [paymethodsList.paymethods])
170
+
171
+ useEffect(() => {
172
+ if (paymethodSelected?.gateway !== 'cash' && errorCash) {
173
+ props.setErrorCash(false)
174
+ }
175
+ }, [paymethodSelected])
176
+
177
+ useEffect(() => {
178
+ if (props.paySelected && props.paySelected?.data) {
179
+ requestAnimationFrame(() => {
180
+ setPaymethodData && setPaymethodData(props.paySelected?.data)
181
+ })
182
+ }
183
+ }, [props.paySelected])
184
+
185
+ useEffect(() => {
186
+ if (methodsPay.includes(paymethodSelected?.gateway) && paymethodData?.id && paymethodSelected?.data?.card) {
187
+ handlePlaceOrder(confirmApplePayPayment)
188
+ }
189
+ }, [paymethodData, paymethodSelected])
190
+
191
+ useEffect(() => {
192
+ if (paymethodClicked?.confirmed) {
193
+ handlePaymentMethodClickCustom(paymethodClicked?.paymethod)
194
+ }
195
+ }, [paymethodClicked?.confirmed])
196
+
197
+
198
+ const renderPaymethods = ({ item }: any) => {
199
+ return (
200
+ <>
201
+ {methodsPay.includes(item?.gateway) ? (
202
+ <TouchableOpacity
203
+ onPress={() => handlePaymentMethodClick(item)}
204
+ >
205
+ <OIcon
206
+ src={getPayIcon(item.gateway)}
207
+ width={70}
208
+ height={70}
209
+ style={{ marginRight: 10 }}
210
+ />
211
+ </TouchableOpacity>
212
+ ) : (
213
+ <TouchableOpacity
214
+ onPress={() => handlePaymentMethodClick(item)}
215
+ >
216
+ <PMItem
217
+ key={item.id}
218
+ isDisabled={isDisabled}
219
+ isActive={paymethodSelected?.id === item.id}
220
+ >
221
+ <OIcon
222
+ src={getPayIcon(item.gateway)}
223
+ width={20}
224
+ height={20}
225
+ color={item?.gateway === 'apple_pay' ? '' : paymethodSelected?.id === item.id ? theme.colors.white : theme.colors.backgroundDark}
226
+ />
227
+ <OText
228
+ size={10}
229
+ style={{ margin: 0, marginTop: 4 }}
230
+ color={paymethodSelected?.id === item.id ? theme.colors.white : '#000'}
231
+ >
232
+ {t(item?.gateway?.toUpperCase(), item.name)}
233
+ </OText>
234
+ </PMItem>
235
+ </TouchableOpacity>
236
+ )}
237
+ </>
238
+
239
+ )
240
+ }
241
+
242
+ const excludeIds: any = [32]; //exclude paypal & connect & redirect
243
+ const filterMethodsPay = (gateway: string) => Platform.OS === 'ios' ? gateway !== 'google_pay' : gateway !== 'apple_pay'
244
+
245
+ return (
246
+ <PMContainer>
247
+ {paymethodsList.paymethods.length > 0 && (
248
+ <FlatList
249
+ horizontal
250
+ showsHorizontalScrollIndicator={false}
251
+ // data={paymethodsList.paymethods.sort((a: any, b: any) => a.id - b.id)}
252
+ data={paymethodsList.paymethods.sort((a: any, b: any) => a.id - b.id)
253
+ .filter((p: any) =>
254
+ !multiCheckoutMethods.includes(p.gateway) &&
255
+ filterMethodsPay(p.gateway) &&
256
+ !excludeIds.includes(p.id))}
257
+ renderItem={renderPaymethods}
258
+ keyExtractor={(paymethod: any) => paymethod?.id?.toString?.()}
259
+ />
260
+ )}
261
+
262
+ {(paymethodsList.loading || isLoading) && (
263
+ <Placeholder style={{ marginTop: 10 }} Animation={Fade}>
264
+ <View style={{ display: 'flex', flexDirection: 'row' }}>
265
+ {[...Array(3)].map((_, i) => (
266
+ <PlaceholderLine
267
+ key={i}
268
+ width={37}
269
+ height={80}
270
+ noMargin
271
+ style={{ borderRadius: 10, marginRight: 10 }}
272
+ />
273
+ ))}
274
+ </View>
275
+ </Placeholder>
276
+ )}
277
+
278
+ {paymethodsList.error && paymethodsList.error.length > 0 && (
279
+ <OText size={12} style={{ margin: 0 }}>
280
+ {paymethodsList?.error[0]?.message || paymethodsList?.error[0]}
281
+ </OText>
282
+ )}
283
+
284
+ {!(paymethodsList.loading || isLoading) &&
285
+ !paymethodsList.error &&
286
+ (!paymethodsList?.paymethods || paymethodsList.paymethods.length === 0) &&
287
+ (
288
+ <OText size={12} style={{ margin: 0 }}>
289
+ {t('NO_PAYMENT_METHODS', 'No payment methods!')}
290
+ </OText>
291
+ )}
292
+
293
+ {paymethodSelected?.gateway === 'cash' && (
294
+ <PaymentOptionCash
295
+ orderTotal={cart.balance ?? cart.total}
296
+ defaultValue={paymethodSelected?.data?.cash}
297
+ onChangeData={handlePaymethodDataChange}
298
+ setErrorCash={props.setErrorCash}
299
+ />
300
+ )}
301
+
302
+ {/* {stripeOptions.includes(paymethodSelected?.gateway) &&
293
303
  (paymethodData?.brand || paymethodData?.card?.brand) &&
294
304
  (paymethodData?.last4 || paymethodData?.card?.last4) &&
295
305
  (
@@ -320,186 +330,188 @@ const PaymentOptionsUI = (props: any) => {
320
330
  </PMCardSelected>
321
331
  )} */}
322
332
 
323
- {/* Stripe */}
324
- {isOpenMethod?.paymethod?.gateway === 'stripe' && (
325
- <View>
326
- <OButton
327
- text={t('ADD_PAYMENT_CARD', 'Add New Payment Card')}
328
- bgColor={theme.colors.white}
329
- style={styles.btnAddStyle}
330
- textStyle={{ color: theme.colors.primary, fontSize: 12 }}
331
- imgRightSrc={null}
332
- onClick={() => setAddCardOpen({ ...addCardOpen, stripe: true })}
333
- />
334
- <StripeCardsList
335
- paymethod={isOpenMethod?.paymethod}
336
- businessId={props.businessId}
337
- publicKey={isOpenMethod?.paymethod?.credentials?.publishable}
338
- payType={paymethodsList?.name}
339
- onSelectCard={handlePaymethodDataChange}
340
- onNavigationRedirect={onNavigationRedirect}
341
- paymethodCardId={paymethodData?.id}
342
- onCancel={() => handlePaymethodClick(null)}
343
- setAddCardOpen={setAddCardOpen}
344
- addCardOpen={addCardOpen}
345
- isOpenMethod={isOpenMethod}
346
- handleSource={handlePaymethodDataChange}
347
- clientSecret={props.clientSecret}
348
- businessId={props.businessId}
349
- onPaymentChange={onPaymentChange}
350
- paySelected={props.paySelected}
351
- />
352
- </View>
353
- )}
354
- {/* Google pay, Apple pay */}
355
- {methodsPay.includes(isOpenMethod?.paymethod?.gateway) && (
356
- <StripeElementsForm
357
- cart={cart}
358
- paymethod={isOpenMethod?.paymethod?.gateway}
359
- methodsPay={methodsPay}
360
- businessId={props.businessId}
361
- publicKey={isOpenMethod?.paymethod?.credentials?.publishable || isOpenMethod?.paymethod?.credentials?.publishable_key}
362
- handleSource={handlePaymethodDataChange}
363
- onCancel={() => handlePaymethodClick(null)}
364
- merchantId={merchantId}
365
- urlscheme={urlscheme}
366
- androidAppId={androidAppId}
367
- setMethodPaySupported={setMethodPaySupported}
368
- methodPaySupported={methodPaySupported}
369
- placeByMethodPay={placeByMethodPay}
370
- setPlaceByMethodPay={setPlaceByMethodPay}
371
- publicKeyAddCard={isOpenMethod?.paymethod?.credentials?.stripe?.publishable || isOpenMethod?.paymethod?.credentials?.publishable}
372
- />
373
- )}
374
-
375
- {(cardsPaymethods.includes(isOpenMethod?.paymethod?.gateway) || cardsPaymethods.includes(paymethodSelected?.gateway)) && (
376
- <PaymentOptionCard
377
- setCardList={setCardList}
378
- paymethod={isOpenMethod?.paymethod}
379
- businessId={props.businessId}
380
- publicKey={isOpenMethod?.paymethod?.credentials?.publishable}
381
- gateway={isOpenMethod?.paymethod?.gateway || paymethodSelected?.gateway}
382
- onPaymentChange={onPaymentChange}
383
- payType={isOpenMethod?.paymethod?.name}
384
- onSelectCard={handlePaymethodDataChange}
385
- addCardOpen={addCardOpen}
386
- setAddCardOpen={setAddCardOpen}
387
- onCancel={() => handlePaymethodClick(null)}
388
- paymethodSelected={paymethodSelected?.data?.id}
389
- handlePaymentMethodClick={handlePaymentMethodClick}
390
- />
391
- )}
392
-
393
- {/* Stripe direct */}
394
- <OModal
395
- entireModal
396
- title={t('ADD_CREDIT_OR_DEBIT_CARD', 'Add credit or debit card')}
397
- open={stripeDirectMethods?.includes(isOpenMethod?.paymethod?.gateway) && !paymethodData.id}
398
- onClose={() => handlePaymethodClick(null)}
399
- >
400
- <KeyboardAvoidingView
401
- behavior={Platform.OS == 'ios' ? 'padding' : 'height'}
402
- keyboardVerticalOffset={Platform.OS == 'ios' ? 0 : 0}
403
- enabled={Platform.OS === 'ios' ? true : false}
404
- >
405
- <StripeElementsForm
406
- cart={cart}
407
- paymethod={isOpenMethod?.paymethod?.gateway}
408
- methodsPay={methodsPay}
409
- businessId={props.businessId}
410
- publicKey={isOpenMethod?.paymethod?.credentials?.publishable || isOpenMethod?.paymethod?.credentials?.publishable_key}
411
- handleSource={handlePaymethodDataChange}
412
- onCancel={() => handlePaymethodClick(null)}
413
- merchantId={merchantId}
414
- urlscheme={urlscheme}
415
- androidAppId={androidAppId}
416
- publicKeyAddCard={isOpenMethod?.paymethod?.credentials?.stripe?.publishable || isOpenMethod?.paymethod?.credentials?.publishable}
417
- paySelected={props.paySelected}
418
- />
419
- </KeyboardAvoidingView>
420
- </OModal>
421
-
422
- {/* Stripe Connect */}
423
- {isOpenMethod?.paymethod?.gateway === 'stripe_connect' && !paymethodData?.id && (
424
- <View>
425
- <OButton
426
- text={t('ADD_PAYMENT_CARD', 'Add New Payment Card')}
427
- bgColor={theme.colors.white}
428
- style={styles.btnAddStyle}
429
- textStyle={{ color: theme.colors.primary, fontSize: 12 }}
430
- imgRightSrc={null}
431
- onClick={() => setAddCardOpen({ ...addCardOpen, stripeConnect: true })}
432
- />
433
- <StripeCardsList
434
- paymethod={isOpenMethod?.paymethod}
435
- businessId={props.businessId}
436
- payType={paymethodsList?.name}
437
- onSelectCard={handlePaymethodDataChange}
438
- onNavigationRedirect={onNavigationRedirect}
439
- onCancel={() => handlePaymethodClick(null)}
440
- publicKey={isOpenMethod?.paymethod?.credentials.publishable}
441
- publicKeyAddCard={isOpenMethod?.paymethod?.credentials?.stripe?.publishable || isOpenMethod?.paymethod?.credentials?.publishable}
442
- paySelected={props.paySelected}
443
- />
444
- </View>
445
- )}
446
- {/** Stripe connect add cards */}
447
- <OModal
448
- entireModal
449
- title={t('ADD_CREDIT_OR_DEBIT_CARD', 'Add credit or debit card')}
450
- open={addCardOpen.stripeConnect}
451
- onClose={() => setAddCardOpen({ ...addCardOpen, stripeConnect: false })}
452
- >
453
- <KeyboardAvoidingView
454
- behavior={Platform.OS == 'ios' ? 'padding' : 'height'}
455
- keyboardVerticalOffset={Platform.OS == 'ios' ? 0 : 0}
456
- enabled={Platform.OS === 'ios' ? true : false}
457
- >
458
- <StripeElementsForm
459
- openCarts={props.openCarts}
460
- toSave
461
- businessId={props.businessId}
462
- publicKey={isOpenMethod?.paymethod?.credentials?.stripe?.publishable}
463
- requirements={isOpenMethod?.paymethod?.credentials?.publishable}
464
- accountId={isOpenMethod?.paymethod?.credentials?.user}
465
- onSelectCard={handlePaymethodDataChange}
466
- onCancel={() => setAddCardOpen({ ...addCardOpen, stripeConnect: false })}
467
- publicKeyAddCard={isOpenMethod?.paymethod?.credentials?.stripe?.publishable || isOpenMethod?.paymethod?.credentials?.publishable}
468
- />
469
- </KeyboardAvoidingView>
470
- </OModal>
471
-
472
- {/* Stripe Add card */}
473
- <OModal
474
- entireModal
475
- title={t('ADD_CREDIT_OR_DEBIT_CARD', 'Add credit or debit card')}
476
- open={addCardOpen?.stripe}
477
- onClose={() => setAddCardOpen({ ...addCardOpen, stripe: false })}
478
- style={{ backgroundColor: 'red' }}
479
- >
480
- <KeyboardAvoidingView
481
- behavior={Platform.OS == 'ios' ? 'padding' : 'height'}
482
- keyboardVerticalOffset={Platform.OS == 'ios' ? 0 : 0}
483
- enabled={Platform.OS === 'ios' ? true : false}
484
- >
485
- <StripeElementsForm
486
- openCarts={props.openCarts}
487
- toSave
488
- businessId={props.businessId}
489
- businessIds={props.businessIds}
490
- publicKey={props.publicKey || isOpenMethod?.paymethod?.credentials?.publishable}
491
- setCardsList={setCardList}
492
- requirements={props.clientSecret}
493
- handleSource={handlePaymethodDataChange}
494
- onSelectCard={handlePaymethodDataChange}
495
- onCancel={() => setAddCardOpen({ ...addCardOpen, stripe: false })}
496
- publicKeyAddCard={isOpenMethod?.paymethod?.credentials?.stripe?.publishable || isOpenMethod?.paymethod?.credentials?.publishable}
497
- />
498
- </KeyboardAvoidingView>
499
- </OModal>
500
-
501
- {/* Stripe Redirect */}
502
- {/* <OModal
333
+ {/* Stripe */}
334
+ {isOpenMethod?.paymethod?.gateway === 'stripe' && (
335
+ <View>
336
+ <OButton
337
+ text={t('ADD_PAYMENT_CARD', 'Add New Payment Card')}
338
+ bgColor={theme.colors.white}
339
+ style={styles.btnAddStyle}
340
+ textStyle={{ color: theme.colors.primary, fontSize: 12 }}
341
+ imgRightSrc={null}
342
+ onClick={() => setAddCardOpen({ ...addCardOpen, stripe: true })}
343
+ />
344
+ <StripeCardsList
345
+ paymethod={isOpenMethod?.paymethod}
346
+ businessId={props.businessId}
347
+ publicKey={isOpenMethod?.paymethod?.credentials?.publishable}
348
+ payType={paymethodsList?.name}
349
+ onSelectCard={handlePaymethodDataChange}
350
+ onNavigationRedirect={onNavigationRedirect}
351
+ paymethodCardId={paymethodData?.id}
352
+ onCancel={() => handlePaymethodClick(null)}
353
+ setAddCardOpen={setAddCardOpen}
354
+ addCardOpen={addCardOpen}
355
+ isOpenMethod={isOpenMethod}
356
+ handleSource={handlePaymethodDataChange}
357
+ clientSecret={props.clientSecret}
358
+ businessId={props.businessId}
359
+ onPaymentChange={onPaymentChange}
360
+ paySelected={props.paySelected}
361
+ setUserHasCards={setUserHasCards}
362
+ />
363
+ </View>
364
+ )}
365
+ {/* Google pay, Apple pay */}
366
+ {methodsPay.includes(isOpenMethod?.paymethod?.gateway) && (
367
+ <StripeElementsForm
368
+ cart={cart}
369
+ paymethod={isOpenMethod?.paymethod?.gateway}
370
+ methodsPay={methodsPay}
371
+ businessId={props.businessId}
372
+ publicKey={isOpenMethod?.paymethod?.credentials?.publishable || isOpenMethod?.paymethod?.credentials?.publishable_key}
373
+ handleSource={handlePaymethodDataChange}
374
+ onCancel={() => handlePaymethodClick(null)}
375
+ merchantId={merchantId}
376
+ urlscheme={urlscheme}
377
+ androidAppId={androidAppId}
378
+ setMethodPaySupported={setMethodPaySupported}
379
+ methodPaySupported={methodPaySupported}
380
+ placeByMethodPay={placeByMethodPay}
381
+ setPlaceByMethodPay={setPlaceByMethodPay}
382
+ publicKeyAddCard={isOpenMethod?.paymethod?.credentials?.stripe?.publishable || isOpenMethod?.paymethod?.credentials?.publishable}
383
+ />
384
+ )}
385
+
386
+ {(cardsPaymethods.includes(isOpenMethod?.paymethod?.gateway) || cardsPaymethods.includes(paymethodSelected?.gateway)) && (
387
+ <PaymentOptionCard
388
+ setCardList={setCardList}
389
+ paymethod={isOpenMethod?.paymethod}
390
+ businessId={props.businessId}
391
+ publicKey={isOpenMethod?.paymethod?.credentials?.publishable}
392
+ gateway={isOpenMethod?.paymethod?.gateway || paymethodSelected?.gateway}
393
+ onPaymentChange={onPaymentChange}
394
+ payType={isOpenMethod?.paymethod?.name}
395
+ onSelectCard={handlePaymethodDataChange}
396
+ addCardOpen={addCardOpen}
397
+ setAddCardOpen={setAddCardOpen}
398
+ onCancel={() => handlePaymethodClick(null)}
399
+ paymethodSelected={paymethodSelected?.data?.id}
400
+ handlePaymentMethodClick={handlePaymentMethodClick}
401
+ />
402
+ )}
403
+
404
+ {/* Stripe direct */}
405
+ <OModal
406
+ entireModal
407
+ title={t('ADD_CREDIT_OR_DEBIT_CARD', 'Add credit or debit card')}
408
+ open={stripeDirectMethods?.includes(isOpenMethod?.paymethod?.gateway) && !paymethodData.id}
409
+ onClose={() => handlePaymethodClick(null)}
410
+ >
411
+ <KeyboardAvoidingView
412
+ behavior={Platform.OS == 'ios' ? 'padding' : 'height'}
413
+ keyboardVerticalOffset={Platform.OS == 'ios' ? 0 : 0}
414
+ enabled={Platform.OS === 'ios' ? true : false}
415
+ >
416
+ <StripeElementsForm
417
+ cart={cart}
418
+ paymethod={isOpenMethod?.paymethod?.gateway}
419
+ methodsPay={methodsPay}
420
+ businessId={props.businessId}
421
+ publicKey={isOpenMethod?.paymethod?.credentials?.publishable || isOpenMethod?.paymethod?.credentials?.publishable_key}
422
+ handleSource={handlePaymethodDataChange}
423
+ onCancel={() => handlePaymethodClick(null)}
424
+ merchantId={merchantId}
425
+ urlscheme={urlscheme}
426
+ androidAppId={androidAppId}
427
+ publicKeyAddCard={isOpenMethod?.paymethod?.credentials?.stripe?.publishable || isOpenMethod?.paymethod?.credentials?.publishable}
428
+ paySelected={props.paySelected}
429
+ />
430
+ </KeyboardAvoidingView>
431
+ </OModal>
432
+
433
+ {/* Stripe Connect */}
434
+ {isOpenMethod?.paymethod?.gateway === 'stripe_connect' && (
435
+ <View>
436
+ <OButton
437
+ text={t('ADD_PAYMENT_CARD', 'Add New Payment Card')}
438
+ bgColor={theme.colors.white}
439
+ style={styles.btnAddStyle}
440
+ textStyle={{ color: theme.colors.primary, fontSize: 12 }}
441
+ imgRightSrc={null}
442
+ onClick={() => setAddCardOpen({ ...addCardOpen, stripeConnect: true })}
443
+ />
444
+ <StripeCardsList
445
+ paymethod={isOpenMethod?.paymethod}
446
+ businessId={props.businessId}
447
+ payType={paymethodsList?.name}
448
+ onSelectCard={handlePaymethodDataChange}
449
+ onNavigationRedirect={onNavigationRedirect}
450
+ onCancel={() => handlePaymethodClick(null)}
451
+ publicKey={isOpenMethod?.paymethod?.credentials.publishable}
452
+ publicKeyAddCard={isOpenMethod?.paymethod?.credentials?.stripe?.publishable || isOpenMethod?.paymethod?.credentials?.publishable}
453
+ paySelected={props.paySelected}
454
+ setUserHasCards={setUserHasCards}
455
+ />
456
+ </View>
457
+ )}
458
+ {/** Stripe connect add cards */}
459
+ <OModal
460
+ entireModal
461
+ title={t('ADD_CREDIT_OR_DEBIT_CARD', 'Add credit or debit card')}
462
+ open={addCardOpen.stripeConnect}
463
+ onClose={() => setAddCardOpen({ ...addCardOpen, stripeConnect: false })}
464
+ >
465
+ <KeyboardAvoidingView
466
+ behavior={Platform.OS == 'ios' ? 'padding' : 'height'}
467
+ keyboardVerticalOffset={Platform.OS == 'ios' ? 0 : 0}
468
+ enabled={Platform.OS === 'ios' ? true : false}
469
+ >
470
+ <StripeElementsForm
471
+ openCarts={props.openCarts}
472
+ toSave
473
+ businessId={props.businessId}
474
+ publicKey={isOpenMethod?.paymethod?.credentials?.stripe?.publishable}
475
+ requirements={isOpenMethod?.paymethod?.credentials?.publishable}
476
+ accountId={isOpenMethod?.paymethod?.credentials?.user}
477
+ onSelectCard={handlePaymethodDataChange}
478
+ onCancel={() => setAddCardOpen({ ...addCardOpen, stripeConnect: false })}
479
+ publicKeyAddCard={isOpenMethod?.paymethod?.credentials?.stripe?.publishable || isOpenMethod?.paymethod?.credentials?.publishable}
480
+ />
481
+ </KeyboardAvoidingView>
482
+ </OModal>
483
+
484
+ {/* Stripe Add card */}
485
+ <OModal
486
+ entireModal
487
+ title={t('ADD_CREDIT_OR_DEBIT_CARD', 'Add credit or debit card')}
488
+ open={addCardOpen?.stripe}
489
+ onClose={() => setAddCardOpen({ ...addCardOpen, stripe: false })}
490
+ style={{ backgroundColor: 'red' }}
491
+ >
492
+ <KeyboardAvoidingView
493
+ behavior={Platform.OS == 'ios' ? 'padding' : 'height'}
494
+ keyboardVerticalOffset={Platform.OS == 'ios' ? 0 : 0}
495
+ enabled={Platform.OS === 'ios' ? true : false}
496
+ >
497
+ <StripeElementsForm
498
+ openCarts={props.openCarts}
499
+ toSave
500
+ businessId={props.businessId}
501
+ businessIds={props.businessIds}
502
+ publicKey={props.publicKey || isOpenMethod?.paymethod?.credentials?.publishable}
503
+ setCardsList={setCardList}
504
+ requirements={props.clientSecret}
505
+ handleSource={handlePaymethodDataChange}
506
+ onSelectCard={handlePaymethodDataChange}
507
+ onCancel={() => setAddCardOpen({ ...addCardOpen, stripe: false })}
508
+ publicKeyAddCard={isOpenMethod?.paymethod?.credentials?.stripe?.publishable || isOpenMethod?.paymethod?.credentials?.publishable}
509
+ />
510
+ </KeyboardAvoidingView>
511
+ </OModal>
512
+
513
+ {/* Stripe Redirect */}
514
+ {/* <OModal
503
515
  isNotDecoration
504
516
  open={['stripe_redirect'].includes(paymethodSelected?.gateway) && !paymethodData.type}
505
517
  title={t('STRIPE_REDIRECT', 'Stripe Redirect')}
@@ -515,8 +527,8 @@ const PaymentOptionsUI = (props: any) => {
515
527
  />
516
528
  </OModal> */}
517
529
 
518
- {/* Paypal */}
519
- {/* <Modal
530
+ {/* Paypal */}
531
+ {/* <Modal
520
532
  className='modal-info'
521
533
  open={paymethodSelected?.gateway === 'paypal' && !paymethodData?.id}
522
534
  onClose={() => handlePaymethodClick(null)}
@@ -541,35 +553,35 @@ const PaymentOptionsUI = (props: any) => {
541
553
  />
542
554
  )}
543
555
  </Modal> */}
544
- </PMContainer>
545
- )
556
+ </PMContainer>
557
+ )
546
558
  }
547
559
 
548
560
  const styles = StyleSheet.create({
549
- viewStyle: {
550
- marginRight: 10
551
- },
552
- cardsList: {
553
- borderWidth: 1,
554
- borderColor: 'red',
555
- flex: 1,
556
- height: 120
557
- },
558
- btnAddStyle: {
559
- marginVertical: 20,
560
- borderRadius: 7.6,
561
- shadowOpacity: 0,
562
- height: 44,
563
- borderWidth: 1
564
- },
561
+ viewStyle: {
562
+ marginRight: 10
563
+ },
564
+ cardsList: {
565
+ borderWidth: 1,
566
+ borderColor: 'red',
567
+ flex: 1,
568
+ height: 120
569
+ },
570
+ btnAddStyle: {
571
+ marginVertical: 20,
572
+ borderRadius: 7.6,
573
+ shadowOpacity: 0,
574
+ height: 44,
575
+ borderWidth: 1
576
+ },
565
577
  })
566
578
 
567
579
  export const PaymentOptions = (props: any) => {
568
- const paymentOptions = {
569
- ...props,
570
- UIComponent: PaymentOptionsUI
571
- }
572
- return (
573
- <PaymentOptionsController {...paymentOptions} />
574
- )
580
+ const paymentOptions = {
581
+ ...props,
582
+ UIComponent: PaymentOptionsUI
583
+ }
584
+ return (
585
+ <PaymentOptionsController {...paymentOptions} />
586
+ )
575
587
  }