-
Notifications
You must be signed in to change notification settings - Fork 21
/
client.go
40 lines (34 loc) · 874 Bytes
/
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
package sources
import (
"github.com/checkout/checkout-sdk-go/client"
"github.com/checkout/checkout-sdk-go/common"
"github.com/checkout/checkout-sdk-go/configuration"
)
type Client struct {
configuration *configuration.Configuration
apiClient client.HttpClient
}
func NewClient(configuration *configuration.Configuration, apiClient client.HttpClient) *Client {
return &Client{
configuration: configuration,
apiClient: apiClient,
}
}
func (c *Client) CreateSepaSource(request *sepaSourceRequest) (*CreateSepaSourceResponse, error) {
auth, err := c.configuration.Credentials.GetAuthorization(configuration.SecretKey)
if err != nil {
return nil, err
}
var response CreateSepaSourceResponse
err = c.apiClient.Post(
common.BuildPath(path),
auth,
request,
&response,
nil,
)
if err != nil {
return nil, err
}
return &response, nil
}