-
Notifications
You must be signed in to change notification settings - Fork 21
/
sources.go
63 lines (53 loc) · 1.76 KB
/
sources.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
55
56
57
58
59
60
61
62
63
package sources
import (
"github.com/checkout/checkout-sdk-go/common"
)
const path = "sources"
type SourceType string
type MandateType string
const (
Sepa SourceType = "Sepa"
)
const (
Single MandateType = "single"
Recurring MandateType = "recurring"
)
// Request
type (
SourceData struct {
FirstName string `json:"first_name,omitempty"`
LastName string `json:"last_name,omitempty"`
AccountIban string `json:"account_iban,omitempty"`
Bic string `json:"bic,omitempty"`
BillingDescriptor string `json:"billing_descriptor,omitempty"`
MandateType MandateType `json:"mandate_type,omitempty"`
}
sepaSourceRequest struct {
Type SourceType `json:"type" binding:"required"`
BillingAddress *common.Address `json:"billing_address,omitempty"`
SourceData *SourceData `json:"source_data,omitempty"`
Reference string `json:"reference,omitempty"`
Phone *common.Phone `json:"phone,omitempty"`
CustomerRequest *common.CustomerRequest `json:"customer,omitempty"`
}
)
func NewSepaSourceRequest() *sepaSourceRequest {
return &sepaSourceRequest{
Type: Sepa,
}
}
// Response
type (
CreateSepaSourceResponse struct {
HttpResponse common.HttpMetadata
SourceResponse *SourceResponse
ResponseData map[string]string `json:"response_data,omitempty"`
}
SourceResponse struct {
SourceType SourceType `json:"type,omitempty"`
Id string `json:"id,omitempty"`
ResponseCode string `json:"response_code,omitempty"`
Customer *common.CustomerResponse `json:"customer,omitempty"`
Links map[string]common.Link `json:"_links"`
}
)