use of jp.ne.paypay.Pair in project paypayopa-sdk-java by paypay.
the class HmacAuthTest method hmacAuthTest.
@Test
public void hmacAuthTest() {
HmacAuth hmacAuth = new HmacAuth();
hmacAuth.setApiKey("API_KEY");
hmacAuth.setApiSecretKey("SECRET_KEY");
hmacAuth.setContentType("Application/Json");
hmacAuth.setHttpMethod("POST");
hmacAuth.setRequestUrl("/v2/api/test");
QRCode qrCode = new QRCode();
qrCode.setMerchantPaymentId(UUID.randomUUID().toString());
hmacAuth.setRequestBody(qrCode.toString());
Map<String, String> headerParams = new HashMap<>();
List<Pair> queryParams = new ArrayList<>();
hmacAuth.applyToParams(queryParams, headerParams);
Assert.assertTrue(headerParams.get("Authorization").startsWith("hmac"));
Assert.assertNotNull(hmacAuth.getApiKey());
Assert.assertNotNull(hmacAuth.getApiSecretKey());
Assert.assertNotNull(hmacAuth.getContentType());
Assert.assertNotNull(hmacAuth.getHttpMethod());
Assert.assertNotNull(hmacAuth.getRequestBody());
Assert.assertNotNull(hmacAuth.getRequestUrl());
hmacAuth.setRequestUrl("/v2/api/test?param=p1");
hmacAuth.applyToParams(queryParams, headerParams);
Assert.assertTrue(headerParams.get("Authorization").startsWith("hmac"));
hmacAuth.setRequestUrl(null);
hmacAuth.applyToParams(queryParams, headerParams);
Assert.assertTrue(headerParams.get("Authorization").startsWith("hmac"));
hmacAuth.setContentType(null);
headerParams = new HashMap<>();
hmacAuth.applyToParams(queryParams, headerParams);
Assert.assertNull(headerParams.get("Authorization"));
}
use of jp.ne.paypay.Pair 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.Pair in project paypayopa-sdk-java by paypay.
the class ApiClientTest method buildRequest.
@Test
public void buildRequest() throws ApiException {
List<Pair> queryParams = new ArrayList<>();
queryParams.add(new Pair("name", "paypay"));
QRCode qrCode = new QRCode();
qrCode.setMerchantPaymentId("maerchant_payemnt_id");
Map<String, String> headerParams = new HashMap<>();
headerParams.put("content-type", "application/json");
String[] localVarAuthNames = new String[] { "HmacAuth" };
Request request = apiClient.buildRequest("/v2/qrcode", "POST", queryParams, queryParams, qrCode, headerParams, null, localVarAuthNames);
Assert.assertEquals(request.method(), "POST");
Assert.assertTrue(request.urlString().contains("/v2/qrcode"));
request = apiClient.buildRequest("/v2/qrcode", "POST", queryParams, queryParams, null, headerParams, null, localVarAuthNames);
Assert.assertNotNull(request.body());
request = apiClient.buildRequest("/v2/qrcode", "DELETE", queryParams, queryParams, null, headerParams, null, localVarAuthNames);
Assert.assertNull(request.body());
}
use of jp.ne.paypay.Pair 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<ReverseCashbackDetails>
* @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);
}
Aggregations