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,8 +87,12 @@ class PPModel
public function __set($key, $value)
{
ModelAccessorValidator::validate($this, $this->convertToCamelCase($key));
if ($value == null) {
$this->__unset($key);
} else {
$this->_propMap[$key] = $value;
}
}
/**
* Converts the input key into a valid Setter Method Name

View File

@@ -1020,6 +1020,14 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3
"slug": "update-invoice"
},
"depth": 3
}, {
"type": "heading",
"data": {
"level": 3,
"title": "NOTE: These are the work-around added to the",
"slug": "note-these-are-the-work-around-added-to-the"
},
"depth": 3
}, {
"type": "heading",
"data": {

View File

@@ -2,8 +2,13 @@
<p>This sample code demonstrate how you can update
an invoice.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> Invoice $invoice */</span>
<span class="hljs-variable">$invoice</span> = <span class="hljs-keyword">require</span> <span class="hljs-string">'CreateInvoice.php'</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Invoice</span>;</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="update-invoice">Update Invoice</h3>
<p>Lets update some information</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$invoice</span>-&gt;setInvoiceDate(<span class="hljs-string">"2014-11-16 PST"</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>For Sample Purposes Only.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$request</span> = <span class="hljs-keyword">clone</span> <span class="hljs-variable">$invoice</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Invoice</span>;</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>For Sample Purposes Only.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$request</span> = <span class="hljs-keyword">clone</span> <span class="hljs-variable">$invoice</span>;</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="update-invoice">Update Invoice</h3>
<p>Lets update some information</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$invoice</span>-&gt;setInvoiceDate(<span class="hljs-string">"2014-12-16 PST"</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="note-these-are-the-work-around-added-to-the">NOTE: These are the work-around added to the</h3>
<p>sample, to get past the bug in PayPal APIs.
There is already an internal ticket #PPTIPS-1932 created for it.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$invoice</span>-&gt;setDiscount(<span class="hljs-keyword">null</span>);
<span class="hljs-variable">$billingInfo</span> = <span class="hljs-variable">$invoice</span>-&gt;getBillingInfo()[<span class="hljs-number">0</span>];
<span class="hljs-variable">$billingInfo</span>-&gt;setAddress(<span class="hljs-keyword">null</span>);
<span class="hljs-variable">$invoice</span>-&gt;getPaymentTerm()-&gt;setDueDate(<span class="hljs-keyword">null</span>);
<span class="hljs-keyword">try</span> {</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="update-invoice">Update Invoice</h3>
<p>Update an invoice by calling the invoice-&gt;update() method

View File

@@ -44,6 +44,10 @@ if (PHP_SAPI == 'cli') {
-webkit-font-smoothing: antialiased;
}
li.list-group-item:hover {
background-color: #EEE;
}
@media (max-width: 992px) {
.jumbotron {
background: white;
@@ -201,7 +205,7 @@ if (PHP_SAPI == 'cli') {
<div class="row">
<div class="col-md-8"><h5>Direct credit card payments</h5></div>
<div class="col-md-4">
<a href="payments/CreatePayment.php" class="btn btn-primary pull-left execute"> Execute <i
<a href="payments/CreatePayment.php" class="btn btn-primary pull-left execute"> Try It <i
class="fa fa-play-circle-o"></i></a>
<a href="doc/payments/CreatePayment.html" class="btn btn-default pull-right">Source <i
class="fa fa-file-code-o"></i></a>
@@ -213,7 +217,7 @@ if (PHP_SAPI == 'cli') {
<div class="col-md-8"><h5>PayPal account payments</h5></div>
<div class="col-md-4">
<a href="payments/CreatePaymentUsingPayPal.php" class="btn btn-primary pull-left execute">
Execute
Try It
<i class="fa fa-play-circle-o"></i></a><a
href="doc/payments/CreatePaymentUsingPayPal.html"
class="btn btn-default pull-right">Source <i
@@ -227,7 +231,7 @@ if (PHP_SAPI == 'cli') {
<div class="col-md-4">
<a href="payments/CreatePaymentUsingSavedCard.php"
class="btn btn-primary pull-left execute">
Execute <i class="fa fa-play-circle-o"></i></a>
Try It <i class="fa fa-play-circle-o"></i></a>
<a href="doc/payments/CreatePayment.html" class="btn btn-default pull-right">Source <i
class="fa fa-file-code-o"></i></a>
</div>
@@ -252,7 +256,7 @@ if (PHP_SAPI == 'cli') {
<div class="row">
<div class="col-md-8"><h5>Get payment details</h5></div>
<div class="col-md-4">
<a href="payments/GetPayment.php" class="btn btn-primary pull-left execute"> Execute <i
<a href="payments/GetPayment.php" class="btn btn-primary pull-left execute"> Try It <i
class="fa fa-play-circle-o"></i></a>
<a href="doc/payments/CreatePayment.html" class="btn btn-default pull-right">Source <i
class="fa fa-file-code-o"></i></a>
@@ -263,7 +267,7 @@ if (PHP_SAPI == 'cli') {
<div class="row">
<div class="col-md-8"><h5>Get payment history</h5></div>
<div class="col-md-4">
<a href="payments/ListPayments.php" class="btn btn-primary pull-left execute"> Execute <i
<a href="payments/ListPayments.php" class="btn btn-primary pull-left execute"> Try It <i
class="fa fa-play-circle-o"></i></a>
<a href="doc/payments/CreatePayment.html" class="btn btn-default pull-right">Source <i
class="fa fa-file-code-o"></i></a>
@@ -285,7 +289,7 @@ if (PHP_SAPI == 'cli') {
<div class="row">
<div class="col-md-8"><h5>Authorize Payment</h5></div>
<div class="col-md-4">
<a href="payments/AuthorizePayment.php" class="btn btn-primary pull-left execute"> Execute
<a href="payments/AuthorizePayment.php" class="btn btn-primary pull-left execute"> Try It
<i
class="fa fa-play-circle-o"></i></a>
<a href="doc/payments/AuthorizePayment.html" class="btn btn-default pull-right">Source <i
@@ -297,7 +301,7 @@ if (PHP_SAPI == 'cli') {
<div class="row">
<div class="col-md-8"><h5>Get details of an authorized payment</h5></div>
<div class="col-md-4">
<a href="payments/GetAuthorization.php" class="btn btn-primary pull-left execute"> Execute
<a href="payments/GetAuthorization.php" class="btn btn-primary pull-left execute"> Try It
<i
class="fa fa-play-circle-o"></i></a>
<a href="doc/payments/GetAuthorization.html" class="btn btn-default pull-right">Source <i
@@ -310,7 +314,7 @@ if (PHP_SAPI == 'cli') {
<div class="col-md-8"><h5>Capture an authorized payment</h5></div>
<div class="col-md-4">
<a href="payments/AuthorizationCapture.php" class="btn btn-primary pull-left execute">
Execute <i
Try It <i
class="fa fa-play-circle-o"></i></a>
<a href="doc/payments/AuthorizationCapture.html" class="btn btn-default pull-right">Source
<i
@@ -322,7 +326,7 @@ if (PHP_SAPI == 'cli') {
<div class="row">
<div class="col-md-8"><h5>Get details of a captured payment</h5></div>
<div class="col-md-4">
<a href="payments/GetCapture.php" class="btn btn-primary pull-left execute"> Execute <i
<a href="payments/GetCapture.php" class="btn btn-primary pull-left execute"> Try It <i
class="fa fa-play-circle-o"></i></a>
<a href="doc/payments/GetCapture.html" class="btn btn-default pull-right">Source <i
class="fa fa-file-code-o"></i></a>
@@ -333,7 +337,7 @@ if (PHP_SAPI == 'cli') {
<div class="row">
<div class="col-md-8"><h5>Void an authorized payment</h5></div>
<div class="col-md-4">
<a href="payments/VoidAuthorization.php" class="btn btn-primary pull-left execute"> Execute
<a href="payments/VoidAuthorization.php" class="btn btn-primary pull-left execute"> Try It
<i
class="fa fa-play-circle-o"></i></a>
<a href="doc/payments/VoidAuthorization.html" class="btn btn-default pull-right">Source <i
@@ -345,7 +349,7 @@ if (PHP_SAPI == 'cli') {
<div class="row">
<div class="col-md-8"><h5>Reauthorize a payment</h5></div>
<div class="col-md-4">
<a href="payments/Reauthorization.php" class="btn btn-primary pull-left execute"> Execute <i
<a href="payments/Reauthorization.php" class="btn btn-primary pull-left execute"> Try It <i
class="fa fa-play-circle-o"></i></a>
<a href="doc/payments/Reauthorization.html" class="btn btn-default pull-right">Source <i
class="fa fa-file-code-o"></i></a>
@@ -356,7 +360,7 @@ if (PHP_SAPI == 'cli') {
<div class="row">
<div class="col-md-8"><h5>Refund captured payment</h5></div>
<div class="col-md-4">
<a href="payments/RefundCapture.php" class="btn btn-primary pull-left execute"> Execute <i
<a href="payments/RefundCapture.php" class="btn btn-primary pull-left execute"> Try It <i
class="fa fa-play-circle-o"></i></a>
<a href="doc/payments/RefundCapture.html" class="btn btn-default pull-right">Source <i
class="fa fa-file-code-o"></i></a>
@@ -378,7 +382,7 @@ if (PHP_SAPI == 'cli') {
<div class="row">
<div class="col-md-8"><h5>Get Sale details</h5></div>
<div class="col-md-4">
<a href="sale/GetSale.php" class="btn btn-primary pull-left execute"> Execute <i
<a href="sale/GetSale.php" class="btn btn-primary pull-left execute"> Try It <i
class="fa fa-play-circle-o"></i></a>
<a href="doc/sale/GetSale.html" class="btn btn-default pull-right">Source <i
class="fa fa-file-code-o"></i></a>
@@ -389,7 +393,7 @@ if (PHP_SAPI == 'cli') {
<div class="row">
<div class="col-md-8"><h5>Refund a Sale</h5></div>
<div class="col-md-4">
<a href="sale/RefundSale.php" class="btn btn-primary pull-left execute"> Execute <i
<a href="sale/RefundSale.php" class="btn btn-primary pull-left execute"> Try It <i
class="fa fa-play-circle-o"></i></a>
<a href="doc/sale/RefundSale.html" class="btn btn-default pull-right">Source <i
class="fa fa-file-code-o"></i></a>
@@ -411,7 +415,7 @@ if (PHP_SAPI == 'cli') {
<div class="row">
<div class="col-md-8"><h5>Create Billing Plan</h5></div>
<div class="col-md-4">
<a href="billing/CreatePlan.php" class="btn btn-primary pull-left execute"> Execute <i
<a href="billing/CreatePlan.php" class="btn btn-primary pull-left execute"> Try It <i
class="fa fa-play-circle-o"></i></a>
<a href="doc/billing/CreatePlan.html" class="btn btn-default pull-right">Source <i
class="fa fa-file-code-o"></i></a>
@@ -422,7 +426,7 @@ if (PHP_SAPI == 'cli') {
<div class="row">
<div class="col-md-8"><h5>Get Billing Plan</h5></div>
<div class="col-md-4">
<a href="billing/GetPlan.php" class="btn btn-primary pull-left execute"> Execute <i
<a href="billing/GetPlan.php" class="btn btn-primary pull-left execute"> Try It <i
class="fa fa-play-circle-o"></i></a>
<a href="doc/billing/GetPlan.html" class="btn btn-default pull-right">Source <i
class="fa fa-file-code-o"></i></a>
@@ -433,7 +437,7 @@ if (PHP_SAPI == 'cli') {
<div class="row">
<div class="col-md-8"><h5>Update/Activate Plan</h5></div>
<div class="col-md-4">
<a href="billing/UpdatePlan.php" class="btn btn-primary pull-left execute"> Execute <i
<a href="billing/UpdatePlan.php" class="btn btn-primary pull-left execute"> Try It <i
class="fa fa-play-circle-o"></i></a>
<a href="doc/billing/UpdatePlan.html" class="btn btn-default pull-right">Source <i
class="fa fa-file-code-o"></i></a>
@@ -446,7 +450,7 @@ if (PHP_SAPI == 'cli') {
<div class="col-md-4">
<a href="billing/UpdatePlanPaymentDefinitions.php"
class="btn btn-primary pull-left execute">
Execute <i class="fa fa-play-circle-o"></i></a>
Try It <i class="fa fa-play-circle-o"></i></a>
<a href="doc/billing/UpdatePlanPaymentDefinitions.html" class="btn btn-default pull-right">Source
<i
class="fa fa-file-code-o"></i></a>
@@ -457,7 +461,7 @@ if (PHP_SAPI == 'cli') {
<div class="row">
<div class="col-md-8"><h5>List Billing Plans</h5></div>
<div class="col-md-4">
<a href="billing/ListPlans.php" class="btn btn-primary pull-left execute"> Execute <i
<a href="billing/ListPlans.php" class="btn btn-primary pull-left execute"> Try It <i
class="fa fa-play-circle-o"></i></a>
<a href="doc/billing/ListPlans.html" class="btn btn-default pull-right">Source <i
class="fa fa-file-code-o"></i></a>
@@ -469,7 +473,7 @@ if (PHP_SAPI == 'cli') {
<div class="col-md-8"><h5>Create Billing Agreement With Credit Card</h5></div>
<div class="col-md-4">
<a href="billing/CreateBillingAgreementWithCreditCard.php"
class="btn btn-primary pull-left execute"> Execute <i
class="btn btn-primary pull-left execute"> Try It <i
class="fa fa-play-circle-o"></i></a>
<a href="doc/billing/CreateBillingAgreementWithCreditCard.html"
class="btn btn-default pull-right">Source
@@ -483,7 +487,7 @@ if (PHP_SAPI == 'cli') {
<div class="col-md-4">
<a href="billing/CreateBillingAgreementWithPayPal.php"
class="btn btn-primary pull-left execute">
Execute <i class="fa fa-play-circle-o"></i></a>
Try It <i class="fa fa-play-circle-o"></i></a>
<a href="doc/billing/CreateBillingAgreementWithPayPal.html"
class="btn btn-default pull-right">Source
<i class="fa fa-file-code-o"></i></a>
@@ -494,7 +498,7 @@ if (PHP_SAPI == 'cli') {
<div class="row">
<div class="col-md-8"><h5>Get Billing Agreement</h5></div>
<div class="col-md-4">
<a href="billing/GetBillingAgreement.php" class="btn btn-primary pull-left execute"> Execute
<a href="billing/GetBillingAgreement.php" class="btn btn-primary pull-left execute"> Try It
<i
class="fa fa-play-circle-o"></i></a>
<a href="doc/billing/GetBillingAgreement.html" class="btn btn-default pull-right">Source <i
@@ -507,7 +511,7 @@ if (PHP_SAPI == 'cli') {
<div class="col-md-8"><h5>Update Billing Agreement</h5></div>
<div class="col-md-4">
<a href="billing/UpdateBillingAgreement.php" class="btn btn-primary pull-left execute">
Execute <i
Try It <i
class="fa fa-play-circle-o"></i></a>
<a href="doc/billing/UpdateBillingAgreement.html" class="btn btn-default pull-right">Source
<i
@@ -520,7 +524,7 @@ if (PHP_SAPI == 'cli') {
<div class="col-md-8"><h5>Suspend Billing Agreement</h5></div>
<div class="col-md-4">
<a href="billing/SuspendBillingAgreement.php" class="btn btn-primary pull-left execute">
Execute <i
Try It <i
class="fa fa-play-circle-o"></i></a>
<a href="doc/billing/SuspendBillingAgreement.html" class="btn btn-default pull-right">Source
<i
@@ -533,7 +537,7 @@ if (PHP_SAPI == 'cli') {
<div class="col-md-8"><h5>Reactivate Billing Agreement</h5></div>
<div class="col-md-4">
<a href="billing/ReactivateBillingAgreement.php" class="btn btn-primary pull-left execute">
Execute
Try It
<i class="fa fa-play-circle-o"></i></a>
<a href="doc/billing/ReactivateBillingAgreement.html" class="btn btn-default pull-right">Source
<i
@@ -555,7 +559,7 @@ if (PHP_SAPI == 'cli') {
<div class="row">
<div class="col-md-8"><h5>Save a credit card</h5></div>
<div class="col-md-4">
<a href="vault/CreateCreditCard.php" class="btn btn-primary pull-left execute"> Execute <i
<a href="vault/CreateCreditCard.php" class="btn btn-primary pull-left execute"> Try It <i
class="fa fa-play-circle-o"></i></a>
<a href="doc/vault/CreateCreditCard.html" class="btn btn-default pull-right">Source <i
class="fa fa-file-code-o"></i></a>
@@ -566,7 +570,7 @@ if (PHP_SAPI == 'cli') {
<div class="row">
<div class="col-md-8"><h5>Retrieve saved credit card</h5></div>
<div class="col-md-4">
<a href="vault/GetCreditCard.php" class="btn btn-primary pull-left execute"> Execute <i
<a href="vault/GetCreditCard.php" class="btn btn-primary pull-left execute"> Try It <i
class="fa fa-play-circle-o"></i></a>
<a href="doc/vault/GetCreditCard.html" class="btn btn-default pull-right">Source <i
class="fa fa-file-code-o"></i></a>
@@ -577,7 +581,7 @@ if (PHP_SAPI == 'cli') {
<div class="row">
<div class="col-md-8"><h5>Delete saved credit card</h5></div>
<div class="col-md-4">
<a href="vault/DeleteCreditCard.php" class="btn btn-primary pull-left execute"> Execute <i
<a href="vault/DeleteCreditCard.php" class="btn btn-primary pull-left execute"> Try It <i
class="fa fa-play-circle-o"></i></a>
<a href="doc/vault/DeleteCreditCard.html" class="btn btn-default pull-right">Source <i
class="fa fa-file-code-o"></i></a>
@@ -600,7 +604,7 @@ if (PHP_SAPI == 'cli') {
<div class="col-md-8"><h5>Create a web experience profile</h5></div>
<div class="col-md-4">
<a href="payment-experience/CreateWebProfile.php" class="btn btn-primary pull-left execute">
Execute
Try It
<i class="fa fa-play-circle-o"></i></a>
<a href="doc/payment-experience/CreateWebProfile.html" class="btn btn-default pull-right">Source
<i
@@ -613,7 +617,7 @@ if (PHP_SAPI == 'cli') {
<div class="col-md-8"><h5>Retrieve a web experience profile</h5></div>
<div class="col-md-4">
<a href="payment-experience/GetWebProfile.php" class="btn btn-primary pull-left execute">
Execute <i
Try It <i
class="fa fa-play-circle-o"></i></a>
<a href="doc/payment-experience/GetWebProfile.html" class="btn btn-default pull-right">Source
<i
@@ -626,7 +630,7 @@ if (PHP_SAPI == 'cli') {
<div class="col-md-8"><h5>List web experience profiles</h5></div>
<div class="col-md-4">
<a href="payment-experience/ListWebProfiles.php" class="btn btn-primary pull-left execute">
Execute
Try It
<i class="fa fa-play-circle-o"></i></a>
<a href="doc/payment-experience/ListWebProfiles.html" class="btn btn-default pull-right">Source
<i
@@ -639,7 +643,7 @@ if (PHP_SAPI == 'cli') {
<div class="col-md-8"><h5>Update a web experience profile</h5></div>
<div class="col-md-4">
<a href="payment-experience/UpdateWebProfile.php" class="btn btn-primary pull-left execute">
Execute
Try It
<i class="fa fa-play-circle-o"></i></a>
<a href="doc/payment-experience/UpdateWebProfile.html" class="btn btn-default pull-right">Source
<i
@@ -652,7 +656,7 @@ if (PHP_SAPI == 'cli') {
<div class="col-md-8"><h5>Partially update a web experience profile</h5></div>
<div class="col-md-4">
<a href="payment-experience/PartiallyUpdateWebProfile.php"
class="btn btn-primary pull-left execute"> Execute <i
class="btn btn-primary pull-left execute"> Try It <i
class="fa fa-play-circle-o"></i></a>
<a href="doc/payment-experience/PartiallyUpdateWebProfile.html"
class="btn btn-default pull-right">Source
@@ -665,7 +669,7 @@ if (PHP_SAPI == 'cli') {
<div class="col-md-8"><h5>Delete a web experience profile</h5></div>
<div class="col-md-4">
<a href="payment-experience/DeleteWebProfile.php" class="btn btn-primary pull-left execute">
Execute
Try It
<i class="fa fa-play-circle-o"></i></a>
<a href="doc/payment-experience/DeleteWebProfile.html" class="btn btn-default pull-right">Source
<i
@@ -688,7 +692,7 @@ if (PHP_SAPI == 'cli') {
<div class="row">
<div class="col-md-8"><h5>Create an Invoice</h5></div>
<div class="col-md-4">
<a href="invoice/CreateInvoice.php" class="btn btn-primary pull-left execute"> Execute <i
<a href="invoice/CreateInvoice.php" class="btn btn-primary pull-left execute"> Try It <i
class="fa fa-play-circle-o"></i></a>
<a href="doc/invoice/CreateInvoice.html" class="btn btn-default pull-right">Source <i
class="fa fa-file-code-o"></i></a>
@@ -699,7 +703,7 @@ if (PHP_SAPI == 'cli') {
<div class="row">
<div class="col-md-8"><h5>Send an Invoice</h5></div>
<div class="col-md-4">
<a href="invoice/SendInvoice.php" class="btn btn-primary pull-left execute"> Execute <i
<a href="invoice/SendInvoice.php" class="btn btn-primary pull-left execute"> Try It <i
class="fa fa-play-circle-o"></i></a>
<a href="doc/invoice/SendInvoice.html" class="btn btn-default pull-right">Source <i
class="fa fa-file-code-o"></i></a>
@@ -710,7 +714,7 @@ if (PHP_SAPI == 'cli') {
<div class="row">
<div class="col-md-8"><h5>Update an Invoice</h5></div>
<div class="col-md-4">
<a href="invoice/UpdateInvoice.php" class="btn btn-primary pull-left execute"> Execute <i
<a href="invoice/UpdateInvoice.php" class="btn btn-primary pull-left execute"> Try It <i
class="fa fa-play-circle-o"></i></a>
<a href="doc/invoice/UpdateInvoice.html" class="btn btn-default pull-right">Source <i
class="fa fa-file-code-o"></i></a>
@@ -721,7 +725,7 @@ if (PHP_SAPI == 'cli') {
<div class="row">
<div class="col-md-8"><h5>Retrieve an Invoice</h5></div>
<div class="col-md-4">
<a href="invoice/GetInvoice.php" class="btn btn-primary pull-left execute"> Execute <i
<a href="invoice/GetInvoice.php" class="btn btn-primary pull-left execute"> Try It <i
class="fa fa-play-circle-o"></i></a>
<a href="doc/invoice/GetInvoice.html" class="btn btn-default pull-right">Source <i
class="fa fa-file-code-o"></i></a>
@@ -732,7 +736,7 @@ if (PHP_SAPI == 'cli') {
<div class="row">
<div class="col-md-8"><h5>Get Invoices of a Merchant</h5></div>
<div class="col-md-4">
<a href="invoice/ListInvoice.php" class="btn btn-primary pull-left execute"> Execute <i
<a href="invoice/ListInvoice.php" class="btn btn-primary pull-left execute"> Try It <i
class="fa fa-play-circle-o"></i></a>
<a href="doc/invoice/ListInvoice.html" class="btn btn-default pull-right">Source <i
class="fa fa-file-code-o"></i></a>
@@ -743,7 +747,7 @@ if (PHP_SAPI == 'cli') {
<div class="row">
<div class="col-md-8"><h5>Search for Invoices</h5></div>
<div class="col-md-4">
<a href="invoice/SearchInvoices.php" class="btn btn-primary pull-left execute"> Execute <i
<a href="invoice/SearchInvoices.php" class="btn btn-primary pull-left execute"> Try It <i
class="fa fa-play-circle-o"></i></a>
<a href="doc/invoice/SearchInvoices.html" class="btn btn-default pull-right">Source <i
class="fa fa-file-code-o"></i></a>
@@ -754,7 +758,7 @@ if (PHP_SAPI == 'cli') {
<div class="row">
<div class="col-md-8"><h5>Send an Invoice Reminder</h5></div>
<div class="col-md-4">
<a href="invoice/RemindInvoice.php" class="btn btn-primary pull-left execute"> Execute <i
<a href="invoice/RemindInvoice.php" class="btn btn-primary pull-left execute"> Try It <i
class="fa fa-play-circle-o"></i></a>
<a href="doc/invoice/RemindInvoice.html" class="btn btn-default pull-right">Source <i
class="fa fa-file-code-o"></i></a>
@@ -765,7 +769,7 @@ if (PHP_SAPI == 'cli') {
<div class="row">
<div class="col-md-8"><h5>Cancel an Invoice</h5></div>
<div class="col-md-4">
<a href="invoice/CancelInvoice.php" class="btn btn-primary pull-left execute"> Execute <i
<a href="invoice/CancelInvoice.php" class="btn btn-primary pull-left execute"> Try It <i
class="fa fa-play-circle-o"></i></a>
<a href="doc/invoice/CancelInvoice.html" class="btn btn-default pull-right">Source <i
class="fa fa-file-code-o"></i></a>
@@ -776,7 +780,7 @@ if (PHP_SAPI == 'cli') {
<div class="row">
<div class="col-md-8"><h5>Delete an Invoice</h5></div>
<div class="col-md-4">
<a href="invoice/DeleteInvoice.php" class="btn btn-primary pull-left execute"> Execute <i
<a href="invoice/DeleteInvoice.php" class="btn btn-primary pull-left execute"> Try It <i
class="fa fa-play-circle-o"></i></a>
<a href="doc/invoice/DeleteInvoice.html" class="btn btn-default pull-right">Source <i
class="fa fa-file-code-o"></i></a>
@@ -787,7 +791,7 @@ if (PHP_SAPI == 'cli') {
<div class="row">
<div class="col-md-8"><h5>Retrieve a QR Code</h5></div>
<div class="col-md-4">
<a href="invoice/RetrieveQRCode.php" class="btn btn-primary pull-left execute"> Execute <i
<a href="invoice/RetrieveQRCode.php" class="btn btn-primary pull-left execute"> Try It <i
class="fa fa-play-circle-o"></i></a>
<a href="doc/invoice/RetrieveQRCode.html" class="btn btn-default pull-right">Source <i
class="fa fa-file-code-o"></i></a>
@@ -798,7 +802,7 @@ if (PHP_SAPI == 'cli') {
<div class="row">
<div class="col-md-8"><h5>Record a Payment</h5></div>
<div class="col-md-4">
<a href="invoice/RecordPayment.php" class="btn btn-primary pull-left execute"> Execute <i
<a href="invoice/RecordPayment.php" class="btn btn-primary pull-left execute"> Try It <i
class="fa fa-play-circle-o"></i></a>
<a href="doc/invoice/RecordPayment.html" class="btn btn-default pull-right">Source <i
class="fa fa-file-code-o"></i></a>
@@ -809,7 +813,7 @@ if (PHP_SAPI == 'cli') {
<div class="row">
<div class="col-md-8"><h5>Record a Refund</h5></div>
<div class="col-md-4">
<a href="invoice/RecordRefund.php" class="btn btn-primary pull-left execute"> Execute <i
<a href="invoice/RecordRefund.php" class="btn btn-primary pull-left execute"> Try It <i
class="fa fa-play-circle-o"></i></a>
<a href="doc/invoice/RecordRefund.html" class="btn btn-default pull-right">Source <i
class="fa fa-file-code-o"></i></a>
@@ -831,7 +835,7 @@ if (PHP_SAPI == 'cli') {
<div class="row">
<div class="col-md-8"><h5>Obtain User's Consent</h5></div>
<div class="col-md-4">
<a href="lipp/ObtainUserConsent.php" class="btn btn-primary pull-left execute"> Execute <i
<a href="lipp/ObtainUserConsent.php" class="btn btn-primary pull-left execute"> Try It <i
class="fa fa-play-circle-o"></i></a>
<a href="doc/lipp/ObtainUserConsent.html" class="btn btn-default pull-right">Source <i
class="fa fa-file-code-o"></i></a>
@@ -851,7 +855,7 @@ if (PHP_SAPI == 'cli') {
<div class="row">
<div class="col-md-8"><h5>Get User Info</h5></div>
<div class="col-md-4">
<a href="lipp/GetUserInfo.php" class="btn btn-primary pull-left execute"> Execute <i
<a href="lipp/GetUserInfo.php" class="btn btn-primary pull-left execute"> Try It <i
class="fa fa-play-circle-o"></i></a>
<a href="doc/lipp/GetUserInfo.html" class="btn btn-default pull-right">Source <i
class="fa fa-file-code-o"></i></a>
@@ -864,7 +868,7 @@ if (PHP_SAPI == 'cli') {
<div class="col-md-4">
<a href="lipp/GenerateAccessTokenFromRefreshToken.php"
class="btn btn-primary pull-left execute">
Execute <i class="fa fa-play-circle-o"></i></a>
Try It <i class="fa fa-play-circle-o"></i></a>
<a href="doc/lipp/GenerateAccessTokenFromRefreshToken.html"
class="btn btn-default pull-right">Source
<i class="fa fa-file-code-o"></i></a>

View File

@@ -8,14 +8,21 @@
$invoice = require 'CreateInvoice.php';
use PayPal\Api\Invoice;
// ### Update Invoice
// Lets update some information
$invoice->setInvoiceDate("2014-11-16 PST");
// For Sample Purposes Only.
$request = clone $invoice;
// ### Update Invoice
// Lets update some information
$invoice->setInvoiceDate("2014-12-16 PST");
// ### NOTE: These are the work-around added to the
// sample, to get past the bug in PayPal APIs.
// There is already an internal ticket #PPTIPS-1932 created for it.
$invoice->setDiscount(null);
$billingInfo = $invoice->getBillingInfo()[0];
$billingInfo->setAddress(null);
$invoice->getPaymentTerm()->setDueDate(null);
try {
// ### Update Invoice
// Update an invoice by calling the invoice->update() method

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@@ -18,7 +18,7 @@ class BillingInfoTest extends \PHPUnit_Framework_TestCase
*/
public static function getJson()
{
return '{"email":"TestSample","first_name":"TestSample","last_name":"TestSample","business_name":"TestSample","address":' .AddressTest::getJson() . ',"language":"TestSample","additional_info":"TestSample","notification_channel":"TestSample","phone":' .PhoneTest::getJson() . '}';
return '{"email":"TestSample","first_name":"TestSample","last_name":"TestSample","business_name":"TestSample","address":' .InvoiceAddressTest::getJson() . ',"language":"TestSample","additional_info":"TestSample","notification_channel":"TestSample","phone":' .PhoneTest::getJson() . '}';
}
/**
@@ -62,7 +62,7 @@ class BillingInfoTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($obj->getFirstName(), "TestSample");
$this->assertEquals($obj->getLastName(), "TestSample");
$this->assertEquals($obj->getBusinessName(), "TestSample");
$this->assertEquals($obj->getAddress(), AddressTest::getObject());
$this->assertEquals($obj->getAddress(), InvoiceAddressTest::getObject());
$this->assertEquals($obj->getLanguage(), "TestSample");
$this->assertEquals($obj->getAdditionalInfo(), "TestSample");
$this->assertEquals($obj->getNotificationChannel(), "TestSample");

View File

@@ -0,0 +1,108 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Api\InvoiceAddress;
/**
* Class InvoiceAddress
*
* @package PayPal\Test\Api
*/
class InvoiceAddressTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object Address
* @return string
*/
public static function getJson()
{
return '{"line1":"TestSample","line2":"TestSample","city":"TestSample","country_code":"TestSample","postal_code":"TestSample","state":"TestSample","phone":'. PhoneTest::getJson() . "}";
}
/**
* Gets Object Instance with Json data filled in
* @return InvoiceAddress
*/
public static function getObject()
{
return new InvoiceAddress(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return InvoiceAddress
*/
public function testSerializationDeserialization()
{
$obj = new InvoiceAddress(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getLine1());
$this->assertNotNull($obj->getLine2());
$this->assertNotNull($obj->getCity());
$this->assertNotNull($obj->getCountryCode());
$this->assertNotNull($obj->getPostalCode());
$this->assertNotNull($obj->getState());
$this->assertNotNull($obj->getPhone());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param InvoiceAddress $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getLine1(), "TestSample");
$this->assertEquals($obj->getLine2(), "TestSample");
$this->assertEquals($obj->getCity(), "TestSample");
$this->assertEquals($obj->getCountryCode(), "TestSample");
$this->assertEquals($obj->getPostalCode(), "TestSample");
$this->assertEquals($obj->getState(), "TestSample");
$this->assertEquals($obj->getPhone(), PhoneTest::getObject());
}
/**
* @depends testSerializationDeserialization
* @param InvoiceAddress $obj
*/
public function testDeprecatedGetters($obj)
{
$this->assertEquals($obj->getCountry_code(), "TestSample");
$this->assertEquals($obj->getPostal_code(), "TestSample");
}
/**
* @depends testSerializationDeserialization
* @param InvoiceAddress $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
// Check for Country_code
$obj->setCountryCode(null);
$this->assertNull($obj->getCountry_code());
$this->assertNull($obj->getCountryCode());
$this->assertSame($obj->getCountryCode(), $obj->getCountry_code());
$obj->setCountry_code("TestSample");
$this->assertEquals($obj->getCountry_code(), "TestSample");
// Check for Postal_code
$obj->setPostalCode(null);
$this->assertNull($obj->getPostal_code());
$this->assertNull($obj->getPostalCode());
$this->assertSame($obj->getPostalCode(), $obj->getPostal_code());
$obj->setPostal_code("TestSample");
$this->assertEquals($obj->getPostal_code(), "TestSample");
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}