Skip to content

Commit

Permalink
Merge pull request #195 from getyoti/release/3.2.0
Browse files Browse the repository at this point in the history
Release 3.2.0
  • Loading branch information
davidgrayston committed Oct 20, 2020
2 parents 746bfed + 1314ee0 commit 4d52474
Show file tree
Hide file tree
Showing 31 changed files with 592 additions and 73 deletions.
4 changes: 2 additions & 2 deletions _examples/aml/go.sum
Expand Up @@ -30,5 +30,5 @@ google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miE
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM=
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
gotest.tools/v3 v3.0.2 h1:kG1BFyqVHuQoVQiR1bWGnfz/fmHvvuiSPIV7rvl360E=
gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk=
gotest.tools/v3 v3.0.3 h1:4AuOwCGf4lLR9u3YOe2awrHygurzhO/HeQ6laiA6Sx0=
gotest.tools/v3 v3.0.3/go.mod h1:Z7Lb0S5l+klDB31fvDQX8ss/FlKDxtlFlw3Oa8Ymbl8=
4 changes: 2 additions & 2 deletions _examples/docscan/go.sum
Expand Up @@ -76,5 +76,5 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gotest.tools/v3 v3.0.2 h1:kG1BFyqVHuQoVQiR1bWGnfz/fmHvvuiSPIV7rvl360E=
gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk=
gotest.tools/v3 v3.0.3 h1:4AuOwCGf4lLR9u3YOe2awrHygurzhO/HeQ6laiA6Sx0=
gotest.tools/v3 v3.0.3/go.mod h1:Z7Lb0S5l+klDB31fvDQX8ss/FlKDxtlFlw3Oa8Ymbl8=
15 changes: 11 additions & 4 deletions _examples/docscan/handlers.session.go
Expand Up @@ -96,10 +96,17 @@ func showSuccessPage(c *gin.Context) {
return
}

render(c, gin.H{
"title": "Success",
"getSessionResult": getSessionResult},
"success.html")
render(
c,
gin.H{
"title": "Success",
"getSessionResult": getSessionResult,
"add": func(a int, b int) int {
return a + b
},
},
"success.html",
)
return
}

Expand Down
27 changes: 27 additions & 0 deletions _examples/docscan/models.sessionspec.go
Expand Up @@ -3,6 +3,7 @@ package main
import (
"github.com/getyoti/yoti-go-sdk/v3/docscan/session/create"
"github.com/getyoti/yoti-go-sdk/v3/docscan/session/create/check"
"github.com/getyoti/yoti-go-sdk/v3/docscan/session/create/filter"
"github.com/getyoti/yoti-go-sdk/v3/docscan/session/create/task"
)

Expand Down Expand Up @@ -39,6 +40,13 @@ func buildSessionSpec() (sessionSpec *create.SessionSpecification, err error) {
return nil, err
}

var idDocsComparisonCheck *check.RequestedIDDocumentComparisonCheck
idDocsComparisonCheck, err = check.NewRequestedIDDocumentComparisonCheckBuilder().
Build()
if err != nil {
return nil, err
}

var sdkConfig *create.SDKConfig
sdkConfig, err = create.NewSdkConfigBuilder().
WithAllowsCameraAndUpload().
Expand All @@ -55,15 +63,34 @@ func buildSessionSpec() (sessionSpec *create.SessionSpecification, err error) {
return nil, err
}

passportFilter, err := filter.NewRequestedOrthogonalRestrictionsFilterBuilder().
WithIncludedDocumentTypes(
[]string{"PASSPORT"}).
Build()
passportDoc, err := filter.NewRequiredIDDocumentBuilder().
WithFilter(passportFilter).
Build()

drivingLicenceFilter, err := filter.NewRequestedOrthogonalRestrictionsFilterBuilder().
WithIncludedDocumentTypes(
[]string{"DRIVING_LICENCE"}).
Build()
drivingLicenceDoc, err := filter.NewRequiredIDDocumentBuilder().
WithFilter(drivingLicenceFilter).
Build()

