ExposedMethods.js

/**
 * @module Methods
 */

/**
 * @description Identifies, authenticates and authorizes user and returns user ID together with content state
 * @param  {String} token JWT token, signed with HS265 alorithm, containing purchase payload
 * @async
 * @function identifyClient
 * @returns {Promise} Promise that returns object containing UserId, contentId, contentState, subscripionState, challengeId and allowedMethods.
 * @throws {error} throws error containing error code and reason if function fails.
 */
export async function identifyClient(token) {

}
/**
 * @description Initializes one time purchase. Returns success, failure or need for SMS authentication
 * @param {Object} purchase input object containing token and userId
 * @param {String} purchase.token JWT token, signed with HS265 alorithm, containing purchase payload
 * @param {String} purchase.userId Zlick userID
 * @async
 * @function purchase
 * @returns {Promise} Promise that returns object containing UserId, contentId, contentState, subscripionState, challengeId and allowedMethods.
 * @throws {error} throws error containing error code and reason if function fails.
 */
export async function purchase({token, userId}) {

}
/**
 * @description subsribes to monthly / weekly / daily subscription
 * @param {Object} subscribe input object containing token and userId
 * @param {String} subscribe.token JWT token, signed with HS265 alorithm, containing purchase payload
 * @param {String} subscribe.userId Zlick userID
 * @async
 * @function subscribe
 * @returns {Promise} Promise that returns object containing UserId, contentId, contentState, subscripionState, challengeId and allowedMethods.
 * @throws {error} throws error containing error code and reason if function fails.
 */
export async function subscribe({token, userId}) {

}
/**
 * @description Cancels subsription. Content will be availabe to user until expire datet. 
 * @param {Object} unsubscribe input object containing token and userId
 * @param {String} unsubscribe.token JWT token, signed with HS265 alorithm, containing purchase payload
 * @param {String} unsubscribe.userId Zlick userID
 * @async
 * @function unsubscribe
 * @returns {Promise} Promise that returns object containing UserId, contentId, contentState, subscripionState, challengeId and allowedMethods.
 * @throws {error} throws error containing error code and reason if function fails.
 */
export async function unsubscribe({token, userId}) {

}
/**
 * @description Refunds purchase and cancels permission to view content
 * @param {Object} refundPurchase input object containing token and userId
 * @param {String} refundPurchase.token JWT token, signed with HS265 alorithm, containing purchase payload
 * @param {String} refundPurchase.userId Zlick userID
 * @param {string} refundPurchase.refundReason reason to refund purchase
 * @async
 * @function refundPurchase
 * @returns {Promise} Promise that returns object containing UserId, contentId, contentState, subscripionState, challengeId and allowedMethods.
 * @throws {error} throws error containing error code and reason if function fails.
 */
export async function refundPurchase({token, userId, refundReason}) {

}
/**
 * @description Starts SMS authentication
 * @param {Object} sendPinCodeSMS input object containing token and userId
 * @param  {String} sendPinCodeSMS.token JWT token, signed with HS265 alorithm, containing purchase payload
 * @param {String} sendPinCodeSMS.mobilePhoneNumber customer mobile number that starts SMS authentication
 * @async
 * @function sendPinCodeSMS
 * @returns {Promise} Promise that returns object containing UserId, contentId, contentState, subscripionState, challengeId and allowedMethods.
 * @throws {error} throws error containing error code and reason if function fails.
 */
export async function sendPinCodeSMS({token, mobilePhoneNumber}) {

}
/**
 * @description completes SMS authentication
 * @param {Object} verifyPinCode input object containing token and userId
 * @param {String} verifyPinCode.token JWT token, signed with HS265 alorithm, containing purchase payload
 * @param {String} verifyPinCode.confirmationCode 4 digit confirmation code sent to customers mobile number via SMS
 * @param {String} verifyPinCode.challengeId id created by zlick and sent via smsAuthStart method to verify mobile number and challenge ID
 * @async
 * @function verifyPinCode
 * @returns {Promise} Promise that returns object containing UserId, contentId, contentState, subscripionState, challengeId and allowedMethods.
 * @throws {error} throws error containing error code and reason if function fails.
 */
export async function verifyPinCode({token, confirmationCode, challengeId}) {

}