Fixing Invoice Phone Attribute

- Also updated the Update Invoice Sample
This commit is contained in:
japatel
2014-11-20 17:00:19 -06:00
parent b5809666b4
commit 24e0609e5b
15 changed files with 460 additions and 265 deletions

View File

@@ -11,208 +11,14 @@ use PayPal\Common\PPModel;
*
* @package PayPal\Api
*
* @property string line1
* @property string line2
* @property string city
* @property string country_code
* @property string postal_code
* @property string state
* @property string phone
*/
class Address extends PPModel
class Address extends BaseAddress
{
/**
* Line 1 of the Address (eg. number, street, etc).
*
* @param string $line1
*
* @return $this
*/
public function setLine1($line1)
{
$this->line1 = $line1;
return $this;
}
/**
* Line 1 of the Address (eg. number, street, etc).
*
* @return string
*/
public function getLine1()
{
return $this->line1;
}
/**
* Optional line 2 of the Address (eg. suite, apt #, etc.).
*
* @param string $line2
*
* @return $this
*/
public function setLine2($line2)
{
$this->line2 = $line2;
return $this;
}
/**
* Optional line 2 of the Address (eg. suite, apt #, etc.).
*
* @return string
*/
public function getLine2()
{
return $this->line2;
}
/**
* City name.
*
* @param string $city
*
* @return $this
*/
public function setCity($city)
{
$this->city = $city;
return $this;
}
/**
* City name.
*
* @return string
*/
public function getCity()
{
return $this->city;
}
/**
* 2 letter country code.
*
* @param string $country_code
*
* @return $this
*/
public function setCountryCode($country_code)
{
$this->country_code = $country_code;
return $this;
}
/**
* 2 letter country code.
*
* @return string
*/
public function getCountryCode()
{
return $this->country_code;
}
/**
* 2 letter country code.
*
* @deprecated Instead use setCountryCode
*
* @param string $country_code
* @return $this
*/
public function setCountry_code($country_code)
{
$this->country_code = $country_code;
return $this;
}
/**
* 2 letter country code.
* @deprecated Instead use getCountryCode
*
* @return string
*/
public function getCountry_code()
{
return $this->country_code;
}
/**
* Zip code or equivalent is usually required for countries that have them. For list of countries that do not have postal codes please refer to http://en.wikipedia.org/wiki/Postal_code.
*
* @param string $postal_code
*
* @return $this
*/
public function setPostalCode($postal_code)
{
$this->postal_code = $postal_code;
return $this;
}
/**
* Zip code or equivalent is usually required for countries that have them. For list of countries that do not have postal codes please refer to http://en.wikipedia.org/wiki/Postal_code.
*
* @return string
*/
public function getPostalCode()
{
return $this->postal_code;
}
/**
* Zip code or equivalent is usually required for countries that have them. For list of countries that do not have postal codes please refer to http://en.wikipedia.org/wiki/Postal_code.
*
* @deprecated Instead use setPostalCode
*
* @param string $postal_code
* @return $this
*/
public function setPostal_code($postal_code)
{
$this->postal_code = $postal_code;
return $this;
}
/**
* Zip code or equivalent is usually required for countries that have them. For list of countries that do not have postal codes please refer to http://en.wikipedia.org/wiki/Postal_code.
* @deprecated Instead use getPostalCode
*
* @return string
*/
public function getPostal_code()
{
return $this->postal_code;
}
/**
* 2 letter code for US states, and the equivalent for other countries.
*
* @param string $state
*
* @return $this
*/
public function setState($state)
{
$this->state = $state;
return $this;
}
/**
* 2 letter code for US states, and the equivalent for other countries.
*
* @return string
*/
public function getState()
{
return $this->state;
}
/**
* Phone number in E.123 format.
*
* @param \PayPal\Api\Phone $phone
* @param string $phone
*
* @return $this
*/
@@ -225,7 +31,7 @@ class Address extends PPModel
/**
* Phone number in E.123 format.
*
* @return \PayPal\Api\Phone
* @return string
*/
public function getPhone()
{

View File

@@ -0,0 +1,211 @@
<?php
namespace PayPal\Api;
use PayPal\Common\PPModel;
/**
* Class BaseAddress
*
* Base Address object used as billing address in a payment or extended for Shipping Address.
*
* @package PayPal\Api
*
* @property string line1
* @property string line2
* @property string city
* @property string country_code
* @property string postal_code
* @property string state
*/
class BaseAddress extends PPModel
{
/**
* Line 1 of the Address (eg. number, street, etc).
*
* @param string $line1
*
* @return $this
*/
public function setLine1($line1)
{
$this->line1 = $line1;
return $this;
}
/**
* Line 1 of the Address (eg. number, street, etc).
*
* @return string
*/
public function getLine1()
{
return $this->line1;
}
/**
* Optional line 2 of the Address (eg. suite, apt #, etc.).
*
* @param string $line2
*
* @return $this
*/
public function setLine2($line2)
{
$this->line2 = $line2;
return $this;
}
/**
* Optional line 2 of the Address (eg. suite, apt #, etc.).
*
* @return string
*/
public function getLine2()
{
return $this->line2;
}
/**
* City name.
*
* @param string $city
*
* @return $this
*/
public function setCity($city)
{
$this->city = $city;
return $this;
}
/**
* City name.
*
* @return string
*/
public function getCity()
{
return $this->city;
}
/**
* 2 letter country code.
*
* @param string $country_code
*
* @return $this
*/
public function setCountryCode($country_code)
{
$this->country_code = $country_code;
return $this;
}
/**
* 2 letter country code.
*
* @return string
*/
public function getCountryCode()
{
return $this->country_code;
}
/**
* 2 letter country code.
*
* @deprecated Instead use setCountryCode
*
* @param string $country_code
* @return $this
*/
public function setCountry_code($country_code)
{
$this->country_code = $country_code;
return $this;
}
/**
* 2 letter country code.
* @deprecated Instead use getCountryCode
*
* @return string
*/
public function getCountry_code()
{
return $this->country_code;
}
/**
* Zip code or equivalent is usually required for countries that have them. For list of countries that do not have postal codes please refer to http://en.wikipedia.org/wiki/Postal_code.
*
* @param string $postal_code
*
* @return $this
*/
public function setPostalCode($postal_code)
{
$this->postal_code = $postal_code;
return $this;
}
/**
* Zip code or equivalent is usually required for countries that have them. For list of countries that do not have postal codes please refer to http://en.wikipedia.org/wiki/Postal_code.
*
* @return string
*/
public function getPostalCode()
{
return $this->postal_code;
}
/**
* Zip code or equivalent is usually required for countries that have them. For list of countries that do not have postal codes please refer to http://en.wikipedia.org/wiki/Postal_code.
*
* @deprecated Instead use setPostalCode
*
* @param string $postal_code
* @return $this
*/
public function setPostal_code($postal_code)
{
$this->postal_code = $postal_code;
return $this;
}
/**
* Zip code or equivalent is usually required for countries that have them. For list of countries that do not have postal codes please refer to http://en.wikipedia.org/wiki/Postal_code.
* @deprecated Instead use getPostalCode
*
* @return string
*/
public function getPostal_code()
{
return $this->postal_code;
}
/**
* 2 letter code for US states, and the equivalent for other countries.
*
* @param string $state
*
* @return $this
*/
public function setState($state)
{
$this->state = $state;
return $this;
}
/**
* 2 letter code for US states, and the equivalent for other countries.
*
* @return string
*/
public function getState()
{
return $this->state;
}
}

View File

@@ -15,7 +15,7 @@ use PayPal\Common\PPModel;
* @property string first_name
* @property string last_name
* @property string business_name
* @property \PayPal\Api\Address address
* @property \PayPal\Api\InvoiceAddress address
* @property string language
* @property string additional_info
* @property string notification_channel
@@ -193,7 +193,7 @@ class BillingInfo extends PPModel
/**
* Address of the invoice recipient.
*
* @param \PayPal\Api\Address $address
* @param \PayPal\Api\InvoiceAddress $address
*
* @return $this
*/
@@ -206,7 +206,7 @@ class BillingInfo extends PPModel
/**
* Address of the invoice recipient.
*
* @return \PayPal\Api\Address
* @return \PayPal\Api\InvoiceAddress
*/
public function getAddress()
{

View File

@@ -0,0 +1,41 @@
<?php
namespace PayPal\Api;
use PayPal\Common\PPModel;
/**
* Class InvoiceAddress
*
* Base Address object used as billing address in a payment or extended for Shipping Address.
*
* @package PayPal\Api
*
* @property \PayPal\Api\Phone phone
*/
class InvoiceAddress extends BaseAddress
{
/**
* Phone number in E.123 format.
*
* @param \PayPal\Api\Phone $phone
*
* @return $this
*/
public function setPhone($phone)
{
$this->phone = $phone;
return $this;
}
/**
* Phone number in E.123 format.
*
* @return \PayPal\Api\Phone
*/
public function getPhone()
{
return $this->phone;
}
}

View File

@@ -14,7 +14,7 @@ use PayPal\Common\PPModel;
* @property string email
* @property string first_name
* @property string last_name
* @property \PayPal\Api\Address address
* @property \PayPal\Api\InvoiceAddress address
* @property string business_name
* @property \PayPal\Api\Phone phone
* @property \PayPal\Api\Phone fax
@@ -146,7 +146,7 @@ class MerchantInfo extends PPModel
/**
* Address of the merchant.
*
* @param \PayPal\Api\Address $address
* @param \PayPal\Api\InvoiceAddress $address
*
* @return $this
*/
@@ -159,7 +159,7 @@ class MerchantInfo extends PPModel
/**
* Address of the merchant.
*
* @return \PayPal\Api\Address
* @return \PayPal\Api\InvoiceAddress
*/
public function getAddress()
{

View File

@@ -13,6 +13,7 @@ use PayPal\Common\PPModel;
*
* @property string country_code
* @property string national_number
* @property string extension
*/
class Phone extends PPModel
{

View File

@@ -15,7 +15,7 @@ use PayPal\Common\PPModel;
* @property string last_name
* @property string business_name
* @property \PayPal\Api\Phone phone
* @property \PayPal\Api\Address address
* @property \PayPal\Api\InvoiceAddress address
*/
class ShippingInfo extends PPModel
{
@@ -188,7 +188,7 @@ class ShippingInfo extends PPModel
/**
* Address of the invoice recipient.
*
* @param \PayPal\Api\Address $address
* @param \PayPal\Api\InvoiceAddress $address
*
* @return $this
*/
@@ -201,7 +201,7 @@ class ShippingInfo extends PPModel
/**
* Address of the invoice recipient.
*
* @return \PayPal\Api\Address
* @return \PayPal\Api\InvoiceAddress
*/
public function getAddress()
{

View File

@@ -87,7 +87,11 @@ class PPModel
public function __set($key, $value)
{
ModelAccessorValidator::validate($this, $this->convertToCamelCase($key));
$this->_propMap[$key] = $value;
if ($value == null) {
$this->__unset($key);
} else {
$this->_propMap[$key] = $value;
}
}
/**