forked from LiveCarta/PayPal-PHP-SDK
Added invoiceNumber, custom and softDescriptor to Transaction.
This commit is contained in:
@@ -207,6 +207,84 @@ class Transaction extends PPModel
|
|||||||
return $this->related_resources;
|
return $this->related_resources;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set invoice number.
|
||||||
|
* Invoice number used to track the payment. 256 characters max.
|
||||||
|
*
|
||||||
|
* @param string $invoiceNumber
|
||||||
|
*
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function setInvoiceNumber($invoiceNumber)
|
||||||
|
{
|
||||||
|
$this->invoice_number = $invoiceNumber;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get invoice number.
|
||||||
|
* Invoice number used to track the payment. 256 characters max.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getInvoiceNumber()
|
||||||
|
{
|
||||||
|
return $this->invoice_number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set free-form field.
|
||||||
|
* Free-form field for the use of clients. 256 characters max.
|
||||||
|
*
|
||||||
|
* @param string $custom
|
||||||
|
*
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function setCustom($custom)
|
||||||
|
{
|
||||||
|
$this->custom = $custom;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get free-form field.
|
||||||
|
* Free-form field for the use of clients. 256 characters max.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getCustom()
|
||||||
|
{
|
||||||
|
return $this->custom;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set soft descriptor.
|
||||||
|
* Soft descriptor used when charging this funding source. 22 characters max.
|
||||||
|
*
|
||||||
|
* @param string $softDescriptor
|
||||||
|
*
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function setSoftDescriptor($softDescriptor)
|
||||||
|
{
|
||||||
|
$this->soft_descriptor = $softDescriptor;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get soft descriptor.
|
||||||
|
* Soft descriptor used when charging this funding source. 22 characters max.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getSoftDescriptor()
|
||||||
|
{
|
||||||
|
return $this->soft_descriptor;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Transactions
|
* Set Transactions
|
||||||
* Additional transactions for complex payment (Parallel and Chained) scenarios
|
* Additional transactions for complex payment (Parallel and Chained) scenarios
|
||||||
|
|||||||
@@ -12,12 +12,18 @@ class TransactionTest extends \PHPUnit_Framework_TestCase {
|
|||||||
private $transaction;
|
private $transaction;
|
||||||
|
|
||||||
public static $description = "desc . . . ";
|
public static $description = "desc . . . ";
|
||||||
|
public static $invoiceNumber = "#123";
|
||||||
|
public static $custom = "custom";
|
||||||
|
public static $softDescriptor = "descriptor";
|
||||||
public static $total = "1.12";
|
public static $total = "1.12";
|
||||||
|
|
||||||
public static function createTransaction() {
|
public static function createTransaction() {
|
||||||
$transaction = new Transaction();
|
$transaction = new Transaction();
|
||||||
$transaction->setAmount(AmountTest::createAmount());
|
$transaction->setAmount(AmountTest::createAmount());
|
||||||
$transaction->setDescription(self::$description);
|
$transaction->setDescription(self::$description);
|
||||||
|
$transaction->setInvoiceNumber(self::$invoiceNumber);
|
||||||
|
$transaction->setCustom(self::$custom);
|
||||||
|
$transaction->setSoftDescriptor(self::$softDescriptor);
|
||||||
$transaction->setItemList(ItemListTest::createItemList());
|
$transaction->setItemList(ItemListTest::createItemList());
|
||||||
$transaction->setPayee(PayeeTest::createPayee());
|
$transaction->setPayee(PayeeTest::createPayee());
|
||||||
$transaction->setRelatedResources( array(RelatedResourcesTest::createRelatedResources()) );
|
$transaction->setRelatedResources( array(RelatedResourcesTest::createRelatedResources()) );
|
||||||
@@ -31,6 +37,9 @@ class TransactionTest extends \PHPUnit_Framework_TestCase {
|
|||||||
public function testGetterSetter() {
|
public function testGetterSetter() {
|
||||||
$this->assertEquals(AmountTest::$currency, $this->transaction->getAmount()->getCurrency());
|
$this->assertEquals(AmountTest::$currency, $this->transaction->getAmount()->getCurrency());
|
||||||
$this->assertEquals(self::$description, $this->transaction->getDescription());
|
$this->assertEquals(self::$description, $this->transaction->getDescription());
|
||||||
|
$this->assertEquals(self::$invoiceNumber, $this->transaction->getInvoiceNumber());
|
||||||
|
$this->assertEquals(self::$custom, $this->transaction->getCustom());
|
||||||
|
$this->assertEquals(self::$softDescriptor, $this->transaction->getSoftDescriptor());
|
||||||
$items = $this->transaction->getItemList()->getItems();
|
$items = $this->transaction->getItemList()->getItems();
|
||||||
$this->assertEquals(ItemTest::$quantity, $items[0]->getQuantity());
|
$this->assertEquals(ItemTest::$quantity, $items[0]->getQuantity());
|
||||||
$this->assertEquals(PayeeTest::$email, $this->transaction->getPayee()->getEmail());
|
$this->assertEquals(PayeeTest::$email, $this->transaction->getPayee()->getEmail());
|
||||||
|
|||||||
Reference in New Issue
Block a user