-
Notifications
You must be signed in to change notification settings - Fork 145
/
deposits.go
37 lines (29 loc) · 967 Bytes
/
deposits.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
package coinbasepro
import (
"fmt"
)
type Deposit struct {
Currency string `json:"currency"`
Amount string `json:"amount"`
PaymentMethodID string `json:"payment_method_id"` // PaymentMethodID can be determined by calling GetPaymentMethods()
// Response fields
ID string `json:"id,omitempty"`
PayoutAt Time `json:"payout_at,string,omitempty"`
}
func (c *Client) CreateDeposit(newDeposit *Deposit) (Deposit, error) {
var savedDeposit Deposit
url := fmt.Sprintf("/deposits/payment-method")
_, err := c.Request("POST", url, newDeposit, &savedDeposit)
return savedDeposit, err
}
type PaymentMethod struct {
Currency string `json:"currency"`
Type string `json:"type"`
ID string `json:"id"`
}
func (c *Client) GetPaymentMethods() ([]PaymentMethod, error) {
var paymentMethods []PaymentMethod
url := fmt.Sprintf("/payment-methods")
_, err := c.Request("GET", url, nil, &paymentMethods)
return paymentMethods, err
}