Discounts/Codes/Methods

Discounts/Codes/Methods

Methods

(static) discounts/addCode(doc) → {String}

Source:
Parameters:
Name Type Description
doc Object

A Discounts document to be inserted

Returns:

Insert result

Type
String

(static) discounts/codes/credit(cartId, discountId, collections) → {Number}

calculates a credit off cart for discount codes

Source:
Parameters:
Name Type Description
cartId String

cartId

discountId String

discountId

collections Object

Map of MongoDB collections

Returns:

returns discount total

Type
Number

(static) discounts/codes/discount(cartId, discountId, collections) → {Number}

calculates percentage off discount rates

Source:
Parameters:
Name Type Description
cartId String

cartId

discountId String

discountId

collections Object

Map of MongoDB collections

Returns:

returns discount total

Type
Number

(static) discounts/codes/sale(cartId, discountId, collections) → {Number}

calculates a new price for an item

Source:
Parameters:
Name Type Description
cartId String

cartId

discountId String

discountId

collections Object

Map of MongoDB collections

Returns:

returns discount total

Type
Number

(static) discounts/codes/shipping(cartId, discountId, collections) → {Number}

calculates a discount based on the value of a calculated shipping rate in the cart.

Source:
Parameters:
Name Type Description
cartId String

cartId

discountId String

discountId

collections Object

Map of MongoDB collections

Returns:

returns discount total

Type
Number

(static) discounts/deleteCode(discountId) → {String}

Source:
Parameters:
Name Type Description
discountId String

discount id to delete

Returns:

returns remove result

Type
String

(static) discounts/editCode(details) → {String}

Source:
Parameters:
Name Type Description
details Object

An object with _id and modifier props

Returns:

Update result

Type
String