@zezosoft/react-native-zezopay 1.0.3 → 1.0.4
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/README.md +11 -3
- package/lib/module/index.js +1 -1
- package/lib/module/zezopay/ZezoPay.js +248 -0
- package/lib/module/zezopay/ZezoPay.js.map +1 -0
- package/lib/module/{ZezoPay → zezopay}/components/Header.js +28 -10
- package/lib/module/zezopay/components/Header.js.map +1 -0
- package/lib/module/zezopay/components/PayButton.js +192 -0
- package/lib/module/zezopay/components/PayButton.js.map +1 -0
- package/lib/module/{ZezoPay → zezopay}/components/PaymentMethod.js +96 -70
- package/lib/module/zezopay/components/PaymentMethod.js.map +1 -0
- package/lib/module/{ZezoPay → zezopay}/components/Summary.js +54 -43
- package/lib/module/zezopay/components/Summary.js.map +1 -0
- package/lib/module/{ZezoPay → zezopay}/components/VoucherBox.js +81 -48
- package/lib/module/zezopay/components/VoucherBox.js.map +1 -0
- package/lib/module/zezopay/components/index.js +8 -0
- package/lib/module/zezopay/components/index.js.map +1 -0
- package/lib/module/zezopay/context/ZezoPayContext.js +24 -0
- package/lib/module/zezopay/context/ZezoPayContext.js.map +1 -0
- package/lib/module/zezopay/context/index.js +4 -0
- package/lib/module/zezopay/context/index.js.map +1 -0
- package/lib/module/zezopay/hooks/index.js +5 -0
- package/lib/module/zezopay/hooks/index.js.map +1 -0
- package/lib/module/zezopay/hooks/useAsync.js +44 -0
- package/lib/module/zezopay/hooks/useAsync.js.map +1 -0
- package/lib/module/zezopay/hooks/useZezoPay.helpers.js +217 -0
- package/lib/module/zezopay/hooks/useZezoPay.helpers.js.map +1 -0
- package/lib/module/zezopay/hooks/useZezoPay.js +219 -0
- package/lib/module/zezopay/hooks/useZezoPay.js.map +1 -0
- package/lib/module/zezopay/index.js +10 -0
- package/lib/module/zezopay/index.js.map +1 -0
- package/lib/module/zezopay/payments/providers/iap/IAP.js +201 -0
- package/lib/module/zezopay/payments/providers/iap/IAP.js.map +1 -0
- package/lib/module/zezopay/payments/providers/index.js +12 -0
- package/lib/module/zezopay/payments/providers/index.js.map +1 -0
- package/lib/module/zezopay/payments/providers/payment-gateways.types.d.js +2 -0
- package/lib/module/zezopay/payments/providers/payment-gateways.types.d.js.map +1 -0
- package/lib/module/zezopay/payments/providers/razorpay/Razorpay.js +40 -0
- package/lib/module/zezopay/payments/providers/razorpay/Razorpay.js.map +1 -0
- package/lib/module/zezopay/payments/providers/stripe/Stripe.js +58 -0
- package/lib/module/zezopay/payments/providers/stripe/Stripe.js.map +1 -0
- package/lib/module/zezopay/services/api-sdk.js +24 -0
- package/lib/module/zezopay/services/api-sdk.js.map +1 -0
- package/lib/module/zezopay/services/baseService.js +55 -0
- package/lib/module/zezopay/services/baseService.js.map +1 -0
- package/lib/module/zezopay/services/common.types.js +2 -0
- package/lib/module/zezopay/services/common.types.js.map +1 -0
- package/lib/module/zezopay/services/digitalProducts/digitalProducts.js +72 -0
- package/lib/module/zezopay/services/digitalProducts/digitalProducts.js.map +1 -0
- package/lib/module/zezopay/services/digitalProducts/digitalProducts.types.js +4 -0
- package/lib/module/zezopay/services/digitalProducts/digitalProducts.types.js.map +1 -0
- package/lib/module/zezopay/services/digitalProducts/index.js +5 -0
- package/lib/module/zezopay/services/digitalProducts/index.js.map +1 -0
- package/lib/module/zezopay/services/iap/iap.js +20 -0
- package/lib/module/zezopay/services/iap/iap.js.map +1 -0
- package/lib/module/zezopay/services/iap/iap.types.js +2 -0
- package/lib/module/zezopay/services/iap/iap.types.js.map +1 -0
- package/lib/module/zezopay/services/iap/index.js +5 -0
- package/lib/module/zezopay/services/iap/index.js.map +1 -0
- package/lib/module/zezopay/services/index.js +10 -0
- package/lib/module/zezopay/services/index.js.map +1 -0
- package/lib/module/zezopay/services/payments/index.js +5 -0
- package/lib/module/zezopay/services/payments/index.js.map +1 -0
- package/lib/module/{ZezoPay/http → zezopay}/services/payments/payments.js +2 -1
- package/lib/module/zezopay/services/payments/payments.js.map +1 -0
- package/lib/module/zezopay/services/payments/payments.types.js +52 -0
- package/lib/module/zezopay/services/payments/payments.types.js.map +1 -0
- package/lib/module/zezopay/services/subscriptions/index.js +5 -0
- package/lib/module/zezopay/services/subscriptions/index.js.map +1 -0
- package/lib/module/zezopay/services/subscriptions/plan/index.js +5 -0
- package/lib/module/zezopay/services/subscriptions/plan/index.js.map +1 -0
- package/lib/module/zezopay/services/subscriptions/plan/plan.js +57 -0
- package/lib/module/zezopay/services/subscriptions/plan/plan.js.map +1 -0
- package/lib/module/zezopay/services/subscriptions/plan/plan.types.js +4 -0
- package/lib/module/zezopay/services/subscriptions/plan/plan.types.js.map +1 -0
- package/lib/module/zezopay/services/utils/errorFormatter.js.map +1 -0
- package/lib/module/zezopay/services/utils/index.js +4 -0
- package/lib/module/zezopay/services/utils/index.js.map +1 -0
- package/lib/module/zezopay/theme.js +40 -0
- package/lib/module/zezopay/theme.js.map +1 -0
- package/lib/module/{ZezoPay → zezopay}/types/index.js.map +1 -1
- package/lib/module/{ZezoPay → zezopay}/utils/index.js +2 -1
- package/lib/module/zezopay/utils/index.js.map +1 -0
- package/lib/typescript/src/index.d.ts +1 -1
- package/lib/typescript/src/zezopay/ZezoPay.d.ts.map +1 -0
- package/lib/typescript/src/{ZezoPay → zezopay}/components/Header.d.ts +2 -0
- package/lib/typescript/src/zezopay/components/Header.d.ts.map +1 -0
- package/lib/typescript/src/{ZezoPay → zezopay}/components/PayButton.d.ts +2 -0
- package/lib/typescript/src/zezopay/components/PayButton.d.ts.map +1 -0
- package/lib/typescript/src/zezopay/components/PaymentMethod.d.ts +15 -0
- package/lib/typescript/src/zezopay/components/PaymentMethod.d.ts.map +1 -0
- package/lib/typescript/src/zezopay/components/Summary.d.ts +11 -0
- package/lib/typescript/src/zezopay/components/Summary.d.ts.map +1 -0
- package/lib/typescript/src/{ZezoPay → zezopay}/components/VoucherBox.d.ts +2 -0
- package/lib/typescript/src/zezopay/components/VoucherBox.d.ts.map +1 -0
- package/lib/typescript/src/zezopay/components/index.d.ts +6 -0
- package/lib/typescript/src/zezopay/components/index.d.ts.map +1 -0
- package/lib/typescript/src/zezopay/context/ZezoPayContext.d.ts +10 -0
- package/lib/typescript/src/zezopay/context/ZezoPayContext.d.ts.map +1 -0
- package/lib/typescript/src/zezopay/context/index.d.ts +2 -0
- package/lib/typescript/src/zezopay/context/index.d.ts.map +1 -0
- package/lib/typescript/src/zezopay/hooks/index.d.ts +4 -0
- package/lib/typescript/src/zezopay/hooks/index.d.ts.map +1 -0
- package/lib/typescript/src/zezopay/hooks/useAsync.d.ts +8 -0
- package/lib/typescript/src/zezopay/hooks/useAsync.d.ts.map +1 -0
- package/lib/typescript/src/{ZezoPay/utils → zezopay}/hooks/useZezoPay.d.ts +13 -12
- package/lib/typescript/src/zezopay/hooks/useZezoPay.d.ts.map +1 -0
- package/lib/typescript/src/zezopay/hooks/useZezoPay.helpers.d.ts +23 -0
- package/lib/typescript/src/zezopay/hooks/useZezoPay.helpers.d.ts.map +1 -0
- package/lib/typescript/src/zezopay/index.d.ts +8 -0
- package/lib/typescript/src/zezopay/index.d.ts.map +1 -0
- package/lib/typescript/src/zezopay/payments/providers/iap/IAP.d.ts +17 -0
- package/lib/typescript/src/zezopay/payments/providers/iap/IAP.d.ts.map +1 -0
- package/lib/typescript/src/zezopay/payments/providers/index.d.ts +9 -0
- package/lib/typescript/src/zezopay/payments/providers/index.d.ts.map +1 -0
- package/lib/typescript/src/zezopay/payments/providers/razorpay/Razorpay.d.ts.map +1 -0
- package/lib/typescript/src/zezopay/payments/providers/stripe/Stripe.d.ts +7 -0
- package/lib/typescript/src/zezopay/payments/providers/stripe/Stripe.d.ts.map +1 -0
- package/lib/typescript/src/zezopay/services/api-sdk.d.ts +31 -0
- package/lib/typescript/src/zezopay/services/api-sdk.d.ts.map +1 -0
- package/lib/typescript/src/{ZezoPay/http → zezopay}/services/baseService.d.ts +1 -1
- package/lib/typescript/src/zezopay/services/baseService.d.ts.map +1 -0
- package/lib/typescript/src/zezopay/services/common.types.d.ts +25 -0
- package/lib/typescript/src/zezopay/services/common.types.d.ts.map +1 -0
- package/lib/typescript/src/zezopay/services/digitalProducts/digitalProducts.d.ts +15 -0
- package/lib/typescript/src/zezopay/services/digitalProducts/digitalProducts.d.ts.map +1 -0
- package/lib/typescript/src/zezopay/services/digitalProducts/digitalProducts.types.d.ts +79 -0
- package/lib/typescript/src/zezopay/services/digitalProducts/digitalProducts.types.d.ts.map +1 -0
- package/lib/typescript/src/zezopay/services/digitalProducts/index.d.ts +3 -0
- package/lib/typescript/src/zezopay/services/digitalProducts/index.d.ts.map +1 -0
- package/lib/typescript/src/zezopay/services/iap/iap.d.ts +13 -0
- package/lib/typescript/src/zezopay/services/iap/iap.d.ts.map +1 -0
- package/lib/typescript/src/zezopay/services/iap/iap.types.d.ts +47 -0
- package/lib/typescript/src/zezopay/services/iap/iap.types.d.ts.map +1 -0
- package/lib/typescript/src/zezopay/services/iap/index.d.ts +3 -0
- package/lib/typescript/src/zezopay/services/iap/index.d.ts.map +1 -0
- package/lib/typescript/src/zezopay/services/index.d.ts +9 -0
- package/lib/typescript/src/zezopay/services/index.d.ts.map +1 -0
- package/lib/typescript/src/zezopay/services/payments/index.d.ts +3 -0
- package/lib/typescript/src/zezopay/services/payments/index.d.ts.map +1 -0
- package/lib/typescript/src/{ZezoPay/http → zezopay}/services/payments/payments.d.ts +3 -2
- package/lib/typescript/src/zezopay/services/payments/payments.d.ts.map +1 -0
- package/lib/typescript/src/{ZezoPay/http → zezopay}/services/payments/payments.types.d.ts +22 -1
- package/lib/typescript/src/zezopay/services/payments/payments.types.d.ts.map +1 -0
- package/lib/typescript/src/zezopay/services/subscriptions/index.d.ts +3 -0
- package/lib/typescript/src/zezopay/services/subscriptions/index.d.ts.map +1 -0
- package/lib/typescript/src/zezopay/services/subscriptions/plan/index.d.ts +3 -0
- package/lib/typescript/src/zezopay/services/subscriptions/plan/index.d.ts.map +1 -0
- package/lib/typescript/src/zezopay/services/subscriptions/plan/plan.d.ts +19 -0
- package/lib/typescript/src/zezopay/services/subscriptions/plan/plan.d.ts.map +1 -0
- package/lib/typescript/src/zezopay/services/subscriptions/plan/plan.types.d.ts +64 -0
- package/lib/typescript/src/zezopay/services/subscriptions/plan/plan.types.d.ts.map +1 -0
- package/lib/typescript/src/zezopay/services/utils/errorFormatter.d.ts.map +1 -0
- package/lib/typescript/src/zezopay/services/utils/index.d.ts +2 -0
- package/lib/typescript/src/zezopay/services/utils/index.d.ts.map +1 -0
- package/lib/typescript/src/zezopay/theme.d.ts +38 -0
- package/lib/typescript/src/zezopay/theme.d.ts.map +1 -0
- package/lib/typescript/src/{ZezoPay → zezopay}/types/index.d.ts +19 -21
- package/lib/typescript/src/zezopay/types/index.d.ts.map +1 -0
- package/lib/typescript/src/{ZezoPay → zezopay}/utils/index.d.ts.map +1 -1
- package/package.json +13 -5
- package/lib/module/ZezoPay/Payments/Providers/PaymentGateways.types.d.js +0 -2
- package/lib/module/ZezoPay/Payments/Providers/PaymentGateways.types.d.js.map +0 -1
- package/lib/module/ZezoPay/Payments/Providers/Razorpay/Razorpay.js +0 -39
- package/lib/module/ZezoPay/Payments/Providers/Razorpay/Razorpay.js.map +0 -1
- package/lib/module/ZezoPay/Payments/Providers/index.js +0 -10
- package/lib/module/ZezoPay/Payments/Providers/index.js.map +0 -1
- package/lib/module/ZezoPay/ZezoPay.js +0 -192
- package/lib/module/ZezoPay/ZezoPay.js.map +0 -1
- package/lib/module/ZezoPay/components/Header.js.map +0 -1
- package/lib/module/ZezoPay/components/PayButton.js +0 -143
- package/lib/module/ZezoPay/components/PayButton.js.map +0 -1
- package/lib/module/ZezoPay/components/PaymentMethod.js.map +0 -1
- package/lib/module/ZezoPay/components/Summary.js.map +0 -1
- package/lib/module/ZezoPay/components/VoucherBox.js.map +0 -1
- package/lib/module/ZezoPay/http/api-sdk.js +0 -14
- package/lib/module/ZezoPay/http/api-sdk.js.map +0 -1
- package/lib/module/ZezoPay/http/services/baseService.js +0 -28
- package/lib/module/ZezoPay/http/services/baseService.js.map +0 -1
- package/lib/module/ZezoPay/http/services/payments/payments.js.map +0 -1
- package/lib/module/ZezoPay/http/services/payments/payments.types.js +0 -2
- package/lib/module/ZezoPay/http/services/payments/payments.types.js.map +0 -1
- package/lib/module/ZezoPay/http/utils/errorFormatter.js.map +0 -1
- package/lib/module/ZezoPay/index.js +0 -5
- package/lib/module/ZezoPay/index.js.map +0 -1
- package/lib/module/ZezoPay/utils/hooks/useAsync.js +0 -32
- package/lib/module/ZezoPay/utils/hooks/useAsync.js.map +0 -1
- package/lib/module/ZezoPay/utils/hooks/useZezoPay.js +0 -249
- package/lib/module/ZezoPay/utils/hooks/useZezoPay.js.map +0 -1
- package/lib/module/ZezoPay/utils/index.js.map +0 -1
- package/lib/typescript/src/ZezoPay/Payments/Providers/Razorpay/Razorpay.d.ts.map +0 -1
- package/lib/typescript/src/ZezoPay/Payments/Providers/index.d.ts +0 -7
- package/lib/typescript/src/ZezoPay/Payments/Providers/index.d.ts.map +0 -1
- package/lib/typescript/src/ZezoPay/ZezoPay.d.ts.map +0 -1
- package/lib/typescript/src/ZezoPay/components/Header.d.ts.map +0 -1
- package/lib/typescript/src/ZezoPay/components/PayButton.d.ts.map +0 -1
- package/lib/typescript/src/ZezoPay/components/PaymentMethod.d.ts +0 -12
- package/lib/typescript/src/ZezoPay/components/PaymentMethod.d.ts.map +0 -1
- package/lib/typescript/src/ZezoPay/components/Summary.d.ts +0 -7
- package/lib/typescript/src/ZezoPay/components/Summary.d.ts.map +0 -1
- package/lib/typescript/src/ZezoPay/components/VoucherBox.d.ts.map +0 -1
- package/lib/typescript/src/ZezoPay/http/api-sdk.d.ts +0 -21
- package/lib/typescript/src/ZezoPay/http/api-sdk.d.ts.map +0 -1
- package/lib/typescript/src/ZezoPay/http/services/baseService.d.ts.map +0 -1
- package/lib/typescript/src/ZezoPay/http/services/payments/payments.d.ts.map +0 -1
- package/lib/typescript/src/ZezoPay/http/services/payments/payments.types.d.ts.map +0 -1
- package/lib/typescript/src/ZezoPay/http/utils/errorFormatter.d.ts.map +0 -1
- package/lib/typescript/src/ZezoPay/index.d.ts +0 -3
- package/lib/typescript/src/ZezoPay/index.d.ts.map +0 -1
- package/lib/typescript/src/ZezoPay/types/index.d.ts.map +0 -1
- package/lib/typescript/src/ZezoPay/utils/hooks/useAsync.d.ts +0 -6
- package/lib/typescript/src/ZezoPay/utils/hooks/useAsync.d.ts.map +0 -1
- package/lib/typescript/src/ZezoPay/utils/hooks/useZezoPay.d.ts.map +0 -1
- package/src/ZezoPay/Payments/Providers/PaymentGateways.types.d.ts +0 -48
- package/src/ZezoPay/Payments/Providers/Razorpay/Razorpay.ts +0 -46
- package/src/ZezoPay/Payments/Providers/index.ts +0 -8
- package/src/ZezoPay/ZezoPay.tsx +0 -197
- package/src/ZezoPay/components/Header.tsx +0 -107
- package/src/ZezoPay/components/PayButton.tsx +0 -132
- package/src/ZezoPay/components/PaymentMethod.tsx +0 -263
- package/src/ZezoPay/components/Summary.tsx +0 -188
- package/src/ZezoPay/components/VoucherBox.tsx +0 -182
- package/src/ZezoPay/http/api-sdk.ts +0 -27
- package/src/ZezoPay/http/services/baseService.ts +0 -37
- package/src/ZezoPay/http/services/payments/payments.ts +0 -66
- package/src/ZezoPay/http/services/payments/payments.types.ts +0 -120
- package/src/ZezoPay/http/utils/errorFormatter.ts +0 -88
- package/src/ZezoPay/index.ts +0 -2
- package/src/ZezoPay/types/index.ts +0 -104
- package/src/ZezoPay/utils/hooks/useAsync.ts +0 -38
- package/src/ZezoPay/utils/hooks/useZezoPay.ts +0 -323
- package/src/ZezoPay/utils/index.ts +0 -16
- package/src/index.tsx +0 -1
- /package/lib/module/{ZezoPay/http → zezopay/services}/utils/errorFormatter.js +0 -0
- /package/lib/module/{ZezoPay → zezopay}/types/index.js +0 -0
- /package/lib/typescript/src/{ZezoPay → zezopay}/ZezoPay.d.ts +0 -0
- /package/lib/typescript/src/{ZezoPay/Payments/Providers/Razorpay → zezopay/payments/providers/razorpay}/Razorpay.d.ts +0 -0
- /package/lib/typescript/src/{ZezoPay/http → zezopay/services}/utils/errorFormatter.d.ts +0 -0
- /package/lib/typescript/src/{ZezoPay → zezopay}/utils/index.d.ts +0 -0
|
@@ -1,263 +0,0 @@
|
|
|
1
|
-
import React, { memo, useCallback } from 'react';
|
|
2
|
-
import { Pressable, StyleSheet, Text, View, Animated } from 'react-native';
|
|
3
|
-
import { scale, moderateScale, verticalScale } from 'react-native-size-matters';
|
|
4
|
-
import type { IReadyPaymentProvider } from '../http/api-sdk';
|
|
5
|
-
|
|
6
|
-
interface PaymentMethodProps {
|
|
7
|
-
providers: IReadyPaymentProvider[];
|
|
8
|
-
selectedProvider: string | null;
|
|
9
|
-
onProviderChange: (provider: string) => void;
|
|
10
|
-
isLoading?: boolean;
|
|
11
|
-
error?: string | null;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const COLORS = {
|
|
15
|
-
background: '#ffffff',
|
|
16
|
-
lightGray: '#f9fafb',
|
|
17
|
-
grayBorder: '#e5e7eb',
|
|
18
|
-
grayText: '#6b7280',
|
|
19
|
-
darkText: '#111827',
|
|
20
|
-
logoFallback: '#9ca3af',
|
|
21
|
-
skeleton: '#d1d5db',
|
|
22
|
-
error: '#dc2626',
|
|
23
|
-
selectedBorder: '#2563EB',
|
|
24
|
-
selectedBackground: '#eff6ff',
|
|
25
|
-
radioBorder: '#9ca3af',
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const ProviderLogo: React.FC<{
|
|
29
|
-
name: string;
|
|
30
|
-
logo?: string;
|
|
31
|
-
isLoading?: boolean;
|
|
32
|
-
}> = ({ name, logo, isLoading }) => {
|
|
33
|
-
if (isLoading) return <View style={styles.skeletonLogo} />;
|
|
34
|
-
|
|
35
|
-
if (logo) {
|
|
36
|
-
return (
|
|
37
|
-
<View style={styles.logoWrapper}>
|
|
38
|
-
<Animated.Image
|
|
39
|
-
source={{ uri: logo }}
|
|
40
|
-
style={styles.logo}
|
|
41
|
-
accessibilityLabel={`${name} logo`}
|
|
42
|
-
/>
|
|
43
|
-
</View>
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return (
|
|
48
|
-
<View style={styles.logoFallback}>
|
|
49
|
-
<Text style={styles.logoFallbackText}>{name[0]}</Text>
|
|
50
|
-
</View>
|
|
51
|
-
);
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
const ProviderItem: React.FC<{
|
|
55
|
-
provider: IReadyPaymentProvider;
|
|
56
|
-
isProviderSelected: boolean;
|
|
57
|
-
isLoading: boolean;
|
|
58
|
-
onPress: (provider: string) => void;
|
|
59
|
-
}> = memo(({ provider, isProviderSelected, isLoading, onPress }) => (
|
|
60
|
-
<Pressable
|
|
61
|
-
onPress={() => onPress(provider.provider)}
|
|
62
|
-
key={provider.provider}
|
|
63
|
-
style={[
|
|
64
|
-
styles.gatewayItem,
|
|
65
|
-
isProviderSelected && styles.gatewaySelected,
|
|
66
|
-
isLoading && styles.disabled,
|
|
67
|
-
]}
|
|
68
|
-
disabled={isLoading}
|
|
69
|
-
accessibilityState={{ selected: isProviderSelected, disabled: isLoading }}
|
|
70
|
-
>
|
|
71
|
-
<View style={styles.providerContainer}>
|
|
72
|
-
<ProviderLogo
|
|
73
|
-
name={provider.provider}
|
|
74
|
-
logo={provider.logo}
|
|
75
|
-
isLoading={isLoading}
|
|
76
|
-
/>
|
|
77
|
-
{isLoading ? (
|
|
78
|
-
<View style={styles.skeletonText} />
|
|
79
|
-
) : (
|
|
80
|
-
<Text style={styles.gatewayText}>{provider.provider}</Text>
|
|
81
|
-
)}
|
|
82
|
-
</View>
|
|
83
|
-
<View style={[styles.radio, isProviderSelected && styles.radioSelected]}>
|
|
84
|
-
{isProviderSelected && <View style={styles.radioDot} />}
|
|
85
|
-
</View>
|
|
86
|
-
</Pressable>
|
|
87
|
-
));
|
|
88
|
-
|
|
89
|
-
const PaymentMethod: React.FC<PaymentMethodProps> = ({
|
|
90
|
-
providers,
|
|
91
|
-
selectedProvider,
|
|
92
|
-
onProviderChange,
|
|
93
|
-
isLoading = false,
|
|
94
|
-
error = null,
|
|
95
|
-
}) => {
|
|
96
|
-
const handleProviderChange = useCallback(
|
|
97
|
-
(provider: string) => onProviderChange(provider),
|
|
98
|
-
[onProviderChange]
|
|
99
|
-
);
|
|
100
|
-
|
|
101
|
-
const skeletonItems = Array.from({ length: 3 }, (_, i) => ({
|
|
102
|
-
provider: `loading-${i}`,
|
|
103
|
-
logo: '',
|
|
104
|
-
}));
|
|
105
|
-
|
|
106
|
-
return (
|
|
107
|
-
<View style={styles.container}>
|
|
108
|
-
<Text style={styles.title} accessibilityRole="header">
|
|
109
|
-
Payment Gateways
|
|
110
|
-
</Text>
|
|
111
|
-
|
|
112
|
-
{error ? (
|
|
113
|
-
<View style={styles.noProvidersWrapper}>
|
|
114
|
-
<Text style={styles.errorText}>{error}</Text>
|
|
115
|
-
</View>
|
|
116
|
-
) : (
|
|
117
|
-
<>
|
|
118
|
-
{(isLoading ? skeletonItems : providers).map((provider) => (
|
|
119
|
-
<ProviderItem
|
|
120
|
-
key={provider.provider}
|
|
121
|
-
provider={provider}
|
|
122
|
-
isProviderSelected={provider.provider === selectedProvider}
|
|
123
|
-
isLoading={isLoading}
|
|
124
|
-
onPress={handleProviderChange}
|
|
125
|
-
/>
|
|
126
|
-
))}
|
|
127
|
-
|
|
128
|
-
{!isLoading && providers.length === 0 && (
|
|
129
|
-
<View style={styles.noProvidersWrapper}>
|
|
130
|
-
<Text style={styles.noProvidersText}>
|
|
131
|
-
No payment gateways available
|
|
132
|
-
</Text>
|
|
133
|
-
</View>
|
|
134
|
-
)}
|
|
135
|
-
</>
|
|
136
|
-
)}
|
|
137
|
-
</View>
|
|
138
|
-
);
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
const styles = StyleSheet.create({
|
|
142
|
-
container: {
|
|
143
|
-
padding: scale(16),
|
|
144
|
-
backgroundColor: COLORS.background,
|
|
145
|
-
position: 'relative',
|
|
146
|
-
borderRadius: scale(12),
|
|
147
|
-
elevation: 4,
|
|
148
|
-
marginBottom: verticalScale(16),
|
|
149
|
-
shadowColor: '#000',
|
|
150
|
-
shadowOpacity: 0.05,
|
|
151
|
-
shadowRadius: 10,
|
|
152
|
-
shadowOffset: { width: 0, height: 2 },
|
|
153
|
-
flexShrink: 1,
|
|
154
|
-
},
|
|
155
|
-
title: {
|
|
156
|
-
fontSize: moderateScale(16),
|
|
157
|
-
fontWeight: '700',
|
|
158
|
-
marginBottom: verticalScale(8),
|
|
159
|
-
color: COLORS.darkText,
|
|
160
|
-
},
|
|
161
|
-
errorText: {
|
|
162
|
-
fontSize: moderateScale(14),
|
|
163
|
-
color: COLORS.error,
|
|
164
|
-
textAlign: 'center',
|
|
165
|
-
marginVertical: verticalScale(16),
|
|
166
|
-
},
|
|
167
|
-
noProvidersWrapper: {
|
|
168
|
-
flex: 1,
|
|
169
|
-
justifyContent: 'center',
|
|
170
|
-
alignItems: 'center',
|
|
171
|
-
minHeight: 150,
|
|
172
|
-
},
|
|
173
|
-
noProvidersText: {
|
|
174
|
-
fontSize: moderateScale(14),
|
|
175
|
-
color: COLORS.grayText,
|
|
176
|
-
textAlign: 'center',
|
|
177
|
-
},
|
|
178
|
-
gatewayItem: {
|
|
179
|
-
flexDirection: 'row',
|
|
180
|
-
justifyContent: 'space-between',
|
|
181
|
-
alignItems: 'center',
|
|
182
|
-
padding: scale(10),
|
|
183
|
-
borderRadius: scale(10),
|
|
184
|
-
backgroundColor: COLORS.lightGray,
|
|
185
|
-
borderWidth: 1,
|
|
186
|
-
borderColor: COLORS.grayBorder,
|
|
187
|
-
marginBottom: verticalScale(8),
|
|
188
|
-
},
|
|
189
|
-
gatewaySelected: {
|
|
190
|
-
borderColor: COLORS.selectedBorder,
|
|
191
|
-
backgroundColor: COLORS.selectedBackground,
|
|
192
|
-
},
|
|
193
|
-
disabled: { opacity: 0.6 },
|
|
194
|
-
providerContainer: { flexDirection: 'row', alignItems: 'center' },
|
|
195
|
-
logoWrapper: {
|
|
196
|
-
width: scale(32),
|
|
197
|
-
height: scale(32),
|
|
198
|
-
backgroundColor: COLORS.background,
|
|
199
|
-
borderRadius: scale(6),
|
|
200
|
-
padding: scale(3),
|
|
201
|
-
alignItems: 'center',
|
|
202
|
-
justifyContent: 'center',
|
|
203
|
-
marginRight: scale(12),
|
|
204
|
-
},
|
|
205
|
-
logo: {
|
|
206
|
-
width: '100%',
|
|
207
|
-
height: '100%',
|
|
208
|
-
resizeMode: 'contain',
|
|
209
|
-
borderRadius: scale(4),
|
|
210
|
-
},
|
|
211
|
-
skeletonLogo: {
|
|
212
|
-
width: scale(28),
|
|
213
|
-
height: scale(28),
|
|
214
|
-
borderRadius: scale(14),
|
|
215
|
-
backgroundColor: COLORS.skeleton,
|
|
216
|
-
marginRight: scale(12),
|
|
217
|
-
},
|
|
218
|
-
logoFallback: {
|
|
219
|
-
width: scale(28),
|
|
220
|
-
height: scale(28),
|
|
221
|
-
borderRadius: scale(14),
|
|
222
|
-
backgroundColor: COLORS.logoFallback,
|
|
223
|
-
alignItems: 'center',
|
|
224
|
-
justifyContent: 'center',
|
|
225
|
-
marginRight: scale(12),
|
|
226
|
-
},
|
|
227
|
-
logoFallbackText: {
|
|
228
|
-
fontSize: moderateScale(12),
|
|
229
|
-
fontWeight: '700',
|
|
230
|
-
color: COLORS.background,
|
|
231
|
-
textTransform: 'uppercase',
|
|
232
|
-
},
|
|
233
|
-
gatewayText: {
|
|
234
|
-
fontSize: moderateScale(15),
|
|
235
|
-
fontWeight: '600',
|
|
236
|
-
textTransform: 'capitalize',
|
|
237
|
-
color: COLORS.darkText,
|
|
238
|
-
},
|
|
239
|
-
skeletonText: {
|
|
240
|
-
width: scale(80),
|
|
241
|
-
height: verticalScale(14),
|
|
242
|
-
backgroundColor: COLORS.skeleton,
|
|
243
|
-
borderRadius: scale(4),
|
|
244
|
-
},
|
|
245
|
-
radio: {
|
|
246
|
-
width: scale(20),
|
|
247
|
-
height: scale(20),
|
|
248
|
-
borderRadius: scale(10),
|
|
249
|
-
borderWidth: scale(2),
|
|
250
|
-
borderColor: COLORS.radioBorder,
|
|
251
|
-
alignItems: 'center',
|
|
252
|
-
justifyContent: 'center',
|
|
253
|
-
},
|
|
254
|
-
radioSelected: { borderColor: COLORS.selectedBorder },
|
|
255
|
-
radioDot: {
|
|
256
|
-
width: scale(10),
|
|
257
|
-
height: scale(10),
|
|
258
|
-
borderRadius: scale(5),
|
|
259
|
-
backgroundColor: COLORS.selectedBorder,
|
|
260
|
-
},
|
|
261
|
-
});
|
|
262
|
-
|
|
263
|
-
export default memo(PaymentMethod);
|
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
import { View, Text, Image, TouchableOpacity, StyleSheet } from 'react-native';
|
|
2
|
-
import { X } from 'lucide-react-native';
|
|
3
|
-
import { formatCurrency } from '../utils';
|
|
4
|
-
import type { ISummaryItem } from '../types';
|
|
5
|
-
|
|
6
|
-
export const Summary = ({
|
|
7
|
-
items = [],
|
|
8
|
-
displayCurrency = 'INR',
|
|
9
|
-
onRemoveItem,
|
|
10
|
-
}: {
|
|
11
|
-
items: ISummaryItem[];
|
|
12
|
-
displayCurrency?: string;
|
|
13
|
-
onRemoveItem?: (id: ISummaryItem['id']) => void;
|
|
14
|
-
}) => {
|
|
15
|
-
// Show error if no items
|
|
16
|
-
if (!items || items.length === 0) {
|
|
17
|
-
return (
|
|
18
|
-
<View style={styles.errorWrapper}>
|
|
19
|
-
<Text style={styles.errorText}>No items in summary.</Text>
|
|
20
|
-
</View>
|
|
21
|
-
);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return (
|
|
25
|
-
<View>
|
|
26
|
-
<Text style={styles.title}>Summary</Text>
|
|
27
|
-
<View style={styles.list}>
|
|
28
|
-
{items.map((item) => {
|
|
29
|
-
let discountedPrice = item.price;
|
|
30
|
-
if (item.discount) {
|
|
31
|
-
if (typeof item.discount === 'number') {
|
|
32
|
-
discountedPrice = (item.price * (100 - item.discount)) / 100;
|
|
33
|
-
} else if (item.discount.type === 'percentage') {
|
|
34
|
-
discountedPrice =
|
|
35
|
-
(item.price * (100 - item.discount.amount)) / 100;
|
|
36
|
-
} else if (item.discount.type === 'fixed') {
|
|
37
|
-
discountedPrice = item.price - item.discount.amount;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return (
|
|
42
|
-
<View key={`summary-${item.id}`} style={styles.itemBox}>
|
|
43
|
-
<View style={styles.row}>
|
|
44
|
-
<View style={styles.left}>
|
|
45
|
-
{item.image ? (
|
|
46
|
-
<Image source={{ uri: item.image }} style={styles.logo} />
|
|
47
|
-
) : (
|
|
48
|
-
<View style={[styles.logo, styles.logoTextContainer]}>
|
|
49
|
-
<Text style={styles.logoText}>
|
|
50
|
-
{item.name.slice(0, 2).toUpperCase()}
|
|
51
|
-
</Text>
|
|
52
|
-
</View>
|
|
53
|
-
)}
|
|
54
|
-
|
|
55
|
-
<View style={styles.info}>
|
|
56
|
-
<Text style={styles.itemName}>{item.name}</Text>
|
|
57
|
-
|
|
58
|
-
{item.discount ? (
|
|
59
|
-
<Text style={styles.subText}>
|
|
60
|
-
<Text style={styles.strike}>
|
|
61
|
-
{formatCurrency({
|
|
62
|
-
amount: item.price,
|
|
63
|
-
currency: displayCurrency,
|
|
64
|
-
})}
|
|
65
|
-
</Text>
|
|
66
|
-
<Text> </Text>
|
|
67
|
-
<Text style={styles.discounted}>
|
|
68
|
-
{formatCurrency({
|
|
69
|
-
amount: discountedPrice,
|
|
70
|
-
currency: displayCurrency,
|
|
71
|
-
})}
|
|
72
|
-
</Text>
|
|
73
|
-
{item.duration ? (
|
|
74
|
-
<Text>{` /${item.duration}`}</Text>
|
|
75
|
-
) : null}
|
|
76
|
-
</Text>
|
|
77
|
-
) : (
|
|
78
|
-
<Text style={styles.subText}>
|
|
79
|
-
{formatCurrency({
|
|
80
|
-
amount: discountedPrice,
|
|
81
|
-
currency: displayCurrency,
|
|
82
|
-
})}
|
|
83
|
-
{item.duration ? (
|
|
84
|
-
<Text>{` /${item.duration}`}</Text>
|
|
85
|
-
) : null}
|
|
86
|
-
</Text>
|
|
87
|
-
)}
|
|
88
|
-
</View>
|
|
89
|
-
</View>
|
|
90
|
-
|
|
91
|
-
{onRemoveItem && (
|
|
92
|
-
<TouchableOpacity
|
|
93
|
-
onPress={() => onRemoveItem(item.id)}
|
|
94
|
-
style={styles.removeBtn}
|
|
95
|
-
>
|
|
96
|
-
<X size={20} />
|
|
97
|
-
</TouchableOpacity>
|
|
98
|
-
)}
|
|
99
|
-
</View>
|
|
100
|
-
</View>
|
|
101
|
-
);
|
|
102
|
-
})}
|
|
103
|
-
</View>
|
|
104
|
-
</View>
|
|
105
|
-
);
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
const styles = StyleSheet.create({
|
|
109
|
-
title: {
|
|
110
|
-
fontSize: 18,
|
|
111
|
-
fontWeight: '700',
|
|
112
|
-
marginBottom: 10,
|
|
113
|
-
},
|
|
114
|
-
list: {
|
|
115
|
-
gap: 10,
|
|
116
|
-
},
|
|
117
|
-
itemBox: {
|
|
118
|
-
padding: 12,
|
|
119
|
-
borderRadius: 12,
|
|
120
|
-
marginBottom: 10,
|
|
121
|
-
borderColor: '#a6e6cf',
|
|
122
|
-
borderWidth: 1,
|
|
123
|
-
backgroundColor: 'rgba(224, 243, 236, 0.68)',
|
|
124
|
-
},
|
|
125
|
-
row: {
|
|
126
|
-
flexDirection: 'row',
|
|
127
|
-
alignItems: 'center',
|
|
128
|
-
justifyContent: 'space-between',
|
|
129
|
-
},
|
|
130
|
-
left: {
|
|
131
|
-
flexDirection: 'row',
|
|
132
|
-
alignItems: 'center',
|
|
133
|
-
gap: 10,
|
|
134
|
-
flex: 1,
|
|
135
|
-
},
|
|
136
|
-
logo: {
|
|
137
|
-
width: 42,
|
|
138
|
-
height: 42,
|
|
139
|
-
borderRadius: 8,
|
|
140
|
-
backgroundColor: '#ddd',
|
|
141
|
-
justifyContent: 'center',
|
|
142
|
-
alignItems: 'center',
|
|
143
|
-
},
|
|
144
|
-
logoTextContainer: {
|
|
145
|
-
backgroundColor: '#444',
|
|
146
|
-
},
|
|
147
|
-
logoText: {
|
|
148
|
-
fontWeight: '700',
|
|
149
|
-
color: '#fff',
|
|
150
|
-
},
|
|
151
|
-
info: {
|
|
152
|
-
flexDirection: 'column',
|
|
153
|
-
},
|
|
154
|
-
itemName: {
|
|
155
|
-
fontSize: 15,
|
|
156
|
-
fontWeight: '600',
|
|
157
|
-
color: '#111',
|
|
158
|
-
},
|
|
159
|
-
subText: {
|
|
160
|
-
fontSize: 13,
|
|
161
|
-
color: '#222',
|
|
162
|
-
},
|
|
163
|
-
strike: {
|
|
164
|
-
textDecorationLine: 'line-through',
|
|
165
|
-
color: '#444',
|
|
166
|
-
},
|
|
167
|
-
discounted: {
|
|
168
|
-
fontWeight: '700',
|
|
169
|
-
color: '#000',
|
|
170
|
-
},
|
|
171
|
-
removeBtn: {
|
|
172
|
-
padding: 6,
|
|
173
|
-
borderRadius: 20,
|
|
174
|
-
},
|
|
175
|
-
errorWrapper: {
|
|
176
|
-
padding: 12,
|
|
177
|
-
borderRadius: 12,
|
|
178
|
-
backgroundColor: '#fee2e2',
|
|
179
|
-
borderWidth: 1,
|
|
180
|
-
borderColor: '#fca5a5',
|
|
181
|
-
marginVertical: 10,
|
|
182
|
-
},
|
|
183
|
-
errorText: {
|
|
184
|
-
color: '#b91c1c',
|
|
185
|
-
fontWeight: '600',
|
|
186
|
-
textAlign: 'center',
|
|
187
|
-
},
|
|
188
|
-
});
|
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
View,
|
|
4
|
-
Text,
|
|
5
|
-
TextInput,
|
|
6
|
-
StyleSheet,
|
|
7
|
-
TouchableOpacity,
|
|
8
|
-
ActivityIndicator,
|
|
9
|
-
} from 'react-native';
|
|
10
|
-
import LinearGradient from 'react-native-linear-gradient';
|
|
11
|
-
import { scale, verticalScale, moderateScale } from 'react-native-size-matters';
|
|
12
|
-
|
|
13
|
-
const COLORS = {
|
|
14
|
-
primaryOrange: '#FF7847',
|
|
15
|
-
secondaryOrange: '#c24c21',
|
|
16
|
-
disabledOrangeStart: '#df7026ff',
|
|
17
|
-
disabledOrangeEnd: '#ce6320ff',
|
|
18
|
-
black: '#000',
|
|
19
|
-
white: '#fff',
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
interface VoucherBoxProps {
|
|
23
|
-
onApply?: ({ voucherCode }: { voucherCode: string }) => void;
|
|
24
|
-
loading?: boolean;
|
|
25
|
-
couponApplied?: boolean;
|
|
26
|
-
onRemove?: () => void;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const VoucherBox: React.FC<VoucherBoxProps> = ({
|
|
30
|
-
onApply,
|
|
31
|
-
loading = false,
|
|
32
|
-
couponApplied = false,
|
|
33
|
-
onRemove,
|
|
34
|
-
}) => {
|
|
35
|
-
const [voucher, setVoucher] = React.useState('');
|
|
36
|
-
|
|
37
|
-
return (
|
|
38
|
-
<View style={styles.container}>
|
|
39
|
-
<Text style={styles.title}>Voucher</Text>
|
|
40
|
-
|
|
41
|
-
{couponApplied ? (
|
|
42
|
-
// Display applied voucher with remove button
|
|
43
|
-
<View style={styles.appliedWrapper}>
|
|
44
|
-
<Text style={styles.appliedText}>{voucher}</Text>
|
|
45
|
-
<TouchableOpacity
|
|
46
|
-
style={styles.removeButton}
|
|
47
|
-
onPress={() => {
|
|
48
|
-
setVoucher('');
|
|
49
|
-
onRemove?.();
|
|
50
|
-
}}
|
|
51
|
-
accessibilityRole="button"
|
|
52
|
-
accessibilityLabel="Remove voucher"
|
|
53
|
-
>
|
|
54
|
-
<Text style={styles.removeText}>Remove</Text>
|
|
55
|
-
</TouchableOpacity>
|
|
56
|
-
</View>
|
|
57
|
-
) : (
|
|
58
|
-
// Input for new voucher
|
|
59
|
-
<View style={styles.inputWrapper}>
|
|
60
|
-
<TextInput
|
|
61
|
-
placeholder="Enter code..."
|
|
62
|
-
style={styles.input}
|
|
63
|
-
value={voucher}
|
|
64
|
-
onChangeText={(text) => setVoucher(text.toUpperCase())}
|
|
65
|
-
autoCapitalize="characters"
|
|
66
|
-
editable={!loading}
|
|
67
|
-
accessibilityLabel="Voucher code input"
|
|
68
|
-
/>
|
|
69
|
-
<TouchableOpacity
|
|
70
|
-
style={styles.button}
|
|
71
|
-
onPress={() => onApply?.({ voucherCode: voucher })}
|
|
72
|
-
disabled={!voucher || loading}
|
|
73
|
-
activeOpacity={0.8}
|
|
74
|
-
accessibilityRole="button"
|
|
75
|
-
accessibilityLabel="Apply voucher code"
|
|
76
|
-
>
|
|
77
|
-
<LinearGradient
|
|
78
|
-
colors={
|
|
79
|
-
voucher
|
|
80
|
-
? [COLORS.primaryOrange, COLORS.secondaryOrange]
|
|
81
|
-
: [COLORS.disabledOrangeStart, COLORS.disabledOrangeEnd]
|
|
82
|
-
}
|
|
83
|
-
style={styles.gradient}
|
|
84
|
-
start={{ x: 0, y: 0 }}
|
|
85
|
-
end={{ x: 1, y: 0 }}
|
|
86
|
-
>
|
|
87
|
-
{loading ? (
|
|
88
|
-
<ActivityIndicator size="small" color={COLORS.white} />
|
|
89
|
-
) : (
|
|
90
|
-
<Text
|
|
91
|
-
style={[
|
|
92
|
-
styles.buttonText,
|
|
93
|
-
!voucher && styles.disabledButtonText,
|
|
94
|
-
]}
|
|
95
|
-
>
|
|
96
|
-
Apply
|
|
97
|
-
</Text>
|
|
98
|
-
)}
|
|
99
|
-
</LinearGradient>
|
|
100
|
-
</TouchableOpacity>
|
|
101
|
-
</View>
|
|
102
|
-
)}
|
|
103
|
-
</View>
|
|
104
|
-
);
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
const styles = StyleSheet.create({
|
|
108
|
-
container: { marginBottom: verticalScale(12) },
|
|
109
|
-
title: {
|
|
110
|
-
fontSize: moderateScale(16),
|
|
111
|
-
fontWeight: '700',
|
|
112
|
-
color: COLORS.black,
|
|
113
|
-
marginBottom: verticalScale(8),
|
|
114
|
-
},
|
|
115
|
-
inputWrapper: {
|
|
116
|
-
flexDirection: 'row',
|
|
117
|
-
alignItems: 'center',
|
|
118
|
-
backgroundColor: COLORS.white,
|
|
119
|
-
height: moderateScale(47),
|
|
120
|
-
borderRadius: scale(8),
|
|
121
|
-
borderWidth: 1,
|
|
122
|
-
borderColor: COLORS.primaryOrange,
|
|
123
|
-
width: '100%',
|
|
124
|
-
paddingVertical: verticalScale(2),
|
|
125
|
-
overflow: 'hidden',
|
|
126
|
-
},
|
|
127
|
-
input: {
|
|
128
|
-
flex: 1,
|
|
129
|
-
height: '100%',
|
|
130
|
-
fontSize: moderateScale(14),
|
|
131
|
-
paddingHorizontal: scale(14),
|
|
132
|
-
borderRadius: scale(12),
|
|
133
|
-
},
|
|
134
|
-
button: {
|
|
135
|
-
minWidth: scale(80),
|
|
136
|
-
height: moderateScale(45),
|
|
137
|
-
overflow: 'hidden',
|
|
138
|
-
justifyContent: 'center',
|
|
139
|
-
alignItems: 'center',
|
|
140
|
-
},
|
|
141
|
-
gradient: {
|
|
142
|
-
width: '100%',
|
|
143
|
-
height: '100%',
|
|
144
|
-
alignItems: 'center',
|
|
145
|
-
justifyContent: 'center',
|
|
146
|
-
// borderRadius: scale(10),
|
|
147
|
-
},
|
|
148
|
-
buttonText: {
|
|
149
|
-
color: COLORS.white,
|
|
150
|
-
fontWeight: '700',
|
|
151
|
-
fontSize: moderateScale(15),
|
|
152
|
-
textTransform: 'uppercase',
|
|
153
|
-
},
|
|
154
|
-
disabledButtonText: { opacity: 0.7 },
|
|
155
|
-
appliedWrapper: {
|
|
156
|
-
flexDirection: 'row',
|
|
157
|
-
justifyContent: 'space-between',
|
|
158
|
-
alignItems: 'center',
|
|
159
|
-
borderColor: COLORS.primaryOrange,
|
|
160
|
-
borderWidth: 1,
|
|
161
|
-
backgroundColor: '#F3F4F6',
|
|
162
|
-
borderRadius: scale(8),
|
|
163
|
-
paddingHorizontal: scale(12),
|
|
164
|
-
paddingVertical: verticalScale(10),
|
|
165
|
-
},
|
|
166
|
-
appliedText: {
|
|
167
|
-
fontSize: moderateScale(14),
|
|
168
|
-
fontWeight: '600',
|
|
169
|
-
color: COLORS.black,
|
|
170
|
-
},
|
|
171
|
-
removeButton: {
|
|
172
|
-
paddingHorizontal: scale(5),
|
|
173
|
-
paddingVertical: verticalScale(4),
|
|
174
|
-
},
|
|
175
|
-
removeText: {
|
|
176
|
-
fontSize: moderateScale(14),
|
|
177
|
-
fontWeight: '700',
|
|
178
|
-
color: COLORS.primaryOrange,
|
|
179
|
-
},
|
|
180
|
-
});
|
|
181
|
-
|
|
182
|
-
export default VoucherBox;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import PaymentService from './services/payments/payments';
|
|
2
|
-
|
|
3
|
-
export interface IOptions {
|
|
4
|
-
publicKey: string;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export interface APIError {
|
|
8
|
-
type: string;
|
|
9
|
-
status?: number | string;
|
|
10
|
-
message: string;
|
|
11
|
-
path?: string;
|
|
12
|
-
location?: string;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export class ZezoPayClient {
|
|
16
|
-
payments: PaymentService;
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Constructor for the ZezoPay class.
|
|
20
|
-
* @param options
|
|
21
|
-
*/
|
|
22
|
-
constructor(options: IOptions) {
|
|
23
|
-
this.payments = new PaymentService(options);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export * from './services/payments/payments.types';
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import axios, {
|
|
2
|
-
type AxiosInstance,
|
|
3
|
-
type AxiosRequestConfig,
|
|
4
|
-
type AxiosResponse,
|
|
5
|
-
} from 'axios';
|
|
6
|
-
import type { APIError, IOptions } from '../api-sdk';
|
|
7
|
-
import { formatAPIError } from '../utils/errorFormatter';
|
|
8
|
-
|
|
9
|
-
class BaseService {
|
|
10
|
-
protected client: AxiosInstance;
|
|
11
|
-
|
|
12
|
-
constructor(options: IOptions) {
|
|
13
|
-
this.client = axios.create({
|
|
14
|
-
baseURL: 'https://payapi.zezo.in',
|
|
15
|
-
// baseURL: 'http://localhost:5501',
|
|
16
|
-
headers: {
|
|
17
|
-
'Content-Type': 'application/json',
|
|
18
|
-
'Accept': 'application/json',
|
|
19
|
-
'x-public-key': String(options.publicKey) || '',
|
|
20
|
-
},
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
protected async request<T = any>(
|
|
25
|
-
config: AxiosRequestConfig
|
|
26
|
-
): Promise<AxiosResponse<T>> {
|
|
27
|
-
try {
|
|
28
|
-
return await this.client.request<T>(config);
|
|
29
|
-
} catch (error) {
|
|
30
|
-
// 🔥 Always return consistent APIError format
|
|
31
|
-
const formattedError: APIError = formatAPIError(error);
|
|
32
|
-
throw formattedError;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export default BaseService;
|