Class: Workarea::Fulfillment::Policies::Download

Inherits:
Base
  • Object
show all
Defined in:
app/models/workarea/fulfillment/policies/download.rb

Instance Attribute Summary

Attributes inherited from Base

#sku

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Workarea::Fulfillment::Policies::Base

Instance Method Details

#process(order_item:, fulfillment: nil) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/models/workarea/fulfillment/policies/download.rb', line 5

def process(order_item:, fulfillment: nil)
  Fulfillment::Token.create!(
    order_id: order_item.order.id,
    order_item_id: order_item.id,
    sku: sku.id
  )

  return unless fulfillment.present?
  fulfillment.mark_item_shipped(
    id: order_item.id.to_s,
    quantity: order_item.quantity
  )
end