diff --git a/app/views/api/v4/transactions/_transaction.json.jbuilder b/app/views/api/v4/transactions/_transaction.json.jbuilder index ddbd9f6015..def378ba88 100644 --- a/app/views/api/v4/transactions/_transaction.json.jbuilder +++ b/app/views/api/v4/transactions/_transaction.json.jbuilder @@ -3,6 +3,8 @@ # This partial is capable of rendering `HcbCode`, `CanonicalPendingTransaction`, and `CanonicalTransactionGrouped` instances hcb_code = tx.is_a?(HcbCode) ? tx : tx.local_hcb_code +is_cpt = tx.is_a?(CanonicalPendingTransaction) +is_hcb_code = tx.is_a?(HcbCode) amount = transaction_amount(tx, event: @event) json.id hcb_code.public_id @@ -10,8 +12,9 @@ json.date tx.date json.amount_cents amount json.memo hcb_code.memo(event: @event) json.has_custom_memo hcb_code.custom_memo.present? -json.pending (tx.is_a?(CanonicalPendingTransaction) && tx.unsettled?) || (tx.is_a?(HcbCode) && !tx.pt&.fronted? && tx.pt&.unsettled?) -json.declined (tx.is_a?(CanonicalPendingTransaction) && tx.declined?) || (tx.is_a?(HcbCode) && tx.pt&.declined?) +json.pending (is_cpt && tx.unsettled?) || (is_hcb_code && !tx.pt&.fronted? && tx.pt&.unsettled?) +json.declined (is_cpt && tx.declined?) || (is_hcb_code && tx.pt&.declined?) +json.reversed (is_cpt && tx.raw_pending_stripe_transaction&.stripe_transaction&.dig("status") == "reversed") || (is_hcb_code && tx.stripe_reversed_by_merchant?) json.tags hcb_code.tags do |tag| json.id tag.public_id json.label tag.label