ordering-ui-react-native 0.19.4-release → 0.19.5-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 +1 -1
- package/themes/original/src/components/PaymentOptionCard/index.tsx +4 -2
- package/themes/original/src/components/PaymentOptions/index.tsx +34 -1
- package/themes/original/src/components/StripeCardsList/index.tsx +2 -33
- package/themes/original/src/components/StripeElementsForm/index.tsx +4 -2
package/package.json
CHANGED
|
@@ -26,7 +26,7 @@ const PaymentOptionCardUI = (props: any) => {
|
|
|
26
26
|
const [alertState, setAlertState] = useState<{ open: boolean, content: Array<string> }>({ open: false, content: [] })
|
|
27
27
|
const [newCard, setNewCard] = useState<any>(null)
|
|
28
28
|
|
|
29
|
-
const onChangeCardForm = (values
|
|
29
|
+
const onChangeCardForm = (values: any) => {
|
|
30
30
|
if (values?.valid) {
|
|
31
31
|
const expiry = values?.values?.expiry?.split('/')
|
|
32
32
|
const expiryMonth = expiry[0]
|
|
@@ -107,6 +107,8 @@ const PaymentOptionCardUI = (props: any) => {
|
|
|
107
107
|
cardsList={cardsList}
|
|
108
108
|
noShowErrors
|
|
109
109
|
gateway={gateway}
|
|
110
|
+
onOpen={() => setAddCardOpen({ ...addCardOpen, stripe: true })}
|
|
111
|
+
onCancel={() => setAddCardOpen({ ...addCardOpen, stripe: false })}
|
|
110
112
|
/>
|
|
111
113
|
</>
|
|
112
114
|
<Modal
|
|
@@ -169,7 +171,7 @@ const PaymentOptionCardUI = (props: any) => {
|
|
|
169
171
|
)
|
|
170
172
|
}
|
|
171
173
|
|
|
172
|
-
export const PaymentOptionCard = (props
|
|
174
|
+
export const PaymentOptionCard = (props: any) => {
|
|
173
175
|
const paymentOptions = {
|
|
174
176
|
...props,
|
|
175
177
|
UIComponent: PaymentOptionCardUI
|
|
@@ -364,6 +364,7 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
364
364
|
methodPaySupported={methodPaySupported}
|
|
365
365
|
placeByMethodPay={placeByMethodPay}
|
|
366
366
|
setPlaceByMethodPay={setPlaceByMethodPay}
|
|
367
|
+
publicKeyAddCard={isOpenMethod?.paymethod?.credentials?.stripe?.publishable}
|
|
367
368
|
/>
|
|
368
369
|
)}
|
|
369
370
|
|
|
@@ -406,6 +407,7 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
406
407
|
handleSource={handlePaymethodDataChange}
|
|
407
408
|
onCancel={() => handlePaymethodClick(null)}
|
|
408
409
|
merchantId={merchantId}
|
|
410
|
+
publicKeyAddCard={isOpenMethod?.paymethod?.credentials?.stripe?.publishable}
|
|
409
411
|
/>
|
|
410
412
|
</KeyboardAvoidingView>
|
|
411
413
|
</OModal>
|
|
@@ -425,11 +427,12 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
425
427
|
<StripeCardsList
|
|
426
428
|
paymethod={isOpenMethod?.paymethod}
|
|
427
429
|
businessId={props.businessId}
|
|
428
|
-
publicKey={isOpenMethod?.paymethod?.credentials.publishable}
|
|
429
430
|
payType={paymethodsList?.name}
|
|
430
431
|
onSelectCard={handlePaymethodDataChange}
|
|
431
432
|
onNavigationRedirect={onNavigationRedirect}
|
|
432
433
|
onCancel={() => handlePaymethodClick(null)}
|
|
434
|
+
publicKey={isOpenMethod?.paymethod?.credentials.publishable}
|
|
435
|
+
publicKeyAddCard={isOpenMethod?.paymethod?.credentials?.stripe?.publishable}
|
|
433
436
|
/>
|
|
434
437
|
</View>
|
|
435
438
|
)}
|
|
@@ -446,6 +449,7 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
446
449
|
enabled={Platform.OS === 'ios' ? true : false}
|
|
447
450
|
>
|
|
448
451
|
<StripeElementsForm
|
|
452
|
+
openCarts={props.openCarts}
|
|
449
453
|
toSave
|
|
450
454
|
businessId={props.businessId}
|
|
451
455
|
publicKey={isOpenMethod?.paymethod?.credentials?.stripe?.publishable}
|
|
@@ -453,6 +457,35 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
453
457
|
accountId={isOpenMethod?.paymethod?.credentials?.user}
|
|
454
458
|
onSelectCard={handlePaymethodDataChange}
|
|
455
459
|
onCancel={() => setAddCardOpen({ ...addCardOpen, stripeConnect: false })}
|
|
460
|
+
publicKeyAddCard={isOpenMethod?.paymethod?.credentials?.stripe?.publishable}
|
|
461
|
+
/>
|
|
462
|
+
</KeyboardAvoidingView>
|
|
463
|
+
</OModal>
|
|
464
|
+
|
|
465
|
+
{/* Stripe Add card */}
|
|
466
|
+
<OModal
|
|
467
|
+
entireModal
|
|
468
|
+
title={t('ADD_CREDIT_OR_DEBIT_CARD', 'Add credit or debit card')}
|
|
469
|
+
open={addCardOpen?.stripe}
|
|
470
|
+
onClose={() => setAddCardOpen({ ...addCardOpen, stripe: false })}
|
|
471
|
+
style={{ backgroundColor: 'red' }}
|
|
472
|
+
>
|
|
473
|
+
<KeyboardAvoidingView
|
|
474
|
+
behavior={Platform.OS == 'ios' ? 'padding' : 'height'}
|
|
475
|
+
keyboardVerticalOffset={Platform.OS == 'ios' ? 0 : 0}
|
|
476
|
+
enabled={Platform.OS === 'ios' ? true : false}
|
|
477
|
+
>
|
|
478
|
+
<StripeElementsForm
|
|
479
|
+
openCarts={props.openCarts}
|
|
480
|
+
toSave
|
|
481
|
+
businessId={props.businessId}
|
|
482
|
+
businessIds={props.businessIds}
|
|
483
|
+
publicKey={props.publicKey || isOpenMethod?.paymethod?.credentials?.publishable}
|
|
484
|
+
setCardsList={setCardList}
|
|
485
|
+
requirements={props.clientSecret}
|
|
486
|
+
onSelectCard={handlePaymethodDataChange}
|
|
487
|
+
onCancel={() => setAddCardOpen({ ...addCardOpen, stripe: false })}
|
|
488
|
+
publicKeyAddCard={isOpenMethod?.paymethod?.credentials?.stripe?.publishable}
|
|
456
489
|
/>
|
|
457
490
|
</KeyboardAvoidingView>
|
|
458
491
|
</OModal>
|
|
@@ -29,12 +29,8 @@ export const StripeCardsListUI = (props: any) => {
|
|
|
29
29
|
cardSelected,
|
|
30
30
|
cardsList,
|
|
31
31
|
handleCardClick,
|
|
32
|
-
|
|
32
|
+
onOpen,
|
|
33
33
|
gateway,
|
|
34
|
-
setCardsList,
|
|
35
|
-
addCardOpen,
|
|
36
|
-
isOpenMethod,
|
|
37
|
-
handlePaymethodDataChange
|
|
38
34
|
} = props;
|
|
39
35
|
|
|
40
36
|
const theme = useTheme();
|
|
@@ -54,7 +50,7 @@ export const StripeCardsListUI = (props: any) => {
|
|
|
54
50
|
|
|
55
51
|
useEffect(() => {
|
|
56
52
|
if (!cardsList?.loading && cardsList?.cards?.length === 0 && !paymethodsWithoutSaveCards.includes(gateway)) {
|
|
57
|
-
|
|
53
|
+
onOpen && onOpen();
|
|
58
54
|
}
|
|
59
55
|
}, [cardsList?.loading])
|
|
60
56
|
|
|
@@ -147,33 +143,6 @@ export const StripeCardsListUI = (props: any) => {
|
|
|
147
143
|
))}
|
|
148
144
|
</ScrollView>
|
|
149
145
|
)}
|
|
150
|
-
<OModal
|
|
151
|
-
entireModal
|
|
152
|
-
title={t('ADD_CREDIT_OR_DEBIT_CARD', 'Add credit or debit card')}
|
|
153
|
-
open={addCardOpen.stripe}
|
|
154
|
-
onClose={() => setAddCardOpen({ ...addCardOpen, stripe: false })}
|
|
155
|
-
style={{ backgroundColor: 'red' }}
|
|
156
|
-
>
|
|
157
|
-
<KeyboardAvoidingView
|
|
158
|
-
behavior={Platform.OS == 'ios' ? 'padding' : 'height'}
|
|
159
|
-
keyboardVerticalOffset={Platform.OS == 'ios' ? 0 : 0}
|
|
160
|
-
enabled={Platform.OS === 'ios' ? true : false}
|
|
161
|
-
>
|
|
162
|
-
<StripeElementsForm
|
|
163
|
-
openCarts={props.openCarts}
|
|
164
|
-
toSave
|
|
165
|
-
businessId={props.businessId}
|
|
166
|
-
businessIds={props.businessIds}
|
|
167
|
-
publicKey={props.publicKey || isOpenMethod?.paymethod?.credentials?.publishable}
|
|
168
|
-
setCardsList={setCardsList}
|
|
169
|
-
cardsList={cardsList}
|
|
170
|
-
requirements={props.clientSecret}
|
|
171
|
-
handleCardClick={handleCardClick}
|
|
172
|
-
onSelectCard={handlePaymethodDataChange}
|
|
173
|
-
onCancel={() => setAddCardOpen({ ...addCardOpen, stripe: false })}
|
|
174
|
-
/>
|
|
175
|
-
</KeyboardAvoidingView>
|
|
176
|
-
</OModal>
|
|
177
146
|
</>
|
|
178
147
|
)
|
|
179
148
|
}
|
|
@@ -33,7 +33,8 @@ const StripeElementsFormUI = (props: any) => {
|
|
|
33
33
|
placeByMethodPay,
|
|
34
34
|
methodPaySupported,
|
|
35
35
|
setPlaceByMethodPay,
|
|
36
|
-
cartTotal
|
|
36
|
+
cartTotal,
|
|
37
|
+
publicKeyAddCard
|
|
37
38
|
} = props;
|
|
38
39
|
|
|
39
40
|
const theme = useTheme();
|
|
@@ -52,6 +53,7 @@ const StripeElementsFormUI = (props: any) => {
|
|
|
52
53
|
const [isKeyboardShow, setIsKeyboardShow] = useState(false);
|
|
53
54
|
const zipCodeEnabled = validationFields?.fields?.card?.zipcode?.enabled
|
|
54
55
|
const zipCodeRequired = validationFields?.fields?.card?.zipcode?.required
|
|
56
|
+
const isToSave = methodsPay?.includes(paymethod) ? publicKey : publicKeyAddCard
|
|
55
57
|
const styles = StyleSheet.create({
|
|
56
58
|
container: {
|
|
57
59
|
width: '100%',
|
|
@@ -200,7 +202,7 @@ const StripeElementsFormUI = (props: any) => {
|
|
|
200
202
|
{publicKey ? (
|
|
201
203
|
<View style={{ flex: 1 }}>
|
|
202
204
|
<StripeProvider
|
|
203
|
-
publishableKey={
|
|
205
|
+
publishableKey={isToSave}
|
|
204
206
|
merchantIdentifier={merchantId}
|
|
205
207
|
urlScheme={merchantId}
|
|
206
208
|
>
|