mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-04-10 00:53:51 +02:00
add invoice item to refund invoices for wallet credit
This commit is contained in:
parent
5a1abe409a
commit
3cdbecf74a
@ -121,7 +121,7 @@ module PDF
|
|||||||
|
|
||||||
|
|
||||||
else ### Reservation
|
else ### Reservation
|
||||||
case invoice.invoiced.reservable_type
|
case invoice.invoiced.try(:reservable_type)
|
||||||
### Machine reservation
|
### Machine reservation
|
||||||
when 'Machine'
|
when 'Machine'
|
||||||
details += I18n.t('invoices.machine_reservation_DESCRIPTION', DESCRIPTION: item.description)
|
details += I18n.t('invoices.machine_reservation_DESCRIPTION', DESCRIPTION: item.description)
|
||||||
@ -136,6 +136,9 @@ module PDF
|
|||||||
invoice.invoiced.tickets.each do |t|
|
invoice.invoiced.tickets.each do |t|
|
||||||
details += "\n "+I18n.t('invoices.other_rate_ticket', count: t.booked, NAME: t.event_price_category.price_category.name)
|
details += "\n "+I18n.t('invoices.other_rate_ticket', count: t.booked, NAME: t.event_price_category.price_category.name)
|
||||||
end
|
end
|
||||||
|
### wallet credit
|
||||||
|
when nil
|
||||||
|
details = item.description
|
||||||
|
|
||||||
### Other cases (not expected)
|
### Other cases (not expected)
|
||||||
else
|
else
|
||||||
|
@ -51,5 +51,11 @@ class WalletService
|
|||||||
avoir.user_id = wallet_transaction.wallet.user_id
|
avoir.user_id = wallet_transaction.wallet.user_id
|
||||||
avoir.total = wallet_transaction.amount * 100.0
|
avoir.total = wallet_transaction.amount * 100.0
|
||||||
avoir.save!
|
avoir.save!
|
||||||
|
|
||||||
|
ii = InvoiceItem.new
|
||||||
|
ii.amount = wallet_transaction.amount * 100.0
|
||||||
|
ii.description = I18n.t('invoices.wallet_credit')
|
||||||
|
ii.invoice = avoir
|
||||||
|
ii.save!
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user