use of jp.ne.paypay.model.Refund in project paypayopa-sdk-java by paypay.
the class PendingPaymentApiTest method refundPaymentTest.
/**
* Refund a payment
*
* Refund a payment. **Timeout: 30s**
*
* @throws ApiException if the Api call fails
*/
@Test
public void refundPaymentTest() throws ApiException {
Refund refund = new Refund();
refund.setAmount(new MoneyAmount().amount(1).currency(MoneyAmount.CurrencyEnum.JPY));
refund.setMerchantRefundId("refundId");
refund.setPaymentId("paymentId");
refund.setReason("Testing");
refund.setRequestedAt(Instant.now().getEpochSecond());
RefundDetails refundDetails = new RefundDetails();
refundDetails.setResultInfo(resultInfo);
refund.setStatus(RefundState.StatusEnum.CREATED);
refundDetails.setData(refund);
ApiResponse<RefundDetails> paymentDetailsApiResponse = new ApiResponse<>(00001, null, refundDetails);
Mockito.when(paymentApi.refundPaymentWithHttpInfo(refund)).thenReturn(paymentDetailsApiResponse);
Assert.assertNotNull(refund.toString());
RefundDetails response = api.refundPayment(refund);
Assert.assertNotNull(response.toString());
Assert.assertEquals(response.getResultInfo().getMessage(), "SUCCESS");
}
use of jp.ne.paypay.model.Refund in project paypayopa-sdk-java by paypay.
the class PaymentApiExample method createRefund.
private static void createRefund(final PaymentApi apiInstance, String paymentId, String refundId) {
try {
Refund refund = getRefundObject(paymentId, refundId);
RefundDetails result = apiInstance.refundPayment(refund);
System.out.println("\nAPI RESPONSE\n------------------\n");
System.out.println(result);
} catch (ApiException e) {
System.err.println(e.getResponseBody());
}
}
use of jp.ne.paypay.model.Refund in project paypayopa-sdk-java by paypay.
the class PaymentApiExample method getRefundObject.
protected static Refund getRefundObject(String paymentId, String refundId) {
Refund refund = new Refund();
refund.setAmount(new MoneyAmount().amount(1).currency(MoneyAmount.CurrencyEnum.JPY));
refund.setMerchantRefundId(refundId);
refund.setPaymentId(paymentId);
refund.setReason("Testing");
return refund;
}
use of jp.ne.paypay.model.Refund in project paypayopa-sdk-java by paypay.
the class PaymentApiTest method refundPaymentTest.
/**
* Refund a payment
*
* Refund a payment. **Timeout: 30s**
*
* @throws ApiException if the Api call fails
*/
@Test
public void refundPaymentTest() throws ApiException {
Refund refund = new Refund();
refund.setAmount(new MoneyAmount().amount(1).currency(MoneyAmount.CurrencyEnum.JPY));
refund.setMerchantRefundId("refundId");
refund.setPaymentId("paymentId");
refund.setReason("Testing");
refund.setRequestedAt(Instant.now().getEpochSecond());
RefundDetails refundDetails = new RefundDetails();
refundDetails.setResultInfo(resultInfo);
refund.setStatus(RefundState.StatusEnum.CREATED);
refundDetails.setData(refund);
ApiResponse<RefundDetails> paymentDetailsApiResponse = new ApiResponse<>(00001, null, refundDetails);
Mockito.when(api.refundPaymentWithHttpInfo(refund)).thenReturn(paymentDetailsApiResponse);
Assert.assertNotNull(refund.toString());
RefundDetails response = api.refundPayment(refund);
Assert.assertNotNull(response.toString());
Assert.assertEquals(response.getResultInfo().getMessage(), "SUCCESS");
}
use of jp.ne.paypay.model.Refund in project paypayopa-sdk-java by paypay.
the class PendingPaymentApiExample method refundPendingPayment.
private static RefundDetails refundPendingPayment(final PendingPaymentApi apiInstance, String paymentId, String refundId) {
RefundDetails result = null;
try {
Refund refund = getRefundObject(paymentId, refundId);
result = apiInstance.refundPayment(refund);
System.out.println("\nAPI RESPONSE\n------------------\n");
System.out.println(result.getResultInfo().getCode());
System.out.println(result);
} catch (ApiException e) {
System.err.println(e.getResponseBody());
}
return result;
}
Aggregations