From 8fa9567eae2593474c58b63de7aad17893bbcc5c Mon Sep 17 00:00:00 2001 From: Du Peng Date: Tue, 7 Nov 2023 09:34:02 +0100 Subject: [PATCH] (bug) unable to show wallet payment mean for avoir --- CHANGELOG.md | 2 ++ app/models/invoice.rb | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index af4147f3b..d401cf56d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Changelog Fab-manager +- Fix a bug: unable to show wallet payment mean for avoir + ## v6.3.0 2023 November 3 - Fix a bug: fix all failing tasks of rake task file chain.rake diff --git a/app/models/invoice.rb b/app/models/invoice.rb index b607fd08a..63f8fd04d 100644 --- a/app/models/invoice.rb +++ b/app/models/invoice.rb @@ -160,7 +160,9 @@ class Invoice < PaymentDocument # return a summary of the payment means used def payment_means res = [] - res.push(means: :wallet, amount: wallet_amount) if paid_by_wallet? + res.push(means: :wallet, amount: wallet_amount || total) if paid_by_wallet? + return res if is_a?(Avoir) + if paid_by_card? res.push(means: :card, amount: amount_paid) else @@ -195,7 +197,7 @@ class Invoice < PaymentDocument end def paid_by_wallet? - wallet_transaction && wallet_amount.positive? + (wallet_transaction && wallet_amount.positive?) || payment_method == 'wallet' end def render_resource