|
14 | 14 | import jp.ne.paypay.model.NotDataResponse; |
15 | 15 | import jp.ne.paypay.model.Payment; |
16 | 16 | import jp.ne.paypay.model.PaymentDetails; |
| 17 | +import jp.ne.paypay.model.PaymentMethodsResponse; |
| 18 | +import jp.ne.paypay.model.ProductType; |
17 | 19 | import jp.ne.paypay.model.QRCode; |
18 | 20 | import jp.ne.paypay.model.QRCodeDetails; |
19 | 21 | import jp.ne.paypay.model.Refund; |
20 | 22 | import jp.ne.paypay.model.RefundDetails; |
21 | 23 | import jp.ne.paypay.model.RevertAuthResponse; |
22 | 24 |
|
23 | 25 | import java.lang.reflect.Type; |
| 26 | +import java.util.ArrayList; |
| 27 | +import java.util.HashMap; |
| 28 | +import java.util.List; |
| 29 | +import java.util.Map; |
24 | 30 |
|
25 | 31 | public class PaymentApi { |
26 | 32 | private ApiClient apiClient; |
@@ -72,8 +78,7 @@ public NotDataResponse cancelPayment(String merchantPaymentId) throws ApiExcepti |
72 | 78 | */ |
73 | 79 | protected ApiResponse<NotDataResponse> cancelPaymentWithHttpInfo(String merchantPaymentId) throws ApiException { |
74 | 80 | Call call = cancelPaymentValidateBeforeCall(merchantPaymentId); |
75 | | - Type localVarReturnType = new TypeToken<NotDataResponse>() { |
76 | | - }.getType(); |
| 81 | + Type localVarReturnType = new TypeToken<NotDataResponse>() {}.getType(); |
77 | 82 | return apiClient.execute(call, localVarReturnType, ApiNameConstants.CANCEL_PAYMENT); |
78 | 83 | } |
79 | 84 |
|
@@ -103,8 +108,7 @@ public PaymentDetails capturePaymentAuth(CaptureObject body) throws ApiException |
103 | 108 | */ |
104 | 109 | protected ApiResponse<PaymentDetails> capturePaymentAuthWithHttpInfo(Object body) throws ApiException { |
105 | 110 | Call call = capturePaymentAuthCall(body); |
106 | | - Type localVarReturnType = new TypeToken<PaymentDetails>() { |
107 | | - }.getType(); |
| 111 | + Type localVarReturnType = new TypeToken<PaymentDetails>() {}.getType(); |
108 | 112 | return apiClient.execute(call, localVarReturnType, ApiNameConstants.CAPTURE_PAYMENT); |
109 | 113 | } |
110 | 114 |
|
@@ -145,8 +149,7 @@ public PaymentDetails createPayment(Payment body, String agreeSimilarTransaction |
145 | 149 | */ |
146 | 150 | protected ApiResponse<PaymentDetails> createPaymentWithHttpInfo(Object body, String agreeSimilarTransaction) throws ApiException { |
147 | 151 | Call call = createPaymentValidateBeforeCall(body, agreeSimilarTransaction); |
148 | | - Type localVarReturnType = new TypeToken<PaymentDetails>() { |
149 | | - }.getType(); |
| 152 | + Type localVarReturnType = new TypeToken<PaymentDetails>() {}.getType(); |
150 | 153 | return apiClient.execute(call, localVarReturnType, ApiNameConstants.CREATE_PAYMENT); |
151 | 154 | } |
152 | 155 |
|
@@ -192,8 +195,7 @@ public QRCodeDetails createQRCode(QRCode body) throws ApiException { |
192 | 195 | */ |
193 | 196 | protected ApiResponse<QRCodeDetails> createQRCodeWithHttpInfo(Object body) throws ApiException { |
194 | 197 | Call call = createQRCodeValidateBeforeCall(body); |
195 | | - Type localVarReturnType = new TypeToken<QRCodeDetails>() { |
196 | | - }.getType(); |
| 198 | + Type localVarReturnType = new TypeToken<QRCodeDetails>() {}.getType(); |
197 | 199 | return apiClient.execute(call, localVarReturnType, ApiNameConstants.CREATE_QRCODE); |
198 | 200 | } |
199 | 201 |
|
@@ -225,8 +227,7 @@ public NotDataResponse deleteQRCode(String codeId) throws ApiException { |
225 | 227 | */ |
226 | 228 | protected ApiResponse<NotDataResponse> deleteQRCodeWithHttpInfo(String codeId) throws ApiException { |
227 | 229 | Call call = deleteQRCodeValidateBeforeCall(codeId); |
228 | | - Type localVarReturnType = new TypeToken<NotDataResponse>() { |
229 | | - }.getType(); |
| 230 | + Type localVarReturnType = new TypeToken<NotDataResponse>() {}.getType(); |
230 | 231 | return apiClient.execute(call, localVarReturnType, ApiNameConstants.DELETE_QRCODE); |
231 | 232 | } |
232 | 233 |
|
@@ -258,12 +259,64 @@ public PaymentDetails getPaymentDetails(String merchantPaymentId) throws ApiExce |
258 | 259 | */ |
259 | 260 | protected ApiResponse<PaymentDetails> getPaymentDetailsWithHttpInfo(String merchantPaymentId) throws ApiException { |
260 | 261 | Call call = getPaymentDetailsValidateBeforeCall(merchantPaymentId); |
261 | | - Type localVarReturnType = new TypeToken<PaymentDetails>() { |
262 | | - }.getType(); |
| 262 | + Type localVarReturnType = new TypeToken<PaymentDetails>() {}.getType(); |
263 | 263 | return apiClient.execute(call, localVarReturnType, ApiNameConstants.GET_PAYMENT); |
264 | 264 | } |
265 | 265 |
|
| 266 | + /** |
| 267 | + * Validate request parameters and build http call |
| 268 | + * |
| 269 | + * @param userAuthorizationId (required) |
| 270 | + * @param productType (optional) |
| 271 | + * @return Call |
| 272 | + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body |
| 273 | + */ |
| 274 | + private Call getPaymentMethodsValidateBeforeCall(String userAuthorizationId, ProductType productType) throws ApiException { |
| 275 | + // verify the required parameter 'userAuthorizationId' is set |
| 276 | + if (userAuthorizationId == null) |
| 277 | + throw new ApiException("Missing the required parameter 'userAuthorizationId' when calling getPaymentMethods"); |
| 278 | + |
| 279 | + List<Pair> localVarCollectionQueryParams = new ArrayList<>(); |
| 280 | + Map<String, String> localVarHeaderParams = new HashMap<>(); |
| 281 | + Map<String, Object> localVarFormParams = new HashMap<>(); |
| 282 | + String[] localVarAuthNames = new String[]{ApiConstants.HMAC_AUTH}; |
| 283 | + |
| 284 | + List<Pair> localVarQueryParams = new ArrayList<>(apiClient.parameterToPair("userAuthorizationId", userAuthorizationId)); |
| 285 | + if (productType != null) |
| 286 | + localVarQueryParams.addAll(apiClient.parameterToPair("productType", productType)); |
| 287 | + |
| 288 | + return apiClient.buildCall("/v4/paymentMethods", "GET", localVarQueryParams, localVarCollectionQueryParams, |
| 289 | + null, localVarHeaderParams, localVarFormParams, localVarAuthNames); |
| 290 | + } |
| 291 | + |
| 292 | + /** |
| 293 | + * Get payment methods |
| 294 | + * Get payment methods. **Timeout: 30s** |
| 295 | + * |
| 296 | + * @param userAuthorizationId (required) |
| 297 | + * @param productType (optional) |
| 298 | + * @return PaymentMethodsResponse |
| 299 | + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body |
| 300 | + */ |
| 301 | + public PaymentMethodsResponse getPaymentMethods(String userAuthorizationId, ProductType productType) throws ApiException { |
| 302 | + ApiResponse<PaymentMethodsResponse> resp = getPaymentMethodsWithHttpInfo(userAuthorizationId, productType); |
| 303 | + return resp.getData(); |
| 304 | + } |
266 | 305 |
|
| 306 | + /** |
| 307 | + * Get payment methods |
| 308 | + * Get payment methods. **Timeout: 30s** |
| 309 | + * |
| 310 | + * @param userAuthorizationId (required) |
| 311 | + * @param productType (optional) |
| 312 | + * @return ApiResponse<PaymentMethodsResponse> |
| 313 | + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body |
| 314 | + */ |
| 315 | + protected ApiResponse<PaymentMethodsResponse> getPaymentMethodsWithHttpInfo(String userAuthorizationId, ProductType productType) throws ApiException { |
| 316 | + Call call = getPaymentMethodsValidateBeforeCall(userAuthorizationId, productType); |
| 317 | + Type localVarReturnType = new TypeToken<PaymentMethodsResponse>() {}.getType(); |
| 318 | + return apiClient.execute(call, localVarReturnType, ApiNameConstants.GET_PAYMENT_METHODS); |
| 319 | + } |
267 | 320 |
|
268 | 321 | private Call getCodesPaymentDetailsValidateBeforeCall(String merchantPaymentId) throws ApiException { |
269 | 322 | return ApiUtil.getCallObject(apiClient, "/v2/codes/payments/{merchantPaymentId}", new Pair(ApiConstants.MERCHANT_PAYMENT_ID, |
@@ -293,8 +346,7 @@ public PaymentDetails getCodesPaymentDetails(String merchantPaymentId) throws Ap |
293 | 346 | */ |
294 | 347 | protected ApiResponse<PaymentDetails> getCodesPaymentDetailsWithHttpInfo(String merchantPaymentId) throws ApiException { |
295 | 348 | Call call = getCodesPaymentDetailsValidateBeforeCall(merchantPaymentId); |
296 | | - Type localVarReturnType = new TypeToken<PaymentDetails>() { |
297 | | - }.getType(); |
| 349 | + Type localVarReturnType = new TypeToken<PaymentDetails>() {}.getType(); |
298 | 350 | return apiClient.execute(call, localVarReturnType, ApiNameConstants.GET_QR_PAYMENT); |
299 | 351 | } |
300 | 352 |
|
@@ -328,8 +380,7 @@ public RefundDetails getRefundDetails(String merchantRefundId) throws ApiExcepti |
328 | 380 | */ |
329 | 381 | protected ApiResponse<RefundDetails> getRefundDetailsWithHttpInfo(String merchantRefundId) throws ApiException { |
330 | 382 | Call call = getRefundDetailsValidateBeforeCall(merchantRefundId); |
331 | | - Type localVarReturnType = new TypeToken<RefundDetails>() { |
332 | | - }.getType(); |
| 383 | + Type localVarReturnType = new TypeToken<RefundDetails>() {}.getType(); |
333 | 384 | return apiClient.execute(call, localVarReturnType, ApiNameConstants.GET_REFUND); |
334 | 385 | } |
335 | 386 |
|
@@ -361,8 +412,7 @@ public RefundDetails refundPayment(Refund body) throws ApiException { |
361 | 412 | */ |
362 | 413 | protected ApiResponse<RefundDetails> refundPaymentWithHttpInfo(Object body) throws ApiException { |
363 | 414 | Call call = refundPaymentValidateBeforeCall(body); |
364 | | - Type localVarReturnType = new TypeToken<RefundDetails>() { |
365 | | - }.getType(); |
| 415 | + Type localVarReturnType = new TypeToken<RefundDetails>() {}.getType(); |
366 | 416 | return apiClient.execute(call, localVarReturnType, ApiNameConstants.REFUND_PAYMENT); |
367 | 417 | } |
368 | 418 |
|
@@ -393,8 +443,7 @@ public RevertAuthResponse revertAuth(Object body) throws ApiException { |
393 | 443 | */ |
394 | 444 | protected ApiResponse<RevertAuthResponse> revertAuthWithHttpInfo(Object body) throws ApiException { |
395 | 445 | Call call = revertAuthValidateBeforeCall(body); |
396 | | - Type localVarReturnType = new TypeToken<RevertAuthResponse>() { |
397 | | - }.getType(); |
| 446 | + Type localVarReturnType = new TypeToken<RevertAuthResponse>() {}.getType(); |
398 | 447 | return apiClient.execute(call, localVarReturnType, ApiNameConstants.REVERT_AUTHORIZE); |
399 | 448 | } |
400 | 449 |
|
@@ -422,8 +471,7 @@ public LinkQRCodeResponse createAccountLinkQRCode(AccountLinkQRCode body) throws |
422 | 471 | */ |
423 | 472 | protected ApiResponse<LinkQRCodeResponse> createAccountLinkQRCodeWithHttpInfo(Object body) throws ApiException { |
424 | 473 | Call call = createAccountLinkQrCodeCall(body); |
425 | | - Type localVarReturnType = new TypeToken<LinkQRCodeResponse>() { |
426 | | - }.getType(); |
| 474 | + Type localVarReturnType = new TypeToken<LinkQRCodeResponse>() {}.getType(); |
427 | 475 | return apiClient.execute(call, localVarReturnType, ApiNameConstants.CREATE_QR_SESSION); |
428 | 476 | } |
429 | 477 |
|
@@ -458,8 +506,7 @@ public PaymentDetails createPaymentAuthorization(Payment body, String agreeSimil |
458 | 506 | */ |
459 | 507 | protected ApiResponse<PaymentDetails> createPaymentAuthorizationWithHttpInfo(Object body, String agreeSimilarTransaction) throws ApiException { |
460 | 508 | Call call = ApiUtil.postCallObject(apiClient, "/v2/payments/preauthorize", body, agreeSimilarTransaction); |
461 | | - Type localVarReturnType = new TypeToken<PaymentDetails>() { |
462 | | - }.getType(); |
| 509 | + Type localVarReturnType = new TypeToken<PaymentDetails>() {}.getType(); |
463 | 510 | return apiClient.execute(call, localVarReturnType, ApiNameConstants.PREAUTHORIZE_PAYMENT); |
464 | 511 | } |
465 | 512 |
|
@@ -488,8 +535,7 @@ public PaymentDetails createContinuousPayment(Payment body) throws ApiException |
488 | 535 | */ |
489 | 536 | protected ApiResponse<PaymentDetails> createContinuousPaymentWithHttpInfo(Object body) throws ApiException { |
490 | 537 | Call call = createContinuousPaymentCall(body); |
491 | | - Type localVarReturnType = new TypeToken<PaymentDetails>() { |
492 | | - }.getType(); |
| 538 | + Type localVarReturnType = new TypeToken<PaymentDetails>() {}.getType(); |
493 | 539 | return apiClient.execute(call, localVarReturnType, ApiNameConstants.CREATE_CONTINUOUS_PAYMENT); |
494 | 540 | } |
495 | 541 |
|
|
0 commit comments