new BackendCartComponent()

Description

Provides methods for working with multiple aspects of a cart, including lines, cart summary, estimates, promotions, and the submit action. It also exposes cancelable events that are triggered before and after changes to lines, estimates, promotions, and so on.

Members


componentName :string

Description

A name that identifies the component. Use the name to register a new component and get a component implementation with BackendComponentContainer.

Methods


addLine( data ) → {Deferred}

Description

Adds a new line to the cart. Returns a Deferred object. If the promise is resolved, the line is added to the cart. If the promise is rejected, it returns an error.

Parameters
Name Type Description
data Object

A Line object.

Returns

addLineSync( data ) → {String}

Description

The synchronous version of BackendCartComponent#addLine.

Parameters
Name Type Description
data Object
Returns

addLines( lines ) → {Deferred}

Description

Adds multiple lines to the cart. Returns a Deferered object. If the object is resolved, the lines (as an array of strings) are added to the cart. If the object is rejected, it returns an error.

Parameters
Name Type Description
lines Object
Returns

addLinesSync( lines ) → {Array.<String>}

Description

The synchronous version of BackendCartComponent#addLineS.

Parameters
Name Type Description
lines Object
Returns

getLines() → {Deferred}

Description

Gets the lines in the cart and returns a Deferred object. If the promise is resolved, it returns an array of Line objects. If the promise is rejected, it returns an error.

Returns

getLinesSync() → {Array.<Line>}

Description

Synchronous version of BackendCartComponent#getLines.

Returns

removeLine( internalid ) → {Deferred}

Description

Removes a line from the cart. Returns a Deferred that is resolved in the case the operation was done successfully or rejected with an error message.

Parameters
Name Type Description
internalid String

id of the line to remove

Returns

removeLineSync() → {undefined|string}

Description

Synchronous version of BackendCartComponent#removeLine.

Returns

returns undefined if successful or an error message if an errors occurs.


updateLine( line ) → {Deferred}

Description

Updates a cart's line. Returns a Deferred that is resolved with Line in the case the operation was done successfully,
or rejected with an error message.

Parameters
Name Type Description
line Line
Returns

updateLineSync( line ) → {Line|string}

Description

Synchronous version of BackendCartComponent#updateLine.

Parameters
Name Type Description
line Object
Returns

getSummary() → {Deferred}

Description

Returns the summary of the cart as a Deferred that is resolved with a Summary in the case the operation was done successfully or
rejected with an error message.

Returns

getSummarySync() → {Summary}

Description

Synchronous version of BackendCartComponent#getSummary.

Returns

submit() → {Deferred}

Description

Submits the order. Returns a Deferred that is resolved with a ConfirmationSubmit object in the case
the operation was done successfully, or rejected with an error message.

Returns

submitSync() → {ConfirmationSubmit}

Description

Synchronous version of BackendCartComponent#submitSync.

Returns

addPayment()

Description

Adds a payment method
//TODO: returns? - Deferred resolved with ?
//TODO: data parameter ? what's the structure?


addPaymentSync()

Description

Synchronous version of BackendCartComponent#addPayment.
TODO


getPaymentMethods() → {Deferred}

Description

returns the payment methods added to the order

Returns

Return a jQuery Deferred that is resolved with an array of PaymentMethod
in the case the operation was done successfully or the promise is rejected with an error message.


getPaymentMethodsSync()

Description

Synchronous version of BackendCartComponent#addPayment.
TODO


addPromotion( the )

Description

Adds a promotion

Parameters
Name Type Description
the Object

promocode to add


addPromotionSync()

Description

Synchronous version of BackendCartComponent#addPromotion.
TODO


removePromotion( data ) → {Deferred}

Description

Removes a promotion

Parameters
Name Type Description
data Object
Returns

TODO: check param and deferred resolve with


removePromotionSync()

Description

Synchronous version of BackendCartComponent#removePromotion.
TODO


getPromotions() → {Deferred}

Description

Returns the promotions' codes added to the cart

Returns

Returns a Deferred that is resolved with an array of Promotion in the case the
operation was done successfully or rejected with an error message.


getPromotionsSync()

Description

