vchain_client 1.0.14 → 1.0.15
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.
- checksums.yaml +4 -4
- data/lib/vchain_client.rb +31 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f7cee1ed6c6a5984dc6a2895676e516a9ec6eeaa
|
4
|
+
data.tar.gz: e6579fd0ab9f8d7460f7d46dd98f6b9625ba675a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e94a3dd3e7327a2b007bf75588366ee8cbdd103f8f32cb356e1c6e31bb3e31d7c21f6391e27770919117df1fc46e95c5bc8facc99b875fd0dd7b6b34707c1f40
|
7
|
+
data.tar.gz: 2532de0a43e0de96ec538d27d1f13912fd0c33bb06aee3292789c765da8f8897cb8ad12cc51a8ecf2f74836b7f393a380899a4a97f73d480b73a496c9d47fd93
|
data/lib/vchain_client.rb
CHANGED
@@ -46,6 +46,18 @@ module VChainClient
|
|
46
46
|
}
|
47
47
|
end
|
48
48
|
|
49
|
+
def get_credentials_fields(type)
|
50
|
+
if type == FIELD_TYPE_HASHED
|
51
|
+
return ["type", "citizenship", "number", "first_name", "last_name", "birthdate"]
|
52
|
+
end
|
53
|
+
|
54
|
+
if @log.error?
|
55
|
+
@log.error("[get_credentials_fields] unknown document type: '"+ type +"'")
|
56
|
+
end
|
57
|
+
|
58
|
+
return nil
|
59
|
+
end
|
60
|
+
|
49
61
|
def get_credentials_hash(document)
|
50
62
|
if document["type"] == FIELD_TYPE_HASHED
|
51
63
|
what_to_hash = document["type"] + document["citizenship"] + document["number"] + document["first_name"] + document["last_name"] + document["birthdate"]
|
@@ -408,7 +420,25 @@ module VChainClient
|
|
408
420
|
@log.debug("[check] recieved verifications")
|
409
421
|
end
|
410
422
|
|
411
|
-
|
423
|
+
credentials_document = document
|
424
|
+
|
425
|
+
if res["status"] == "ERROR" || res["status"] == "error"
|
426
|
+
if res["error_reason_code"] == "DOCUMENT_POSSIBLE_MISTAKES"
|
427
|
+
credentials_document = {}
|
428
|
+
|
429
|
+
credentials_fields = self.get_credentials_fields(document["type"])
|
430
|
+
|
431
|
+
credentials_fields.each_with_index{ |field,index|
|
432
|
+
if document[field] != res_document["values"][field]
|
433
|
+
credentials_document[field] = res_document["values"][field]
|
434
|
+
else
|
435
|
+
credentials_document[field] = document[field]
|
436
|
+
end
|
437
|
+
}
|
438
|
+
end
|
439
|
+
end
|
440
|
+
|
441
|
+
credentials_hash = self.get_credentials_hash(credentials_document)
|
412
442
|
|
413
443
|
if @log.debug?
|
414
444
|
@log.debug("[check] credentials_hash: "+ credentials_hash)
|