sessionSpec, err = create.NewSessionSpecificationBuilder().
WithClientSessionTokenTTL(600).
WithResourcesTTL(90000).
WithUserTrackingID("some-tracking-id").
WithRequestedCheck(faceMatchCheck).
WithRequestedCheck(documentAuthenticityCheck).
WithRequestedCheck(livenessCheck).
WithRequestedCheck(idDocsComparisonCheck).
WithRequestedTask(textExtractionTask).
WithSDKConfig(sdkConfig).
WithRequiredDocument(passportDoc).
WithRequiredDocument(drivingLicenceDoc).
Build()

if err != nil {
Expand Down
116 changes: 92 additions & 24 deletions _examples/docscan/templates/success.html
Expand Up @@ -34,6 +34,14 @@ <h1>Get Session Result</h1>
<td>User Tracking ID</td>
<td>{{ .getSessionResult.UserTrackingID }}</td>
</tr>
{{ if .getSessionResult.BiometricConsentTimestamp }}
<tr>
<td>Biometric Consent Timestamp</td>
<td>
{{ .getSessionResult.BiometricConsentTimestamp }}
</td>
</tr>
{{ end }}
</tbody>
</table>
</div>
Expand All @@ -44,7 +52,7 @@ <h1>Get Session Result</h1>
<div class="col">
<h2>Checks</h2>
<div class="accordion mt-3" id="checks">
{{ if .AuthenticityChecks }}
{{ if .getSessionResult.AuthenticityChecks }}
<div class="card">
<div class="card-header" id="authenticity-checks">
<h3 class="mb-0">
Expand All @@ -65,7 +73,7 @@ <h3 class="mb-0">
</div>
</div>
{{ end }}
{{ if .TextDataChecks }}
{{ if .getSessionResult.TextDataChecks }}
<div class="card">
<div class="card-header" id="text-data-checks">
<h3 class="mb-0">
Expand All @@ -85,7 +93,7 @@ <h3 class="mb-0">
</div>
</div>
{{ end }}
{{ if .FaceMatchChecks }}
{{ if .getSessionResult.FaceMatchChecks }}
<div class="card">
<div class="card-header" id="face-match-checks">
<h3 class="mb-0">
Expand All @@ -100,14 +108,13 @@ <h3 class="mb-0">
aria-labelledby="face-match-checks">
<div class="card-body">
{{ range $check := .getSessionResult.FaceMatchChecks }}
{% with check=check }}
{{ template "check.html" $check }}
{{ end }}
</div>
</div>
</div>
{{ end }}
{{ if .LivenessChecks }}
{{ if .getSessionResult.LivenessChecks }}
<div class="card">
<div class="card-header" id="liveness-checks">
<h3 class="mb-0">
Expand All @@ -127,6 +134,26 @@ <h3 class="mb-0">
</div>
</div>
{{ end }}
{{ if .getSessionResult.IDDocumentComparisonChecks }}
<div class="card">
<div class="card-header" id="comparison-checks">
<h3 class="mb-0">
<button class="btn btn-link" type="button" data-toggle="collapse"
data-target="#collapse-comparison-checks" aria-expanded="true"
aria-controls="collapse-comparison-checks">
ID Document Comparison Checks
</button>
</h3>
</div>
<div id="collapse-comparison-checks" class="collapse" aria-labelledby="comparison-checks">
<div class="card-body">
{{ range $check := .getSessionResult.IDDocumentComparisonChecks }}
{{ template "check.html" $check}}
{{ end }}
</div>
</div>
</div>
{{ end }}
</div>
</div>
</div>
Expand Down Expand Up @@ -183,6 +210,31 @@ <h5>Media</h5>
</div>
</div>
{{ end }}

{{ if $doc.DocumentIDPhoto }}
<div class="card">
<div class="card-header" id="document-id-photo-{{ $key }}">
<h4 class="mb-0">
<button class="btn btn-link"
type="button"
data-toggle="collapse"
data-target="#collapse-document-id-photo-{{ $key }}"
aria-expanded="true"
aria-controls="collapse-document-id-photo-{{ $key }}">
Document ID Photo
</button>
</h4>
</div>
<div id="collapse-document-id-photo-{{ $key }}" class="collapse" aria-labelledby="document-id-photo-{{ $key }}">
<div class="card-body">
{{ if $doc.DocumentIDPhoto.Media }}
<img class="card-img-top" src="/media?mediaId={{ $doc.DocumentIDPhoto.Media.ID }}" />
{{ end }}
</div>
</div>
</div>
{{ end }}

