-
Notifications
You must be signed in to change notification settings - Fork 2
/
vipps.go
46 lines (38 loc) · 1.02 KB
/
vipps.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
package vipps
import (
"fmt"
"github.com/go-kit/kit/log"
"net/http"
)
const (
BaseURL = "https://api.vipps.no"
BaseURLTesting = "https://apitest.vipps.no"
)
// ErrUnexpectedResponse represents an unexpected erroneous response from the
// Vipps APIs.
type ErrUnexpectedResponse struct {
Body []byte
Status int
}
func (e ErrUnexpectedResponse) Error() string {
return fmt.Sprintf("unexpected response from Vipps, body: %s, status: %d", e.Body, e.Status)
}
// Environment is the Vipps environment that a Client should use.
type Environment string
// List of values that Environment can take.
const (
EnvironmentTesting Environment = "testing"
)
// Credentials represents secrets used to authenticate and authorize a client
// to the Vipps APIs.
type Credentials struct {
APISubscriptionKey string
ClientID string
ClientSecret string
}
// ClientConfig represents the configuration to use for a Client
type ClientConfig struct {
Environment Environment
Logger log.Logger
HTTPClient *http.Client
}