ordering-ui-react-native 0.16.37 → 0.16.40
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 +1 -1
- package/src/components/OrderDetails/index.tsx +2 -20
- package/src/components/PaymentOptions/index.tsx +66 -49
- package/src/components/ReviewOrder/index.tsx +1 -0
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +122 -44
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +4 -0
- package/themes/original/src/components/Cart/index.tsx +1 -1
- package/themes/original/src/components/Favorite/index.tsx +1 -0
- package/themes/original/src/components/FavoriteList/index.tsx +13 -2
- package/themes/original/src/components/OrderSummary/index.tsx +1 -1
- package/themes/original/src/components/PaymentOptions/index.tsx +41 -22
- package/themes/original/src/components/StripeElementsForm/index.tsx +6 -6
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React, { useState, useEffect
|
|
2
|
-
import { View, StyleSheet, BackHandler, TouchableOpacity, I18nManager
|
|
1
|
+
import React, { useState, useEffect } from 'react'
|
|
2
|
+
import { View, StyleSheet, BackHandler, TouchableOpacity, I18nManager } from 'react-native'
|
|
3
3
|
import LinearGradient from 'react-native-linear-gradient'
|
|
4
4
|
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
5
5
|
import MaterialCommunityIcon from 'react-native-vector-icons/MaterialCommunityIcons'
|
|
@@ -109,7 +109,6 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
109
109
|
const [isReviewed, setIsReviewed] = useState(false)
|
|
110
110
|
const [openOrderCreating, setOpenOrderCreating] = useState(false)
|
|
111
111
|
const [openTaxModal, setOpenTaxModal] = useState<any>({ open: false, tax: null, type: '' })
|
|
112
|
-
const appState = useRef(AppState.currentState)
|
|
113
112
|
|
|
114
113
|
const { order, loading, businessData, error } = props.order
|
|
115
114
|
|
|
@@ -259,23 +258,6 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
259
258
|
})
|
|
260
259
|
}, [])
|
|
261
260
|
|
|
262
|
-
useEffect(() => {
|
|
263
|
-
const onFocusApp = (nextAppState: any) => {
|
|
264
|
-
if (
|
|
265
|
-
appState.current.match(/inactive|background/) &&
|
|
266
|
-
nextAppState === "active"
|
|
267
|
-
) {
|
|
268
|
-
getOrder && getOrder()
|
|
269
|
-
}
|
|
270
|
-
appState.current = nextAppState;
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
AppState.addEventListener("change", onFocusApp);
|
|
274
|
-
return () => {
|
|
275
|
-
AppState.removeEventListener('change', onFocusApp);
|
|
276
|
-
};
|
|
277
|
-
}, [])
|
|
278
|
-
|
|
279
261
|
return (
|
|
280
262
|
<OrderDetailsContainer keyboardShouldPersistTaps='handled'>
|
|
281
263
|
{order && order?.id && !error && !loading && (
|
|
@@ -89,6 +89,8 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
89
89
|
return theme.images.general.stripes
|
|
90
90
|
case 'stripe_redirect':
|
|
91
91
|
return theme.images.general.stripesb
|
|
92
|
+
case 'apple_pay':
|
|
93
|
+
return theme.images.general.applePayMark
|
|
92
94
|
default:
|
|
93
95
|
return theme.images.general.creditCard
|
|
94
96
|
}
|
|
@@ -97,7 +99,7 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
97
99
|
const handlePaymentMethodClick = (paymethod: any) => {
|
|
98
100
|
const isPopupMethod = ['stripe', 'stripe_direct', 'stripe_connect', 'stripe_redirect', 'paypal', 'square'].includes(paymethod?.gateway)
|
|
99
101
|
handlePaymethodClick(paymethod, isPopupMethod)
|
|
100
|
-
|
|
102
|
+
if (webViewPaymentGateway.includes(paymethod?.gateway)) {
|
|
101
103
|
handlePaymentMethodClickCustom(paymethod)
|
|
102
104
|
}
|
|
103
105
|
setCardData(paymethodData)
|
|
@@ -130,29 +132,44 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
130
132
|
|
|
131
133
|
const renderPaymethods = ({ item }: any) => {
|
|
132
134
|
return (
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
key={item.id}
|
|
138
|
-
isDisabled={isDisabled}
|
|
139
|
-
isActive={paymethodSelected?.id === item.id}
|
|
140
|
-
>
|
|
141
|
-
<OIcon
|
|
142
|
-
src={getPayIcon(item.gateway)}
|
|
143
|
-
width={40}
|
|
144
|
-
height={40}
|
|
145
|
-
color={paymethodSelected?.id === item.id ? theme.colors.white : theme.colors.backgroundDark}
|
|
146
|
-
/>
|
|
147
|
-
<OText
|
|
148
|
-
size={12}
|
|
149
|
-
style={{ margin: 0 }}
|
|
150
|
-
color={paymethodSelected?.id === item.id ? theme.colors.white : '#000'}
|
|
135
|
+
<>
|
|
136
|
+
{item?.gateway === 'apple_pay' ? (
|
|
137
|
+
<TouchableOpacity
|
|
138
|
+
onPress={() => handlePaymentMethodClick(item)}
|
|
151
139
|
>
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
140
|
+
<OIcon
|
|
141
|
+
src={getPayIcon(item.gateway)}
|
|
142
|
+
width={120}
|
|
143
|
+
height={100}
|
|
144
|
+
style={{ marginRight: 10 }}
|
|
145
|
+
/>
|
|
146
|
+
</TouchableOpacity>
|
|
147
|
+
) : (
|
|
148
|
+
<TouchableOpacity
|
|
149
|
+
onPress={() => handlePaymentMethodClick(item)}
|
|
150
|
+
>
|
|
151
|
+
<PMItem
|
|
152
|
+
key={item.id}
|
|
153
|
+
isDisabled={isDisabled}
|
|
154
|
+
isActive={paymethodSelected?.id === item.id}
|
|
155
|
+
>
|
|
156
|
+
<OIcon
|
|
157
|
+
src={getPayIcon(item.gateway)}
|
|
158
|
+
width={40}
|
|
159
|
+
height={40}
|
|
160
|
+
color={paymethodSelected?.id === item.id ? theme.colors.white : theme.colors.backgroundDark}
|
|
161
|
+
/>
|
|
162
|
+
<OText
|
|
163
|
+
size={12}
|
|
164
|
+
style={{ margin: 0 }}
|
|
165
|
+
color={paymethodSelected?.id === item.id ? theme.colors.white : '#000'}
|
|
166
|
+
>
|
|
167
|
+
{t(item.gateway.toUpperCase(), item.name)}
|
|
168
|
+
</OText>
|
|
169
|
+
</PMItem>
|
|
170
|
+
</TouchableOpacity>
|
|
171
|
+
)}
|
|
172
|
+
</>
|
|
156
173
|
)
|
|
157
174
|
}
|
|
158
175
|
|
|
@@ -213,31 +230,31 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
213
230
|
{stripeOptions.includes(paymethodSelected?.gateway) &&
|
|
214
231
|
(paymethodData?.brand || paymethodData?.card?.brand) &&
|
|
215
232
|
(paymethodData?.last4 || paymethodData?.card?.last4) &&
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
233
|
+
(
|
|
234
|
+
<PMCardSelected>
|
|
235
|
+
<PMCardItemContent>
|
|
236
|
+
<View style={styles.viewStyle}>
|
|
237
|
+
<MaterialCommunityIcons
|
|
238
|
+
name='radiobox-marked'
|
|
239
|
+
size={24}
|
|
240
|
+
color={theme.colors.primary}
|
|
241
|
+
/>
|
|
242
|
+
</View>
|
|
243
|
+
<View style={styles.viewStyle}>
|
|
244
|
+
<OText>
|
|
245
|
+
{getIconCard((paymethodData?.brand || paymethodData?.card?.brand), 26)}
|
|
246
|
+
</OText>
|
|
247
|
+
</View>
|
|
248
|
+
<View style={styles.viewStyle}>
|
|
249
|
+
<OText
|
|
250
|
+
size={20}
|
|
251
|
+
>
|
|
252
|
+
XXXX-XXXX-XXXX-{(paymethodData?.last4 || paymethodData?.card?.last4)}
|
|
253
|
+
</OText>
|
|
254
|
+
</View>
|
|
255
|
+
</PMCardItemContent>
|
|
256
|
+
</PMCardSelected>
|
|
257
|
+
)}
|
|
241
258
|
|
|
242
259
|
{/* Stripe */}
|
|
243
260
|
{isOpenMethod?.paymethod?.gateway === 'stripe' && !paymethodData?.id && (
|
|
@@ -317,7 +334,7 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
317
334
|
bgColor={theme.colors.primary}
|
|
318
335
|
borderColor={theme.colors.primary}
|
|
319
336
|
style={styles.btnAddStyle}
|
|
320
|
-
textStyle={{color: 'white'}}
|
|
337
|
+
textStyle={{ color: 'white' }}
|
|
321
338
|
imgRightSrc={null}
|
|
322
339
|
onClick={() => setAddCardOpen({ ...addCardOpen, stripeConnect: true })}
|
|
323
340
|
/>
|
|
@@ -332,6 +332,7 @@ export const ReviewOrderUI = (props: ReviewOrderParams) => {
|
|
|
332
332
|
export const ReviewOrder = (props: ReviewOrderParams) => {
|
|
333
333
|
const reviewOrderProps = {
|
|
334
334
|
...props,
|
|
335
|
+
defaultStar: 0,
|
|
335
336
|
UIComponent: ReviewOrderUI
|
|
336
337
|
}
|
|
337
338
|
return <ReviewOrderController {...reviewOrderProps} />
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
|
2
|
-
import { StyleSheet, View, TouchableOpacity } from 'react-native';
|
|
2
|
+
import { StyleSheet, View, TouchableOpacity, Linking } from 'react-native';
|
|
3
3
|
import { useUtils, useOrder, useLanguage } from 'ordering-components/native';
|
|
4
4
|
import { useTheme } from 'styled-components/native';
|
|
5
5
|
import { OIcon, OText, OModal } from '../shared';
|
|
6
6
|
import { BusinessBasicInformationParams } from '../../types';
|
|
7
7
|
import { convertHoursToMinutes, shape } from '../../utils';
|
|
8
|
+
import MaterialComIcon from 'react-native-vector-icons/MaterialCommunityIcons'
|
|
8
9
|
import dayjs from 'dayjs';
|
|
9
10
|
import timezone from 'dayjs/plugin/timezone';
|
|
10
11
|
import isBetween from 'dayjs/plugin/isBetween';
|
|
@@ -21,7 +22,8 @@ import {
|
|
|
21
22
|
WrapReviews,
|
|
22
23
|
WrapBusinessInfo,
|
|
23
24
|
TitleWrapper,
|
|
24
|
-
RibbonBox
|
|
25
|
+
RibbonBox,
|
|
26
|
+
SocialListWrapper
|
|
25
27
|
} from './styles';
|
|
26
28
|
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
27
29
|
const types = ['food', 'laundry', 'alcohol', 'groceries'];
|
|
@@ -44,6 +46,64 @@ export const BusinessBasicInformation = (
|
|
|
44
46
|
const [businessInformationObtained, setBusinessInformationObtained] = useState(false)
|
|
45
47
|
const [businessReviewsObtained, setBusinessReviewsObtainedbtained] = useState(false)
|
|
46
48
|
|
|
49
|
+
const styles = StyleSheet.create({
|
|
50
|
+
businesInfoheaderStyle: {
|
|
51
|
+
height: 150,
|
|
52
|
+
},
|
|
53
|
+
headerStyle: {
|
|
54
|
+
height: 260,
|
|
55
|
+
},
|
|
56
|
+
businessLogo: {
|
|
57
|
+
width: 72,
|
|
58
|
+
height: 72,
|
|
59
|
+
borderRadius: 7.6,
|
|
60
|
+
justifyContent: 'flex-start',
|
|
61
|
+
alignItems: 'flex-start',
|
|
62
|
+
},
|
|
63
|
+
businessInfo: {
|
|
64
|
+
paddingHorizontal: 40,
|
|
65
|
+
paddingTop: 56,
|
|
66
|
+
},
|
|
67
|
+
bullet: {
|
|
68
|
+
flexDirection: 'row',
|
|
69
|
+
alignItems: 'center',
|
|
70
|
+
},
|
|
71
|
+
metadata: {
|
|
72
|
+
marginRight: 2,
|
|
73
|
+
},
|
|
74
|
+
starIcon: {
|
|
75
|
+
marginHorizontal: 5,
|
|
76
|
+
},
|
|
77
|
+
reviewStyle: {
|
|
78
|
+
flexDirection: 'row',
|
|
79
|
+
alignItems: 'center',
|
|
80
|
+
justifyContent: 'center'
|
|
81
|
+
},
|
|
82
|
+
modalTitleSectionStyle: {
|
|
83
|
+
position: 'absolute',
|
|
84
|
+
width: '100%',
|
|
85
|
+
top: 0,
|
|
86
|
+
zIndex: 100,
|
|
87
|
+
left: 40
|
|
88
|
+
},
|
|
89
|
+
socialIcon: {
|
|
90
|
+
borderRadius: 3,
|
|
91
|
+
borderColor: theme.colors.border,
|
|
92
|
+
borderWidth: 1,
|
|
93
|
+
width: 20,
|
|
94
|
+
height: 20,
|
|
95
|
+
justifyContent: 'center',
|
|
96
|
+
alignItems: 'center',
|
|
97
|
+
marginLeft: 5
|
|
98
|
+
},
|
|
99
|
+
tiktokIcon: {
|
|
100
|
+
height: 12,
|
|
101
|
+
width: 12,
|
|
102
|
+
margin: 0,
|
|
103
|
+
padding: 0
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
|
|
47
107
|
const handleClickBusinessInformation = () => {
|
|
48
108
|
if (!businessInformationObtained) {
|
|
49
109
|
BusinessInformation = require('../BusinessInformation').BusinessInformation
|
|
@@ -73,6 +133,19 @@ export const BusinessBasicInformation = (
|
|
|
73
133
|
return _types.join(', ');
|
|
74
134
|
};
|
|
75
135
|
|
|
136
|
+
const SocialNetWork = (props: any) => {
|
|
137
|
+
const { socialLink, iconTitle} = props
|
|
138
|
+
|
|
139
|
+
return (
|
|
140
|
+
<TouchableOpacity style={styles.socialIcon} onPress={() => Linking.openURL(socialLink)}>
|
|
141
|
+
<MaterialComIcon
|
|
142
|
+
name={iconTitle}
|
|
143
|
+
color={theme.colors.textNormal}
|
|
144
|
+
size={14}
|
|
145
|
+
/>
|
|
146
|
+
</TouchableOpacity>
|
|
147
|
+
)
|
|
148
|
+
}
|
|
76
149
|
|
|
77
150
|
useEffect(() => {
|
|
78
151
|
if (businessState?.loading) return
|
|
@@ -165,6 +238,53 @@ export const BusinessBasicInformation = (
|
|
|
165
238
|
</OText>
|
|
166
239
|
</RibbonBox>
|
|
167
240
|
)}
|
|
241
|
+
<SocialListWrapper
|
|
242
|
+
showsVerticalScrollIndicator={false}
|
|
243
|
+
showsHorizontalScrollIndicator={false}
|
|
244
|
+
horizontal
|
|
245
|
+
contentContainerStyle={{ flex: 1, justifyContent: 'flex-end'}}
|
|
246
|
+
>
|
|
247
|
+
{!!business?.facebook_profile && (
|
|
248
|
+
<SocialNetWork
|
|
249
|
+
socialLink={business?.facebook_profile}
|
|
250
|
+
iconTitle='facebook'
|
|
251
|
+
/>
|
|
252
|
+
)}
|
|
253
|
+
{!!business?.instagram_profile && (
|
|
254
|
+
<SocialNetWork
|
|
255
|
+
socialLink={business?.instagram_profile}
|
|
256
|
+
iconTitle='instagram'
|
|
257
|
+
/>
|
|
258
|
+
)}
|
|
259
|
+
{!!business?.tiktok_profile && (
|
|
260
|
+
<TouchableOpacity style={styles.socialIcon} onPress={() => Linking.openURL(business?.tiktok_profile)}>
|
|
261
|
+
<View style={styles.tiktokIcon}>
|
|
262
|
+
<OIcon
|
|
263
|
+
src={theme.images.general.tiktok}
|
|
264
|
+
style={{ width: '100%', height: '100%'}}
|
|
265
|
+
/>
|
|
266
|
+
</View>
|
|
267
|
+
</TouchableOpacity>
|
|
268
|
+
)}
|
|
269
|
+
{!!business?.pinterest_profile && (
|
|
270
|
+
<SocialNetWork
|
|
271
|
+
socialLink={business?.pinterest_profile}
|
|
272
|
+
iconTitle='pinterest'
|
|
273
|
+
/>
|
|
274
|
+
)}
|
|
275
|
+
{!!business?.whatsapp_number && (
|
|
276
|
+
<SocialNetWork
|
|
277
|
+
socialLink={business?.whatsapp_number}
|
|
278
|
+
iconTitle='whatsapp'
|
|
279
|
+
/>
|
|
280
|
+
)}
|
|
281
|
+
{!!business?.snapchat_profile && (
|
|
282
|
+
<SocialNetWork
|
|
283
|
+
socialLink={business?.snapchat_profile}
|
|
284
|
+
iconTitle='snapchat'
|
|
285
|
+
/>
|
|
286
|
+
)}
|
|
287
|
+
</SocialListWrapper>
|
|
168
288
|
</TitleWrapper>
|
|
169
289
|
)}
|
|
170
290
|
</BusinessInfoItem>
|
|
@@ -276,45 +396,3 @@ export const BusinessBasicInformation = (
|
|
|
276
396
|
</BusinessContainer>
|
|
277
397
|
);
|
|
278
398
|
};
|
|
279
|
-
|
|
280
|
-
const styles = StyleSheet.create({
|
|
281
|
-
businesInfoheaderStyle: {
|
|
282
|
-
height: 150,
|
|
283
|
-
},
|
|
284
|
-
headerStyle: {
|
|
285
|
-
height: 260,
|
|
286
|
-
},
|
|
287
|
-
businessLogo: {
|
|
288
|
-
width: 72,
|
|
289
|
-
height: 72,
|
|
290
|
-
borderRadius: 7.6,
|
|
291
|
-
justifyContent: 'flex-start',
|
|
292
|
-
alignItems: 'flex-start',
|
|
293
|
-
},
|
|
294
|
-
businessInfo: {
|
|
295
|
-
paddingHorizontal: 40,
|
|
296
|
-
paddingTop: 56,
|
|
297
|
-
},
|
|
298
|
-
bullet: {
|
|
299
|
-
flexDirection: 'row',
|
|
300
|
-
alignItems: 'center',
|
|
301
|
-
},
|
|
302
|
-
metadata: {
|
|
303
|
-
marginRight: 2,
|
|
304
|
-
},
|
|
305
|
-
starIcon: {
|
|
306
|
-
marginHorizontal: 5,
|
|
307
|
-
},
|
|
308
|
-
reviewStyle: {
|
|
309
|
-
flexDirection: 'row',
|
|
310
|
-
alignItems: 'center',
|
|
311
|
-
justifyContent: 'center'
|
|
312
|
-
},
|
|
313
|
-
modalTitleSectionStyle: {
|
|
314
|
-
position: 'absolute',
|
|
315
|
-
width: '100%',
|
|
316
|
-
top: 0,
|
|
317
|
-
zIndex: 100,
|
|
318
|
-
left: 40
|
|
319
|
-
},
|
|
320
|
-
});
|
|
@@ -361,7 +361,7 @@ const CartUI = (props: any) => {
|
|
|
361
361
|
{t('TOTAL', 'Total')}
|
|
362
362
|
</OText>
|
|
363
363
|
<OText size={14} lineHeight={21} weight={'600'}>
|
|
364
|
-
{parsePrice(cart?.
|
|
364
|
+
{parsePrice(cart?.balance >= 0 ? cart?.balance : 0)}
|
|
365
365
|
</OText>
|
|
366
366
|
</OSTable>
|
|
367
367
|
</OSTotal>
|
|
@@ -73,6 +73,17 @@ const FavoriteListUI = (props: FavoriteParams) => {
|
|
|
73
73
|
return objectStatus && objectStatus
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
+
const onProductClick = (product: any) => {
|
|
77
|
+
const categoryId = product?.category?.id
|
|
78
|
+
const businessId = product?.category?.business?.id
|
|
79
|
+
if (!categoryId || !businessId) return
|
|
80
|
+
onNavigationRedirect && onNavigationRedirect('ProductDetails', {
|
|
81
|
+
productId: product?.id,
|
|
82
|
+
categoryId: categoryId,
|
|
83
|
+
businessId: businessId
|
|
84
|
+
})
|
|
85
|
+
}
|
|
86
|
+
|
|
76
87
|
useEffect(() => {
|
|
77
88
|
const _businessId = 'businessId:' + reorderState?.result?.business_id
|
|
78
89
|
if (reorderState?.error) {
|
|
@@ -248,9 +259,9 @@ const FavoriteListUI = (props: FavoriteParams) => {
|
|
|
248
259
|
favoriteList.favorites?.sort((a: any, b: any) => a?.name?.toLowerCase() > b?.name?.toLowerCase()).map((product: any, i: number) => (
|
|
249
260
|
<SingleProductCard
|
|
250
261
|
key={`${product?.id}_${i}`}
|
|
251
|
-
isSoldOut={product
|
|
262
|
+
isSoldOut={product?.inventoried && !product?.quantity}
|
|
252
263
|
product={product}
|
|
253
|
-
onProductClick={
|
|
264
|
+
onProductClick={onProductClick}
|
|
254
265
|
handleUpdateProducts={handleUpdateFavoriteList}
|
|
255
266
|
/>
|
|
256
267
|
))
|
|
@@ -299,7 +299,7 @@ const OrderSummaryUI = (props: any) => {
|
|
|
299
299
|
{t('TOTAL', 'Total')}
|
|
300
300
|
</OText>
|
|
301
301
|
<OText size={14} style={{ fontWeight: 'bold' }} >
|
|
302
|
-
{parsePrice(cart?.
|
|
302
|
+
{parsePrice(cart?.balance >= 0 ? cart?.balance : 0)}
|
|
303
303
|
</OText>
|
|
304
304
|
</OSTable>
|
|
305
305
|
</View>
|
|
@@ -82,6 +82,8 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
82
82
|
return theme.images.general.stripes
|
|
83
83
|
case 'stripe_redirect':
|
|
84
84
|
return theme.images.general.stripesb
|
|
85
|
+
case 'apple_pay':
|
|
86
|
+
return theme.images.general.applePayMark
|
|
85
87
|
default:
|
|
86
88
|
return theme.images.general.creditCard
|
|
87
89
|
}
|
|
@@ -142,29 +144,46 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
142
144
|
|
|
143
145
|
const renderPaymethods = ({ item }: any) => {
|
|
144
146
|
return (
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
key={item.id}
|
|
150
|
-
isDisabled={isDisabled}
|
|
151
|
-
isActive={paymethodSelected?.id === item.id}
|
|
152
|
-
>
|
|
153
|
-
<OIcon
|
|
154
|
-
src={getPayIcon(item.gateway)}
|
|
155
|
-
width={20}
|
|
156
|
-
height={20}
|
|
157
|
-
color={paymethodSelected?.id === item.id ? theme.colors.white : theme.colors.backgroundDark}
|
|
158
|
-
/>
|
|
159
|
-
<OText
|
|
160
|
-
size={10}
|
|
161
|
-
style={{ margin: 0, marginTop: 4 }}
|
|
162
|
-
color={paymethodSelected?.id === item.id ? theme.colors.white : '#000'}
|
|
147
|
+
<>
|
|
148
|
+
{item?.gateway === 'apple_pay' ? (
|
|
149
|
+
<TouchableOpacity
|
|
150
|
+
onPress={() => handlePaymentMethodClick(item)}
|
|
163
151
|
>
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
152
|
+
<OIcon
|
|
153
|
+
src={getPayIcon(item.gateway)}
|
|
154
|
+
width={70}
|
|
155
|
+
height={70}
|
|
156
|
+
style={{ marginRight: 10 }}
|
|
157
|
+
/>
|
|
158
|
+
</TouchableOpacity>
|
|
159
|
+
) : (
|
|
160
|
+
<TouchableOpacity
|
|
161
|
+
onPress={() => handlePaymentMethodClick(item)}
|
|
162
|
+
>
|
|
163
|
+
{console.log(item?.gateway)}
|
|
164
|
+
<PMItem
|
|
165
|
+
key={item.id}
|
|
166
|
+
isDisabled={isDisabled}
|
|
167
|
+
isActive={paymethodSelected?.id === item.id}
|
|
168
|
+
>
|
|
169
|
+
<OIcon
|
|
170
|
+
src={getPayIcon(item.gateway)}
|
|
171
|
+
width={20}
|
|
172
|
+
height={20}
|
|
173
|
+
color={item?.gateway === 'apple_pay' ? '' : paymethodSelected?.id === item.id ? theme.colors.white : theme.colors.backgroundDark}
|
|
174
|
+
/>
|
|
175
|
+
<OText
|
|
176
|
+
size={10}
|
|
177
|
+
style={{ margin: 0, marginTop: 4 }}
|
|
178
|
+
color={paymethodSelected?.id === item.id ? theme.colors.white : '#000'}
|
|
179
|
+
>
|
|
180
|
+
{t(item.gateway.toUpperCase(), item.name)}
|
|
181
|
+
</OText>
|
|
182
|
+
</PMItem>
|
|
183
|
+
</TouchableOpacity>
|
|
184
|
+
)}
|
|
185
|
+
</>
|
|
186
|
+
|
|
168
187
|
)
|
|
169
188
|
}
|
|
170
189
|
|
|
@@ -61,13 +61,13 @@ const StripeElementsFormUI = (props: any) => {
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
if (user?.address) {
|
|
64
|
-
billingDetails.
|
|
64
|
+
billingDetails.address.line1 = user?.address
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
const createPayMethod = async () => {
|
|
68
|
-
const params: any = {
|
|
68
|
+
const params: any = { paymentMethodType: 'Card', paymentMethodData: {} }
|
|
69
69
|
if (Object.keys(billingDetails).length > 0) {
|
|
70
|
-
params.billingDetails = billingDetails
|
|
70
|
+
params.paymentMethodData.billingDetails = {...billingDetails, token: card?.last4}
|
|
71
71
|
}
|
|
72
72
|
try {
|
|
73
73
|
setCreatePmLoading(true)
|
|
@@ -94,16 +94,16 @@ const StripeElementsFormUI = (props: any) => {
|
|
|
94
94
|
setErrors(error?.message || error?.toString());
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
|
-
|
|
97
|
+
|
|
98
98
|
const handleSaveCard = async () => {
|
|
99
99
|
setErrors('');
|
|
100
100
|
if (!requirements) {
|
|
101
101
|
createPayMethod();
|
|
102
102
|
return
|
|
103
103
|
}
|
|
104
|
-
const params: any = {
|
|
104
|
+
const params: any = { paymentMethodType: 'Card', paymentMethodData: {} }
|
|
105
105
|
if (Object.keys(billingDetails).length > 0) {
|
|
106
|
-
params.billingDetails = billingDetails
|
|
106
|
+
params.paymentMethodData.billingDetails = {...billingDetails, token: card?.last4}
|
|
107
107
|
}
|
|
108
108
|
try {
|
|
109
109
|
const { setupIntent, error } = await confirmSetupIntent(requirements, params);
|