@magic.batua/points
Version:
The Points module powers the loyalty points features of the Magic Batua platform.
72 lines (68 loc) • 2.07 kB
text/typescript
/**
* @module Points
* @overview Defines the points distribution for various services available on
* Magic Batua.
*
* @author Animesh Mishra <hello@animesh.ltd>
* @copyright © 2018 Animesh Ltd. All Rights Reserved.
*/
/** @exports Points */
export var description = "Defines points distribution table."
/**
* Returns the number of points that must be awarded to the account carrying
* out the transaction for the `service`.
*
* A `service` is one of the transaction categories supported by the Magic Batua
* platform. At the time of writing, points were only awarded for the following
* three services:
*
* - Signup
* - College Fees
* - Mobile Prepaid
*
* @param {service} service Name of the service used
*
* @returns {number} Number of points that must be credited to the transaction
* maker's account.
*/
export function ToSelfFor(service: string): number {
switch(service) {
case "Signup":
return 600
case "College Fees":
return 20
case "Mobile Prepaid":
return 1
default:
return 0
}
}
/**
* Returns the number of points that must be awarded to the referrer of the account
* that is carrying out the transaction for the `service`.
*
* A `service` is one of the transaction categories supported by the Magic Batua
* platform. At the time of writing, points were only awarded for the following
* three services:
*
* - Signup
* - College Fees
* - Mobile Prepaid
*
* @param {service} service Name of the service used
*
* @returns {number} Number of points that must be credited to the transaction
* maker's referrer.
*/
export function ToReferrerFor(service: string): number {
switch (service) {
case "Signup":
return 400
case "College Fees":
return 20
case "Mobile Prepaid":
return 1
default:
return 0
}
}