{{ if $doc.TextExtractionTasks }}
<div class="card">
<div class="card-header" id="text-extraction-tasks-{{ $key }}">
Expand Down Expand Up @@ -242,38 +294,54 @@ <h5>Generated Media</h5>
</div>
{{ end }}

{{ if $doc.Pages}}
{{ if $doc.Pages }}
{{ range $pageNum, $page := $doc.Pages }}
<div class="card">
<div class="card-header" id="document-pages-{{ $key }}">
<div class="card-header" id="document-pages-{{ $key }}-{{ $pageNum }}">
<h4 class="mb-0">
<button class="btn btn-link" type="button" data-toggle="collapse"
data-target="#collapse-document-pages-{{ $key }}"
data-target="#collapse-document-pages-{{ $key }}-{{ $pageNum }}"
aria-expanded="true"
aria-controls="collapse-document-pages-{{ $key }}">
Pages
aria-controls="collapse-document-pages-{{ $key }}-{{ $pageNum }}">
Page {{call $.add $pageNum 1}}
</button>
</h4>
</div>
<div id="collapse-document-pages-{{ $key }}" class="collapse"
aria-labelledby="document-pages-{{ $key }}">
<div class="card-body">
<div class="card-group">
{{ range $page := $doc.Pages }}
{{ if $page.Media }}
<div class="card" style="width: 18rem;">
<img class="card-img-top"
src="/media?mediaId={{ $page.Media.ID }}"/>
<div class="card-body">
<p>Method: {{ $page.CaptureMethod }}</p>
</div>
<div id="collapse-document-pages-{{ $key }}-{{ $pageNum }}" class="collapse"
aria-labelledby="document-pages-{{ $key }}-{{ $pageNum }}">

<div class="card-group">
{{ if $page.Media }}
<div class="card" style="width: 18rem;">
<img class="card-img-top"
src="/media?mediaId={{ $page.Media.ID }}"/>
<div class="card-body">
<p>Method: {{ $page.CaptureMethod }}</p>
</div>
</div>
{{ end }}
</div>

{{ if $page.Frames}}
<div class="card-group">
{{ range $frame := $page.Frames }}
{{ if $frame.Media }}
<div class="card">
<img class="card-img-top"
src="/media?mediaId={{ $frame.Media.ID }}"/>
<div class="card-body">
<h5 class="card-title">Frame</h5>
</div>
{{ end }}
</div>
{{ end }}
</div>
{{ end }}
</div>
{{ end }}

</div>
</div>
{{ end }}
{{ end }}
</div>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions _examples/docscansandbox/go.sum
Expand Up @@ -181,8 +181,8 @@ gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gotest.tools/v3 v3.0.2 h1:kG1BFyqVHuQoVQiR1bWGnfz/fmHvvuiSPIV7rvl360E=
gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk=
gotest.tools/v3 v3.0.3 h1:4AuOwCGf4lLR9u3YOe2awrHygurzhO/HeQ6laiA6Sx0=
gotest.tools/v3 v3.0.3/go.mod h1:Z7Lb0S5l+klDB31fvDQX8ss/FlKDxtlFlw3Oa8Ymbl8=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
Expand Down
4 changes: 2 additions & 2 deletions _examples/profile/go.sum
Expand Up @@ -30,5 +30,5 @@ google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miE
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM=
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
gotest.tools/v3 v3.0.2 h1:kG1BFyqVHuQoVQiR1bWGnfz/fmHvvuiSPIV7rvl360E=
gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk=
gotest.tools/v3 v3.0.3 h1:4AuOwCGf4lLR9u3YOe2awrHygurzhO/HeQ6laiA6Sx0=
gotest.tools/v3 v3.0.3/go.mod h1:Z7Lb0S5l+klDB31fvDQX8ss/FlKDxtlFlw3Oa8Ymbl8=
2 changes: 1 addition & 1 deletion _examples/profilesandbox/go.mod
Expand Up @@ -5,7 +5,7 @@ go 1.12
require (
github.com/getyoti/yoti-go-sdk/v3 v3.0.0
github.com/joho/godotenv v1.3.0
gotest.tools/v3 v3.0.2
gotest.tools/v3 v3.0.3
)

