Skip to content

Commit

Permalink
verifyings
Browse files Browse the repository at this point in the history
  • Loading branch information
qinmingyuan committed Jan 1, 2025
1 parent 1563b9f commit 4600769
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/models/trade/model/order.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ module Model::Order
attribute :refunded_amount, :decimal, default: 0
attribute :unreceived_amount, :decimal
attribute :payable_amount, :decimal
attribute :verifying_amount, :decimal, comment: '待核销金额'

enum :aim, {
use: 'use',
Expand Down Expand Up @@ -349,6 +350,10 @@ def compute_received_amount
self.received_amount = self.payment_orders.select(&:state_confirmed?).sum(&:order_amount)
end

def compute_verifying_amount
self.verifying_amount = self.payment_orders.select(&:state_pending?).sum(&:order_amount)
end

def computed_payable_amount
self.payable_amount - self.payment_orders.select(&:paid?).sum(&:order_amount)
end
Expand Down Expand Up @@ -436,6 +441,8 @@ def batch_pending_payments(params)
self.payment_orders.build po_params
end
end
self.compute_verifying_amount
self.payment_status = 'to_check'
end

def init_wallet_payments(order_amount: computed_payable_amount)
Expand Down

0 comments on commit 4600769

Please sign in to comment.