-
Notifications
You must be signed in to change notification settings - Fork 17
Added v6 wallet balance api to SDK #170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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; | ||
|
|
@@ -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, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Method |
||
| ProductType productType) throws ApiException { | ||
|
|
||
| String localVarPath = "/v2/wallet/check_balance"; | ||
|
|
||
| List<Pair> localVarQueryParams = new ArrayList<>(); | ||
| List<Pair> 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<WalletBalance> 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<WalletBalance> 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<WalletBalance>(){}.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<GetWalletBalance> 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<GetWalletBalance> getWalletBalanceWithHttpInfo(String userAuthorizationId, | ||
| String currency, ProductType productType) throws ApiException { | ||
| Call call = validateGetWalletBalanceParamsBeforeCall(userAuthorizationId, currency, productType); | ||
| Type localVarReturnType = new TypeToken<GetWalletBalance>(){}.getType(); | ||
| return apiClient.execute(call, localVarReturnType, ApiNameConstants.GET_BALANCE); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar blocks of code found in 2 locations. Consider refactoring. |
||
| 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 "); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| package jp.ne.paypay.model; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar blocks of code found in 10 locations. Consider refactoring. |
||
|
|
||
| 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 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Method |
||
| 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 "); | ||
| } | ||
| } | ||
|
|
||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.