Search in sources :

Example 1 with ApiException

use of jp.ne.paypay.ApiException in project paypayopa-sdk-java by paypay.

the class CashbackApiExample method getCashbackDetails.

private static CashbackDetails getCashbackDetails(final CashbackApi apiInstance, String merchantCashbackId) {
    CashbackDetails result = null;
    try {
        result = apiInstance.getCashbackDetails(merchantCashbackId);
        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;
}
Also used : CashbackDetails(jp.ne.paypay.model.CashbackDetails) ReverseCashbackDetails(jp.ne.paypay.model.ReverseCashbackDetails) ApiException(jp.ne.paypay.ApiException)

Example 2 with ApiException

use of jp.ne.paypay.ApiException in project paypayopa-sdk-java by paypay.

the class PaymentApiExample method capturePayment.

private static void capturePayment(final PaymentApi apiInstance, String merchantPaymentId, int amount) {
    try {
        CaptureObject captureObject = new CaptureObject();
        captureObject.setMerchantCaptureId(UUID.randomUUID().toString());
        captureObject.setMerchantPaymentId(merchantPaymentId);
        captureObject.setAmount(new MoneyAmount().amount(amount).currency(MoneyAmount.CurrencyEnum.JPY));
        captureObject.setOrderDescription("new Order");
        PaymentDetails paymentDetails = apiInstance.capturePaymentAuth(captureObject);
        System.out.println(paymentDetails);
    } catch (ApiException e) {
        e.printStackTrace();
        System.out.println(e.getResponseBody());
    }
}
Also used : CaptureObject(jp.ne.paypay.model.CaptureObject) MoneyAmount(jp.ne.paypay.model.MoneyAmount) PaymentDetails(jp.ne.paypay.model.PaymentDetails) ApiException(jp.ne.paypay.ApiException)

Example 3 with ApiException

use of jp.ne.paypay.ApiException in project paypayopa-sdk-java by paypay.

the class PaymentApiExample method createContinuousPayment.

private static PaymentDetails createContinuousPayment(final PaymentApi apiInstance, Payment payment) {
    PaymentDetails result = null;
    try {
        result = apiInstance.createContinuousPayment(payment);
        System.out.println("\nAPI RESPONSE\n------------------\n");
        System.out.println(result.getResultInfo().getCode());
    } catch (ApiException e) {
        System.err.println(e.getResponseBody());
    }
    return result;
}
Also used : PaymentDetails(jp.ne.paypay.model.PaymentDetails) ApiException(jp.ne.paypay.ApiException)

Example 4 with ApiException

use of jp.ne.paypay.ApiException 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());
    }
}
Also used : Refund(jp.ne.paypay.model.Refund) RefundDetails(jp.ne.paypay.model.RefundDetails) ApiException(jp.ne.paypay.ApiException)

Example 5 with ApiException

use of jp.ne.paypay.ApiException in project paypayopa-sdk-java by paypay.

the class PaymentApiExample method getRefundDetails.

protected static void getRefundDetails(final PaymentApi apiInstance, final String merchantRefundId) {
    try {
        RefundDetails result = apiInstance.getRefundDetails(merchantRefundId);
        System.out.println("\nAPI RESPONSE\n------------------\n");
        System.out.println(result);
    } catch (ApiException e) {
        System.err.println(e.getResponseBody());
    }
}
Also used : RefundDetails(jp.ne.paypay.model.RefundDetails) ApiException(jp.ne.paypay.ApiException)

Aggregations

ApiException (jp.ne.paypay.ApiException)23 PaymentDetails (jp.ne.paypay.model.PaymentDetails)7 NotDataResponse (jp.ne.paypay.model.NotDataResponse)4 ReverseCashbackDetails (jp.ne.paypay.model.ReverseCashbackDetails)4 RefundDetails (jp.ne.paypay.model.RefundDetails)3 AccountLinkQRCode (jp.ne.paypay.model.AccountLinkQRCode)2 CashbackDetails (jp.ne.paypay.model.CashbackDetails)2 MoneyAmount (jp.ne.paypay.model.MoneyAmount)2 QRCodeDetails (jp.ne.paypay.model.QRCodeDetails)2 Refund (jp.ne.paypay.model.Refund)2 Test (org.junit.jupiter.api.Test)2 TypeToken (com.google.gson.reflect.TypeToken)1 MediaType (com.squareup.okhttp.MediaType)1 Request (com.squareup.okhttp.Request)1 RequestBody (com.squareup.okhttp.RequestBody)1 Response (com.squareup.okhttp.Response)1 File (java.io.File)1 Type (java.lang.reflect.Type)1 ArrayList (java.util.ArrayList)1 ApiResponse (jp.ne.paypay.ApiResponse)1