zippie-utils/reward

Methods

(async, inner) cancelPendingReward(userRef, rewardId)

Cancels a pending reward allocated with queuePendingReward

Parameters:
Name Type Description
userRef String

secure user reference

rewardId String

reward identifier

Source:

(async, inner) checkPhoneNumber(phonenumber)

Checks to see if a phone number has passed verification

Parameters:
Name Type Description
phonenumber String

Phone number to check

Source:

(async, inner) createOTP(phonenumber, message, referralCode, customer)

Create a One Time Password for phone number verification

Parameters:
Name Type Description
phonenumber String

Phone number to verify

message String

Message for the OTP SMS

referralCode String

Code for referral

customer String

Zippie Project ID

Source:

(async, inner) createPendingCheque(userRef, token, message)

Creates a pending payment with the current balance of a reward token

Parameters:
Name Type Description
userRef String

secure user reference

token String

reward token address

message String

display message for transaction

Source:

(async, inner) createReferralCode(userRef)

Creates a unique referral code for a user

Parameters:
Name Type Description
userRef String

secure user reference

Source:

(async, inner) finishReferral(phonenumber)

Set a phone number to claimed

Parameters:
Name Type Description
phonenumber String

phone number to finish referral process

Source:

(async, inner) getCheques(userRef, token)

Parameters:
Name Type Description
userRef String

secure user reference

token String

reward token address

Source:

(async, inner) getPendingRewards(userRef, tokenAddress)

List all the pending rewards for a user

Parameters:
Name Type Description
userRef String

secure user reference

tokenAddress String

token to list

Source:

(async, inner) getUserBalance(userRef, token) → {String}

Gets the current reward balance for a user

Parameters:
Name Type Description
userRef String

secure user reference

token String

reward token address

Source:

(async, inner) getUserIdFromReferralCode(referral_code)

Retrieves a secure user reference for a given referral code

Parameters:
Name Type Description
referral_code String

referral code generated by createReferralCode

Source:

(async, inner) getUserKey(userRef, key)

Gets a value for a stored key

Parameters:
Name Type Description
userRef String

secure user reference

key String

value to retrieve

Source:

(inner) getUserReference(userid) → {String}

Converts a local User Id into a secure value suitible for use with the Reward API

Parameters:
Name Type Description
userid String

local user id

Source:

(inner) init(prefix, privateKey, apiKey, uri)

Initialise Reward API with common values

Parameters:
Name Type Description
prefix String

secure salt

privateKey *
apiKey String

zippie service api key

uri String

Reward Service URI

Source:

(async, inner) markChequeClaimed(cheque)

Mark a cheque as claimed

Parameters:
Name Type Description
cheque String

cheque reference

Source:

(async, inner) queuePendingReward(userRef, amount, tokenAddress, message, expiry)

Queue a reward to be released later this will show up in the users transactions but cannot be used until released or expiry

Parameters:
Name Type Description
userRef String

secure user reference

amount String

amount to reward

tokenAddress String

token to reward

message String

message for user

expiry Date

when the condition will expire

Source:

(async, inner) registerWallet(userRef, walletAddress, token)

Parameters:
Name Type Description
userRef String

secure user reference

walletAddress String

users wallet address

token String

reward token address

Source:

(async, inner) releasePendingReward(userRef, rewardId)

Releases a pending reward allocated with queuePendingReward

Parameters:
Name Type Description
userRef String

secure user reference

rewardId String

reward identifier

Source:

(async, inner) resendOTP(phonenumber, message, customer)

Resends an One Time Password in case of non-delivery

Parameters:
Name Type Description
phonenumber String

Phone number to verify

message String

Message for the OTP SMS

customer String

Zippie Project ID

Source:

(async, inner) rewardTo(userRef, token, amount, message)

Adds an amount to the users pending reward balance

Parameters:
Name Type Description
userRef String

secure user reference

token String

reward token address

amount String

token amount to add

message String

reward description message, maximum 100 characters

Source:

(async, inner) sendEvent(jsonData)

Send generic event to reward api Events and actions can be defined in the rewards dashboard

Parameters:
Name Type Description
jsonData JSON

JSON Encoded event data

Source:

(async, inner) setUserKey(userRef, key, value)

Sets a Key Value pair for a user

Parameters:
Name Type Description
userRef String

secure user reference

key String

index key

value String

value to be stored

Source:

(async, inner) submitOTP(phonenumber, otpCode, customer)

Submits the One Time Password recieved for verificaiton

Parameters:
Name Type Description
phonenumber String

Phone number to verify

otpCode String

OTP received by SMS

customer String

zippie project id

Source: