Asset Request with PHP SDK

Updated: June 1, 2020
Contents

The Connect PHP SDK is a valuable tool to implement middlewares between Cloudblue Connect and your platform. Not necessarily your platform must be developed in PHP, only the platform that runs the middleware must support PHP 5.6 or higher.

For more information go to PHP Connect documentation.

The example uses the scenario developed in Apiary that simulates a Vendor System API.

In the PHP SDK, folder examples/apiary-scenario is placed the scripts that runs a middleware to execute the workflow.

In app/ProductFulfillment.php is the example of the workflow. This workflow was implemented based on the product fulfillment automation process. This loads the purchase requests to connect and process it one by one.

Requirements

In order to use this template, you will need an environment capable to run PHP scripts, any version starting PHP 5.6 is supported. Additionally please ensure that composer it’s functional.

Installation

Once you has pulled the project, go to the folder examples/apiary-scenario and run “composer update” to get the latest versions of the dependencies and to update the file composer.lock

PHP

In the config.php you must to set the API Vendor credentials.
In app/ProductFulfillment.php file in the processRequest() method is the logic of the process.
This have two parts.

Create tenant: Process every request that not have filled the parameter tenantId, calling the API Vendor System simulated by Apiary making a POST with the new tenant. Catch the Id of the response and store in the parameter tenantId of the Purchase Request in Connect.

Process tenant: Verify the status of every request into Vendor System and if the status=”ready”, process the Purchase Request in Connect.

Is this page helpful?
Translate with Google
Copied to clipboard