All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.binance.connector.client.impl.spot.GiftCard Maven / Gradle / Ivy

There is a newer version: 3.2.0
Show newest version
package com.binance.connector.client.impl.spot;

import java.util.Map;

import com.binance.connector.client.enums.HttpMethod;
import com.binance.connector.client.utils.ParameterChecker;
import com.binance.connector.client.utils.ProxyAuth;
import com.binance.connector.client.utils.RequestHandler;
import com.binance.connector.client.utils.signaturegenerator.HmacSignatureGenerator;
import com.binance.connector.client.utils.signaturegenerator.SignatureGenerator;

/**
 * 

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, ProxyAuth proxy) { this.baseUrl = baseUrl; this.requestHandler = new RequestHandler(apiKey, new HmacSignatureGenerator(secretKey), proxy); this.showLimitUsage = showLimitUsage; } public GiftCard(String baseUrl, String apiKey, SignatureGenerator signatureGenerator, boolean showLimitUsage, ProxyAuth proxy) { this.baseUrl = baseUrl; this.requestHandler = new RequestHandler(apiKey, signatureGenerator, proxy); 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 Map 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://developers.binance.com/docs/gift_card/market-data/Create-a-single-token-gift-card */ public String createCode(Map 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 Map 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://developers.binance.com/docs/gift_card/market-data/Redeem-a-Binance-Gift-Card */ public String redeemCode(Map 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 Map 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://developers.binance.com/docs/gift_card/market-data/Verify-Binance-Gift-Card-by-Gift-Card-Number */ public String verify(Map 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 Map of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* recvWindow -- optional/long
* @return String * @see * https://developers.binance.com/docs/gift_card/market-data/Fetch-RSA-Public-Key */ public String rsaPublicKey(Map parameters) { return requestHandler.sendSignedRequest(baseUrl, RSA_PUB, parameters, HttpMethod.GET, showLimitUsage); } private final String CREATE_DUAL_TOKEN_CODE = "/sapi/v1/giftcard/buyCode"; /** * This API is for buying a fixed-value Binance Code, which means your Binance Code will be redeemable to a token that is different to the token that you are paying in. If the token you’re paying and the redeemable token are the same, please use the Create Binance Code endpoint. * You can use supported crypto currency or fiat token as baseToken to buy Binance Code that is redeemable to your chosen faceToken. * Once successfully purchased, the amount of baseToken would be deducted from your funding wallet. * * 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/buyCode *
* @param * parameters Map of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* baseToken -- mandatory/string -- The token you want to pay, example BUSD
* faceToken -- mandatory/string -- The token you want to buy, example BNB. If faceToken = baseToken, it's the same as createCode endpoint.
* baseTokenAmount -- mandatory/double -- The base token asset quantity, example 1.002
* discount -- optional/double -- The discount rate, example 0.1
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String * @see * https://developers.binance.com/docs/gift_card/market-data/Create-a-dual-token-gift-card */ public String createDualTokensCode(Map parameters) { ParameterChecker.checkParameter(parameters, "baseToken", String.class); ParameterChecker.checkParameter(parameters, "faceToken", String.class); ParameterChecker.checkParameter(parameters, "baseTokenAmount", Double.class); return requestHandler.sendSignedRequest(baseUrl, CREATE_DUAL_TOKEN_CODE, parameters, HttpMethod.POST, showLimitUsage); } private final String TOKEN_LIMIT = "/sapi/v1/giftcard/buyCode/token-limit"; /** * This API is to help you verify which tokens are available for you to purchase fixed-value gift cards. * *

* GET /sapi/v1/giftcard/buyCode/token-limit *
* @param * parameters Map of String,Object pair * where String is the name of the parameter and Object is the value of the parameter *

* baseToken -- mandatory/string -- The token you want to pay, example BUSD
* recvWindow -- optional/long -- The value cannot be greater than 60000
* @return String * @see * https://developers.binance.com/docs/gift_card/market-data/Fetch-Token-Limit */ public String tokensLimit(Map parameters) { ParameterChecker.checkParameter(parameters, "baseToken", String.class); return requestHandler.sendSignedRequest(baseUrl, TOKEN_LIMIT, parameters, HttpMethod.GET, showLimitUsage); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy