• 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/UsersMerchantLevelApi.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.CreateMerchantUserRequest;
18
import com.adyen.model.management.CreateUserResponse;
19
import com.adyen.model.management.ListMerchantUsersResponse;
20
import com.adyen.model.management.RestServiceError;
21
import com.adyen.model.management.UpdateMerchantUserRequest;
22
import com.adyen.model.management.User;
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 UsersMerchantLevelApi 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 UsersMerchantLevelApi(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 UsersMerchantLevelApi(Client client, String baseURL) {
53
        super(client);
×
54
        this.baseURL = baseURL;
×
55
    }
×
56

57
    /**
58
    * Create a new user
59
    *
60
    * @param merchantId {@link String } Unique identifier of the merchant. (required)
61
    * @param createMerchantUserRequest {@link CreateMerchantUserRequest }  (required)
62
    * @return {@link CreateUserResponse }
63
    * @throws ApiException if fails to make API call
64
    */
65
    public CreateUserResponse createNewUser(String merchantId, CreateMerchantUserRequest createMerchantUserRequest) throws ApiException, IOException {
NEW
66
        return createNewUser(merchantId, createMerchantUserRequest, null);
×
67
    }
68

69
    /**
70
    * Create a new user
71
    *
72
    * @param merchantId {@link String } Unique identifier of the merchant. (required)
73
    * @param createMerchantUserRequest {@link CreateMerchantUserRequest }  (required)
74
    * @param requestOptions {@link RequestOptions } Object to store additional data such as idempotency-keys (optional)
75
    * @return {@link CreateUserResponse }
76
    * @throws ApiException if fails to make API call
77
    */
78
    public CreateUserResponse createNewUser(String merchantId, CreateMerchantUserRequest createMerchantUserRequest, 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 = createMerchantUserRequest.toJson();
×
87
        Resource resource = new Resource(this, this.baseURL + "/merchants/{merchantId}/users", null);
×
NEW
88
        String jsonResult = resource.request(requestBody, requestOptions, ApiConstants.HttpMethod.POST, pathParams);
×
NEW
89
        return CreateUserResponse.fromJson(jsonResult);
×
90
    }
91

92
    /**
93
    * Get user details
94
    *
95
    * @param merchantId {@link String } Unique identifier of the merchant. (required)
96
    * @param userId {@link String } Unique identifier of the user. (required)
97
    * @return {@link User }
98
    * @throws ApiException if fails to make API call
99
    */
100
    public User getUserDetails(String merchantId, String userId) throws ApiException, IOException {
101
        return getUserDetails(merchantId, userId, null);
×
102
    }
103

104
    /**
105
    * Get user details
106
    *
107
    * @param merchantId {@link String } Unique identifier of the merchant. (required)
108
    * @param userId {@link String } Unique identifier of the user. (required)
109
    * @param requestOptions {@link RequestOptions } Object to store additional data such as idempotency-keys (optional)
110
    * @return {@link User }
111
    * @throws ApiException if fails to make API call
112
    */
113
    public User getUserDetails(String merchantId, String userId, 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 (userId == null) {
×
121
            throw new IllegalArgumentException("Please provide the userId path parameter");
×
122
        }
123
        pathParams.put("userId", userId);
×
124

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

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

142
    /**
143
    * Get a list of users
144
    *
145
    * @param merchantId {@link String } Unique identifier of the merchant. (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 value is **100**. The default is **10** items on a page. (optional)
148
    * @param username {@link String } Query: The partial or complete username to select all users that match. (optional)
149
    * @param requestOptions {@link RequestOptions } Object to store additional data such as idempotency-keys (optional)
150
    * @return {@link ListMerchantUsersResponse }
151
    * @throws ApiException if fails to make API call
152
    */
153
    public ListMerchantUsersResponse listUsers(String merchantId, Integer pageNumber, Integer pageSize, String username, RequestOptions requestOptions) throws ApiException, IOException {
154
        //Add path params
155
        Map<String, String> pathParams = new HashMap<>();
×
156
        if (merchantId == null) {
×
157
            throw new IllegalArgumentException("Please provide the merchantId path parameter");
×
158
        }
159
        pathParams.put("merchantId", merchantId);
×
160
        //Add query params
NEW
161
        Map<String, String> queryParams = new HashMap<>();
×
NEW
162
        if (pageNumber != null) {
×
NEW
163
        queryParams.put("pageNumber", pageNumber.toString());
×
164
        }
NEW
165
        if (pageSize != null) {
×
NEW
166
        queryParams.put("pageSize", pageSize.toString());
×
167
        }
NEW
168
        if (username != null) {
×
NEW
169
        queryParams.put("username", username);
×
170
        }
171

NEW
172
        String requestBody = null;
×
NEW
173
        Resource resource = new Resource(this, this.baseURL + "/merchants/{merchantId}/users", null);
×
NEW
174
        String jsonResult = resource.request(requestBody, requestOptions, ApiConstants.HttpMethod.GET, pathParams, queryParams);
×
NEW
175
        return ListMerchantUsersResponse.fromJson(jsonResult);
×
176
    }
177

178
    /**
179
    * Update a user
180
    *
181
    * @param merchantId {@link String } Unique identifier of the merchant. (required)
182
    * @param userId {@link String } Unique identifier of the user. (required)
183
    * @param updateMerchantUserRequest {@link UpdateMerchantUserRequest }  (required)
184
    * @return {@link User }
185
    * @throws ApiException if fails to make API call
186
    */
187
    public User updateUser(String merchantId, String userId, UpdateMerchantUserRequest updateMerchantUserRequest) throws ApiException, IOException {
NEW
188
        return updateUser(merchantId, userId, updateMerchantUserRequest, null);
×
189
    }
190

191
    /**
192
    * Update a user
193
    *
194
    * @param merchantId {@link String } Unique identifier of the merchant. (required)
195
    * @param userId {@link String } Unique identifier of the user. (required)
196
    * @param updateMerchantUserRequest {@link UpdateMerchantUserRequest }  (required)
197
    * @param requestOptions {@link RequestOptions } Object to store additional data such as idempotency-keys (optional)
198
    * @return {@link User }
199
    * @throws ApiException if fails to make API call
200
    */
201
    public User updateUser(String merchantId, String userId, UpdateMerchantUserRequest updateMerchantUserRequest, RequestOptions requestOptions) throws ApiException, IOException {
202
        //Add path params
203
        Map<String, String> pathParams = new HashMap<>();
×
204
        if (merchantId == null) {
×
205
            throw new IllegalArgumentException("Please provide the merchantId path parameter");
×
206
        }
207
        pathParams.put("merchantId", merchantId);
×
NEW
208
        if (userId == null) {
×
NEW
209
            throw new IllegalArgumentException("Please provide the userId path parameter");
×
210
        }
NEW
211
        pathParams.put("userId", userId);
×
212

NEW
213
        String requestBody = updateMerchantUserRequest.toJson();
×
NEW
214
        Resource resource = new Resource(this, this.baseURL + "/merchants/{merchantId}/users/{userId}", null);
×
NEW
215
        String jsonResult = resource.request(requestBody, requestOptions, ApiConstants.HttpMethod.PATCH, pathParams);
×
NEW
216
        return User.fromJson(jsonResult);
×
217
    }
218
}
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