-
Notifications
You must be signed in to change notification settings - Fork 0
/
kyc.go
105 lines (93 loc) · 5.05 KB
/
kyc.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
package identitymind
import "fmt"
// KYC
// GetApplication see https://edoc.identitymind.com/reference#getv2
func (i *IdentityMindAPIClient) GetApplication(applicationID string) (interface{}, error) {
var resp map[string]interface{}
status, err := i.Get(fmt.Sprintf("im/account/consumer/v2/%s", applicationID), map[string]interface{}{}, &resp)
if err != nil {
return nil, fmt.Errorf("Failed to retrieve KYC application via identitymind API; status: %d; %s", status, err.Error())
}
return resp, nil
}
// SubmitApplication see https://edoc.identitymind.com/reference#create
func (i *IdentityMindAPIClient) SubmitApplication(params map[string]interface{}) (interface{}, error) {
var resp map[string]interface{}
status, err := i.Post("im/account/consumer?graphScoreResponse=false", params, &resp)
if err != nil {
return nil, fmt.Errorf("Failed to upload consumer KYC document via identitymind API; status: %d; %s", status, err.Error())
}
return resp, nil
}
// ProvideApplicationResponse see https://edoc.identitymind.com/reference#quizresponse_1
func (i *IdentityMindAPIClient) ProvideApplicationResponse(applicationID string, params map[string]interface{}) (interface{}, error) {
var resp map[string]interface{}
status, err := i.Post(fmt.Sprintf("im/account/consumer/%s/quizresponse", applicationID), params, &resp)
if err != nil {
return nil, fmt.Errorf("Failed to reject merchant KYC application via identitymind API; status: %d; %s", status, err.Error())
}
return resp, nil
}
// ListApplicationDocuments see https://edoc.identitymind.com/reference#getfilelistforapplication
func (i *IdentityMindAPIClient) ListApplicationDocuments(applicationID string) (interface{}, error) {
var resp map[string]interface{}
status, err := i.Get(fmt.Sprintf("im/account/consumer/%s/files", applicationID), map[string]interface{}{}, &resp)
if err != nil {
return nil, fmt.Errorf("Failed to list KYC documents via identitymind API; status: %d; %s", status, err.Error())
}
return resp, nil
}
// DownloadApplicationDocument see https://edoc.identitymind.com/reference#reevaluatemerchant
func (i *IdentityMindAPIClient) DownloadApplicationDocument(applicationID, documentID string) (interface{}, error) {
var resp map[string]interface{}
status, err := i.Get(fmt.Sprintf("im/account/consumer/%s/files/%s", applicationID, documentID), map[string]interface{}{}, &resp)
if err != nil {
return nil, fmt.Errorf("Failed to download KYC document via identitymind API; status: %d; %s", status, err.Error())
}
return resp, nil
}
// UploadApplicationDocument see https://edoc.identitymind.com/reference#processfileuploadrequest
func (i *IdentityMindAPIClient) UploadApplicationDocument(applicationID string, params map[string]interface{}) (interface{}, error) {
var resp map[string]interface{}
status, err := i.PostMultipartFormData(fmt.Sprintf("im/account/consumer/%s/files", applicationID), params, &resp)
if err != nil {
return nil, fmt.Errorf("Failed to upload consumer KYC document via identitymind API; status: %d; %s", status, err.Error())
}
return resp, nil
}
// UploadApplicationDocumentVerificationImage see https://edoc.identitymind.com/reference#processimageuploadrequest
func (i *IdentityMindAPIClient) UploadApplicationDocumentVerificationImage(applicationID string, params map[string]interface{}) (interface{}, error) {
var resp map[string]interface{}
status, err := i.PostMultipartFormData(fmt.Sprintf("im/account/consumer/%s/dv", applicationID), params, &resp)
if err != nil {
return nil, fmt.Errorf("Failed to upload consumer KYC document image for verification via identitymind API; status: %d; %s", status, err.Error())
}
return resp, nil
}
// ApproveApplication see https://edoc.identitymind.com/reference#feedback
func (i *IdentityMindAPIClient) ApproveApplication(applicationID string, params map[string]interface{}) (interface{}, error) {
var resp map[string]interface{}
status, err := i.Post(fmt.Sprintf("im/account/consumer/%s/accepted", applicationID), params, &resp)
if err != nil {
return nil, fmt.Errorf("Failed to approve KYC application via identitymind API; status: %d; %s", status, err.Error())
}
return resp, nil
}
// RejectApplication see https://edoc.identitymind.com/reference#feedback
func (i *IdentityMindAPIClient) RejectApplication(applicationID string, params map[string]interface{}) (interface{}, error) {
var resp map[string]interface{}
status, err := i.Post(fmt.Sprintf("im/account/consumer/%s/rejected", applicationID), params, &resp)
if err != nil {
return nil, fmt.Errorf("Failed to reject KYC application via identitymind API; status: %d; %s", status, err.Error())
}
return resp, nil
}
// UndecideApplication see https://edoc.identitymind.com/reference#feedback
func (i *IdentityMindAPIClient) UndecideApplication(applicationID string, params map[string]interface{}) (interface{}, error) {
var resp map[string]interface{}
status, err := i.Post(fmt.Sprintf("im/account/consumer/%s/review", applicationID), params, &resp)
if err != nil {
return nil, fmt.Errorf("Failed to undecide KYC application via identitymind API; status: %d; %s", status, err.Error())
}
return resp, nil
}