Class: Spree::ReimbursementType::OriginalPayment

Inherits:
Spree::ReimbursementType show all
Extended by:
ReimbursementHelpers
Defined in:
core/app/models/spree/reimbursement_type/original_payment.rb

Constant Summary

Constants inherited from Spree::ReimbursementType

ORIGINAL

Instance Attribute Summary

Attributes included from ReimbursementHelpers

#eligible_refund_methods

Class Method Summary collapse

Methods included from ReimbursementHelpers

create_credits, create_refunds

Methods inherited from Base

display_includes, #initialize_preference_defaults, page, preference

Class Method Details

.reimburse(reimbursement, return_items, simulate, _created_by) ⇒ Object



7
8
9
10
11
12
13
# File 'core/app/models/spree/reimbursement_type/original_payment.rb', line 7

def reimburse(reimbursement, return_items, simulate, _created_by)
  unpaid_amount = return_items.sum(&:total).round(2, :down)
  payments = reimbursement.order.payments.completed

  refund_list, _unpaid_amount = create_refunds(reimbursement, payments, unpaid_amount, simulate)
  refund_list
end