adds ability to update balance to 0 and adds integration test (#1036)

This commit is contained in:
Kasper Fabricius Kristensen
2022-02-10 09:11:32 +01:00
committed by GitHub
parent 38b2e51cbb
commit ff9e2e58cb
2 changed files with 31 additions and 1 deletions
+1 -1
View File
@@ -261,7 +261,7 @@ class GiftCardService extends BaseService {
giftCard.metadata = await this.setMetadata_(giftCard.id, metadata)
}
if (balance) {
if (typeof balance !== "undefined") {
if (balance < 0 || giftCard.value < balance) {
throw new MedusaError(
MedusaError.Types.INVALID_ARGUMENT,