Synchronous version of BackendCartComponent#getPromotions.
TODO


estimateShipping( locationData )

Description

Returns the estimated shipping costs

Parameters
Name Type Description
locationData Object

TODO: returns ?


estimateShippingSync()

Description

Synchronous version of BackendCartComponent#estimateShipping.
TODO


removeShipping()

Description

Removes the shipping method
// TODO: returns ?
TODO @params?


clearEstimateShipping()

Description

Clears the shopping estimations in the cart
TODO: returns ?
TODO: params?


clearEstimateShippingSync()

Description

Synchronous version of BackendCartComponent#clearEstimateShipping.
TODO


getAddresses() → {Deferred}

Description

Returns the addresses of the order

Returns

Return a jQuery Deferred that is resolved with an array of Address in the case the operation
was done successfully or the promise is rejected with an error message.


getAddressesSync()

Description

Synchronous version of BackendCartComponent#getAddresses.
TODO


getShipAddress() → {Deferred}

Description

Returns the shipping address of the order

Returns

Return a jQuery Deferred that is resolved with an Address in the case the operation
was done successfully or the promise is rejected with an error message.


getShipAddressSync()

Description

Synchronous version of BackendCartComponent#getShipAddress.
TODO


getBillAddress() → {Deferred}

Description

Returns the billing address of the order

Returns

Return a jQuery Deferred that is resolved with an Address in the case the operation
was done successfully or the promise is rejected with an error message.


getBillAddressSync()

Description

Synchronous version of BackendCartComponent#getBillAddress.
TODO


getShipMethods() → {Deferred}

Description

Returns the ship methods of the order

Returns

Return a jQuery Deferred that is resolved with an array of ShipMethod in the case the operation
was done successfully or the promise is rejected with an error message.


getShipMethodsSync()

Description

Synchronous version of BackendCartComponent#getShipMethods.
TODO


getShipMethod() → {Deferred}

Description

Returns the selected shipping method of the order

Returns

Return a jQuery Deferred that is resolved with an array of ShipMethod in the case the operation
was done successfully or the promise is rejected with an error message.


getShipMethodSync()

Description

Synchronous version of BackendCartComponent#getShipMethod.
TODO


voidLine()

Description

Voids a line. Implemented only for SCIS
//TODO: params ?
// TODO return ?


voidLineSync()

Description

Synchronous version of BackendCartComponent#voidLine.
TODO


unvoidLine()

Description

Unvoids a line. Implemented only for SCIS

//TODO: params ?
// TODO return ?


unvoidLineSync()

Description

Synchronous version of BackendCartComponent#unvoidLine.
TODO


updateCustomer()

Description

Updates a customer data. Implemented only for SCIS
//TODO: params ?
// TODO return ?


updateCustomerSync()

Description

Synchronous version of BackendCartComponent#updateCustomer.
TODO


extend( componentDefinition ) → {BackendBaseComponent}

Description

Extends the current component and returns a child component.

Parameters
Name Type Description
componentDefinition Object

Any object that has properties and methods.


on( event_name, handler ) → {void}

Description

Attaches an event handler to an event name. Alias for BackendCancelableEvents#cancelableOn.

Parameters
Name Type Description
event_name string

The event name that the handler will be attached to.

handler function

The event handler (function) that will be invoked when event_name is triggered. The event handler can accept one optional callback parameter. The event handler can return a Deferred object, which if resolved, executes the callback function. If the promise is rejected, the callback function does not execute.

Returns

off( event_name, handler ) → {void}

Description

Detaches an event handler from an event name. Alias for BackendCancelableEvents#cancelableOff.

Parameters
Name Type Description
event_name string

The event name that the handler will be detached from. Optional.

handler function

The event handler (function) that will be removed from the list of registered handlers.

Returns

cancelableOn( event_name, handler ) → {void}

Description

Attaches an event handler to an event.

Parameters
Name Type Description
event_name String

The event name that the handler will be attached to.

handler function

The event handler (function) that will be invoked when event_name is triggered. The event handler can accept one optional callback parameter. The event handler can return a Deferred object, which if resolved, executes the callback function. If the promise is rejected, the callback function does not execute.

Returns

