Search in sources :

Example 6 with CashbackDetails

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

the class CashbackApiTest method createCashbackRequestTest.

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

Example 7 with CashbackDetails

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

the class CashbackApiExample method createCashbackRequest.

private static CashbackDetails createCashbackRequest(final CashbackApi apiInstance, Cashback cashback) {
    CashbackDetails result = null;
    try {
        result = apiInstance.createCashbackRequest(cashback);
        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)

Aggregations

CashbackDetails (jp.ne.paypay.model.CashbackDetails)7 ReverseCashbackDetails (jp.ne.paypay.model.ReverseCashbackDetails)7 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 ApiClient (jp.ne.paypay.ApiClient)1 Configuration (jp.ne.paypay.Configuration)1 Pair (jp.ne.paypay.Pair)1 CashbackApi (jp.ne.paypay.api.CashbackApi)1