Class: ReimbursementShipping

Inherits:
Object
  • Object
show all
Includes:
Spree::ReimbursementType::ReimbursementHelpers
Defined in:
app/models/reimbursement_shipping.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(reimbursement) ⇒ ReimbursementShipping

Returns a new instance of ReimbursementShipping.



7
8
9
10
# File 'app/models/reimbursement_shipping.rb', line 7

def initialize(reimbursement)
  @order         = reimbursement.order
  @reimbursement = reimbursement
end

Instance Attribute Details

#orderObject (readonly)

Returns the value of attribute order.



3
4
5
# File 'app/models/reimbursement_shipping.rb', line 3

def order
  @order
end

#reimbursementObject

Returns the value of attribute reimbursement.



2
3
4
# File 'app/models/reimbursement_shipping.rb', line 2

def reimbursement
  @reimbursement
end

Instance Method Details

#update!(shipping_amount) ⇒ Object



12
13
14
15
# File 'app/models/reimbursement_shipping.rb', line 12

def update!(shipping_amount)
  reimbursement.update!(total: calculated_amount(shipping_amount))
  create_refund_payment!(shipping_amount)
end