Package com.etospheres.etopay
Class ETOPaySdk
java.lang.Object
com.etospheres.etopay.ETOPaySdk
Main object that contains all the functionality for interfacing with the ETOPaySdk.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Destructor for the SDK handlevoid
createNewUser
(String username) Creates a new user for the SDK.createNewWallet
(String pin) Creates a new wallet and sets the pin and passwordCreates a payment detail for the wallet crypto address in viviswapbyte[]
createWalletBackup
(String pin, String backup_password) Creates a wallet backup file for the existing wallet and encrypts it with the passwordvoid
createWalletFromBackup
(String pin, byte[] backup, String backup_password) Creates a wallet from a previously created backupvoid
createWalletFromMnemonic
(String pin, String mnemonic) Creates/migrates a wallet from an existing mnemonicvoid
deleteUser
(String pin) Deletes the user in ETOPay.void
deleteWallet
(String pin) Deletes the local wallet and associated filesCreates a payment contract for depositing money in wallet using viviswap [EURO --> Crypto]generateNewAddress
(String pin) Generate a new receiver address based on selected currency in the config.Get sdk build information.double
Gets the current exchange rate for the cryptocurrency to EUROGets the IBAN of the userFetches the KYC details for the postident providerFetch available currencies and corresponding networks.Get the user's preferred network.Get/download the recovery share.getSwapDetails
(String order_id) Gets the detail of a particular swap(deposit or withdrawal) created at viviswap based on the given order id.getSwapList
(long start, long limit) Gets the detailed lists of swaps (deposit and withdrawal) created at viviswapFetches the KYC details for a user by the viviswap onboarding processGet the open AMLA KYC questionsGet the currently open/missing documents for KYCdouble
getWalletBalance
(String pin) Fetches the current balance of the base crypto currency on the walletgetWalletTransaction
(String pin, String tx_id) Gets the details of a specific wallet transactiongetWalletTransactionList
(String pin, long start, long limit) Gets the detailed lists of wallet transactionsvoid
initializeUser
(String username) Initializes an existing user in the SDKboolean
isKycVerified
(String username) Fetches the kyc verification status for the userboolean
Check if the password to use for wallet operations is set.void
Resets the pin for the wallet using the wallet passwordvoid
Verifies the pin for the walletpurchaseDetails
(String purchase_id) Fetches the purchase details from the given purchase ID.void
purchaseRequestConfirm
(String pin, String purchase_id) Confirm the purchase for the given purchase ID.purchaseRequestCreate
(String receiver, double amount, String product_hash, String app_data, String purchase_type) Creates a purchase request for buying an artefactvoid
refreshAccessToken
(String access_token) Refreshes the access token for the user in the SDK.sendAmount
(String pin, String address, double amount, byte[] data) Sends the given amount to the given addressvoid
Set the configuration as a JSON-encoded string.void
setNetwork
(String network_key) Selects the network for the ETOPay SDK.void
setPreferredNetwork
(String network_key) Set the user's preferred network.void
setRecoveryShare
(String share) Set/upload the recovery share.void
setViviswapKycAmlaAnswer
(String question_id, String[] answers, String freetext_answer) Set the answer to an open AMLA KYC questionvoid
setViviswapKycDocument
(String document_id, String expiration_date, String document_number, byte[] front_image_data, String front_image_filename, byte[] back_image_data, String back_image_filename) Set / upload an open KYC documentvoid
setViviswapKycIdentityDetails
(String official_document_type, String expiration_date, String document_number, byte[] official_document_front_image_data, String official_document_front_image_filename, byte[] official_document_back_image_data, String official_document_back_image_filename, byte[] personal_video_data, String personal_video_filename) Set Viviswap KYC identity detailsvoid
setViviswapKycResidenceDetails
(String country_code, String region, String zip_code, String city, String address_line_1, String address_line_2, boolean is_public_entry, String public_entry_reference, boolean has_no_official_document, byte[] official_document_image_data, String official_document_image_filename) Set Viviswap KYC residence detailsvoid
setWalletPassword
(String pin, String new_password) Set the password to use for wallet operations.Initialize the KYC process for Postident by generating a case id.startViviswapKyc
(String mail, boolean terms_accepted) Starts the KYC verification process for viviswapvoid
Submits the partial KYC details for the viviswap onboarding processtxList
(long start, long limit) Gets the detailed lists of purchases (COMPLIMENTS and PURCHASES)updateIbanViviswap
(String pin, String address) Updates the IBAN of the uservoid
updateKycStatusForPostident
(String case_id) Triggers the backend to update the KYC status in the postident KYC providerupdateViviswapKycPartial
(boolean is_individual, boolean is_pep, boolean is_us_citizen, boolean is_regulatory_disclosure, String country_of_residence, String nationality, String full_name, String date_of_birth) Updates the partial KYC details for the viviswap onboarding processboolean
verifyMnemonic
(String pin, String mnemonic) Verifies the mnemonic for the walletwithdrawWithViviswap
(double amount, String pin, byte[] data) Creates a payment contract for withdrawing money from wallet using viviswap [Crypto --> EUR] and if the pin is provided automatically triggers a withdrawal
-
Constructor Details
-
ETOPaySdk
public ETOPaySdk()
-
-
Method Details
-
setConfig
Set the configuration as a JSON-encoded string.- Parameters:
config
- The input string representing the configuration with the following structure:{ "auth_provider": "<authentication provider name>", "backend_url": "<valid URL to the backend API>", "storage_path": "/path/to/valid/folder", "log_level": "info", }
- Throws:
Exception
-
getNetworks
Fetch available currencies and corresponding networks.- Returns:
- Serialized string of ApiNetworks as value
- Throws:
Exception
-
setNetwork
Selects the network for the ETOPay SDK.- Parameters:
network_key
- The input string representing the network key- Throws:
Exception
-
close
Destructor for the SDK handle- Throws:
Exception
-
createNewUser
Creates a new user for the SDK.- Parameters:
username
- The input string representing the username.- Throws:
Exception
-
initializeUser
Initializes an existing user in the SDK- Parameters:
username
- The input string representing the username.- Throws:
Exception
-
refreshAccessToken
Refreshes the access token for the user in the SDK.- Parameters:
access_token
- The input string representing the access token.- Throws:
Exception
-
isKycVerified
Fetches the kyc verification status for the user- Parameters:
username
- The input string representing the username.- Returns:
- The kyc verification status as a boolean value
- Throws:
Exception
-
verifyMnemonic
Verifies the mnemonic for the wallet- Parameters:
pin
- The input string representing the pin.mnemonic
- The input string representing the mnemonic- Returns:
- a boolean indicating if the mnemonic is correct or not
- Throws:
Exception
-
createNewWallet
Creates a new wallet and sets the pin and password- Parameters:
pin
- The input string representing the pin.- Returns:
- The mnemonic of the created wallet as a string
- Throws:
Exception
-
createWalletFromMnemonic
Creates/migrates a wallet from an existing mnemonic- Parameters:
pin
- The input string representing the pin.mnemonic
- The input string representing the mnemonic- Throws:
Exception
-
createWalletFromBackup
public void createWalletFromBackup(String pin, byte[] backup, String backup_password) throws Exception Creates a wallet from a previously created backup- Parameters:
pin
- The input string representing the pin.backup
- The bytes of the backup file.backup_password
- The input string representing the password of the backup- Throws:
Exception
-
createWalletBackup
Creates a wallet backup file for the existing wallet and encrypts it with the password- Parameters:
pin
- The input string representing the pin.backup_password
- The input string representing the password to be used to encrypt the backup- Returns:
- The path to the generated backup file as string
- Throws:
Exception
-
deleteWallet
Deletes the local wallet and associated files- Parameters:
pin
- The input string representing the pin.- Throws:
Exception
-
generateNewAddress
Generate a new receiver address based on selected currency in the config.- Parameters:
pin
- The input string representing the pin.- Returns:
- The receiver wallet address as String.
- Throws:
Exception
-
getWalletBalance
Fetches the current balance of the base crypto currency on the wallet- Parameters:
pin
- The input string representing the pin.- Returns:
- The current balance as a double precision floating point number
- Throws:
Exception
-
startKycVerificationForPostident
Initialize the KYC process for Postident by generating a case id.Note: This method is only available if the SDK is compiled with support for postident.
- Returns:
- The ID of the new Postident KYC case.
- Throws:
Exception
-
getKycDetailsForPostident
Fetches the KYC details for the postident providerNote: This method is only available if the SDK is compiled with support for postident.
- Returns:
- The case details as a serialized JSON string
- Throws:
Exception
-
updateKycStatusForPostident
Triggers the backend to update the KYC status in the postident KYC providerNote: This method is only available if the SDK is compiled with support for postident.
- Parameters:
case_id
- The input string representing the case_id to be updated- Throws:
Exception
-
purchaseRequestCreate
public String purchaseRequestCreate(String receiver, double amount, String product_hash, String app_data, String purchase_type) throws Exception Creates a purchase request for buying an artefact- Parameters:
receiver
- The receiver of the purchase request.amount
- The amount of the purchase.product_hash
- The hash of the underlying product/artefactapp_data
- The app data for the purchase. This is application specific string or stringified object data.purchase_type
- The type of the purchase. Either a COMPLIMENT or a PURCHASE- Returns:
- The purchase id of the created purchase request as string
- Throws:
Exception
-
purchaseDetails
Fetches the purchase details from the given purchase ID.- Parameters:
purchase_id
- The purchase id to query to details.- Returns:
- The purchase details as a serialized JSON string
- Throws:
Exception
-
purchaseRequestConfirm
Confirm the purchase for the given purchase ID.- Parameters:
pin
- The pin for confirmation of purchasepurchase_id
- The purchase id to confirm.- Throws:
Exception
-
startViviswapKyc
Starts the KYC verification process for viviswap- Parameters:
mail
- The email address of the user as a string.terms_accepted
- The terms of conditions accepted flag for the user as a boolean- Returns:
- The new viviswap user as a serialized JSON string
- Throws:
Exception
-
getViviswapKyc
Fetches the KYC details for a user by the viviswap onboarding process- Returns:
- The KYC details as a serialized JSON string
- Throws:
Exception
-
updateViviswapKycPartial
public String updateViviswapKycPartial(boolean is_individual, boolean is_pep, boolean is_us_citizen, boolean is_regulatory_disclosure, String country_of_residence, String nationality, String full_name, String date_of_birth) throws Exception Updates the partial KYC details for the viviswap onboarding process- Parameters:
is_individual
- Flag indicating if the user is an individual.is_pep
- Flag indicating if the user is a politically exposed person.is_us_citizen
- Flag indicating if the user is a US citizen.is_regulatory_disclosure
- Flag indicating if the user has made a regulatory disclosure.country_of_residence
- The country of residence of the user.nationality
- The nationality of the user.full_name
- The full name of the user.date_of_birth
- The date of birth of the user.- Returns:
- The KYC updated details reflected as a serialized JSON string
- Throws:
Exception
-
submitViviswapKycPartial
Submits the partial KYC details for the viviswap onboarding process- Throws:
Exception
-
setViviswapKycIdentityDetails
public void setViviswapKycIdentityDetails(String official_document_type, String expiration_date, String document_number, byte[] official_document_front_image_data, String official_document_front_image_filename, byte[] official_document_back_image_data, String official_document_back_image_filename, byte[] personal_video_data, String personal_video_filename) throws Exception Set Viviswap KYC identity details- Parameters:
official_document_type
- The type of the official document.expiration_date
- The expiration date of the official document.document_number
- The number of the official document.official_document_front_image_data
- The byte data of the image of the front of the official document.official_document_front_image_filename
- The filename (including extension) of the image of the front of the official document.official_document_back_image_data
- The byte data of the image of the back of the official document, or NULL to not provide a back image.official_document_back_image_filename
- The filename (including extension) of the image of the back of the official document, or NULL to no provide a back image.personal_video_data
- The byte data of the 30 second personal video recording.personal_video_filename
- The filename (including extenstion) of the 30 second personal video recording.- Throws:
Exception
-
setViviswapKycResidenceDetails
public void setViviswapKycResidenceDetails(String country_code, String region, String zip_code, String city, String address_line_1, String address_line_2, boolean is_public_entry, String public_entry_reference, boolean has_no_official_document, byte[] official_document_image_data, String official_document_image_filename) throws Exception Set Viviswap KYC residence details- Parameters:
country_code
- `, `region`, `zip_code`, `city`, `address_line_1`, `address_line_2 basic address data.is_public_entry
- Inidcates that a valid public entry of this clients address can be found.public_entry_reference
- if `is_public_entry` is `true`, then this must contain the resource link.has_no_official_document
- indicates if the client does not have any document verifying their address.official_document_image_data
- if `has_no_official_document` is `false`, then this must contain the bytes of the document file that verifies that this person is currently living at the address submitted. Otherwise leave as NULL.official_document_image_filename
- the filename (including extension) of the document, or NULL if no document needs to be provided.- Throws:
Exception
-
getViviswapKycAmlaOpenQuestions
Get the open AMLA KYC questions- Returns:
- A list of the currently open AMLA questions.
- Throws:
Exception
-
setViviswapKycAmlaAnswer
public void setViviswapKycAmlaAnswer(String question_id, String[] answers, String freetext_answer) throws Exception Set the answer to an open AMLA KYC question- Parameters:
question_id
- The ID of the question to set the answer to.answers
- a list of the selected available answers for the question.freetext_answer
- an optional free-text answer. Pass NULL to not pass any value.- Throws:
Exception
-
getViviswapKycOpenDocuments
Get the currently open/missing documents for KYC- Returns:
- A list of the currently open documents.
- Throws:
Exception
-
setViviswapKycDocument
public void setViviswapKycDocument(String document_id, String expiration_date, String document_number, byte[] front_image_data, String front_image_filename, byte[] back_image_data, String back_image_filename) throws Exception Set / upload an open KYC document- Parameters:
document_id
- The ID of the document to upload.expiration_date
- the expiration date of this document.document_number
- the official document number.front_image_data
- the bytes of the image of the front side of the document.front_image_filename
- the filename (including extension) of the front side of the document.back_image_data
- the bytes of the mage of the back side of the documentk, or NULL for not specifying a back side image.back_image_filename
- the filename (including extension) of the back side of the documentk, or NULL for not specifying a back side image.- Throws:
Exception
-
pinVerify
Verifies the pin for the wallet- Parameters:
pin
- The pin to be verified- Throws:
Exception
-
pinReset
Resets the pin for the wallet using the wallet password- Parameters:
new_pin
- The new pin to be set for the wallet- Throws:
Exception
-
setWalletPassword
Set the password to use for wallet operations. If the password was already set, this changes it.- Parameters:
pin
- The pin for verificationnew_password
- The new password to be set- Throws:
Exception
-
isWalletPasswordSet
Check if the password to use for wallet operations is set. UsesetWalletPassword(java.lang.String, java.lang.String)
to set a new or change an existing password.- Returns:
- whether the password is already set or not.
- Throws:
Exception
-
sendAmount
Sends the given amount to the given address- Parameters:
pin
- The pin for verificationaddress
- The address of the receiveramount
- The amount to send in the selected currencydata
- The data associated with the transaction. Pass NULL to not specify any data.- Returns:
- The transaction id.
- Throws:
Exception
-
updateIbanViviswap
Updates the IBAN of the user- Parameters:
pin
- The pin for verificationaddress
- The IBAN number to be updated- Returns:
- The details of the added IBAN as a serialized JSON string.
- Throws:
Exception
-
getIbanViviswap
Gets the IBAN of the user- Returns:
- The details of the IBAN as a serialized JSON string.
- Throws:
Exception
-
depositWithViviswap
Creates a payment contract for depositing money in wallet using viviswap [EURO --> Crypto]- Parameters:
pin
- The input string representing the pin.- Returns:
- The details of the added payment contract as a serialized JSON string.
- Throws:
Exception
-
createViviswapDetail
Creates a payment detail for the wallet crypto address in viviswap- Parameters:
pin
- The input string representing the pin.- Returns:
- The details of the added payment detail as a serialized JSON string.
- Throws:
Exception
-
withdrawWithViviswap
Creates a payment contract for withdrawing money from wallet using viviswap [Crypto --> EUR] and if the pin is provided automatically triggers a withdrawal- Parameters:
amount
- The amount to withdraw from the walletpin
- The pin for verification. Pass NULL to not specify a pin.data
- The data associated with the transaction. Pass NULL to not specify any data.- Returns:
- The details of the created payment contract as a serialized JSON string.
- Throws:
Exception
-
getSwapDetails
Gets the detail of a particular swap(deposit or withdrawal) created at viviswap based on the given order id.- Parameters:
order_id
- The amount to withdraw from the wallet- Returns:
- The details of the created order as a serialized JSON string.
- Throws:
Exception
-
getSwapList
Gets the detailed lists of swaps (deposit and withdrawal) created at viviswap- Parameters:
start
- The start pagelimit
- The limit per page- Returns:
- The details of the created orders as a serialized JSON string.
- Throws:
Exception
-
txList
Gets the detailed lists of purchases (COMPLIMENTS and PURCHASES)- Parameters:
start
- The start pagelimit
- The limit per page- Returns:
- The details of the created purchases as a serialized JSON string.
- Throws:
Exception
-
getExchangeRate
Gets the current exchange rate for the cryptocurrency to EURO- Returns:
- The exchange rate as a floating point number
- Throws:
Exception
-
deleteUser
Deletes the user in ETOPay. Hazmat!- Parameters:
pin
- The wallet pin for confirmation. Optional in case there is an active wallet.- Throws:
Exception
-
getWalletTransactionList
Gets the detailed lists of wallet transactions- Parameters:
pin
- The input string representing the pin.start
- The start pagelimit
- The limit per page- Returns:
- The details of the wallet transactions as a serialized JSON string.
- Throws:
Exception
-
getWalletTransaction
Gets the details of a specific wallet transaction- Parameters:
pin
- The input string representing the pin.tx_id
- The ID of the transaction to get details for.- Returns:
- The details of the wallet transaction as a serialized JSON string.
- Throws:
Exception
-
getPreferredNetwork
Get the user's preferred network.- Returns:
- The preferred network, or `null` if it has not been set.
- Throws:
Exception
-
setPreferredNetwork
Set the user's preferred network.- Parameters:
network_key
- The preferred network, or `null` if it should be unset.- Throws:
Exception
-
getBuildInfo
Get sdk build information.- Returns:
- The sdk build information as a string.
- Throws:
Exception
-