use of jp.ne.paypay.model.ProductType in project paypayopa-sdk-java by paypay.
the class WalletApiTest method checkWalletBalanceTest.
/**
* Check user wallet balance
*
* Check if user has enough balance to make a payment **Timeout: 15s**
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void checkWalletBalanceTest() throws ApiException {
String userAuthorizationId = "user-authorization-id";
Integer amount = 10;
String currency = "JPY";
ProductType productType = null;
WalletBalance walletBalance = new WalletBalance();
Assert.assertNotNull(api.getApiClient());
walletBalance.setResultInfo(resultInfo);
BalanceData balanceData = new BalanceData();
balanceData.setHasEnoughBalance(true);
walletBalance.setData(balanceData);
ApiResponse<WalletBalance> walletBalanceApiResponse = new ApiResponse<>(00001, null, walletBalance);
Mockito.when(api.checkWalletBalanceWithHttpInfo(userAuthorizationId, amount, currency, productType)).thenReturn(walletBalanceApiResponse);
WalletBalance response = api.checkWalletBalance(userAuthorizationId, amount, currency, productType);
Assert.assertEquals(response.getResultInfo().getMessage(), "SUCCESS");
}
use of jp.ne.paypay.model.ProductType in project paypayopa-sdk-java by paypay.
the class WalletApiTest method checkWalletBalanceInvalidParamsTest.
@Test
@DisplayName("Wallet Balance API for invalid params test")
public void checkWalletBalanceInvalidParamsTest() throws ApiException {
String userAuthorizationId = "user-authorization-id";
Integer amount = 10;
String currency = "JPY";
ProductType productType = null;
WalletBalance walletBalance = new WalletBalance();
Assert.assertNotNull(api.getApiClient());
walletBalance.setResultInfo(resultInfo);
Assert.assertThrows(ApiException.class, () -> api.checkWalletBalance(null, amount, currency, productType));
Assert.assertThrows(ApiException.class, () -> api.checkWalletBalance(userAuthorizationId, null, currency, productType));
Assert.assertThrows(ApiException.class, () -> api.checkWalletBalance(userAuthorizationId, amount, null, productType));
}
use of jp.ne.paypay.model.ProductType in project paypayopa-sdk-java by paypay.
the class WalletApi method checkWalletBalanceWithHttpInfo.
/**
* Check user wallet balance
* Check if user has enough balance to make a payment **Timeout: 15s**
* @param userAuthorizationId (required)
* @param amount (required)
* @param currency (required)
* @param productType (optional)
* @return ApiResponse<WalletBalance>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
protected ApiResponse<WalletBalance> checkWalletBalanceWithHttpInfo(String userAuthorizationId, Integer amount, String currency, ProductType productType) throws ApiException {
Call call = checkWalletBalanceValidateBeforeCall(userAuthorizationId, amount, currency, productType);
Type localVarReturnType = new TypeToken<WalletBalance>() {
}.getType();
return apiClient.execute(call, localVarReturnType, ApiNameConstants.CHECK_BALANCE);
}
Aggregations