diff --git a/src/order/orderData/item/item.php b/src/order/orderData/item/item.php index f2e410e..f062ec7 100644 --- a/src/order/orderData/item/item.php +++ b/src/order/orderData/item/item.php @@ -23,141 +23,153 @@ public function init() { $this->__addProperty("sourceItemId", "", true); $this->__addProperty("sku"); $this->__addProperty("quantity", 1, true); + $this->__addProperty("printQuantity"); $this->__addProperty("shrinkWrap", false); $this->__addProperty("barcode", "", false); $this->__addProperty("dispatchAlert"); $this->__addArray("extraData",null); $this->__addProperty("colour"); - } - - /** - * newComponent function. - * - * @access public - * @param string $code - * @return OneFlowComponent - */ - public function newComponent($code){ - $count = count($this->components); - $component = new OneFlowComponent(); - $component->setCode($code); - $this->components[$count] = $component; - - return $this->components[$count]; - } - - /** - * addTextComponent function. - * - * @access public - * @return OneFlowComponent - */ - public function addTextComponent() { - return $this->newComponent('text'); - } - - /** - * addTextComponent function. - * - * @access public - * @param string $barcode - * @return string - */ - public function setBarcode($barcode) { - return $this->barcode = $barcode; - } - - /** - * addCoverComponent function. - * - * @access public - * @return OneFlowComponent - */ - public function addCoverComponent() { - return $this->newComponent('cover'); - } - - /** - * setDispatchAlert function. - * - * @access public - * @param mixed $dispatchAlert - * @return void - */ - public function setDispatchAlert($dispatchAlert) { - $this->dispatchAlert = $dispatchAlert; - } - - /** - * setShipment function. - * - * @access public - * @param mixed $shipment - * @return void - */ - public function setShipment($shipment) { - $this->shipmentIndex = $shipment->shipmentIndex; - } - - /** - * setBinding function. - * - * @access public - * @param mixed $binding - * @return boolean - */ - public function setBinding($binding) { + } + + /** + * newComponent function. + * + * @access public + * @param string $code + * @return OneFlowComponent + */ + public function newComponent($code){ + $count = count($this->components); + $component = new OneFlowComponent(); + $component->setCode($code); + $this->components[$count] = $component; + + return $this->components[$count]; + } + + /** + * addTextComponent function. + * + * @access public + * @return OneFlowComponent + */ + public function addTextComponent() { + return $this->newComponent('text'); + } + + /** + * addTextComponent function. + * + * @access public + * @param string $barcode + * @return string + */ + public function setBarcode($barcode) { + return $this->barcode = $barcode; + } + + /** + * addCoverComponent function. + * + * @access public + * @return OneFlowComponent + */ + public function addCoverComponent() { + return $this->newComponent('cover'); + } + + /** + * setDispatchAlert function. + * + * @access public + * @param mixed $dispatchAlert + * @return void + */ + public function setDispatchAlert($dispatchAlert) { + $this->dispatchAlert = $dispatchAlert; + } + + /** + * setShipment function. + * + * @access public + * @param mixed $shipment + * @return void + */ + public function setShipment($shipment) { + $this->shipmentIndex = $shipment->shipmentIndex; + } + + /** + * setBinding function. + * + * @access public + * @param mixed $binding + * @return boolean + */ + public function setBinding($binding) { $this->__addList("binding", Array("perfect", "saddle", "wiro", "pur", "threadSawn")); $this->binding = $binding; return true; - } - - /** - * setFolding function. - * - * @access public - * @param mixed $folding - * @return boolean - */ - public function setFolding($folding) { + } + + /** + * setFolding function. + * + * @access public + * @param mixed $folding + * @return boolean + */ + public function setFolding($folding) { $this->__addList("folding", Array("half", "gate", "cross", "concertina", "z", "2", "3")); $this->folding = $folding; return true; - } - - /** - * setQuantity function. - * - * @access public - * @param mixed $quantity - * @return void - */ - public function setQuantity($quantity) { - $this->quantity = $quantity; - } - - /** - * setSourceItemId function. - * - * @access public - * @param mixed $sourceItemId - * @return void - */ - public function setSourceItemId($sourceItemId) { - $this->sourceItemId = $sourceItemId; - } - - /** - * setSKU function. - * - * @access public - * @param mixed $skuCode - * @return void - */ - public function setSKU($skuCode) { - $this->sku = $skuCode; - } + } + + /** + * setQuantity function. + * + * @access public + * @param mixed $quantity + * @return void + */ + public function setQuantity($quantity) { + $this->quantity = $quantity; + } + + /** + * setPrintQuantity function. + * + * @access public + * @param integer $printQuantity + * @return void + */ + public function setPrintQuantity($printQuantity) { + $this->printQuantity = $printQuantity; + } + + /** + * setSourceItemId function. + * + * @access public + * @param mixed $sourceItemId + * @return void + */ + public function setSourceItemId($sourceItemId) { + $this->sourceItemId = $sourceItemId; + } + + /** + * setSKU function. + * + * @access public + * @param mixed $skuCode + * @return void + */ + public function setSKU($skuCode) { + $this->sku = $skuCode; + } /** * setExtraData function. diff --git a/src/order/orderData/shipment/shipment.php b/src/order/orderData/shipment/shipment.php index 8c6d08c..04035d3 100644 --- a/src/order/orderData/shipment/shipment.php +++ b/src/order/orderData/shipment/shipment.php @@ -28,6 +28,7 @@ public function init() { $this->__addProperty("pspBranding", true); $this->__addProperty("labelName"); $this->__addProperty("cost"); + $this->__addProperty("slaDays"); $this->__addProperty("dispatchAlert"); } @@ -171,6 +172,17 @@ public function setCarrierByAlias($alias) { public function setLabelName($labelName) { $this->labelName = $labelName; } + + /** + * setSlaDays function. + * + * @access public + * @param integer $slaDays + * @return void + */ + public function setSlaDays($slaDays) { + $this->slaDays = $slaDays; + } } ?> diff --git a/tests/order/orderTest.php b/tests/order/orderTest.php index 11e2e5c..f2fd205 100644 --- a/tests/order/orderTest.php +++ b/tests/order/orderTest.php @@ -19,6 +19,7 @@ public function testCanBuildASingleItemOrder() ]); $item = $orderData->newSKUItem('skuCode', 'itemId', 5); + $item->setPrintQuantity(1); $item->setBarcode('customItemBarcode'); $item->setDispatchAlert('my item dispatch alert'); $item->setExtraData([ @@ -75,6 +76,7 @@ public function testCanBuildASingleItemOrder() $shipment->newAttachment('http://site.com/attachment.pdf', 'insert'); $shipment->setDispatchAlert('my shipment dispatch alert'); $shipment->setLabelName('labelName'); + $shipment->setSlaDays(5); $item->setShipment($shipment); $stockItem->setShipment($shipment); @@ -107,6 +109,7 @@ public function testCanBuildASingleItemOrder() $this->assertEquals('itemId', $outputItem->sourceItemId); $this->assertEquals('customItemBarcode', $outputItem->barcode); $this->assertEquals(5, $outputItem->quantity); + $this->assertEquals(1, $outputItem->printQuantity); $this->assertEquals(0, $outputItem->shipmentIndex); $this->assertEquals('my item dispatch alert', $outputItem->dispatchAlert); $this->assertObjectHasAttribute('extraData', $outputItem); @@ -176,6 +179,7 @@ public function testCanBuildASingleItemOrder() $this->assertEquals('carrierCode', $outputShipment->carrier->code); $this->assertEquals('carrierService', $outputShipment->carrier->service); $this->assertEquals('carrierAlias', $outputShipment->carrier->alias); + $this->assertEquals(5, $outputShipment->slaDays); $this->assertEquals(1, count($outputShipment->attachments)); $outputAttachment = $outputShipment->attachments[0];