Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
* 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, new HmacSignatureGenerator(secretKey));
this.showLimitUsage = showLimitUsage;
}
public GiftCard(String baseUrl, String apiKey, SignatureGenerator signatureGenerator, boolean showLimitUsage) {
this.baseUrl = baseUrl;
this.requestHandler = new RequestHandler(apiKey, signatureGenerator);
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
* externalUid -- optional/string -- Each external unique ID represents a unique user on the partner platform.
* The function helps you to identify the redemption behavior of different users,
* such as redemption frequency and amount. It also helps risk and limit control of a single account,
* such as daily limit on redemption volume, frequency, and incorrect number of entries. This will also prevent a single user account reach the partner's daily redemption limits. We strongly recommend you to use this feature and transfer us the User ID of your users if you have different users redeeming Binance codes on your platform.
* To protect user data privacy, you may choose to transfer the user id in any desired format (max. 400 characters).
* 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);
}
private final String RSA_PUB = "/sapi/v1/giftcard/cryptography/rsa-public-key";
/**
* This API is for fetching the RSA Public Key. This RSA Public key will be used to encrypt the card code.
*
* GET /sapi/v1/giftcard/cryptography/rsa-public-key
*
* @param
* parameters LinkedHashedMap of String,Object pair
* where String is the name of the parameter and Object is the value of the parameter
*