Merge branch 'develop' into feat/add-to-wishlist-extension

This commit is contained in:
Vilfred Sikker
2021-08-27 11:21:17 +02:00
144 changed files with 38978 additions and 11657 deletions
File diff suppressed because it is too large Load Diff
@@ -246,6 +246,7 @@ export default async (req, res) => {
amount: Validator.number()
.integer()
.required(),
sale_amount: Validator.number().optional(),
})
.xor("region_id", "currency_code")
),
@@ -330,6 +330,7 @@ describe("TotalsService", () => {
{
id: "line2",
unit_price: 100,
allow_discounts: true,
variant: {
id: "variant",
product_id: "product2",
@@ -349,6 +350,7 @@ describe("TotalsService", () => {
{
id: "line2",
unit_price: 100,
allow_discounts: true,
variant: {
id: "variant",
product_id: "product2",
@@ -368,6 +370,7 @@ describe("TotalsService", () => {
{
id: "line",
unit_price: 100,
allow_discounts: true,
variant: {
id: "variant",
product_id: "product",
@@ -386,6 +389,7 @@ describe("TotalsService", () => {
{
id: "line2",
unit_price: 100,
allow_discounts: true,
variant: {
id: "variant",
product_id: "testp2",
@@ -404,6 +408,7 @@ describe("TotalsService", () => {
{
id: "line2",
unit_price: 100,
allow_discounts: true,
variant: {
id: "variant",
product_id: "testp2",
@@ -422,6 +427,7 @@ describe("TotalsService", () => {
{
id: "notInOrder",
unit_price: 123,
allow_discounts: true,
variant: {
id: "variant",
product_id: "pid",
+2 -1
View File
@@ -122,7 +122,7 @@ class TotalsService extends BaseService {
const discount = discounts.find(({ rule }) => rule.type !== "free_shipping")
if (!discount) {
if (!discount || !lineItem.allow_discounts) {
return lineItem.unit_price * lineItem.quantity * (1 + taxRate)
}
@@ -168,6 +168,7 @@ class TotalsService extends BaseService {
return this.getLineItemRefund(order, i)
})
return this.rounded(refunds.reduce((acc, next) => acc + next, 0))
}