From 2afc181f50caf1a1da1f2dbf6742dc39dbbc13e3 Mon Sep 17 00:00:00 2001 From: Jay Date: Mon, 25 Sep 2017 16:11:54 -0500 Subject: [PATCH] Add purchase_order in CartBase (#939) --- lib/PayPal/Api/CartBase.php | 24 ++++++++++++++++++++++++ tests/PayPal/Test/Api/CartBaseTest.php | 4 +++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/lib/PayPal/Api/CartBase.php b/lib/PayPal/Api/CartBase.php index eebd830..1f7ef1e 100644 --- a/lib/PayPal/Api/CartBase.php +++ b/lib/PayPal/Api/CartBase.php @@ -19,6 +19,7 @@ use PayPal\Validation\UrlValidator; * @property string note_to_payee * @property string custom * @property string invoice_number + * @property string purchase_order * @property string soft_descriptor * @property \PayPal\Api\PaymentOptions payment_options * @property \PayPal\Api\ItemList item_list @@ -188,6 +189,29 @@ class CartBase extends PayPalModel return $this->invoice_number; } + /** + * purchase order is number or id specific to this payment + * + * @param string $purchase_order + * + * @return $this + */ + public function setPurchaseOrder($purchase_order) + { + $this->purchase_order = $purchase_order; + return $this; + } + + /** + * purchase order is number or id specific to this payment + * + * @return string + */ + public function getPurchaseOrder() + { + return $this->purchase_order; + } + /** * Soft descriptor used when charging this funding source. If length exceeds max length, the value will be truncated * diff --git a/tests/PayPal/Test/Api/CartBaseTest.php b/tests/PayPal/Test/Api/CartBaseTest.php index cb4cf2e..d76b78b 100644 --- a/tests/PayPal/Test/Api/CartBaseTest.php +++ b/tests/PayPal/Test/Api/CartBaseTest.php @@ -18,7 +18,7 @@ class CartBaseTest extends \PHPUnit_Framework_TestCase */ public static function getJson() { - return '{"reference_id":"TestSample","amount":' .AmountTest::getJson() . ',"payee":' .PayeeTest::getJson() . ',"description":"TestSample","note_to_payee":"TestSample","custom":"TestSample","invoice_number":"TestSample","soft_descriptor":"TestSample","soft_descriptor_city":"TestSample","payment_options":' .PaymentOptionsTest::getJson() . ',"item_list":' .ItemListTest::getJson() . ',"notify_url":"http://www.google.com","order_url":"http://www.google.com","external_funding":' .ExternalFundingTest::getJson() . ',"type":"TestSample"}'; + return '{"reference_id":"TestSample","amount":' .AmountTest::getJson() . ',"payee":' .PayeeTest::getJson() . ',"description":"TestSample","note_to_payee":"TestSample","custom":"TestSample","invoice_number":"TestSample","purchase_order":"TestSample","soft_descriptor":"TestSample","soft_descriptor_city":"TestSample","payment_options":' .PaymentOptionsTest::getJson() . ',"item_list":' .ItemListTest::getJson() . ',"notify_url":"http://www.google.com","order_url":"http://www.google.com","external_funding":' .ExternalFundingTest::getJson() . ',"type":"TestSample"}'; } /** @@ -46,6 +46,7 @@ class CartBaseTest extends \PHPUnit_Framework_TestCase $this->assertNotNull($obj->getNoteToPayee()); $this->assertNotNull($obj->getCustom()); $this->assertNotNull($obj->getInvoiceNumber()); + $this->assertNotNull($obj->getPurchaseOrder()); $this->assertNotNull($obj->getSoftDescriptor()); $this->assertNotNull($obj->getSoftDescriptorCity()); $this->assertNotNull($obj->getPaymentOptions()); @@ -70,6 +71,7 @@ class CartBaseTest extends \PHPUnit_Framework_TestCase $this->assertEquals($obj->getNoteToPayee(), "TestSample"); $this->assertEquals($obj->getCustom(), "TestSample"); $this->assertEquals($obj->getInvoiceNumber(), "TestSample"); + $this->assertEquals($obj->getPurchaseOrder(), "TestSample"); $this->assertEquals($obj->getSoftDescriptor(), "TestSample"); $this->assertEquals($obj->getSoftDescriptorCity(), "TestSample"); $this->assertEquals($obj->getPaymentOptions(), PaymentOptionsTest::getObject());