uw-labs / go-onfido Goto Github PK
View Code? Open in Web Editor NEWGolang client for the Onfido API
License: MIT License
Golang client for the Onfido API
License: MIT License
The get requests contain a query param to expand the check. When a check has the consider
status the reports need to be expanded to make decisions.
The signature of GetCheck
will need to be changed it should probably be updated to take a request object. Will you accept a PR for this ?
Methods to download and list photos and videos are needed.
I've been working on expanding webhook support. That branch has CreateWebhook
and ListWebhooks
which are already functional.
If this looks like it would be useful in the main project I'd be happy to open a PR.
(I'm not completely happy withe the WebhookRef
type name that I've been using and would very much appreciate any alternative suggestions.)
Onfido now generates tokens with prefixes of either api_live.
or api_sandbox.
by default: https://documentation.onfido.com/#test-the-api
Newly generated Production tokens are not identified correctly by the Token.Prod()
method.
internally we are creating an applicant with the following data:
"applicant": {
"first_name": "Df",
"last_name": "Df",
"email": "[email protected]",
"dob": "1990-12-12",
"country": "GBR",
"addresses": [
{
"flat_number": "",
"building_number": "",
"building_name": "",
"street": "Prime Minister & First Lord of the Treasury",
"sub_street": "",
"town": "",
"state": "",
"postcode": "SW1A 2AA",
"country": "GBR"
}
]
},
Hacking some debug code in we can see Onfido send the following error body:
{"error":{"type":"validation_error","message":"There was a validation error on this request","fields":{"addresses":[{"street":["can't be longer than 32 characters"]}]}}}
Demarshalling this leads to an error as this type:
type ErrorFields map[string][]string
should actually be
type ErrorFields map[string][]interface{}
Methods to upload photo and video challenges for testing purposes would be welcome.
It seems that Onfido have deviated from their documented Error JSON structure:
{
"error": {
"id": "544f95539648607d03001542",
"type": "validation_error",
"message": "",
"fields": {
"email": {
"messages": [
"invalid format"
]
},
"name": {
"messages": [
"can't be blank"
]
}
}
}
}
I am receiving from them the following Error object when I create a new Applicant:
{
"error": {
"type": "validation_error",
"message": "There was a validation error on this request",
"fields": {
"addresses": [
{
"country": [
"can't be blank"
]
}
]
}
}
}
This causes a json.Unmarshal error within this package's onfido.go file:
json: cannot unmarshal array into Go struct field .fields of type struct { Messages []string }
This unmarshallng error then masks the actual Onfido error.
My solution was to update the Error structure type in onfido.go with the following:
// Error represents an Onfido API error response
type Error struct {
Resp *http.Response
Err struct {
ID string `json:"id"`
Type string `json:"type"`
Msg string `json:"message"`
Fields ErrorFields `json:"fields"`
} `json:"error"`
}
type ErrorFields map[string]interface{}
I am using Go 1.11.4 linux/amd64
Thank you for a great Go package. My API is Go based and I have a need to interface it with Onfido. Finding your well documented package has saved me many days of development effort.
Are you able to confirm please, that the package (go-onfido.Client in particular) is safe for concurrent use by multiple Go routines?
Have you considered adding it here: https://documentation.onfido.com/#client-libraries
Thanks again.
Mark
Consider making the examples into test examples.
(See https://godoc.org/github.com/natefinch/godocgo/sub#hdr-Examples )
As a user of the library it would be nice for date of birth to be of type time.Time and have the library deal with the parsing to and from the string type/
Date of birth is of type string
When running the build for multiple versions of go, at least one seems to fail with the following error
integration_test.go:173: Rate limit exceeded. Please try again later.
The tests should be made more resilient to not fail when this happens, or we should run integration tests for fewer go versions.
We just heard from Onfido that the document check can return address information if the document contained it (driving license). This need to enabled in options as follows:
{
"type": "express",
"asynchronous": true,
"reports": [{
"name": "document",
"options": [
{
"name": "document_address_information"
}
]
}]
}
Since a lot of the fields are type-safe (ish) is there a nice way to encode this ? At the moment the options field is map[string]interface{}
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.