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);
}
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;
}
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);
}
}
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<CashbackDetails>
* @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);
}
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");
}
Aggregations