-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbank_details_lookup.go
55 lines (45 loc) · 1.59 KB
/
bank_details_lookup.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
package gocardless
import (
"fmt"
)
type BankDetailsLookupService service
const (
AUTOGIRO = "autogiro"
BACS = "bacs"
SEPA_CORE = "sepa_core"
)
type AvailableDebitScheme struct {
Name string
}
type AvailableDebitSchemeList struct {
list []AvailableDebitScheme
}
type BankDetailsLookupRequest struct {
AccountNumber string `json:"account_number,omitempty"`
BankCode string `json:"bank_code,omitempty"`
BranchCode string `json:"branch_code,omitempty"`
CountryCode string `json:"country_code,omitempty"`
Iban string `json:"iban,omitempty"`
}
type BankDetailsLookup struct {
BankName string `json:"bank_name,omitempty"`
BIC string `json:"bic,omitempty"`
CustomerId AvailableDebitSchemeList `json:"available_debit_schemes,omitempty"`
ResponseUrl string `json:"responseurl,omitempty"`
Metadata Metadata `json:"metadata,omitempty"`
}
func (availableDebitSchemeList *AvailableDebitSchemeList) AddDebitScheme(debitScheme AvailableDebitScheme) []AvailableDebitScheme {
availableDebitSchemeList.list = append(availableDebitSchemeList.list, debitScheme)
return availableDebitSchemeList.list
}
// Performs a bank details lookup
// As part of the lookup a modulus check and reachability check are performed.
func (s *BankDetailsLookupService) Lookup(lookup *BankDetailsLookupRequest) (*Response, error) {
u := fmt.Sprintf("/bank_details_lookups")
resp := &Response{}
rel := map[string]interface{}{
"bank_details_lookups": lookup,
}
err := s.client.Call("POST", u, rel, resp)
return resp, err
}