Users should be able to set things like email, currency or any Order value not dependent on other objects.
curl -H 'X-Spree-Token: 123' -X POST http://localhost:9292/api/orders.json
api/orders.json should be the root path for creating the orders.
| unless File.exist?('Gemfile') | |
| File.write('Gemfile', <<-GEMFILE) | |
| source 'https://rubygems.org' | |
| gem 'rails', path: '../rails' | |
| gem 'arel', '~> 5.0.0' | |
| gem 'rack', '~> 1.5.2' | |
| gem 'i18n', github: 'svenfuchs/i18n' | |
| gem 'sqlite3' | |
| gem 'rspec-rails', '~> 2.14.0' | |
| GEMFILE |
| unless File.exist?('Gemfile') | |
| File.write('Gemfile', <<-GEMFILE) | |
| source 'https://rubygems.org' | |
| gem 'rails', path: '../rails' | |
| gem 'arel', '~> 5.0.0' | |
| gem 'rack', '~> 1.5.2' | |
| gem 'i18n', github: 'svenfuchs/i18n' | |
| gem 'sqlite3' | |
| GEMFILE |
| Running #persist_invalid: | |
| (0.1ms) begin transaction | |
| (0.0ms) SAVEPOINT active_record_1 | |
| Spree::Order Exists (0.1ms) SELECT 1 AS one FROM "spree_orders" WHERE "spree_orders"."number" = 'R287523099' LIMIT 1 | |
| (0.1ms) SELECT COUNT(*) FROM "spree_orders" WHERE (spree_orders.number LIKE 'R287523099%') | |
| Spree::Order Exists (0.1ms) SELECT 1 AS one FROM "spree_orders" WHERE "spree_orders"."number" = 'R287523099' LIMIT 1 | |
| Running #confirmation_required? | |
| Spree::Order Exists (0.1ms) SELECT 1 AS one FROM "spree_orders" WHERE "spree_orders"."guest_token" = 'Z_tTol42m1nKm4Ghfwm8YA' LIMIT 1 | |
| SQL (0.8ms) INSERT INTO "spree_orders" ("created_at", "currency", "guest_token", "number", "state", "updated_at") VALUES (?, ?, ?, ?, ?, | |
| ?) [["created_at", "2014-08-25 17:36:26.478451"], ["currency", "USD"], ["guest_token", "Z_tTol42m1nKm4Ghfwm8YA"], ["number", "R287523099"], |
| FriendlyId::Slug Load (0.8ms) SELECT "friendly_id_slugs".* FROM "friendly_id_slugs" WHERE "friendly_id_slugs"."sluggable_id" = $1 AND "friendly_id_slugs"."sluggable_type" = $2 ORDER BY "friendly_id_slugs".id DESC [["sluggable_id", 1], ["sluggable_type", "Spree::Product"]] | |
| (0.1ms) BEGIN | |
| SQL (0.2ms) DELETE FROM "friendly_id_slugs" WHERE "friendly_id_slugs"."id" = $1 [["id", 17]] | |
| SQL (0.2ms) DELETE FROM "friendly_id_slugs" WHERE "friendly_id_slugs"."id" = $1 [["id", 1]] | |
| (0.4ms) COMMIT | |
| Spree::ProductOptionType Load (0.6ms) SELECT "spree_product_option_types".* FROM "spree_product_option_types" WHERE "spree_product_option_types"."product_id" = $1 [["product_id", 1]] | |
| Spree::ProductProperty Load (0.6ms) SELECT "spree_product_properties".* FROM "spree_product_properties" WHERE "spree_product_properties"."product_id" = $1 ORDER BY spree_product_properties.position [["product_id", 1]] | |
| (0.1ms) BEGIN | |
| SQL (0.2ms) DELETE FROM "spree_product_properties" WHERE "spree_product_properties |
| { | |
| "order": { | |
| "number": "REREGEGERGRRG", | |
| "state": "complete", | |
| "channel": "spree", | |
| "email": "[email protected]", | |
| "currency": "USD", | |
| "completed_at": "2014-08-03T09:08:57Z", | |
| "adjustments_attributes": [ | |
| { |
| { | |
| "title": "Product Schema", | |
| "type": "object", | |
| "required": [ | |
| "sku", | |
| "description", | |
| "price", | |
| "cost_price" | |
| ], | |
| "properties": { |
| module Spree | |
| Gateway::AdyenPaymentEncrypted.class_eval do | |
| def require_3d_secure?(payment) | |
| if payment.order && payment.order.bill_address.city == "Bethesda" | |
| false | |
| else | |
| true | |
| end | |
| end |
| module Spree | |
| Order.class_eval do | |
| # NOTE Overriden spree core | |
| def confirmation_required? | |
| false | |
| end | |
| # NOTE Overriden spree core | |
| # | |
| # Currently Spree 2-2-stable raises an error any time Order#process_payments! |
| require 'httparty' | |
| Spree::CheckoutController.class_eval do | |
| include Spree::Adyen::CheckoutRescue | |
| Spree::Payment.send :attr_accessor, :request_env | |
| Spree::PermittedAttributes.payment_attributes.push request_env: ['HTTP_USER_AGENT', 'HTTP_ACCEPT'] | |
| Spree::PermittedAttributes.source_attributes.push :customer_enabled | |
| before_filter :set_payment_request_env, only: :update |