Search in sources :

Example 1 with ReverseCashbackDetails

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

the class CashbackApiTest method getReversedCashbackDetailsTest.

/**
 * Check Reversed Cashback Details
 *
 * Check the reversed cashback details of the cashback given
 *
 * @throws ApiException if the Api call fails
 */
@Test
public void getReversedCashbackDetailsTest() throws ApiException {
    String merchantCashbackId = "merchantCashbackId";
    String merchantCashbackReversalId = "merchantCashbackReversalId";
    ReverseCashbackDetails reverseCashbackDetails = new ReverseCashbackDetails();
    reverseCashbackDetails.setResultInfo(resultInfo);
    reverseCashback.setStatus("SUCCESS");
    reverseCashbackDetails.data(reverseCashback);
    ApiResponse<ReverseCashbackDetails> reverseCashbackDetailsApiResponse = new ApiResponse<>(00001, null, reverseCashbackDetails);
    Mockito.when(apiClient.escapeString(merchantCashbackId)).thenReturn(merchantCashbackId);
    Mockito.when(apiClient.escapeString(merchantCashbackReversalId)).thenReturn(merchantCashbackReversalId);
    Mockito.when(api.getReversedCashbackDetailsWithHttpInfo(merchantCashbackReversalId, merchantCashbackId)).thenReturn(reverseCashbackDetailsApiResponse);
    ReverseCashbackDetails response = api.getReversedCashbackDetails(merchantCashbackReversalId, merchantCashbackId);
    Assert.assertEquals(response.getResultInfo().getMessage(), "SUCCESS");
}
Also used : ReverseCashbackDetails(jp.ne.paypay.model.ReverseCashbackDetails) ApiResponse(jp.ne.paypay.ApiResponse) Test(org.junit.jupiter.api.Test)

Example 2 with ReverseCashbackDetails

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

the class CashbackApi method createReverseCashbackRequestWithHttpInfo.

/**
 * Reverse a given cashback
 * Transfer money back from user wallet to merchants campaign wallet.  **Timeout: 30s**
 *
 * @param reverseCashback ReverseCashback
 * @return ApiResponse&lt;ReverseCashbackDetails&gt;
 * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
 */
protected ApiResponse<ReverseCashbackDetails> createReverseCashbackRequestWithHttpInfo(ReverseCashback reverseCashback) throws ApiException {
    Call call = ApiUtil.postCallObject(apiClient, "/v2/cashback_reversal", reverseCashback, null);
    Type localVarReturnType = new TypeToken<ReverseCashbackDetails>() {
    }.getType();
    return apiClient.execute(call, localVarReturnType, ApiNameConstants.CREATE_REVERSE_CASHBACK_REQUEST);
}
Also used : Call(com.squareup.okhttp.Call) Type(java.lang.reflect.Type) ReverseCashbackDetails(jp.ne.paypay.model.ReverseCashbackDetails)

Example 3 with ReverseCashbackDetails

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

the class CashbackApi method getReversedCashbackDetailsWithHttpInfo.

/**
 * Check Cashback Reversal Details
 * Check the cashback reversal details of the cashback reversed  **Timeout: 15s**
 *
 * @param merchantCashbackReversalId (required)
 * @param merchantCashbackId (required)
 * @return ApiResponse&lt;ReverseCashbackDetails&gt;
 * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
 */
protected ApiResponse<ReverseCashbackDetails> getReversedCashbackDetailsWithHttpInfo(String merchantCashbackReversalId, String merchantCashbackId) throws ApiException {
    if (StringUtils.isEmpty(merchantCashbackReversalId)) {
        throw new IllegalArgumentException("Missing the required parameter merchantCashbackReversalId");
    }
    Call call = ApiUtil.getCallObject(apiClient, "/v2/cashback_reversal/" + apiClient.escapeString(merchantCashbackReversalId) + "/{merchantCashbackId}", new Pair(ApiConstants.MERCHANT_CASHBACK_ID, merchantCashbackId), "GET");
    Type localVarReturnType = new TypeToken<ReverseCashbackDetails>() {
    }.getType();
    return apiClient.execute(call, localVarReturnType, ApiNameConstants.GET_REVERSED_CASHBACK_DETAILS);
}
Also used : Call(com.squareup.okhttp.Call) Type(java.lang.reflect.Type) ReverseCashbackDetails(jp.ne.paypay.model.ReverseCashbackDetails) Pair(jp.ne.paypay.Pair)

Example 4 with ReverseCashbackDetails

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

the class CashbackApiTest method reverseCashbackTest.

/**
 * Create reverse cashback request
 *
 * Transfer money back from user wallet to merchants campaign wallet
 *
 * @throws ApiException if the Api call fails
 */
@Test
public void reverseCashbackTest() throws ApiException {
    ReverseCashbackDetails reverseCashbackDetails = new ReverseCashbackDetails();
    reverseCashbackDetails.resultInfo(resultInfo);
    reverseCashback.setStatus("REQUEST_ACCEPTED");
    reverseCashbackDetails.data(reverseCashback);
    Assert.assertNotNull(reverseCashback.toString());
    ApiResponse<ReverseCashbackDetails> cashbackDetailsApiResponse = new ApiResponse<>(8100001, null, reverseCashbackDetails);
    Mockito.when(api.createReverseCashbackRequestWithHttpInfo(reverseCashback)).thenReturn(cashbackDetailsApiResponse);
    ReverseCashbackDetails response = api.createReverseCashbackRequest(reverseCashback);
    Assert.assertEquals(response.getResultInfo().getMessage(), "SUCCESS");
}
Also used : ReverseCashbackDetails(jp.ne.paypay.model.ReverseCashbackDetails) ApiResponse(jp.ne.paypay.ApiResponse) Test(org.junit.jupiter.api.Test)

Example 5 with ReverseCashbackDetails

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

the class CashbackApiExample method createReverseCashbackRequest.

private static ReverseCashbackDetails createReverseCashbackRequest(final CashbackApi apiInstance, ReverseCashback reverseCashback) {
    ReverseCashbackDetails result = null;
    try {
        result = apiInstance.createReverseCashbackRequest(reverseCashback);
        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 : ReverseCashbackDetails(jp.ne.paypay.model.ReverseCashbackDetails) ApiException(jp.ne.paypay.ApiException)

Aggregations

ReverseCashbackDetails (jp.ne.paypay.model.ReverseCashbackDetails)6 Call (com.squareup.okhttp.Call)2 Type (java.lang.reflect.Type)2 ApiException (jp.ne.paypay.ApiException)2 ApiResponse (jp.ne.paypay.ApiResponse)2 Test (org.junit.jupiter.api.Test)2 Pair (jp.ne.paypay.Pair)1