forked from bpancost/sila
-
Notifications
You must be signed in to change notification settings - Fork 0
/
account_link_account.go
56 lines (47 loc) · 1.7 KB
/
account_link_account.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
package sila
import (
"github.com/kappapay/silaclient/domain"
)
func (client ClientImpl) LinkAccount(userHandle string) LinkAccount {
return &LinkAccountMsg{
Header: client.generateHeader().setUserHandle(userHandle),
Message: "link_account_msg",
}
}
type LinkAccountMsg struct {
Header *Header `json:"header"`
Message string `json:"message"`
PublicToken string `json:"public_token,omitempty"`
SelectedAccountId string `json:"selected_account_id,omitempty"`
AccountNumber string `json:"account_number,omitempty"`
RoutingNumber string `json:"routing_number,omitempty"`
AccountType string `json:"account_type,omitempty"`
AccountName string `json:"account_name,omitempty"`
}
func (msg *LinkAccountMsg) SetRef(ref string) LinkAccount {
msg.Header.setRef(ref)
return msg
}
func (msg *LinkAccountMsg) SetPlaidLinkAccount(publicToken string, selectedAccountId string) LinkAccount {
msg.PublicToken = publicToken
msg.SelectedAccountId = selectedAccountId
return msg
}
func (msg *LinkAccountMsg) SetDirectLinkAccount(accountNumber string, routingNumber string) LinkAccount {
msg.AccountNumber = accountNumber
msg.RoutingNumber = routingNumber
return msg
}
func (msg *LinkAccountMsg) SetAccountType(accountType string) LinkAccount {
msg.AccountType = accountType
return msg
}
func (msg *LinkAccountMsg) SetAccountName(accountName string) LinkAccount {
msg.AccountName = accountName
return msg
}
func (msg *LinkAccountMsg) Do(userWalletPrivateKey string) (domain.LinkAccountResponse, error) {
var responseBody domain.LinkAccountResponse
err := instance.performCallWithUserAuth("/link_account", msg, &responseBody, userWalletPrivateKey)
return responseBody, err
}