Ledger

Ledger

The Points Ledger keeps track of a user's Magic Points, their status, their availability and other points related arithmetic.

Magic Points are awarded to users as rewards for continued usage and word-of-mouth publicity. The points are rewarded as following:

  • 600 points at signup. These points aren't redeemable until you've spent ₹1,000 or more on the Magic Batua platform.

  • 400 points if somebody signs up using your referral code. These points become redeemable once you've amassed 10 or more referrals, and each of those referrals have spent ₹1,000 or more.

  • 1 point for mobile recharge. Redeemable immediately. If were referred by someone, their account is credited with a point too.

  • 20 points for tuition fee payments. Redeemable immediately. If were referred by someone, their account is credited with 20 points too.

    To manage the points logic, we make use of three buckets: Signup, Referrals and Available. As points earned through Signup and Referrals become redeemable they are emptied into the Available bucket. Points earned through other activities such as mobile recharge or tuition fee payment are credited to the Available bucket straightaway.

Constructor

new Ledger()

Source:

Members

available

Number of points available for redemption

Source:

expired

Points that have expired.

Source:

redeemable

Number of points accured since the creation of account

Source:

redeemed

Points that have been redeemed since the creation of account

Source:

referral

Points earned through referrals. Becomes redeemable once the account has accrued 10 or more referrals.

Source:

refunded

Points that have been refunded

Source:

signup

Points earned at signup. Becomes redeemable once the account has spent ₹1,000 or more on the Magic Batua platform.

Source:

transactions

Points transactions listing all the issuance, redemption and refund transactions.

Source:

Methods

count(transactions)

Goes over all point transactions one by one and separates all the points in their respective baskets.

Parameters:
Name Type Description
transactions

An array of Points Transaction

Source:

Issue()

Issues a Magic Point for the given reason

Source:

MakeReferralsRedeemable()

This method will be called by the Account module when the condition for unlocking signup bonus is met. To move points from Referrals bucket this.signup to Redeemable bucket this.redeemable, we change the notes property of signup points issuance from "Signup" to "Referral points can be redeemed now.".

Source:

MakeSignupRedeemable()

This method will be called by the Account module when the condition for unlocking signup bonus is met. To move points from Signup bucket this.signup to Redeemable bucket this.redeemable, we change the notes property of signup points issuance from "Signup" to "Signup Points become active".

Source:

Redeem()

Redeems points from the balance

Source: