diff --git a/README.md b/README.md
index 5e8c719..e858b1e 100644
--- a/README.md
+++ b/README.md
@@ -85,6 +85,7 @@ Title | Method | HTTP request | Description
*PaymentApi* | [**getRefundDetails**](docs/PendingPaymentApi.md#getRefundDetails) | **GET** /v2/refunds/{merchantRefundId} | Get refund details (Pending Payment)
*PaymentApi* | [**refundPayment**](docs/PendingPaymentApi.md#refundPayment) | **POST** /v1/requestOrder/refunds | Refund a payment (Pending Payment)
*WalletApi* | [**checkWalletBalance**](docs/WalletApi.md#checkWalletBalance) | **GET** /v2/wallet/check_balance | Check user wallet balance
+*WalletApi* | [**getWalletBalance**](docs/WalletApi.md#getWalletBalance) | **GET** /v6/wallet/balance | Get user wallet balance along with preference
*UserApi* | [**getMaskedUserProfile**](docs/UserApi.md#getMaskedUserProfile) | **GET** /v2/user/profile/secure?userAuthorizationId={userAuthorizationId} | Get masked user profile
*UserApi* | [**getUserAuthorizationStatus**](docs/UserApi.md#getUserAuthorizationStatus) | **GET** /v2/user/authorizations?userAuthorizationId={userAuthorizationId} | Get user authorization status
*UserApi* | [**unlinkUser**](docs/UserApi.md#unlinkUser) | **DELETE** /v2/user/authorizations/{userAuthorizationId} | Unlink user
@@ -127,6 +128,9 @@ Title | Method | HTTP request | Description
- [ReverseCashback](docs/ReverseCashback.md)
- [CashbackDetails](docs/CashbackDetails.md)
- [ReverseCashbackDetails](docs/ReverseCashbackDetails.md)
+ - [GetWalletBalance](docs/GetWalletBalance.md)
+ - [Preference](docs/Preference.md)
+ - [GetBalanceData](docs/GetBalanceData.md)
diff --git a/docs/GetBalanceData.md b/docs/GetBalanceData.md
new file mode 100644
index 0000000..24069d7
--- /dev/null
+++ b/docs/GetBalanceData.md
@@ -0,0 +1,13 @@
+
+# GetBalanceData
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**userAuthorizationId** | **String** | user authentication id | Required
+**totalBalance** | [**MoneyAmount**](MoneyAmount.md) | | Required
+**preference** | [**Preference**](Preference.md) | | Required
+
+
+
+
diff --git a/docs/GetWalletBalance.md b/docs/GetWalletBalance.md
new file mode 100644
index 0000000..6e4a4e2
--- /dev/null
+++ b/docs/GetWalletBalance.md
@@ -0,0 +1,12 @@
+
+# GetWalletBalance
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**resultInfo** | [**ResultInfo**](ResultInfo.md) | | [optional]
+**data** | [**GetBalanceData**](GetBalanceData.md) | | [optional]
+
+
+
+
diff --git a/docs/Preference.md b/docs/Preference.md
new file mode 100644
index 0000000..63b97aa
--- /dev/null
+++ b/docs/Preference.md
@@ -0,0 +1,11 @@
+
+# Preference
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**useCashback** | **Boolean** | use cashback amount for transaction | Required
+**cashbackAutoInvestment** | **String** | use cashback for investment | Required
+
+
+
diff --git a/docs/WalletApi.md b/docs/WalletApi.md
index f8a85c7..4491424 100644
--- a/docs/WalletApi.md
+++ b/docs/WalletApi.md
@@ -4,7 +4,7 @@
Method | HTTP request | Description
------------- | ------------- | -------------
[**checkWalletBalance**](WalletApi.md#checkWalletBalance) | **GET** /v2/wallet/check_balance | Check user wallet balance
-
+[**getWalletBalance**](WalletApi.md#getWalletBalance) | **GET** /v6/wallet/balance | Get user wallet balance
@@ -49,3 +49,45 @@ try {
Please refer to the below document for more information :
https://www.paypay.ne.jp/opa/doc/v1.0/direct_debit#operation/checkWalletBalance
```
+
+
+
+
+# **getWalletBalance**
+> GetWalletBalance getWalletBalance(userAuthorizationId, currency, productType)
+
+Get user wallet balance
+
+Get the user wallet account balance **Timeout: 15s**
+
+### Example
+```java
+// Import classes:
+import jp.ne.paypay.ApiException;
+import jp.ne.paypay.api.WalletApi;
+
+
+
+WalletApi apiInstance = new WalletApi(apiClient);
+
+String userAuthorizationId = "USER_AUTHORIZATION_ID";
+
+String currency = "JPY";
+
+ProductType productType = ProductType.VIRTUAL_BONUS_INVESTMENT OR ProductType.PAY_LATER_REPAYMENT
+
+// productType parameter in request is optional. For some merchants that are restricted to use only certain product types, the product type must be properly set.
+
+try {
+ GetWalletBalance result = apiInstance.getWalletBalance(userAuthorizationId, currency, null);
+ System.out.println(result);
+} catch (ApiException e) {
+ System.err.println("Exception when calling WalletApi#getWalletBalance");
+ e.printStackTrace();
+ System.out.println(e.getResponseBody());
+}
+```
+```
+Please refer to the below document for more information :
+https://www.paypay.ne.jp/opa/doc/v1.0/get_balance#tag/Wallet/operation/getBalance
+```
diff --git a/src/main/java/jp/ne/paypay/api/ApiNameConstants.java b/src/main/java/jp/ne/paypay/api/ApiNameConstants.java
index a36bd81..6d2b783 100644
--- a/src/main/java/jp/ne/paypay/api/ApiNameConstants.java
+++ b/src/main/java/jp/ne/paypay/api/ApiNameConstants.java
@@ -26,4 +26,5 @@ public class ApiNameConstants {
public static final String GET_CASHBACK_DETAILS = "v2_getCashbackDetails";
public static final String CREATE_REVERSE_CASHBACK_REQUEST = "v2_createReverseCashBackRequest";
public static final String GET_REVERSED_CASHBACK_DETAILS = "v2_getReversedCashBackDetails";
+ public static final String GET_BALANCE = "v6_getWalletBalance";
}
diff --git a/src/main/java/jp/ne/paypay/api/WalletApi.java b/src/main/java/jp/ne/paypay/api/WalletApi.java
index 5342d2b..3c74f43 100644
--- a/src/main/java/jp/ne/paypay/api/WalletApi.java
+++ b/src/main/java/jp/ne/paypay/api/WalletApi.java
@@ -9,6 +9,7 @@
import jp.ne.paypay.Pair;
import jp.ne.paypay.model.ProductType;
import jp.ne.paypay.model.WalletBalance;
+import jp.ne.paypay.model.GetWalletBalance;
import jakarta.validation.constraints.NotNull;
import java.lang.reflect.Type;
@@ -39,7 +40,7 @@ public void setApiClient(ApiClient apiClient) {
/**
- * Build call for checkWalletBalance
+ * Build call for checkWalletBalance and getWalletBalance
* @param userAuthorizationId (required)
* @param amount (required)
* @param currency (required)
@@ -48,11 +49,9 @@ public void setApiClient(ApiClient apiClient) {
* @throws ApiException If fail to serialize the request body object
*/
- private Call checkWalletBalanceCall(String userAuthorizationId, Integer amount, String currency,
+ private Call walletBalanceCall(String endpoint, String userAuthorizationId, Integer amount, String currency,
ProductType productType) throws ApiException {
- String localVarPath = "/v2/wallet/check_balance";
-
List localVarQueryParams = new ArrayList<>();
List localVarCollectionQueryParams = new ArrayList<>();
if (userAuthorizationId != null)
@@ -82,12 +81,11 @@ private Call checkWalletBalanceCall(String userAuthorizationId, Integer amount,
String[] localVarAuthNames = new String[] { "HmacAuth" };
apiClient.setReadTimeout(15);
- return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams,
+ return apiClient.buildCall(endpoint, "GET", localVarQueryParams, localVarCollectionQueryParams,
null, localVarHeaderParams, localVarFormParams, localVarAuthNames);
}
- private Call checkWalletBalanceValidateBeforeCall(String userAuthorizationId, Integer amount, String currency, ProductType productType) throws ApiException {
-
+ private Call validateCheckWalletBalanceParamsBeforeCall(String userAuthorizationId, Integer amount, String currency, ProductType productType) throws ApiException {
// verify the required parameter 'userAuthorizationId' is set
if (userAuthorizationId == null) {
@@ -104,20 +102,33 @@ private Call checkWalletBalanceValidateBeforeCall(String userAuthorizationId, In
throw new ApiException("Missing the required parameter 'currency' when calling checkWalletBalance(Async)");
}
+ return walletBalanceCall("/v2/wallet/check_balance", userAuthorizationId, amount, currency, productType);
+ }
+
+ private Call validateGetWalletBalanceParamsBeforeCall(String userAuthorizationId, String currency, ProductType productType) throws ApiException {
+
+ // verify the required parameter 'userAuthorizationId' is set
+ if (userAuthorizationId == null) {
+ throw new ApiException("Missing the required parameter 'userAuthorizationId' when calling checkWalletBalance(Async)");
+ }
- return checkWalletBalanceCall(userAuthorizationId, amount, currency, productType);
+ // verify the required parameter 'currency' is set
+ if (currency == null) {
+ throw new ApiException("Missing the required parameter 'currency' when calling checkWalletBalance(Async)");
+ }
+
+ return walletBalanceCall("/v6/wallet/balance", userAuthorizationId, null, currency, productType);
}
/**
* Check user wallet balance
- * Check if user has enough balance to make a payment **Timeout: 15s**
+ * 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 WalletBalance
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
-
*/
public WalletBalance checkWalletBalance( String userAuthorizationId, Integer amount, String currency, @NotNull ProductType productType) throws ApiException {
ApiResponse resp = checkWalletBalanceWithHttpInfo(userAuthorizationId, amount, currency, productType);
@@ -126,19 +137,48 @@ public WalletBalance checkWalletBalance( String userAuthorizationId, Integer amo
/**
* Check user wallet balance
- * Check if user has enough balance to make a payment **Timeout: 15s**
+ * 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 checkWalletBalanceWithHttpInfo(String userAuthorizationId, Integer amount,
String currency, ProductType productType) throws ApiException {
- Call call = checkWalletBalanceValidateBeforeCall(userAuthorizationId, amount, currency, productType);
+ Call call = validateCheckWalletBalanceParamsBeforeCall(userAuthorizationId, amount, currency, productType);
Type localVarReturnType = new TypeToken(){}.getType();
return apiClient.execute(call, localVarReturnType, ApiNameConstants.CHECK_BALANCE);
}
-}
+
+ /**
+ * Get user wallet balance
+ * Get the user's total balance and preference **Timeout: 15s**
+ * @param userAuthorizationId (required)
+ * @param currency (required)
+ * @param productType (optional)
+ * @return GetWalletBalance
+ * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
+ */
+ public GetWalletBalance getWalletBalance(String userAuthorizationId, String currency, @NotNull ProductType productType) throws ApiException {
+ ApiResponse resp = getWalletBalanceWithHttpInfo(userAuthorizationId, currency, productType);
+ return resp.getData();
+ }
+
+ /**
+ * Get user wallet balance
+ * Get the user's total balance and preference **Timeout: 15s**
+ * @param userAuthorizationId (required)
+ * @param currency (required)
+ * @param productType (optional)
+ * @return ApiResponse<GetWalletBalance>
+ * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
+ */
+ protected ApiResponse getWalletBalanceWithHttpInfo(String userAuthorizationId,
+ String currency, ProductType productType) throws ApiException {
+ Call call = validateGetWalletBalanceParamsBeforeCall(userAuthorizationId, currency, productType);
+ Type localVarReturnType = new TypeToken(){}.getType();
+ return apiClient.execute(call, localVarReturnType, ApiNameConstants.GET_BALANCE);
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/jp/ne/paypay/model/GetBalanceData.java b/src/main/java/jp/ne/paypay/model/GetBalanceData.java
new file mode 100644
index 0000000..1c98c22
--- /dev/null
+++ b/src/main/java/jp/ne/paypay/model/GetBalanceData.java
@@ -0,0 +1,81 @@
+package jp.ne.paypay.model;
+
+import com.google.gson.annotations.SerializedName;
+
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * BalanceData
+ */
+public class GetBalanceData {
+
+ @SerializedName("userAuthorizationId")
+ private String userAuthorizationId = null;
+
+ @SerializedName("totalBalance")
+ private MoneyAmount totalBalance = null;
+
+ @SerializedName("preference")
+ private Preference preference = null;
+
+ /**
+ * User's userAuthorizationId
+ * @return userAuthorizationId
+ **/
+ @ApiModelProperty(value = "User's userAuthorizationId")
+ public String getUserAuthorizationId() {
+ return userAuthorizationId;
+ }
+
+ public GetBalanceData setUserAuthorizationId(String userAuthorizationId) {
+ this.userAuthorizationId = userAuthorizationId;
+ return this;
+ }
+
+ /**
+ * User's total balance
+ * @return totalAmount
+ **/
+
+ public MoneyAmount getTotalBalance() {
+ return totalBalance;
+ }
+ public void setTotalBalance(MoneyAmount totalBalance) {
+ this.totalBalance = totalBalance;
+ }
+
+ /**
+ * User's Preference
+ * @return preference
+ **/
+
+ public Preference getPreference() {
+ return preference;
+ }
+ public void setPreference(Preference preference) {
+ this.preference = preference;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("class GetBalanceData {\n");
+
+ sb.append(" userAuthorizationId: ").append(toIndentedString(userAuthorizationId)).append("\n");
+ sb.append(" totalBalance: ").append(toIndentedString(totalBalance)).append("\n");
+ sb.append(" preference: ").append(toIndentedString(preference)).append("\n");
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces
+ * (except the first line).
+ */
+ private String toIndentedString(Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/jp/ne/paypay/model/GetWalletBalance.java b/src/main/java/jp/ne/paypay/model/GetWalletBalance.java
new file mode 100644
index 0000000..3d1d81a
--- /dev/null
+++ b/src/main/java/jp/ne/paypay/model/GetWalletBalance.java
@@ -0,0 +1,99 @@
+package jp.ne.paypay.model;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.util.Objects;
+
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * GetWalletBalance
+ */
+
+public class GetWalletBalance {
+
+ @SerializedName("resultInfo")
+ private ResultInfo resultInfo = null;
+
+ @SerializedName("data")
+ private GetBalanceData data = null;
+
+ public GetWalletBalance resultInfo(ResultInfo resultInfo) {
+ this.resultInfo = resultInfo;
+ return this;
+ }
+
+
+ /**
+ * Get resultInfo
+ * @return resultInfo
+ **/
+ @ApiModelProperty(value = "")
+ public ResultInfo getResultInfo() {
+ return resultInfo;
+ }
+ public void setResultInfo(ResultInfo resultInfo) {
+ this.resultInfo = resultInfo;
+ }
+
+ public GetWalletBalance data(GetBalanceData data) {
+ this.data = data;
+ return this;
+ }
+
+
+ /**
+ * Get data
+ * @return data
+ **/
+ @ApiModelProperty(value = "")
+ public GetBalanceData getData() {
+ return data;
+ }
+ public void setData(GetBalanceData data) {
+ this.data = data;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ GetWalletBalance walletBalance = (GetWalletBalance) o;
+ return Objects.equals(this.resultInfo, walletBalance.resultInfo) &&
+ Objects.equals(this.data, walletBalance.data);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(resultInfo, data);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("class GetWalletBalance {\n");
+
+ sb.append(" resultInfo: ").append(toIndentedString(resultInfo)).append("\n");
+ sb.append(" data: ").append(toIndentedString(data)).append("\n");
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces
+ * (except the first line).
+ */
+ private String toIndentedString(Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+}
+
+
+
diff --git a/src/main/java/jp/ne/paypay/model/Preference.java b/src/main/java/jp/ne/paypay/model/Preference.java
new file mode 100644
index 0000000..811a958
--- /dev/null
+++ b/src/main/java/jp/ne/paypay/model/Preference.java
@@ -0,0 +1,86 @@
+package jp.ne.paypay.model;
+
+import com.google.gson.annotations.SerializedName;
+
+import java.util.Objects;
+
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * Preference
+ */
+
+public class Preference {
+
+ @SerializedName("useCashback")
+ private Boolean useCashback = null;
+
+ @SerializedName("cashbackAutoInvestment")
+ private Boolean cashbackAutoInvestment = null;
+
+ /**
+ * Get useCashback flag
+ * @return useCashback
+ **/
+ @ApiModelProperty(value = "Use cashback amount for transaction")
+ public Boolean isUseCashback() {
+ return useCashback;
+ }
+ public void setUseCashback(Boolean useCashback) {
+ this.useCashback = useCashback;
+ }
+
+ /**
+ * Get cashbackAutoInvestment flag
+ * @return cashbackAutoInvestment
+ **/
+ @ApiModelProperty(value = "Use cashback for auto investment")
+ public Boolean isCashbackAutoInvestment() {
+ return cashbackAutoInvestment;
+ }
+ public void setCashbackAutoInvestment(Boolean cashbackAutoInvestment) {
+ this.cashbackAutoInvestment = cashbackAutoInvestment;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ Preference preference = (Preference) o;
+ return Objects.equals(this.useCashback, preference.useCashback) &&
+ Objects.equals(this.cashbackAutoInvestment, preference.cashbackAutoInvestment);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(useCashback, cashbackAutoInvestment);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("class Preference {\n");
+ sb.append(" useCashback: ").append(toIndentedString(useCashback)).append("\n");
+ sb.append(" cashbackAutoInvestment: ").append(toIndentedString(cashbackAutoInvestment)).append("\n");
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces
+ * (except the first line).
+ */
+ private String toIndentedString(Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+}
+
+
+
diff --git a/src/test/java/jp/ne/paypay/api/WalletApiTest.java b/src/test/java/jp/ne/paypay/api/WalletApiTest.java
index d934a00..b186266 100644
--- a/src/test/java/jp/ne/paypay/api/WalletApiTest.java
+++ b/src/test/java/jp/ne/paypay/api/WalletApiTest.java
@@ -4,9 +4,15 @@
import jp.ne.paypay.ApiException;
import jp.ne.paypay.ApiResponse;
import jp.ne.paypay.model.BalanceData;
+import jp.ne.paypay.model.GetBalanceData;
+import jp.ne.paypay.model.GetWalletBalance;
+import jp.ne.paypay.model.MoneyAmount;
+import jp.ne.paypay.model.Preference;
import jp.ne.paypay.model.ProductType;
import jp.ne.paypay.model.ResultInfo;
import jp.ne.paypay.model.WalletBalance;
+import jp.ne.paypay.model.MoneyAmount.CurrencyEnum;
+
import org.junit.Assert;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
@@ -81,4 +87,44 @@ public void checkWalletBalanceInvalidParamsTest() throws ApiException {
Assert.assertThrows(ApiException.class, () -> api.checkWalletBalance(userAuthorizationId, amount, null, productType));
}
+ /**
+ * Get user wallet balance with preference
+ *
+ *
+ * @throws ApiException
+ * if the Api call fails
+ */
+ @Test
+ public void getWalletBalanceTest() throws ApiException {
+
+ String userAuthorizationId = "user-authorization-id";
+ String currency = "JPY";
+ ProductType productType = null;
+ GetWalletBalance walletBalance = new GetWalletBalance();
+
+ Assert.assertNotNull(api.getApiClient());
+ walletBalance.setResultInfo(resultInfo);
+ GetBalanceData balanceData = new GetBalanceData();
+ Preference preference = new Preference();
+ MoneyAmount totalBalance = new MoneyAmount();
+
+ preference.setCashbackAutoInvestment(false);
+ preference.setUseCashback(false);
+
+ totalBalance.setAmount(1000);
+ totalBalance.setCurrency(CurrencyEnum.JPY);
+
+ balanceData.setPreference(preference);
+ balanceData.setTotalBalance(totalBalance);
+ balanceData.setUserAuthorizationId(userAuthorizationId);
+
+ walletBalance.setData(balanceData);
+
+ ApiResponse walletBalanceApiResponse = new ApiResponse<>(1, null, walletBalance);
+ Mockito.when(api.getWalletBalanceWithHttpInfo(userAuthorizationId, currency, productType)).thenReturn(walletBalanceApiResponse);
+ GetWalletBalance response = api.getWalletBalance(userAuthorizationId, currency, productType);
+ Assert.assertEquals(response.getResultInfo().getMessage(), "SUCCESS");
+ Assert.assertEquals(response.getData().getTotalBalance().getAmount().toString(), "1000");
+ Assert.assertEquals(response.getData().getPreference().isUseCashback(), false);
+ }
}