UNPKG

@magic.batua/points

Version:

The Points module powers the loyalty points features of the Magic Batua platform.

94 lines (73 loc) 3.4 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Source/Transaction.js - 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">Source/Transaction.js</h1> <section> <article> <pre class="prettyprint source linenums"><code>"use strict"; /** * @module Transaction * @overview Defines the points transactions logic and interfaces * * @author Animesh Mishra &lt;hello@animesh.ltd> * @copyright © 2018 Animesh Ltd. All Rights Reserved. */ Object.defineProperty(exports, "__esModule", { value: true }); const mongodb_1 = require("mongodb"); const milliSecondsInAYear = 31557600000; /** * Operations such as issuance, redemptions, rollback, refund etc. are classified as Points * Transactions and managed by the `Transaction` class. * * Each `transaction` carries a unique `_id`. */ class Transaction { /** * Initialises a Points `Transaction` instance. * * @param {InitTransaction} json See `Source/Transaction.ts` for definition * of `InitTransaction`. */ constructor(json) { this._id = json._id || new mongodb_1.ObjectID().toHexString(); this.points = json.points; this.type = json.type; this.date = json.date ? new Date(json.date) : new Date(); this.notes = json.notes; this.expiryDate = json.expiryDate ? new Date(json.expiryDate) : new Date(Date.now() + milliSecondsInAYear); } } exports.Transaction = Transaction; //# sourceMappingURL=Transaction.js.map</code></pre> </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>