-
Notifications
You must be signed in to change notification settings - Fork 16
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
Open
navin-math
wants to merge
4
commits into
master
Choose a base branch
from
new/v6-wallet-balance-api
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 | ||
|
|
||
|
|
||
|
|
||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
|
|
||
| # GetWalletBalance | ||
|
|
||
| ## Properties | ||
| Name | Type | Description | Notes | ||
| ------------ | ------------- | ------------- | ------------- | ||
| **resultInfo** | [**ResultInfo**](ResultInfo.md) | | [optional] | ||
| **data** | [**GetBalanceData**](GetBalanceData.md) | | [optional] | ||
|
|
||
|
|
||
|
|
||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 | ||
|
|
||
|
|
||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | ||
|
|
@@ -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, | ||
|
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); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 "); | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.