Sha256: 024b198c35ae13c61caa26d556c9955e60047585fb7095e922a42925bc9b1dac

Contents?: true

Size: 903 Bytes

Versions: 16

Compression:

Stored size: 903 Bytes

Contents

//= require spree/backend/routes
//= require spree/backend/collections/line_items
//= require spree/backend/models/address

Spree.Models.Order = Backbone.Model.extend({
  urlRoot: Spree.routes.orders_api,
  idAttribute: "number",

  relations: {
    "line_items": Spree.Collections.LineItems,
    "shipments": Backbone.Collection,
    "bill_address": Spree.Models.Address,
    "ship_address": Spree.Models.Address
  },

  advance: function(opts) {
    var options = {
      url: Spree.routes.checkouts_api + "/" + this.id + "/advance",
      type: 'PUT',
    };
    _.extend(options, opts);
    return this.fetch(options)
  }
});

Spree.Models.Order.fetch = function(number, opts) {
  var options = (opts || {});
  var model = new Spree.Models.Order({
    number: number,
    line_items: [],
    shipments: [],
    bill_address: {},
    ship_address: {},
  });
  model.fetch(options);
  return model;
}

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
solidus_backend-2.4.2 app/assets/javascripts/spree/backend/models/order.js
solidus_backend-2.4.1 app/assets/javascripts/spree/backend/models/order.js
solidus_backend-2.3.1 app/assets/javascripts/spree/backend/models/order.js
solidus_backend-2.2.2 app/assets/javascripts/spree/backend/models/order.js
solidus_backend-2.4.0 app/assets/javascripts/spree/backend/models/order.js
solidus_backend-2.4.0.rc1 app/assets/javascripts/spree/backend/models/order.js
solidus_backend-2.4.0.beta1 app/assets/javascripts/spree/backend/models/order.js
solidus_backend-2.3.0 app/assets/javascripts/spree/backend/models/order.js
solidus_backend-2.3.0.rc3 app/assets/javascripts/spree/backend/models/order.js
solidus_backend-2.3.0.rc2 app/assets/javascripts/spree/backend/models/order.js
solidus_backend-2.3.0.rc1 app/assets/javascripts/spree/backend/models/order.js
solidus_backend-2.3.0.beta1 app/assets/javascripts/spree/backend/models/order.js
solidus_backend-2.2.1 app/assets/javascripts/spree/backend/models/order.js
solidus_backend-2.2.0 app/assets/javascripts/spree/backend/models/order.js
solidus_backend-2.2.0.rc1 app/assets/javascripts/spree/backend/models/order.js
solidus_backend-2.2.0.beta1 app/assets/javascripts/spree/backend/models/order.js