Search in sources :

Example 1 with CashbackDetails

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

the class CashbackApi method getCashbackDetailsWithHttpInfo.

/**
 * Check Cashback Details
 * Check the cashback details of the cashback given  **Timeout: 15s**
 *
 * @param merchantCashbackId (required)
 * @return ApiResponse<CashbackDetails>
 * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
 */
protected ApiResponse<CashbackDetails> getCashbackDetailsWithHttpInfo(String merchantCashbackId) throws ApiException {
    Call call = ApiUtil.getCallObject(apiClient, "/v2/cashback/{merchantCashbackId}", new Pair(ApiConstants.MERCHANT_CASHBACK_ID, merchantCashbackId), "GET");
    Type localVarReturnType = new TypeToken<CashbackDetails>() {
    }.getType();
    return apiClient.execute(call, localVarReturnType, ApiNameConstants.GET_CASHBACK_DETAILS);
}
Also used : Call(com.squareup.okhttp.Call) Type(java.lang.reflect.Type) ReverseCashbackDetails(jp.ne.paypay.model.ReverseCashbackDetails) CashbackDetails(jp.ne.paypay.model.CashbackDetails) Pair(jp.ne.paypay.Pair)

Example 2 with CashbackDetails

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

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

the class CashbackApiExample 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("YOUR_MERCHANT_ID");
    String userAuthorizationId = "USER_AUTHORIZATION_ID";
    CashbackApi cashbackApi = new CashbackApi(apiClient);
    CashbackDetails cashbackDetails = giveCashback(cashbackApi, userAuthorizationId, 1);
    if (cashbackDetails != null && cashbackDetails.getData() != null) {
        reverseCashback(cashbackApi, cashbackDetails.getData().getMerchantCashbackId(), 1);
    }
}
Also used : Configuration(jp.ne.paypay.Configuration) CashbackApi(jp.ne.paypay.api.CashbackApi) CashbackDetails(jp.ne.paypay.model.CashbackDetails) ReverseCashbackDetails(jp.ne.paypay.model.ReverseCashbackDetails) ApiClient(jp.ne.paypay.ApiClient)

Example 4 with CashbackDetails

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

the class CashbackApi method createCashbackRequestWithHttpInfo.

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

Example 5 with CashbackDetails

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

the class CashbackApiTest method getCashbackDetailsTest.

/**
 * Check Cashback Details
 *
 * Check the cashback details of the cashback given
 *
 * @throws ApiException if the Api call fails
 */
@Test
public void getCashbackDetailsTest() throws ApiException {
    String merchantCashbackId = "merchantCashbackId";
    CashbackDetails cashbackDetails = new CashbackDetails();
    cashbackDetails.setResultInfo(resultInfo);
    cashback.setStatus("SUCCESS").setCashbackId("cashbackId");
    cashbackDetails.data(cashback);
    ApiResponse<CashbackDetails> cashbackDetailsApiResponse = new ApiResponse<>(00001, null, cashbackDetails);
    Mockito.when(apiClient.escapeString(merchantCashbackId)).thenReturn(merchantCashbackId);
    Mockito.when(api.getCashbackDetailsWithHttpInfo(merchantCashbackId)).thenReturn(cashbackDetailsApiResponse);
    CashbackDetails response = api.getCashbackDetails(merchantCashbackId);
    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)

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