-
Notifications
You must be signed in to change notification settings - Fork 1
/
apple_pay.go
100 lines (86 loc) · 2.79 KB
/
apple_pay.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
// This file was auto-generated by Fern from our API Definition.
package square
import (
json "encoding/json"
fmt "fmt"
internal "github.com/square/square-go-sdk/internal"
)
type RegisterDomainRequest struct {
// A domain name as described in RFC-1034 that will be registered with ApplePay.
DomainName string `json:"domain_name" url:"-"`
}
// Defines the fields that are included in the response body of
// a request to the [RegisterDomain](api-endpoint:ApplePay-RegisterDomain) endpoint.
//
// Either `errors` or `status` are present in a given response (never both).
type RegisterDomainResponse struct {
// Any errors that occurred during the request.
Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"`
// The status of the domain registration.
//
// See [RegisterDomainResponseStatus](entity:RegisterDomainResponseStatus) for possible values.
// See [RegisterDomainResponseStatus](#type-registerdomainresponsestatus) for possible values
Status *RegisterDomainResponseStatus `json:"status,omitempty" url:"status,omitempty"`
extraProperties map[string]interface{}
rawJSON json.RawMessage
}
func (r *RegisterDomainResponse) GetErrors() []*Error {
if r == nil {
return nil
}
return r.Errors
}
func (r *RegisterDomainResponse) GetStatus() *RegisterDomainResponseStatus {
if r == nil {
return nil
}
return r.Status
}
func (r *RegisterDomainResponse) GetExtraProperties() map[string]interface{} {
return r.extraProperties
}
func (r *RegisterDomainResponse) UnmarshalJSON(data []byte) error {
type unmarshaler RegisterDomainResponse
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*r = RegisterDomainResponse(value)
extraProperties, err := internal.ExtractExtraProperties(data, *r)
if err != nil {
return err
}
r.extraProperties = extraProperties
r.rawJSON = json.RawMessage(data)
return nil
}
func (r *RegisterDomainResponse) String() string {
if len(r.rawJSON) > 0 {
if value, err := internal.StringifyJSON(r.rawJSON); err == nil {
return value
}
}
if value, err := internal.StringifyJSON(r); err == nil {
return value
}
return fmt.Sprintf("%#v", r)
}
// The status of the domain registration.
type RegisterDomainResponseStatus string
const (
RegisterDomainResponseStatusPending RegisterDomainResponseStatus = "PENDING"
RegisterDomainResponseStatusVerified RegisterDomainResponseStatus = "VERIFIED"
)
func NewRegisterDomainResponseStatusFromString(s string) (RegisterDomainResponseStatus, error) {
switch s {
case "PENDING":
return RegisterDomainResponseStatusPending, nil
case "VERIFIED":
return RegisterDomainResponseStatusVerified, nil
}
var t RegisterDomainResponseStatus
return "", fmt.Errorf("%s is not a valid %T", s, t)
}
func (r RegisterDomainResponseStatus) Ptr() *RegisterDomainResponseStatus {
return &r
}