replace github.com/getyoti/yoti-go-sdk/v3 => ../../
4 changes: 2 additions & 2 deletions _examples/profilesandbox/go.sum
Expand Up @@ -30,5 +30,5 @@ google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miE
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM=
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
gotest.tools/v3 v3.0.2 h1:kG1BFyqVHuQoVQiR1bWGnfz/fmHvvuiSPIV7rvl360E=
gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk=
gotest.tools/v3 v3.0.3 h1:4AuOwCGf4lLR9u3YOe2awrHygurzhO/HeQ6laiA6Sx0=
gotest.tools/v3 v3.0.3/go.mod h1:Z7Lb0S5l+klDB31fvDQX8ss/FlKDxtlFlw3Oa8Ymbl8=
2 changes: 1 addition & 1 deletion consts/version.go
Expand Up @@ -2,5 +2,5 @@ package consts

const (
SDKIdentifier = "Go"
SDKVersionIdentifier = "3.1.0"
SDKVersionIdentifier = "3.2.0"
)
1 change: 1 addition & 0 deletions docscan/constants/constants.go
Expand Up @@ -2,6 +2,7 @@ package constants

const (
IDDocumentAuthenticity string = "ID_DOCUMENT_AUTHENTICITY"
IDDocumentComparison string = "ID_DOCUMENT_COMPARISON"
IDDocumentTextDataCheck string = "ID_DOCUMENT_TEXT_DATA_CHECK"
IDDocumentTextDataExtraction string = "ID_DOCUMENT_TEXT_DATA_EXTRACTION"
IDDocumentFaceMatch string = "ID_DOCUMENT_FACE_MATCH"
Expand Down
49 changes: 49 additions & 0 deletions docscan/sandbox/request/check/id_document_comparison_check.go
@@ -0,0 +1,49 @@
package check

import (
"github.com/getyoti/yoti-go-sdk/v3/docscan/sandbox/request/check/report"
"github.com/getyoti/yoti-go-sdk/v3/docscan/sandbox/request/filter"
)

// IDDocumentComparisonCheck Represents a document authenticity check
type IDDocumentComparisonCheck struct {
*check
SecondaryDocumentFilter *filter.DocumentFilter `json:"secondary_document_filter,omitempty"`
}

// IDDocumentComparisonCheckBuilder builds a IDDocumentComparisonCheck
type IDDocumentComparisonCheckBuilder struct {
checkBuilder
secondaryDocumentFilter *filter.DocumentFilter
}

// NewIDDocumentComparisonCheckBuilder creates a new IDDocumentComparisonCheckBuilder
func NewIDDocumentComparisonCheckBuilder() *IDDocumentComparisonCheckBuilder {
return &IDDocumentComparisonCheckBuilder{}
}

// WithRecommendation sets the recommendation on the check
func (b *IDDocumentComparisonCheckBuilder) WithRecommendation(recommendation *report.Recommendation) *IDDocumentComparisonCheckBuilder {
b.checkBuilder.withRecommendation(recommendation)
return b
}

// WithBreakdown adds a breakdown item to the check
func (b *IDDocumentComparisonCheckBuilder) WithBreakdown(breakdown *report.Breakdown) *IDDocumentComparisonCheckBuilder {
b.checkBuilder.withBreakdown(breakdown)
return b
}

// WithSecondaryDocumentFilter adds a secondary document filter to the check
func (b *IDDocumentComparisonCheckBuilder) WithSecondaryDocumentFilter(filter *filter.DocumentFilter) *IDDocumentComparisonCheckBuilder {
b.secondaryDocumentFilter = filter
return b
}

// Build creates a new IDDocumentComparisonCheck
func (b *IDDocumentComparisonCheckBuilder) Build() (*IDDocumentComparisonCheck, error) {
return &IDDocumentComparisonCheck{
check: b.checkBuilder.build(),
SecondaryDocumentFilter: b.secondaryDocumentFilter,
}, nil
}

0 comments on commit 4d52474

Please sign in to comment.