• 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

30.77
/src/main/java/com/adyen/service/management/AccountMerchantLevelApi.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.CreateMerchantRequest;
18
import com.adyen.model.management.CreateMerchantResponse;
19
import com.adyen.model.management.ListMerchantResponse;
20
import com.adyen.model.management.Merchant;
21
import com.adyen.model.management.RequestActivationResponse;
22
import com.adyen.model.management.RestServiceError;
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 AccountMerchantLevelApi 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 AccountMerchantLevelApi(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 AccountMerchantLevelApi(Client client, String baseURL) {
53
        super(client);
×
54
        this.baseURL = baseURL;
×
55
    }
×
56

57
    /**
58
    * Create a merchant account
59
    *
60
    * @param createMerchantRequest {@link CreateMerchantRequest }  (required)
61
    * @return {@link CreateMerchantResponse }
62
    * @throws ApiException if fails to make API call
63
    */
64
    public CreateMerchantResponse createMerchantAccount(CreateMerchantRequest createMerchantRequest) throws ApiException, IOException {
NEW
65
        return createMerchantAccount(createMerchantRequest, null);
×
66
    }
67

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

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

84
    /**
85
    * Get a merchant account
86
    *
87
    * @param merchantId {@link String } The unique identifier of the merchant account. (required)
88
    * @return {@link Merchant }
89
    * @throws ApiException if fails to make API call
90
    */
91
    public Merchant getMerchantAccount(String merchantId) throws ApiException, IOException {
92
        return getMerchantAccount(merchantId, null);
×
93
    }
94

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

111
        String requestBody = null;
×
112
        Resource resource = new Resource(this, this.baseURL + "/merchants/{merchantId}", null);
×
113
        String jsonResult = resource.request(requestBody, requestOptions, ApiConstants.HttpMethod.GET, pathParams);
×
114
        return Merchant.fromJson(jsonResult);
×
115
    }
116

117
    /**
118
    * Get a list of merchant accounts
119
    *
120
    * @return {@link ListMerchantResponse }
121
    * @throws ApiException if fails to make API call
122
    */
123
    public ListMerchantResponse listMerchantAccounts() throws ApiException, IOException {
124
        return listMerchantAccounts(null,  null,  null);
1✔
125
    }
126

127
    /**
128
    * Get a list of merchant accounts
129
    *
130
    * @param pageNumber {@link Integer } Query: The number of the page to fetch. (optional)
131
    * @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)
132
    * @param requestOptions {@link RequestOptions } Object to store additional data such as idempotency-keys (optional)
133
    * @return {@link ListMerchantResponse }
134
    * @throws ApiException if fails to make API call
135
    */
136
    public ListMerchantResponse listMerchantAccounts(Integer pageNumber, Integer pageSize, RequestOptions requestOptions) throws ApiException, IOException {
137
        //Add query params
138
        Map<String, String> queryParams = new HashMap<>();
1✔
139
        if (pageNumber != null) {
1✔
NEW
140
        queryParams.put("pageNumber", pageNumber.toString());
×
141
        }
142
        if (pageSize != null) {
1✔
143
        queryParams.put("pageSize", pageSize.toString());
1✔
144
        }
145

146
        String requestBody = null;
1✔
147
        Resource resource = new Resource(this, this.baseURL + "/merchants", null);
1✔
148
        String jsonResult = resource.request(requestBody, requestOptions, ApiConstants.HttpMethod.GET, null, queryParams);
1✔
149
        return ListMerchantResponse.fromJson(jsonResult);
1✔
150
    }
151

152
    /**
153
    * Request to activate a merchant account
154
    *
155
    * @param merchantId {@link String } The unique identifier of the merchant account. (required)
156
    * @return {@link RequestActivationResponse }
157
    * @throws ApiException if fails to make API call
158
    */
159
    public RequestActivationResponse requestToActivateMerchantAccount(String merchantId) throws ApiException, IOException {
160
        return requestToActivateMerchantAccount(merchantId, null);
×
161
    }
162

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

179
        String requestBody = null;
×
180
        Resource resource = new Resource(this, this.baseURL + "/merchants/{merchantId}/activate", null);
×
181
        String jsonResult = resource.request(requestBody, requestOptions, ApiConstants.HttpMethod.POST, pathParams);
×
182
        return RequestActivationResponse.fromJson(jsonResult);
×
183
    }
184
}
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