-
Notifications
You must be signed in to change notification settings - Fork 9
/
vault.go
35 lines (29 loc) · 1.27 KB
/
vault.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
package paypal
import "net/http"
const (
kCreditCards = "/v1/vault/credit-cards"
)
// StoreCreditCard https://developer.paypal.com/docs/api/vault/#credit-cards_create
func (c *Client) StoreCreditCard(param *CreditCard) (result *CreditCard, err error) {
var api = c.BuildAPI(kCreditCards)
err = c.doRequestWithAuth(http.MethodPost, api, param, &result)
return result, err
}
// GetCreditCardList https://developer.paypal.com/docs/api/vault/#credit-cards_list
func (c *Client) GetCreditCardList(param *CreditCardListParam) (result *CreditCardList, err error) {
var api = c.BuildAPI(kCreditCards) + param.QueryString()
err = c.doRequestWithAuth(http.MethodGet, api, nil, &result)
return result, err
}
// DeleteCreditCard https://developer.paypal.com/docs/api/vault/#credit-cards_delete
func (c *Client) DeleteCreditCard(creditCardId string) (err error) {
var api = c.BuildAPI(kCreditCards, creditCardId)
err = c.doRequestWithAuth(http.MethodDelete, api, nil, nil)
return err
}
// GetCreditCardDetails https://developer.paypal.com/docs/api/vault/#credit-cards_delete
func (c *Client) GetCreditCardDetails(creditCardId string) (result *CreditCard, err error) {
var api = c.BuildAPI(kCreditCards, creditCardId)
err = c.doRequestWithAuth(http.MethodGet, api, nil, &result)
return result, err
}