Sha256: c1168b62a98c41aefc8d4e8b9f682f2b40c2b110c4a563c28984ce7e6f06504f

Contents?: true

Size: 1.06 KB

Versions: 26

Compression:

Stored size: 1.06 KB

Contents

Spree::Sample.load_sample("addresses")
Spree::Sample.load_sample("stores")

payment_method = Spree::PaymentMethod::Check.first!
store = Spree::Store.first!

orders = []
orders << Spree::Order.create!(
  number: "R123456789",
  email: "spree@example.com",
  item_total: 150.95,
  adjustment_total: 150.95,
  total: 301.90,
  shipping_address: Spree::Address.first,
  billing_address: Spree::Address.last)

orders << Spree::Order.create!(
  number: "R987654321",
  email: "spree@example.com",
  item_total: 15.95,
  adjustment_total: 15.95,
  total: 31.90,
  shipping_address: Spree::Address.first,
  billing_address: Spree::Address.last)

orders[0].line_items.create!(
  variant: Spree::Product.find_by_name!("Ruby on Rails Tote").master,
  quantity: 1,
  price: 15.99)

orders[1].line_items.create!(
  variant: Spree::Product.find_by_name!("Ruby on Rails Bag").master,
  quantity: 1,
  price: 22.99)

orders.each do |order|
  order.payments.create!(payment_method: payment_method)
  order.update_attributes(store: store)

  order.next! while !order.can_complete?
  order.complete!
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
solidus_sample-2.2.2 db/samples/orders.rb
solidus_sample-2.1.1 db/samples/orders.rb
solidus_sample-2.0.3 db/samples/orders.rb
solidus_sample-1.4.2 db/samples/orders.rb
solidus_sample-1.3.2 db/samples/orders.rb
solidus_sample-2.0.2 db/samples/orders.rb
solidus_sample-1.4.1 db/samples/orders.rb
solidus_sample-2.2.1 db/samples/orders.rb
solidus_sample-2.2.0 db/samples/orders.rb
solidus_sample-2.2.0.rc1 db/samples/orders.rb
solidus_sample-2.2.0.beta1 db/samples/orders.rb
solidus_sample-2.1.0 db/samples/orders.rb
solidus_sample-2.1.0.rc1 db/samples/orders.rb
solidus_sample-2.0.1 db/samples/orders.rb
solidus_sample-2.1.0.beta1 db/samples/orders.rb
solidus_sample-2.0.0 db/samples/orders.rb
solidus_sample-1.4.0 db/samples/orders.rb
solidus_sample-2.0.0.rc1 db/samples/orders.rb
solidus_sample-1.4.0.rc1 db/samples/orders.rb
solidus_sample-2.0.0.beta1 db/samples/orders.rb