Utility Promotion Calculation with TypeScript
Use the node package manager npm to install foobar.
npm install
recommended node version: 12
[Rules] -> [Calculate Engine] -> [Calculated Result]
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
}],
}, {
})
See example rules in test folder
To run all test rules use command