cancelableOff( event_name, handler ) → {void}

Description

Detaches an event handler from an event.

Parameters
Name Type Description
event_name String

The event name that the handler will be detached from. This argument is required.

handler function

The event handler (function) that will be removed from the list of registered handlers. This argument is required.

Returns

cancelableDisable( event_name ) → {void}

Description

Disables all event handlers attached to an event.

Parameters
Name Type Description
event_name String

The name of the event for which event handlers will be disabled.

Returns

cancelableEnable( event_name ) → {Void}

Description

Re-enables all event handlers attached to an event.

Parameters
Name Type Description
event_name String

The name of the event for which event handlers will be re-enabled.

Returns

cancelableTrigger( event_name, ...args ) → {Deferred}

Description

Triggers an event with one or more arguments. If any of the event handlers associated with the event are rejected, callbacks will not be executed.

Parameters
Name Type Attributes Description
event_name String

The name of the event to trigger.

args params <repeatable>

Any arguments to be passed to all event handlers attached to the event.

Returns

Returns a Deferred object. Because event handlers are sometimes asynchronous, any callbacks in the event handlers will also be asynchronous.


cancelableTriggerUnsafe( event_name, ...args ) → {Deferred}

Description

Triggers an event with one or more unsanitized arguments. If any of the event handlers associated with the event are rejected, callbacks will not be executed.

Parameters
Name Type Attributes Description
event_name String

The name of the event to trigger.

args params <repeatable>

Any arguments to be passed to all event handlers attached to the event.

Returns

Returns a Deferred object. Because event handlers are sometimes asynchronous, any callbacks in the event handlers will also be asynchronous.


removeShippingSync()

Description

Synchronous version of BackendCartComponent#removeShipping.
TODO

Events


beforeUpdateLine

Description

Cancelable event triggered before a cart's line is updated. See BackendCancelableEvents

Properties
Type Description
boolean
Details
object

afterUpdateLine

Description

Triggered after a cart's line is updated See

Properties
Type Description
boolean
Details
object

beforeRemoveLine

Description

Cancelable event triggered before a cart's line is removed. See BackendCancelableEvents

Properties
Type Description
boolean
Details
object

afterRemoveLine

Description

Triggered after a cart's line is removed

Properties
Type Description
boolean
Details
object

beforeEstimateShipping

Description

Cancelable event triggered before doing an estimate shipping in the cart. See BackendCancelableEvents

Properties
Type Description
boolean
Details
object

afterEstimateShipping

Description

Triggered after an estimate shipping is done in the cart

Properties
Type Description
boolean
Details
object

beforeClearEstimateShipping

Description

Cancelable event triggered before clearing an estimate shipping in the cart. See BackendCancelableEvents

Properties
Type Description
boolean
Details
object

afterClearEstimateShipping

Description

Triggered after an estimate shipping is cleared in the cart

Properties
Type Description
boolean
Details
object

beforeAddPromotion

Description

Triggered before a promotion is added to the cart. See BackendCancelableEvents

Properties
Type Description
boolean
Details
object

afterAddPromotion

Description

Triggered before a promotion is added to the cart

Properties
Type Description
boolean
Details
object

beforeRemovePromotion

Description

Triggered before a promocode is removed from the cart. See BackendCancelableEvents

Properties
Type Description
boolean
Details
object

afterRemovePromotion

Description

Triggered after a promocode is removed from the cart

Properties
Type Description
boolean
Details
object

beforeAddPayment

Description

Triggered before a payment method is added to the order. See BackendCancelableEvents

Properties
Type Description
boolean
Details
object

afterAddPayment

Description

Triggered after a payment method is added to the order

Properties
Type Description
boolean
Details
object

beforeSubmit

Description

Triggered before the order is submitted. See BackendCancelableEvents

Properties
Type Description
boolean
Details
object

afterSubmit

Description

Triggered after the order is submitted

Properties
Type Description
boolean
Details
object

beforeAddLine

Description

Cancelable event triggered before adding a new cart's line. See BackendCancelableEvents

Properties
Type Description
boolean
Details
object

afterAddLine

Description

Triggered after a new line is added in the cart

Properties
Type Description
boolean
Details
object