• 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

11.96
/src/main/java/com/adyen/service/management/AccountStoreLevelApi.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.ListStoresResponse;
18
import com.adyen.model.management.RestServiceError;
19
import com.adyen.model.management.Store;
20
import com.adyen.model.management.StoreCreationRequest;
21
import com.adyen.model.management.StoreCreationWithMerchantCodeRequest;
22
import com.adyen.model.management.UpdateStoreRequest;
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 AccountStoreLevelApi 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 AccountStoreLevelApi(Client client) {
42
        super(client);
1✔
43
        this.baseURL = createBaseURL("https://management-test.adyen.com/v3");
1✔
44
    }
1✔
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 AccountStoreLevelApi(Client client, String baseURL) {
53
        super(client);
×
54
        this.baseURL = baseURL;
×
55
    }
×
56

57
    /**
58
    * Create a store
59
    *
60
    * @param storeCreationWithMerchantCodeRequest {@link StoreCreationWithMerchantCodeRequest }  (required)
61
    * @return {@link Store }
62
    * @throws ApiException if fails to make API call
63
    */
64
    public Store createStore(StoreCreationWithMerchantCodeRequest storeCreationWithMerchantCodeRequest) throws ApiException, IOException {
NEW
65
        return createStore(storeCreationWithMerchantCodeRequest, null);
×
66
    }
67

68
    /**
69
    * Create a store
70
    *
71
    * @param storeCreationWithMerchantCodeRequest {@link StoreCreationWithMerchantCodeRequest }  (required)
72
    * @param requestOptions {@link RequestOptions } Object to store additional data such as idempotency-keys (optional)
73
    * @return {@link Store }
74
    * @throws ApiException if fails to make API call
75
    */
76
    public Store createStore(StoreCreationWithMerchantCodeRequest storeCreationWithMerchantCodeRequest, RequestOptions requestOptions) throws ApiException, IOException {
77

NEW
78
        String requestBody = storeCreationWithMerchantCodeRequest.toJson();
×
NEW
79
        Resource resource = new Resource(this, this.baseURL + "/stores", null);
×
NEW
80
        String jsonResult = resource.request(requestBody, requestOptions, ApiConstants.HttpMethod.POST, null);
×
NEW
81
        return Store.fromJson(jsonResult);
×
82
    }
83

84
    /**
85
    * Create a store
86
    *
87
    * @param merchantId {@link String } The unique identifier of the merchant account. (required)
88
    * @param storeCreationRequest {@link StoreCreationRequest }  (required)
89
    * @return {@link Store }
90
    * @throws ApiException if fails to make API call
91
    */
92
    public Store createStoreByMerchantId(String merchantId, StoreCreationRequest storeCreationRequest) throws ApiException, IOException {
93
        return createStoreByMerchantId(merchantId, storeCreationRequest, null);
1✔
94
    }
95

96
    /**
97
    * Create a store
98
    *
99
    * @param merchantId {@link String } The unique identifier of the merchant account. (required)
100
    * @param storeCreationRequest {@link StoreCreationRequest }  (required)
101
    * @param requestOptions {@link RequestOptions } Object to store additional data such as idempotency-keys (optional)
102
    * @return {@link Store }
103
    * @throws ApiException if fails to make API call
104
    */
105
    public Store createStoreByMerchantId(String merchantId, StoreCreationRequest storeCreationRequest, RequestOptions requestOptions) throws ApiException, IOException {
106
        //Add path params
107
        Map<String, String> pathParams = new HashMap<>();
1✔
108
        if (merchantId == null) {
1✔
109
            throw new IllegalArgumentException("Please provide the merchantId path parameter");
×
110
        }
111
        pathParams.put("merchantId", merchantId);
1✔
112

113
        String requestBody = storeCreationRequest.toJson();
1✔
114
        Resource resource = new Resource(this, this.baseURL + "/merchants/{merchantId}/stores", null);
1✔
115
        String jsonResult = resource.request(requestBody, requestOptions, ApiConstants.HttpMethod.POST, pathParams);
1✔
116
        return Store.fromJson(jsonResult);
1✔
117
    }
