
com.binance.connector.client.impl.spot.GiftCard Maven / Gradle / Ivy
package com.binance.connector.client.impl.spot;
import com.binance.connector.client.enums.HttpMethod;
import com.binance.connector.client.utils.ParameterChecker;
import com.binance.connector.client.utils.RequestHandler;
import java.util.LinkedHashMap;
/**
* Gift Card Endpoints
* All endpoints under the
* Gift Card Endpoint
* section of the API documentation will be implemented in this class.
*
* Response will be returned in String format.
*/
public class GiftCard {
private final String baseUrl;
private final RequestHandler requestHandler;
private final boolean showLimitUsage;
public GiftCard(String baseUrl, String apiKey, String secretKey, boolean showLimitUsage) {
this.baseUrl = baseUrl;
this.requestHandler = new RequestHandler(apiKey, secretKey);
this.showLimitUsage = showLimitUsage;
}
private final String CREATE_CODE = "/sapi/v1/giftcard/createCode";
/**
* This API is for creating a Binance Code. To get started with, please make sure:
*
* You have a Binance account
* You have passed kyc
* You have a sufficient balance in your Binance funding wallet
* You need Enable Withdrawals for the API Key which requests this endpoint.
*
* POST /sapi/v1/giftcard/createCode
*
* @param
* parameters LinkedHashedMap of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* token -- mandatory/string -- The coin type contained in the Binance Code
* amount -- mandatory/double -- The amount of the coin
* recvWindow -- optional/long
* @return String
* @see
* https://binance-docs.github.io/apidocs/spot/en/#create-a-binance-code-user_data
*/
public String createCode(LinkedHashMap parameters) {
ParameterChecker.checkParameter(parameters, "token", String.class);
ParameterChecker.checkParameter(parameters, "amount", Double.class);
return requestHandler.sendSignedRequest(baseUrl, CREATE_CODE, parameters, HttpMethod.POST, showLimitUsage);
}
private final String REDEEM_CODE = "/sapi/v1/giftcard/redeemCode";
/**
* This API is for redeeming the Binance Code. Once redeemed, the coins will be deposited in your funding wallet.
* Please note that if you enter the wrong code 5 times within 24 hours,
* you will no longer be able to redeem any Binance Code that day.
*
* POST /sapi/v1/giftcard/redeemCode
*
* @param
* parameters LinkedHashedMap of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* code -- mandatory/string -- Binance code
* recvWindow -- optional/long
* @return String
* @see
* https://binance-docs.github.io/apidocs/spot/en/#redeem-a-binance-code-user_data
*/
public String redeemCode(LinkedHashMap parameters) {
ParameterChecker.checkParameter(parameters, "code", String.class);
return requestHandler.sendSignedRequest(baseUrl, REDEEM_CODE, parameters, HttpMethod.POST, showLimitUsage);
}
private final String VERIFY = "/sapi/v1/giftcard/verify";
/**
* This API is for verifying whether the Binance Code is valid or not by entering Binance Code or reference number.
* Please note that if you enter the wrong binance code 5 times within an hour,
* you will no longer be able to verify any binance code for that hour.
*
* GET /sapi/v1/giftcard/verify
*
* @param
* parameters LinkedHashedMap of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*
* referenceNo -- mandatory/string -- reference number
* recvWindow -- optional/long
* @return String
* @see
* https://binance-docs.github.io/apidocs/spot/en/#verify-a-binance-code-user_data
*/
public String verify(LinkedHashMap parameters) {
ParameterChecker.checkParameter(parameters, "referenceNo", String.class);
return requestHandler.sendSignedRequest(baseUrl, VERIFY, parameters, HttpMethod.GET, showLimitUsage);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy