Sha256: 114f3ad5a38ad9478b6ecd3b3c31012476952c6ad5e598a149d63893cd021851

Contents?: true

Size: 759 Bytes

Versions: 1

Compression:

Stored size: 759 Bytes

Contents

module Workarea
  module FlowIo
    class CheckoutTokenForm
      def self.from(order:, session_id:)
        new(order: order, session_id: session_id).to_flow_model
      end

      attr_reader :order, :session_id

      def initialize(order:, session_id:)
        @order = order
        @session_id = session_id
      end

      def to_flow_model
        ::Io::Flow::V0::Models::CheckoutTokenReferenceForm.new(attributes)
      end

      def attributes
        {
          order_number: order.id,
          session_id: session_id,
          urls: {
            continue_shopping: continue_shopping_url
          }
        }
      end

      private

        def continue_shopping_url
         "https://#{Workarea.config.host}"
        end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
workarea-flow_io-1.2.1 app/services/workarea/flow_io/checkout_token_form.rb