promotion-calculation-engine
TypeScript icon, indicating that this package has built-in type declarations

0.2.12 • Public • Published

Promotion Calculation Engine

Utility Promotion Calculation with TypeScript

Installation

Use the node package manager npm to install foobar.

npm install

recommended node version: 12

How Calculation Engine Works

[Rules] -> [Calculate Engine] -> [Calculated Result]

Usage

import { CalculationEngine } from 'promotion-calculation-engine'

const calculationEngine = new CalculationEngine()
const calculateOrder = await calculationEngine.process({
    rules,
    items,
    deliveryAddresses,
    customer: {
      uniqueId: customer.id,
      email: customer.email,
      msisdn: customer.mobileNo,
      isNewCustomer: customer.isNewCustomer,
    } || null,
    usageCounts: [{
       salesRuleId: rule.id,
       total: 10,
       byCustomer: 1
    }],
  }, {
  
})
  

Test and Development

See example rules in test folder

To run all test rules use command

npm run test or yarn test

Readme

Keywords

none

Package Sidebar

Install

npm i promotion-calculation-engine

Weekly Downloads

17

Version

0.2.12

License

MIT

Unpacked Size

666 kB

Total Files

63

Last publish

Collaborators

  • muze
  • peatiscoding