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:
@@ -221,20 +221,20 @@ const SummaryCard: React.FC<SummaryCardProps> = ({ order, reservations }) => {
|
||||
}
|
||||
/>
|
||||
))}
|
||||
{order?.gift_cards?.map((giftCard, index) => (
|
||||
{order?.gift_card_transactions?.map((gcTransaction, index) => (
|
||||
<DisplayTotal
|
||||
key={index}
|
||||
currency={order.currency_code}
|
||||
totalAmount={-1 * order.gift_card_total}
|
||||
totalAmount={-1 * gcTransaction.amount}
|
||||
totalTitle={
|
||||
<div className="inter-small-regular text-grey-90 flex items-center">
|
||||
Gift card:
|
||||
<Badge className="ml-3" variant="default">
|
||||
{giftCard.code}
|
||||
{gcTransaction.gift_card.code}
|
||||
</Badge>
|
||||
<div className="ml-2">
|
||||
<CopyToClipboard
|
||||
value={giftCard.code}
|
||||
value={gcTransaction.gift_card.code}
|
||||
showValue={false}
|
||||
iconSize={16}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user