-
Notifications
You must be signed in to change notification settings - Fork 28
/
api_utility.go
141 lines (114 loc) · 4.58 KB
/
api_utility.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
/*
Adyen Checkout API
API version: 71
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package checkout
import (
"context"
"net/http"
"net/url"
"github.com/adyen/adyen-go-api-library/v8/src/common"
)
// UtilityApi service
type UtilityApi common.Service
// All parameters accepted by UtilityApi.GetApplePaySession
type UtilityApiGetApplePaySessionInput struct {
idempotencyKey *string
applePaySessionRequest *ApplePaySessionRequest
}
// A unique identifier for the message with a maximum of 64 characters (we recommend a UUID).
func (r UtilityApiGetApplePaySessionInput) IdempotencyKey(idempotencyKey string) UtilityApiGetApplePaySessionInput {
r.idempotencyKey = &idempotencyKey
return r
}
func (r UtilityApiGetApplePaySessionInput) ApplePaySessionRequest(applePaySessionRequest ApplePaySessionRequest) UtilityApiGetApplePaySessionInput {
r.applePaySessionRequest = &applePaySessionRequest
return r
}
/*
Prepare a request for GetApplePaySession
@return UtilityApiGetApplePaySessionInput
*/
func (a *UtilityApi) GetApplePaySessionInput() UtilityApiGetApplePaySessionInput {
return UtilityApiGetApplePaySessionInput{}
}
/*
GetApplePaySession Get an Apple Pay session
You need to use this endpoint if you have an API-only integration with Apple Pay which uses Adyen's Apple Pay certificate.
The endpoint returns the Apple Pay session data which you need to complete the [Apple Pay session validation](https://docs.adyen.com/payment-methods/apple-pay/api-only?tab=adyen-certificate-validation_1#complete-apple-pay-session-validation).
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param r UtilityApiGetApplePaySessionInput - Request parameters, see GetApplePaySessionInput
@return ApplePaySessionResponse, *http.Response, error
*/
func (a *UtilityApi) GetApplePaySession(ctx context.Context, r UtilityApiGetApplePaySessionInput) (ApplePaySessionResponse, *http.Response, error) {
res := &ApplePaySessionResponse{}
path := "/applePay/sessions"
queryParams := url.Values{}
headerParams := make(map[string]string)
if r.idempotencyKey != nil {
common.ParameterAddToHeaderOrQuery(headerParams, "Idempotency-Key", r.idempotencyKey, "")
}
httpRes, err := common.SendAPIRequest(
ctx,
a.Client,
r.applePaySessionRequest,
res,
http.MethodPost,
a.BasePath()+path,
queryParams,
headerParams,
)
return *res, httpRes, err
}
// All parameters accepted by UtilityApi.OriginKeys
type UtilityApiOriginKeysInput struct {
idempotencyKey *string
utilityRequest *UtilityRequest
}
// A unique identifier for the message with a maximum of 64 characters (we recommend a UUID).
func (r UtilityApiOriginKeysInput) IdempotencyKey(idempotencyKey string) UtilityApiOriginKeysInput {
r.idempotencyKey = &idempotencyKey
return r
}
func (r UtilityApiOriginKeysInput) UtilityRequest(utilityRequest UtilityRequest) UtilityApiOriginKeysInput {
r.utilityRequest = &utilityRequest
return r
}
/*
Prepare a request for OriginKeys
@return UtilityApiOriginKeysInput
Deprecated
*/
func (a *UtilityApi) OriginKeysInput() UtilityApiOriginKeysInput {
return UtilityApiOriginKeysInput{}
}
/*
OriginKeys Create originKey values for domains
This operation takes the origin domains and returns a JSON object containing the corresponding origin keys for the domains.
> If you're still using origin key for your Web Drop-in or Components integration, we recommend [switching to client key](https://docs.adyen.com/development-resources/client-side-authentication/migrate-from-origin-key-to-client-key). This allows you to use a single key for all origins, add or remove origins without generating a new key, and detect the card type from the number entered in your payment form.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param r UtilityApiOriginKeysInput - Request parameters, see OriginKeysInput
@return UtilityResponse, *http.Response, error
Deprecated
*/
func (a *UtilityApi) OriginKeys(ctx context.Context, r UtilityApiOriginKeysInput) (UtilityResponse, *http.Response, error) {
res := &UtilityResponse{}
path := "/originKeys"
queryParams := url.Values{}
headerParams := make(map[string]string)
if r.idempotencyKey != nil {
common.ParameterAddToHeaderOrQuery(headerParams, "Idempotency-Key", r.idempotencyKey, "")
}
httpRes, err := common.SendAPIRequest(
ctx,
a.Client,
r.utilityRequest,
res,
http.MethodPost,
a.BasePath()+path,
queryParams,
headerParams,
)
return *res, httpRes, err
}