• 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

57.14
/src/main/java/com/adyen/service/balanceplatform/PaymentInstrumentsApi.java
1
/*
2
 * Configuration API
3
 *
4
 * The version of the OpenAPI document: 2
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.balanceplatform;
13

14
import com.adyen.Client;
15
import com.adyen.Service;
16
import com.adyen.constants.ApiConstants;
17
import com.adyen.model.balanceplatform.ListNetworkTokensResponse;
18
import com.adyen.model.balanceplatform.PaymentInstrument;
19
import com.adyen.model.balanceplatform.PaymentInstrumentInfo;
20
import com.adyen.model.balanceplatform.PaymentInstrumentRevealInfo;
21
import com.adyen.model.balanceplatform.PaymentInstrumentUpdateRequest;
22
import com.adyen.model.balanceplatform.RestServiceError;
23
import com.adyen.model.balanceplatform.TransactionRulesResponse;
24
import com.adyen.model.balanceplatform.UpdatePaymentInstrument;
25
import com.adyen.model.RequestOptions;
26
import com.adyen.service.exception.ApiException;
27
import com.adyen.service.resource.Resource;
28

29
import java.io.IOException;
30
import java.util.HashMap;
31
import java.util.Map;
32

33
public class PaymentInstrumentsApi extends Service {
34

35
    public static final String API_VERSION = "2";
36

37
    protected String baseURL;
38

39
    /**
40
    * Payment instruments constructor in {@link com.adyen.service.balanceplatform package}.
41
    * @param client {@link Client } (required)
42
    */
43
    public PaymentInstrumentsApi(Client client) {
44
        super(client);
1✔
45
        this.baseURL = createBaseURL("https://balanceplatform-api-test.adyen.com/bcl/v2");
1✔
46
    }
1✔
47

48
    /**
49
    * Payment instruments constructor in {@link com.adyen.service.balanceplatform package}.
50
    * 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.
51
    * @param client {@link Client } (required)
52
    * @param baseURL {@link String } (required)
53
    */
54
    public PaymentInstrumentsApi(Client client, String baseURL) {
55
        super(client);
×
56
        this.baseURL = baseURL;
×
57
    }
×
58

59
    /**
60
    * Create a payment instrument
61
    *
62
    * @param paymentInstrumentInfo {@link PaymentInstrumentInfo }  (required)
63
    * @return {@link PaymentInstrument }
64
    * @throws ApiException if fails to make API call
65
    */
66
    public PaymentInstrument createPaymentInstrument(PaymentInstrumentInfo paymentInstrumentInfo) throws ApiException, IOException {
67
        return createPaymentInstrument(paymentInstrumentInfo, null);
1✔
68
    }
69

70
    /**
71
    * Create a payment instrument
72
    *
73
    * @param paymentInstrumentInfo {@link PaymentInstrumentInfo }  (required)
74
    * @param requestOptions {@link RequestOptions } Object to store additional data such as idempotency-keys (optional)
75
    * @return {@link PaymentInstrument }
76
    * @throws ApiException if fails to make API call
77
    */
78
    public PaymentInstrument createPaymentInstrument(PaymentInstrumentInfo paymentInstrumentInfo, RequestOptions requestOptions) throws ApiException, IOException {
79

80
        String requestBody = paymentInstrumentInfo.toJson();
1✔
81
        Resource resource = new Resource(this, this.baseURL + "/paymentInstruments", null);
1✔
82
        String jsonResult = resource.request(requestBody, requestOptions, ApiConstants.HttpMethod.POST, null);
1✔
83
        return PaymentInstrument.fromJson(jsonResult);
1✔
84
    }
85

86
    /**
87
    * Get all transaction rules for a payment instrument
88
    *
89
    * @param id {@link String } The unique identifier of the payment instrument. (required)
90
    * @return {@link TransactionRulesResponse }
91
    * @throws ApiException if fails to make API call
92
    */
93
    public TransactionRulesResponse getAllTransactionRulesForPaymentInstrument(String id) throws ApiException, IOException {
94
        return getAllTransactionRulesForPaymentInstrument(id, null);
1✔
95
    }
96

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

113
        String requestBody = null;
1✔
114
        Resource resource = new Resource(this, this.baseURL + "/paymentInstruments/{id}/transactionRules", null);
1✔
115
        String jsonResult = resource.request(requestBody, requestOptions, ApiConstants.HttpMethod.GET, pathParams);
1✔
116
        return TransactionRulesResponse.fromJson(jsonResult);
1✔
117
    }
118

119
    /**
120
    * Get the PAN of a payment instrument
121
    *
122
    * @param id {@link String } The unique identifier of the payment instrument. (required)
123
    * @return {@link PaymentInstrumentRevealInfo }
124
    * @throws ApiException if fails to make API call
125
    */
126
    public PaymentInstrumentRevealInfo getPanOfPaymentInstrument(String id) throws ApiException, IOException {
127
        return getPanOfPaymentInstrument(id, null);
×
128
    }
