Class: Spree::ReimbursementType::OriginalPayment Private

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

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

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

Methods included from Preferences::Preferable

#default_preferences, #defined_preferences, #get_preference, #has_preference!, #has_preference?, #preference_default, #preference_type, #set_preference

Class Method Details

.reimburse(reimbursement, return_items, simulate) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



5
6
7
8
9
10
11
# File 'app/models/spree/reimbursement_type/original_payment.rb', line 5

def reimburse(reimbursement, return_items, simulate)
  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