fairsure-checkout-sdk 1.0.8 → 1.0.9
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/dist/components/PaystackCheckout.js +5 -3
- package/dist/components/USSDPayment.js +37 -3
- package/dist/components/usePaymentCheckout.js +3 -4
- package/package.json +1 -1
- package/src/components/PaystackCheckout.tsx +2 -2
- package/src/components/USSDPayment.tsx +41 -3
- package/src/components/usePaymentCheckout.ts +1 -3
|
@@ -93,9 +93,11 @@ export default function Checkout({ requestId, customerEmail, customerName, custo
|
|
|
93
93
|
<Text style={styles.payButtonText}>{getButtonText()}</Text>
|
|
94
94
|
{checkout.loading && (<ActivityIndicator size="small" color="white"/>)}
|
|
95
95
|
</TouchableOpacity>
|
|
96
|
-
{!checkout.loading && checkout.timeLeft <= 0 && (
|
|
97
|
-
|
|
98
|
-
|
|
96
|
+
{/* {!checkout.loading && checkout.timeLeft <= 0 && (
|
|
97
|
+
<TouchableOpacity>
|
|
98
|
+
<Text>Resend</Text>
|
|
99
|
+
</TouchableOpacity>
|
|
100
|
+
)} */}
|
|
99
101
|
|
|
100
102
|
{/* Footer */}
|
|
101
103
|
<View style={styles.footer}>
|
|
@@ -12,6 +12,18 @@ export default function USSDPayment({ selectedBank, setSelectedBank, showBankDro
|
|
|
12
12
|
<Ionicons name="chevron-down" size={20} color="#9CA3AF"/>
|
|
13
13
|
</TouchableOpacity>
|
|
14
14
|
|
|
15
|
+
{!showBankDropdown && !selectedBank && (<View style={styles.instructionContainer}>
|
|
16
|
+
<Text style={styles.instructionTitle}>How to pay with USSD</Text>
|
|
17
|
+
|
|
18
|
+
<Text style={styles.instructionText}>
|
|
19
|
+
1. Select your bank{"\n"}
|
|
20
|
+
2. Dial the generated USSD code{"\n"}
|
|
21
|
+
3. Follow the prompts on your phone{"\n"}
|
|
22
|
+
4. Authorize payment with your PIN{"\n"}
|
|
23
|
+
5. Click the "Confirm Payment" button.
|
|
24
|
+
</Text>
|
|
25
|
+
</View>)}
|
|
26
|
+
|
|
15
27
|
{showBankDropdown && (<BankDropdown ussdBanks={ussdBanks} loading={loading} onSelectBank={(bank) => {
|
|
16
28
|
setSelectedBank(bank);
|
|
17
29
|
setShowBankDropdown(false);
|
|
@@ -51,12 +63,32 @@ function USSDInstructions({ ussdCode, copied, handleCopy, loading, }) {
|
|
|
51
63
|
<Text style={styles.ussdStepsText}>
|
|
52
64
|
1. Dial the USSD code on your phone{"\n"}
|
|
53
65
|
2. Follow the prompts on your screen{"\n"}
|
|
54
|
-
3. Authorize payment with your bank PIN
|
|
66
|
+
3. Authorize payment with your bank PIN{"\n"}
|
|
67
|
+
4. Click the "Confirm Payment" button.
|
|
55
68
|
</Text>
|
|
56
69
|
</View>
|
|
57
70
|
</View>);
|
|
58
71
|
}
|
|
59
72
|
const styles = StyleSheet.create({
|
|
73
|
+
instructionContainer: {
|
|
74
|
+
marginTop: 12,
|
|
75
|
+
padding: 16,
|
|
76
|
+
backgroundColor: "#F9FAFB",
|
|
77
|
+
borderRadius: 12,
|
|
78
|
+
borderWidth: 1,
|
|
79
|
+
borderColor: "#E5E7EB",
|
|
80
|
+
},
|
|
81
|
+
instructionTitle: {
|
|
82
|
+
fontSize: 14,
|
|
83
|
+
fontWeight: "600",
|
|
84
|
+
color: "#111827",
|
|
85
|
+
marginBottom: 8,
|
|
86
|
+
},
|
|
87
|
+
instructionText: {
|
|
88
|
+
fontSize: 13,
|
|
89
|
+
lineHeight: 22,
|
|
90
|
+
color: "#6B7280",
|
|
91
|
+
},
|
|
60
92
|
overlay: {
|
|
61
93
|
flex: 1,
|
|
62
94
|
backgroundColor: "rgba(0,0,0,0.5)",
|
|
@@ -250,8 +282,9 @@ const styles = StyleSheet.create({
|
|
|
250
282
|
},
|
|
251
283
|
ussdCodeContainer: {
|
|
252
284
|
backgroundColor: "white", // bg-white
|
|
253
|
-
borderRadius:
|
|
254
|
-
|
|
285
|
+
borderRadius: 8, // rounded-xl
|
|
286
|
+
paddingHorizontal: 12, // p-4
|
|
287
|
+
paddingTop: 12,
|
|
255
288
|
marginBottom: 12, // mb-3
|
|
256
289
|
},
|
|
257
290
|
ussdCodeRow: {
|
|
@@ -277,6 +310,7 @@ const styles = StyleSheet.create({
|
|
|
277
310
|
},
|
|
278
311
|
ussdStepsText: {
|
|
279
312
|
fontSize: 14, // text-sm
|
|
313
|
+
padding: 4, // px-2
|
|
280
314
|
color: "#1E40AF", // text-indigo-800
|
|
281
315
|
},
|
|
282
316
|
payButton: {
|
|
@@ -67,7 +67,7 @@ export function usePaymentCheckout(amount, requestId, customerEmail, customerNam
|
|
|
67
67
|
}
|
|
68
68
|
}, [selectedMethod]);
|
|
69
69
|
const fetchTransferDetails = async () => {
|
|
70
|
-
var _a
|
|
70
|
+
var _a;
|
|
71
71
|
setLoading(true);
|
|
72
72
|
try {
|
|
73
73
|
const payload = {
|
|
@@ -84,8 +84,7 @@ export function usePaymentCheckout(amount, requestId, customerEmail, customerNam
|
|
|
84
84
|
"User-Agent": "PostmanRuntime/7.51.0",
|
|
85
85
|
},
|
|
86
86
|
});
|
|
87
|
-
|
|
88
|
-
setTransferDetail((_b = res === null || res === void 0 ? void 0 : res.data) === null || _b === void 0 ? void 0 : _b.data);
|
|
87
|
+
setTransferDetail((_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.data);
|
|
89
88
|
}
|
|
90
89
|
catch (error) {
|
|
91
90
|
console.log("FETCH ERROR:", error);
|
|
@@ -127,7 +126,7 @@ export function usePaymentCheckout(amount, requestId, customerEmail, customerNam
|
|
|
127
126
|
codeReference: ussdBankResponse === null || ussdBankResponse === void 0 ? void 0 : ussdBankResponse.codeRef,
|
|
128
127
|
amount: ussdBankResponse === null || ussdBankResponse === void 0 ? void 0 : ussdBankResponse.amount,
|
|
129
128
|
};
|
|
130
|
-
const res = await axios.post("https://api.
|
|
129
|
+
const res = await axios.post("https://api.fairsurepay.com/api/pub/ussd-status", payload, {
|
|
131
130
|
headers: {
|
|
132
131
|
Accept: "application/json",
|
|
133
132
|
"Content-Type": "application/json",
|
package/package.json
CHANGED
|
@@ -194,11 +194,11 @@ export default function Checkout({
|
|
|
194
194
|
<ActivityIndicator size="small" color="white" />
|
|
195
195
|
)}
|
|
196
196
|
</TouchableOpacity>
|
|
197
|
-
{!checkout.loading && checkout.timeLeft <= 0 && (
|
|
197
|
+
{/* {!checkout.loading && checkout.timeLeft <= 0 && (
|
|
198
198
|
<TouchableOpacity>
|
|
199
199
|
<Text>Resend</Text>
|
|
200
200
|
</TouchableOpacity>
|
|
201
|
-
)}
|
|
201
|
+
)} */}
|
|
202
202
|
|
|
203
203
|
{/* Footer */}
|
|
204
204
|
<View style={styles.footer}>
|
|
@@ -56,6 +56,20 @@ export default function USSDPayment({
|
|
|
56
56
|
<Ionicons name="chevron-down" size={20} color="#9CA3AF" />
|
|
57
57
|
</TouchableOpacity>
|
|
58
58
|
|
|
59
|
+
{!showBankDropdown && !selectedBank && (
|
|
60
|
+
<View style={styles.instructionContainer}>
|
|
61
|
+
<Text style={styles.instructionTitle}>How to pay with USSD</Text>
|
|
62
|
+
|
|
63
|
+
<Text style={styles.instructionText}>
|
|
64
|
+
1. Select your bank{"\n"}
|
|
65
|
+
2. Dial the generated USSD code{"\n"}
|
|
66
|
+
3. Follow the prompts on your phone{"\n"}
|
|
67
|
+
4. Authorize payment with your PIN{"\n"}
|
|
68
|
+
5. Click the "Confirm Payment" button.
|
|
69
|
+
</Text>
|
|
70
|
+
</View>
|
|
71
|
+
)}
|
|
72
|
+
|
|
59
73
|
{showBankDropdown && (
|
|
60
74
|
<BankDropdown
|
|
61
75
|
ussdBanks={ussdBanks}
|
|
@@ -153,13 +167,35 @@ function USSDInstructions({
|
|
|
153
167
|
<Text style={styles.ussdStepsText}>
|
|
154
168
|
1. Dial the USSD code on your phone{"\n"}
|
|
155
169
|
2. Follow the prompts on your screen{"\n"}
|
|
156
|
-
3. Authorize payment with your bank PIN
|
|
170
|
+
3. Authorize payment with your bank PIN{"\n"}
|
|
171
|
+
4. Click the "Confirm Payment" button.
|
|
157
172
|
</Text>
|
|
158
173
|
</View>
|
|
159
174
|
</View>
|
|
160
175
|
);
|
|
161
176
|
}
|
|
162
177
|
const styles = StyleSheet.create({
|
|
178
|
+
instructionContainer: {
|
|
179
|
+
marginTop: 12,
|
|
180
|
+
padding: 16,
|
|
181
|
+
backgroundColor: "#F9FAFB",
|
|
182
|
+
borderRadius: 12,
|
|
183
|
+
borderWidth: 1,
|
|
184
|
+
borderColor: "#E5E7EB",
|
|
185
|
+
},
|
|
186
|
+
|
|
187
|
+
instructionTitle: {
|
|
188
|
+
fontSize: 14,
|
|
189
|
+
fontWeight: "600",
|
|
190
|
+
color: "#111827",
|
|
191
|
+
marginBottom: 8,
|
|
192
|
+
},
|
|
193
|
+
|
|
194
|
+
instructionText: {
|
|
195
|
+
fontSize: 13,
|
|
196
|
+
lineHeight: 22,
|
|
197
|
+
color: "#6B7280",
|
|
198
|
+
},
|
|
163
199
|
overlay: {
|
|
164
200
|
flex: 1,
|
|
165
201
|
backgroundColor: "rgba(0,0,0,0.5)",
|
|
@@ -356,8 +392,9 @@ const styles = StyleSheet.create({
|
|
|
356
392
|
},
|
|
357
393
|
ussdCodeContainer: {
|
|
358
394
|
backgroundColor: "white", // bg-white
|
|
359
|
-
borderRadius:
|
|
360
|
-
|
|
395
|
+
borderRadius: 8, // rounded-xl
|
|
396
|
+
paddingHorizontal: 12, // p-4
|
|
397
|
+
paddingTop: 12,
|
|
361
398
|
marginBottom: 12, // mb-3
|
|
362
399
|
},
|
|
363
400
|
ussdCodeRow: {
|
|
@@ -383,6 +420,7 @@ const styles = StyleSheet.create({
|
|
|
383
420
|
},
|
|
384
421
|
ussdStepsText: {
|
|
385
422
|
fontSize: 14, // text-sm
|
|
423
|
+
padding: 4, // px-2
|
|
386
424
|
color: "#1E40AF", // text-indigo-800
|
|
387
425
|
},
|
|
388
426
|
payButton: {
|
|
@@ -104,8 +104,6 @@ export function usePaymentCheckout(
|
|
|
104
104
|
},
|
|
105
105
|
},
|
|
106
106
|
);
|
|
107
|
-
console.log("RESPONSE", res?.data?.data);
|
|
108
|
-
|
|
109
107
|
setTransferDetail(res?.data?.data);
|
|
110
108
|
} catch (error) {
|
|
111
109
|
console.log("FETCH ERROR:", error);
|
|
@@ -151,7 +149,7 @@ export function usePaymentCheckout(
|
|
|
151
149
|
amount: ussdBankResponse?.amount,
|
|
152
150
|
};
|
|
153
151
|
const res = await axios.post(
|
|
154
|
-
"https://api.
|
|
152
|
+
"https://api.fairsurepay.com/api/pub/ussd-status",
|
|
155
153
|
payload,
|
|
156
154
|
{
|
|
157
155
|
headers: {
|