forked from stripe/stripe-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
client.go
54 lines (43 loc) · 1.43 KB
/
client.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
// Package threedsecure provides the /3d_secure APIs
package threedsecure
import (
stripe "github.com/stripe/stripe-go"
"github.com/stripe/stripe-go/form"
)
// Client is used to invoke /3d_secure APIs.
type Client struct {
B stripe.Backend
Key string
}
// New POSTs new 3D Secure auths.
// For more details see https://stripe.com/docs/api#create_three_d_secure.
func New(params *stripe.ThreeDSecureParams) (*stripe.ThreeDSecure, error) {
return getC().New(params)
}
func (c Client) New(params *stripe.ThreeDSecureParams) (*stripe.ThreeDSecure, error) {
body := &form.Values{}
form.AppendTo(body, params)
tds := &stripe.ThreeDSecure{}
err := c.B.Call("POST", "/3d_secure", c.Key, body, ¶ms.Params, tds)
return tds, err
}
// Get returns the details of a 3D Secure auth.
// For more details see https://stripe.com/docs/api#retrieve_three_d_secure.
func Get(id string, params *stripe.ThreeDSecureParams) (*stripe.ThreeDSecure, error) {
return getC().Get(id, params)
}
func (c Client) Get(id string, params *stripe.ThreeDSecureParams) (*stripe.ThreeDSecure, error) {
var body *form.Values
var commonParams *stripe.Params
if params != nil {
commonParams = ¶ms.Params
body = &form.Values{}
form.AppendTo(body, params)
}
tds := &stripe.ThreeDSecure{}
err := c.B.Call("GET", "/3d_secure/"+id, c.Key, body, commonParams, tds)
return tds, err
}
func getC() Client {
return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}
}