• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Adyen / adyen-java-api-library / #2934

11 Dec 2023 05:06PM CUT coverage: 12.835%. First build
#2934

push

web-flow
Merge 0111dd892 into d70611050

173 of 797 new or added lines in 39 files covered. (21.71%)

12464 of 97111 relevant lines covered (12.83%)

0.13 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/main/java/com/adyen/service/management/PaymentMethodsMerchantLevelApi.java
1
/*
2
 * Management API
3
 *
4
 * The version of the OpenAPI document: 3
5
 * 
6
 *
7
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
8
 * https://openapi-generator.tech
9
 * Do not edit the class manually.
10
 */
11

12
package com.adyen.service.management;
13

14
import com.adyen.Client;
15
import com.adyen.Service;
16
import com.adyen.constants.ApiConstants;
17
import com.adyen.model.management.ApplePayInfo;
18
import com.adyen.model.management.PaymentMethod;
19
import com.adyen.model.management.PaymentMethodResponse;
20
import com.adyen.model.management.PaymentMethodSetupInfo;
21
import com.adyen.model.management.RestServiceError;
22
import com.adyen.model.management.UpdatePaymentMethodInfo;
23
import com.adyen.model.RequestOptions;
24
import com.adyen.service.exception.ApiException;
25
import com.adyen.service.resource.Resource;
26

27
import java.io.IOException;
28
import java.util.HashMap;
29
import java.util.Map;
30

