mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-29 18:52:22 +01: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
|
||||
case invoice.invoiced.reservable_type
|
||||
case invoice.invoiced.try(:reservable_type)
|
||||
### Machine reservation
|
||||
when 'Machine'
|
||||
details += I18n.t('invoices.machine_reservation_DESCRIPTION', DESCRIPTION: item.description)
|
||||
@ -136,6 +136,9 @@ module PDF
|
||||
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)
|
||||
end
|
||||
### wallet credit
|
||||
when nil
|
||||
details = item.description
|
||||
|
||||
### Other cases (not expected)
|
||||
else
|
||||
|
@ -51,5 +51,11 @@ class WalletService
|
||||
avoir.user_id = wallet_transaction.wallet.user_id
|
||||
avoir.total = wallet_transaction.amount * 100.0
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user