Class: Workarea::FlowIo::CheckoutTokenForm

Inherits:
Object
  • Object
show all
Defined in:
app/services/workarea/flow_io/checkout_token_form.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(order:, session_id:) ⇒ CheckoutTokenForm

Returns a new instance of CheckoutTokenForm.



10
11
12
13
# File 'app/services/workarea/flow_io/checkout_token_form.rb', line 10

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

Instance Attribute Details

#orderObject (readonly)

Returns the value of attribute order.



8
9
10
# File 'app/services/workarea/flow_io/checkout_token_form.rb', line 8

def order
  @order
end

#session_idObject (readonly)

Returns the value of attribute session_id.



8
9
10
# File 'app/services/workarea/flow_io/checkout_token_form.rb', line 8

def session_id
  @session_id
end

Class Method Details

.from(order:, session_id:) ⇒ Object



4
5
6
# File 'app/services/workarea/flow_io/checkout_token_form.rb', line 4

def self.from(order:, session_id:)
  new(order: order, session_id: session_id).to_flow_model
end

Instance Method Details

#attributesObject



19
20
21
22
23
24
25
26
27
# File 'app/services/workarea/flow_io/checkout_token_form.rb', line 19

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

#to_flow_modelObject



15
16
17
# File 'app/services/workarea/flow_io/checkout_token_form.rb', line 15

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