31
public class PaymentMethodsMerchantLevelApi extends Service {
32

33
    public static final String API_VERSION = "3";
34

35
    protected String baseURL;
36

37
    /**
38
    *  constructor in {@link com.adyen.service.management package}.
39
    * @param client {@link Client } (required)
40
    */
41
    public PaymentMethodsMerchantLevelApi(Client client) {
42
        super(client);
×
43
        this.baseURL = createBaseURL("https://management-test.adyen.com/v3");
×
44
    }
×
45

46
    /**
47
    *  constructor in {@link com.adyen.service.management package}.
48
    * Please use this constructor only if you would like to pass along your own url for routing or testing purposes. The latest API version is defined in this class as a constant.
49
    * @param client {@link Client } (required)
50
    * @param baseURL {@link String } (required)
51
    */
52
    public PaymentMethodsMerchantLevelApi(Client client, String baseURL) {
53
        super(client);
×
54
        this.baseURL = baseURL;
×
55
    }
×
56

57
    /**
58
    * Add an Apple Pay domain
59
    *
60
    * @param merchantId {@link String } The unique identifier of the merchant account. (required)
61
    * @param paymentMethodId {@link String } The unique identifier of the payment method. (required)
62
    * @param applePayInfo {@link ApplePayInfo }  (required)
63
    * @throws ApiException if fails to make API call
64
    */
65
    public void addApplePayDomain(String merchantId, String paymentMethodId, ApplePayInfo applePayInfo) throws ApiException, IOException {
NEW
66
        addApplePayDomain(merchantId, paymentMethodId, applePayInfo, null);
×
NEW
67
    }
×
68

69
    /**
70
    * Add an Apple Pay domain
71
    *
72
    * @param merchantId {@link String } The unique identifier of the merchant account. (required)
73
    * @param paymentMethodId {@link String } The unique identifier of the payment method. (required)
74
    * @param applePayInfo {@link ApplePayInfo }  (required)
75
    * @param requestOptions {@link RequestOptions } Object to store additional data such as idempotency-keys (optional)
76
    * @throws ApiException if fails to make API call
77
    */
78
    public void addApplePayDomain(String merchantId, String paymentMethodId, ApplePayInfo applePayInfo, RequestOptions requestOptions) throws ApiException, IOException {
79
        //Add path params
NEW
80
        Map<String, String> pathParams = new HashMap<>();
×
NEW
81
        if (merchantId == null) {
×
NEW
82
            throw new IllegalArgumentException("Please provide the merchantId path parameter");
×
83
        }
NEW
84
        pathParams.put("merchantId", merchantId);
×
NEW
85
        if (paymentMethodId == null) {
×
NEW
86
            throw new IllegalArgumentException("Please provide the paymentMethodId path parameter");
×
87
        }
NEW
88
        pathParams.put("paymentMethodId", paymentMethodId);
×
89

NEW
90
        String requestBody = applePayInfo.toJson();
×
NEW
91
        Resource resource = new Resource(this, this.baseURL + "/merchants/{merchantId}/paymentMethodSettings/{paymentMethodId}/addApplePayDomains", null);
×
NEW
92
        resource.request(requestBody, requestOptions, ApiConstants.HttpMethod.POST, pathParams);
×
NEW
93
    }
×
94

95
    /**
96
    * Get all payment methods
97
    *
98
    * @param merchantId {@link String } The unique identifier of the merchant account. (required)
99
    * @return {@link PaymentMethodResponse }
100
    * @throws ApiException if fails to make API call
101
    */
102
    public PaymentMethodResponse getAllPaymentMethods(String merchantId) throws ApiException, IOException {
103
        return getAllPaymentMethods(merchantId, null,  null,  null,  null,  null);
×
104
    }
105

106
    /**
107
    * Get all payment methods
108
    *
109
    * @param merchantId {@link String } The unique identifier of the merchant account. (required)
110
    * @param storeId {@link String } Query: The unique identifier of the store for which to return the payment methods. (optional)
111
    * @param businessLineId {@link String } Query: The unique identifier of the Business Line for which to return the payment methods. (optional)
112
    * @param pageSize {@link Integer } Query: The number of items to have on a page, maximum 100. The default is 10 items on a page. (optional)
113
    * @param pageNumber {@link Integer } Query: The number of the page to fetch. (optional)
114
    * @param requestOptions {@link RequestOptions } Object to store additional data such as idempotency-keys (optional)
115
    * @return {@link PaymentMethodResponse }
116
    * @throws ApiException if fails to make API call
117
    */
118
    public PaymentMethodResponse getAllPaymentMethods(String merchantId, String storeId, String businessLineId, Integer pageSize, Integer pageNumber, RequestOptions requestOptions) throws ApiException, IOException {
119
        //Add path params
120
        Map<String, String> pathParams = new HashMap<>();
×
121
        if (merchantId == null) {
×
122
            throw new IllegalArgumentException("Please provide the merchantId path parameter");
×
123
        }
124
        pathParams.put("merchantId", merchantId);
×
125
        //Add query params
126
        Map<String, String> queryParams = new HashMap<>();
×
127
        if (storeId != null) {
×
128
        queryParams.put("storeId", storeId);
×
129
        }
130
        if (businessLineId != null) {
×
131
        queryParams.put("businessLineId", businessLineId);
×
132
        }
133
        if (pageSize != null) {
×
134
        queryParams.put("pageSize", pageSize.toString());
×
135
        }
136
        if (pageNumber != null) {
×
137
        queryParams.put("pageNumber", pageNumber.toString());
×
138
        }
139

140
        String requestBody = null;
×
141
        Resource resource = new Resource(this, this.baseURL + "/merchants/{merchantId}/paymentMethodSettings", null);
×
142
        String jsonResult = resource.request(requestBody, requestOptions, ApiConstants.HttpMethod.GET, pathParams, queryParams);
×
143
        return PaymentMethodResponse.fromJson(jsonResult);
×
144
    }
145

146
    /**
147
    * Get Apple Pay domains
148
    *
149
    * @param merchantId {@link String } The unique identifier of the merchant account. (required)
150
    * @param paymentMethodId {@link String } The unique identifier of the payment method. (required)
151
    * @return {@link ApplePayInfo }
152
    * @throws ApiException if fails to make API call
153
    */
154
    public ApplePayInfo getApplePayDomains(String merchantId, String paymentMethodId) throws ApiException, IOException {
155
        return getApplePayDomains(merchantId, paymentMethodId, null);
×
156
    }
157

158
    /**
159
    * Get Apple Pay domains
160
    *
161
    * @param merchantId {@link String } The unique identifier of the merchant account. (required)
162
    * @param paymentMethodId {@link String } The unique identifier of the payment method. (required)
163
    * @param requestOptions {@link RequestOptions } Object to store additional data such as idempotency-keys (optional)
164
    * @return {@link ApplePayInfo }
165
    * @throws ApiException if fails to make API call
166
    */
167
    public ApplePayInfo getApplePayDomains(String merchantId, String paymentMethodId, RequestOptions requestOptions) throws ApiException, IOException {
168
        //Add path params
169
        Map<String, String> pathParams = new HashMap<>();
×
170
        if (merchantId == null) {
×
171
            throw new IllegalArgumentException("Please provide the merchantId path parameter");
×
172
        }
173
        pathParams.put("merchantId", merchantId);
×
174
        if (paymentMethodId == null) {
×
175
            throw new IllegalArgumentException("Please provide the paymentMethodId path parameter");
×
176
        }
177
        pathParams.put("paymentMethodId", paymentMethodId);
×
178

179
        String requestBody = null;
×
180
        Resource resource = new Resource(this, this.baseURL + "/merchants/{merchantId}/paymentMethodSettings/{paymentMethodId}/getApplePayDomains", null);
×
181
        String jsonResult = resource.request(requestBody, requestOptions, ApiConstants.HttpMethod.GET, pathParams);
×
182
        return ApplePayInfo.fromJson(jsonResult);
×
183
    }
184

185
    /**
186
    * Get payment method details
187
    *
188
    * @param merchantId {@link String } The unique identifier of the merchant account. (required)
189
    * @param paymentMethodId {@link String } The unique identifier of the payment method. (required)
190
    * @return {@link PaymentMethod }
191
    * @throws ApiException if fails to make API call
192
    */
193
    public PaymentMethod getPaymentMethodDetails(String merchantId, String paymentMethodId) throws ApiException, IOException {
NEW
194
        return getPaymentMethodDetails(merchantId, paymentMethodId, null);
×
195
    }
196

197
    /**
198
    * Get payment method details
199
    *
200
    * @param merchantId {@link String } The unique identifier of the merchant account. (required)
201
    * @param paymentMethodId {@link String } The unique identifier of the payment method. (required)
202
    * @param requestOptions {@link RequestOptions } Object to store additional data such as idempotency-keys (optional)
203
    * @return {@link PaymentMethod }
204
    * @throws ApiException if fails to make API call
205
    */
206
    public PaymentMethod getPaymentMethodDetails(String merchantId, String paymentMethodId, RequestOptions requestOptions) throws ApiException, IOException {
207
        //Add path params
208
        Map<String, String> pathParams = new HashMap<>();
×
209
        if (merchantId == null) {
×
210
            throw new IllegalArgumentException("Please provide the merchantId path parameter");
×
211
        }
212
        pathParams.put("merchantId", merchantId);
×
213
        if (paymentMethodId == null) {
×
214
            throw new IllegalArgumentException("Please provide the paymentMethodId path parameter");
×
215
        }
216
        pathParams.put("paymentMethodId", paymentMethodId);
×
217

NEW
218
        String requestBody = null;
×
219
        Resource resource = new Resource(this, this.baseURL + "/merchants/{merchantId}/paymentMethodSettings/{paymentMethodId}", null);
×
NEW
220
        String jsonResult = resource.request(requestBody, requestOptions, ApiConstants.HttpMethod.GET, pathParams);
×
221
        return PaymentMethod.fromJson(jsonResult);
×
222
    }
223

224
    /**
225
    * Request a payment method
226
    *
227
    * @param merchantId {@link String } The unique identifier of the merchant account. (required)
228
    * @param paymentMethodSetupInfo {@link PaymentMethodSetupInfo }  (required)
229
    * @return {@link PaymentMethod }
230
    * @throws ApiException if fails to make API call
231
    */
232
    public PaymentMethod requestPaymentMethod(String merchantId, PaymentMethodSetupInfo paymentMethodSetupInfo) throws ApiException, IOException {
233
        return requestPaymentMethod(merchantId, paymentMethodSetupInfo, null);
×
234
    }
235

236
    /**
237
    * Request a payment method
238
    *
239
    * @param merchantId {@link String } The unique identifier of the merchant account. (required)
240
    * @param paymentMethodSetupInfo {@link PaymentMethodSetupInfo }  (required)
241
    * @param requestOptions {@link RequestOptions } Object to store additional data such as idempotency-keys (optional)
242
    * @return {@link PaymentMethod }
243
    * @throws ApiException if fails to make API call
244
    */
245
    public PaymentMethod requestPaymentMethod(String merchantId, PaymentMethodSetupInfo paymentMethodSetupInfo, RequestOptions requestOptions) throws ApiException, IOException {
246
        //Add path params
247
        Map<String, String> pathParams = new HashMap<>();
×
248
        if (merchantId == null) {
×
249
            throw new IllegalArgumentException("Please provide the merchantId path parameter");
×
250
        }
251
        pathParams.put("merchantId", merchantId);
×
252

253
        String requestBody = paymentMethodSetupInfo.toJson();
×
254
        Resource resource = new Resource(this, this.baseURL + "/merchants/{merchantId}/paymentMethodSettings", null);
×
255
        String jsonResult = resource.request(requestBody, requestOptions, ApiConstants.HttpMethod.POST, pathParams);
×
256
        return PaymentMethod.fromJson(jsonResult);
×
257
    }
258

259
    /**
260
    * Update a payment method
261
    *
262
    * @param merchantId {@link String } The unique identifier of the merchant account. (required)
263
    * @param paymentMethodId {@link String } The unique identifier of the payment method. (required)
264
    * @param updatePaymentMethodInfo {@link UpdatePaymentMethodInfo }  (required)
265
    * @return {@link PaymentMethod }
266
    * @throws ApiException if fails to make API call
267
    */
268
    public PaymentMethod updatePaymentMethod(String merchantId, String paymentMethodId, UpdatePaymentMethodInfo updatePaymentMethodInfo) throws ApiException, IOException {
NEW
269
        return updatePaymentMethod(merchantId, paymentMethodId, updatePaymentMethodInfo, null);
×
270
    }
271

272
    /**
273
    * Update a payment method
274
    *
275
    * @param merchantId {@link String } The unique identifier of the merchant account. (required)
276
    * @param paymentMethodId {@link String } The unique identifier of the payment method. (required)
277
    * @param updatePaymentMethodInfo {@link UpdatePaymentMethodInfo }  (required)
278
    * @param requestOptions {@link RequestOptions } Object to store additional data such as idempotency-keys (optional)
279
    * @return {@link PaymentMethod }
280
    * @throws ApiException if fails to make API call
281
    */
282
    public PaymentMethod updatePaymentMethod(String merchantId, String paymentMethodId, UpdatePaymentMethodInfo updatePaymentMethodInfo, RequestOptions requestOptions) throws ApiException, IOException {
283
        //Add path params
284
        Map<String, String> pathParams = new HashMap<>();
×
285
        if (merchantId == null) {
×
286
            throw new IllegalArgumentException("Please provide the merchantId path parameter");
×
287
        }
288
        pathParams.put("merchantId", merchantId);
×
289
        if (paymentMethodId == null) {
×
290
            throw new IllegalArgumentException("Please provide the paymentMethodId path parameter");
×
291
        }
292
        pathParams.put("paymentMethodId", paymentMethodId);
×
293

NEW
294
        String requestBody = updatePaymentMethodInfo.toJson();
×
NEW
295
        Resource resource = new Resource(this, this.baseURL + "/merchants/{merchantId}/paymentMethodSettings/{paymentMethodId}", null);
×
NEW
296
        String jsonResult = resource.request(requestBody, requestOptions, ApiConstants.HttpMethod.PATCH, pathParams);
×
NEW
297
        return PaymentMethod.fromJson(jsonResult);
×
298
    }
299
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc