Skip to content
This repository has been archived by the owner on Sep 29, 2023. It is now read-only.

Note to payer property #1294

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions lib/PayPal/Api/Capture.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
* @property string parent_payment
* @property string invoice_number
* @property \PayPal\Api\Currency transaction_fee
* @property string note_to_payer
* @property string create_time
* @property string update_time
* @property \PayPal\Api\Links[] links
Expand Down Expand Up @@ -214,6 +215,29 @@ public function getTransactionFee()
return $this->transaction_fee;
}

/**
* A free-form field that clients can use to send a note to the payer.
*
* @param string $note_to_payer
*
* @return $this
*/
public function setNoteToPayer($note_to_payer)
{
$this->note_to_payer = $note_to_payer;
return $this;
}

/**
* A free-form field that clients can use to send a note to the payer.
*
* @return string
*/
public function getNoteToPayer()
{
return $this->note_to_payer;
}

/**
* The date and time of capture, as defined in [RFC 3339 Section 5.6](http://tools.ietf.org/html/rfc3339#section-5.6).
*
Expand Down
2 changes: 2 additions & 0 deletions sample/payments/AuthorizationCapture.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// API used: /v1/payments/payment
// https://developer.paypal.com/docs/api/#capture-an-authorization

require __DIR__ . '/../bootstrap.php';
use PayPal\Api\Amount;
use PayPal\Api\Authorization;
use PayPal\Api\Capture;
Expand All @@ -29,6 +30,7 @@
### Capture
$capture = new Capture();
$capture->setAmount($amt);
$capture->setNoteToPayer("Contact us for any questions on your order.");

// Perform a capture
$getCapture = $authorization->capture($capture, $apiContext);
Expand Down
4 changes: 3 additions & 1 deletion tests/PayPal/Test/Api/CaptureTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class CaptureTest extends TestCase
*/
public static function getJson()
{
return '{"id":"TestSample","amount":' .AmountTest::getJson() . ',"is_final_capture":true,"state":"TestSample","reason_code":"TestSample","parent_payment":"TestSample","invoice_number":"TestSample","transaction_fee":' .CurrencyTest::getJson() . ',"create_time":"TestSample","update_time":"TestSample","links":' .LinksTest::getJson() . '}';
return '{"id":"TestSample","amount":' .AmountTest::getJson() . ',"is_final_capture":true,"state":"TestSample","reason_code":"TestSample","parent_payment":"TestSample","invoice_number":"TestSample","transaction_fee":' .CurrencyTest::getJson() . ',"note_to_payer":"Contact us for any questions on your order.","create_time":"TestSample","update_time":"TestSample","links":' .LinksTest::getJson() . '}';
}

/**
Expand Down Expand Up @@ -48,6 +48,7 @@ public function testSerializationDeserialization()
$this->assertNotNull($obj->getParentPayment());
$this->assertNotNull($obj->getInvoiceNumber());
$this->assertNotNull($obj->getTransactionFee());
$this->assertNotNull($obj->getNoteToPayer());
$this->assertNotNull($obj->getCreateTime());
$this->assertNotNull($obj->getUpdateTime());
$this->assertNotNull($obj->getLinks());
Expand All @@ -69,6 +70,7 @@ public function testGetters($obj)
$this->assertEquals($obj->getParentPayment(), "TestSample");
$this->assertEquals($obj->getInvoiceNumber(), "TestSample");
$this->assertEquals($obj->getTransactionFee(), CurrencyTest::getObject());
$this->assertEquals($obj->getNoteToPayer(), "Contact us for any questions on your order.");
$this->assertEquals($obj->getCreateTime(), "TestSample");
$this->assertEquals($obj->getUpdateTime(), "TestSample");
$this->assertEquals($obj->getLinks(), LinksTest::getObject());
Expand Down