dojah-kyc-sdk-react_native 0.0.9 → 0.1.1
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/android/build.gradle +1 -1
- package/ios/DojahKyc.mm +8 -1
- package/ios/DojahKyc.swift +79 -2
- package/package.json +1 -1
package/android/build.gradle
CHANGED
|
@@ -107,7 +107,7 @@ dependencies {
|
|
|
107
107
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
108
108
|
|
|
109
109
|
// implementation 'com.github.dojah-inc:sdk-kotlin:v0.0.1-dev'
|
|
110
|
-
implementation 'com.github.dojah-inc:sdk-kotlin:v0.
|
|
110
|
+
implementation 'com.github.dojah-inc:sdk-kotlin:v0.1.3-dev'
|
|
111
111
|
|
|
112
112
|
|
|
113
113
|
}
|
package/ios/DojahKyc.mm
CHANGED
|
@@ -20,11 +20,18 @@
|
|
|
20
20
|
|
|
21
21
|
RCT_EXTERN_METHOD(initialize:(NSString)appName)
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
//launch:withReferenceId:withEmail:withUserData:withGovData:withGovId:withLocation:withBuisnessData:withAddress:withMetaData:resolver:rejecter:
|
|
24
24
|
RCT_EXTERN_METHOD(
|
|
25
25
|
launch:(NSString *)widgetId
|
|
26
26
|
withReferenceId:(NSString *)referenceId
|
|
27
27
|
withEmail:(NSString *)email
|
|
28
|
+
withUserData:(NSDictionary *)userData
|
|
29
|
+
withGovData:(NSDictionary *)govData
|
|
30
|
+
withGovId:(NSDictionary *)govId
|
|
31
|
+
withLocation:(NSDictionary *)location
|
|
32
|
+
withBuisnessData:(NSDictionary *)businessData
|
|
33
|
+
withAddress:(NSString *)address
|
|
34
|
+
withMetaData:(NSDictionary *)metadata
|
|
28
35
|
resolver:(RCTPromiseResolveBlock)resolve
|
|
29
36
|
rejecter:(RCTPromiseRejectBlock)reject
|
|
30
37
|
)
|
package/ios/DojahKyc.swift
CHANGED
|
@@ -89,11 +89,18 @@ class DojahKyc: RCTEventEmitter, RCTBridgeDelegate {
|
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
|
|
92
|
-
@objc(launch:withReferenceId:withEmail:resolver:rejecter:)
|
|
92
|
+
@objc(launch:withReferenceId:withEmail:withUserData:withGovData:withGovId:withLocation:withBuisnessData:withAddress:withMetaData:resolver:rejecter:)
|
|
93
93
|
func launch(
|
|
94
94
|
_ widgetId:String,
|
|
95
95
|
withReferenceId referenceId:String,
|
|
96
96
|
withEmail email:String,
|
|
97
|
+
withUserData userData : NSDictionary? = nil,
|
|
98
|
+
withGovData govData: NSDictionary? = nil,
|
|
99
|
+
withGovId govId: NSDictionary? = nil,
|
|
100
|
+
withLocation location: NSDictionary? = nil,
|
|
101
|
+
withBuisnessData businessData: NSDictionary? = nil,
|
|
102
|
+
withAddress address: String = "",
|
|
103
|
+
withMetaData metadata: NSDictionary? = nil,
|
|
97
104
|
resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
98
105
|
rejecter reject: @escaping RCTPromiseRejectBlock
|
|
99
106
|
) {
|
|
@@ -121,7 +128,21 @@ class DojahKyc: RCTEventEmitter, RCTBridgeDelegate {
|
|
|
121
128
|
|
|
122
129
|
if(navCtrl != nil){
|
|
123
130
|
do{
|
|
124
|
-
|
|
131
|
+
|
|
132
|
+
DojahWidgetSDK.initialize(
|
|
133
|
+
widgetID: widgetId,
|
|
134
|
+
referenceID: referenceId,
|
|
135
|
+
emailAddress: email,
|
|
136
|
+
extraUserData: ExtraUserData(
|
|
137
|
+
userData: mapToUserBioData(from: userData),
|
|
138
|
+
govData: mapToExtraGovData(from: govData),
|
|
139
|
+
govId: mapToExtraGovIdData(from: govId),
|
|
140
|
+
location: mapToExtraLocationData(from: location),
|
|
141
|
+
businessData: mapToExtraBusinessData(from: businessData),
|
|
142
|
+
metadata: metadata as? [String : Any]
|
|
143
|
+
),
|
|
144
|
+
navController: navCtrl!)
|
|
145
|
+
|
|
125
146
|
}catch{
|
|
126
147
|
reject("no-launch", "Could not launch Dojah Widget", error)
|
|
127
148
|
}
|
|
@@ -133,3 +154,59 @@ class DojahKyc: RCTEventEmitter, RCTBridgeDelegate {
|
|
|
133
154
|
}
|
|
134
155
|
|
|
135
156
|
}
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
// Mapping functions for each sub-struct
|
|
161
|
+
func mapToUserBioData(from dictionary: NSDictionary?) -> UserBioData? {
|
|
162
|
+
guard let userData = dictionary else { return nil }
|
|
163
|
+
|
|
164
|
+
return UserBioData(
|
|
165
|
+
firstName: userData["first_name"] as? String,
|
|
166
|
+
lastName: userData["last_name"] as? String,
|
|
167
|
+
dob: userData["dob"] as? String,
|
|
168
|
+
email: userData["email"] as? String
|
|
169
|
+
)
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
func mapToExtraGovData(from dictionary: NSDictionary?) -> ExtraGovData? {
|
|
173
|
+
guard let govData = dictionary else { return nil }
|
|
174
|
+
|
|
175
|
+
return ExtraGovData(
|
|
176
|
+
bvn: govData["bvn"] as? String,
|
|
177
|
+
dl: govData["dl"] as? String,
|
|
178
|
+
nin: govData["nin"] as? String,
|
|
179
|
+
vnin: govData["vnin"] as? String
|
|
180
|
+
)
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
func mapToExtraGovIdData(from dictionary: NSDictionary?) -> ExtraGovIdData? {
|
|
184
|
+
guard let govId = dictionary else { return nil }
|
|
185
|
+
|
|
186
|
+
return ExtraGovIdData(
|
|
187
|
+
national: govId["national"] as? String,
|
|
188
|
+
passport: govId["passport"] as? String,
|
|
189
|
+
dl: govId["dl"] as? String,
|
|
190
|
+
voter: govId["voter"] as? String,
|
|
191
|
+
nin: govId["nin"] as? String,
|
|
192
|
+
others: govId["others"] as? String
|
|
193
|
+
)
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
func mapToExtraLocationData(from dictionary: NSDictionary?) -> ExtraLocationData? {
|
|
197
|
+
guard let location = dictionary else { return nil }
|
|
198
|
+
|
|
199
|
+
return ExtraLocationData(
|
|
200
|
+
longitude: location["longitude"] as? String,
|
|
201
|
+
latitude: location["latitude"] as? String
|
|
202
|
+
)
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
func mapToExtraBusinessData(from dictionary: NSDictionary?) -> ExtraBusinessData? {
|
|
206
|
+
guard let businessData = dictionary else { return nil }
|
|
207
|
+
|
|
208
|
+
return ExtraBusinessData(
|
|
209
|
+
cac: businessData["cac"] as? String
|
|
210
|
+
)
|
|
211
|
+
}
|
|
212
|
+
|