react-native-fpay 0.4.19 → 0.4.21
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/FountainPayProvider.js +50 -126
- package/lib/module/FountainPayProvider.js.map +1 -1
- package/lib/module/core/api/client.js +1 -1
- package/lib/module/core/api/index.js +16 -12
- package/lib/module/core/api/index.js.map +1 -1
- package/lib/module/core/types/index.js +1 -1
- package/lib/module/core/types/index.js.map +1 -1
- package/lib/module/engine/FPEngine.js +27 -16
- package/lib/module/engine/FPEngine.js.map +1 -1
- package/lib/module/store/FPStore.js +11 -4
- package/lib/module/store/FPStore.js.map +1 -1
- package/lib/module/ui/components/ConfirmScreen.js +2 -2
- package/lib/module/ui/components/ConfirmScreen.js.map +1 -1
- package/lib/module/ui/modals/FPCreatePin.js +234 -0
- package/lib/module/ui/modals/FPCreatePin.js.map +1 -0
- package/lib/module/ui/modals/FPShell.js +7 -3
- package/lib/module/ui/modals/FPShell.js.map +1 -1
- package/lib/module/ui/modals/FPValidateBvn.js +258 -0
- package/lib/module/ui/modals/FPValidateBvn.js.map +1 -0
- package/lib/module/ui/screens/ResultScreen.js +4 -17
- package/lib/module/ui/screens/ResultScreen.js.map +1 -1
- package/lib/module/ui/screens/SendScreen.js +24 -9
- package/lib/module/ui/screens/SendScreen.js.map +1 -1
- package/lib/module/ui/screens/sub/sendPayment/ProximitySubScreen.js +3 -3
- package/lib/module/ui/screens/sub/sendPayment/ProximitySubScreen.js.map +1 -1
- package/lib/module/ui/screens/sub/sendPayment/TransferSubScreen.js +8 -1
- package/lib/module/ui/screens/sub/sendPayment/TransferSubScreen.js.map +1 -1
- package/lib/typescript/src/FountainPayProvider.d.ts +3 -4
- package/lib/typescript/src/FountainPayProvider.d.ts.map +1 -1
- package/lib/typescript/src/core/api/index.d.ts +20 -20
- package/lib/typescript/src/core/api/index.d.ts.map +1 -1
- package/lib/typescript/src/core/types/index.d.ts +16 -6
- package/lib/typescript/src/core/types/index.d.ts.map +1 -1
- package/lib/typescript/src/engine/FPEngine.d.ts +3 -0
- package/lib/typescript/src/engine/FPEngine.d.ts.map +1 -1
- package/lib/typescript/src/store/FPStore.d.ts +8 -5
- package/lib/typescript/src/store/FPStore.d.ts.map +1 -1
- package/lib/typescript/src/ui/components/ConfirmScreen.d.ts +1 -2
- package/lib/typescript/src/ui/components/ConfirmScreen.d.ts.map +1 -1
- package/lib/typescript/src/ui/modals/FPCreatePin.d.ts +3 -0
- package/lib/typescript/src/ui/modals/FPCreatePin.d.ts.map +1 -0
- package/lib/typescript/src/ui/modals/FPShell.d.ts.map +1 -1
- package/lib/typescript/src/ui/modals/FPValidateBvn.d.ts +3 -0
- package/lib/typescript/src/ui/modals/FPValidateBvn.d.ts.map +1 -0
- package/lib/typescript/src/ui/screens/ResultScreen.d.ts.map +1 -1
- package/lib/typescript/src/ui/screens/SendScreen.d.ts.map +1 -1
- package/lib/typescript/src/ui/screens/sub/sendPayment/TransferSubScreen.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/FountainPayProvider.tsx +59 -149
- package/src/core/api/client.ts +1 -1
- package/src/core/api/index.ts +56 -52
- package/src/core/types/index.ts +18 -5
- package/src/engine/FPEngine.ts +34 -17
- package/src/store/FPStore.ts +15 -8
- package/src/ui/components/ConfirmScreen.tsx +4 -3
- package/src/ui/modals/FPCreatePin.tsx +206 -0
- package/src/ui/modals/FPShell.tsx +16 -2
- package/src/ui/modals/FPValidateBvn.tsx +229 -0
- package/src/ui/screens/ResultScreen.tsx +6 -10
- package/src/ui/screens/SendScreen.tsx +60 -36
- package/src/ui/screens/sub/sendPayment/ProximitySubScreen.tsx +3 -3
- package/src/ui/screens/sub/sendPayment/TransferSubScreen.tsx +7 -1
|
@@ -25,6 +25,7 @@ import type {
|
|
|
25
25
|
FPUserInfo,
|
|
26
26
|
FPTransferRecipient,
|
|
27
27
|
FPSendWalletPaymentRequest,
|
|
28
|
+
FPInternalTransferRecipient,
|
|
28
29
|
} from '../../core/types';
|
|
29
30
|
import styled from 'styled-components/native';
|
|
30
31
|
import Ionicons from 'react-native-vector-icons/Ionicons';
|
|
@@ -339,51 +340,74 @@ const SendScreen = ({
|
|
|
339
340
|
};
|
|
340
341
|
|
|
341
342
|
const handleProcessingTransaction = async (temptId: string) => {
|
|
342
|
-
console.log('Got in here for processing');
|
|
343
343
|
try {
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
response = (await transferAPI.sendToWallet(
|
|
358
|
-
transactionPayload as FPSendWalletPaymentRequest,
|
|
359
|
-
temptId
|
|
360
|
-
)) || null;
|
|
361
|
-
}
|
|
362
|
-
break;
|
|
363
|
-
case 'nqr':
|
|
364
|
-
response = await nqrAPI.pay(
|
|
344
|
+
setLoading(true);
|
|
345
|
+
setShowConfirmationModal(false);
|
|
346
|
+
let response: any = null;
|
|
347
|
+
|
|
348
|
+
const recipient = transactionPayload?.recipient as any;
|
|
349
|
+
|
|
350
|
+
switch (transactionPayload?.channel) {
|
|
351
|
+
case 'transfer':
|
|
352
|
+
case 'bluetooth':
|
|
353
|
+
case 'proximity': {
|
|
354
|
+
// Internal transfer — recipient has id + type (AGENT/TERMINAL)
|
|
355
|
+
if (recipient?.id && recipient?.type && ['AGENT', 'TERMINAL'].includes(recipient.type)) {
|
|
356
|
+
response = await transferAPI.sendToWallet(
|
|
365
357
|
{
|
|
366
358
|
...transactionPayload,
|
|
367
|
-
|
|
368
|
-
|
|
359
|
+
recipient: {
|
|
360
|
+
agent_id: recipient.id,
|
|
361
|
+
type: recipient.type,
|
|
362
|
+
},
|
|
369
363
|
},
|
|
370
364
|
temptId
|
|
371
365
|
);
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
366
|
+
}
|
|
367
|
+
// Bank transfer — recipient has accountNumber + bankCode
|
|
368
|
+
else if (recipient?.bankCode) {
|
|
369
|
+
response = await transferAPI.sendToBank(
|
|
370
|
+
transactionPayload as FPSendPaymentRequest,
|
|
371
|
+
temptId
|
|
372
|
+
);
|
|
373
|
+
}
|
|
374
|
+
// Wallet transfer — recipient has accountNumber + userId/agentId
|
|
375
|
+
else {
|
|
376
|
+
response = await transferAPI.sendToWallet(
|
|
377
|
+
transactionPayload as FPSendWalletPaymentRequest,
|
|
380
378
|
temptId
|
|
381
379
|
);
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
onError?.({ message: 'Invalid channel' } as FPError);
|
|
385
|
-
break;
|
|
380
|
+
}
|
|
381
|
+
break;
|
|
386
382
|
}
|
|
383
|
+
|
|
384
|
+
case 'nqr':
|
|
385
|
+
response = await nqrAPI.pay(
|
|
386
|
+
{
|
|
387
|
+
...transactionPayload,
|
|
388
|
+
sender: user ?? undefined,
|
|
389
|
+
narration: `Send ${formatted} to ${recipient?.accountName ?? ''}`,
|
|
390
|
+
},
|
|
391
|
+
temptId
|
|
392
|
+
);
|
|
393
|
+
break;
|
|
394
|
+
|
|
395
|
+
case 'nfc':
|
|
396
|
+
response = await nfcAPI.pay(
|
|
397
|
+
{
|
|
398
|
+
...transactionPayload,
|
|
399
|
+
sender: user ?? undefined,
|
|
400
|
+
narration: `Send ${formatted} to ${recipient?.accountName ?? ''}`,
|
|
401
|
+
},
|
|
402
|
+
temptId
|
|
403
|
+
);
|
|
404
|
+
break;
|
|
405
|
+
|
|
406
|
+
default:
|
|
407
|
+
onError?.({ message: 'Invalid channel' } as FPError);
|
|
408
|
+
return;
|
|
409
|
+
}
|
|
410
|
+
|
|
387
411
|
|
|
388
412
|
if (!response?.status) {
|
|
389
413
|
// Show failed result screen
|
|
@@ -266,14 +266,14 @@ export function ProximitySubScreen({
|
|
|
266
266
|
sender_type: 'USER',
|
|
267
267
|
recipient: {
|
|
268
268
|
accountNumber: selected.accountNumber || '',
|
|
269
|
-
type: selected.userType === '
|
|
269
|
+
type: selected.userType === 'AGENT' ? 'USER' : 'AGENT',
|
|
270
270
|
accountName: selected.displayName || '',
|
|
271
271
|
agentId:
|
|
272
|
-
selected.userType === '
|
|
272
|
+
selected.userType === 'AGENT'
|
|
273
273
|
? undefined
|
|
274
274
|
: selected.userId,
|
|
275
275
|
userId:
|
|
276
|
-
selected.userType === '
|
|
276
|
+
selected.userType === 'AGENT'
|
|
277
277
|
? selected.userId
|
|
278
278
|
: undefined,
|
|
279
279
|
},
|
|
@@ -186,6 +186,7 @@ export function TransferSubScreen({
|
|
|
186
186
|
const [isVerifying, setIsVerifying] = useState<boolean>(false);
|
|
187
187
|
|
|
188
188
|
const [showBankList, setShowBankList] = useState<boolean>(false);
|
|
189
|
+
const user = getFPStore().user
|
|
189
190
|
|
|
190
191
|
const [banks, setBanks] = useState<any>(getFPStore().banks);
|
|
191
192
|
const [filteredBanks, setFilteredBanks] = useState<any>([]);
|
|
@@ -218,6 +219,8 @@ export function TransferSubScreen({
|
|
|
218
219
|
if (!accountDetail) return;
|
|
219
220
|
|
|
220
221
|
try {
|
|
222
|
+
|
|
223
|
+
|
|
221
224
|
const base = {
|
|
222
225
|
recipient: accountDetail,
|
|
223
226
|
amount: Number(amount), // keep as number — host app converts if needed
|
|
@@ -228,10 +231,13 @@ export function TransferSubScreen({
|
|
|
228
231
|
};
|
|
229
232
|
|
|
230
233
|
if (!isBank) {
|
|
234
|
+
const recipient = {...base.recipient, id: base.recipient.ownerId};
|
|
235
|
+
delete recipient.ownerId;
|
|
231
236
|
onProcessTransaction?.({
|
|
232
237
|
...base,
|
|
233
238
|
sender_id: getFPStore().psspId ?? '',
|
|
234
|
-
sender_type:
|
|
239
|
+
sender_type: user?.type,
|
|
240
|
+
recipient,
|
|
235
241
|
});
|
|
236
242
|
} else if (isBank && bank) {
|
|
237
243
|
onProcessTransaction?.({
|