@magic.batua/points
Version:
The Points module powers the loyalty points features of the Magic Batua platform.
1,162 lines (236 loc) • 13.5 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>Ledger - Postman Documentation</title>
<script src="scripts/prettify/prettify.js"></script>
<script src="scripts/prettify/lang-css.js"></script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/ionicons.min.css">
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<input type="checkbox" id="nav-trigger" class="nav-trigger" />
<label for="nav-trigger" class="navicon-button x">
<div class="navicon"></div>
</label>
<label for="nav-trigger" class="overlay"></label>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Ledger.html">Ledger</a><ul class='methods'><li data-type='method'><a href="Ledger.html#count">count</a></li><li data-type='method'><a href="Ledger.html#Issue">Issue</a></li><li data-type='method'><a href="Ledger.html#MakeReferralsRedeemable">MakeReferralsRedeemable</a></li><li data-type='method'><a href="Ledger.html#MakeSignupRedeemable">MakeSignupRedeemable</a></li><li data-type='method'><a href="Ledger.html#Redeem">Redeem</a></li></ul></li><li><a href="Transaction.html">Transaction</a></li></ul><h3>Modules</h3><ul><li><a href="module-Points.html">Points</a><ul class='methods'><li data-type='method'><a href="module-Points.html#~ToReferrerFor">ToReferrerFor</a></li><li data-type='method'><a href="module-Points.html#~ToSelfFor">ToSelfFor</a></li></ul></li></ul>
</nav>
<div id="main">
<h1 class="page-title">Ledger</h1>
<section>
<header>
<h2>
Ledger
</h2>
<div class="class-description"><p>The Points Ledger keeps track of a user's Magic Points, their status, their availability
and other points related arithmetic.</p>
<p> Magic Points are awarded to users as rewards for continued usage and word-of-mouth publicity.
The points are rewarded as following:</p>
<ul>
<li><p>600 points at signup. These points aren't redeemable until you've spent ₹1,000 or more on the
Magic Batua platform.</p>
</li>
<li><p>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.</p>
</li>
<li><p>1 point for mobile recharge. Redeemable immediately. If were referred by someone, their account
is credited with a point too.</p>
</li>
<li><p>20 points for tuition fee payments. Redeemable immediately. If were referred by someone, their
account is credited with 20 points too.</p>
<p>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.</p>
</li>
</ul></div>
</header>
<article>
<div class="container-overview">
<h2>Constructor</h2>
<h4 class="name" id="Ledger"><span class="type-signature"></span>new Ledger<span class="signature">()</span><span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line41">line 41</a>
</li></ul></dd>
</dl>
</div>
<h3 class="subsection-title">Members</h3>
<h4 class="name" id="available"><span class="type-signature"></span>available<span class="type-signature"></span></h4>
<div class="description">
<p>Number of points available for redemption</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line44">line 44</a>
</li></ul></dd>
</dl>
<h4 class="name" id="expired"><span class="type-signature"></span>expired<span class="type-signature"></span></h4>
<div class="description">
<p>Points that have expired.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line58">line 58</a>
</li></ul></dd>
</dl>
<h4 class="name" id="redeemable"><span class="type-signature"></span>redeemable<span class="type-signature"></span></h4>
<div class="description">
<p>Number of points accured since the creation of account</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line56">line 56</a>
</li></ul></dd>
</dl>
<h4 class="name" id="redeemed"><span class="type-signature"></span>redeemed<span class="type-signature"></span></h4>
<div class="description">
<p>Points that have been redeemed since the creation of account</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line60">line 60</a>
</li></ul></dd>
</dl>
<h4 class="name" id="referral"><span class="type-signature"></span>referral<span class="type-signature"></span></h4>
<div class="description">
<p>Points earned through referrals. Becomes redeemable once the account has accrued
10 or more referrals.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line54">line 54</a>
</li></ul></dd>
</dl>
<h4 class="name" id="refunded"><span class="type-signature"></span>refunded<span class="type-signature"></span></h4>
<div class="description">
<p>Points that have been refunded</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line62">line 62</a>
</li></ul></dd>
</dl>
<h4 class="name" id="signup"><span class="type-signature"></span>signup<span class="type-signature"></span></h4>
<div class="description">
<p>Points earned at signup. Becomes redeemable once the account has spent
₹1,000 or more on the Magic Batua platform.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line49">line 49</a>
</li></ul></dd>
</dl>
<h4 class="name" id="transactions"><span class="type-signature"></span>transactions<span class="type-signature"></span></h4>
<div class="description">
<p>Points transactions listing all the issuance, redemption and refund transactions.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line64">line 64</a>
</li></ul></dd>
</dl>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id="count"><span class="type-signature"></span>count<span class="signature">(transactions)</span><span class="type-signature"></span></h4>
<div class="description">
<p>Goes over all point transactions one by one and separates all the points
in their respective baskets.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>transactions</code></td>
<td class="type">
</td>
<td class="description last"><p>An array of Points <code>Transaction</code></p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line77">line 77</a>
</li></ul></dd>
</dl>
<h4 class="name" id="Issue"><span class="type-signature"></span>Issue<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
<p>Issues a Magic Point for the given <code>reason</code></p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line113">line 113</a>
</li></ul></dd>
</dl>
<h4 class="name" id="MakeReferralsRedeemable"><span class="type-signature"></span>MakeReferralsRedeemable<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
<p>This method will be called by the <code>Account</code> module when the condition for
unlocking signup bonus is met.
To move points from Referrals bucket <code>this.signup</code> to Redeemable bucket <code>this.redeemable</code>,
we change the <code>notes</code> property of signup points issuance from "Signup" to
"Referral points can be redeemed now.".</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line163">line 163</a>
</li></ul></dd>
</dl>
<h4 class="name" id="MakeSignupRedeemable"><span class="type-signature"></span>MakeSignupRedeemable<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
<p>This method will be called by the <code>Account</code> module when the condition for
unlocking signup bonus is met.
To move points from Signup bucket <code>this.signup</code> to Redeemable bucket <code>this.redeemable</code>,
we change the <code>notes</code> property of signup points issuance from "Signup" to
"Signup Points become active".</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line148">line 148</a>
</li></ul></dd>
</dl>
<h4 class="name" id="Redeem"><span class="type-signature"></span>Redeem<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
<p>Redeems <code>points</code> from the balance</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line126">line 126</a>
</li></ul></dd>
</dl>
</article>
</section>
</div>
<br class="clear">
<footer>
Documentation generated at Tue Mar 20 2018 02:33:08 GMT+0530 (IST)
</footer>
<script>prettyPrint();</script>
<script src="scripts/linenumber.js"></script>
</body>
</html>