Search in sources :

Example 6 with PaymentDetails

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

the class PaymentApi method createPaymentWithHttpInfo.

/**
 * Create a payment
 * Create a direct debit payment and start the money transfer.  **Timeout: 30s**
 *
 * @param body                    Payment (optional)
 * @param agreeSimilarTransaction (Optional) If the parameter is set to \"true\", the payment duplication check will be bypassed.  (optional)
 * @return ApiResponse<PaymentDetails>
 * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
 */
protected ApiResponse<PaymentDetails> createPaymentWithHttpInfo(Object body, String agreeSimilarTransaction) throws ApiException {
    Call call = createPaymentValidateBeforeCall(body, agreeSimilarTransaction);
    Type localVarReturnType = new TypeToken<PaymentDetails>() {
    }.getType();
    return apiClient.execute(call, localVarReturnType, ApiNameConstants.CREATE_PAYMENT);
}
Also used : Call(com.squareup.okhttp.Call) Type(java.lang.reflect.Type) PaymentDetails(jp.ne.paypay.model.PaymentDetails)

Example 7 with PaymentDetails

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

the class PaymentApi method capturePaymentAuthWithHttpInfo.

/**
 * Capture a payment authorization
 * This api is used to capture the payment authorization for a payment  **Timeout: 30s**
 *
 * @param body (optional)
 * @return ApiResponse&lt;PaymentDetails&gt;
 * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
 */
protected ApiResponse<PaymentDetails> capturePaymentAuthWithHttpInfo(Object body) throws ApiException {
    Call call = capturePaymentAuthCall(body);
    Type localVarReturnType = new TypeToken<PaymentDetails>() {
    }.getType();
    return apiClient.execute(call, localVarReturnType, ApiNameConstants.CAPTURE_PAYMENT);
}
Also used : Call(com.squareup.okhttp.Call) Type(java.lang.reflect.Type) PaymentDetails(jp.ne.paypay.model.PaymentDetails)

Example 8 with PaymentDetails

use of jp.ne.paypay.model.PaymentDetails 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 9 with PaymentDetails

use of jp.ne.paypay.model.PaymentDetails 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 10 with PaymentDetails

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

the class PendingPaymentApiExample method main.

public static void main(String[] args) throws ApiException {
    ApiClient apiClient = new Configuration().getDefaultApiClient();
    apiClient.setProductionMode(false);
    apiClient.setApiKey("API_KEY");
    apiClient.setApiSecretKey("API_SECRET_KEY");
    apiClient.setAssumeMerchant("ASSUME_MERCHANT_ID");
    String userAuthorizationId = "USER_AUTHORIZATION_ID";
    PendingPaymentApi pendingPaymentApi = new PendingPaymentApi(apiClient);
    PaymentApi paymentApi = new PaymentApi(apiClient);
    PaymentDetails paymentDetails = pendingPayment(pendingPaymentApi, userAuthorizationId, 2);
    if (paymentDetails != null && paymentDetails.getData() != null) {
        String merchantPaymentId = paymentDetails.getData().getMerchantPaymentId();
        getPendingPaymentDetails(pendingPaymentApi, merchantPaymentId);
        // Cancel Pending Order
        cancelPendingPayment(pendingPaymentApi, merchantPaymentId);
        // Refund payment. Run this after payment is complete
        refundPendingPayment(paymentApi, pendingPaymentApi, paymentDetails.getData().getPaymentId());
    }
}
Also used : PendingPaymentApi(jp.ne.paypay.api.PendingPaymentApi) PaymentApi(jp.ne.paypay.api.PaymentApi) Configuration(jp.ne.paypay.Configuration) PaymentDetails(jp.ne.paypay.model.PaymentDetails) ApiClient(jp.ne.paypay.ApiClient) PendingPaymentApi(jp.ne.paypay.api.PendingPaymentApi)

Aggregations

PaymentDetails (jp.ne.paypay.model.PaymentDetails)29 ApiResponse (jp.ne.paypay.ApiResponse)9 Test (org.junit.jupiter.api.Test)9 Call (com.squareup.okhttp.Call)8 Type (java.lang.reflect.Type)8 ApiException (jp.ne.paypay.ApiException)7 Payment (jp.ne.paypay.model.Payment)5 MoneyAmount (jp.ne.paypay.model.MoneyAmount)4 WalletBalance (jp.ne.paypay.model.WalletBalance)4 CaptureObject (jp.ne.paypay.model.CaptureObject)2 ArrayList (java.util.ArrayList)1 ApiClient (jp.ne.paypay.ApiClient)1 Configuration (jp.ne.paypay.Configuration)1 PaymentApi (jp.ne.paypay.api.PaymentApi)1 PendingPaymentApi (jp.ne.paypay.api.PendingPaymentApi)1 Capture (jp.ne.paypay.model.Capture)1 MerchantOrderItem (jp.ne.paypay.model.MerchantOrderItem)1 PaymentStateCaptures (jp.ne.paypay.model.PaymentStateCaptures)1 QRCodeDetails (jp.ne.paypay.model.QRCodeDetails)1 DisplayName (org.junit.jupiter.api.DisplayName)1