Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions app/views/api/v4/transactions/_transaction.json.jbuilder
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@
# 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
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
Expand Down