omnipay-reactnative-sdk 1.2.0 → 1.2.1-beta.0
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 +153 -31
- package/lib/commonjs/components/FaceVerification.js +755 -0
- package/lib/commonjs/components/FaceVerification.js.map +1 -0
- package/lib/commonjs/components/OmnipayProvider.js +65 -4
- package/lib/commonjs/components/OmnipayProvider.js.map +1 -1
- package/lib/commonjs/types/faceVerification.js +2 -0
- package/lib/commonjs/types/faceVerification.js.map +1 -0
- package/lib/commonjs/types/index.js +17 -0
- package/lib/commonjs/types/index.js.map +1 -0
- package/lib/module/components/FaceVerification.js +746 -0
- package/lib/module/components/FaceVerification.js.map +1 -0
- package/lib/module/components/OmnipayProvider.js +65 -4
- package/lib/module/components/OmnipayProvider.js.map +1 -1
- package/lib/module/types/faceVerification.js +2 -0
- package/lib/module/types/faceVerification.js.map +1 -0
- package/lib/module/types/index.js +2 -0
- package/lib/module/types/index.js.map +1 -0
- package/lib/typescript/components/FaceVerification.d.ts +10 -0
- package/lib/typescript/components/FaceVerification.d.ts.map +1 -0
- package/lib/typescript/components/OmnipayProvider.d.ts +4 -2
- package/lib/typescript/components/OmnipayProvider.d.ts.map +1 -1
- package/lib/typescript/components/OmnipayView.d.ts +2 -0
- package/lib/typescript/components/OmnipayView.d.ts.map +1 -1
- package/lib/typescript/components/views/BvnVerification.d.ts +2 -0
- package/lib/typescript/components/views/BvnVerification.d.ts.map +1 -1
- package/lib/typescript/components/views/PaylaterAgreement.d.ts +2 -0
- package/lib/typescript/components/views/PaylaterAgreement.d.ts.map +1 -1
- package/lib/typescript/components/views/Registration.d.ts +2 -0
- package/lib/typescript/components/views/Registration.d.ts.map +1 -1
- package/lib/typescript/hooks/useOmnipay.d.ts +4 -2
- package/lib/typescript/hooks/useOmnipay.d.ts.map +1 -1
- package/lib/typescript/types/faceVerification.d.ts +18 -0
- package/lib/typescript/types/faceVerification.d.ts.map +1 -0
- package/lib/typescript/types/index.d.ts +2 -0
- package/lib/typescript/types/index.d.ts.map +1 -0
- package/package.json +10 -4
- package/src/components/FaceVerification.tsx +884 -0
- package/src/components/OmnipayProvider.tsx +80 -3
- package/src/types/faceVerification.ts +27 -0
- package/src/types/index.ts +1 -0
package/README.md
CHANGED
|
@@ -11,14 +11,25 @@ yarn add omnipay-reactnative-sdk
|
|
|
11
11
|
## Dependencies
|
|
12
12
|
|
|
13
13
|
```sh
|
|
14
|
-
yarn add react-native-select-contact react-native-webview react-native-share
|
|
14
|
+
yarn add react-native-select-contact react-native-webview react-native-share react-native-svg react-native-vision-camera react-native-vision-camera-face-detector
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
Make sure your manifest files includes
|
|
17
|
+
Make sure your manifest files includes permissions for contacts and camera access:
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
**Android (android/app/src/main/AndroidManifest.xml):**
|
|
20
|
+
|
|
21
|
+
```xml
|
|
20
22
|
<uses-permission android:name="android.permission.READ_CONTACTS" />
|
|
23
|
+
<uses-permission android:name="android.permission.CAMERA" />
|
|
24
|
+
```
|
|
21
25
|
|
|
26
|
+
**iOS (ios/YourApp/Info.plist):**
|
|
27
|
+
|
|
28
|
+
```xml
|
|
29
|
+
<key>NSContactsUsageDescription</key>
|
|
30
|
+
<string>This app needs access to contacts to help you select recipients.</string>
|
|
31
|
+
<key>NSCameraUsageDescription</key>
|
|
32
|
+
<string>This app needs camera access for face verification.</string>
|
|
22
33
|
```
|
|
23
34
|
|
|
24
35
|
Also add this for Android 11+ support below the application tag in your AndroidManifest.xml file
|
|
@@ -81,35 +92,69 @@ initiateWallet({
|
|
|
81
92
|
customerRef: '9ab6790',
|
|
82
93
|
userRef: '889huop',
|
|
83
94
|
onClose: onWalletClosed,
|
|
84
|
-
usesAirtimeData: true,
|
|
85
|
-
usesBills: true,
|
|
86
95
|
usesPaylater: true,
|
|
87
96
|
usesPromo: true,
|
|
88
|
-
|
|
97
|
+
usesAirtimeData: true,
|
|
89
98
|
usesTransfer: true,
|
|
99
|
+
usesBills: true,
|
|
100
|
+
usesPos: true,
|
|
101
|
+
promoBalanceOffset: 0,
|
|
102
|
+
deviceId: 'device123',
|
|
103
|
+
deviceName: 'My Device',
|
|
104
|
+
hideWalletTransfer: false,
|
|
105
|
+
isBvnValidationRequired: false,
|
|
106
|
+
walletTab: 'Account', // 'Paylater' | 'Account' | 'Omoni'
|
|
107
|
+
sessionId: 'session123',
|
|
108
|
+
kycStatus: 'verified', // 'verified' | 'unverified'
|
|
109
|
+
launchPage: 'wallet',
|
|
90
110
|
});
|
|
91
111
|
```
|
|
92
112
|
|
|
93
113
|
### Properties
|
|
94
114
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
|
98
|
-
|
|
|
99
|
-
|
|
|
100
|
-
|
|
|
101
|
-
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
|
106
|
-
|
|
|
107
|
-
|
|
|
115
|
+
#### OmnipayProvider Props
|
|
116
|
+
|
|
117
|
+
| Name | Type | Description |
|
|
118
|
+
| --------- | ------ | ------------------------------------ |
|
|
119
|
+
| color | String | color of primary buttons and links |
|
|
120
|
+
| env | String | dev or prod |
|
|
121
|
+
| publicKey | String | public key of the company on omnipay |
|
|
122
|
+
|
|
123
|
+
#### initiateBills Props
|
|
124
|
+
|
|
125
|
+
| Name | Type | Description |
|
|
126
|
+
| ----------- | -------- | ---------------------------------------------- |
|
|
127
|
+
| phoneNumber | String | phone number of the customer |
|
|
128
|
+
| onClose | Function | this is used to notify you when the sdk closes |
|
|
129
|
+
|
|
130
|
+
#### initiateWallet Props
|
|
108
131
|
|
|
132
|
+
| Name | Type | Description |
|
|
133
|
+
| ----------------------- | -------- | -------------------------------------------------------------- |
|
|
134
|
+
| phoneNumber | String | phone number of the customer |
|
|
135
|
+
| customerRef | String | unique reference for the customer |
|
|
136
|
+
| userRef | String | unique reference for the user |
|
|
137
|
+
| onClose | Function | this is used to notify you when the sdk closes |
|
|
138
|
+
| usesPaylater | Boolean | whether to show paylater tab in wallet view |
|
|
139
|
+
| usesPromo | Boolean | whether to show promo tab in wallet view |
|
|
140
|
+
| usesAirtimeData | Boolean | whether to show airtime and data shortcut in wallet view |
|
|
141
|
+
| usesTransfer | Boolean | whether to show transfer shortcut in wallet view |
|
|
142
|
+
| usesBills | Boolean | whether to show bills shortcut in wallet view |
|
|
143
|
+
| usesPos | Boolean | whether to show pos shortcut in wallet view |
|
|
144
|
+
| promoBalanceOffset | Number | offset for promo balance display |
|
|
145
|
+
| deviceId | String | unique identifier for the device |
|
|
146
|
+
| deviceName | String | name of the device |
|
|
147
|
+
| hideWalletTransfer | Boolean | whether to hide wallet transfer functionality |
|
|
148
|
+
| isBvnValidationRequired | Boolean | whether BVN validation is required |
|
|
149
|
+
| walletTab | String | initial wallet tab to display ('Paylater', 'Account', 'Omoni') |
|
|
150
|
+
| sessionId | String | unique session identifier |
|
|
151
|
+
| kycStatus | String | KYC status of the user ('verified', 'unverified') |
|
|
152
|
+
| launchPage | String | page to launch in the wallet |
|
|
109
153
|
|
|
110
154
|
## Registration Sdk
|
|
155
|
+
|
|
111
156
|
```js
|
|
112
|
-
import { Omnipay } from
|
|
157
|
+
import { Omnipay } from 'omnipay-reactnative-sdk';
|
|
113
158
|
|
|
114
159
|
//render it anywhere on your page where you want to display the registration sdk
|
|
115
160
|
<Omnipay.Registration
|
|
@@ -119,9 +164,9 @@ import { Omnipay } from "omnipay-reactnative-sdk";
|
|
|
119
164
|
phoneNumber="09031234571"
|
|
120
165
|
onRegistrationSuccessful={({ customerRef, walletId }) => {
|
|
121
166
|
/**
|
|
122
|
-
* the customer ref and walletid can be saved
|
|
167
|
+
* the customer ref and walletid can be saved
|
|
123
168
|
* to your database at this point
|
|
124
|
-
*
|
|
169
|
+
*
|
|
125
170
|
* we will also be sending a webhook notification
|
|
126
171
|
* so, you can either save at this point or via the webhook
|
|
127
172
|
*/
|
|
@@ -132,17 +177,94 @@ import { Omnipay } from "omnipay-reactnative-sdk";
|
|
|
132
177
|
* the user is done with registration.
|
|
133
178
|
* you can navigate them else where at this point
|
|
134
179
|
*/
|
|
135
|
-
|
|
136
180
|
}}
|
|
137
|
-
|
|
181
|
+
/>;
|
|
138
182
|
```
|
|
139
183
|
|
|
140
184
|
### Properties
|
|
141
185
|
|
|
142
|
-
| Name
|
|
143
|
-
|
|
|
144
|
-
| color
|
|
145
|
-
| env
|
|
146
|
-
| phoneNumber
|
|
147
|
-
| publicKey
|
|
148
|
-
| view
|
|
186
|
+
| Name | Type | Description |
|
|
187
|
+
| ----------- | ------ | ------------------------------------ |
|
|
188
|
+
| color | String | color of primary buttons and links |
|
|
189
|
+
| env | String | dev or prod |
|
|
190
|
+
| phoneNumber | String | phone number of the customer |
|
|
191
|
+
| publicKey | String | public key of the company on omnipay |
|
|
192
|
+
| view | String | the view to render on the sdk |
|
|
193
|
+
|
|
194
|
+
## Face Verification Feature
|
|
195
|
+
|
|
196
|
+
The SDK now includes face verification functionality that can be triggered from the webview. This feature provides liveness detection with multiple verification steps including blinking, smiling, and final position verification.
|
|
197
|
+
|
|
198
|
+
### Usage from WebView
|
|
199
|
+
|
|
200
|
+
The webview can trigger face verification by sending a message:
|
|
201
|
+
|
|
202
|
+
```javascript
|
|
203
|
+
// From webview JavaScript
|
|
204
|
+
window.ReactNativeWebView.postMessage(
|
|
205
|
+
JSON.stringify({
|
|
206
|
+
dataKey: 'startFaceVerification',
|
|
207
|
+
dataValue: JSON.stringify({
|
|
208
|
+
// additional options can be passed here
|
|
209
|
+
customData: {
|
|
210
|
+
/* any custom data */
|
|
211
|
+
},
|
|
212
|
+
}),
|
|
213
|
+
})
|
|
214
|
+
);
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### Handling Face Verification Results
|
|
218
|
+
|
|
219
|
+
The SDK will post back results to the webview:
|
|
220
|
+
|
|
221
|
+
```javascript
|
|
222
|
+
// Listen for results in webview
|
|
223
|
+
window.addEventListener('message', function (event) {
|
|
224
|
+
const data = JSON.parse(event.data);
|
|
225
|
+
|
|
226
|
+
if (data.dataKey === 'faceVerificationComplete') {
|
|
227
|
+
if (data.dataValue.success) {
|
|
228
|
+
// Verification successful
|
|
229
|
+
const base64Image = data.dataValue.image;
|
|
230
|
+
// Handle success
|
|
231
|
+
} else {
|
|
232
|
+
// Verification failed
|
|
233
|
+
console.error(data.dataValue.error);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
if (data.dataKey === 'faceVerificationCancelled') {
|
|
238
|
+
// User cancelled verification
|
|
239
|
+
console.log('Face verification cancelled');
|
|
240
|
+
}
|
|
241
|
+
});
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
### Required Setup for Face Verification
|
|
245
|
+
|
|
246
|
+
1. **Install additional dependencies** (already included if you followed the Dependencies section above):
|
|
247
|
+
|
|
248
|
+
- `react-native-vision-camera` for camera access
|
|
249
|
+
- `react-native-vision-camera-face-detector` for face detection
|
|
250
|
+
- `react-native-svg` for UI components
|
|
251
|
+
|
|
252
|
+
2. **Permissions** (already included if you followed the Dependencies section above):
|
|
253
|
+
|
|
254
|
+
- Camera permissions are required on both iOS and Android
|
|
255
|
+
|
|
256
|
+
3. **Platform-specific setup**:
|
|
257
|
+
- Follow the setup instructions for `react-native-vision-camera` in your project
|
|
258
|
+
- Ensure camera permissions are properly configured
|
|
259
|
+
|
|
260
|
+
### Face Verification Flow
|
|
261
|
+
|
|
262
|
+
1. User triggers verification from webview
|
|
263
|
+
2. SDK displays face verification modal with "Proceed" button
|
|
264
|
+
3. User goes through verification steps:
|
|
265
|
+
- Position face in frame
|
|
266
|
+
- Blink eyes
|
|
267
|
+
- Smile
|
|
268
|
+
- Hold still for final capture
|
|
269
|
+
4. SDK captures image and shows preview with "Continue" and "Retake" options
|
|
270
|
+
5. SDK returns base64 image data to webview when user selects "Continue"
|