Skip to content

Commit

Permalink
feat: added properties and methods, removed empty string defaults, re…
Browse files Browse the repository at this point in the history
…moved item shrinkWrap property
  • Loading branch information
joseandrespg committed May 10, 2019
1 parent aaa2baf commit a8f5ad9
Show file tree
Hide file tree
Showing 8 changed files with 248 additions and 16 deletions.
24 changes: 18 additions & 6 deletions src/order/orderData/item/component/component.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,18 @@ public function init() {
$this->__addProperty("type");
$this->__addProperty("code");
$this->__addProperty("path");
$this->__addProperty("barcode", "");
$this->__addProperty("barcode");
$this->__addProperty("fetch", false);
$this->__addProperty("localFile", false);
$this->__addProperty("preflight");
$this->__addProperty("preflightProfile");
$this->__addProperty("preflightProfileId");
$this->__addProperty("paper", "", false);
$this->__addProperty("weight", "", false);
$this->__addProperty("pages", "", false);
$this->__addProperty("width", "", false);
$this->__addProperty("height", "", false);
$this->__addProperty("paper" );
$this->__addProperty("weight" );
$this->__addProperty("pages" );
$this->__addProperty("width");
$this->__addProperty("height");
$this->__addProperty("duplicate");
$this->__addArray("attributes", null);
$this->__addArray("extraData", null);
}
Expand Down Expand Up @@ -280,6 +281,17 @@ public function addAttribute($name, $value = null) {
$this->attributes[$name] = $value;
}

/**
* setDuplicate function.
*
* @access public
* @param integer $duplicate
* @return void
*/
public function setDuplicate($duplicate) {
$this->duplicate = $duplicate;
}

/**
* setExtraData function.
*
Expand Down
51 changes: 49 additions & 2 deletions src/order/orderData/item/item.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,14 @@ public function init() {
$this->__addProperty("shipmentIndex", 0, true);
$this->__addProperty("sourceItemId", "", true);
$this->__addProperty("sku");
$this->__addProperty("sourceProductId");
$this->__addProperty("quantity", 1, true);
$this->__addProperty("printQuantity");
$this->__addProperty("shrinkWrap", false);
$this->__addProperty("barcode", "", false);
$this->__addProperty("barcode");
$this->__addProperty("dispatchAlert");
$this->__addProperty("unitWeight");
$this->__addProperty("unitCost");
$this->__addProperty("unitPrice");
$this->__addArray("extraData",null);

$this->__addProperty("colour");
Expand Down Expand Up @@ -171,6 +174,50 @@ public function setSKU($skuCode) {
$this->sku = $skuCode;
}

/**
* setSourceProductId function.
*
* @access public
* @param string $sourceProductId
* @return void
*/
public function setSourceProductId($sourceProductId) {
$this->sourceProductId = $sourceProductId;
}

/**
* setUnitWeight function.
*
* @access public
* @param float $unitWeight
* @return void
*/
public function setUnitWeight($unitWeight) {
$this->unitWeight = $unitWeight;
}

/**
* setUnitPrice function.
*
* @access public
* @param float $unitPrice
* @return void
*/
public function setUnitPrice($unitPrice) {
$this->unitPrice = $unitPrice;
}

/**
* setUnitCost function.
*
* @access public
* @param float $unitCost
* @return void
*/
public function setUnitCost($unitCost) {
$this->unitCost = $unitCost;
}

/**
* setExtraData function.
*
Expand Down
34 changes: 33 additions & 1 deletion src/order/orderData/orderData.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,14 @@ public function init() {
$this->__addProperty("email","");
$this->__addProperty("misCode");
$this->__addProperty("amount", 0, "numeric"); //check this validation
$this->__addProperty("currency", "", false);
$this->__addProperty("currency");
$this->__addProperty("deliveryDate"); //check whether required in SKU Orders
$this->__addProperty("shipbyDate"); //check whether required in SKU Orders
$this->__addProperty("customerName","");
$this->__addProperty("purchaseOrderNumber");
$this->__addProperty("consolidatedInvoice");
$this->__addProperty("tax");
$this->__addProperty("instructions");

}

Expand Down Expand Up @@ -80,6 +81,25 @@ public function newSKUItem($skuCode, $sourceItemId, $quantity = 1) {
return $item;
}

/**
* newSourceProductIdItem function.
*
* @access public
* @param string $sourceProductId
* @param mixed $sourceItemId
* @param integer $quantity
* @return OneFlowItem
*/
public function newSourceProductIdItem($sourceProductId, $sourceItemId, $quantity = 1) {
$item = new OneFlowItem();
$item->setSourceItemId($sourceItemId);
$item->setQuantity($quantity);
$item->setSourceProductId($sourceProductId);

$this->items[] = $item;
return $item;
}

