Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)



Expand Down
13 changes: 13 additions & 0 deletions docs/GetBalanceData.md
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




12 changes: 12 additions & 0 deletions docs/GetWalletBalance.md
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]




11 changes: 11 additions & 0 deletions docs/Preference.md
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



44 changes: 43 additions & 1 deletion docs/WalletApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -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



Expand Down Expand Up @@ -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
```



<a name="getWalletBalance"></a>
# **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
```
1 change: 1 addition & 0 deletions src/main/java/jp/ne/paypay/api/ApiNameConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
68 changes: 54 additions & 14 deletions src/main/java/jp/ne/paypay/api/WalletApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand All @@ -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,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Method walletBalanceCall has 5 arguments (exceeds 4 allowed). Consider refactoring.

ProductType productType) throws ApiException {

String localVarPath = "/v2/wallet/check_balance";

List<Pair> localVarQueryParams = new ArrayList<>();
List<Pair> localVarCollectionQueryParams = new ArrayList<>();
if (userAuthorizationId != null)
Expand Down Expand Up @@ -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) {
Expand All @@ -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);
Expand All @@ -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&lt;WalletBalance&gt;
* @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&lt;GetWalletBalance&gt;
* @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);
}
}
81 changes: 81 additions & 0 deletions src/main/java/jp/ne/paypay/model/GetBalanceData.java
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

Choose a reason for hiding this comment

The 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 ");
}
}
Loading