couponable
Advanced tools
Comparing version 6.0.0 to 6.0.1
@@ -35,3 +35,3 @@ // if the comma or decimal portions of the price need internationalization | ||
var quantity = orderItem.quantity || 0, | ||
total = orderItem.priceInCents; | ||
total = orderItem.priceInCents; | ||
@@ -43,2 +43,6 @@ if (orderItem.variation) { | ||
if (orderItem.coupon) { | ||
if (orderItem.purchasableType === 'bundle' && quantity > 1) { | ||
total = total * quantity; | ||
quantity = 1; | ||
} | ||
total = Math.round(discountable(total, orderItem.coupon.percentOff, orderItem.coupon.amountOffInCents)); | ||
@@ -45,0 +49,0 @@ } |
{ | ||
"name": "couponable", | ||
"description": "Helper functions for dealing with coupons.", | ||
"version": "6.0.0", | ||
"version": "6.0.1", | ||
"author": "Chris McC", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
@@ -33,2 +33,11 @@ var couponable = require('.'); | ||
}); | ||
it('handles coupons for bundles correctly', function() { | ||
assert.equal(totalDueNow({ | ||
quantity: 10, | ||
coupon: {amountOffInCents: 5}, | ||
priceInCents: 10, | ||
purchasableType: 'bundle' | ||
}), 95) | ||
}); | ||
}); | ||
@@ -35,0 +44,0 @@ |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
13222
387
1