forked from LiveCarta/PayPal-PHP-SDK
Enabled EC Parameters support
- Updated Api to enabled EC Parameters - Updated Tests - Updated Logging Manager - Added a feature to do validation on accessors.
This commit is contained in:
@@ -8,48 +8,33 @@ use PayPal\Rest\ApiContext;
|
||||
/**
|
||||
* Class ItemList
|
||||
*
|
||||
* @property array|\PayPal\Api\Item items
|
||||
* List of items being paid for.
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property \PayPal\Api\Item items
|
||||
* @property \PayPal\Api\ShippingAddress shipping_address
|
||||
*/
|
||||
class ItemList extends PPModel
|
||||
{
|
||||
|
||||
/**
|
||||
* Construct an empty list.
|
||||
*/
|
||||
function __construct()
|
||||
{
|
||||
$this->items = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this list empty?
|
||||
*/
|
||||
public function isEmpty()
|
||||
{
|
||||
return empty($this->items);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Items
|
||||
* List of Items
|
||||
*
|
||||
* @param array|\PayPal\Api\Item $items
|
||||
* List of items.
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\Item $items
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setItems($items)
|
||||
{
|
||||
$this->items = $items;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Items
|
||||
* List of items
|
||||
* List of items.
|
||||
*
|
||||
* @return \PayPal\Api\Item
|
||||
* @return \PayPal\Api\Item[]
|
||||
*/
|
||||
public function getItems()
|
||||
{
|
||||
@@ -57,10 +42,11 @@ class ItemList extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Shipping Address
|
||||
* Shipping address.
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\ShippingAddress $shipping_address
|
||||
*
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setShippingAddress($shipping_address)
|
||||
@@ -70,32 +56,7 @@ class ItemList extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Append an item to the list.
|
||||
*
|
||||
* @return PayPal\Api\Item
|
||||
*/
|
||||
public function addItem($item)
|
||||
{
|
||||
return $this->setItems(
|
||||
array_merge($this->items, array($item))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove an item from the list.
|
||||
* Items are compared using === comparision (PHP.net)
|
||||
*
|
||||
* @return PayPal\Api\Item
|
||||
*/
|
||||
public function removeItem($item)
|
||||
{
|
||||
return $this->setItems(
|
||||
array_diff($this->items, array($item))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Shipping Address
|
||||
* Shipping address.
|
||||
*
|
||||
* @return \PayPal\Api\ShippingAddress
|
||||
*/
|
||||
@@ -105,25 +66,22 @@ class ItemList extends PPModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Shipping Address
|
||||
* Shipping address.
|
||||
*
|
||||
* @deprecated Instead use setShippingAddress
|
||||
*
|
||||
* @param \PayPal\Api\ShippingAddress $shipping_address
|
||||
*
|
||||
* @deprecated Use setShippingAddress
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setShipping_address($shipping_address)
|
||||
{
|
||||
$this->shipping_address = $shipping_address;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Shipping Address
|
||||
*
|
||||
* @deprecated Use getShippingAddress
|
||||
* Shipping address.
|
||||
* @deprecated Instead use getShippingAddress
|
||||
*
|
||||
* @return \PayPal\Api\ShippingAddress
|
||||
*/
|
||||
@@ -131,4 +89,5 @@ class ItemList extends PPModel
|
||||
{
|
||||
return $this->shipping_address;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user