feat(medusa, admin-ui): Improve gift card application (#4944)
Fix for the problems identified in issue #4892 Bugfix: admin-ui order summary no longer uses gift card total from order when displaying how much has been withdrawn from each giftcard. Bugfix(?): no longer keep applying gift cards (at 0 value) when sufficient balance has been reached Feature: multiple giftcards are now applied in ordered fashion. First by end_date (supports null), then by remaining balance. In order to ensure that customers ends up with as long lasting and few remaining gift cards as possible after the transaction.
This commit is contained in:
1 parent
9f16c90f99
commit
11fb523051
4 files changed
+199
-6
No files matched your search
@@ -9,6 +9,7 @@ export type GiftCardFactoryData = {
|
||||
value: number
|
||||
balance: number
|
||||
tax_rate?: number
|
||||
ends_at?: Date
|
||||
}
|
||||
|
||||
export const simpleGiftCardFactory = async (
|
||||
@@ -29,6 +30,7 @@ export const simpleGiftCardFactory = async (
|
||||
value: data.value,
|
||||
balance: data.balance,
|
||||
tax_rate: data.tax_rate,
|
||||
ends_at: data.ends_at
|
||||
})
|
||||
|
||||
return await manager.save(toSave)
|
||||
|
||||
Reference in new issue
Block a user