omnipay-reactnative-sdk 1.2.1 → 1.2.2-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 +136 -45
- package/lib/commonjs/components/FaceVerification.js +755 -0
- package/lib/commonjs/components/FaceVerification.js.map +1 -0
- package/lib/commonjs/components/OmnipayProvider.js +60 -1
- 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 +60 -1
- 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.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 +69 -0
- 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
|
+
```
|
|
25
|
+
|
|
26
|
+
**iOS (ios/YourApp/Info.plist):**
|
|
21
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
|
|
@@ -102,45 +113,48 @@ initiateWallet({
|
|
|
102
113
|
### Properties
|
|
103
114
|
|
|
104
115
|
#### OmnipayProvider Props
|
|
105
|
-
|
|
106
|
-
|
|
|
107
|
-
|
|
|
108
|
-
|
|
|
109
|
-
|
|
|
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 |
|
|
110
122
|
|
|
111
123
|
#### initiateBills Props
|
|
112
|
-
|
|
113
|
-
|
|
|
114
|
-
|
|
|
115
|
-
|
|
|
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 |
|
|
116
129
|
|
|
117
130
|
#### initiateWallet Props
|
|
118
|
-
| Name | Type | Description |
|
|
119
|
-
| ----------------------- | -------- | ---------------------------------------------------------------- |
|
|
120
|
-
| phoneNumber | String | phone number of the customer |
|
|
121
|
-
| customerRef | String | unique reference for the customer |
|
|
122
|
-
| userRef | String | unique reference for the user |
|
|
123
|
-
| onClose | Function | this is used to notify you when the sdk closes |
|
|
124
|
-
| usesPaylater | Boolean | whether to show paylater tab in wallet view |
|
|
125
|
-
| usesPromo | Boolean | whether to show promo tab in wallet view |
|
|
126
|
-
| usesAirtimeData | Boolean | whether to show airtime and data shortcut in wallet view |
|
|
127
|
-
| usesTransfer | Boolean | whether to show transfer shortcut in wallet view |
|
|
128
|
-
| usesBills | Boolean | whether to show bills shortcut in wallet view |
|
|
129
|
-
| usesPos | Boolean | whether to show pos shortcut in wallet view |
|
|
130
|
-
| promoBalanceOffset | Number | offset for promo balance display |
|
|
131
|
-
| deviceId | String | unique identifier for the device |
|
|
132
|
-
| deviceName | String | name of the device |
|
|
133
|
-
| hideWalletTransfer | Boolean | whether to hide wallet transfer functionality |
|
|
134
|
-
| isBvnValidationRequired | Boolean | whether BVN validation is required |
|
|
135
|
-
| walletTab | String | initial wallet tab to display ('Paylater', 'Account', 'Omoni') |
|
|
136
|
-
| sessionId | String | unique session identifier |
|
|
137
|
-
| kycStatus | String | KYC status of the user ('verified', 'unverified') |
|
|
138
|
-
| launchPage | String | page to launch in the wallet |
|
|
139
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 |
|
|
140
153
|
|
|
141
154
|
## Registration Sdk
|
|
155
|
+
|
|
142
156
|
```js
|
|
143
|
-
import { Omnipay } from
|
|
157
|
+
import { Omnipay } from 'omnipay-reactnative-sdk';
|
|
144
158
|
|
|
145
159
|
//render it anywhere on your page where you want to display the registration sdk
|
|
146
160
|
<Omnipay.Registration
|
|
@@ -150,9 +164,9 @@ import { Omnipay } from "omnipay-reactnative-sdk";
|
|
|
150
164
|
phoneNumber="09031234571"
|
|
151
165
|
onRegistrationSuccessful={({ customerRef, walletId }) => {
|
|
152
166
|
/**
|
|
153
|
-
* the customer ref and walletid can be saved
|
|
167
|
+
* the customer ref and walletid can be saved
|
|
154
168
|
* to your database at this point
|
|
155
|
-
*
|
|
169
|
+
*
|
|
156
170
|
* we will also be sending a webhook notification
|
|
157
171
|
* so, you can either save at this point or via the webhook
|
|
158
172
|
*/
|
|
@@ -163,17 +177,94 @@ import { Omnipay } from "omnipay-reactnative-sdk";
|
|
|
163
177
|
* the user is done with registration.
|
|
164
178
|
* you can navigate them else where at this point
|
|
165
179
|
*/
|
|
166
|
-
|
|
167
180
|
}}
|
|
168
|
-
|
|
181
|
+
/>;
|
|
169
182
|
```
|
|
170
183
|
|
|
171
184
|
### Properties
|
|
172
185
|
|
|
173
|
-
| Name
|
|
174
|
-
|
|
|
175
|
-
| color
|
|
176
|
-
| env
|
|
177
|
-
| phoneNumber
|
|
178
|
-
| publicKey
|
|
179
|
-
| 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"
|