118

119
    /**
120
    * Get a store
121
    *
122
    * @param merchantId {@link String } The unique identifier of the merchant account. (required)
123
    * @param storeId {@link String } The unique identifier of the store. (required)
124
    * @return {@link Store }
125
    * @throws ApiException if fails to make API call
126
    */
127
    public Store getStore(String merchantId, String storeId) throws ApiException, IOException {
128
        return getStore(merchantId, storeId, null);
×
129
    }
130

131
    /**
132
    * Get a store
133
    *
134
    * @param merchantId {@link String } The unique identifier of the merchant account. (required)
135
    * @param storeId {@link String } The unique identifier of the store. (required)
136
    * @param requestOptions {@link RequestOptions } Object to store additional data such as idempotency-keys (optional)
137
    * @return {@link Store }
138
    * @throws ApiException if fails to make API call
139
    */
140
    public Store getStore(String merchantId, String storeId, RequestOptions requestOptions) throws ApiException, IOException {
141
        //Add path params
142
        Map<String, String> pathParams = new HashMap<>();
×
143
        if (merchantId == null) {
×
144
            throw new IllegalArgumentException("Please provide the merchantId path parameter");
×
145
        }
146
        pathParams.put("merchantId", merchantId);
×
147
        if (storeId == null) {
×
148
            throw new IllegalArgumentException("Please provide the storeId path parameter");
×
149
        }
150
        pathParams.put("storeId", storeId);
×
151

152
        String requestBody = null;
×
153
        Resource resource = new Resource(this, this.baseURL + "/merchants/{merchantId}/stores/{storeId}", null);
×
154
        String jsonResult = resource.request(requestBody, requestOptions, ApiConstants.HttpMethod.GET, pathParams);
×
155
        return Store.fromJson(jsonResult);
×
156
    }
157

158
    /**
159
    * Get a store
160
    *
161
    * @param storeId {@link String } The unique identifier of the store. (required)
162
    * @return {@link Store }
163
    * @throws ApiException if fails to make API call
164
    */
165
    public Store getStoreById(String storeId) throws ApiException, IOException {
NEW
166
        return getStoreById(storeId, null);
×
167
    }
168

169
    /**
170
    * Get a store
171
    *
172
    * @param storeId {@link String } The unique identifier of the store. (required)
173
    * @param requestOptions {@link RequestOptions } Object to store additional data such as idempotency-keys (optional)
174
    * @return {@link Store }
175
    * @throws ApiException if fails to make API call
176
    */
177
    public Store getStoreById(String storeId, RequestOptions requestOptions) throws ApiException, IOException {
178
        //Add path params
NEW
179
        Map<String, String> pathParams = new HashMap<>();
×
NEW
180
        if (storeId == null) {
×
NEW
181
            throw new IllegalArgumentException("Please provide the storeId path parameter");
×
182
        }
NEW
183
        pathParams.put("storeId", storeId);
×
184

NEW
185
        String requestBody = null;
×
NEW
186
        Resource resource = new Resource(this, this.baseURL + "/stores/{storeId}", null);
×
NEW
187
        String jsonResult = resource.request(requestBody, requestOptions, ApiConstants.HttpMethod.GET, pathParams);
×
NEW
188
        return Store.fromJson(jsonResult);
×
189
    }
190

191
    /**
192
    * Get a list of stores
193
    *
194
    * @return {@link ListStoresResponse }
195
    * @throws ApiException if fails to make API call
196
    */
197
    public ListStoresResponse listStores() throws ApiException, IOException {
198
        return listStores(null,  null,  null,  null,  null);
×
199
    }
200

