Skip to content

Commit 3bb04a1

Browse files
authored
Merge branch 'master' into dependabot/gradle/com.auth0-java-jwt-4.0.0
2 parents 8d3c357 + 6a29f24 commit 3bb04a1

10 files changed

Lines changed: 605 additions & 35 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ Title | Method | HTTP request | Description
8181
*PaymentApi* | [**refundPayment**](docs/PaymentApi.md#refundPayment) | **POST** /v2/refunds | Refund a payment
8282
*PaymentApi* | [**createPendingPayment**](docs/PendingPaymentApi.md#createPendingPayment) | **POST** /v1/requestOrder | Create a pending payment
8383
*PaymentApi* | [**getPaymentDetails**](docs/PendingPaymentApi.md#getPaymentDetails) | **GET** /v1/requestOrder/{merchantPaymentId} | Get payment details (Pending Payment)
84+
*PaymentApi* | [**getPaymentMethods**](docs/PaymentApi.md#getPaymentMethods) | **GET** /v4/paymentMethods | Get payment methods
8485
*PaymentApi* | [**cancelPendingOrder**](docs/PendingPaymentApi.md#cancelPendingOrder) | **DELETE** /v1/requestOrder/{merchantPaymentId} | Cancel a Pending Order
8586
*PaymentApi* | [**getRefundDetails**](docs/PendingPaymentApi.md#getRefundDetails) | **GET** /v2/refunds/{merchantRefundId} | Get refund details (Pending Payment)
8687
*PaymentApi* | [**refundPayment**](docs/PendingPaymentApi.md#refundPayment) | **POST** /v1/requestOrder/refunds | Refund a payment (Pending Payment)

docs/PaymentApi.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Method | HTTP request | Description
1212
[**createQRCode**](PaymentApi.md#createQRCode) | **POST** /v2/codes | Create a Code
1313
[**deleteQRCode**](PaymentApi.md#deleteQRCode) | **DELETE** /v2/codes/{codeId} | Delete a Code
1414
[**getPaymentDetails**](PaymentApi.md#getPaymentDetails) | **GET** /v2/payments/{merchantPaymentId} | Get payment details
15+
[**getPaymentMethods**](PaymentApi.md#getPaymentMethods) | **GET** /v4/paymentMethods | Get payment methods
1516
[**getCodesPaymentDetails**](PaymentApi.md#getCodesPaymentDetails) | **GET** /v2/codes/payments/{merchantPaymentId} | Get payment details for QR code
1617
[**getRefundDetails**](PaymentApi.md#getRefundDetails) | **GET** /v2/refunds/{merchantRefundId} | Get refund details
1718
[**refundPayment**](PaymentApi.md#refundPayment) | **POST** /v2/refunds | Refund a payment
@@ -100,6 +101,8 @@ Create a payment
100101

101102
Create a direct debit payment and start the money transfer. **Timeout: 30s**
102103

104+
NOTE: If you would like to specify payment method, see also [**getPaymentMethods**](PaymentApi.md#getPaymentMethods).
105+
103106
### Example
104107
```java
105108
//Import classes:
@@ -151,6 +154,8 @@ Create a payment authorization
151154

152155
Create a payment authorization to block the money. **Timeout: 30s**
153156

157+
NOTE: If you would like to specify payment method, see also [**getPaymentMethods**](PaymentApi.md#getPaymentMethods).
158+
154159
### Example
155160
```java
156161
//Import classes:
@@ -201,6 +206,8 @@ https://www.paypay.ne.jp/opa/doc/v1.0/preauth_capture#operation/createAuth
201206
Create a continuous payment
202207
Create a continuous payment and start the money transfer. **Timeout: 30s**
203208

209+
NOTE: If you would like to specify payment method, see also [**getPaymentMethods**](PaymentApi.md#getPaymentMethods).
210+
204211
### Example
205212
```java
206213
//Import classes:
@@ -394,6 +401,83 @@ try {
394401
Please refer to the below document for more information :
395402
https://www.paypay.ne.jp/opa/doc/v1.0/direct_debit#operation/getPaymentDetails
396403
```
404+
405+
<a name="getPaymentMethods"></a>
406+
# **getPaymentMethods**
407+
> PaymentMethodsResponse getPaymentMethods(userAuthorizationId)
408+
409+
Get payment methods
410+
411+
Get payment methods. **Timeout: 30s**
412+
413+
### Example
414+
```java
415+
// Import classes:
416+
import jp.ne.paypay.ApiException;
417+
import jp.ne.paypay.api.PaymentApi;
418+
419+
420+
421+
PaymentApi apiInstance = new PaymentApi(apiClient);
422+
423+
String userAuthorizationId = "USER_AUTHORIZATION_ID"; // String
424+
ProductType productType = null; // Optional
425+
426+
try {
427+
PaymentMethodsResponse result = apiInstance.getPaymentMethods(userAuthorizationId, productType);
428+
System.out.println(result);
429+
} catch (ApiException e) {
430+
System.err.println("Exception when calling PaymentApi#getPaymentMethods");
431+
System.out.println(e.getResponseBody());
432+
}
433+
```
434+
435+
You can specify payment method by `setPaymentMethodType` and `setPaymentMethodId`.
436+
437+
```java
438+
439+
import jp.ne.paypay.ApiException;
440+
import jp.ne.paypay.api.PaymentApi;
441+
442+
443+
PaymentApi apiInstance = new PaymentApi(apiClient);
444+
445+
String agreeSimilarTransaction = "false"; // (Optional) If the parameter is set to true, the payment duplication check will be bypassed.
446+
String userAuthorizationId = "USER_AUTHORIZATION_ID"; // String
447+
ProductType productType = null; // Optional
448+
449+
Payment payment = new Payment();
450+
// ... set various fields to build a request body
451+
452+
453+
try {
454+
// Get availabkle payment methods
455+
PaymentMethodsResponse paymentMethodsResponse = apiInstance.getPaymentMethods(userAuthorizationId, productType);
456+
List<PaymentMethod> methods = paymentMethodsResponse.getData().getPaymentMethods();
457+
458+
// Set payment method if the response contains what you want for the payment
459+
Optional<PaymentMethod> method = methods.stream()
460+
.filter(x -> "PAY_LATER_CC".equals(x.getPaymentMethodType()))
461+
.findFirst();
462+
463+
if (method.isPresent()) {
464+
payment.setPaymentMethodType(method.get().getPaymentMethodType());
465+
payment.setPaymentMethodId(method.get().getPaymentMethodId());
466+
}
467+
468+
PaymentDetails result = apiInstance.createPayment(payment, agreeSimilarTransaction);
469+
System.out.println(result);
470+
} catch (ApiException e) {
471+
System.out.println(e.getResponseBody());
472+
}
473+
474+
```
475+
476+
```
477+
Please refer to the below document for more information :
478+
https://www.paypay.ne.jp/opa/doc/v1.0/direct_debit#tag/Payment/operation/GetPaymentMethods
479+
```
480+
397481
<a name="getCodesPaymentDetails"></a>
398482
# **getCodesPaymentDetails**
399483
> PaymentDetails getCodesPaymentDetails(merchantPaymentId)

src/main/java/jp/ne/paypay/api/ApiNameConstants.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ public class ApiNameConstants {
88
public static final String CREATE_QRCODE = "v2_createDynamicQRCode";
99
public static final String DELETE_QRCODE = "v2_deleteDynamicQRCode";
1010
public static final String GET_PAYMENT = "v2_getPaymentDetail";
11+
public static final String GET_PAYMENT_METHODS = "v4_getPaymentMethods";
1112
public static final String GET_QR_PAYMENT = "v2_getQRPaymentDetails";
1213
public static final String GET_REFUND = "v2_getRefundDetails";
1314
public static final String REFUND_PAYMENT = "v2_createRefundPayment";

src/main/java/jp/ne/paypay/api/PaymentApi.java

Lines changed: 72 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,19 @@
1414
import jp.ne.paypay.model.NotDataResponse;
1515
import jp.ne.paypay.model.Payment;
1616
import jp.ne.paypay.model.PaymentDetails;
17+
import jp.ne.paypay.model.PaymentMethodsResponse;
18+
import jp.ne.paypay.model.ProductType;
1719
import jp.ne.paypay.model.QRCode;
1820
import jp.ne.paypay.model.QRCodeDetails;
1921
import jp.ne.paypay.model.Refund;
2022
import jp.ne.paypay.model.RefundDetails;
2123
import jp.ne.paypay.model.RevertAuthResponse;
2224

2325
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;
2430

2531
public class PaymentApi {
2632
private ApiClient apiClient;
@@ -72,8 +78,7 @@ public NotDataResponse cancelPayment(String merchantPaymentId) throws ApiExcepti
7278
*/
7379
protected ApiResponse<NotDataResponse> cancelPaymentWithHttpInfo(String merchantPaymentId) throws ApiException {
7480
Call call = cancelPaymentValidateBeforeCall(merchantPaymentId);
75-
Type localVarReturnType = new TypeToken<NotDataResponse>() {
76-
}.getType();
81+
Type localVarReturnType = new TypeToken<NotDataResponse>() {}.getType();
7782
return apiClient.execute(call, localVarReturnType, ApiNameConstants.CANCEL_PAYMENT);
7883
}
7984

@@ -103,8 +108,7 @@ public PaymentDetails capturePaymentAuth(CaptureObject body) throws ApiException
103108
*/
104109
protected ApiResponse<PaymentDetails> capturePaymentAuthWithHttpInfo(Object body) throws ApiException {
105110
Call call = capturePaymentAuthCall(body);
106-
Type localVarReturnType = new TypeToken<PaymentDetails>() {
107-
}.getType();
111+
Type localVarReturnType = new TypeToken<PaymentDetails>() {}.getType();
108112
return apiClient.execute(call, localVarReturnType, ApiNameConstants.CAPTURE_PAYMENT);
109113
}
110114

@@ -145,8 +149,7 @@ public PaymentDetails createPayment(Payment body, String agreeSimilarTransaction
145149
*/
146150
protected ApiResponse<PaymentDetails> createPaymentWithHttpInfo(Object body, String agreeSimilarTransaction) throws ApiException {
147151
Call call = createPaymentValidateBeforeCall(body, agreeSimilarTransaction);
148-
Type localVarReturnType = new TypeToken<PaymentDetails>() {
149-
}.getType();
152+
Type localVarReturnType = new TypeToken<PaymentDetails>() {}.getType();
150153
return apiClient.execute(call, localVarReturnType, ApiNameConstants.CREATE_PAYMENT);
151154
}
152155

@@ -192,8 +195,7 @@ public QRCodeDetails createQRCode(QRCode body) throws ApiException {
192195
*/
193196
protected ApiResponse<QRCodeDetails> createQRCodeWithHttpInfo(Object body) throws ApiException {
194197
Call call = createQRCodeValidateBeforeCall(body);
195-
Type localVarReturnType = new TypeToken<QRCodeDetails>() {
196-
}.getType();
198+
Type localVarReturnType = new TypeToken<QRCodeDetails>() {}.getType();
197199
return apiClient.execute(call, localVarReturnType, ApiNameConstants.CREATE_QRCODE);
198200
}
199201

@@ -225,8 +227,7 @@ public NotDataResponse deleteQRCode(String codeId) throws ApiException {
225227
*/
226228
protected ApiResponse<NotDataResponse> deleteQRCodeWithHttpInfo(String codeId) throws ApiException {
227229
Call call = deleteQRCodeValidateBeforeCall(codeId);
228-
Type localVarReturnType = new TypeToken<NotDataResponse>() {
229-
}.getType();
230+
Type localVarReturnType = new TypeToken<NotDataResponse>() {}.getType();
230231
return apiClient.execute(call, localVarReturnType, ApiNameConstants.DELETE_QRCODE);
231232
}
232233

@@ -258,12 +259,64 @@ public PaymentDetails getPaymentDetails(String merchantPaymentId) throws ApiExce
258259
*/
259260
protected ApiResponse<PaymentDetails> getPaymentDetailsWithHttpInfo(String merchantPaymentId) throws ApiException {
260261
Call call = getPaymentDetailsValidateBeforeCall(merchantPaymentId);
261-
Type localVarReturnType = new TypeToken<PaymentDetails>() {
262-
}.getType();
262+
Type localVarReturnType = new TypeToken<PaymentDetails>() {}.getType();
263263
return apiClient.execute(call, localVarReturnType, ApiNameConstants.GET_PAYMENT);
264264
}
265265

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+
}
266305

306+
/**
307+
* Get payment methods
308+
* Get payment methods. **Timeout: 30s**
309+
*
310+
* @param userAuthorizationId (required)
311+
* @param productType (optional)
312+
* @return ApiResponse&lt;PaymentMethodsResponse&gt;
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+
}
267320

268321
private Call getCodesPaymentDetailsValidateBeforeCall(String merchantPaymentId) throws ApiException {
269322
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
293346
*/
294347
protected ApiResponse<PaymentDetails> getCodesPaymentDetailsWithHttpInfo(String merchantPaymentId) throws ApiException {
295348
Call call = getCodesPaymentDetailsValidateBeforeCall(merchantPaymentId);
296-
Type localVarReturnType = new TypeToken<PaymentDetails>() {
297-
}.getType();
349+
Type localVarReturnType = new TypeToken<PaymentDetails>() {}.getType();
298350
return apiClient.execute(call, localVarReturnType, ApiNameConstants.GET_QR_PAYMENT);
299351
}
300352

@@ -328,8 +380,7 @@ public RefundDetails getRefundDetails(String merchantRefundId) throws ApiExcepti
328380
*/
329381
protected ApiResponse<RefundDetails> getRefundDetailsWithHttpInfo(String merchantRefundId) throws ApiException {
330382
Call call = getRefundDetailsValidateBeforeCall(merchantRefundId);
331-
Type localVarReturnType = new TypeToken<RefundDetails>() {
332-
}.getType();
383+
Type localVarReturnType = new TypeToken<RefundDetails>() {}.getType();
333384
return apiClient.execute(call, localVarReturnType, ApiNameConstants.GET_REFUND);
334385
}
335386

@@ -361,8 +412,7 @@ public RefundDetails refundPayment(Refund body) throws ApiException {
361412
*/
362413
protected ApiResponse<RefundDetails> refundPaymentWithHttpInfo(Object body) throws ApiException {
363414
Call call = refundPaymentValidateBeforeCall(body);
364-
Type localVarReturnType = new TypeToken<RefundDetails>() {
365-
}.getType();
415+
Type localVarReturnType = new TypeToken<RefundDetails>() {}.getType();
366416
return apiClient.execute(call, localVarReturnType, ApiNameConstants.REFUND_PAYMENT);
367417
}
368418

@@ -393,8 +443,7 @@ public RevertAuthResponse revertAuth(Object body) throws ApiException {
393443
*/
394444
protected ApiResponse<RevertAuthResponse> revertAuthWithHttpInfo(Object body) throws ApiException {
395445
Call call = revertAuthValidateBeforeCall(body);
396-
Type localVarReturnType = new TypeToken<RevertAuthResponse>() {
397-
}.getType();
446+
Type localVarReturnType = new TypeToken<RevertAuthResponse>() {}.getType();
398447
return apiClient.execute(call, localVarReturnType, ApiNameConstants.REVERT_AUTHORIZE);
399448
}
400449

@@ -422,8 +471,7 @@ public LinkQRCodeResponse createAccountLinkQRCode(AccountLinkQRCode body) throws
422471
*/
423472
protected ApiResponse<LinkQRCodeResponse> createAccountLinkQRCodeWithHttpInfo(Object body) throws ApiException {
424473
Call call = createAccountLinkQrCodeCall(body);
425-
Type localVarReturnType = new TypeToken<LinkQRCodeResponse>() {
426-
}.getType();
474+
Type localVarReturnType = new TypeToken<LinkQRCodeResponse>() {}.getType();
427475
return apiClient.execute(call, localVarReturnType, ApiNameConstants.CREATE_QR_SESSION);
428476
}
429477

@@ -458,8 +506,7 @@ public PaymentDetails createPaymentAuthorization(Payment body, String agreeSimil
458506
*/
459507
protected ApiResponse<PaymentDetails> createPaymentAuthorizationWithHttpInfo(Object body, String agreeSimilarTransaction) throws ApiException {
460508
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();
463510
return apiClient.execute(call, localVarReturnType, ApiNameConstants.PREAUTHORIZE_PAYMENT);
464511
}
465512

@@ -488,8 +535,7 @@ public PaymentDetails createContinuousPayment(Payment body) throws ApiException
488535
*/
489536
protected ApiResponse<PaymentDetails> createContinuousPaymentWithHttpInfo(Object body) throws ApiException {
490537
Call call = createContinuousPaymentCall(body);
491-
Type localVarReturnType = new TypeToken<PaymentDetails>() {
492-
}.getType();
538+
Type localVarReturnType = new TypeToken<PaymentDetails>() {}.getType();
493539
return apiClient.execute(call, localVarReturnType, ApiNameConstants.CREATE_CONTINUOUS_PAYMENT);
494540
}
495541

0 commit comments

Comments
 (0)