An Ember Ecosystem
For Spree Commerce

spree-ember-checkouts

Extends SpreeSerializer

The Order Serializer converts the Order model into a JSON payload as dictated by Spree's "Checkouts" endpoint. The payload is dependant on the state of the order.

Methods

Show Private Methods

_serializeForCheckouts

(
  • snapshot
  • orderJSON
)
private

Serializes the Order into a format the Spree Checkouts endpoint expects, dependant on the state of Checkouts service.

Parameters:

  • snapshot Ember.Object

    A snapshot of the order model for serialization.

  • orderJSON Object

    The regular JSON for the Order.

extractErrors

(
  • store
  • type
  • payload
  • id
)

Extracts the errors from an Invalid response from the Server. Overrides the default method to include a Top Level error from the payload as base in the DS.Errors collection.

Parameters:

  • store subclass of DS.Store

    The ember store used for this request.

  • type subclass of DS.Model

    The Order Factory.

  • payload Object

    The returned JSON Payload.

  • id Integer

    The order's ID.

serialize

(
  • snapshot
)

Serializes the Order into a format the Spree Checkouts endpoint expects.

Parameters:

  • snapshot Snapshot

    A snapshot of the order model for serialization.

serializeIntoHash

(
  • data
  • type
  • snapshot
  • options
)

By default, Ember's Active Model Serializer will merge the JSON payload returned by the serialize call under the model's name. The Spree Checkouts endpoint expects objects as siblings in the payload, so when we're saving the checkouts via DS.Order#saveToCheckouts() we override this behaviour.

Parameters:

  • data Object

    The payload for the request.

  • type subclass of DS.Model

    The model factory.

  • snapshot Ember.Object

    The record's snapshot.

  • options Object

    Options for the request.

Properties

Show Private Properties

checkouts

Ember.Service

A reference to the Stateful Checkouts service.