From 2223f1546fdaa3eac5c61e99c8619125f9f58a0f Mon Sep 17 00:00:00 2001 From: Caleb Denio Date: Thu, 21 Mar 2024 12:25:13 -0400 Subject: [PATCH] Properly handle Stripe refunds --- .../transaction/types/CardChargeTransaction.tsx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/components/transaction/types/CardChargeTransaction.tsx b/src/components/transaction/types/CardChargeTransaction.tsx index 90087b9..6d3ee9d 100644 --- a/src/components/transaction/types/CardChargeTransaction.tsx +++ b/src/components/transaction/types/CardChargeTransaction.tsx @@ -24,6 +24,8 @@ export default function CardChargeTransaction({ const navigation = useNavigation>(); + const isRefund = transaction.amount_cents > 0; + const badge = transaction.pending ? ( Pending @@ -39,7 +41,7 @@ export default function CardChargeTransaction({ {renderMoney(Math.abs(transaction.amount_cents))}{" "} - charge at + {isRefund ? "refund from" : "charge at"} {"\n"} {merchant.smart_name} @@ -51,9 +53,12 @@ export default function CardChargeTransaction({ value: merchant.name, }, descriptionDetail(orgId, transaction, navigation), - { label: "Spent on", value: renderDate(transaction.date) }, { - label: "Spent by", + label: isRefund ? "Refunded on" : "Spent on", + value: renderDate(transaction.date), + }, + { + label: isRefund ? "Refunded to" : "Spent by", value: , }, ]}