A workflow defines the action an application should offer the user for a particular tag, such as purchasing a product or claiming a coupon.

Each workflow includes all information required to display the actions (such as the product information) to the user.

After obtaining the tag, use the PTKWorkflowManager to retrieve the workflow information for the tag.

Workflow Types

The WorkflowManager will return one of the following workflow types:

A workflow for a single product that can be purchased immediately or saved in a basket for later.

A workflow for a 'TemporaryBasket' containing a set of items that can be purchased.

A worfklow for an 'Act' containing custom information required by a merchant as part of a "Call to action".

A workflow for a catalog which contains products for review, selection and purchase.

Retrieving a Workflow

  1. Retrieve an instance of PTKWorkflowManager:
PTKWorkflowManager *wm = [[PTKManagerFactory sharedManager] workflowManager];

  1. Get the workflow using a tag:
[wm workflowForTag:tag completion:^(PTKWorkflow *workflow, NSError *error) {
   switch (workflow.workflowType){
	   // Determine the workflow type

Determining the Workflow Type

  1. Use the PTKWorkflowType convertion methods to convert the generic workflow object to the correct workflow subclass:
switch (workflow.workflowType) {
    case PTKWorkflowTypeProduct:
        PTKProductWorkflow *productWorkflow = [PTKWorkflow asProductWorkflow:workflow];
        PTKProduct *product = productWorkflow.product;
    case PTKWorkflowTypeBasket:
        PTKTemporaryBasketWorkflow *basketWorkflow = [PTKWorkflow asTemporaryBasketWorkflow:workflow];
        PTKTemporaryBasket *basket = basketWorkflow.basket;
    case PTKWorkflowTypeAct:
        PTKActWorkflow *actWorkflow = [PTKWorkflow asActWorkflow:workflow];
        PTKAct *act = actWorkflow.act;
    case PTKWorkflowTypeCatalog:
        PTKCatalogWorkflow *catalogWorkflow = [PTKWorkflow asCatalogWorkflow:workflow];
        PTKCatalog *catalog = catalogWorkflow.catalog;

Next Steps

Depending on the returned workflow type you can navigate to the following sections for implementation details for each one:

PTKProductWorkflow - review the Products page
PTKTemporaryBasketWorkflow - review the Baskets page
PTKActWorkflow - review the Acts page
PTKCampaignWorkflow - review the Catalogs page