/**
* @overview Cordova Paygilant plugin
*/
var exec = require('cordova/exec')
/**
* Wraps cordova's exec invocation for service `Paygilant` into Promise
* @access private
* @param {string} action to perform on native platform
* @param {Any[]} optionsArr array of parameters
* @returns {Promise<*>}
*/
let getPromiseFromExec = function (action, optionsArr) {
return new Promise(function (resolve, reject) {
exec(function (data) {
resolve(data)
},
function (error) {
reject(error)
},
'Paygilant',
action,
optionsArr)
})
}
/**
@namespace Paygilant
*/
var Paygilant = {}
/**
* type of checkpoint
* @readonly
* @enum {string}
*/
Paygilant.CheckpointType = {
LAUNCH: 'LAUNCH',
REGISTER: 'REGISTER',
LOGIN: 'LOGIN',
TRANSACTION: 'TRANSACTION',
UPDATE_DETAILS: 'UPDATE_DETAILS',
ADD_PAYMENT_METHOD: 'ADD_PAYMENT_METHOD',
GENERAL: 'GENERAL',
}
/**
* usually for updating transaction
* @readonly
* @enum {string}
*/
Paygilant.CheckPointStatus = {
/**
* checkpoint was approved by the application / application server
*/
APPROVED: 'APPROVED',
/**
* checkpoint was denied / blocked by the application / application server
*/
DENIED: 'DENIED',
/**
* checkpoint was canceled by the user
*/
CANCELLED: 'CANCELLED',
}
/**
* Type of screen for ScreenListener
* @readonly
* @enum {string}
*/
Paygilant.ScreenListenerType = {
REGISTRATION_FORM: 'REGISTRATION_FORM',
LOGIN_FORM: 'LOGIN_FORM',
MAIN_SCREEN: 'MAIN_SCREEN',
CATALOG_SCREEN: 'CATALOG_SCREEN',
SEARCH_SCREEN: 'SEARCH_SCREEN',
PRODUCT_SCREEN: 'PRODUCT_SCREEN',
GENERAL_FORM: 'GENERAL_FORM',
PINCODE: 'PINCODE',
TRANSACTION_DETAILS: 'TRANSACTION_DETAILS',
CONTACTS: 'CONTACTS',
PAYMENT_SCREEN: 'PAYMENT_SCREEN',
EMULATOR_CHECK: 'EMULATOR_CHECK',
GENERAL: 'GENERAL',
ADD_PAYMENT_SCREEN: 'ADD_PAYMENT_SCREEN',
WITHDRAW_SCREEN: 'WITHDRAW_SCREEN',
}
/**
* Type of verification
* @readonly
* @enum {string}
*/
Paygilant.VerificationType = {
VERIFIED: 'VERIFIED',
NOT_VERIFIED: 'NOT_VERIFIED',
UNKNOWN: 'UNKNOWN',
}
/**
* Type of payment method
* @readonly
* @enum {string}
*/
Paygilant.PaymentMethodType = {
CREDIT_CARD: 'CREDIT_CARD',
BANK_ACCOUNT: 'BANK_ACCOUNT',
ECHECK: 'ECHECK',
UNKNOWN: 'UNKNOWN',
}
/**
* type of transaction
* @readonly
* @enum {string}
*/
Paygilant.TransactionType = {
/**
* payment for goods
*/
PURCHASE: 'PURCHASE',
/**
* money transfer to another payee
*/
MONEY_TRANSFER: 'MONEY_TRANSFER',
/**
* money deposit to store
*/
DEPOSIT: 'DEPOSIT',
/**
* money withdraw from store
*/
WITHDRAW: 'WITHDRAW',
}
/**
* ISO 4217 3 letter currency codes
* @readonly
* @enum {string}
*/
Paygilant.CurrencyCode = {
/**
* Afghan Afghani
*/
AFN: 'AFN',
/**
* Euro
*/
EUR: 'EUR',
/**
* Albanian Lek
*/
ALL: 'ALL',
/**
* Algerian Dinar
*/
DZD: 'DZD',
/**
* US Dollar
*/
USD: 'USD',
AOA: 'AOA',
XCD: 'XCD',
/**
* Argentine Peso
*/
ARS: 'ARS',
/**
* Armenian Dram
*/
AMD: 'AMD',
AWG: 'AWG',
/**
* Australian Dollar
*/
AUD: 'AUD',
/**
* Azerbaijani Manat
*/
AZN: 'AZN',
BSD: 'BSD',
/**
* Bahraini Dinar
*/
BHD: 'BHD',
/**
* Bangladeshi Taka
*/
BDT: 'BDT',
BBD: 'BBD',
BYN: 'BYN',
/**
* Belize Dollar
*/
BZD: 'BZD',
/**
* CFA Franc BCEAO
*/
XOF: 'XOF',
BMD: 'BMD',
/**
* Indian Rupee
*/
INR: 'INR',
BTN: 'BTN',
/**
* Bolivian Boliviano
*/
BOB: 'BOB',
BOV: 'BOV',
/**
* Bosnia-Herzegovina Convertible Mark
*/
BAM: 'BAM',
/**
* Botswanan Pula
*/
BWP: 'BWP',
/**
* Norwegian Krone
*/
NOK: 'NOK',
/**
* Brazilian Real
*/
BRL: 'BRL',
/**
* Brunei Dollar
*/
BND: 'BND',
/**
* Bulgarian Lev
*/
BGN: 'BGN',
/**
* Burundian Franc
*/
BIF: 'BIF',
/**
* Cape Verdean Escudo
*/
CVE: 'CVE',
/**
* Cambodian Riel
*/
KHR: 'KHR',
/**
* CFA Franc BEAC
*/
XAF: 'XAF',
/**
* Canadian Dollar
*/
CAD: 'CAD',
KYD: 'KYD',
/**
* Chilean Peso
*/
CLP: 'CLP',
CLF: 'CLF',
/**
* Chinese Yuan
*/
CNY: 'CNY',
/**
* Colombian Peso
*/
COP: 'COP',
COU: 'COU',
/**
* Comorian Franc
*/
KMF: 'KMF',
/**
* Congolese Franc
*/
CDF: 'CDF',
/**
* New Zealand Dollar
*/
NZD: 'NZD',
/**
* Costa Rican Colón
*/
CRC: 'CRC',
/**
* Croatian Kuna
*/
HRK: 'HRK',
CUP: 'CUP',
CUC: 'CUC',
ANG: 'ANG',
/**
* Czech Republic Koruna
*/
CZK: 'CZK',
/**
* Danish Krone
*/
DKK: 'DKK',
/**
* Djiboutian Franc
*/
DJF: 'DJF',
/**
* Dominican Peso
*/
DOP: 'DOP',
/**
* Egyptian Pound
*/
EGP: 'EGP',
SVC: 'SVC',
/**
* Eritrean Nakfa
*/
ERN: 'ERN',
/**
* Ethiopian Birr
*/
ETB: 'ETB',
FKP: 'FKP',
FJD: 'FJD',
XPF: 'XPF',
GMD: 'GMD',
/**
* Georgian Lari
*/
GEL: 'GEL',
/**
* Ghanaian Cedi
*/
GHS: 'GHS',
GIP: 'GIP',
/**
* Guatemalan Quetzal
*/
GTQ: 'GTQ',
/**
* British Pound Sterling
*/
GBP: 'GBP',
/**
* Guinean Franc
*/
GNF: 'GNF',
GYD: 'GYD',
HTG: 'HTG',
/**
* Honduran Lempira
*/
HNL: 'HNL',
/**
* Hong Kong Dollar
*/
HKD: 'HKD',
/**
* Hungarian Forint
*/
HUF: 'HUF',
/**
* Icelandic Króna
*/
ISK: 'ISK',
/**
* Indonesian Rupiah
*/
IDR: 'IDR',
XDR: 'XDR',
/**
* Iranian Rial
*/
IRR: 'IRR',
/**
* Iraqi Dinar
*/
IQD: 'IQD',
/**
* Israeli New Sheqel
*/
ILS: 'ILS',
/**
* Jamaican Dollar
*/
JMD: 'JMD',
/**
* Japanese Yen
*/
JPY: 'JPY',
/**
* Jordanian Dinar
*/
JOD: 'JOD',
/**
* Kazakhstani Tenge
*/
KZT: 'KZT',
/**
* Kenyan Shilling
*/
KES: 'KES',
KPW: 'KPW',
/**
* South Korean Won
*/
KRW: 'KRW',
/**
* Kuwaiti Dinar
*/
KWD: 'KWD',
KGS: 'KGS',
LAK: 'LAK',
/**
* Lebanese Pound
*/
LBP: 'LBP',
LSL: 'LSL',
/**
* South African Rand
*/
ZAR: 'ZAR',
LRD: 'LRD',
/**
* Libyan Dinar
*/
LYD: 'LYD',
/**
* Swiss Franc
*/
CHF: 'CHF',
/**
* Macanese Pataca
*/
MOP: 'MOP',
/**
* Macedonian Denar
*/
MKD: 'MKD',
/**
* Malagasy Ariary
*/
MGA: 'MGA',
MWK: 'MWK',
/**
* Malaysian Ringgit
*/
MYR: 'MYR',
MVR: 'MVR',
MRU: 'MRU',
/**
* Mauritian Rupee
*/
MUR: 'MUR',
XUA: 'XUA',
/**
* Mexican Peso
*/
MXN: 'MXN',
MXV: 'MXV',
/**
* Moldovan Leu
*/
MDL: 'MDL',
MNT: 'MNT',
/**
* Moroccan Dirham
*/
MAD: 'MAD',
/**
* Mozambican Metical
*/
MZN: 'MZN',
/**
* Myanma Kyat
*/
MMK: 'MMK',
/**
* Namibian Dollar
*/
NAD: 'NAD',
/**
* Nepalese Rupee
*/
NPR: 'NPR',
/**
* Nicaraguan Córdoba
*/
NIO: 'NIO',
/**
* Nigerian Naira
*/
NGN: 'NGN',
/**
* Omani Rial
*/
OMR: 'OMR',
/**
* Pakistani Rupee
*/
PKR: 'PKR',
/**
* Panamanian Balboa
*/
PAB: 'PAB',
PGK: 'PGK',
/**
* Paraguayan Guarani
*/
PYG: 'PYG',
/**
* Peruvian Nuevo Sol
*/
PEN: 'PEN',
/**
* Philippine Peso
*/
PHP: 'PHP',
/**
* Polish Zloty
*/
PLN: 'PLN',
/**
* Qatari Rial
*/
QAR: 'QAR',
/**
* Romanian Leu
*/
RON: 'RON',
/**
* Russian Ruble
*/
RUB: 'RUB',
/**
* Rwandan Franc
*/
RWF: 'RWF',
SHP: 'SHP',
WST: 'WST',
STN: 'STN',
/**
* Saudi Riyal
*/
SAR: 'SAR',
/**
* Serbian Dinar
*/
RSD: 'RSD',
SCR: 'SCR',
SLL: 'SLL',
/**
* Singapore Dollar
*/
SGD: 'SGD',
XSU: 'XSU',
SBD: 'SBD',
/**
* Somali Shilling
*/
SOS: 'SOS',
SSP: 'SSP',
/**
* Sri Lankan Rupee
*/
LKR: 'LKR',
/**
* Sudanese Pound
*/
SDG: 'SDG',
SRD: 'SRD',
SZL: 'SZL',
/**
* Swedish Krona
*/
SEK: 'SEK',
CHE: 'CHE',
CHW: 'CHW',
/**
* Syrian Pound
*/
SYP: 'SYP',
/**
* New Taiwan Dollar
*/
TWD: 'TWD',
TJS: 'TJS',
/**
* Tanzanian Shilling
*/
TZS: 'TZS',
/**
* Thai Baht
*/
THB: 'THB',
/**
* Tongan Paʻanga
*/
TOP: 'TOP',
/**
* Trinidad and Tobago Dollar
*/
TTD: 'TTD',
/**
* Tunisian Dinar
*/
TND: 'TND',
/**
* Turkish Lira
*/
TRY: 'TRY',
TMT: 'TMT',
/**
* Ugandan Shilling
*/
UGX: 'UGX',
/**
* Ukrainian Hryvnia
*/
UAH: 'UAH',
/**
* United Arab Emirates Dirham
*/
AED: 'AED',
USN: 'USN',
/**
* Uruguayan Peso
*/
UYU: 'UYU',
UYI: 'UYI',
UYW: 'UYW',
/**
* Uzbekistan Som
*/
UZS: 'UZS',
VUV: 'VUV',
VES: 'VES',
/**
* Vietnamese Dong
*/
VND: 'VND',
/**
* Yemeni Rial
*/
YER: 'YER',
ZMW: 'ZMW',
ZWL: 'ZWL',
XBA: 'XBA',
XBB: 'XBB',
XBC: 'XBC',
XBD: 'XBD',
XTS: 'XTS',
XXX: 'XXX',
XAU: 'XAU',
XPD: 'XPD',
XPT: 'XPT',
XAG: 'XAG',
}
/**
Response for {@link Paygilant.getRiskForCheckpoint}
@property {string} requestId - id of the request
@property {number} score - risk score
@property {string} signedRisk - encrypted risk score
@constructor
@example
{ requestID: '123', score: 2 , signedRisk: 'ojeipjai3!+D-0-=dje' }
*/
Paygilant.RiskForCheckPointResponse = function (requestId, score, signedRisk) {
this.requestId = requestId
this.score = score
this.signedRisk = signedRisk
}
/**
* User object
* @param {string} user_id
* @param {string} email
* @param {Paygilant.VerificationType} isEmailVerified
* @param {string} phoneUser
* @param {Paygilant.VerificationType} isPhoneUserVerified
* @constructor
*/
Paygilant.User = function (user_id, email, isEmailVerified, phoneUser, isPhoneUserVerified) {
this.user_id = user_id
this.email = email
this.isEmailVerified = isEmailVerified
this.phoneUser = phoneUser
this.isPhoneUserVerified = isPhoneUserVerified
}
/**
* Address
* @param {string} firstName
* @param {string} lastName
* @param {string} addressLine1
* @param {string} addressLine2
* @param {string} city
* @param {string} state
* @param {string} country
* @param {string} postalCode
* @param {string} phoneNumber
* @constructor
*/
Paygilant.Address = function (
firstName, lastName, addressLine1, addressLine2, city, state, country, postalCode, phoneNumber) {
this.firstName = firstName
this.lastName = lastName
this.addressLine1 = addressLine1
this.addressLine2 = addressLine2
this.city = city
this.state = state
this.country = country
this.postalCode = postalCode
this.phoneNumber = phoneNumber
}
/**
* Credit card details
* @param {string} bin
* @param {string} lastFourDigit
* @param {number} yearExpiryDate
* @param {number} monthExpiryDate
* @param {string} card_token
* @param {string} cardId
* @constructor
*/
Paygilant.CreditCardDetail = function (bin, lastFourDigit, yearExpiryDate, monthExpiryDate, card_token, cardId) {
this.bin = bin
this.lastFourDigit = lastFourDigit
this.yearExpiryDate = yearExpiryDate
this.monthExpiryDate = monthExpiryDate
this.card_token = card_token
this.cardId = cardId
}
/**
* Bank account detail information
* @param {string} bankAccountNumber - bank account number
* @param {string} bankAccountFullname - bank account owner full name
* @param {string} bankAccountBsb - bank account state branch
* @constructor
*/
Paygilant.BankAccountDetails = function (bankAccountNumber, bankAccountFullname, bankAccountBsb) {
this.bankAccountNumber = bankAccountNumber
this.bankAccountFullname = bankAccountFullname
this.bankAccountBsb = bankAccountBsb
}
/**
* Clearing/bank response for transaction
* @param {string} verificationStatus
* @param {string} aVSResultCode
* @param {string} declineReasonCode
* @param {string} declineReasonMessage
* @param {string} acquirerResponseCode
* @param {string} acquirerResponseMessage
* @param {string} threeDSResponseStatus
* @param {string} threeDSResponseEnrolled
* @param {string} threeDSResponseECI
* @constructor
*/
Paygilant.AuthorizationResponse = function (
verificationStatus, aVSResultCode, declineReasonCode, declineReasonMessage, acquirerResponseCode,
acquirerResponseMessage, threeDSResponseStatus, threeDSResponseEnrolled, threeDSResponseECI) {
this.verificationStatus = verificationStatus
this.aVSResultCode = aVSResultCode
this.declineReasonCode = declineReasonCode
this.declineReasonMessage = declineReasonMessage
this.acquirerResponseCode = acquirerResponseCode
this.acquirerResponseMessage = acquirerResponseMessage
this.threeDSResponseStatus = threeDSResponseStatus
this.threeDSResponseEnrolled = threeDSResponseEnrolled
this.threeDSResponseECI = threeDSResponseECI
}
/**
* Payment options information
* @param {Paygilant.PaymentMethodType} paymentMethod
* @param {string} processor
* @param {string} fullNameOnCard
* @param {Paygilant.CreditCardDetail} creditCardDetail
* @param {Paygilant.BankAccountDetails} bankAccountDetails
* @constructor
*/
Paygilant.Payment = function (paymentMethod, processor, fullNameOnCard, creditCardDetail, bankAccountDetails) {
this.paymentMethod = paymentMethod
this.processor = processor
this.fullNameOnCard = fullNameOnCard
this.creditCardDetail = creditCardDetail
this.bankAccountDetails = bankAccountDetails
}
/**
* Generic checkpoint class
* @param {Paygilant.CheckpointType} type - type of checkpoint
* @param {Any} [additionalData]
* @constructor
*/
Paygilant.Checkpoint = function (type, additionalData) {
this.type = type
if (typeof additionalData !== 'undefined') {
this.additionalData = additionalData
}
}
/**
* General checkpoint
* @param {Any} [additionalData]
* @constructor
* @extends Paygilant.Checkpoint
*/
Paygilant.General = function (additionalData) {
Paygilant.Checkpoint.call(this, Paygilant.CheckpointType.GENERAL, additionalData)
}
Paygilant.General.prototype = Object.create(Paygilant.Checkpoint.prototype)
Paygilant.General.prototype.constructor = Paygilant.General
Paygilant.General.parent = Paygilant.Checkpoint.prototype
/**
* Launch checkpoint
* @param {Any} [additionalData]
* @constructor
* @extends Paygilant.Checkpoint
*/
Paygilant.Launch = function (additionalData) {
Paygilant.Checkpoint.call(this, Paygilant.CheckpointType.LAUNCH, additionalData)
}
Paygilant.Launch.prototype = Object.create(Paygilant.Checkpoint.prototype)
Paygilant.Launch.prototype.constructor = Paygilant.Launch
Paygilant.Launch.parent = Paygilant.Checkpoint.prototype
/**
* Login checkpoint - to be used during login attempt
* @param {Paygilant.User} user
* @param {Any} [additionalData]
* @constructor
* @extends Paygilant.Checkpoint
*/
Paygilant.Login = function (user, additionalData) {
Paygilant.Checkpoint.call(this, Paygilant.CheckpointType.LOGIN, additionalData)
this.user = user
}
Paygilant.Login.prototype = Object.create(Paygilant.Checkpoint.prototype)
Paygilant.Login.prototype.constructor = Paygilant.Login
Paygilant.Login.parent = Paygilant.Checkpoint.prototype
/**
* Register checkpoint - to be used after registration of new user.
* @param user - username or user id
* @param {Any} [additionalData]
* @constructor
* @extends Paygilant.Checkpoint
*/
Paygilant.Register = function (user, additionalData) {
Paygilant.Checkpoint.call(this, Paygilant.CheckpointType.REGISTER, additionalData)
this.user = user
}
Paygilant.Register.prototype = Object.create(Paygilant.Checkpoint.prototype)
Paygilant.Register.prototype.constructor = Paygilant.Register
Paygilant.Register.parent = Paygilant.Checkpoint.prototype
/**
* Transaction checkpoint to be used on transaction attempt
* @param {Paygilant.User} user
* @param {number} amount
* @param {Paygilant.CurrencyCode} curType - type of currency
* @param {Paygilant.TransactionType} transactionType
* @param {string} destinationId - end user that transaction is going to
* @param {Paygilant.Payment} payment
* @param {Paygilant.Address} billingAddress
* @param {Paygilant.Address} shippingAddress
* @param {Paygilant.AuthorizationResponse} authorizationResponse
* @param {Any} additionalData
* @constructor
* @extends Paygilant.Checkpoint
*/
Paygilant.Transaction = function (
user, amount, curType, transactionType, destinationId, payment, billingAddress, shippingAddress,
authorizationResponse, additionalData) {
Paygilant.Checkpoint.call(this, Paygilant.CheckpointType.TRANSACTION, additionalData)
this.user = user
this.amount = amount
this.curType = curType
this.transactionType = transactionType
this.destinationId = destinationId
this.payment = payment
this.billingAddress = billingAddress
this.shippingAddress = shippingAddress
this.authorizationResponse = authorizationResponse
}
Paygilant.Transaction.prototype = Object.create(Paygilant.Checkpoint.prototype)
Paygilant.Transaction.prototype.constructor = Paygilant.Transaction
Paygilant.Transaction.parent = Paygilant.Checkpoint.prototype
/**
* Add Payment Method checkpoint - use when user add / change his payment method, e.g add credit card details or bank account details
* @param {Paygilant.User} user
* @param {Paygilant.Payment} payment
* @param {Paygilant.Address} billingAddress
* @param {Any} additionalData
* @constructor
* @extends Paygilant.Checkpoint
*/
Paygilant.AddPaymentMethod = function (user, payment, billingAddress, additionalData) {
Paygilant.Checkpoint.call(this, Paygilant.CheckpointType.ADD_PAYMENT_METHOD, additionalData)
this.user = user
this.payment = payment
this.billingAddress = billingAddress
}
Paygilant.AddPaymentMethod.prototype = Object.create(Paygilant.Checkpoint.prototype)
Paygilant.AddPaymentMethod.prototype.constructor = Paygilant.AddPaymentMethod
Paygilant.AddPaymentMethod.parent = Paygilant.Checkpoint.prototype
/**
* Sets user's id/username after it is known
* @param {string} user_id
* @returns {Promise<Any>}
*/
Paygilant.setUserId = function (user_id) {
return getPromiseFromExec('setUserId', [user_id])
}
/**
* Sends info to Paygilant server that user has arrived to check point
* @alias Paygilant.arriveToCheckPoint
* @param {Paygilant.Checkpoint} checkPoint
* @returns {Promise<Any>}
*/
Paygilant.arriveToCheckPoint = function (checkPoint) {
return getPromiseFromExec('arriveToCheckPoint', [checkPoint])
}
/**
* Start screen listener
* @param {Paygilant.ScreenListenerType} screenListenerType - type of screen listener
* @returns {Promise<Any>}
*/
Paygilant.startScreenListener = function (screenListenerType) {
return getPromiseFromExec('startScreenListener', [screenListenerType])
}
/**
* Sends information that app is paused (standby, user switched to other app).
* Unless init() is invoked with skipPauseResumeHandling = true, this gets called automatically with Cordova's onpause event.
* @returns {Promise<Any>}
*/
Paygilant.pauseListenToSensors = function () {
return getPromiseFromExec('pauseListenToSensors', [])
}
/**
* Sends information that app is resumed (wake, user switched from other app).
* Unless init() is invoked with skipPauseResumeHandling = true, this gets called automatically with Cordova's onresume event.
* @returns {Promise<Any>}
*/
Paygilant.resumeListen = function () {
return getPromiseFromExec('resumeListen', [])
}
/**
* Gets risk for checkpoint
* @alias Paygilant.getRiskForCheckpoint
* @param {Paygilant.Checkpoint} checkPoint
* @returns {Promise<RiskForCheckPointResponse>} risk score
*/
Paygilant.getRiskForCheckPoint = function (checkPoint) {
return getPromiseFromExec('getRiskForCheckPoint', [checkPoint])
}
/**
* Updates checkpoint
* @param {Paygilant.CheckpointType} checkPointType - type of checkpoint
* @param {string} requestId - request id
* @param {Paygilant.CheckPointStatus} checkPointStatus - status of checkpoint
* @param {string} [transactionId] - transaction id
* @returns {Promise<Any>}
*/
Paygilant.updateCheckPointStatus = function (checkPointType, requestId, checkPointStatus, transactionId) {
return getPromiseFromExec('updateCheckPointStatus', [checkPointType, requestId, checkPointStatus, transactionId])
}
/**
* Sends the result of asking user for permission
* @param {string} permissionName
* @param {boolean} permissionResult - true if user allowed permission, false otherwise
* @returns {Promise<Any>}
*/
Paygilant.onRequestPermissionsResult = function (permissionName, permissionResult) {
return getPromiseFromExec('onRequestPermissionsResult', [0, [permissionName], [permissionResult ? 0 : -1]])
}
/**
* Initializes Paygilant service. This function must be invoked before any other Paygilant function
* @param {string} serverUrl - url address of Paygilant server
* @param {string} [userId] - userId or username (can be omitted if unknown)
* @returns {Promise<Any>}
*/
Paygilant.init = function (serverUrl, userId) {
return new Promise((resolve, reject) => {
getPromiseFromExec('init', [serverUrl, userId]).then(data => {
resolve(data)
}, error => {
reject(error)
})
})
}
module.exports = Paygilant