-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
90 lines (82 loc) · 2.25 KB
/
main.go
File metadata and controls
90 lines (82 loc) · 2.25 KB
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
package main
import (
"log"
"github.com/Alig1493/from3-accounts-modules/models"
"github.com/Alig1493/from3-accounts-modules/services"
"github.com/google/uuid"
)
var (
service = services.NewAccountService()
userId = uuid.NewString()
organizationId = uuid.NewString()
)
func displayResponse(responseData *models.ResponseData, responseError *models.ErrorData) {
if responseError != nil {
log.Printf("Response error: %v", responseError)
} else {
log.Printf("Successful response for data: %+v", *responseData)
}
log.Printf("Status code: %v", responseData.StatusCode)
}
func sampleCreate() {
// {
// 'data': {
// 'type': 'accounts',
// 'id': 'ad27e265-9605-4b4b-a0e5-3003ea9cc4dc',
// 'organisation_id': 'eb0bd6f5-c3f5-44b2-b677-acd23cdde73c',
// 'attributes': {
// 'country': 'GB',
// 'base_currency': 'GBP',
// 'bank_id': '400300',
// 'bank_id_code': 'GBDSC',
// 'bic': 'NWBKGB22',
// 'name': [
// 'Samantha Holder'
// ],
// 'alternative_names': [
// 'Sam Holder'
// ],
// 'account_classification': 'Personal',
// 'joint_account': false,
// 'account_matching_opt_out': false,
// 'secondary_identification': 'A1B2C3D4'
// }
// }
// }
country := "GB"
account_classification := "Personal"
jointAccount := false
accountMatchingOptOut := false
accountData := models.Data{
Data: &models.AccountData{
Type: "accounts",
ID: userId,
OrganisationID: organizationId,
Attributes: &models.AccountAttributes{
Country: &country,
BaseCurrency: "GBP",
BankID: "400300",
BankIDCode: "GBDSC",
Bic: "NWBKGB22",
Name: []string{"Samantha", "Holder"},
AlternativeNames: []string{"Sam", "Holder"},
AccountClassification: &account_classification,
JointAccount: &jointAccount,
AccountMatchingOptOut: &accountMatchingOptOut,
SecondaryIdentification: "A1B2C3D4",
},
},
}
displayResponse(service.Create(&accountData))
}
func sampleFetch() {
displayResponse(service.Fetch(userId))
}
func sampleDelete() {
displayResponse(service.Delete(userId))
}
func main() {
sampleCreate()
sampleFetch()
sampleDelete()
}