@fadyshawky/react-native-magic 2.0.5 → 2.0.7
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/template/App.tsx +21 -16
- package/template/ios/reactnativemagic/AppDelegate.mm +5 -0
- package/template/src/common/ImageResources.g.ts +1 -33
- package/template/src/common/components/Background.tsx +7 -7
- package/template/src/common/components/Container.tsx +7 -10
- package/template/src/common/localization/LocalizationProvider.tsx +14 -17
- package/template/src/common/localization/RTLInitializer.tsx +90 -0
- package/template/src/common/localization/intlFormatter.ts +37 -0
- package/template/src/common/localization/localization.ts +1 -3
- package/template/src/common/localization/translations/commonLocalization.ts +11 -81
- package/template/src/common/localization/translations/emptyLocalization.ts +6 -2
- package/template/src/common/localization/translations/errorsLocalization.ts +33 -13
- package/template/src/common/localization/translations/homeLocalization.ts +4 -24
- package/template/src/common/localization/translations/loginLocalization.ts +26 -29
- package/template/src/common/localization/translations/mainNavigationLocalization.ts +2 -2
- package/template/src/common/localization/translations/onboardingLocalization.ts +40 -9
- package/template/src/common/localization/translations/otpLocalization.ts +8 -8
- package/template/src/common/localization/translations/pagesLocalization.ts +13 -1
- package/template/src/common/localization/translations/passwordLocalization.ts +3 -3
- package/template/src/common/localization/translations/profileLocalization.ts +4 -4
- package/template/src/core/store/app/appSlice.ts +2 -2
- package/template/src/core/store/app/appState.ts +1 -1
- package/template/src/core/theme/colors.ts +106 -70
- package/template/src/core/theme/commonConsts.ts +1 -1
- package/template/src/core/theme/commonSizes.ts +119 -94
- package/template/src/core/theme/commonStyles.ts +22 -22
- package/template/src/core/theme/fonts.ts +13 -14
- package/template/src/core/theme/shadows.ts +135 -0
- package/template/src/core/theme/themes.ts +386 -75
- package/template/src/core/theme/types.ts +201 -15
- package/template/src/navigation/HeaderComponents.tsx +6 -30
- package/template/src/navigation/MainNavigation.tsx +2 -3
- package/template/src/navigation/MainStack.tsx +6 -97
- package/template/src/screens/Login/Login.tsx +5 -7
- package/template/src/screens/OTP/OTPScreen.tsx +12 -13
- package/template/src/screens/home/HomeScreen.tsx +2 -295
- package/template/src/screens/profile/Profile.tsx +2 -290
- package/template/src/common/localization/translations/posLocalization.ts +0 -196
- package/template/src/components/PrinterExample.js +0 -226
- package/template/src/core/store/Categories/categoryActions.ts +0 -33
- package/template/src/core/store/Categories/categorySlice.ts +0 -75
- package/template/src/core/store/Categories/categoryState.ts +0 -41
- package/template/src/core/store/Providers/providersActions.ts +0 -102
- package/template/src/core/store/Providers/providersSlice.ts +0 -136
- package/template/src/core/store/Providers/providersState.ts +0 -37
- package/template/src/core/store/Services/servicesActions.ts +0 -191
- package/template/src/core/store/Services/servicesSlice.ts +0 -205
- package/template/src/core/store/Services/servicesState.ts +0 -466
- package/template/src/modules/SunmiCard.js +0 -212
- package/template/src/modules/SunmiPrepaid.ts +0 -122
- package/template/src/screens/Categories/Categories.tsx +0 -141
- package/template/src/screens/Categories/hooks/useCategoriesData.ts +0 -33
- package/template/src/screens/Categories/types.ts +0 -7
- package/template/src/screens/Favorites/Favorites.tsx +0 -130
- package/template/src/screens/ForceChangePassword/ForceChangePasswordScreen.tsx +0 -155
- package/template/src/screens/History/History.tsx +0 -430
- package/template/src/screens/History/hooks/useHistoryData.ts +0 -49
- package/template/src/screens/History/types.ts +0 -7
- package/template/src/screens/InquiredBill/InquiredBill.tsx +0 -443
- package/template/src/screens/InquiredBill/hooks/useInquiredData.ts +0 -91
- package/template/src/screens/PaymentConfirmation/PaymentConfirmation.tsx +0 -326
- package/template/src/screens/Providers/Providers.tsx +0 -166
- package/template/src/screens/Providers/hooks/useProvidersData.ts +0 -33
- package/template/src/screens/Providers/types.ts +0 -7
- package/template/src/screens/ReceiptScreen/ReceiptScreen.tsx +0 -181
- package/template/src/screens/ReceiptScreen/hooks/useReceiptData.ts +0 -46
- package/template/src/screens/ReceiptScreen/utils/utils.tsx +0 -156
- package/template/src/screens/Services/Services.tsx +0 -144
- package/template/src/screens/Services/hooks/useServicesData.ts +0 -41
- package/template/src/screens/SingleService/Components/FawryInputs.tsx +0 -446
- package/template/src/screens/SingleService/SingleService.tsx +0 -229
- package/template/src/screens/SingleService/hooks/useServiceData.ts +0 -164
- package/template/src/services/SunmiPrinterInternal.js +0 -268
- package/template/src/types/sunmiPrepaid.d.ts +0 -20
- package/template/src/utils/SunmiPrinter.ts +0 -442
- package/template/src/utils/feesCalculator.ts +0 -92
|
@@ -1,443 +0,0 @@
|
|
|
1
|
-
import {useNavigation} from '@react-navigation/native';
|
|
2
|
-
import {NativeStackNavigationProp} from '@react-navigation/native-stack';
|
|
3
|
-
import React, {Dispatch, SetStateAction, useEffect, useRef} from 'react';
|
|
4
|
-
import {
|
|
5
|
-
Image,
|
|
6
|
-
ImageResizeMode,
|
|
7
|
-
ImageStyle,
|
|
8
|
-
ImageURISource,
|
|
9
|
-
View,
|
|
10
|
-
ViewStyle,
|
|
11
|
-
} from 'react-native';
|
|
12
|
-
import {KeyboardAwareScrollView} from 'react-native-keyboard-aware-scroll-view';
|
|
13
|
-
import {Container} from '../../common/components/Container';
|
|
14
|
-
import {PrimaryButton} from '../../common/components/PrimaryButton';
|
|
15
|
-
import {PrimaryTextInput} from '../../common/components/PrimaryTextInput';
|
|
16
|
-
import {RTLAwareText} from '../../common/components/RTLAwareText';
|
|
17
|
-
import {
|
|
18
|
-
RTLAwareTouchableOpacity,
|
|
19
|
-
RTLAwareView,
|
|
20
|
-
} from '../../common/components/RTLAwareView';
|
|
21
|
-
import {ImageResources} from '../../common/ImageResources.g';
|
|
22
|
-
import {useTranslation} from '../../common/localization/LocalizationProvider';
|
|
23
|
-
import {useAppSelector} from '../../core/store/reduxHelpers';
|
|
24
|
-
import {RootState} from '../../core/store/rootReducer';
|
|
25
|
-
import {CommonSizes} from '../../core/theme/commonSizes';
|
|
26
|
-
import {createThemedStyles} from '../../core/theme/commonStyles';
|
|
27
|
-
import {scaleHeight, scaleWidth} from '../../core/theme/scaling';
|
|
28
|
-
import {useTheme} from '../../core/theme/ThemeProvider';
|
|
29
|
-
import {Theme} from '../../core/theme/types';
|
|
30
|
-
import {HeaderBack} from '../../navigation/HeaderComponents';
|
|
31
|
-
import {RootStackParamList} from '../../navigation/types';
|
|
32
|
-
import {useInquiredData} from './hooks/useInquiredData';
|
|
33
|
-
import {SkypeIndicator} from 'react-native-indicators';
|
|
34
|
-
import {ButtonType} from '../../../types';
|
|
35
|
-
|
|
36
|
-
// Reusable components
|
|
37
|
-
const BillHeader = ({
|
|
38
|
-
serviceName,
|
|
39
|
-
billLabel,
|
|
40
|
-
}: {
|
|
41
|
-
serviceName: string;
|
|
42
|
-
billLabel?: string;
|
|
43
|
-
}) => {
|
|
44
|
-
const {theme} = useTheme();
|
|
45
|
-
return (
|
|
46
|
-
<>
|
|
47
|
-
<RTLAwareText style={styles.headerText(theme)}>
|
|
48
|
-
{serviceName}
|
|
49
|
-
</RTLAwareText>
|
|
50
|
-
{billLabel && (
|
|
51
|
-
<RTLAwareText style={styles.headerText(theme)}>
|
|
52
|
-
{billLabel}
|
|
53
|
-
</RTLAwareText>
|
|
54
|
-
)}
|
|
55
|
-
</>
|
|
56
|
-
);
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
const ProviderImage = ({imageUrl}: {imageUrl: string}) => {
|
|
60
|
-
return <Image source={{uri: imageUrl}} style={styles.sectionImage} />;
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
const BillAmount = ({title, amount}: {title: string; amount: string}) => {
|
|
64
|
-
const {theme} = useTheme();
|
|
65
|
-
return (
|
|
66
|
-
<>
|
|
67
|
-
<RTLAwareText style={styles.subheaderText(theme)}>{title}</RTLAwareText>
|
|
68
|
-
<RTLAwareText style={styles.subheaderText(theme)}>{amount}</RTLAwareText>
|
|
69
|
-
</>
|
|
70
|
-
);
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
const AmountInput = ({
|
|
74
|
-
paymentType,
|
|
75
|
-
currencyCode,
|
|
76
|
-
amount1,
|
|
77
|
-
amount2,
|
|
78
|
-
value,
|
|
79
|
-
setAmount,
|
|
80
|
-
}: {
|
|
81
|
-
paymentType: string;
|
|
82
|
-
currencyCode: string;
|
|
83
|
-
amount1: string;
|
|
84
|
-
amount2: string;
|
|
85
|
-
value: string;
|
|
86
|
-
|
|
87
|
-
setAmount: Dispatch<SetStateAction<string>>;
|
|
88
|
-
}) => {
|
|
89
|
-
const {theme} = useTheme();
|
|
90
|
-
const {service} = useAppSelector((state: RootState) => state.services);
|
|
91
|
-
const t = useTranslation();
|
|
92
|
-
|
|
93
|
-
return (
|
|
94
|
-
<RTLAwareView style={styles.amountInputContainer}>
|
|
95
|
-
<PrimaryTextInput
|
|
96
|
-
editable={
|
|
97
|
-
service?.PaymentRules?.IsFracAcpt && paymentType === 'partial'
|
|
98
|
-
}
|
|
99
|
-
onChangeText={text =>
|
|
100
|
-
setAmount(
|
|
101
|
-
service?.PaymentRules?.IsFracAcpt ? text : Number(text).toString(),
|
|
102
|
-
)
|
|
103
|
-
}
|
|
104
|
-
width={'30%'}
|
|
105
|
-
placeholder={t('amount', 'common')}
|
|
106
|
-
keyboardType={'numeric'}
|
|
107
|
-
value={value}
|
|
108
|
-
/>
|
|
109
|
-
<Image source={ImageResources.arrows} style={styles.arrowsImage} />
|
|
110
|
-
<RTLAwareText style={styles.bodyText(theme)}>
|
|
111
|
-
{`${currencyCode || ''} ${
|
|
112
|
-
(Number(amount1) || 0) + (Number(amount2) || 0)
|
|
113
|
-
}`}
|
|
114
|
-
</RTLAwareText>
|
|
115
|
-
</RTLAwareView>
|
|
116
|
-
);
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
const RadioButtonItem = ({
|
|
120
|
-
image,
|
|
121
|
-
text,
|
|
122
|
-
isSelected,
|
|
123
|
-
onPress,
|
|
124
|
-
}: {
|
|
125
|
-
image: ImageURISource;
|
|
126
|
-
text: string;
|
|
127
|
-
isSelected: boolean;
|
|
128
|
-
onPress: () => void;
|
|
129
|
-
}) => {
|
|
130
|
-
const {theme} = useTheme();
|
|
131
|
-
return (
|
|
132
|
-
<RTLAwareTouchableOpacity
|
|
133
|
-
style={styles.radioButtonItem}
|
|
134
|
-
onPressIn={onPress}>
|
|
135
|
-
<Image source={image} />
|
|
136
|
-
<RTLAwareView style={styles.radioButtonItemText}>
|
|
137
|
-
<View
|
|
138
|
-
style={{
|
|
139
|
-
width: scaleWidth(35),
|
|
140
|
-
height: scaleHeight(35),
|
|
141
|
-
borderRadius: CommonSizes.borderRadius.extraLarge,
|
|
142
|
-
backgroundColor: theme.colors.surface,
|
|
143
|
-
...createThemedStyles(theme).dropShadow,
|
|
144
|
-
alignItems: 'center',
|
|
145
|
-
justifyContent: 'center',
|
|
146
|
-
}}>
|
|
147
|
-
{isSelected && (
|
|
148
|
-
<View
|
|
149
|
-
style={{
|
|
150
|
-
width: scaleWidth(23),
|
|
151
|
-
height: scaleHeight(23),
|
|
152
|
-
backgroundColor: theme.colors.indigoBlue,
|
|
153
|
-
borderRadius: CommonSizes.borderRadius.extraLarge,
|
|
154
|
-
}}
|
|
155
|
-
/>
|
|
156
|
-
)}
|
|
157
|
-
</View>
|
|
158
|
-
|
|
159
|
-
<RTLAwareText style={theme.text.body1}>{text}</RTLAwareText>
|
|
160
|
-
</RTLAwareView>
|
|
161
|
-
</RTLAwareTouchableOpacity>
|
|
162
|
-
);
|
|
163
|
-
};
|
|
164
|
-
const RadioButton = ({
|
|
165
|
-
selectedPaymentType,
|
|
166
|
-
setSelectedPaymentType,
|
|
167
|
-
setAmount,
|
|
168
|
-
amount,
|
|
169
|
-
amount1,
|
|
170
|
-
}: {
|
|
171
|
-
selectedPaymentType: string;
|
|
172
|
-
setSelectedPaymentType: (paymentType: string) => void;
|
|
173
|
-
setAmount: Dispatch<SetStateAction<string>>;
|
|
174
|
-
amount: string;
|
|
175
|
-
amount1: string;
|
|
176
|
-
}) => {
|
|
177
|
-
const t = useTranslation();
|
|
178
|
-
return (
|
|
179
|
-
<RTLAwareView style={styles.radioButtonContainer}>
|
|
180
|
-
<RadioButtonItem
|
|
181
|
-
image={ImageResources.full_ammount}
|
|
182
|
-
text={t('fullAmount', 'common')}
|
|
183
|
-
isSelected={selectedPaymentType === 'full'}
|
|
184
|
-
onPress={() => {
|
|
185
|
-
setSelectedPaymentType('full');
|
|
186
|
-
setAmount(amount1);
|
|
187
|
-
}}
|
|
188
|
-
/>
|
|
189
|
-
<RadioButtonItem
|
|
190
|
-
image={ImageResources.partial_ammount}
|
|
191
|
-
text={t('partialAmount', 'common')}
|
|
192
|
-
isSelected={selectedPaymentType === 'partial'}
|
|
193
|
-
onPress={() => {
|
|
194
|
-
setAmount('');
|
|
195
|
-
setSelectedPaymentType('partial');
|
|
196
|
-
}}
|
|
197
|
-
/>
|
|
198
|
-
</RTLAwareView>
|
|
199
|
-
);
|
|
200
|
-
};
|
|
201
|
-
|
|
202
|
-
export function InquiredBill(): JSX.Element {
|
|
203
|
-
const {theme} = useTheme();
|
|
204
|
-
const navigation =
|
|
205
|
-
useNavigation<NativeStackNavigationProp<RootStackParamList>>();
|
|
206
|
-
const scroll = useRef<KeyboardAwareScrollView>(null);
|
|
207
|
-
const {
|
|
208
|
-
amount,
|
|
209
|
-
amount1,
|
|
210
|
-
billInfo,
|
|
211
|
-
currencyCode,
|
|
212
|
-
fees,
|
|
213
|
-
service,
|
|
214
|
-
setShowPaymentType,
|
|
215
|
-
setSelectedPaymentType,
|
|
216
|
-
setAmount,
|
|
217
|
-
showPaymentType,
|
|
218
|
-
selectedProvider,
|
|
219
|
-
selectedPaymentType,
|
|
220
|
-
totalAmount,
|
|
221
|
-
inquiredBill,
|
|
222
|
-
isLoading,
|
|
223
|
-
handleSubmit,
|
|
224
|
-
} = useInquiredData();
|
|
225
|
-
|
|
226
|
-
useEffect(() => {
|
|
227
|
-
setAmount(totalAmount.replace('EGP ', ''));
|
|
228
|
-
return () => {
|
|
229
|
-
setSelectedPaymentType('full');
|
|
230
|
-
setAmount('');
|
|
231
|
-
setShowPaymentType(false);
|
|
232
|
-
};
|
|
233
|
-
}, [totalAmount]);
|
|
234
|
-
|
|
235
|
-
const t = useTranslation();
|
|
236
|
-
|
|
237
|
-
const hasDetails =
|
|
238
|
-
billInfo?.RulesAwareness ||
|
|
239
|
-
billInfo?.DueDt ||
|
|
240
|
-
billInfo?.IssueDt ||
|
|
241
|
-
billInfo?.ExtraBillInfo ||
|
|
242
|
-
inquiredBill?.BillTypeDescription ||
|
|
243
|
-
inquiredBill?.BillTypeExtraRefKeys?.BillTypeRefKey.length > 0;
|
|
244
|
-
|
|
245
|
-
return (
|
|
246
|
-
<Container
|
|
247
|
-
ref={scroll}
|
|
248
|
-
testID={'InquiredBillScreenID'}
|
|
249
|
-
contentContainerStyle={styles.contentContainer}
|
|
250
|
-
style={styles.container}
|
|
251
|
-
backgroundImage={ImageResources.background_2}
|
|
252
|
-
withoutPadding
|
|
253
|
-
extendedBackground
|
|
254
|
-
bounces={true}
|
|
255
|
-
backgroundColor={theme.colors.background}>
|
|
256
|
-
{isLoading ? (
|
|
257
|
-
<SkypeIndicator size={80} color={theme.colors.mutedLavender} />
|
|
258
|
-
) : (
|
|
259
|
-
<>
|
|
260
|
-
<HeaderBack onPress={navigation.goBack} />
|
|
261
|
-
<BillHeader
|
|
262
|
-
serviceName={service.Name || ''}
|
|
263
|
-
billLabel={billInfo?.BillLabel}
|
|
264
|
-
/>
|
|
265
|
-
<ProviderImage imageUrl={selectedProvider.img_url || ''} />
|
|
266
|
-
<BillAmount title={t('billAmount', 'common')} amount={totalAmount} />
|
|
267
|
-
|
|
268
|
-
{(service?.PaymentRules?.IsPrtAcpt ||
|
|
269
|
-
service?.PaymentRules?.IsOvrAcpt ||
|
|
270
|
-
service?.PaymentRules?.IsAdvAcpt) && (
|
|
271
|
-
<RTLAwareTouchableOpacity
|
|
272
|
-
style={{
|
|
273
|
-
backgroundColor: theme.colors.surface,
|
|
274
|
-
borderWidth: 1,
|
|
275
|
-
borderColor: theme.colors.indigoBlue,
|
|
276
|
-
justifyContent: 'flex-end',
|
|
277
|
-
alignItems: 'center',
|
|
278
|
-
flexDirection: 'row',
|
|
279
|
-
paddingHorizontal: CommonSizes.spacing.large,
|
|
280
|
-
paddingVertical: CommonSizes.spacing.large,
|
|
281
|
-
borderRadius: CommonSizes.borderRadius.large,
|
|
282
|
-
}}
|
|
283
|
-
onPressIn={() => {
|
|
284
|
-
setShowPaymentType(!showPaymentType);
|
|
285
|
-
}}>
|
|
286
|
-
<RTLAwareText style={{color: theme.colors.mutedLavender}}>
|
|
287
|
-
{t('otherAmount', 'common')}
|
|
288
|
-
</RTLAwareText>
|
|
289
|
-
<Image source={0} />
|
|
290
|
-
</RTLAwareTouchableOpacity>
|
|
291
|
-
)}
|
|
292
|
-
{(service?.PaymentRules?.IsPrtAcpt ||
|
|
293
|
-
service?.PaymentRules?.IsOvrAcpt ||
|
|
294
|
-
service?.PaymentRules?.IsAdvAcpt) &&
|
|
295
|
-
showPaymentType && (
|
|
296
|
-
<RadioButton
|
|
297
|
-
selectedPaymentType={selectedPaymentType}
|
|
298
|
-
setSelectedPaymentType={setSelectedPaymentType}
|
|
299
|
-
setAmount={setAmount}
|
|
300
|
-
amount={amount}
|
|
301
|
-
amount1={amount1?.toString()}
|
|
302
|
-
/>
|
|
303
|
-
)}
|
|
304
|
-
<AmountInput
|
|
305
|
-
paymentType={selectedPaymentType}
|
|
306
|
-
currencyCode={currencyCode}
|
|
307
|
-
amount1={amount}
|
|
308
|
-
amount2={fees?.toString()}
|
|
309
|
-
value={amount?.toString()}
|
|
310
|
-
setAmount={setAmount}
|
|
311
|
-
/>
|
|
312
|
-
{hasDetails && (
|
|
313
|
-
<RTLAwareView
|
|
314
|
-
style={{
|
|
315
|
-
backgroundColor: theme.colors.surface,
|
|
316
|
-
padding: CommonSizes.spacing.large,
|
|
317
|
-
borderRadius: CommonSizes.borderRadius.large,
|
|
318
|
-
borderWidth: 1,
|
|
319
|
-
borderColor: theme.colors.indigoBlue,
|
|
320
|
-
}}>
|
|
321
|
-
{billInfo?.RulesAwareness && (
|
|
322
|
-
<RTLAwareText style={{...theme.text.body1}}>
|
|
323
|
-
{billInfo?.RulesAwareness}
|
|
324
|
-
</RTLAwareText>
|
|
325
|
-
)}
|
|
326
|
-
{billInfo?.DueDt && (
|
|
327
|
-
<RTLAwareText style={{...theme.text.body1}}>
|
|
328
|
-
{`${t('dueDate', 'common')}: ${billInfo?.DueDt}`}
|
|
329
|
-
</RTLAwareText>
|
|
330
|
-
)}
|
|
331
|
-
{billInfo?.IssueDt && (
|
|
332
|
-
<RTLAwareText style={{...theme.text.body1}}>
|
|
333
|
-
{`${t('issueDate', 'common')}: ${billInfo?.IssueDt}`}
|
|
334
|
-
</RTLAwareText>
|
|
335
|
-
)}
|
|
336
|
-
{billInfo?.ExtraBillInfo && (
|
|
337
|
-
<RTLAwareText style={{...theme.text.body1}}>
|
|
338
|
-
{billInfo?.ExtraBillInfo}
|
|
339
|
-
</RTLAwareText>
|
|
340
|
-
)}
|
|
341
|
-
{inquiredBill?.BillTypeDescription && (
|
|
342
|
-
<RTLAwareText style={{...theme.text.body1}}>
|
|
343
|
-
{inquiredBill?.BillTypeDescription}
|
|
344
|
-
</RTLAwareText>
|
|
345
|
-
)}
|
|
346
|
-
{inquiredBill?.BillTypeExtraRefKeys?.BillTypeRefKey.length > 0 &&
|
|
347
|
-
inquiredBill?.BillTypeExtraRefKeys?.BillTypeRefKey.map(
|
|
348
|
-
(item: any) => (
|
|
349
|
-
<RTLAwareText style={{...theme.text.body1}}>
|
|
350
|
-
{`${item.key}: ${item.value}`}
|
|
351
|
-
</RTLAwareText>
|
|
352
|
-
),
|
|
353
|
-
)}
|
|
354
|
-
</RTLAwareView>
|
|
355
|
-
)}
|
|
356
|
-
<PrimaryButton
|
|
357
|
-
isLoading={isLoading}
|
|
358
|
-
disabled={isLoading || !amount}
|
|
359
|
-
label={t('submit', 'common')}
|
|
360
|
-
onPressIn={() => {
|
|
361
|
-
handleSubmit();
|
|
362
|
-
}}
|
|
363
|
-
style={styles.submitButton}
|
|
364
|
-
type={ButtonType.solid}
|
|
365
|
-
/>
|
|
366
|
-
<PrimaryButton
|
|
367
|
-
label={t('backToHome', 'common')}
|
|
368
|
-
onPress={() => {
|
|
369
|
-
navigation.reset({
|
|
370
|
-
index: 0,
|
|
371
|
-
routes: [{name: 'Main'}],
|
|
372
|
-
});
|
|
373
|
-
}}
|
|
374
|
-
style={{alignSelf: 'flex-end'}}
|
|
375
|
-
type={ButtonType.outlineNegative}
|
|
376
|
-
/>
|
|
377
|
-
</>
|
|
378
|
-
)}
|
|
379
|
-
</Container>
|
|
380
|
-
);
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
const styles = {
|
|
384
|
-
container: {
|
|
385
|
-
flexGrow: 1,
|
|
386
|
-
paddingBottom: scaleHeight(130),
|
|
387
|
-
borderTopRightRadius: CommonSizes.spacing.large,
|
|
388
|
-
borderTopLeftRadius: CommonSizes.spacing.large,
|
|
389
|
-
paddingHorizontal: CommonSizes.spacing.large,
|
|
390
|
-
gap: CommonSizes.spacing.xl,
|
|
391
|
-
justifyContent: 'flex-start' as const,
|
|
392
|
-
} as ViewStyle,
|
|
393
|
-
contentContainer: {
|
|
394
|
-
flexGrow: 1,
|
|
395
|
-
} as ViewStyle,
|
|
396
|
-
headerText: (theme: Theme) => ({
|
|
397
|
-
...theme.text.header1,
|
|
398
|
-
alignSelf: 'center' as const,
|
|
399
|
-
}),
|
|
400
|
-
subheaderText: (theme: Theme) => ({
|
|
401
|
-
...theme.text.header2,
|
|
402
|
-
alignSelf: 'center' as const,
|
|
403
|
-
}),
|
|
404
|
-
bodyText: (theme: Theme) => ({
|
|
405
|
-
...theme.text.body1,
|
|
406
|
-
alignSelf: 'center' as const,
|
|
407
|
-
}),
|
|
408
|
-
sectionImage: {
|
|
409
|
-
width: '100%',
|
|
410
|
-
height: scaleHeight(150),
|
|
411
|
-
resizeMode: 'contain' as ImageResizeMode,
|
|
412
|
-
} as ImageStyle,
|
|
413
|
-
amountInputContainer: {
|
|
414
|
-
flexDirection: 'row' as const,
|
|
415
|
-
alignItems: 'center' as const,
|
|
416
|
-
justifyContent: 'space-evenly' as const,
|
|
417
|
-
width: '100%',
|
|
418
|
-
} as ViewStyle,
|
|
419
|
-
arrowsImage: {
|
|
420
|
-
width: 24,
|
|
421
|
-
height: 24,
|
|
422
|
-
resizeMode: 'contain' as ImageResizeMode,
|
|
423
|
-
} as ImageStyle,
|
|
424
|
-
submitButton: {
|
|
425
|
-
alignSelf: 'flex-end' as const,
|
|
426
|
-
} as ViewStyle,
|
|
427
|
-
radioButtonContainer: {
|
|
428
|
-
flexDirection: 'row' as const,
|
|
429
|
-
alignItems: 'flex-start' as const,
|
|
430
|
-
justifyContent: 'space-evenly' as const,
|
|
431
|
-
width: '100%',
|
|
432
|
-
} as ViewStyle,
|
|
433
|
-
radioButtonItem: {
|
|
434
|
-
alignItems: 'center' as const,
|
|
435
|
-
justifyContent: 'space-evenly' as const,
|
|
436
|
-
} as ViewStyle,
|
|
437
|
-
radioButtonItemText: {
|
|
438
|
-
flexDirection: 'row' as const,
|
|
439
|
-
alignItems: 'center' as const,
|
|
440
|
-
justifyContent: 'space-evenly' as const,
|
|
441
|
-
gap: CommonSizes.spacing.large,
|
|
442
|
-
} as ViewStyle,
|
|
443
|
-
};
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import {useNavigation} from '@react-navigation/native';
|
|
2
|
-
import {NativeStackNavigationProp} from '@react-navigation/native-stack';
|
|
3
|
-
import {omit} from 'lodash';
|
|
4
|
-
import {useState} from 'react';
|
|
5
|
-
import {initFees} from '../../../common/utils/FeesCaalculation';
|
|
6
|
-
import {useAppDispatch, useAppSelector} from '../../../core/store/reduxHelpers';
|
|
7
|
-
import {RootState} from '../../../core/store/rootReducer';
|
|
8
|
-
import {payService} from '../../../core/store/Services/servicesActions';
|
|
9
|
-
import {RootStackParamList} from '../../../navigation/types';
|
|
10
|
-
|
|
11
|
-
// Define the PaymentConfirmationProps interface
|
|
12
|
-
interface PaymentConfirmationProps {
|
|
13
|
-
amountToBePaid: string;
|
|
14
|
-
billInfo: any;
|
|
15
|
-
fees: number;
|
|
16
|
-
currencyCode: string;
|
|
17
|
-
billRec: {
|
|
18
|
-
BillingAcct: string;
|
|
19
|
-
BillerId: string;
|
|
20
|
-
BillTypeCode: number;
|
|
21
|
-
BillRefNumber: string;
|
|
22
|
-
BillStatus: string;
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export function useInquiredData() {
|
|
27
|
-
const [isLoading, setIsLoading] = useState(false);
|
|
28
|
-
const dispatch = useAppDispatch();
|
|
29
|
-
|
|
30
|
-
const [selectedPaymentType, setSelectedPaymentType] =
|
|
31
|
-
useState<string>('full');
|
|
32
|
-
const [showPaymentType, setShowPaymentType] = useState<boolean>(false);
|
|
33
|
-
const {service} = useAppSelector((state: RootState) => state.services);
|
|
34
|
-
const {inquiredBill} = useAppSelector((state: RootState) => state.services);
|
|
35
|
-
const billInfo = inquiredBill?.BillRec?.[0]?.BillInfo;
|
|
36
|
-
let billRec: any = inquiredBill?.BillRec?.[0];
|
|
37
|
-
billRec = omit(billRec, ['BillInfo']);
|
|
38
|
-
const amount1 = billInfo?.BillSummAmt?.[0]?.CurAmt?.Amt || 0;
|
|
39
|
-
const {selectedProvider} = useAppSelector(
|
|
40
|
-
(state: RootState) => state.providers,
|
|
41
|
-
);
|
|
42
|
-
const [amount, setAmount] = useState<string>(amount1?.toString());
|
|
43
|
-
const currencyCode = billInfo?.BillSummAmt?.[0]?.CurAmt?.CurCode || '';
|
|
44
|
-
const fees = initFees(service, amount);
|
|
45
|
-
const totalAmount = `${currencyCode} ${amount1}`;
|
|
46
|
-
const navigation =
|
|
47
|
-
useNavigation<NativeStackNavigationProp<RootStackParamList>>();
|
|
48
|
-
|
|
49
|
-
const fetchData = async () => {
|
|
50
|
-
setAmount(amount1?.toString());
|
|
51
|
-
setIsLoading(true);
|
|
52
|
-
try {
|
|
53
|
-
} catch (error) {
|
|
54
|
-
console.error('Error fetching history data:', error);
|
|
55
|
-
} finally {
|
|
56
|
-
setIsLoading(false);
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
const refreshData = () => {
|
|
61
|
-
fetchData();
|
|
62
|
-
};
|
|
63
|
-
const handleSubmit = async () => {
|
|
64
|
-
setIsLoading(false);
|
|
65
|
-
navigation.navigate('PaymentConfirmation', {
|
|
66
|
-
paymentData: {amountToBePaid: amount, fees},
|
|
67
|
-
});
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
return {
|
|
71
|
-
isLoading,
|
|
72
|
-
refreshData,
|
|
73
|
-
fetchData,
|
|
74
|
-
showPaymentType,
|
|
75
|
-
setShowPaymentType,
|
|
76
|
-
selectedPaymentType,
|
|
77
|
-
setSelectedPaymentType,
|
|
78
|
-
billInfo,
|
|
79
|
-
billRec,
|
|
80
|
-
service,
|
|
81
|
-
selectedProvider,
|
|
82
|
-
amount,
|
|
83
|
-
setAmount,
|
|
84
|
-
fees,
|
|
85
|
-
totalAmount,
|
|
86
|
-
amount1,
|
|
87
|
-
currencyCode,
|
|
88
|
-
inquiredBill,
|
|
89
|
-
handleSubmit,
|
|
90
|
-
};
|
|
91
|
-
}
|