201
    /**
202
    * Get a list of stores
203
    *
204
    * @param pageNumber {@link Integer } Query: The number of the page to fetch. (optional)
205
    * @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)
206
    * @param reference {@link String } Query: The reference of the store. (optional)
207
    * @param merchantId {@link String } Query: The unique identifier of the merchant account. (optional)
208
    * @param requestOptions {@link RequestOptions } Object to store additional data such as idempotency-keys (optional)
209
    * @return {@link ListStoresResponse }
210
    * @throws ApiException if fails to make API call
211
    */
212
    public ListStoresResponse listStores(Integer pageNumber, Integer pageSize, String reference, String merchantId, RequestOptions requestOptions) throws ApiException, IOException {
213
        //Add query params
214
        Map<String, String> queryParams = new HashMap<>();
×
215
        if (pageNumber != null) {
×
216
        queryParams.put("pageNumber", pageNumber.toString());
×
217
        }
218
        if (pageSize != null) {
×
219
        queryParams.put("pageSize", pageSize.toString());
×
220
        }
221
        if (reference != null) {
×
222
        queryParams.put("reference", reference);
×
223
        }
224
        if (merchantId != null) {
×
225
        queryParams.put("merchantId", merchantId);
×
226
        }
227

228
        String requestBody = null;
×
229
        Resource resource = new Resource(this, this.baseURL + "/stores", null);
×
230
        String jsonResult = resource.request(requestBody, requestOptions, ApiConstants.HttpMethod.GET, null, queryParams);
×
231
        return ListStoresResponse.fromJson(jsonResult);
×
232
    }
233

234
    /**
235
    * Get a list of stores
236
    *
237
    * @param merchantId {@link String } The unique identifier of the merchant account. (required)
238
    * @return {@link ListStoresResponse }
239
    * @throws ApiException if fails to make API call
240
    */
241
    public ListStoresResponse listStoresByMerchantId(String merchantId) throws ApiException, IOException {
NEW
242
        return listStoresByMerchantId(merchantId, null,  null,  null,  null);
×
243
    }
244

245
    /**
246
    * Get a list of stores
247
    *
248
    * @param merchantId {@link String } The unique identifier of the merchant account. (required)
249
    * @param pageNumber {@link Integer } Query: The number of the page to fetch. (optional)
250
    * @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)
251
    * @param reference {@link String } Query: The reference of the store. (optional)
252
    * @param requestOptions {@link RequestOptions } Object to store additional data such as idempotency-keys (optional)
253
    * @return {@link ListStoresResponse }
254
    * @throws ApiException if fails to make API call
255
    */
256
    public ListStoresResponse listStoresByMerchantId(String merchantId, Integer pageNumber, Integer pageSize, String reference, RequestOptions requestOptions) throws ApiException, IOException {
257
        //Add path params
258
        Map<String, String> pathParams = new HashMap<>();
×
NEW
259
        if (merchantId == null) {
×
NEW
260
            throw new IllegalArgumentException("Please provide the merchantId path parameter");
×
261
        }
NEW
262
        pathParams.put("merchantId", merchantId);
×
263
        //Add query params
NEW
264
        Map<String, String> queryParams = new HashMap<>();
×
NEW
265
        if (pageNumber != null) {
×
NEW
266
        queryParams.put("pageNumber", pageNumber.toString());
×
267
        }
NEW
268
        if (pageSize != null) {
×
NEW
269
        queryParams.put("pageSize", pageSize.toString());
×
270
        }
NEW
271
        if (reference != null) {
×
NEW
272
        queryParams.put("reference", reference);
×
273
        }
274

275
        String requestBody = null;
×
NEW
276
        Resource resource = new Resource(this, this.baseURL + "/merchants/{merchantId}/stores", null);
×
NEW
277
        String jsonResult = resource.request(requestBody, requestOptions, ApiConstants.HttpMethod.GET, pathParams, queryParams);
×
NEW
278
        return ListStoresResponse.fromJson(jsonResult);
×
279
    }
