Class: SolidusAfterpay::UpdateOrderAddressesService

Inherits:
BaseService
  • Object
show all
Defined in:
app/services/solidus_afterpay/update_order_addresses_service.rb

Instance Method Summary collapse

Methods inherited from BaseService

call

Constructor Details

#initialize(order:, address_params:) ⇒ UpdateOrderAddressesService

Returns a new instance of UpdateOrderAddressesService.



5
6
7
8
9
10
# File 'app/services/solidus_afterpay/update_order_addresses_service.rb', line 5

def initialize(order:, address_params:)
  @order = order
  @address_params = address_params

  super()
end

Instance Method Details

#callObject



12
13
14
15
16
17
18
# File 'app/services/solidus_afterpay/update_order_addresses_service.rb', line 12

def call
  order.state = 'address'
  order.email = SolidusAfterpay.configuration.dummy_email if order.email.blank?
  order.ship_address_attributes = address_object
  order.bill_address_attributes = address_object
  order.save
end