mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-17 06:52:27 +01:00
Fix a bug: invoice of reservation show payment by debit card when user pay with wallet
This commit is contained in:
parent
42f1213af7
commit
63a3bcf19a
@ -1,5 +1,7 @@
|
||||
# Changelog Fab Manager
|
||||
|
||||
- Fix a bug: invoice of reservation show payment by debit card when user pay with wallet
|
||||
|
||||
## v2.4.3 2016 November 21
|
||||
|
||||
- Export user's invoicing status in members' excel export
|
||||
|
3
app/exceptions/debit_wallet_error.rb
Normal file
3
app/exceptions/debit_wallet_error.rb
Normal file
@ -0,0 +1,3 @@
|
||||
# Raised when debit wallet fail
|
||||
class DebitWalletError < StandardError
|
||||
end
|
@ -406,8 +406,14 @@ class Reservation < ActiveRecord::Base
|
||||
if @wallet_amount_debit.present? and @wallet_amount_debit != 0
|
||||
amount = @wallet_amount_debit / 100.0
|
||||
wallet_transaction = WalletService.new(user: user, wallet: user.wallet).debit(amount, self)
|
||||
if !user.invoicing_disabled? and wallet_transaction
|
||||
self.invoice.update_columns(wallet_amount: @wallet_amount_debit, wallet_transaction_id: wallet_transaction.id)
|
||||
# wallet debit success
|
||||
if wallet_transaction
|
||||
# payment by online or (payment by local and invoice isnt disabled)
|
||||
if stp_invoice_id or !user.invoicing_disabled?
|
||||
self.invoice.update_columns(wallet_amount: @wallet_amount_debit, wallet_transaction_id: wallet_transaction.id)
|
||||
end
|
||||
else
|
||||
raise DebitWalletError
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user