Search in sources :

Example 21 with PaymentDetails

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

the class PaymentApiExample method appInvokeFlow.

private static void appInvokeFlow(final PaymentApi paymentApi, final WalletApi walletApiInstance, final String userAuthorizationId) {
    int amount = 1;
    QRCodeDetails qrCodeDetails = createQRCode(paymentApi, amount);
    String merchantPaymentId = qrCodeDetails != null ? qrCodeDetails.getData().getMerchantPaymentId() : null;
    WalletBalance walletBalance = getWalletBalance(walletApiInstance, userAuthorizationId);
    if (merchantPaymentId != null && walletBalance != null && walletBalance.getData().isHasEnoughBalance()) {
        System.out.println("The QR Code can be used as a deeplink to invoke PayPay app and receive Payments. The user " + "can makes the payment using PayPay App");
        System.out.println("For this example, we will create payment using the API...");
        Payment payment = getPaymentObject(merchantPaymentId, userAuthorizationId, amount);
        PaymentDetails paymentDetails = createPayment(paymentApi, payment, false);
        if (paymentDetails != null) {
            System.out.println("Payment created successfully, Now calling the API to get payment details for payment " + "ID:" + merchantPaymentId);
            String refundId = UUID.randomUUID().toString();
            paymentDetails = getPaymentDetails(paymentApi, merchantPaymentId);
            if (paymentDetails != null) {
                System.out.println("Creating Refund for the payment:" + paymentDetails.getData().getPaymentId());
                createRefund(paymentApi, paymentDetails.getData().getPaymentId(), refundId);
                System.out.println("Get refund details:" + refundId);
                getRefundDetails(paymentApi, refundId);
                System.out.println("Finally cancel the payment");
                cancelPayment(paymentApi, merchantPaymentId);
            }
        }
    }
    if (qrCodeDetails != null) {
        System.out.println("Delete the QR Code: " + qrCodeDetails.getData().getCodeId());
        deleteQrCode(paymentApi, qrCodeDetails.getData().getCodeId());
    }
}
Also used : Payment(jp.ne.paypay.model.Payment) WalletBalance(jp.ne.paypay.model.WalletBalance) QRCodeDetails(jp.ne.paypay.model.QRCodeDetails) PaymentDetails(jp.ne.paypay.model.PaymentDetails)

Example 22 with PaymentDetails

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

the class PaymentApi method createPaymentAuthorizationWithHttpInfo.

/**
 * Create a payment authorization
 * Create a payment authorization to block the money.  **Timeout: 30s**
 *
 * @param body                    Payment
 * @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> createPaymentAuthorizationWithHttpInfo(Object body, String agreeSimilarTransaction) throws ApiException {
    Call call = ApiUtil.postCallObject(apiClient, "/v2/payments/preauthorize", body, agreeSimilarTransaction);
    Type localVarReturnType = new TypeToken<PaymentDetails>() {
    }.getType();
    return apiClient.execute(call, localVarReturnType, ApiNameConstants.PREAUTHORIZE_PAYMENT);
}
Also used : Call(com.squareup.okhttp.Call) Type(java.lang.reflect.Type) PaymentDetails(jp.ne.paypay.model.PaymentDetails)

Example 23 with PaymentDetails

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

the class PaymentApi method getPaymentDetailsWithHttpInfo.

/**
 * Get payment details
 * Get payment details.  **Timeout: 15s**
 *
 * @param merchantPaymentId (required)
 * @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> getPaymentDetailsWithHttpInfo(String merchantPaymentId) throws ApiException {
    Call call = getPaymentDetailsValidateBeforeCall(merchantPaymentId);
    Type localVarReturnType = new TypeToken<PaymentDetails>() {
    }.getType();
    return apiClient.execute(call, localVarReturnType, ApiNameConstants.GET_PAYMENT);
}
Also used : Call(com.squareup.okhttp.Call) Type(java.lang.reflect.Type) PaymentDetails(jp.ne.paypay.model.PaymentDetails)

Example 24 with PaymentDetails

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

the class PaymentApi method createContinuousPaymentWithHttpInfo.

/**
 * Create a continuous payment
 * Create a continuous payment and start the money transfer.  **Timeout: 30s**
 *
 * @param body                    Payment
 * @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> createContinuousPaymentWithHttpInfo(Object body) throws ApiException {
    Call call = createContinuousPaymentCall(body);
    Type localVarReturnType = new TypeToken<PaymentDetails>() {
    }.getType();
    return apiClient.execute(call, localVarReturnType, ApiNameConstants.CREATE_CONTINUOUS_PAYMENT);
}
Also used : Call(com.squareup.okhttp.Call) Type(java.lang.reflect.Type) PaymentDetails(jp.ne.paypay.model.PaymentDetails)

Example 25 with PaymentDetails

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

the class PendingPaymentApi method getPendingPaymentDetailsWithHttpInfo.

/**
 * Get payment details for pending payments
 * Get payment details for pending payments.  **Timeout: 15s**
 *
 * @param merchantPaymentId (required)
 * @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> getPendingPaymentDetailsWithHttpInfo(String merchantPaymentId) throws ApiException {
    Call call = getPaymentDetailsValidateBeforeCall(merchantPaymentId);
    Type localVarReturnType = new TypeToken<PaymentDetails>() {
    }.getType();
    return apiClient.execute(call, localVarReturnType, ApiNameConstants.GET_REQUEST_ORDER);
}
Also used : Call(com.squareup.okhttp.Call) Type(java.lang.reflect.Type) PaymentDetails(jp.ne.paypay.model.PaymentDetails)

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