use of jp.ne.paypay.model.PaymentDetails in project paypayopa-sdk-java by paypay.
the class PaymentApiTest method createContinuousPaymentTest.
/**
* Create continuous payment
*
* Create a continuous payment and start the money transfer. **Timeout: 30s**
*
* @throws ApiException if the Api call fails
*/
@Test
public void createContinuousPaymentTest() throws ApiException {
PaymentDetails paymentDetails = new PaymentDetails();
paymentDetails.resultInfo(resultInfo);
payment.status(PaymentState.StatusEnum.COMPLETED).authorizedAt(Instant.now().getNano()).paymentId("paymentId");
paymentDetails.data(payment);
Assert.assertNotNull(payment.toString());
ApiResponse<PaymentDetails> paymentDetailsApiResponse = new ApiResponse<>(90001, null, paymentDetails);
Mockito.when(api.createContinuousPaymentWithHttpInfo(payment)).thenReturn(paymentDetailsApiResponse);
PaymentDetails response = api.createContinuousPayment(payment);
Assert.assertEquals(response.getResultInfo().getMessage(), "SUCCESS");
Assert.assertEquals(response.getData().getMerchantPaymentId(), "merchantPaymentId");
Assert.assertEquals(response.getData().getUserAuthorizationId(), "userAuthorizationId");
Assert.assertEquals(response.getData().getPaymentId(), "paymentId");
Assert.assertEquals(response.getData().getStatus(), PaymentState.StatusEnum.COMPLETED);
Assert.assertNotNull(response.getData());
Assert.assertNotNull(response.getData().getTerminalId());
Assert.assertNotNull(response.getData().getOrderReceiptNumber());
Assert.assertNotNull(response.getData().getAmount());
Assert.assertNotNull(response.getData().getRequestedAt());
Assert.assertNotNull(response.getData().getOrderItems());
Assert.assertNotNull(response.getData().getAuthorizedAt());
}
use of jp.ne.paypay.model.PaymentDetails in project paypayopa-sdk-java by paypay.
the class PaymentApiTest method getCodePaymentDetailsTest.
/**
* Get payment details
*
* Get payment details. **Timeout: 15s**
*
* @throws ApiException if the Api call fails
*/
@Test
public void getCodePaymentDetailsTest() throws ApiException {
String merchantPaymentId = "merchantPaymentId";
PaymentDetails paymentDetails = new PaymentDetails();
paymentDetails.setResultInfo(resultInfo);
ApiResponse<PaymentDetails> paymentDetailsApiResponse = new ApiResponse<>(00001, null, paymentDetails);
Mockito.when(apiClient.escapeString(merchantPaymentId)).thenReturn(merchantPaymentId);
Mockito.when(api.getCodesPaymentDetailsWithHttpInfo(merchantPaymentId)).thenReturn(paymentDetailsApiResponse);
PaymentDetails response = api.getCodesPaymentDetails(merchantPaymentId);
Assert.assertEquals(response.getResultInfo().getMessage(), "SUCCESS");
}
use of jp.ne.paypay.model.PaymentDetails in project paypayopa-sdk-java by paypay.
the class PaymentApiTest method createPaymentAuthorizationTest.
/**
* Create a payment Authorization
*
* Create a direct debit payment and start the money transfer. **Timeout: 30s**
*
* @throws ApiException if the Api call fails
*/
@Test
public void createPaymentAuthorizationTest() throws ApiException {
PaymentDetails paymentDetails = new PaymentDetails();
paymentDetails.setResultInfo(resultInfo);
payment.setStatus(PaymentState.StatusEnum.AUTHORIZED);
payment.setAuthorizedAt(Instant.now().getNano());
payment.setPaymentId("paymentId");
paymentDetails.setData(payment);
String agreeSimilarTransaction = "True";
ApiResponse<PaymentDetails> paymentDetailsApiResponse = new ApiResponse<>(00001, null, paymentDetails);
Mockito.when(api.createPaymentAuthorizationWithHttpInfo(payment, agreeSimilarTransaction)).thenReturn(paymentDetailsApiResponse);
PaymentDetails response = api.createPaymentAuthorization(payment, agreeSimilarTransaction);
Assert.assertNotNull(response.toString());
Assert.assertEquals(response.getResultInfo().getMessage(), "SUCCESS");
Assert.assertEquals(response.getData().getMerchantPaymentId(), "merchantPaymentId");
Assert.assertEquals(response.getData().getUserAuthorizationId(), "userAuthorizationId");
Assert.assertEquals(response.getData().getPaymentId(), "paymentId");
Assert.assertEquals(response.getData().getStatus(), PaymentState.StatusEnum.AUTHORIZED);
Assert.assertNotNull(response.getData());
Assert.assertNotNull(response.getData().getTerminalId());
Assert.assertNotNull(response.getData().getOrderReceiptNumber());
Assert.assertNotNull(response.getData().getAmount());
Assert.assertNotNull(response.getData().getRequestedAt());
Assert.assertNotNull(response.getData().getOrderItems());
Assert.assertNotNull(response.getData().getAuthorizedAt());
}
use of jp.ne.paypay.model.PaymentDetails in project paypayopa-sdk-java by paypay.
the class PaymentApiTest method constraintViolationsTest.
@Test
@DisplayName("Constraint Violations Test")
public void constraintViolationsTest() throws ApiException {
payment.setMerchantPaymentId(null);
PaymentDetails paymentDetails = new PaymentDetails();
paymentDetails.setResultInfo(resultInfo);
payment.setStatus(PaymentState.StatusEnum.AUTHORIZED);
payment.setAuthorizedAt(Instant.now().getNano());
payment.setPaymentId("paymentId");
paymentDetails.setData(payment);
String agreeSimilarTransaction = "True";
ApiResponse<PaymentDetails> paymentDetailsApiResponse = new ApiResponse<>(00001, null, paymentDetails);
Mockito.when(api.createPaymentAuthorizationWithHttpInfo(payment, agreeSimilarTransaction)).thenReturn(paymentDetailsApiResponse);
Assert.assertThrows(IllegalArgumentException.class, () -> api.createPaymentAuthorization(payment, agreeSimilarTransaction));
}
use of jp.ne.paypay.model.PaymentDetails in project paypayopa-sdk-java by paypay.
the class PaymentApi method getCodesPaymentDetailsWithHttpInfo.
/**
* Get payment details
* Get payment details. **Timeout: 15s**
*
* @param merchantPaymentId (required)
* @return ApiResponse<PaymentDetails>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
protected ApiResponse<PaymentDetails> getCodesPaymentDetailsWithHttpInfo(String merchantPaymentId) throws ApiException {
Call call = getCodesPaymentDetailsValidateBeforeCall(merchantPaymentId);
Type localVarReturnType = new TypeToken<PaymentDetails>() {
}.getType();
return apiClient.execute(call, localVarReturnType, ApiNameConstants.GET_QR_PAYMENT);
}
Aggregations