Module: SolidusBolt::OrderDecorator

Defined in:
app/decorators/models/solidus_bolt/order_decorator.rb

Instance Method Summary collapse

Instance Method Details

#bolt_cartObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/decorators/models/solidus_bolt/order_decorator.rb', line 5

def bolt_cart
  {
    total_amount: display_total.cents,
    tax_amount: display_tax_total.cents,
    order_reference: number,
    currency: currency,
    shipments: bolt_shipments_payload,
    items: line_items.map do |line_item|
      {
        sku: line_item.sku,
        name: line_item.name,
        unit_price: cents(line_item.price),
        quantity: line_item.quantity
      }
    end
  }
end

#bolt_user_identifierObject



23
24
25
26
27
28
# File 'app/decorators/models/solidus_bolt/order_decorator.rb', line 23

def bolt_user_identifier
  {
    email: email,
    phone: bill_address.phone
  }
end

#bolt_user_identityObject



30
31
32
33
34
35
36
# File 'app/decorators/models/solidus_bolt/order_decorator.rb', line 30

def bolt_user_identity
  name = bill_address.name.split(' ')
  {
    first_name: name.first,
    last_name: name.last
  }
end