boxpay-checkout-reactnative-sdk 1.0.5 → 1.0.6-beta1
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/lib/module/components/checkboxContainer.js +65 -0
- package/lib/module/components/checkboxContainer.js.map +1 -0
- package/lib/module/components/imageLoader.js +4 -1
- package/lib/module/components/imageLoader.js.map +1 -1
- package/lib/module/components/savedCardComponent.js +39 -2
- package/lib/module/components/savedCardComponent.js.map +1 -1
- package/lib/module/index.js +2 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/interface.js +1 -0
- package/lib/module/interface.js.map +1 -1
- package/lib/module/postRequest/cardPostRequest.js +4 -1
- package/lib/module/postRequest/cardPostRequest.js.map +1 -1
- package/lib/module/postRequest/upiPostRequest.js +8 -1
- package/lib/module/postRequest/upiPostRequest.js.map +1 -1
- package/lib/module/screens/cardScreen.js +9 -1
- package/lib/module/screens/cardScreen.js.map +1 -1
- package/lib/module/screens/mainScreen.js +10 -8
- package/lib/module/screens/mainScreen.js.map +1 -1
- package/lib/module/screens/upiScreen.js +1 -1
- package/lib/module/screens/upiScreen.js.map +1 -1
- package/lib/module/sdk-version.json +1 -1
- package/lib/module/sharedContext/checkoutDetailsHandler.js +6 -2
- package/lib/module/sharedContext/checkoutDetailsHandler.js.map +1 -1
- package/lib/typescript/src/components/checkboxContainer.d.ts +8 -0
- package/lib/typescript/src/components/checkboxContainer.d.ts.map +1 -0
- package/lib/typescript/src/components/imageLoader.d.ts.map +1 -1
- package/lib/typescript/src/components/savedCardComponent.d.ts +1 -1
- package/lib/typescript/src/components/savedCardComponent.d.ts.map +1 -1
- package/lib/typescript/src/interface.d.ts +9 -1
- package/lib/typescript/src/interface.d.ts.map +1 -1
- package/lib/typescript/src/postRequest/cardPostRequest.d.ts +1 -1
- package/lib/typescript/src/postRequest/cardPostRequest.d.ts.map +1 -1
- package/lib/typescript/src/postRequest/upiPostRequest.d.ts +1 -1
- package/lib/typescript/src/postRequest/upiPostRequest.d.ts.map +1 -1
- package/lib/typescript/src/screens/cardScreen.d.ts.map +1 -1
- package/lib/typescript/src/screens/mainScreen.d.ts.map +1 -1
- package/lib/typescript/src/sharedContext/checkoutDetailsHandler.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/components/checkboxContainer.tsx +66 -0
- package/src/components/imageLoader.tsx +4 -1
- package/src/components/savedCardComponent.tsx +47 -7
- package/src/index.tsx +3 -3
- package/src/interface.ts +10 -1
- package/src/postRequest/cardPostRequest.ts +5 -1
- package/src/postRequest/upiPostRequest.tsx +6 -1
- package/src/screens/cardScreen.tsx +28 -14
- package/src/screens/mainScreen.tsx +12 -8
- package/src/screens/upiScreen.tsx +1 -1
- package/src/sdk-version.json +1 -1
- package/src/sharedContext/checkoutDetailsHandler.ts +6 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkoutDetailsHandler.d.ts","sourceRoot":"","sources":["../../../../src/sharedContext/checkoutDetailsHandler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpD,MAAM,MAAM,sBAAsB,GAAG;IACnC,eAAe,EAAE,eAAe,CAAC;CAClC,CAAC;AAEF,eAAO,IAAI,sBAAsB,EAAE,
|
|
1
|
+
{"version":3,"file":"checkoutDetailsHandler.d.ts","sourceRoot":"","sources":["../../../../src/sharedContext/checkoutDetailsHandler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpD,MAAM,MAAM,sBAAsB,GAAG;IACnC,eAAe,EAAE,eAAe,CAAC;CAClC,CAAC;AAEF,eAAO,IAAI,sBAAsB,EAAE,sBA4ClC,CAAC;AAEF,eAAO,MAAM,yBAAyB,GAAI,SAAS,sBAAsB,SAExE,CAAC;AAEF,eAAO,MAAM,kCAAkC,YA8C9C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "boxpay-checkout-reactnative-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6-beta1",
|
|
4
4
|
"description": "Boxpay Payment Gateway",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|
|
@@ -57,6 +57,8 @@
|
|
|
57
57
|
"registry": "https://registry.npmjs.org/"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
|
+
"@react-navigation/native": "^7.1.17",
|
|
61
|
+
"@react-navigation/native-stack": "^7.3.26",
|
|
60
62
|
"@commitlint/config-conventional": "^19.6.0",
|
|
61
63
|
"@eslint/compat": "^1.2.7",
|
|
62
64
|
"@eslint/eslintrc": "^3.3.0",
|
|
@@ -86,8 +88,6 @@
|
|
|
86
88
|
"react-native-country-picker-modal": "^2.0.0",
|
|
87
89
|
"react-native-render-html" : "^6.3.4",
|
|
88
90
|
|
|
89
|
-
"@react-navigation/native": "^7.1.17",
|
|
90
|
-
"@react-navigation/native-stack": "^7.3.26",
|
|
91
91
|
"lottie-react-native": "^7.3.4",
|
|
92
92
|
"react-native-modal": "^14.0.0-rc.1",
|
|
93
93
|
"react-native-svg": ">=15.0.0"
|
|
@@ -145,7 +145,7 @@
|
|
|
145
145
|
"create-react-native-library": {
|
|
146
146
|
"languages": "js",
|
|
147
147
|
"type": "library",
|
|
148
|
-
"version": "1.0.
|
|
148
|
+
"version": "1.0.6-beta1"
|
|
149
149
|
},
|
|
150
150
|
"dependencies": {
|
|
151
151
|
"axios": "^1.11.0",
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { View, Text, TouchableOpacity, StyleSheet } from 'react-native';
|
|
2
|
+
import { checkoutDetailsHandler } from '../sharedContext/checkoutDetailsHandler';
|
|
3
|
+
|
|
4
|
+
interface CheckBoxContainerProps {
|
|
5
|
+
text : string,
|
|
6
|
+
isCheckBoxSelected : boolean,
|
|
7
|
+
onCheckBoxClicked : () => void
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const CheckBoxContainer = ({text, isCheckBoxSelected, onCheckBoxClicked} : CheckBoxContainerProps) =>{
|
|
11
|
+
const {checkoutDetails} = checkoutDetailsHandler
|
|
12
|
+
return(
|
|
13
|
+
<View
|
|
14
|
+
style={styles.checkBoxContainer}>
|
|
15
|
+
<TouchableOpacity
|
|
16
|
+
onPress={() => onCheckBoxClicked()}
|
|
17
|
+
>
|
|
18
|
+
<View style={[
|
|
19
|
+
styles.checkboxBox,
|
|
20
|
+
{ borderColor: checkoutDetails.buttonColor },
|
|
21
|
+
isCheckBoxSelected && { backgroundColor: checkoutDetails.buttonColor }
|
|
22
|
+
]}>
|
|
23
|
+
{isCheckBoxSelected && (
|
|
24
|
+
<Text style={styles.checkmark}>✓</Text>
|
|
25
|
+
)}
|
|
26
|
+
</View>
|
|
27
|
+
</TouchableOpacity>
|
|
28
|
+
<Text
|
|
29
|
+
style={[styles.checkBoxText, {fontFamily: checkoutDetails.fontFamily.regular,}]}
|
|
30
|
+
>
|
|
31
|
+
{text}
|
|
32
|
+
</Text>
|
|
33
|
+
</View>
|
|
34
|
+
)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const styles = StyleSheet.create({
|
|
38
|
+
checkBoxContainer : {
|
|
39
|
+
flexDirection: 'row',
|
|
40
|
+
marginTop: 10,
|
|
41
|
+
alignItems: 'center'
|
|
42
|
+
},
|
|
43
|
+
checkBoxText : {
|
|
44
|
+
color: '#2D2B32',
|
|
45
|
+
fontSize: 14,
|
|
46
|
+
marginLeft: 6,
|
|
47
|
+
},
|
|
48
|
+
checkboxBox: {
|
|
49
|
+
width: 20,
|
|
50
|
+
height: 20,
|
|
51
|
+
borderWidth: 2,
|
|
52
|
+
borderRadius: 3,
|
|
53
|
+
justifyContent: 'center',
|
|
54
|
+
alignItems: 'center',
|
|
55
|
+
marginLeft: 8,
|
|
56
|
+
},
|
|
57
|
+
checkmark: {
|
|
58
|
+
color: '#fff',
|
|
59
|
+
fontSize: 13,
|
|
60
|
+
fontWeight: 'bold',
|
|
61
|
+
lineHeight: 16,
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
export default CheckBoxContainer
|
|
@@ -2,6 +2,8 @@ import { useState, useEffect } from "react";
|
|
|
2
2
|
import { SvgXml } from 'react-native-svg';
|
|
3
3
|
import ShimmerPlaceHolder from 'react-native-shimmer-placeholder';
|
|
4
4
|
import { Image, type ImageSourcePropType , View} from "react-native";
|
|
5
|
+
import callUIAnalytics from "../postRequest/callUIAnalytics";
|
|
6
|
+
import { AnalyticsEvents } from "../interface";
|
|
5
7
|
|
|
6
8
|
interface ImageLoaderProps {
|
|
7
9
|
image : string,
|
|
@@ -50,7 +52,8 @@ const ImageLoader = ({image , errorImage} : ImageLoaderProps) => {
|
|
|
50
52
|
}
|
|
51
53
|
setLoad(false);
|
|
52
54
|
})
|
|
53
|
-
.catch(() => {
|
|
55
|
+
.catch((error) => {
|
|
56
|
+
callUIAnalytics(AnalyticsEvents.SDK_CRASH, "Image loader componenet", `${error}`)
|
|
54
57
|
setImageError(true);
|
|
55
58
|
setLoad(false);
|
|
56
59
|
});
|
|
@@ -4,10 +4,12 @@ import { RadioButton } from 'react-native-paper';
|
|
|
4
4
|
import { checkoutDetailsHandler } from '../sharedContext/checkoutDetailsHandler';
|
|
5
5
|
import ImageLoader from './imageLoader';
|
|
6
6
|
import type { PaymentClass } from '../interface';
|
|
7
|
+
import { useState } from 'react';
|
|
8
|
+
import CheckBoxContainer from './checkboxContainer';
|
|
7
9
|
|
|
8
10
|
interface SavedCardComponentViewProps {
|
|
9
11
|
savedCards: PaymentClass[];
|
|
10
|
-
onProceedForward: (instrumentValue: string) => void;
|
|
12
|
+
onProceedForward: (instrumentValue: string, isSICheckBoxClicked : boolean) => void;
|
|
11
13
|
errorImage: ImageSourcePropType;
|
|
12
14
|
onClickAddCard: () => void;
|
|
13
15
|
onClickRadio: (selectedInstrumentValue: string) => void;
|
|
@@ -106,10 +108,10 @@ interface SavedCardRowProps {
|
|
|
106
108
|
cardNumber: string;
|
|
107
109
|
image: string;
|
|
108
110
|
errorImage: ImageSourcePropType;
|
|
109
|
-
isSelected: boolean
|
|
111
|
+
isSelected: boolean;
|
|
110
112
|
instrumentTypeValue: string;
|
|
111
113
|
onPress: (id: string) => void;
|
|
112
|
-
onProceedForward: (instrumentValue: string) => void;
|
|
114
|
+
onProceedForward: (instrumentValue: string, isSICheckBoxClicked : boolean) => void;
|
|
113
115
|
brandColor: string;
|
|
114
116
|
currencySymbol: string;
|
|
115
117
|
amount: string;
|
|
@@ -127,9 +129,10 @@ const SavedCardRow = ({
|
|
|
127
129
|
onProceedForward,
|
|
128
130
|
brandColor,
|
|
129
131
|
currencySymbol,
|
|
130
|
-
amount
|
|
132
|
+
amount
|
|
131
133
|
}: SavedCardRowProps) => {
|
|
132
134
|
const { checkoutDetails } = checkoutDetailsHandler;
|
|
135
|
+
const [isSICheckBoxClicked, setIsSICheckBoxClicked] = useState(false)
|
|
133
136
|
return (
|
|
134
137
|
<View
|
|
135
138
|
style={{
|
|
@@ -173,16 +176,28 @@ const SavedCardRow = ({
|
|
|
173
176
|
<RadioButton
|
|
174
177
|
value={id}
|
|
175
178
|
status={isSelected ? 'checked' : 'unchecked'}
|
|
176
|
-
onPress={() =>
|
|
179
|
+
onPress={() => {
|
|
180
|
+
setIsSICheckBoxClicked(false)
|
|
181
|
+
onPress(id)
|
|
182
|
+
}}
|
|
177
183
|
color={brandColor}
|
|
178
184
|
uncheckedColor={'#01010273'}
|
|
179
185
|
/>
|
|
180
186
|
</View>
|
|
187
|
+
{(checkoutDetails.isSICheckboxVisible && isSelected) && (
|
|
188
|
+
<CheckBoxContainer
|
|
189
|
+
text = {"Set up Standing Instructions (SI) for this payment."}
|
|
190
|
+
isCheckBoxSelected = {isSICheckBoxClicked}
|
|
191
|
+
onCheckBoxClicked = {() => {
|
|
192
|
+
setIsSICheckBoxClicked(!isSICheckBoxClicked)
|
|
193
|
+
}}
|
|
194
|
+
/>
|
|
195
|
+
)}
|
|
181
196
|
{isSelected && (
|
|
182
197
|
<Pressable
|
|
183
198
|
style={[styles.buttonContainer, { backgroundColor: brandColor }]}
|
|
184
199
|
onPress={() => {
|
|
185
|
-
onProceedForward(instrumentTypeValue);
|
|
200
|
+
onProceedForward(instrumentTypeValue, isSICheckBoxClicked);
|
|
186
201
|
}}
|
|
187
202
|
>
|
|
188
203
|
<Text style={[styles.buttonText, {fontFamily: checkoutDetails.fontFamily.semiBold,}]}>
|
|
@@ -227,5 +242,30 @@ const styles = StyleSheet.create({
|
|
|
227
242
|
paddingHorizontal: 4,
|
|
228
243
|
marginTop: 4,
|
|
229
244
|
alignSelf: 'flex-start',
|
|
230
|
-
}
|
|
245
|
+
},
|
|
246
|
+
checkBoxContainer : {
|
|
247
|
+
flexDirection: 'row',
|
|
248
|
+
marginTop: 10,
|
|
249
|
+
alignItems: 'center'
|
|
250
|
+
},
|
|
251
|
+
checkBoxText : {
|
|
252
|
+
color: '#2D2B32',
|
|
253
|
+
fontSize: 14,
|
|
254
|
+
marginLeft: 6,
|
|
255
|
+
},
|
|
256
|
+
checkboxBox: {
|
|
257
|
+
width: 20,
|
|
258
|
+
height: 20,
|
|
259
|
+
borderWidth: 2,
|
|
260
|
+
borderRadius: 3,
|
|
261
|
+
justifyContent: 'center',
|
|
262
|
+
alignItems: 'center',
|
|
263
|
+
marginLeft: 8,
|
|
264
|
+
},
|
|
265
|
+
checkmark: {
|
|
266
|
+
color: '#fff',
|
|
267
|
+
fontSize: 13,
|
|
268
|
+
fontWeight: 'bold',
|
|
269
|
+
lineHeight: 16,
|
|
270
|
+
}
|
|
231
271
|
});
|
package/src/index.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { BoxpayCheckoutProps} from './interface';
|
|
2
|
+
import { View } from 'react-native';
|
|
2
3
|
import styles from './styles/indexStyles';
|
|
3
|
-
import { SafeAreaView } from 'react-native-safe-area-context';
|
|
4
4
|
import CheckoutContainer from './navigation';
|
|
5
5
|
|
|
6
6
|
const BoxpayCheckout = ({
|
|
@@ -11,7 +11,7 @@ const BoxpayCheckout = ({
|
|
|
11
11
|
uiConfiguration = null
|
|
12
12
|
}: BoxpayCheckoutProps) => {
|
|
13
13
|
return (
|
|
14
|
-
<
|
|
14
|
+
<View style={styles.screenView}>
|
|
15
15
|
<CheckoutContainer
|
|
16
16
|
token={token}
|
|
17
17
|
configurationOptions={configurationOptions}
|
|
@@ -19,7 +19,7 @@ const BoxpayCheckout = ({
|
|
|
19
19
|
shopperToken={shopperToken}
|
|
20
20
|
uiConfiguration={uiConfiguration}
|
|
21
21
|
/>
|
|
22
|
-
</
|
|
22
|
+
</View>
|
|
23
23
|
);
|
|
24
24
|
};
|
|
25
25
|
|
package/src/interface.ts
CHANGED
|
@@ -7,6 +7,7 @@ export enum ConfigurationOptions {
|
|
|
7
7
|
ShowBoxpaySuccessScreen = 'SHOW_BOXPAY_SUCCESS_SCREEN',
|
|
8
8
|
EnableSandboxEnv = 'ENABLE_SANDBOX_ENV',
|
|
9
9
|
ShowUPIQROnLoad = 'SHOW_UPI_QR_ON_LOAD',
|
|
10
|
+
ShowSICheckbox = 'SHOW_SI_CHECKBOX'
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
export enum UIConfigurationOptions {
|
|
@@ -75,7 +76,9 @@ export interface CheckoutDetails {
|
|
|
75
76
|
isUPIOtmIntentMethodEnabled : boolean,
|
|
76
77
|
isUPIOtmCollectMethodEnabled : boolean,
|
|
77
78
|
isUPIOtmQRMethodEnabled : boolean,
|
|
78
|
-
isOrderItemDetailsVisible : boolean
|
|
79
|
+
isOrderItemDetailsVisible : boolean,
|
|
80
|
+
isSICheckboxVisible : boolean,
|
|
81
|
+
isSubscriptionCheckout : boolean
|
|
79
82
|
}
|
|
80
83
|
|
|
81
84
|
interface AnalyticsResponse {
|
|
@@ -500,6 +503,7 @@ export interface SessionDetails {
|
|
|
500
503
|
dateOfBirth : string | null,
|
|
501
504
|
panNumber : string | null
|
|
502
505
|
},
|
|
506
|
+
subscriptionDetails : SubscriptionDetails | null,
|
|
503
507
|
order : OrderDetails | null
|
|
504
508
|
},
|
|
505
509
|
merchantDetails : {
|
|
@@ -528,6 +532,11 @@ interface OrderDetails {
|
|
|
528
532
|
items : OrderItem[] | null
|
|
529
533
|
}
|
|
530
534
|
|
|
535
|
+
interface SubscriptionDetails {
|
|
536
|
+
type : string,
|
|
537
|
+
maxAmountLocaleFull : string
|
|
538
|
+
}
|
|
539
|
+
|
|
531
540
|
export enum AnalyticsEvents {
|
|
532
541
|
CHECKOUT_LOADED = "CHECKOUT_LOADED",
|
|
533
542
|
ADDRESS_UPDATED = "ADDRESS_UPDATED",
|
|
@@ -11,7 +11,8 @@ const cardPostRequest = async (
|
|
|
11
11
|
cvv: string,
|
|
12
12
|
holderName: string,
|
|
13
13
|
cardNickName: string,
|
|
14
|
-
isCheckboxClicked: boolean
|
|
14
|
+
isCheckboxClicked: boolean,
|
|
15
|
+
isSICheckBoxClicked : boolean,
|
|
15
16
|
) : Promise<PaymentExecutedPostResponse> => {
|
|
16
17
|
const { checkoutDetails } = checkoutDetailsHandler;
|
|
17
18
|
const deviceDetails = getDeviceDetails()
|
|
@@ -36,6 +37,9 @@ const cardPostRequest = async (
|
|
|
36
37
|
: {}),
|
|
37
38
|
},
|
|
38
39
|
shopper: shopperData,
|
|
40
|
+
...(checkoutDetails.isSubscriptionCheckout
|
|
41
|
+
? { oneTimePayment: checkoutDetails.isSICheckboxVisible ? isSICheckBoxClicked : true }
|
|
42
|
+
: {}),
|
|
39
43
|
deviceDetails: deviceDetails,
|
|
40
44
|
};
|
|
41
45
|
callUIAnalytics(AnalyticsEvents.PAYMENT_CATEGORY_SELECTED,"Card Post Request",``)
|
|
@@ -3,15 +3,20 @@ import type { InstrumentDetails, PaymentExecutedPostResponse } from '../interfac
|
|
|
3
3
|
import { getBrowserData, getDeviceDetails, getShopperDetails } from '../utility';
|
|
4
4
|
import { AnalyticsEvents, APIStatus } from '../interface';
|
|
5
5
|
import callUIAnalytics from './callUIAnalytics';
|
|
6
|
+
import { checkoutDetailsHandler } from '../sharedContext/checkoutDetailsHandler';
|
|
6
7
|
|
|
7
|
-
const upiPostRequest = async (instrumentDetails: InstrumentDetails) : Promise<PaymentExecutedPostResponse> => {
|
|
8
|
+
const upiPostRequest = async (instrumentDetails: InstrumentDetails, isSICheckBoxClicked : boolean) : Promise<PaymentExecutedPostResponse> => {
|
|
8
9
|
const deviceDetails = getDeviceDetails()
|
|
9
10
|
const browserData = getBrowserData()
|
|
10
11
|
const shopperData = getShopperDetails()
|
|
12
|
+
const {checkoutDetails} = checkoutDetailsHandler
|
|
11
13
|
|
|
12
14
|
const requestBody = {
|
|
13
15
|
browserData: browserData,
|
|
14
16
|
instrumentDetails,
|
|
17
|
+
...((checkoutDetails.isSubscriptionCheckout && instrumentDetails.type === 'card/token')
|
|
18
|
+
? { oneTimePayment: checkoutDetails.isSICheckboxVisible ? isSICheckBoxClicked : true }
|
|
19
|
+
: {}),
|
|
15
20
|
shopper: shopperData,
|
|
16
21
|
deviceDetails: deviceDetails
|
|
17
22
|
};
|
|
@@ -31,6 +31,7 @@ import Toast from 'react-native-toast-message'
|
|
|
31
31
|
import { handleFetchStatusResponseHandler, handlePaymentResponse } from '../sharedContext/handlePaymentResponseHandler';
|
|
32
32
|
import type { CheckoutStackParamList } from '../navigation';
|
|
33
33
|
import { setUserDataHandlerToDefault } from '../sharedContext/userdataHandler';
|
|
34
|
+
import CheckBoxContainer from '../components/checkboxContainer';
|
|
34
35
|
|
|
35
36
|
type CardScreenRouteProp = RouteProp<CheckoutStackParamList, 'CardScreen'>;
|
|
36
37
|
|
|
@@ -108,6 +109,8 @@ const CardScreen = ({ route, navigation }: Props) => {
|
|
|
108
109
|
const [showKnowMoreDialog, setKnowMoreDialog] = useState(false);
|
|
109
110
|
const [isSavedCardCheckBoxClicked, setIsSavedCardCheckBoxClicked] =
|
|
110
111
|
useState(false);
|
|
112
|
+
|
|
113
|
+
const [isSICheckBoxClicked, setIsSICheckBoxClicked] = useState(false)
|
|
111
114
|
const [paymentUrl, setPaymentUrl] = useState<string | null>(null);
|
|
112
115
|
const [paymentHtml, setPaymentHtml] = useState<string | null>(null);
|
|
113
116
|
const [showWebView, setShowWebView] = useState(false);
|
|
@@ -504,7 +507,8 @@ const CardScreen = ({ route, navigation }: Props) => {
|
|
|
504
507
|
cardCvvText || '',
|
|
505
508
|
cardHolderNameText || '',
|
|
506
509
|
cardNickNameText || '',
|
|
507
|
-
isSavedCardCheckBoxClicked
|
|
510
|
+
isSavedCardCheckBoxClicked,
|
|
511
|
+
isSICheckBoxClicked
|
|
508
512
|
);
|
|
509
513
|
}
|
|
510
514
|
handlePaymentResponse({
|
|
@@ -982,18 +986,18 @@ const CardScreen = ({ route, navigation }: Props) => {
|
|
|
982
986
|
style={styles.checkBoxContainer}
|
|
983
987
|
>
|
|
984
988
|
<TouchableOpacity
|
|
985
|
-
|
|
986
|
-
>
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
</TouchableOpacity>
|
|
989
|
+
onPress={() => setIsSavedCardCheckBoxClicked(!isSavedCardCheckBoxClicked)}
|
|
990
|
+
>
|
|
991
|
+
<View style={[
|
|
992
|
+
styles.checkboxBox,
|
|
993
|
+
{ borderColor: checkoutDetails.buttonColor },
|
|
994
|
+
isSavedCardCheckBoxClicked && { backgroundColor: checkoutDetails.buttonColor }
|
|
995
|
+
]}>
|
|
996
|
+
{isSavedCardCheckBoxClicked && (
|
|
997
|
+
<Text style={styles.checkmark}>✓</Text>
|
|
998
|
+
)}
|
|
999
|
+
</View>
|
|
1000
|
+
</TouchableOpacity>
|
|
997
1001
|
<Text
|
|
998
1002
|
style={[styles.checkBoxText, {fontFamily: checkoutDetails.fontFamily.regular,}]}
|
|
999
1003
|
>
|
|
@@ -1014,9 +1018,19 @@ const CardScreen = ({ route, navigation }: Props) => {
|
|
|
1014
1018
|
Know more
|
|
1015
1019
|
</Text>
|
|
1016
1020
|
</Pressable>
|
|
1017
|
-
|
|
1021
|
+
</View>
|
|
1018
1022
|
</>
|
|
1019
1023
|
)}
|
|
1024
|
+
|
|
1025
|
+
{checkoutDetails.isSICheckboxVisible && (
|
|
1026
|
+
<CheckBoxContainer
|
|
1027
|
+
text = {"Set up Standing Instructions (SI) for this payment."}
|
|
1028
|
+
isCheckBoxSelected = {isSICheckBoxClicked}
|
|
1029
|
+
onCheckBoxClicked = {() => {
|
|
1030
|
+
setIsSICheckBoxClicked(!isSICheckBoxClicked)
|
|
1031
|
+
}}
|
|
1032
|
+
/>
|
|
1033
|
+
)}
|
|
1020
1034
|
<View
|
|
1021
1035
|
style={styles.pressableContainer}
|
|
1022
1036
|
>
|
|
@@ -104,7 +104,7 @@ const MainScreen = ({route, navigation} : MainScreenProps) => {
|
|
|
104
104
|
const response = await upiPostRequest({
|
|
105
105
|
type: checkoutDetailsHandler.checkoutDetails.isUPIOtmIntentMethodEnabled ? "upiotm/intent" : 'upi/intent',
|
|
106
106
|
...(selectedIntent && { upiAppDetails: { upiApp: selectedIntent } }), // Conditionally add upiAppDetails only if upiIntent is present
|
|
107
|
-
});
|
|
107
|
+
}, false);
|
|
108
108
|
handlePaymentResponse({
|
|
109
109
|
response: response,
|
|
110
110
|
checkoutDetailsErrorMessage: checkoutDetailsHandler.checkoutDetails.errorMessage,
|
|
@@ -130,7 +130,8 @@ const MainScreen = ({route, navigation} : MainScreenProps) => {
|
|
|
130
130
|
const handleUpiCollectPayment = async (
|
|
131
131
|
upiId: string,
|
|
132
132
|
instrumentRef: string,
|
|
133
|
-
type: string
|
|
133
|
+
type: string,
|
|
134
|
+
isSICheckBoxClicked : boolean
|
|
134
135
|
) => {
|
|
135
136
|
const requestPayload: InstrumentDetails =
|
|
136
137
|
type === 'Card'
|
|
@@ -145,7 +146,7 @@ const MainScreen = ({route, navigation} : MainScreenProps) => {
|
|
|
145
146
|
: { shopperVpa: upiId },
|
|
146
147
|
};
|
|
147
148
|
setLoadingState(true);
|
|
148
|
-
const response = await upiPostRequest(requestPayload);
|
|
149
|
+
const response = await upiPostRequest(requestPayload, isSICheckBoxClicked);
|
|
149
150
|
handlePaymentResponse({
|
|
150
151
|
response: response,
|
|
151
152
|
upiId: upiId,
|
|
@@ -582,7 +583,9 @@ const MainScreen = ({route, navigation} : MainScreenProps) => {
|
|
|
582
583
|
isUPIOtmCollectMethodEnabled : methodFlags.isUPIOtmCollectVisible,
|
|
583
584
|
isUPIOtmIntentMethodEnabled : methodFlags.isUPIIntentVisible,
|
|
584
585
|
isUPIOtmQRMethodEnabled : methodFlags.isUPIOtmQRVisible,
|
|
585
|
-
isOrderItemDetailsVisible : isFieldEnabled('ORDER_ITEM_DETAILS')
|
|
586
|
+
isOrderItemDetailsVisible : isFieldEnabled('ORDER_ITEM_DETAILS'),
|
|
587
|
+
isSICheckboxVisible : configurationOptions?.SHOW_SI_CHECKBOX ? true : false,
|
|
588
|
+
isSubscriptionCheckout : paymentDetails.subscriptionDetails != null ? true : false
|
|
586
589
|
},
|
|
587
590
|
});
|
|
588
591
|
setPaymentHandler({
|
|
@@ -825,7 +828,8 @@ const MainScreen = ({route, navigation} : MainScreenProps) => {
|
|
|
825
828
|
handleUpiCollectPayment(
|
|
826
829
|
displayValue,
|
|
827
830
|
instrumentValue,
|
|
828
|
-
type
|
|
831
|
+
type,
|
|
832
|
+
false
|
|
829
833
|
)
|
|
830
834
|
}
|
|
831
835
|
errorImage={require('../../assets/images/ic_upi.png')}
|
|
@@ -843,7 +847,7 @@ const MainScreen = ({route, navigation} : MainScreenProps) => {
|
|
|
843
847
|
handlePaymentIntent(selectedIntent)
|
|
844
848
|
}
|
|
845
849
|
handleCollectPayment={(displayValue : string, instrumentValue : string, type : string) =>
|
|
846
|
-
handleUpiCollectPayment(displayValue, instrumentValue, type)
|
|
850
|
+
handleUpiCollectPayment(displayValue, instrumentValue, type, false)
|
|
847
851
|
}
|
|
848
852
|
savedUpiArray={savedUpiArray}
|
|
849
853
|
onClickRadio={handleSavedUpiSectionClick}
|
|
@@ -870,8 +874,8 @@ const MainScreen = ({route, navigation} : MainScreenProps) => {
|
|
|
870
874
|
>
|
|
871
875
|
<SavedCardComponentView
|
|
872
876
|
savedCards={savedCardArray}
|
|
873
|
-
onProceedForward={(instrumentValue : string) => {
|
|
874
|
-
handleUpiCollectPayment('', instrumentValue, 'Card');
|
|
877
|
+
onProceedForward={(instrumentValue : string, isSICheckBoxClicked : boolean) => {
|
|
878
|
+
handleUpiCollectPayment('', instrumentValue, 'Card', isSICheckBoxClicked);
|
|
875
879
|
}}
|
|
876
880
|
errorImage={require('../../assets/images/ic_card.png')}
|
|
877
881
|
onClickAddCard={() => navigation.navigate("CardScreen", {})}
|
|
@@ -94,7 +94,7 @@ const UpiScreen: React.FC<UpiScreenProps> = ({
|
|
|
94
94
|
type: isUPIOtmQRVisible ? "upiotm/qr" : 'upi/qr',
|
|
95
95
|
}
|
|
96
96
|
setLoading(true);
|
|
97
|
-
const response = await upiPostRequest(requestPayload);
|
|
97
|
+
const response = await upiPostRequest(requestPayload, false);
|
|
98
98
|
handlePaymentResponse({
|
|
99
99
|
response: response,
|
|
100
100
|
checkoutDetailsErrorMessage: checkoutDetailsHandler.checkoutDetails.errorMessage,
|
package/src/sdk-version.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{ "version": "1.0.
|
|
1
|
+
{ "version": "1.0.6-beta1" }
|
|
@@ -44,7 +44,9 @@ export let checkoutDetailsHandler: CheckoutDetailsHandler = {
|
|
|
44
44
|
isUPIOtmIntentMethodEnabled : false,
|
|
45
45
|
isUPIOtmCollectMethodEnabled : false,
|
|
46
46
|
isUPIOtmQRMethodEnabled : false,
|
|
47
|
-
isOrderItemDetailsVisible : true
|
|
47
|
+
isOrderItemDetailsVisible : true,
|
|
48
|
+
isSICheckboxVisible : false,
|
|
49
|
+
isSubscriptionCheckout : false
|
|
48
50
|
},
|
|
49
51
|
};
|
|
50
52
|
|
|
@@ -93,7 +95,9 @@ export const setCheckOutDetailsHandlerToDefault = () => {
|
|
|
93
95
|
isUPIOtmIntentMethodEnabled: false,
|
|
94
96
|
isUPIOtmCollectMethodEnabled: false,
|
|
95
97
|
isUPIOtmQRMethodEnabled: false,
|
|
96
|
-
isOrderItemDetailsVisible : true
|
|
98
|
+
isOrderItemDetailsVisible : true,
|
|
99
|
+
isSICheckboxVisible : false,
|
|
100
|
+
isSubscriptionCheckout : false
|
|
97
101
|
},
|
|
98
102
|
};
|
|
99
103
|
};
|