vendure-ecommerce/vendure-plus-issues

Giftcards can be applied 2 times

Closed this issue · 1 comments

mutation {
  result: applyGiftCardToOrder(code: "K3QJRL") {
    ... on Order {
      totalWithTaxAfterGiftCard
      giftCardsApplied {
        code
      }
    }
    ... on ErrorResult {
      errorCode
      message
    }
  }
}

When running this mutation 2 times, I get this result:

{
  "data": {
    "result": {
      "totalWithTaxAfterGiftCard": 397900,
      "giftCardsApplied": [
        {
          "code": "K3QJRL"
        },
        {
          "code": "K3QJRL"
        }
      ]
    }
  }
}

The total amount is reduced by 2x the giftcard value. Subsequent mutations don't add a 3rd giftcard.
When running removeGiftCardFromOrder, both giftcards get removed.

Expected behaviour

The giftcard schould only be appliable once.

Thanks for the report! This is fixed in v0.1.3 which was just published :)