Introduction
Using these API functions, you can interact with the MplusKASSA interbranch workflow. The interbranch system was created to facilitate transfer of stock from one branch to another branch within the same MplusKASSA administration. The full interbranch workflow is as follows:
create order saveInterbranchOrder Order claim claimInterbranchOrder ship shipInterbranchOrder Shipment deliver deliverInterbranchShipment Delivery
There are some shortcuts available in this workflow. For instance, you can immediately create a shipment or a delivery, which will automatically create an order or an order and a shipment respectively.
create shipment saveInterbranchShipment Order (automatic) Shipment deliver deliverInterbranchShipment Delivery
create delivery saveInterbranchDelivery Order (automatically) Shipment (automatically) Delivery
Contents
- getInterbranchOrders
Retrieve interbranch orders - getInterbranchShipments
Retrieve interbranch shipments - getInterbranchDeliveries
Retrieve interbranch deliveries - saveInterbranchOrder
Create or modify an interbranch order - claimInterbranchOrder
Claim an interbranch order - releaseInterbranchOrder
Release an interbranch order - shipInterbranchOrder
Ship an interbranch order, which creates a shipment - deliverInterbranchShipment
Deliver an interbranch shipment, which creates a delivery - saveInterbranchShipment
Creates an interbranch shipment, which automatically creates an order - saveInterbranchDelivery
Creates an interbranch delivery, which automatically creates an order and a shipment
getInterbranchOrders
Retrieving interbranch orders
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
<?php require_once('Mplusqapiclient.php'); $mplusqapiclient = new Mplusqapiclient(); // Initialize the client with your details. ... $syncMarker = get_internal_interbranch_orders_syncmarker(); // this should be 0 the first time you synchronize // Then we call the getInterbranchOrders() function wrapped in a try/catch block to intercept any exceptions. try { if (false !== ($interbranch_orders = $mplusqapiclient->getInterbranchOrders($syncMarker))) { // Success, we show the number of retrieved interbranch orders. exit(sprintf('Retrieved %d interbranch orders.', count($interbranch_orders))); } else { exit('Unable to retrieve interbranch orders.'); } } catch (MplusQAPIException $e) { exit($e->getMessage()); } |
getInterbranchShipments
Retrieving interbranch shipments
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
<?php require_once('Mplusqapiclient.php'); $mplusqapiclient = new Mplusqapiclient(); // Initialize the client with your details. ... $syncMarker = get_internal_interbranch_shipments_syncmarker(); // this should be 0 the first time you synchronize // Then we call the getInterbranchShipments() function wrapped in a try/catch block to intercept any exceptions. try { if (false !== ($interbranch_shipments = $mplusqapiclient->getInterbranchShipments($syncMarker))) { // Success, we show the number of retrieved interbranch shipments. exit(sprintf('Retrieved %d interbranch shipments.', count($interbranch_shipments))); } else { exit('Unable to retrieve interbranch shipments.'); } } catch (MplusQAPIException $e) { exit($e->getMessage()); } |
getInterbranchDeliveries
Retrieving interbranch deliveries
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
<?php require_once('Mplusqapiclient.php'); $mplusqapiclient = new Mplusqapiclient(); // Initialize the client with your details. ... $syncMarker = get_internal_interbranch_deliveries_syncmarker(); // this should be 0 the first time you synchronize // Then we call the getInterbranchDeliveries() function wrapped in a try/catch block to intercept any exceptions. try { if (false !== ($interbranch_deliveries = $mplusqapiclient->getInterbranchDeliveries($syncMarker))) { // Success, we show the number of retrieved interbranch deliveries. exit(sprintf('Retrieved %d interbranch deliveries.', count($interbranch_deliveries))); } else { exit('Unable to retrieve interbranch deliveries.'); } } catch (MplusQAPIException $e) { exit($e->getMessage()); } |
saveInterbranchOrder
Create or modify an interbranch order
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
<?php require_once('Mplusqapiclient.php'); $mplusqapiclient = new Mplusqapiclient(); // Initialize the client with your details. ... $interbranch_order = array( 'fromBranchNumber' => 1, 'toBranchNumber' => 2, 'employeeNumber' => 999999, 'reference' => 'Interbranch order from branch 1 to 2', 'interbranchOrderLineList' => array( array( 'articleNumber' => 1, // this quantity + this decimalPlaces means an actual quantity of 2.5 'quantity' => 25, 'decimalPlaces' => 1, ), ), ); // Then we call the saveInterbranchOrder() function wrapped in a try/catch block to intercept any exceptions. try { if (false !== ($interbranch_order = $mplusqapiclient->saveInterbranchOrder($interbranch_order))) { // Success, we show the created interbranch_order print_r($interbranch_order); exit(sprintf('Saved interbranch order %d.%d.', $interbranch_order['interbranchOrderNumber']['year'], $interbranch_order['interbranchOrderNumber']['number'])); } else { exit('Unable to save interbranch order.'); } } catch (MplusQAPIException $e) { exit($e->getMessage()); } |
claimInterbranchOrder
Claim an interbranch order
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
<?php require_once('Mplusqapiclient.php'); $mplusqapiclient = new Mplusqapiclient(); // Initialize the client with your details. ... $interbranch_order_number = array( 'year' => 2018, 'number' => 1, ); $branch_number = 2; $workplace_number = 1; $employee_number = 999999; // Then we call the claimInterbranchOrder() function wrapped in a try/catch block to intercept any exceptions. try { if (false !== ($interbranch_order = $mplusqapiclient->claimInterbranchOrder($interbranch_order_number, $branch_number, $workplace_number, $employee_number))) { // Success, we show the claimed interbranch_order print_r($interbranch_order); exit(sprintf('Claimed interbranch order %d.%d.', $interbranch_order['interbranchOrderNumber']['year'], $interbranch_order['interbranchOrderNumber']['number'])); } else { exit('Unable to claiminterbranch order.'); } } catch (MplusQAPIException $e) { exit($e->getMessage()); } |
releaseInterbranchOrder
Release an interbranch order
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
<?php require_once('Mplusqapiclient.php'); $mplusqapiclient = new Mplusqapiclient(); // Initialize the client with your details. ... $interbranch_order_number = array( 'year' => 2018, 'number' => 1, ); // Then we call the releaseInterbranchOrder() function wrapped in a try/catch block to intercept any exceptions. try { if (false !== ($interbranch_order = $mplusqapiclient->releaseInterbranchOrder($interbranch_order_number))) { // Success, we show the released interbranch_order print_r($interbranch_order); exit(sprintf('Released interbranch order %d.%d.', $interbranch_order['interbranchOrderNumber']['year'], $interbranch_order['interbranchOrderNumber']['number'])); } else { exit('Unable to release interbranch order.'); } } catch (MplusQAPIException $e) { exit($e->getMessage()); } |
shipInterbranchOrder
Ship an interbranch order, which creates a shipment
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
<?php require_once('Mplusqapiclient.php'); $mplusqapiclient = new Mplusqapiclient(); // Initialize the client with your details. ... $interbranch_order_number = array( 'year' => 2018, 'number' => 1, ); // Then we call the shipInterbranchOrder() function wrapped in a try/catch block to intercept any exceptions. try { if (false !== ($interbranch_shipment = $mplusqapiclient->shipInterbranchOrder($interbranch_order_number))) { // Success, we show the interbranch_shipment print_r($interbranch_shipment); exit(sprintf('Shipped interbranch order %d.%d (created interbranch shipment %d.%d).', $interbranch_shipment['interbranchOrderNumber']['year'], $interbranch_shipment['interbranchOrderNumber']['number'], $interbranch_shipment['interbranchShipmentNumber']['year'], $interbranch_shipment['interbranchShipmentNumber']['number'])); } else { exit(sprintf('Unable to ship interbranch order %d.%d.', $interbranch_order_number['year'], $interbranch_order_number['number'])); } } catch (MplusQAPIException $e) { exit($e->getMessage()); } |
deliverInterbranchShipment
Deliver an interbranch shipment, which creates a delivery
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
<?php require_once('Mplusqapiclient.php'); $mplusqapiclient = new Mplusqapiclient(); // Initialize the client with your details. ... $interbranch_shipment_number = array( 'year' => 2018, 'number' => 1, ); // Then we call the deliverInterbranchShipment() function wrapped in a try/catch block to intercept any exceptions. try { if (false !== ($interbranch_delivery = $mplusqapiclient->deliverInterbranchShipment($interbranch_shipment_number))) { // Success, we show the interbranch_delivery print_r($interbranch_delivery); exit(sprintf('Shipped interbranch shipment %d.%d (created interbranch delivery %d.%d).', $interbranch_delivery['interbranchShipmentNumber']['year'], $interbranch_delivery['interbranchShipmentNumber']['number'], $interbranch_delivery['interbranchDeliveryNumber']['year'], $interbranch_shipment['interbranchDeliveryNumber']['number'])); } else { exit(sprintf('Unable to deliver interbranch shipment %d.%d.', $interbranch_shipment_number['year'], $interbranch_shipment_number['number'])); } } catch (MplusQAPIException $e) { exit($e->getMessage()); } |
saveInterbranchShipment
Creates an interbranch shipment, which automatically creates an order
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
<?php require_once('Mplusqapiclient.php'); $mplusqapiclient = new Mplusqapiclient(); // Initialize the client with your details. ... $interbranch_shipment = array( 'fromBranchNumber' => 1, 'toBranchNumber' => 2, 'employeeNumber' => 999999, 'reference' => 'Interbranch shipment from branch 1 to 2', 'interbranchShipmentLineList' => array( array( 'articleNumber' => 1, // this quantity + this decimalPlaces means an actual quantity of 2.5 'quantity' => 25, 'decimalPlaces' => 1, ), ), ); // Then we call the saveInterbranchShipment() function wrapped in a try/catch block to intercept any exceptions. try { if (false !== ($interbranch_shipment = $mplusqapiclient->saveInterbranchShipment($interbranch_shipment))) { // Success, we show the created interbranch_shipment print_r($interbranch_shipment); exit(sprintf('Saved interbranch shipment %d.%d.', $interbranch_shipment['interbranchShipmentNumber']['year'], $interbranch_shipment['interbranchShipmentNumber']['number'])); } else { exit('Unable to save interbranch shipment.'); } } catch (MplusQAPIException $e) { exit($e->getMessage()); } |
saveInterbranchDelivery
Creates an interbranch delivery, which automatically creates an order and a shipment
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
<?php require_once('Mplusqapiclient.php'); $mplusqapiclient = new Mplusqapiclient(); // Initialize the client with your details. ... $interbranch_delivery = array( 'fromBranchNumber' => 1, 'toBranchNumber' => 2, 'employeeNumber' => 999999, 'reference' => 'Interbranch delivery from branch 1 to 2', 'interbranchShipmentLineList' => array( array( 'articleNumber' => 1, // this quantity + this decimalPlaces means an actual quantity of 2.5 'quantity' => 25, 'decimalPlaces' => 1, ), ), ); // Then we call the saveInterbranchDelivery() function wrapped in a try/catch block to intercept any exceptions. try { if (false !== ($interbranch_delivery = $mplusqapiclient->saveInterbranchDelivery($interbranch_delivery))) { // Success, we show the created interbranch_delivery print_r($interbranch_delivery); exit(sprintf('Saved interbranch delivery %d.%d.', $interbranch_delivery['interbranchDeliveryNumber']['year'], $interbranch_delivery['interbranchDeliveryNumber']['number'])); } else { exit('Unable to save interbranch delivery.'); } } catch (MplusQAPIException $e) { exit($e->getMessage()); } |