129

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

146
        String requestBody = null;
×
147
        Resource resource = new Resource(this, this.baseURL + "/paymentInstruments/{id}/reveal", null);
×
148
        String jsonResult = resource.request(requestBody, requestOptions, ApiConstants.HttpMethod.GET, pathParams);
×
149
        return PaymentInstrumentRevealInfo.fromJson(jsonResult);
×
150
    }
151

152
    /**
153
    * Get a payment instrument
154
    *
155
    * @param id {@link String } The unique identifier of the payment instrument. (required)
156
    * @return {@link PaymentInstrument }
157
    * @throws ApiException if fails to make API call
158
    */
159
    public PaymentInstrument getPaymentInstrument(String id) throws ApiException, IOException {
160
        return getPaymentInstrument(id, null);
1✔
161
    }
162

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

179
        String requestBody = null;
1✔
180
        Resource resource = new Resource(this, this.baseURL + "/paymentInstruments/{id}", null);
1✔
181
        String jsonResult = resource.request(requestBody, requestOptions, ApiConstants.HttpMethod.GET, pathParams);
1✔
182
        return PaymentInstrument.fromJson(jsonResult);
1✔
183
    }
184

185
    /**
186
    * List network tokens
187
    *
188
    * @param id {@link String } The unique identifier of the payment instrument. (required)
189
    * @return {@link ListNetworkTokensResponse }
190
    * @throws ApiException if fails to make API call
191
    */
192
    public ListNetworkTokensResponse listNetworkTokens(String id) throws ApiException, IOException {
NEW
193
        return listNetworkTokens(id, null);
×
194
    }
195

196
    /**
197
    * List network tokens
198
    *
199
    * @param id {@link String } The unique identifier of the payment instrument. (required)
200
    * @param requestOptions {@link RequestOptions } Object to store additional data such as idempotency-keys (optional)
201
    * @return {@link ListNetworkTokensResponse }
202
    * @throws ApiException if fails to make API call
203
    */
204
    public ListNetworkTokensResponse listNetworkTokens(String id, RequestOptions requestOptions) throws ApiException, IOException {
205
        //Add path params
206
        Map<String, String> pathParams = new HashMap<>();
×
207
        if (id == null) {
×
208
            throw new IllegalArgumentException("Please provide the id path parameter");
×
209
        }
210
        pathParams.put("id", id);
×
211

NEW
212
        String requestBody = null;
×
NEW
213
        Resource resource = new Resource(this, this.baseURL + "/paymentInstruments/{id}/networkTokens", null);
×
NEW
214
        String jsonResult = resource.request(requestBody, requestOptions, ApiConstants.HttpMethod.GET, pathParams);
×
NEW
215
        return ListNetworkTokensResponse.fromJson(jsonResult);
×
216
    }
217

218
    /**
219
    * Update a payment instrument
220
    *
221
    * @param id {@link String } The unique identifier of the payment instrument. (required)
222
    * @param paymentInstrumentUpdateRequest {@link PaymentInstrumentUpdateRequest }  (required)
223
    * @return {@link UpdatePaymentInstrument }
224
    * @throws ApiException if fails to make API call
225
    */
226
    public UpdatePaymentInstrument updatePaymentInstrument(String id, PaymentInstrumentUpdateRequest paymentInstrumentUpdateRequest) throws ApiException, IOException {
227
        return updatePaymentInstrument(id, paymentInstrumentUpdateRequest, null);
1✔
228
    }
229

230
    /**
231
    * Update a payment instrument
232
    *
233
    * @param id {@link String } The unique identifier of the payment instrument. (required)
234
    * @param paymentInstrumentUpdateRequest {@link PaymentInstrumentUpdateRequest }  (required)
235
    * @param requestOptions {@link RequestOptions } Object to store additional data such as idempotency-keys (optional)
236
    * @return {@link UpdatePaymentInstrument }
237
    * @throws ApiException if fails to make API call
238
    */
239
    public UpdatePaymentInstrument updatePaymentInstrument(String id, PaymentInstrumentUpdateRequest paymentInstrumentUpdateRequest, RequestOptions requestOptions) throws ApiException, IOException {
240
        //Add path params
241
        Map<String, String> pathParams = new HashMap<>();
1✔
242
        if (id == null) {
1✔
NEW
243
            throw new IllegalArgumentException("Please provide the id path parameter");
×
244
        }
245
        pathParams.put("id", id);
1✔
246

247
        String requestBody = paymentInstrumentUpdateRequest.toJson();
1✔
248
        Resource resource = new Resource(this, this.baseURL + "/paymentInstruments/{id}", null);
1✔
249
        String jsonResult = resource.request(requestBody, requestOptions, ApiConstants.HttpMethod.PATCH, pathParams);
1✔
250
        return UpdatePaymentInstrument.fromJson(jsonResult);
1✔
251
    }
252
}
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