Workflow/Methods

Workflow/Methods

Source:

Methods for Workflow. Run these methods using Meteor.call().

Example

Meteor.call("workflow/pushCartWorkflow", "coreCartWorkflow", "checkoutLogin");

Methods

(static) coreOrderWorkflow/coreOrderCompleted(options) → {Boolean}

Performs various checks to determine if an order may be moved into the completed phase.

Source:
See:
  • packages/reaction-schema/common/hooks/orders.js
  • packages/reaction-core/common/methods/workflow.js

Step 4 of the "workflow/pushOrderWorkflow" flow - called from Orders.before.update hook.

Parameters:
Name Type Description
options Object

An object containing arbitrary data

Returns:

true to allow action, false to cancel execution of hook

Type
Boolean

(static) coreOrderWorkflow/coreOrderProcessing(options) → {Boolean}

Checks permissions for a given user to allow them to move an order into the processing phase.

Source:
See:
  • packages/reaction-schema/common/hooks/orders.js
  • packages/reaction-core/common/methods/workflow.js

Step 4 of the "workflow/pushOrderWorkflow" flow - called from Orders.before.update hook.

Parameters:
Name Type Description
options Object

An object containing arbitrary data

Returns:

true to allow action, false to cancel execution of hook

Type
Boolean

(static) workflow/pullOrderWorkflow(workflow, status, order) → {Boolean}

Pull a previous order status

Source:

Push the status as the current workflow step, move the current status to completed worflow steps

Parameters:
Name Type Description
workflow String

workflow to push to

status String

Workflow status

order Order

Schemas.Order, an order object

Returns:

true if update was successful

Type
Boolean

(static) workflow/pushCartWorkflow(workflow, newWorkflowStatus, cartIdopt) → {Array|Boolean|Number}

updates cart workflow status

Source:

status in the workflow is stored as the current active workflow step. first sets, second call moves status to next workflow additional calls do nothing user permissions to template are verified

Example
Meteor.call("workflow/pushCartWorkflow", "coreCartWorkflow", "checkoutLogin");
Parameters:
Name Type Attributes Description
workflow String

name of workflow

newWorkflowStatus String

name of the next workflow stage

cartId String <optional>

cart._id

Returns:

return

Type
Array | Boolean | Number

(static) workflow/pushItemWorkflow(status, order, itemIds) → {Boolean}

Source:
Parameters:
Name Type Description
status String

Workflow status

order Object

Schemas.Order, an order object

itemIds Array.<String>

Array of item IDs

Returns:

true if update was successful

Type
Boolean

(static) workflow/pushOrderWorkflow(workflow, status, order) → {Boolean}

Update the order workflow: Push the status as the current workflow step, move the current status to completed worflow steps

Source:

Step 1 meteor call to push a new workflow Meteor.call("workflow/pushOrderWorkflow", "coreOrderWorkflow", "processing", this); NOTE: "coreOrderWorkflow", "processing" will be combined into "coreOrderWorkflow/processing" and set as the status Step 2 (this method) of the "workflow/pushOrderWorkflow" flow; Try to update the current status

Parameters:
Name Type Description
workflow String

workflow to push to

status String

Workflow status

order Order

Schemas.Order, an order object

Returns:

true if update was successful

Type
Boolean

(static) workflow/revertCartWorkflow(newWorkflowStatus) → {Number|Boolean}

if something was changed on the previous cartWorkflow steps, we need to revert to this step to renew the order

Source:
To Do:
  • need tests
Parameters:
Name Type Description
newWorkflowStatus String

name of cartWorkflow step, which we need to revert

Returns:

cart update results

Type
Number | Boolean