Coupon
Coupon — discount coupons generator. Coupon is designed to be the simplest way possible to create a discount coupons for e-commerce purposes.
Installation
npm install coupon
Usage:
var coupon = ;var myCoupon = ;console;
Examples:
5% discount coupon for anyone
var coupon = ;var myCoupon = ;console;
id: 'W0YEPW913C8M279D0ECV2P5P0C11QAV1' name: 'HELLO-5' discount: 005
20% one-time discount coupon for John
var coupon = ;var myCoupon = ;console;
id: 'K5PL08XU1GG71T9VW00Y4CEUJFVPMM2F' name: 'HELLO-JOHN' user: 'John' countMax: 1 discount: 02
API
give()
Specifies amount of discount.
;
or
;
You can pass "free" string
;
person()
Specifies user
;
limit()
Specifies how many times you can use coupon
;
expire()
Specifies expiration date of coupon
;
only()
Specifies the service
;
json()
Generate JSON object
;
Test
npm test
License
Licensed under the MIT license
Copyright © 2014 Roman Timashev roman@tmshv.ru (http://roman.tmshv.ru)