• 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/ApiCredentialsMerchantLevelApi.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.ApiCredential;
18
import com.adyen.model.management.CreateApiCredentialResponse;
19
import com.adyen.model.management.CreateMerchantApiCredentialRequest;
20
import com.adyen.model.management.ListMerchantApiCredentialsResponse;
21
import com.adyen.model.management.RestServiceError;
22
import com.adyen.model.management.UpdateMerchantApiCredentialRequest;
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 ApiCredentialsMerchantLevelApi 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 ApiCredentialsMerchantLevelApi(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 ApiCredentialsMerchantLevelApi(Client client, String baseURL) {
53
        super(client);
×
54
        this.baseURL = baseURL;
×
55
    }
×
56

57
    /**
58
    * Create an API credential
59
    *
60
    * @param merchantId {@link String } The unique identifier of the merchant account. (required)
61
    * @param createMerchantApiCredentialRequest {@link CreateMerchantApiCredentialRequest }  (required)
62
    * @return {@link CreateApiCredentialResponse }
63
    * @throws ApiException if fails to make API call
64
    */
65
    public CreateApiCredentialResponse createApiCredential(String merchantId, CreateMerchantApiCredentialRequest createMerchantApiCredentialRequest) throws ApiException, IOException {
NEW
66
        return createApiCredential(merchantId, createMerchantApiCredentialRequest, null);
×
67
    }
68

69
    /**
70
    * Create an API credential
71
    *
72
    * @param merchantId {@link String } The unique identifier of the merchant account. (required)
73
    * @param createMerchantApiCredentialRequest {@link CreateMerchantApiCredentialRequest }  (required)
74
    * @param requestOptions {@link RequestOptions } Object to store additional data such as idempotency-keys (optional)
75
    * @return {@link CreateApiCredentialResponse }
76
    * @throws ApiException if fails to make API call
77
    */
78
    public CreateApiCredentialResponse createApiCredential(String merchantId, CreateMerchantApiCredentialRequest createMerchantApiCredentialRequest, RequestOptions requestOptions) throws ApiException, IOException {
79
        //Add path params
80
        Map<String, String> pathParams = new HashMap<>();
×
81
        if (merchantId == null) {
×
82
            throw new IllegalArgumentException("Please provide the merchantId path parameter");
×
83
        }
84
        pathParams.put("merchantId", merchantId);
×
85

NEW
86
        String requestBody = createMerchantApiCredentialRequest.toJson();
×
87
        Resource resource = new Resource(this, this.baseURL + "/merchants/{merchantId}/apiCredentials", null);
×
NEW
88
        String jsonResult = resource.request(requestBody, requestOptions, ApiConstants.HttpMethod.POST, pathParams);
×
NEW
89
        return CreateApiCredentialResponse.fromJson(jsonResult);
×
90
    }
91

92
    /**
93
    * Get an API credential
94
    *
95
    * @param merchantId {@link String } The unique identifier of the merchant account. (required)
96
    * @param apiCredentialId {@link String } Unique identifier of the API credential. (required)
97
    * @return {@link ApiCredential }
98
    * @throws ApiException if fails to make API call
99
    */
100
    public ApiCredential getApiCredential(String merchantId, String apiCredentialId) throws ApiException, IOException {
101
        return getApiCredential(merchantId, apiCredentialId, null);
×
102
    }
103

104
    /**
105
    * Get an API credential
106
    *
107
    * @param merchantId {@link String } The unique identifier of the merchant account. (required)
108
    * @param apiCredentialId {@link String } Unique identifier of the API credential. (required)
109
    * @param requestOptions {@link RequestOptions } Object to store additional data such as idempotency-keys (optional)
110
    * @return {@link ApiCredential }
111
    * @throws ApiException if fails to make API call
112
    */
113
    public ApiCredential getApiCredential(String merchantId, String apiCredentialId, RequestOptions requestOptions) throws ApiException, IOException {
114
        //Add path params
115
        Map<String, String> pathParams = new HashMap<>();
×
116
        if (merchantId == null) {
×
117
            throw new IllegalArgumentException("Please provide the merchantId path parameter");
×
118
        }
119
        pathParams.put("merchantId", merchantId);
×
120
        if (apiCredentialId == null) {
×
121
            throw new IllegalArgumentException("Please provide the apiCredentialId path parameter");
×
122
        }
123
        pathParams.put("apiCredentialId", apiCredentialId);
×
124

125
        String requestBody = null;
×
126
        Resource resource = new Resource(this, this.baseURL + "/merchants/{merchantId}/apiCredentials/{apiCredentialId}", null);
×
127
        String jsonResult = resource.request(requestBody, requestOptions, ApiConstants.HttpMethod.GET, pathParams);
×
128
        return ApiCredential.fromJson(jsonResult);
×
129
    }
130

131
    /**
132
    * Get a list of API credentials
133
    *
134
    * @param merchantId {@link String } The unique identifier of the merchant account. (required)
135
    * @return {@link ListMerchantApiCredentialsResponse }
136
    * @throws ApiException if fails to make API call
137
    */
138
    public ListMerchantApiCredentialsResponse listApiCredentials(String merchantId) throws ApiException, IOException {
NEW
139
        return listApiCredentials(merchantId, null,  null,  null);
×
140
    }
141

142
    /**
143
    * Get a list of API credentials
144
    *
145
    * @param merchantId {@link String } The unique identifier of the merchant account. (required)
146
    * @param pageNumber {@link Integer } Query: The number of the page to fetch. (optional)
147
    * @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)
148
    * @param requestOptions {@link RequestOptions } Object to store additional data such as idempotency-keys (optional)
149
    * @return {@link ListMerchantApiCredentialsResponse }
150
    * @throws ApiException if fails to make API call
151
    */
152
    public ListMerchantApiCredentialsResponse listApiCredentials(String merchantId, Integer pageNumber, Integer pageSize, RequestOptions requestOptions) throws ApiException, IOException {
153
        //Add path params
154
        Map<String, String> pathParams = new HashMap<>();
×
155
        if (merchantId == null) {
×
156
            throw new IllegalArgumentException("Please provide the merchantId path parameter");
×
157
        }
158
        pathParams.put("merchantId", merchantId);
×
159
        //Add query params
NEW
160
        Map<String, String> queryParams = new HashMap<>();
×
NEW
161
        if (pageNumber != null) {
×
NEW
162
        queryParams.put("pageNumber", pageNumber.toString());
×
163
        }
NEW
164
        if (pageSize != null) {
×
NEW
165
        queryParams.put("pageSize", pageSize.toString());
×
166
        }
167

NEW
168
        String requestBody = null;
×
NEW
169
        Resource resource = new Resource(this, this.baseURL + "/merchants/{merchantId}/apiCredentials", null);
×
NEW
170
        String jsonResult = resource.request(requestBody, requestOptions, ApiConstants.HttpMethod.GET, pathParams, queryParams);
×
NEW
171
        return ListMerchantApiCredentialsResponse.fromJson(jsonResult);
×
172
    }
173

174
    /**
175
    * Update an API credential
176
    *
177
    * @param merchantId {@link String } The unique identifier of the merchant account. (required)
178
    * @param apiCredentialId {@link String } Unique identifier of the API credential. (required)
179
    * @param updateMerchantApiCredentialRequest {@link UpdateMerchantApiCredentialRequest }  (required)
180
    * @return {@link ApiCredential }
181
    * @throws ApiException if fails to make API call
182
    */
183
    public ApiCredential updateApiCredential(String merchantId, String apiCredentialId, UpdateMerchantApiCredentialRequest updateMerchantApiCredentialRequest) throws ApiException, IOException {
NEW
184
        return updateApiCredential(merchantId, apiCredentialId, updateMerchantApiCredentialRequest, null);
×
185
    }
186

187
    /**
188
    * Update an API credential
189
    *
190
    * @param merchantId {@link String } The unique identifier of the merchant account. (required)
191
    * @param apiCredentialId {@link String } Unique identifier of the API credential. (required)
192
    * @param updateMerchantApiCredentialRequest {@link UpdateMerchantApiCredentialRequest }  (required)
193
    * @param requestOptions {@link RequestOptions } Object to store additional data such as idempotency-keys (optional)
194
    * @return {@link ApiCredential }
195
    * @throws ApiException if fails to make API call
196
    */
197
    public ApiCredential updateApiCredential(String merchantId, String apiCredentialId, UpdateMerchantApiCredentialRequest updateMerchantApiCredentialRequest, RequestOptions requestOptions) throws ApiException, IOException {
198
        //Add path params
199
        Map<String, String> pathParams = new HashMap<>();
×
200
        if (merchantId == null) {
×
201
            throw new IllegalArgumentException("Please provide the merchantId path parameter");
×
202
        }
203
        pathParams.put("merchantId", merchantId);
×
NEW
204
        if (apiCredentialId == null) {
×
NEW
205
            throw new IllegalArgumentException("Please provide the apiCredentialId path parameter");
×
206
        }
NEW
207
        pathParams.put("apiCredentialId", apiCredentialId);
×
208

NEW
209
        String requestBody = updateMerchantApiCredentialRequest.toJson();
×
NEW
210
        Resource resource = new Resource(this, this.baseURL + "/merchants/{merchantId}/apiCredentials/{apiCredentialId}", null);
×
NEW
211
        String jsonResult = resource.request(requestBody, requestOptions, ApiConstants.HttpMethod.PATCH, pathParams);
×
NEW
212
        return ApiCredential.fromJson(jsonResult);
×
213
    }
214
}
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