Sha256: c4fab33993b8b1be13a1023e5da07b1c9927f606efe4b09d6a087d2148afdb3e

Contents?: true

Size: 658 Bytes

Versions: 10

Compression:

Stored size: 658 Bytes

Contents

# frozen_string_literal: true

module SolidusBolt
  module SpreeCheckoutController
    module AddAddressesToBolt
      def finalize_order
        if session[:bolt_access_token] && current_order.payments.last&.source_type == "SolidusBolt::PaymentSource"
          spree_current_user.addresses.each do |address|
            SolidusBolt::AddAddressJob.perform_later(
              order: current_order,
              access_token: SolidusBolt::Users::RefreshAccessTokenService.call(session: session),
              address: address
            )
          end
        end

        super
      end

      Spree::CheckoutController.prepend self
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
solidus_bolt-0.7.2 app/decorators/controllers/solidus_bolt/spree_checkout_controller/add_addresses_to_bolt.rb
solidus_bolt-0.7.1 app/decorators/controllers/solidus_bolt/spree_checkout_controller/add_addresses_to_bolt.rb
solidus_bolt-0.7.0 app/decorators/controllers/solidus_bolt/spree_checkout_controller/add_addresses_to_bolt.rb
solidus_bolt-0.6.0 app/decorators/controllers/solidus_bolt/spree_checkout_controller/add_addresses_to_bolt.rb
solidus_bolt-0.5.0 app/decorators/controllers/solidus_bolt/spree_checkout_controller/add_addresses_to_bolt.rb
solidus_bolt-0.4.0 app/decorators/controllers/solidus_bolt/spree_checkout_controller/add_addresses_to_bolt.rb
solidus_bolt-0.3.0 app/decorators/controllers/solidus_bolt/spree_checkout_controller/add_addresses_to_bolt.rb
solidus_bolt-0.2.0 app/decorators/controllers/solidus_bolt/spree_checkout_controller/add_addresses_to_bolt.rb
solidus_bolt-0.1.0 app/decorators/controllers/solidus_bolt/spree_checkout_controller/add_addresses_to_bolt.rb
solidus_bolt-0.0.1 app/decorators/controllers/solidus_bolt/spree_checkout_controller/add_addresses_to_bolt.rb