use of jp.ne.paypay.model.RevertAuthResponseData in project paypayopa-sdk-java by paypay.
the class PaymentApiTest method revertAuthTest.
/**
* Revert a payment authorization
*
* Revert a payment authorization. **Timeout: 30s**
*
* @throws ApiException if the Api call fails
*/
@Test
public void revertAuthTest() throws ApiException {
PaymentStateRevert paymentStateRevert = new PaymentStateRevert();
paymentStateRevert.setPaymentId(UUID.randomUUID().toString());
paymentStateRevert.setMerchantRevertId(UUID.randomUUID().toString());
paymentStateRevert.setRequestedAt(Instant.now().getEpochSecond());
RevertAuthResponse revertAuthResponse = new RevertAuthResponse();
revertAuthResponse.setResultInfo(resultInfo);
RevertAuthResponseData revertAuthResponseData = new RevertAuthResponseData();
revertAuthResponseData.setPaymentId(paymentStateRevert.getPaymentId());
revertAuthResponseData.setAcceptedAt(Instant.now().getNano());
revertAuthResponseData.setRequestedAt(Instant.now().getEpochSecond());
revertAuthResponseData.setReason("Order Cancelled");
revertAuthResponseData.setStatus(RevertAuthResponseData.StatusEnum.CANCELED);
revertAuthResponse.setData(revertAuthResponseData);
ApiResponse<RevertAuthResponse> revertAuthResponseApiResponse = new ApiResponse<>(00001, null, revertAuthResponse);
Mockito.when(api.revertAuthWithHttpInfo(paymentStateRevert)).thenReturn(revertAuthResponseApiResponse);
Assert.assertNotNull(paymentStateRevert.toString());
RevertAuthResponse response = api.revertAuth(paymentStateRevert);
Assert.assertNotNull(response.toString());
Assert.assertEquals(response.getResultInfo().getMessage(), "SUCCESS");
Assert.assertNotNull(response.getData());
Assert.assertNotNull(response.getData().getAcceptedAt());
Assert.assertNotNull(response.getData().getRequestedAt());
Assert.assertEquals(response.getData().getReason(), "Order Cancelled");
Assert.assertEquals(response.getData().getStatus(), RevertAuthResponseData.StatusEnum.CANCELED);
}
Aggregations