/**
* newStockItem function.
*
Expand Down Expand Up @@ -197,6 +217,18 @@ public function setEmail($email) {
public function setExtraData($extraData) {
$this->extraData = $extraData;
}

/**
* setInstructions function.
*
* @access public
* @param string $instructions
* @return void
*/
public function setInstructions($instructions)
{
$this->instructions = $instructions;
}
}

?>
4 changes: 2 additions & 2 deletions src/order/orderData/shipment/address/address.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ public function init() {
$this->__addProperty("address3", "");
$this->__addProperty("town", "", true);
$this->__addProperty("state", "");
$this->__addProperty("postcode", "", true);
$this->__addProperty("postcode", "");
$this->__addProperty("isoCountry", "", true);
$this->__addProperty("country", "");
$this->__addProperty("phone");
$this->__addProperty("email", "");
}
}

?>
?>
37 changes: 36 additions & 1 deletion src/order/orderData/shipment/attachments/attachments.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ class OneFlowAttachment extends OneFlowBase {
public function init() {
$this->__addProperty("path", "", true);
$this->__addProperty("type", "", false);
$this->__addProperty("contentType");
$this->__addProperty("fetch");
}

/**
Expand All @@ -28,6 +30,39 @@ public function init() {
public function setPath($path) {
$this->path = $path;
}

/**
* setType function.
*
* @access public
* @param string $type
* @return void
*/
public function setType($type) {
$this->type = $type;
}

/**
* setContentType function.
*
* @access public
* @param string $contentType
* @return void
*/
public function setContentType($contentType) {
$this->contentType = $contentType;
}

/**
* setFetch function.
*
* @access public
* @param boolean $fetch
* @return void
*/
public function setFetch($fetch) {
$this->fetch = $fetch;
}
}

?>
?>
34 changes: 32 additions & 2 deletions src/order/orderData/shipment/shipment.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ public function init() {
$this->__addProperty("cost");
$this->__addProperty("slaDays");
$this->__addProperty("dispatchAlert");
$this->__addProperty("canShipEarly");
$this->__addProperty("shipByDate");
}

/**
Expand All @@ -39,13 +41,17 @@ public function init() {
*
* @param string $path
* @param null|string $type
* @param null|string $contentType
* @param null|boolean $fetch
*
* @return \OneFlowAttachment
*/
public function newAttachment($path, $type = null) {
public function newAttachment($path, $type = null, $contentType = null, $fetch = null) {
$attachment = new OneFlowAttachment();
$attachment->setPath($path);
if($type) $attachment->setValue("type", $type);
if($type) $attachment->setType($type);
if($contentType) $attachment->setContentType($contentType);
if($fetch !== null) $attachment->setFetch($fetch);
$this->attachments[] = $attachment;
return end($this->attachments);
}
Expand Down Expand Up @@ -183,6 +189,30 @@ public function setLabelName($labelName) {
public function setSlaDays($slaDays) {
$this->slaDays = $slaDays;
}

/**
* setCanShipEarly function.
*
* @access public
* @param boolean $canShipEarly
* @return void
*/
public function setCanShipEarly($canShipEarly)
{
$this->canShipEarly = $canShipEarly;
}

/**
* setShipByDate function.
*
* @access public
* @param string $shipByDate Using the format YYYY-MM-DD
* @return void
*/
public function setShipByDate($shipByDate)
{
$this->shipByDate = $shipByDate;
}
}

?>
26 changes: 26 additions & 0 deletions src/order/orderData/stockItem/stockItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ public function init() {
$this->__addProperty("code");
$this->__addProperty("quantity", 1, false);
$this->__addProperty("shipmentIndex");
$this->__addProperty("name");
$this->__addProperty("unitPrice");
}

/**
Expand Down Expand Up @@ -63,6 +65,30 @@ public function setShipment($shipment) {
public function setShipmentIndex($shipmentIndex) {
$this->shipmentIndex = $shipmentIndex;
}

/**
* setName function.
*
* @access public
* @param string $name
* @return void
*/
public function setName($name)
{
$this->name = $name;
}

/**
* setUnitPrice function.
*
* @access public
* @param number $unitPrice
* @return void
*/
public function setUnitPrice($unitPrice)
{
$this->unitPrice = $unitPrice;
}
}

?>
Loading

0 comments on commit a8f5ad9

Please sign in to comment.