280

281
    /**
282
    * Update a store
283
    *
284
    * @param merchantId {@link String } The unique identifier of the merchant account. (required)
285
    * @param storeId {@link String } The unique identifier of the store. (required)
286
    * @param updateStoreRequest {@link UpdateStoreRequest }  (required)
287
    * @return {@link Store }
288
    * @throws ApiException if fails to make API call
289
    */
290
    public Store updateStore(String merchantId, String storeId, UpdateStoreRequest updateStoreRequest) throws ApiException, IOException {
291
        return updateStore(merchantId, storeId, updateStoreRequest, null);
×
292
    }
293

294
    /**
295
    * Update a store
296
    *
297
    * @param merchantId {@link String } The unique identifier of the merchant account. (required)
298
    * @param storeId {@link String } The unique identifier of the store. (required)
299
    * @param updateStoreRequest {@link UpdateStoreRequest }  (required)
300
    * @param requestOptions {@link RequestOptions } Object to store additional data such as idempotency-keys (optional)
301
    * @return {@link Store }
302
    * @throws ApiException if fails to make API call
303
    */
304
    public Store updateStore(String merchantId, String storeId, UpdateStoreRequest updateStoreRequest, RequestOptions requestOptions) throws ApiException, IOException {
305
        //Add path params
306
        Map<String, String> pathParams = new HashMap<>();
×
307
        if (merchantId == null) {
×
308
            throw new IllegalArgumentException("Please provide the merchantId path parameter");
×
309
        }
310
        pathParams.put("merchantId", merchantId);
×
311
        if (storeId == null) {
×
312
            throw new IllegalArgumentException("Please provide the storeId path parameter");
×
313
        }
314
        pathParams.put("storeId", storeId);
×
315

316
        String requestBody = updateStoreRequest.toJson();
×
317
        Resource resource = new Resource(this, this.baseURL + "/merchants/{merchantId}/stores/{storeId}", null);
×
318
        String jsonResult = resource.request(requestBody, requestOptions, ApiConstants.HttpMethod.PATCH, pathParams);
×
319
        return Store.fromJson(jsonResult);
×
320
    }
321

322
    /**
323
    * Update a store
324
    *
325
    * @param storeId {@link String } The unique identifier of the store. (required)
326
    * @param updateStoreRequest {@link UpdateStoreRequest }  (required)
327
    * @return {@link Store }
328
    * @throws ApiException if fails to make API call
329
    */
330
    public Store updateStoreById(String storeId, UpdateStoreRequest updateStoreRequest) throws ApiException, IOException {
331
        return updateStoreById(storeId, updateStoreRequest, null);
×
332
    }
333

334
    /**
335
    * Update a store
336
    *
337
    * @param storeId {@link String } The unique identifier of the store. (required)
338
    * @param updateStoreRequest {@link UpdateStoreRequest }  (required)
339
    * @param requestOptions {@link RequestOptions } Object to store additional data such as idempotency-keys (optional)
340
    * @return {@link Store }
341
    * @throws ApiException if fails to make API call
342
    */
343
    public Store updateStoreById(String storeId, UpdateStoreRequest updateStoreRequest, RequestOptions requestOptions) throws ApiException, IOException {
344
        //Add path params
345
        Map<String, String> pathParams = new HashMap<>();
×
346
        if (storeId == null) {
×
347
            throw new IllegalArgumentException("Please provide the storeId path parameter");
×
348
        }
349
        pathParams.put("storeId", storeId);
×
350

351
        String requestBody = updateStoreRequest.toJson();
×
352
        Resource resource = new Resource(this, this.baseURL + "/stores/{storeId}", null);
×
353
        String jsonResult = resource.request(requestBody, requestOptions, ApiConstants.HttpMethod.PATCH, pathParams);
×
354
        return Store.fromJson(jsonResult);
×
355
    }
356
}
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