-
Notifications
You must be signed in to change notification settings - Fork 1
/
create_reserved_acct.go
executable file
·63 lines (56 loc) · 2.28 KB
/
create_reserved_acct.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
package monnify
import (
"fmt"
"net/http"
)
type (
// CreateReservedAcctReq request object
CreateReservedAcctReq struct {
AccountName string `json:"accountName"`
AccountReference string `json:"accountReference"`
CurrencyCode string `json:"currencyCode"`
ContractCode string `json:"contractCode"`
CustomerName string `json:"customerName"`
CustomerEmail string `json:"customerEmail"`
IncomeSplitConfig IncomeSplitConfigReqBody `json:"incomeSplitConfig"`
}
// IncomeSplitConfigReqBody request object
IncomeSplitConfigReqBody struct {
SubAccountCode string `json:"subAccountCode"`
SplitPercentage int `json:"splitPercentage"`
FeePercentage int `json:"feePercentage"`
FeeBearer bool `json:"feeBearer"`
}
// CreateReservedAcctRes response object
CreateReservedAcctRes struct {
RequestSuccessful bool `json:"requestSuccessful"`
ResponseMessage string `json:"responseMessage"`
ResponseCode string `json:"responseCode"`
ResponseBody struct {
ContractCode string `json:"contractCode"`
AccountReference string `json:"accountReference"`
AccountName string `json:"accountName"`
CurrencyCode string `json:"currencyCode"`
CustomerEmail string `json:"customerEmail"`
CustomerName string `json:"customerName"`
AccountNumber string `json:"accountNumber"`
BankName string `json:"bankName"`
BankCode string `json:"bankCode"`
Status string `json:"status"`
CreatedOn string `json:"createdOn"`
IncomeSplitConfig interface{} `json:"incomeSplitConfig"`
} `json:"responseBody"`
}
)
// CreateReservedAcct allows the creation of dedicated virtual accounts for your customers.
func (c *Client) CreateReservedAcct(payload CreateReservedAcctReq) (*CreateReservedAcctRes, error) {
url := fmt.Sprintf("%s/v1/bank-transfer/reserved-accounts", c.baseURL)
c.isBasic = false
var response CreateReservedAcctRes
if err := c.newRequest(http.MethodPost, url, payload, response); err != nil {
if err = c.generateNewBearerToken(); err != nil {
return nil, err
}
}
return &response, nil
}