From 026802443d49c25f69176e0e41f211740fdd0cfb Mon Sep 17 00:00:00 2001
From: japatel
Date: Wed, 19 Nov 2014 15:21:18 -0600
Subject: [PATCH] Unit Tests and Functional Tests for Invoicing
- Updated Unit Tests for PPModels used by Invoicing
- Updated Functional Tests
- Updated Samples for quick changes.
---
lib/PayPal/Api/Cost.php | 10 +-
lib/PayPal/Api/ShippingInfo.php | 20 +
sample/doc/invoice/RecordPayment.html | 2 +-
sample/doc/invoice/RecordRefund.html | 2 +-
sample/invoice/RecordPayment.php | 2 +-
sample/invoice/RecordRefund.php | 2 +-
tests/PayPal/Test/Api/BillingInfoTest.php | 139 +++++
.../Test/Api/CancelNotificationTest.php | 102 ++++
tests/PayPal/Test/Api/CostTest.php | 82 +++
tests/PayPal/Test/Api/CurrencyTest.php | 2 +
tests/PayPal/Test/Api/CustomAmountTest.php | 80 +++
tests/PayPal/Test/Api/ErrorDetailsTest.php | 80 +++
tests/PayPal/Test/Api/ErrorTest.php | 106 ++++
tests/PayPal/Test/Api/ImageTest.php | 78 +++
tests/PayPal/Test/Api/InvoiceItemTest.php | 99 ++++
.../Test/Api/InvoiceSearchResponseTest.php | 89 +++
tests/PayPal/Test/Api/InvoiceTest.php | 505 ++++++++++++++++++
tests/PayPal/Test/Api/MerchantInfoTest.php | 141 +++++
tests/PayPal/Test/Api/MetadataTest.php | 193 +++++++
tests/PayPal/Test/Api/NotificationTest.php | 91 ++++
tests/PayPal/Test/Api/PaymentDetailTest.php | 106 ++++
tests/PayPal/Test/Api/PaymentTermTest.php | 98 ++++
tests/PayPal/Test/Api/PhoneTest.php | 98 ++++
tests/PayPal/Test/Api/RefundDetailTest.php | 82 +++
tests/PayPal/Test/Api/SearchTest.php | 249 +++++++++
tests/PayPal/Test/Api/ShippingCostTest.php | 80 +++
tests/PayPal/Test/Api/ShippingInfoTest.php | 111 ++++
tests/PayPal/Test/Api/TaxTest.php | 84 +++
.../Functional/Api/InvoiceFunctionalTest.php | 252 +++++++++
.../InvoiceFunctionalTest/testCancel.json | 35 ++
.../InvoiceFunctionalTest/testCreate.json | 150 ++++++
.../InvoiceFunctionalTest/testDelete.json | 31 ++
.../InvoiceFunctionalTest/testGet.json | 98 ++++
.../InvoiceFunctionalTest/testGetAll.json | 148 +++++
.../InvoiceFunctionalTest/testQRCode.json | 33 ++
.../testRecordPayment.json | 21 +
.../testRecordRefund.json | 20 +
.../InvoiceFunctionalTest/testRemind.json | 35 ++
.../InvoiceFunctionalTest/testSearch.json | 67 +++
.../InvoiceFunctionalTest/testSend.json | 31 ++
.../InvoiceFunctionalTest/testUpdate.json | 148 +++++
41 files changed, 3795 insertions(+), 7 deletions(-)
create mode 100644 tests/PayPal/Test/Api/BillingInfoTest.php
create mode 100644 tests/PayPal/Test/Api/CancelNotificationTest.php
create mode 100644 tests/PayPal/Test/Api/CostTest.php
create mode 100644 tests/PayPal/Test/Api/CustomAmountTest.php
create mode 100644 tests/PayPal/Test/Api/ErrorDetailsTest.php
create mode 100644 tests/PayPal/Test/Api/ErrorTest.php
create mode 100644 tests/PayPal/Test/Api/ImageTest.php
create mode 100644 tests/PayPal/Test/Api/InvoiceItemTest.php
create mode 100644 tests/PayPal/Test/Api/InvoiceSearchResponseTest.php
create mode 100644 tests/PayPal/Test/Api/InvoiceTest.php
create mode 100644 tests/PayPal/Test/Api/MerchantInfoTest.php
create mode 100644 tests/PayPal/Test/Api/MetadataTest.php
create mode 100644 tests/PayPal/Test/Api/NotificationTest.php
create mode 100644 tests/PayPal/Test/Api/PaymentDetailTest.php
create mode 100644 tests/PayPal/Test/Api/PaymentTermTest.php
create mode 100644 tests/PayPal/Test/Api/PhoneTest.php
create mode 100644 tests/PayPal/Test/Api/RefundDetailTest.php
create mode 100644 tests/PayPal/Test/Api/SearchTest.php
create mode 100644 tests/PayPal/Test/Api/ShippingCostTest.php
create mode 100644 tests/PayPal/Test/Api/ShippingInfoTest.php
create mode 100644 tests/PayPal/Test/Api/TaxTest.php
create mode 100644 tests/PayPal/Test/Functional/Api/InvoiceFunctionalTest.php
create mode 100644 tests/PayPal/Test/Functional/resources/InvoiceFunctionalTest/testCancel.json
create mode 100644 tests/PayPal/Test/Functional/resources/InvoiceFunctionalTest/testCreate.json
create mode 100644 tests/PayPal/Test/Functional/resources/InvoiceFunctionalTest/testDelete.json
create mode 100644 tests/PayPal/Test/Functional/resources/InvoiceFunctionalTest/testGet.json
create mode 100644 tests/PayPal/Test/Functional/resources/InvoiceFunctionalTest/testGetAll.json
create mode 100644 tests/PayPal/Test/Functional/resources/InvoiceFunctionalTest/testQRCode.json
create mode 100644 tests/PayPal/Test/Functional/resources/InvoiceFunctionalTest/testRecordPayment.json
create mode 100644 tests/PayPal/Test/Functional/resources/InvoiceFunctionalTest/testRecordRefund.json
create mode 100644 tests/PayPal/Test/Functional/resources/InvoiceFunctionalTest/testRemind.json
create mode 100644 tests/PayPal/Test/Functional/resources/InvoiceFunctionalTest/testSearch.json
create mode 100644 tests/PayPal/Test/Functional/resources/InvoiceFunctionalTest/testSend.json
create mode 100644 tests/PayPal/Test/Functional/resources/InvoiceFunctionalTest/testUpdate.json
diff --git a/lib/PayPal/Api/Cost.php b/lib/PayPal/Api/Cost.php
index 55aac44..8813966 100644
--- a/lib/PayPal/Api/Cost.php
+++ b/lib/PayPal/Api/Cost.php
@@ -3,6 +3,8 @@
namespace PayPal\Api;
use PayPal\Common\PPModel;
+use PayPal\Validation\NumericValidator;
+use PayPal\Common\FormatConverter;
/**
* Class Cost
@@ -11,7 +13,7 @@ use PayPal\Common\PPModel;
*
* @package PayPal\Api
*
- * @property \PayPal\Api\number percent
+ * @property string percent
* @property \PayPal\Api\Currency amount
*/
class Cost extends PPModel
@@ -19,12 +21,14 @@ class Cost extends PPModel
/**
* Cost in percent. Range of 0 to 100.
*
- * @param \PayPal\Api\number $percent
+ * @param string $percent
*
* @return $this
*/
public function setPercent($percent)
{
+ NumericValidator::validate($percent, "Percent");
+ $percent = FormatConverter::formatToTwoDecimalPlaces($percent);
$this->percent = $percent;
return $this;
}
@@ -32,7 +36,7 @@ class Cost extends PPModel
/**
* Cost in percent. Range of 0 to 100.
*
- * @return \PayPal\Api\number
+ * @return string
*/
public function getPercent()
{
diff --git a/lib/PayPal/Api/ShippingInfo.php b/lib/PayPal/Api/ShippingInfo.php
index cc34993..1f9ab5b 100644
--- a/lib/PayPal/Api/ShippingInfo.php
+++ b/lib/PayPal/Api/ShippingInfo.php
@@ -208,4 +208,24 @@ class ShippingInfo extends PPModel
return $this->address;
}
+ /**
+ * @deprecated This will not be supported soon. Kept for backward Compatibility
+ *
+ * @param string $email
+ */
+ public function setEmail($email)
+ {
+ $this->email = $email;
+ }
+
+ /**
+ * @deprecated This will not be supported soon. Kept for backward Compatibility
+ *
+ * @return string
+ */
+ public function getEmail()
+ {
+ return $this->email;
+ }
+
}
diff --git a/sample/doc/invoice/RecordPayment.html b/sample/doc/invoice/RecordPayment.html
index 201afc1..c7b76e6 100644
--- a/sample/doc/invoice/RecordPayment.html
+++ b/sample/doc/invoice/RecordPayment.html
@@ -21,7 +21,7 @@ on the Invoice class by passing a valid
notification object
(See bootstrap.php for more on ApiContext)
$refundStatus = $invoice->recordRefund($refund, $apiContext);
} catch (Exception $ex) {
- ResultPrinter::printError("Refund for Invoice", "Invoice", null, $refundStatus, $ex);
+ ResultPrinter::printError("Refund for Invoice", "Invoice", null, null, $ex);
exit(1);
}
diff --git a/sample/invoice/RecordPayment.php b/sample/invoice/RecordPayment.php
index 6bd2a97..cd3f7a7 100644
--- a/sample/invoice/RecordPayment.php
+++ b/sample/invoice/RecordPayment.php
@@ -30,7 +30,7 @@ try {
// (See bootstrap.php for more on `ApiContext`)
$recordStatus = $invoice->recordPayment($record, $apiContext);
} catch (Exception $ex) {
- ResultPrinter::printError("Payment for Invoice", "Invoice", null, $recordStatus, $ex);
+ ResultPrinter::printError("Payment for Invoice", "Invoice", null, null, $ex);
exit(1);
}
diff --git a/sample/invoice/RecordRefund.php b/sample/invoice/RecordRefund.php
index 48f2d57..99277b3 100644
--- a/sample/invoice/RecordRefund.php
+++ b/sample/invoice/RecordRefund.php
@@ -29,7 +29,7 @@ try {
// (See bootstrap.php for more on `ApiContext`)
$refundStatus = $invoice->recordRefund($refund, $apiContext);
} catch (Exception $ex) {
- ResultPrinter::printError("Refund for Invoice", "Invoice", null, $refundStatus, $ex);
+ ResultPrinter::printError("Refund for Invoice", "Invoice", null, null, $ex);
exit(1);
}
diff --git a/tests/PayPal/Test/Api/BillingInfoTest.php b/tests/PayPal/Test/Api/BillingInfoTest.php
new file mode 100644
index 0000000..55a454d
--- /dev/null
+++ b/tests/PayPal/Test/Api/BillingInfoTest.php
@@ -0,0 +1,139 @@
+assertNotNull($obj);
+ $this->assertNotNull($obj->getEmail());
+ $this->assertNotNull($obj->getFirstName());
+ $this->assertNotNull($obj->getLastName());
+ $this->assertNotNull($obj->getBusinessName());
+ $this->assertNotNull($obj->getAddress());
+ $this->assertNotNull($obj->getLanguage());
+ $this->assertNotNull($obj->getAdditionalInfo());
+ $this->assertNotNull($obj->getNotificationChannel());
+ $this->assertNotNull($obj->getPhone());
+ $this->assertEquals(self::getJson(), $obj->toJson());
+ return $obj;
+ }
+
+ /**
+ * @depends testSerializationDeserialization
+ * @param BillingInfo $obj
+ */
+ public function testGetters($obj)
+ {
+ $this->assertEquals($obj->getEmail(), "TestSample");
+ $this->assertEquals($obj->getFirstName(), "TestSample");
+ $this->assertEquals($obj->getLastName(), "TestSample");
+ $this->assertEquals($obj->getBusinessName(), "TestSample");
+ $this->assertEquals($obj->getAddress(), AddressTest::getObject());
+ $this->assertEquals($obj->getLanguage(), "TestSample");
+ $this->assertEquals($obj->getAdditionalInfo(), "TestSample");
+ $this->assertEquals($obj->getNotificationChannel(), "TestSample");
+ $this->assertEquals($obj->getPhone(), PhoneTest::getObject());
+ }
+
+ /**
+ * @depends testSerializationDeserialization
+ * @param BillingInfo $obj
+ */
+ public function testDeprecatedGetters($obj)
+ {
+ $this->assertEquals($obj->getFirst_name(), "TestSample");
+ $this->assertEquals($obj->getLast_name(), "TestSample");
+ $this->assertEquals($obj->getBusiness_name(), "TestSample");
+ $this->assertEquals($obj->getAdditional_info(), "TestSample");
+ $this->assertEquals($obj->getNotification_channel(), "TestSample");
+ }
+
+ /**
+ * @depends testSerializationDeserialization
+ * @param BillingInfo $obj
+ */
+ public function testDeprecatedSetterNormalGetter($obj)
+ {
+
+ // Check for First_name
+ $obj->setFirstName(null);
+ $this->assertNull($obj->getFirst_name());
+ $this->assertNull($obj->getFirstName());
+ $this->assertSame($obj->getFirstName(), $obj->getFirst_name());
+ $obj->setFirst_name("TestSample");
+ $this->assertEquals($obj->getFirst_name(), "TestSample");
+
+ // Check for Last_name
+ $obj->setLastName(null);
+ $this->assertNull($obj->getLast_name());
+ $this->assertNull($obj->getLastName());
+ $this->assertSame($obj->getLastName(), $obj->getLast_name());
+ $obj->setLast_name("TestSample");
+ $this->assertEquals($obj->getLast_name(), "TestSample");
+
+ // Check for Business_name
+ $obj->setBusinessName(null);
+ $this->assertNull($obj->getBusiness_name());
+ $this->assertNull($obj->getBusinessName());
+ $this->assertSame($obj->getBusinessName(), $obj->getBusiness_name());
+ $obj->setBusiness_name("TestSample");
+ $this->assertEquals($obj->getBusiness_name(), "TestSample");
+
+ // Check for Additional_info
+ $obj->setAdditionalInfo(null);
+ $this->assertNull($obj->getAdditional_info());
+ $this->assertNull($obj->getAdditionalInfo());
+ $this->assertSame($obj->getAdditionalInfo(), $obj->getAdditional_info());
+ $obj->setAdditional_info("TestSample");
+ $this->assertEquals($obj->getAdditional_info(), "TestSample");
+
+ // Check for Notification_channel
+ $obj->setNotificationChannel(null);
+ $this->assertNull($obj->getNotification_channel());
+ $this->assertNull($obj->getNotificationChannel());
+ $this->assertSame($obj->getNotificationChannel(), $obj->getNotification_channel());
+ $obj->setNotification_channel("TestSample");
+ $this->assertEquals($obj->getNotification_channel(), "TestSample");
+
+ //Test All Deprecated Getters and Normal Getters
+ $this->testDeprecatedGetters($obj);
+ $this->testGetters($obj);
+ }
+
+
+
+}
diff --git a/tests/PayPal/Test/Api/CancelNotificationTest.php b/tests/PayPal/Test/Api/CancelNotificationTest.php
new file mode 100644
index 0000000..b3136e3
--- /dev/null
+++ b/tests/PayPal/Test/Api/CancelNotificationTest.php
@@ -0,0 +1,102 @@
+assertNotNull($obj);
+ $this->assertNotNull($obj->getSubject());
+ $this->assertNotNull($obj->getNote());
+ $this->assertNotNull($obj->getSendToMerchant());
+ $this->assertNotNull($obj->getSendToPayer());
+ $this->assertEquals(self::getJson(), $obj->toJson());
+ return $obj;
+ }
+
+ /**
+ * @depends testSerializationDeserialization
+ * @param CancelNotification $obj
+ */
+ public function testGetters($obj)
+ {
+ $this->assertEquals($obj->getSubject(), "TestSample");
+ $this->assertEquals($obj->getNote(), "TestSample");
+ $this->assertEquals($obj->getSendToMerchant(), true);
+ $this->assertEquals($obj->getSendToPayer(), true);
+ }
+
+ /**
+ * @depends testSerializationDeserialization
+ * @param CancelNotification $obj
+ */
+ public function testDeprecatedGetters($obj)
+ {
+ $this->assertEquals($obj->getSend_to_merchant(), true);
+ $this->assertEquals($obj->getSend_to_payer(), true);
+ }
+
+ /**
+ * @depends testSerializationDeserialization
+ * @param CancelNotification $obj
+ */
+ public function testDeprecatedSetterNormalGetter($obj)
+ {
+
+ // Check for Send_to_merchant
+ $obj->setSendToMerchant(null);
+ $this->assertNull($obj->getSend_to_merchant());
+ $this->assertNull($obj->getSendToMerchant());
+ $this->assertSame($obj->getSendToMerchant(), $obj->getSend_to_merchant());
+ $obj->setSend_to_merchant(true);
+ $this->assertEquals($obj->getSend_to_merchant(), true);
+
+ // Check for Send_to_payer
+ $obj->setSendToPayer(null);
+ $this->assertNull($obj->getSend_to_payer());
+ $this->assertNull($obj->getSendToPayer());
+ $this->assertSame($obj->getSendToPayer(), $obj->getSend_to_payer());
+ $obj->setSend_to_payer(true);
+ $this->assertEquals($obj->getSend_to_payer(), true);
+
+ //Test All Deprecated Getters and Normal Getters
+ $this->testDeprecatedGetters($obj);
+ $this->testGetters($obj);
+ }
+
+
+
+}
diff --git a/tests/PayPal/Test/Api/CostTest.php b/tests/PayPal/Test/Api/CostTest.php
new file mode 100644
index 0000000..dfd623c
--- /dev/null
+++ b/tests/PayPal/Test/Api/CostTest.php
@@ -0,0 +1,82 @@
+assertNotNull($obj);
+ $this->assertNotNull($obj->getPercent());
+ $this->assertNotNull($obj->getAmount());
+ $this->assertEquals(self::getJson(), $obj->toJson());
+ return $obj;
+ }
+
+ /**
+ * @depends testSerializationDeserialization
+ * @param Cost $obj
+ */
+ public function testGetters($obj)
+ {
+ $this->assertEquals($obj->getPercent(), "12.34");
+ $this->assertEquals($obj->getAmount(), CurrencyTest::getObject());
+ }
+
+ /**
+ * @depends testSerializationDeserialization
+ * @param Cost $obj
+ */
+ public function testDeprecatedGetters($obj)
+ {
+ }
+
+ /**
+ * @depends testSerializationDeserialization
+ * @param Cost $obj
+ */
+ public function testDeprecatedSetterNormalGetter($obj)
+ {
+
+ //Test All Deprecated Getters and Normal Getters
+ $this->testDeprecatedGetters($obj);
+ $this->testGetters($obj);
+ }
+
+
+
+}
diff --git a/tests/PayPal/Test/Api/CurrencyTest.php b/tests/PayPal/Test/Api/CurrencyTest.php
index 0579c90..bb941d7 100644
--- a/tests/PayPal/Test/Api/CurrencyTest.php
+++ b/tests/PayPal/Test/Api/CurrencyTest.php
@@ -3,6 +3,8 @@
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
+use PayPal\Common\FormatConverter;
+use PayPal\Validation\NumericValidator;
use PayPal\Api\Currency;
/**
diff --git a/tests/PayPal/Test/Api/CustomAmountTest.php b/tests/PayPal/Test/Api/CustomAmountTest.php
new file mode 100644
index 0000000..a870479
--- /dev/null
+++ b/tests/PayPal/Test/Api/CustomAmountTest.php
@@ -0,0 +1,80 @@
+assertNotNull($obj);
+ $this->assertNotNull($obj->getLabel());
+ $this->assertNotNull($obj->getAmount());
+ $this->assertEquals(self::getJson(), $obj->toJson());
+ return $obj;
+ }
+
+ /**
+ * @depends testSerializationDeserialization
+ * @param CustomAmount $obj
+ */
+ public function testGetters($obj)
+ {
+ $this->assertEquals($obj->getLabel(), "TestSample");
+ $this->assertEquals($obj->getAmount(), CurrencyTest::getObject());
+ }
+
+ /**
+ * @depends testSerializationDeserialization
+ * @param CustomAmount $obj
+ */
+ public function testDeprecatedGetters($obj)
+ {
+ }
+
+ /**
+ * @depends testSerializationDeserialization
+ * @param CustomAmount $obj
+ */
+ public function testDeprecatedSetterNormalGetter($obj)
+ {
+
+ //Test All Deprecated Getters and Normal Getters
+ $this->testDeprecatedGetters($obj);
+ $this->testGetters($obj);
+ }
+
+
+
+}
diff --git a/tests/PayPal/Test/Api/ErrorDetailsTest.php b/tests/PayPal/Test/Api/ErrorDetailsTest.php
new file mode 100644
index 0000000..f49c199
--- /dev/null
+++ b/tests/PayPal/Test/Api/ErrorDetailsTest.php
@@ -0,0 +1,80 @@
+assertNotNull($obj);
+ $this->assertNotNull($obj->getField());
+ $this->assertNotNull($obj->getIssue());
+ $this->assertEquals(self::getJson(), $obj->toJson());
+ return $obj;
+ }
+
+ /**
+ * @depends testSerializationDeserialization
+ * @param ErrorDetails $obj
+ */
+ public function testGetters($obj)
+ {
+ $this->assertEquals($obj->getField(), "TestSample");
+ $this->assertEquals($obj->getIssue(), "TestSample");
+ }
+
+ /**
+ * @depends testSerializationDeserialization
+ * @param ErrorDetails $obj
+ */
+ public function testDeprecatedGetters($obj)
+ {
+ }
+
+ /**
+ * @depends testSerializationDeserialization
+ * @param ErrorDetails $obj
+ */
+ public function testDeprecatedSetterNormalGetter($obj)
+ {
+
+ //Test All Deprecated Getters and Normal Getters
+ $this->testDeprecatedGetters($obj);
+ $this->testGetters($obj);
+ }
+
+
+
+}
diff --git a/tests/PayPal/Test/Api/ErrorTest.php b/tests/PayPal/Test/Api/ErrorTest.php
new file mode 100644
index 0000000..1270e27
--- /dev/null
+++ b/tests/PayPal/Test/Api/ErrorTest.php
@@ -0,0 +1,106 @@
+assertNotNull($obj);
+ $this->assertNotNull($obj->getName());
+ $this->assertNotNull($obj->getDebugId());
+ $this->assertNotNull($obj->getMessage());
+ $this->assertNotNull($obj->getInformationLink());
+ $this->assertNotNull($obj->getDetails());
+ $this->assertNotNull($obj->getLinks());
+ $this->assertEquals(self::getJson(), $obj->toJson());
+ return $obj;
+ }
+
+ /**
+ * @depends testSerializationDeserialization
+ * @param Error $obj
+ */
+ public function testGetters($obj)
+ {
+ $this->assertEquals($obj->getName(), "TestSample");
+ $this->assertEquals($obj->getDebugId(), "TestSample");
+ $this->assertEquals($obj->getMessage(), "TestSample");
+ $this->assertEquals($obj->getInformationLink(), "TestSample");
+ $this->assertEquals($obj->getDetails(), ErrorDetailsTest::getObject());
+ $this->assertEquals($obj->getLinks(), LinksTest::getObject());
+ }
+
+ /**
+ * @depends testSerializationDeserialization
+ * @param Error $obj
+ */
+ public function testDeprecatedGetters($obj)
+ {
+ $this->assertEquals($obj->getDebug_id(), "TestSample");
+ $this->assertEquals($obj->getInformation_link(), "TestSample");
+ }
+
+ /**
+ * @depends testSerializationDeserialization
+ * @param Error $obj
+ */
+ public function testDeprecatedSetterNormalGetter($obj)
+ {
+
+ // Check for Debug_id
+ $obj->setDebugId(null);
+ $this->assertNull($obj->getDebug_id());
+ $this->assertNull($obj->getDebugId());
+ $this->assertSame($obj->getDebugId(), $obj->getDebug_id());
+ $obj->setDebug_id("TestSample");
+ $this->assertEquals($obj->getDebug_id(), "TestSample");
+
+ // Check for Information_link
+ $obj->setInformationLink(null);
+ $this->assertNull($obj->getInformation_link());
+ $this->assertNull($obj->getInformationLink());
+ $this->assertSame($obj->getInformationLink(), $obj->getInformation_link());
+ $obj->setInformation_link("TestSample");
+ $this->assertEquals($obj->getInformation_link(), "TestSample");
+
+ //Test All Deprecated Getters and Normal Getters
+ $this->testDeprecatedGetters($obj);
+ $this->testGetters($obj);
+ }
+
+
+
+}
diff --git a/tests/PayPal/Test/Api/ImageTest.php b/tests/PayPal/Test/Api/ImageTest.php
new file mode 100644
index 0000000..7d93ad7
--- /dev/null
+++ b/tests/PayPal/Test/Api/ImageTest.php
@@ -0,0 +1,78 @@
+assertNotNull($obj);
+ $this->assertNotNull($obj->getImage());
+ $this->assertEquals(self::getJson(), $obj->toJson());
+ return $obj;
+ }
+
+ /**
+ * @depends testSerializationDeserialization
+ * @param Image $obj
+ */
+ public function testGetters($obj)
+ {
+ $this->assertEquals($obj->getImage(), "TestSample");
+ }
+
+ /**
+ * @depends testSerializationDeserialization
+ * @param Image $obj
+ */
+ public function testDeprecatedGetters($obj)
+ {
+ }
+
+ /**
+ * @depends testSerializationDeserialization
+ * @param Image $obj
+ */
+ public function testDeprecatedSetterNormalGetter($obj)
+ {
+
+ //Test All Deprecated Getters and Normal Getters
+ $this->testDeprecatedGetters($obj);
+ $this->testGetters($obj);
+ }
+
+
+
+}
diff --git a/tests/PayPal/Test/Api/InvoiceItemTest.php b/tests/PayPal/Test/Api/InvoiceItemTest.php
new file mode 100644
index 0000000..28ee892
--- /dev/null
+++ b/tests/PayPal/Test/Api/InvoiceItemTest.php
@@ -0,0 +1,99 @@
+assertNotNull($obj);
+ $this->assertNotNull($obj->getName());
+ $this->assertNotNull($obj->getDescription());
+ $this->assertNotNull($obj->getQuantity());
+ $this->assertNotNull($obj->getUnitPrice());
+ $this->assertNotNull($obj->getTax());
+ $this->assertNotNull($obj->getDate());
+ $this->assertNotNull($obj->getDiscount());
+ $this->assertEquals(self::getJson(), $obj->toJson());
+ return $obj;
+ }
+
+ /**
+ * @depends testSerializationDeserialization
+ * @param InvoiceItem $obj
+ */
+ public function testGetters($obj)
+ {
+ $this->assertEquals($obj->getName(), "TestSample");
+ $this->assertEquals($obj->getDescription(), "TestSample");
+ $this->assertEquals($obj->getQuantity(), "12.34");
+ $this->assertEquals($obj->getUnitPrice(), CurrencyTest::getObject());
+ $this->assertEquals($obj->getTax(), TaxTest::getObject());
+ $this->assertEquals($obj->getDate(), "TestSample");
+ $this->assertEquals($obj->getDiscount(), CostTest::getObject());
+ }
+
+ /**
+ * @depends testSerializationDeserialization
+ * @param InvoiceItem $obj
+ */
+ public function testDeprecatedGetters($obj)
+ {
+ $this->assertEquals($obj->getUnit_price(), CurrencyTest::getObject());
+ }
+
+ /**
+ * @depends testSerializationDeserialization
+ * @param InvoiceItem $obj
+ */
+ public function testDeprecatedSetterNormalGetter($obj)
+ {
+
+ // Check for Unit_price
+ $obj->setUnitPrice(null);
+ $this->assertNull($obj->getUnit_price());
+ $this->assertNull($obj->getUnitPrice());
+ $this->assertSame($obj->getUnitPrice(), $obj->getUnit_price());
+ $obj->setUnit_price(CurrencyTest::getObject());
+ $this->assertEquals($obj->getUnit_price(), CurrencyTest::getObject());
+
+ //Test All Deprecated Getters and Normal Getters
+ $this->testDeprecatedGetters($obj);
+ $this->testGetters($obj);
+ }
+
+
+
+}
diff --git a/tests/PayPal/Test/Api/InvoiceSearchResponseTest.php b/tests/PayPal/Test/Api/InvoiceSearchResponseTest.php
new file mode 100644
index 0000000..d45effa
--- /dev/null
+++ b/tests/PayPal/Test/Api/InvoiceSearchResponseTest.php
@@ -0,0 +1,89 @@
+assertNotNull($obj);
+ $this->assertNotNull($obj->getTotalCount());
+ $this->assertNotNull($obj->getInvoices());
+ $this->assertEquals(self::getJson(), $obj->toJson());
+ return $obj;
+ }
+
+ /**
+ * @depends testSerializationDeserialization
+ * @param InvoiceSearchResponse $obj
+ */
+ public function testGetters($obj)
+ {
+ $this->assertEquals($obj->getTotalCount(), 123);
+ $this->assertEquals($obj->getInvoices(), InvoiceTest::getObject());
+ }
+
+ /**
+ * @depends testSerializationDeserialization
+ * @param InvoiceSearchResponse $obj
+ */
+ public function testDeprecatedGetters($obj)
+ {
+ $this->assertEquals($obj->getTotal_count(), 123);
+ }
+
+ /**
+ * @depends testSerializationDeserialization
+ * @param InvoiceSearchResponse $obj
+ */
+ public function testDeprecatedSetterNormalGetter($obj)
+ {
+
+ // Check for Total_count
+ $obj->setTotalCount(null);
+ $this->assertNull($obj->getTotal_count());
+ $this->assertNull($obj->getTotalCount());
+ $this->assertSame($obj->getTotalCount(), $obj->getTotal_count());
+ $obj->setTotal_count(123);
+ $this->assertEquals($obj->getTotal_count(), 123);
+
+ //Test All Deprecated Getters and Normal Getters
+ $this->testDeprecatedGetters($obj);
+ $this->testGetters($obj);
+ }
+
+
+
+}
diff --git a/tests/PayPal/Test/Api/InvoiceTest.php b/tests/PayPal/Test/Api/InvoiceTest.php
new file mode 100644
index 0000000..41b1e3a
--- /dev/null
+++ b/tests/PayPal/Test/Api/InvoiceTest.php
@@ -0,0 +1,505 @@
+assertNotNull($obj);
+ $this->assertNotNull($obj->getId());
+ $this->assertNotNull($obj->getNumber());
+ $this->assertNotNull($obj->getUri());
+ $this->assertNotNull($obj->getStatus());
+ $this->assertNotNull($obj->getMerchantInfo());
+ $this->assertNotNull($obj->getBillingInfo());
+ $this->assertNotNull($obj->getShippingInfo());
+ $this->assertNotNull($obj->getItems());
+ $this->assertNotNull($obj->getInvoiceDate());
+ $this->assertNotNull($obj->getPaymentTerm());
+ $this->assertNotNull($obj->getDiscount());
+ $this->assertNotNull($obj->getShippingCost());
+ $this->assertNotNull($obj->getCustom());
+ $this->assertNotNull($obj->getTaxCalculatedAfterDiscount());
+ $this->assertNotNull($obj->getTaxInclusive());
+ $this->assertNotNull($obj->getTerms());
+ $this->assertNotNull($obj->getNote());
+ $this->assertNotNull($obj->getMerchantMemo());
+ $this->assertNotNull($obj->getLogoUrl());
+ $this->assertNotNull($obj->getTotalAmount());
+ $this->assertNotNull($obj->getPaymentDetails());
+ $this->assertNotNull($obj->getRefundDetails());
+ $this->assertNotNull($obj->getMetadata());
+ $this->assertNotNull($obj->getAdditionalData());
+ $this->assertEquals(self::getJson(), $obj->toJson());
+ return $obj;
+ }
+
+ /**
+ * @depends testSerializationDeserialization
+ * @param Invoice $obj
+ */
+ public function testGetters($obj)
+ {
+ $this->assertEquals($obj->getId(), "TestSample");
+ $this->assertEquals($obj->getNumber(), "TestSample");
+ $this->assertEquals($obj->getUri(), "TestSample");
+ $this->assertEquals($obj->getStatus(), "TestSample");
+ $this->assertEquals($obj->getMerchantInfo(), MerchantInfoTest::getObject());
+ $this->assertEquals($obj->getBillingInfo(), BillingInfoTest::getObject());
+ $this->assertEquals($obj->getShippingInfo(), ShippingInfoTest::getObject());
+ $this->assertEquals($obj->getItems(), InvoiceItemTest::getObject());
+ $this->assertEquals($obj->getInvoiceDate(), "TestSample");
+ $this->assertEquals($obj->getPaymentTerm(), PaymentTermTest::getObject());
+ $this->assertEquals($obj->getDiscount(), CostTest::getObject());
+ $this->assertEquals($obj->getShippingCost(), ShippingCostTest::getObject());
+ $this->assertEquals($obj->getCustom(), CustomAmountTest::getObject());
+ $this->assertEquals($obj->getTaxCalculatedAfterDiscount(), true);
+ $this->assertEquals($obj->getTaxInclusive(), true);
+ $this->assertEquals($obj->getTerms(), "TestSample");
+ $this->assertEquals($obj->getNote(), "TestSample");
+ $this->assertEquals($obj->getMerchantMemo(), "TestSample");
+ $this->assertEquals($obj->getLogoUrl(), "http://www.google.com");
+ $this->assertEquals($obj->getTotalAmount(), CurrencyTest::getObject());
+ $this->assertEquals($obj->getPaymentDetails(), PaymentDetailTest::getObject());
+ $this->assertEquals($obj->getRefundDetails(), RefundDetailTest::getObject());
+ $this->assertEquals($obj->getMetadata(), MetadataTest::getObject());
+ $this->assertEquals($obj->getAdditionalData(), "TestSample");
+ }
+
+ /**
+ * @depends testSerializationDeserialization
+ * @param Invoice $obj
+ */
+ public function testDeprecatedGetters($obj)
+ {
+ $this->assertEquals($obj->getMerchant_info(), MerchantInfoTest::getObject());
+ $this->assertEquals($obj->getBilling_info(), BillingInfoTest::getObject());
+ $this->assertEquals($obj->getShipping_info(), ShippingInfoTest::getObject());
+ $this->assertEquals($obj->getInvoice_date(), "TestSample");
+ $this->assertEquals($obj->getPayment_term(), PaymentTermTest::getObject());
+ $this->assertEquals($obj->getShipping_cost(), ShippingCostTest::getObject());
+ $this->assertEquals($obj->getTax_calculated_after_discount(), true);
+ $this->assertEquals($obj->getTax_inclusive(), true);
+ $this->assertEquals($obj->getMerchant_memo(), "TestSample");
+ $this->assertEquals($obj->getLogo_url(), "http://www.google.com");
+ $this->assertEquals($obj->getTotal_amount(), CurrencyTest::getObject());
+ $this->assertEquals($obj->getPayment_details(), PaymentDetailTest::getObject());
+ $this->assertEquals($obj->getRefund_details(), RefundDetailTest::getObject());
+ $this->assertEquals($obj->getAdditional_data(), "TestSample");
+ }
+
+ /**
+ * @depends testSerializationDeserialization
+ * @param Invoice $obj
+ */
+ public function testDeprecatedSetterNormalGetter($obj)
+ {
+
+ // Check for Merchant_info
+ $obj->setMerchantInfo(null);
+ $this->assertNull($obj->getMerchant_info());
+ $this->assertNull($obj->getMerchantInfo());
+ $this->assertSame($obj->getMerchantInfo(), $obj->getMerchant_info());
+ $obj->setMerchant_info(MerchantInfoTest::getObject());
+ $this->assertEquals($obj->getMerchant_info(), MerchantInfoTest::getObject());
+
+ // Check for Billing_info
+ $obj->setBillingInfo(null);
+ $this->assertNull($obj->getBilling_info());
+ $this->assertNull($obj->getBillingInfo());
+ $this->assertSame($obj->getBillingInfo(), $obj->getBilling_info());
+ $obj->setBilling_info(BillingInfoTest::getObject());
+ $this->assertEquals($obj->getBilling_info(), BillingInfoTest::getObject());
+
+ // Check for Shipping_info
+ $obj->setShippingInfo(null);
+ $this->assertNull($obj->getShipping_info());
+ $this->assertNull($obj->getShippingInfo());
+ $this->assertSame($obj->getShippingInfo(), $obj->getShipping_info());
+ $obj->setShipping_info(ShippingInfoTest::getObject());
+ $this->assertEquals($obj->getShipping_info(), ShippingInfoTest::getObject());
+
+ // Check for Invoice_date
+ $obj->setInvoiceDate(null);
+ $this->assertNull($obj->getInvoice_date());
+ $this->assertNull($obj->getInvoiceDate());
+ $this->assertSame($obj->getInvoiceDate(), $obj->getInvoice_date());
+ $obj->setInvoice_date("TestSample");
+ $this->assertEquals($obj->getInvoice_date(), "TestSample");
+
+ // Check for Payment_term
+ $obj->setPaymentTerm(null);
+ $this->assertNull($obj->getPayment_term());
+ $this->assertNull($obj->getPaymentTerm());
+ $this->assertSame($obj->getPaymentTerm(), $obj->getPayment_term());
+ $obj->setPayment_term(PaymentTermTest::getObject());
+ $this->assertEquals($obj->getPayment_term(), PaymentTermTest::getObject());
+
+ // Check for Shipping_cost
+ $obj->setShippingCost(null);
+ $this->assertNull($obj->getShipping_cost());
+ $this->assertNull($obj->getShippingCost());
+ $this->assertSame($obj->getShippingCost(), $obj->getShipping_cost());
+ $obj->setShipping_cost(ShippingCostTest::getObject());
+ $this->assertEquals($obj->getShipping_cost(), ShippingCostTest::getObject());
+
+ // Check for Tax_calculated_after_discount
+ $obj->setTaxCalculatedAfterDiscount(null);
+ $this->assertNull($obj->getTax_calculated_after_discount());
+ $this->assertNull($obj->getTaxCalculatedAfterDiscount());
+ $this->assertSame($obj->getTaxCalculatedAfterDiscount(), $obj->getTax_calculated_after_discount());
+ $obj->setTax_calculated_after_discount(true);
+ $this->assertEquals($obj->getTax_calculated_after_discount(), true);
+
+ // Check for Tax_inclusive
+ $obj->setTaxInclusive(null);
+ $this->assertNull($obj->getTax_inclusive());
+ $this->assertNull($obj->getTaxInclusive());
+ $this->assertSame($obj->getTaxInclusive(), $obj->getTax_inclusive());
+ $obj->setTax_inclusive(true);
+ $this->assertEquals($obj->getTax_inclusive(), true);
+
+ // Check for Merchant_memo
+ $obj->setMerchantMemo(null);
+ $this->assertNull($obj->getMerchant_memo());
+ $this->assertNull($obj->getMerchantMemo());
+ $this->assertSame($obj->getMerchantMemo(), $obj->getMerchant_memo());
+ $obj->setMerchant_memo("TestSample");
+ $this->assertEquals($obj->getMerchant_memo(), "TestSample");
+
+ // Check for Total_amount
+ $obj->setTotalAmount(null);
+ $this->assertNull($obj->getTotal_amount());
+ $this->assertNull($obj->getTotalAmount());
+ $this->assertSame($obj->getTotalAmount(), $obj->getTotal_amount());
+ $obj->setTotal_amount(CurrencyTest::getObject());
+ $this->assertEquals($obj->getTotal_amount(), CurrencyTest::getObject());
+
+ // Check for Payment_details
+ $obj->setPaymentDetails(null);
+ $this->assertNull($obj->getPayment_details());
+ $this->assertNull($obj->getPaymentDetails());
+ $this->assertSame($obj->getPaymentDetails(), $obj->getPayment_details());
+ $obj->setPayment_details(PaymentDetailTest::getObject());
+ $this->assertEquals($obj->getPayment_details(), PaymentDetailTest::getObject());
+
+ // Check for Refund_details
+ $obj->setRefundDetails(null);
+ $this->assertNull($obj->getRefund_details());
+ $this->assertNull($obj->getRefundDetails());
+ $this->assertSame($obj->getRefundDetails(), $obj->getRefund_details());
+ $obj->setRefund_details(RefundDetailTest::getObject());
+ $this->assertEquals($obj->getRefund_details(), RefundDetailTest::getObject());
+
+ // Check for Additional_data
+ $obj->setAdditionalData(null);
+ $this->assertNull($obj->getAdditional_data());
+ $this->assertNull($obj->getAdditionalData());
+ $this->assertSame($obj->getAdditionalData(), $obj->getAdditional_data());
+ $obj->setAdditional_data("TestSample");
+ $this->assertEquals($obj->getAdditional_data(), "TestSample");
+
+ //Test All Deprecated Getters and Normal Getters
+ $this->testDeprecatedGetters($obj);
+ $this->testGetters($obj);
+ }
+
+ /**
+ * @expectedException \InvalidArgumentException
+ * @expectedExceptionMessage LogoUrl is not a fully qualified URL
+ */
+ public function testUrlValidationForLogoUrl()
+ {
+ $obj = new Invoice();
+ $obj->setLogoUrl(null);
+ }
+
+ public function testUrlValidationForLogoUrlDeprecated()
+ {
+ $obj = new Invoice();
+ $obj->setLogo_url(null);
+ $this->assertNull($obj->getLogo_url());
+ }
+ /**
+ * @dataProvider mockProvider
+ * @param Invoice $obj
+ */
+ public function testCreate($obj, $mockApiContext)
+ {
+ $mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $mockPPRestCall->expects($this->any())
+ ->method('execute')
+ ->will($this->returnValue(
+ self::getJson()
+ ));
+
+ $result = $obj->create($mockApiContext, $mockPPRestCall);
+ $this->assertNotNull($result);
+ }
+ /**
+ * @dataProvider mockProvider
+ * @param Invoice $obj
+ */
+ public function testSearch($obj, $mockApiContext)
+ {
+ $mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $mockPPRestCall->expects($this->any())
+ ->method('execute')
+ ->will($this->returnValue(
+ InvoiceSearchResponseTest::getJson()
+ ));
+ $search = SearchTest::getObject();
+
+ $result = $obj->search($search, $mockApiContext, $mockPPRestCall);
+ $this->assertNotNull($result);
+ }
+ /**
+ * @dataProvider mockProvider
+ * @param Invoice $obj
+ */
+ public function testSend($obj, $mockApiContext)
+ {
+ $mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $mockPPRestCall->expects($this->any())
+ ->method('execute')
+ ->will($this->returnValue(
+ true
+ ));
+
+ $result = $obj->send($mockApiContext, $mockPPRestCall);
+ $this->assertNotNull($result);
+ }
+ /**
+ * @dataProvider mockProvider
+ * @param Invoice $obj
+ */
+ public function testRemind($obj, $mockApiContext)
+ {
+ $mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $mockPPRestCall->expects($this->any())
+ ->method('execute')
+ ->will($this->returnValue(
+ true
+ ));
+ $notification = NotificationTest::getObject();
+
+ $result = $obj->remind($notification, $mockApiContext, $mockPPRestCall);
+ $this->assertNotNull($result);
+ }
+ /**
+ * @dataProvider mockProvider
+ * @param Invoice $obj
+ */
+ public function testCancel($obj, $mockApiContext)
+ {
+ $mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $mockPPRestCall->expects($this->any())
+ ->method('execute')
+ ->will($this->returnValue(
+ true
+ ));
+ $cancelNotification = CancelNotificationTest::getObject();
+
+ $result = $obj->cancel($cancelNotification, $mockApiContext, $mockPPRestCall);
+ $this->assertNotNull($result);
+ }
+ /**
+ * @dataProvider mockProvider
+ * @param Invoice $obj
+ */
+ public function testRecordPayment($obj, $mockApiContext)
+ {
+ $mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $mockPPRestCall->expects($this->any())
+ ->method('execute')
+ ->will($this->returnValue(
+ true
+ ));
+ $paymentDetail = PaymentDetailTest::getObject();
+
+ $result = $obj->recordPayment($paymentDetail, $mockApiContext, $mockPPRestCall);
+ $this->assertNotNull($result);
+ }
+ /**
+ * @dataProvider mockProvider
+ * @param Invoice $obj
+ */
+ public function testRecordRefund($obj, $mockApiContext)
+ {
+ $mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $mockPPRestCall->expects($this->any())
+ ->method('execute')
+ ->will($this->returnValue(
+ true
+ ));
+ $refundDetail = RefundDetailTest::getObject();
+
+ $result = $obj->recordRefund($refundDetail, $mockApiContext, $mockPPRestCall);
+ $this->assertNotNull($result);
+ }
+ /**
+ * @dataProvider mockProvider
+ * @param Invoice $obj
+ */
+ public function testGet($obj, $mockApiContext)
+ {
+ $mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $mockPPRestCall->expects($this->any())
+ ->method('execute')
+ ->will($this->returnValue(
+ InvoiceTest::getJson()
+ ));
+
+ $result = $obj->get("invoiceId", $mockApiContext, $mockPPRestCall);
+ $this->assertNotNull($result);
+ }
+ /**
+ * @dataProvider mockProvider
+ * @param Invoice $obj
+ */
+ public function testGetAll($obj, $mockApiContext)
+ {
+ $mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $mockPPRestCall->expects($this->any())
+ ->method('execute')
+ ->will($this->returnValue(
+ InvoiceSearchResponseTest::getJson()
+ ));
+
+ $result = $obj->getAll(array(), $mockApiContext, $mockPPRestCall);
+ $this->assertNotNull($result);
+ }
+ /**
+ * @dataProvider mockProvider
+ * @param Invoice $obj
+ */
+ public function testUpdate($obj, $mockApiContext)
+ {
+ $mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $mockPPRestCall->expects($this->any())
+ ->method('execute')
+ ->will($this->returnValue(
+ self::getJson()
+ ));
+
+ $result = $obj->update($mockApiContext, $mockPPRestCall);
+ $this->assertNotNull($result);
+ }
+ /**
+ * @dataProvider mockProvider
+ * @param Invoice $obj
+ */
+ public function testDelete($obj, $mockApiContext)
+ {
+ $mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $mockPPRestCall->expects($this->any())
+ ->method('execute')
+ ->will($this->returnValue(
+ true
+ ));
+
+ $result = $obj->delete($mockApiContext, $mockPPRestCall);
+ $this->assertNotNull($result);
+ }
+ /**
+ * @dataProvider mockProvider
+ * @param Invoice $obj
+ */
+ public function testQrCode($obj, $mockApiContext)
+ {
+ $mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $mockPPRestCall->expects($this->any())
+ ->method('execute')
+ ->will($this->returnValue(
+ ImageTest::getJson()
+ ));
+
+ $result = $obj->qrCode("invoiceId", array(), $mockApiContext, $mockPPRestCall);
+ $this->assertNotNull($result);
+ }
+
+ public function mockProvider()
+ {
+ $obj = self::getObject();
+ $mockApiContext = $this->getMockBuilder('ApiContext')
+ ->disableOriginalConstructor()
+ ->getMock();
+ return array(
+ array($obj, $mockApiContext),
+ array($obj, null)
+ );
+ }
+}
diff --git a/tests/PayPal/Test/Api/MerchantInfoTest.php b/tests/PayPal/Test/Api/MerchantInfoTest.php
new file mode 100644
index 0000000..11186e6
--- /dev/null
+++ b/tests/PayPal/Test/Api/MerchantInfoTest.php
@@ -0,0 +1,141 @@
+assertNotNull($obj);
+ $this->assertNotNull($obj->getEmail());
+ $this->assertNotNull($obj->getFirstName());
+ $this->assertNotNull($obj->getLastName());
+ $this->assertNotNull($obj->getAddress());
+ $this->assertNotNull($obj->getBusinessName());
+ $this->assertNotNull($obj->getPhone());
+ $this->assertNotNull($obj->getFax());
+ $this->assertNotNull($obj->getWebsite());
+ $this->assertNotNull($obj->getTaxId());
+ $this->assertNotNull($obj->getAdditionalInfo());
+ $this->assertEquals(self::getJson(), $obj->toJson());
+ return $obj;
+ }
+
+ /**
+ * @depends testSerializationDeserialization
+ * @param MerchantInfo $obj
+ */
+ public function testGetters($obj)
+ {
+ $this->assertEquals($obj->getEmail(), "TestSample");
+ $this->assertEquals($obj->getFirstName(), "TestSample");
+ $this->assertEquals($obj->getLastName(), "TestSample");
+ $this->assertEquals($obj->getAddress(), AddressTest::getObject());
+ $this->assertEquals($obj->getBusinessName(), "TestSample");
+ $this->assertEquals($obj->getPhone(), PhoneTest::getObject());
+ $this->assertEquals($obj->getFax(), PhoneTest::getObject());
+ $this->assertEquals($obj->getWebsite(), "TestSample");
+ $this->assertEquals($obj->getTaxId(), "TestSample");
+ $this->assertEquals($obj->getAdditionalInfo(), "TestSample");
+ }
+
+ /**
+ * @depends testSerializationDeserialization
+ * @param MerchantInfo $obj
+ */
+ public function testDeprecatedGetters($obj)
+ {
+ $this->assertEquals($obj->getFirst_name(), "TestSample");
+ $this->assertEquals($obj->getLast_name(), "TestSample");
+ $this->assertEquals($obj->getBusiness_name(), "TestSample");
+ $this->assertEquals($obj->getTax_id(), "TestSample");
+ $this->assertEquals($obj->getAdditional_info(), "TestSample");
+ }
+
+ /**
+ * @depends testSerializationDeserialization
+ * @param MerchantInfo $obj
+ */
+ public function testDeprecatedSetterNormalGetter($obj)
+ {
+
+ // Check for First_name
+ $obj->setFirstName(null);
+ $this->assertNull($obj->getFirst_name());
+ $this->assertNull($obj->getFirstName());
+ $this->assertSame($obj->getFirstName(), $obj->getFirst_name());
+ $obj->setFirst_name("TestSample");
+ $this->assertEquals($obj->getFirst_name(), "TestSample");
+
+ // Check for Last_name
+ $obj->setLastName(null);
+ $this->assertNull($obj->getLast_name());
+ $this->assertNull($obj->getLastName());
+ $this->assertSame($obj->getLastName(), $obj->getLast_name());
+ $obj->setLast_name("TestSample");
+ $this->assertEquals($obj->getLast_name(), "TestSample");
+
+ // Check for Business_name
+ $obj->setBusinessName(null);
+ $this->assertNull($obj->getBusiness_name());
+ $this->assertNull($obj->getBusinessName());
+ $this->assertSame($obj->getBusinessName(), $obj->getBusiness_name());
+ $obj->setBusiness_name("TestSample");
+ $this->assertEquals($obj->getBusiness_name(), "TestSample");
+
+ // Check for Tax_id
+ $obj->setTaxId(null);
+ $this->assertNull($obj->getTax_id());
+ $this->assertNull($obj->getTaxId());
+ $this->assertSame($obj->getTaxId(), $obj->getTax_id());
+ $obj->setTax_id("TestSample");
+ $this->assertEquals($obj->getTax_id(), "TestSample");
+
+ // Check for Additional_info
+ $obj->setAdditionalInfo(null);
+ $this->assertNull($obj->getAdditional_info());
+ $this->assertNull($obj->getAdditionalInfo());
+ $this->assertSame($obj->getAdditionalInfo(), $obj->getAdditional_info());
+ $obj->setAdditional_info("TestSample");
+ $this->assertEquals($obj->getAdditional_info(), "TestSample");
+
+ //Test All Deprecated Getters and Normal Getters
+ $this->testDeprecatedGetters($obj);
+ $this->testGetters($obj);
+ }
+
+
+
+}
diff --git a/tests/PayPal/Test/Api/MetadataTest.php b/tests/PayPal/Test/Api/MetadataTest.php
new file mode 100644
index 0000000..bce0d61
--- /dev/null
+++ b/tests/PayPal/Test/Api/MetadataTest.php
@@ -0,0 +1,193 @@
+assertNotNull($obj);
+ $this->assertNotNull($obj->getCreatedDate());
+ $this->assertNotNull($obj->getCreatedBy());
+ $this->assertNotNull($obj->getCancelledDate());
+ $this->assertNotNull($obj->getCancelledBy());
+ $this->assertNotNull($obj->getLastUpdatedDate());
+ $this->assertNotNull($obj->getLastUpdatedBy());
+ $this->assertNotNull($obj->getFirstSentDate());
+ $this->assertNotNull($obj->getLastSentDate());
+ $this->assertNotNull($obj->getLastSentBy());
+ $this->assertNotNull($obj->getPayerViewUrl());
+ $this->assertEquals(self::getJson(), $obj->toJson());
+ return $obj;
+ }
+
+ /**
+ * @depends testSerializationDeserialization
+ * @param Metadata $obj
+ */
+ public function testGetters($obj)
+ {
+ $this->assertEquals($obj->getCreatedDate(), "TestSample");
+ $this->assertEquals($obj->getCreatedBy(), "TestSample");
+ $this->assertEquals($obj->getCancelledDate(), "TestSample");
+ $this->assertEquals($obj->getCancelledBy(), "TestSample");
+ $this->assertEquals($obj->getLastUpdatedDate(), "TestSample");
+ $this->assertEquals($obj->getLastUpdatedBy(), "TestSample");
+ $this->assertEquals($obj->getFirstSentDate(), "TestSample");
+ $this->assertEquals($obj->getLastSentDate(), "TestSample");
+ $this->assertEquals($obj->getLastSentBy(), "TestSample");
+ $this->assertEquals($obj->getPayerViewUrl(), "http://www.google.com");
+ }
+
+ /**
+ * @depends testSerializationDeserialization
+ * @param Metadata $obj
+ */
+ public function testDeprecatedGetters($obj)
+ {
+ $this->assertEquals($obj->getCreated_date(), "TestSample");
+ $this->assertEquals($obj->getCreated_by(), "TestSample");
+ $this->assertEquals($obj->getCancelled_date(), "TestSample");
+ $this->assertEquals($obj->getCancelled_by(), "TestSample");
+ $this->assertEquals($obj->getLast_updated_date(), "TestSample");
+ $this->assertEquals($obj->getLast_updated_by(), "TestSample");
+ $this->assertEquals($obj->getFirst_sent_date(), "TestSample");
+ $this->assertEquals($obj->getLast_sent_date(), "TestSample");
+ $this->assertEquals($obj->getLast_sent_by(), "TestSample");
+ $this->assertEquals($obj->getPayer_view_url(), "http://www.google.com");
+ }
+
+ /**
+ * @depends testSerializationDeserialization
+ * @param Metadata $obj
+ */
+ public function testDeprecatedSetterNormalGetter($obj)
+ {
+
+ // Check for Created_date
+ $obj->setCreatedDate(null);
+ $this->assertNull($obj->getCreated_date());
+ $this->assertNull($obj->getCreatedDate());
+ $this->assertSame($obj->getCreatedDate(), $obj->getCreated_date());
+ $obj->setCreated_date("TestSample");
+ $this->assertEquals($obj->getCreated_date(), "TestSample");
+
+ // Check for Created_by
+ $obj->setCreatedBy(null);
+ $this->assertNull($obj->getCreated_by());
+ $this->assertNull($obj->getCreatedBy());
+ $this->assertSame($obj->getCreatedBy(), $obj->getCreated_by());
+ $obj->setCreated_by("TestSample");
+ $this->assertEquals($obj->getCreated_by(), "TestSample");
+
+ // Check for Cancelled_date
+ $obj->setCancelledDate(null);
+ $this->assertNull($obj->getCancelled_date());
+ $this->assertNull($obj->getCancelledDate());
+ $this->assertSame($obj->getCancelledDate(), $obj->getCancelled_date());
+ $obj->setCancelled_date("TestSample");
+ $this->assertEquals($obj->getCancelled_date(), "TestSample");
+
+ // Check for Cancelled_by
+ $obj->setCancelledBy(null);
+ $this->assertNull($obj->getCancelled_by());
+ $this->assertNull($obj->getCancelledBy());
+ $this->assertSame($obj->getCancelledBy(), $obj->getCancelled_by());
+ $obj->setCancelled_by("TestSample");
+ $this->assertEquals($obj->getCancelled_by(), "TestSample");
+
+ // Check for Last_updated_date
+ $obj->setLastUpdatedDate(null);
+ $this->assertNull($obj->getLast_updated_date());
+ $this->assertNull($obj->getLastUpdatedDate());
+ $this->assertSame($obj->getLastUpdatedDate(), $obj->getLast_updated_date());
+ $obj->setLast_updated_date("TestSample");
+ $this->assertEquals($obj->getLast_updated_date(), "TestSample");
+
+ // Check for Last_updated_by
+ $obj->setLastUpdatedBy(null);
+ $this->assertNull($obj->getLast_updated_by());
+ $this->assertNull($obj->getLastUpdatedBy());
+ $this->assertSame($obj->getLastUpdatedBy(), $obj->getLast_updated_by());
+ $obj->setLast_updated_by("TestSample");
+ $this->assertEquals($obj->getLast_updated_by(), "TestSample");
+
+ // Check for First_sent_date
+ $obj->setFirstSentDate(null);
+ $this->assertNull($obj->getFirst_sent_date());
+ $this->assertNull($obj->getFirstSentDate());
+ $this->assertSame($obj->getFirstSentDate(), $obj->getFirst_sent_date());
+ $obj->setFirst_sent_date("TestSample");
+ $this->assertEquals($obj->getFirst_sent_date(), "TestSample");
+
+ // Check for Last_sent_date
+ $obj->setLastSentDate(null);
+ $this->assertNull($obj->getLast_sent_date());
+ $this->assertNull($obj->getLastSentDate());
+ $this->assertSame($obj->getLastSentDate(), $obj->getLast_sent_date());
+ $obj->setLast_sent_date("TestSample");
+ $this->assertEquals($obj->getLast_sent_date(), "TestSample");
+
+ // Check for Last_sent_by
+ $obj->setLastSentBy(null);
+ $this->assertNull($obj->getLast_sent_by());
+ $this->assertNull($obj->getLastSentBy());
+ $this->assertSame($obj->getLastSentBy(), $obj->getLast_sent_by());
+ $obj->setLast_sent_by("TestSample");
+ $this->assertEquals($obj->getLast_sent_by(), "TestSample");
+
+ //Test All Deprecated Getters and Normal Getters
+ $this->testDeprecatedGetters($obj);
+ $this->testGetters($obj);
+ }
+
+ /**
+ * @expectedException \InvalidArgumentException
+ * @expectedExceptionMessage PayerViewUrl is not a fully qualified URL
+ */
+ public function testUrlValidationForPayerViewUrl()
+ {
+ $obj = new Metadata();
+ $obj->setPayerViewUrl(null);
+ }
+
+ public function testUrlValidationForPayerViewUrlDeprecated()
+ {
+ $obj = new Metadata();
+ $obj->setPayer_view_url(null);
+ $this->assertNull($obj->getPayer_view_url());
+ }
+
+}
diff --git a/tests/PayPal/Test/Api/NotificationTest.php b/tests/PayPal/Test/Api/NotificationTest.php
new file mode 100644
index 0000000..8b9bebe
--- /dev/null
+++ b/tests/PayPal/Test/Api/NotificationTest.php
@@ -0,0 +1,91 @@
+assertNotNull($obj);
+ $this->assertNotNull($obj->getSubject());
+ $this->assertNotNull($obj->getNote());
+ $this->assertNotNull($obj->getSendToMerchant());
+ $this->assertEquals(self::getJson(), $obj->toJson());
+ return $obj;
+ }
+
+ /**
+ * @depends testSerializationDeserialization
+ * @param Notification $obj
+ */
+ public function testGetters($obj)
+ {
+ $this->assertEquals($obj->getSubject(), "TestSample");
+ $this->assertEquals($obj->getNote(), "TestSample");
+ $this->assertEquals($obj->getSendToMerchant(), true);
+ }
+
+ /**
+ * @depends testSerializationDeserialization
+ * @param Notification $obj
+ */
+ public function testDeprecatedGetters($obj)
+ {
+ $this->assertEquals($obj->getSend_to_merchant(), true);
+ }
+
+ /**
+ * @depends testSerializationDeserialization
+ * @param Notification $obj
+ */
+ public function testDeprecatedSetterNormalGetter($obj)
+ {
+
+ // Check for Send_to_merchant
+ $obj->setSendToMerchant(null);
+ $this->assertNull($obj->getSend_to_merchant());
+ $this->assertNull($obj->getSendToMerchant());
+ $this->assertSame($obj->getSendToMerchant(), $obj->getSend_to_merchant());
+ $obj->setSend_to_merchant(true);
+ $this->assertEquals($obj->getSend_to_merchant(), true);
+
+ //Test All Deprecated Getters and Normal Getters
+ $this->testDeprecatedGetters($obj);
+ $this->testGetters($obj);
+ }
+
+
+
+}
diff --git a/tests/PayPal/Test/Api/PaymentDetailTest.php b/tests/PayPal/Test/Api/PaymentDetailTest.php
new file mode 100644
index 0000000..a01e533
--- /dev/null
+++ b/tests/PayPal/Test/Api/PaymentDetailTest.php
@@ -0,0 +1,106 @@
+assertNotNull($obj);
+ $this->assertNotNull($obj->getType());
+ $this->assertNotNull($obj->getTransactionId());
+ $this->assertNotNull($obj->getTransactionType());
+ $this->assertNotNull($obj->getDate());
+ $this->assertNotNull($obj->getMethod());
+ $this->assertNotNull($obj->getNote());
+ $this->assertEquals(self::getJson(), $obj->toJson());
+ return $obj;
+ }
+
+ /**
+ * @depends testSerializationDeserialization
+ * @param PaymentDetail $obj
+ */
+ public function testGetters($obj)
+ {
+ $this->assertEquals($obj->getType(), "TestSample");
+ $this->assertEquals($obj->getTransactionId(), "TestSample");
+ $this->assertEquals($obj->getTransactionType(), "TestSample");
+ $this->assertEquals($obj->getDate(), "TestSample");
+ $this->assertEquals($obj->getMethod(), "TestSample");
+ $this->assertEquals($obj->getNote(), "TestSample");
+ }
+
+ /**
+ * @depends testSerializationDeserialization
+ * @param PaymentDetail $obj
+ */
+ public function testDeprecatedGetters($obj)
+ {
+ $this->assertEquals($obj->getTransaction_id(), "TestSample");
+ $this->assertEquals($obj->getTransaction_type(), "TestSample");
+ }
+
+ /**
+ * @depends testSerializationDeserialization
+ * @param PaymentDetail $obj
+ */
+ public function testDeprecatedSetterNormalGetter($obj)
+ {
+
+ // Check for Transaction_id
+ $obj->setTransactionId(null);
+ $this->assertNull($obj->getTransaction_id());
+ $this->assertNull($obj->getTransactionId());
+ $this->assertSame($obj->getTransactionId(), $obj->getTransaction_id());
+ $obj->setTransaction_id("TestSample");
+ $this->assertEquals($obj->getTransaction_id(), "TestSample");
+
+ // Check for Transaction_type
+ $obj->setTransactionType(null);
+ $this->assertNull($obj->getTransaction_type());
+ $this->assertNull($obj->getTransactionType());
+ $this->assertSame($obj->getTransactionType(), $obj->getTransaction_type());
+ $obj->setTransaction_type("TestSample");
+ $this->assertEquals($obj->getTransaction_type(), "TestSample");
+
+ //Test All Deprecated Getters and Normal Getters
+ $this->testDeprecatedGetters($obj);
+ $this->testGetters($obj);
+ }
+
+
+
+}
diff --git a/tests/PayPal/Test/Api/PaymentTermTest.php b/tests/PayPal/Test/Api/PaymentTermTest.php
new file mode 100644
index 0000000..0cd8e73
--- /dev/null
+++ b/tests/PayPal/Test/Api/PaymentTermTest.php
@@ -0,0 +1,98 @@
+assertNotNull($obj);
+ $this->assertNotNull($obj->getTermType());
+ $this->assertNotNull($obj->getDueDate());
+ $this->assertEquals(self::getJson(), $obj->toJson());
+ return $obj;
+ }
+
+ /**
+ * @depends testSerializationDeserialization
+ * @param PaymentTerm $obj
+ */
+ public function testGetters($obj)
+ {
+ $this->assertEquals($obj->getTermType(), "TestSample");
+ $this->assertEquals($obj->getDueDate(), "TestSample");
+ }
+
+ /**
+ * @depends testSerializationDeserialization
+ * @param PaymentTerm $obj
+ */
+ public function testDeprecatedGetters($obj)
+ {
+ $this->assertEquals($obj->getTerm_type(), "TestSample");
+ $this->assertEquals($obj->getDue_date(), "TestSample");
+ }
+
+ /**
+ * @depends testSerializationDeserialization
+ * @param PaymentTerm $obj
+ */
+ public function testDeprecatedSetterNormalGetter($obj)
+ {
+
+ // Check for Term_type
+ $obj->setTermType(null);
+ $this->assertNull($obj->getTerm_type());
+ $this->assertNull($obj->getTermType());
+ $this->assertSame($obj->getTermType(), $obj->getTerm_type());
+ $obj->setTerm_type("TestSample");
+ $this->assertEquals($obj->getTerm_type(), "TestSample");
+
+ // Check for Due_date
+ $obj->setDueDate(null);
+ $this->assertNull($obj->getDue_date());
+ $this->assertNull($obj->getDueDate());
+ $this->assertSame($obj->getDueDate(), $obj->getDue_date());
+ $obj->setDue_date("TestSample");
+ $this->assertEquals($obj->getDue_date(), "TestSample");
+
+ //Test All Deprecated Getters and Normal Getters
+ $this->testDeprecatedGetters($obj);
+ $this->testGetters($obj);
+ }
+
+
+
+}
diff --git a/tests/PayPal/Test/Api/PhoneTest.php b/tests/PayPal/Test/Api/PhoneTest.php
new file mode 100644
index 0000000..00ce876
--- /dev/null
+++ b/tests/PayPal/Test/Api/PhoneTest.php
@@ -0,0 +1,98 @@
+assertNotNull($obj);
+ $this->assertNotNull($obj->getCountryCode());
+ $this->assertNotNull($obj->getNationalNumber());
+ $this->assertEquals(self::getJson(), $obj->toJson());
+ return $obj;
+ }
+
+ /**
+ * @depends testSerializationDeserialization
+ * @param Phone $obj
+ */
+ public function testGetters($obj)
+ {
+ $this->assertEquals($obj->getCountryCode(), "TestSample");
+ $this->assertEquals($obj->getNationalNumber(), "TestSample");
+ }
+
+ /**
+ * @depends testSerializationDeserialization
+ * @param Phone $obj
+ */
+ public function testDeprecatedGetters($obj)
+ {
+ $this->assertEquals($obj->getCountry_code(), "TestSample");
+ $this->assertEquals($obj->getNational_number(), "TestSample");
+ }
+
+ /**
+ * @depends testSerializationDeserialization
+ * @param Phone $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 National_number
+ $obj->setNationalNumber(null);
+ $this->assertNull($obj->getNational_number());
+ $this->assertNull($obj->getNationalNumber());
+ $this->assertSame($obj->getNationalNumber(), $obj->getNational_number());
+ $obj->setNational_number("TestSample");
+ $this->assertEquals($obj->getNational_number(), "TestSample");
+
+ //Test All Deprecated Getters and Normal Getters
+ $this->testDeprecatedGetters($obj);
+ $this->testGetters($obj);
+ }
+
+
+
+}
diff --git a/tests/PayPal/Test/Api/RefundDetailTest.php b/tests/PayPal/Test/Api/RefundDetailTest.php
new file mode 100644
index 0000000..8de6252
--- /dev/null
+++ b/tests/PayPal/Test/Api/RefundDetailTest.php
@@ -0,0 +1,82 @@
+assertNotNull($obj);
+ $this->assertNotNull($obj->getType());
+ $this->assertNotNull($obj->getDate());
+ $this->assertNotNull($obj->getNote());
+ $this->assertEquals(self::getJson(), $obj->toJson());
+ return $obj;
+ }
+
+ /**
+ * @depends testSerializationDeserialization
+ * @param RefundDetail $obj
+ */
+ public function testGetters($obj)
+ {
+ $this->assertEquals($obj->getType(), "TestSample");
+ $this->assertEquals($obj->getDate(), "TestSample");
+ $this->assertEquals($obj->getNote(), "TestSample");
+ }
+
+ /**
+ * @depends testSerializationDeserialization
+ * @param RefundDetail $obj
+ */
+ public function testDeprecatedGetters($obj)
+ {
+ }
+
+ /**
+ * @depends testSerializationDeserialization
+ * @param RefundDetail $obj
+ */
+ public function testDeprecatedSetterNormalGetter($obj)
+ {
+
+ //Test All Deprecated Getters and Normal Getters
+ $this->testDeprecatedGetters($obj);
+ $this->testGetters($obj);
+ }
+
+
+
+}
diff --git a/tests/PayPal/Test/Api/SearchTest.php b/tests/PayPal/Test/Api/SearchTest.php
new file mode 100644
index 0000000..30aac6a
--- /dev/null
+++ b/tests/PayPal/Test/Api/SearchTest.php
@@ -0,0 +1,249 @@
+assertNotNull($obj);
+ $this->assertNotNull($obj->getEmail());
+ $this->assertNotNull($obj->getRecipientFirstName());
+ $this->assertNotNull($obj->getRecipientLastName());
+ $this->assertNotNull($obj->getRecipientBusinessName());
+ $this->assertNotNull($obj->getNumber());
+ $this->assertNotNull($obj->getStatus());
+ $this->assertNotNull($obj->getLowerTotalAmount());
+ $this->assertNotNull($obj->getUpperTotalAmount());
+ $this->assertNotNull($obj->getStartInvoiceDate());
+ $this->assertNotNull($obj->getEndInvoiceDate());
+ $this->assertNotNull($obj->getStartDueDate());
+ $this->assertNotNull($obj->getEndDueDate());
+ $this->assertNotNull($obj->getStartPaymentDate());
+ $this->assertNotNull($obj->getEndPaymentDate());
+ $this->assertNotNull($obj->getStartCreationDate());
+ $this->assertNotNull($obj->getEndCreationDate());
+ $this->assertNotNull($obj->getPage());
+ $this->assertNotNull($obj->getPageSize());
+ $this->assertNotNull($obj->getTotalCountRequired());
+ $this->assertEquals(self::getJson(), $obj->toJson());
+ return $obj;
+ }
+
+ /**
+ * @depends testSerializationDeserialization
+ * @param Search $obj
+ */
+ public function testGetters($obj)
+ {
+ $this->assertEquals($obj->getEmail(), "TestSample");
+ $this->assertEquals($obj->getRecipientFirstName(), "TestSample");
+ $this->assertEquals($obj->getRecipientLastName(), "TestSample");
+ $this->assertEquals($obj->getRecipientBusinessName(), "TestSample");
+ $this->assertEquals($obj->getNumber(), "TestSample");
+ $this->assertEquals($obj->getStatus(), "TestSample");
+ $this->assertEquals($obj->getLowerTotalAmount(), CurrencyTest::getObject());
+ $this->assertEquals($obj->getUpperTotalAmount(), CurrencyTest::getObject());
+ $this->assertEquals($obj->getStartInvoiceDate(), "TestSample");
+ $this->assertEquals($obj->getEndInvoiceDate(), "TestSample");
+ $this->assertEquals($obj->getStartDueDate(), "TestSample");
+ $this->assertEquals($obj->getEndDueDate(), "TestSample");
+ $this->assertEquals($obj->getStartPaymentDate(), "TestSample");
+ $this->assertEquals($obj->getEndPaymentDate(), "TestSample");
+ $this->assertEquals($obj->getStartCreationDate(), "TestSample");
+ $this->assertEquals($obj->getEndCreationDate(), "TestSample");
+ $this->assertEquals($obj->getPage(), "12.34");
+ $this->assertEquals($obj->getPageSize(), "12.34");
+ $this->assertEquals($obj->getTotalCountRequired(), true);
+ }
+
+ /**
+ * @depends testSerializationDeserialization
+ * @param Search $obj
+ */
+ public function testDeprecatedGetters($obj)
+ {
+ $this->assertEquals($obj->getRecipient_first_name(), "TestSample");
+ $this->assertEquals($obj->getRecipient_last_name(), "TestSample");
+ $this->assertEquals($obj->getRecipient_business_name(), "TestSample");
+ $this->assertEquals($obj->getLower_total_amount(), CurrencyTest::getObject());
+ $this->assertEquals($obj->getUpper_total_amount(), CurrencyTest::getObject());
+ $this->assertEquals($obj->getStart_invoice_date(), "TestSample");
+ $this->assertEquals($obj->getEnd_invoice_date(), "TestSample");
+ $this->assertEquals($obj->getStart_due_date(), "TestSample");
+ $this->assertEquals($obj->getEnd_due_date(), "TestSample");
+ $this->assertEquals($obj->getStart_payment_date(), "TestSample");
+ $this->assertEquals($obj->getEnd_payment_date(), "TestSample");
+ $this->assertEquals($obj->getStart_creation_date(), "TestSample");
+ $this->assertEquals($obj->getEnd_creation_date(), "TestSample");
+ $this->assertEquals($obj->getPage_size(), "12.34");
+ $this->assertEquals($obj->getTotal_count_required(), true);
+ }
+
+ /**
+ * @depends testSerializationDeserialization
+ * @param Search $obj
+ */
+ public function testDeprecatedSetterNormalGetter($obj)
+ {
+
+ // Check for Recipient_first_name
+ $obj->setRecipientFirstName(null);
+ $this->assertNull($obj->getRecipient_first_name());
+ $this->assertNull($obj->getRecipientFirstName());
+ $this->assertSame($obj->getRecipientFirstName(), $obj->getRecipient_first_name());
+ $obj->setRecipient_first_name("TestSample");
+ $this->assertEquals($obj->getRecipient_first_name(), "TestSample");
+
+ // Check for Recipient_last_name
+ $obj->setRecipientLastName(null);
+ $this->assertNull($obj->getRecipient_last_name());
+ $this->assertNull($obj->getRecipientLastName());
+ $this->assertSame($obj->getRecipientLastName(), $obj->getRecipient_last_name());
+ $obj->setRecipient_last_name("TestSample");
+ $this->assertEquals($obj->getRecipient_last_name(), "TestSample");
+
+ // Check for Recipient_business_name
+ $obj->setRecipientBusinessName(null);
+ $this->assertNull($obj->getRecipient_business_name());
+ $this->assertNull($obj->getRecipientBusinessName());
+ $this->assertSame($obj->getRecipientBusinessName(), $obj->getRecipient_business_name());
+ $obj->setRecipient_business_name("TestSample");
+ $this->assertEquals($obj->getRecipient_business_name(), "TestSample");
+
+ // Check for Lower_total_amount
+ $obj->setLowerTotalAmount(null);
+ $this->assertNull($obj->getLower_total_amount());
+ $this->assertNull($obj->getLowerTotalAmount());
+ $this->assertSame($obj->getLowerTotalAmount(), $obj->getLower_total_amount());
+ $obj->setLower_total_amount(CurrencyTest::getObject());
+ $this->assertEquals($obj->getLower_total_amount(), CurrencyTest::getObject());
+
+ // Check for Upper_total_amount
+ $obj->setUpperTotalAmount(null);
+ $this->assertNull($obj->getUpper_total_amount());
+ $this->assertNull($obj->getUpperTotalAmount());
+ $this->assertSame($obj->getUpperTotalAmount(), $obj->getUpper_total_amount());
+ $obj->setUpper_total_amount(CurrencyTest::getObject());
+ $this->assertEquals($obj->getUpper_total_amount(), CurrencyTest::getObject());
+
+ // Check for Start_invoice_date
+ $obj->setStartInvoiceDate(null);
+ $this->assertNull($obj->getStart_invoice_date());
+ $this->assertNull($obj->getStartInvoiceDate());
+ $this->assertSame($obj->getStartInvoiceDate(), $obj->getStart_invoice_date());
+ $obj->setStart_invoice_date("TestSample");
+ $this->assertEquals($obj->getStart_invoice_date(), "TestSample");
+
+ // Check for End_invoice_date
+ $obj->setEndInvoiceDate(null);
+ $this->assertNull($obj->getEnd_invoice_date());
+ $this->assertNull($obj->getEndInvoiceDate());
+ $this->assertSame($obj->getEndInvoiceDate(), $obj->getEnd_invoice_date());
+ $obj->setEnd_invoice_date("TestSample");
+ $this->assertEquals($obj->getEnd_invoice_date(), "TestSample");
+
+ // Check for Start_due_date
+ $obj->setStartDueDate(null);
+ $this->assertNull($obj->getStart_due_date());
+ $this->assertNull($obj->getStartDueDate());
+ $this->assertSame($obj->getStartDueDate(), $obj->getStart_due_date());
+ $obj->setStart_due_date("TestSample");
+ $this->assertEquals($obj->getStart_due_date(), "TestSample");
+
+ // Check for End_due_date
+ $obj->setEndDueDate(null);
+ $this->assertNull($obj->getEnd_due_date());
+ $this->assertNull($obj->getEndDueDate());
+ $this->assertSame($obj->getEndDueDate(), $obj->getEnd_due_date());
+ $obj->setEnd_due_date("TestSample");
+ $this->assertEquals($obj->getEnd_due_date(), "TestSample");
+
+ // Check for Start_payment_date
+ $obj->setStartPaymentDate(null);
+ $this->assertNull($obj->getStart_payment_date());
+ $this->assertNull($obj->getStartPaymentDate());
+ $this->assertSame($obj->getStartPaymentDate(), $obj->getStart_payment_date());
+ $obj->setStart_payment_date("TestSample");
+ $this->assertEquals($obj->getStart_payment_date(), "TestSample");
+
+ // Check for End_payment_date
+ $obj->setEndPaymentDate(null);
+ $this->assertNull($obj->getEnd_payment_date());
+ $this->assertNull($obj->getEndPaymentDate());
+ $this->assertSame($obj->getEndPaymentDate(), $obj->getEnd_payment_date());
+ $obj->setEnd_payment_date("TestSample");
+ $this->assertEquals($obj->getEnd_payment_date(), "TestSample");
+
+ // Check for Start_creation_date
+ $obj->setStartCreationDate(null);
+ $this->assertNull($obj->getStart_creation_date());
+ $this->assertNull($obj->getStartCreationDate());
+ $this->assertSame($obj->getStartCreationDate(), $obj->getStart_creation_date());
+ $obj->setStart_creation_date("TestSample");
+ $this->assertEquals($obj->getStart_creation_date(), "TestSample");
+
+ // Check for End_creation_date
+ $obj->setEndCreationDate(null);
+ $this->assertNull($obj->getEnd_creation_date());
+ $this->assertNull($obj->getEndCreationDate());
+ $this->assertSame($obj->getEndCreationDate(), $obj->getEnd_creation_date());
+ $obj->setEnd_creation_date("TestSample");
+ $this->assertEquals($obj->getEnd_creation_date(), "TestSample");
+
+ // Check for Page_size
+ $obj->setPageSize(null);
+ $this->assertNull($obj->getPage_size());
+ $this->assertNull($obj->getPageSize());
+ $this->assertSame($obj->getPageSize(), $obj->getPage_size());
+ $obj->setPage_size("12.34");
+ $this->assertEquals($obj->getPage_size(), "12.34");
+
+ // Check for Total_count_required
+ $obj->setTotalCountRequired(null);
+ $this->assertNull($obj->getTotal_count_required());
+ $this->assertNull($obj->getTotalCountRequired());
+ $this->assertSame($obj->getTotalCountRequired(), $obj->getTotal_count_required());
+ $obj->setTotal_count_required(true);
+ $this->assertEquals($obj->getTotal_count_required(), true);
+
+ //Test All Deprecated Getters and Normal Getters
+ $this->testDeprecatedGetters($obj);
+ $this->testGetters($obj);
+ }
+
+
+
+}
diff --git a/tests/PayPal/Test/Api/ShippingCostTest.php b/tests/PayPal/Test/Api/ShippingCostTest.php
new file mode 100644
index 0000000..ed3fbf8
--- /dev/null
+++ b/tests/PayPal/Test/Api/ShippingCostTest.php
@@ -0,0 +1,80 @@
+assertNotNull($obj);
+ $this->assertNotNull($obj->getAmount());
+ $this->assertNotNull($obj->getTax());
+ $this->assertEquals(self::getJson(), $obj->toJson());
+ return $obj;
+ }
+
+ /**
+ * @depends testSerializationDeserialization
+ * @param ShippingCost $obj
+ */
+ public function testGetters($obj)
+ {
+ $this->assertEquals($obj->getAmount(), CurrencyTest::getObject());
+ $this->assertEquals($obj->getTax(), TaxTest::getObject());
+ }
+
+ /**
+ * @depends testSerializationDeserialization
+ * @param ShippingCost $obj
+ */
+ public function testDeprecatedGetters($obj)
+ {
+ }
+
+ /**
+ * @depends testSerializationDeserialization
+ * @param ShippingCost $obj
+ */
+ public function testDeprecatedSetterNormalGetter($obj)
+ {
+
+ //Test All Deprecated Getters and Normal Getters
+ $this->testDeprecatedGetters($obj);
+ $this->testGetters($obj);
+ }
+
+
+
+}
diff --git a/tests/PayPal/Test/Api/ShippingInfoTest.php b/tests/PayPal/Test/Api/ShippingInfoTest.php
new file mode 100644
index 0000000..df3b72a
--- /dev/null
+++ b/tests/PayPal/Test/Api/ShippingInfoTest.php
@@ -0,0 +1,111 @@
+assertNotNull($obj);
+ $this->assertNotNull($obj->getFirstName());
+ $this->assertNotNull($obj->getLastName());
+ $this->assertNotNull($obj->getBusinessName());
+ $this->assertNotNull($obj->getAddress());
+ $this->assertEquals(self::getJson(), $obj->toJson());
+ return $obj;
+ }
+
+ /**
+ * @depends testSerializationDeserialization
+ * @param ShippingInfo $obj
+ */
+ public function testGetters($obj)
+ {
+ $this->assertEquals($obj->getFirstName(), "TestSample");
+ $this->assertEquals($obj->getLastName(), "TestSample");
+ $this->assertEquals($obj->getBusinessName(), "TestSample");
+ $this->assertEquals($obj->getAddress(), AddressTest::getObject());
+ }
+
+ /**
+ * @depends testSerializationDeserialization
+ * @param ShippingInfo $obj
+ */
+ public function testDeprecatedGetters($obj)
+ {
+ $this->assertEquals($obj->getFirst_name(), "TestSample");
+ $this->assertEquals($obj->getLast_name(), "TestSample");
+ $this->assertEquals($obj->getBusiness_name(), "TestSample");
+ }
+
+ /**
+ * @depends testSerializationDeserialization
+ * @param ShippingInfo $obj
+ */
+ public function testDeprecatedSetterNormalGetter($obj)
+ {
+
+ // Check for First_name
+ $obj->setFirstName(null);
+ $this->assertNull($obj->getFirst_name());
+ $this->assertNull($obj->getFirstName());
+ $this->assertSame($obj->getFirstName(), $obj->getFirst_name());
+ $obj->setFirst_name("TestSample");
+ $this->assertEquals($obj->getFirst_name(), "TestSample");
+
+ // Check for Last_name
+ $obj->setLastName(null);
+ $this->assertNull($obj->getLast_name());
+ $this->assertNull($obj->getLastName());
+ $this->assertSame($obj->getLastName(), $obj->getLast_name());
+ $obj->setLast_name("TestSample");
+ $this->assertEquals($obj->getLast_name(), "TestSample");
+
+ // Check for Business_name
+ $obj->setBusinessName(null);
+ $this->assertNull($obj->getBusiness_name());
+ $this->assertNull($obj->getBusinessName());
+ $this->assertSame($obj->getBusinessName(), $obj->getBusiness_name());
+ $obj->setBusiness_name("TestSample");
+ $this->assertEquals($obj->getBusiness_name(), "TestSample");
+
+ //Test All Deprecated Getters and Normal Getters
+ $this->testDeprecatedGetters($obj);
+ $this->testGetters($obj);
+ }
+
+
+
+}
diff --git a/tests/PayPal/Test/Api/TaxTest.php b/tests/PayPal/Test/Api/TaxTest.php
new file mode 100644
index 0000000..48d62ed
--- /dev/null
+++ b/tests/PayPal/Test/Api/TaxTest.php
@@ -0,0 +1,84 @@
+assertNotNull($obj);
+ $this->assertNotNull($obj->getId());
+ $this->assertNotNull($obj->getName());
+ $this->assertNotNull($obj->getPercent());
+ $this->assertNotNull($obj->getAmount());
+ $this->assertEquals(self::getJson(), $obj->toJson());
+ return $obj;
+ }
+
+ /**
+ * @depends testSerializationDeserialization
+ * @param Tax $obj
+ */
+ public function testGetters($obj)
+ {
+ $this->assertEquals($obj->getId(), "TestSample");
+ $this->assertEquals($obj->getName(), "TestSample");
+ $this->assertEquals($obj->getPercent(), "12.34");
+ $this->assertEquals($obj->getAmount(), CurrencyTest::getObject());
+ }
+
+ /**
+ * @depends testSerializationDeserialization
+ * @param Tax $obj
+ */
+ public function testDeprecatedGetters($obj)
+ {
+ }
+
+ /**
+ * @depends testSerializationDeserialization
+ * @param Tax $obj
+ */
+ public function testDeprecatedSetterNormalGetter($obj)
+ {
+
+ //Test All Deprecated Getters and Normal Getters
+ $this->testDeprecatedGetters($obj);
+ $this->testGetters($obj);
+ }
+
+
+
+}
diff --git a/tests/PayPal/Test/Functional/Api/InvoiceFunctionalTest.php b/tests/PayPal/Test/Functional/Api/InvoiceFunctionalTest.php
new file mode 100644
index 0000000..27df9d5
--- /dev/null
+++ b/tests/PayPal/Test/Functional/Api/InvoiceFunctionalTest.php
@@ -0,0 +1,252 @@
+getClassName();
+ $testName = $this->getName();
+ $this->setupTest($className, $testName);
+ }
+
+ public function setupTest($className, $testName)
+ {
+ $operationString = file_get_contents(__DIR__ . "/../resources/$className/$testName.json");
+ $this->operation = json_decode($operationString, true);
+ $this->response = true;
+ if (array_key_exists('body', $this->operation['response'])) {
+ $this->response = json_encode($this->operation['response']['body']);
+ }
+
+ $this->mode = getenv('REST_MODE') ? getenv('REST_MODE') : 'mock';
+ if ($this->mode != 'sandbox') {
+
+ // Mock PPRest Caller if mode set to mock
+ $this->mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $this->mockPPRestCall->expects($this->any())
+ ->method('execute')
+ ->will($this->returnValue(
+ $this->response
+ ));
+ }
+ }
+
+
+ /**
+ * Returns just the classname of the test you are executing. It removes the namespaces.
+ * @return string
+ */
+ public function getClassName()
+ {
+ return join('', array_slice(explode('\\', get_class($this)), -1));
+ }
+
+ public function testCreate()
+ {
+ $request = $this->operation['request']['body'];
+ $obj = new Invoice($request);
+ $result = $obj->create(null, $this->mockPPRestCall);
+ $this->assertNotNull($result);
+ self::$obj = $result;
+ return $result;
+ }
+
+ /**
+ * @depends testCreate
+ * @param $invoice Invoice
+ * @return Invoice
+ */
+ public function testGet($invoice)
+ {
+ $result = Invoice::get($invoice->getId(), null, $this->mockPPRestCall);
+ $this->assertNotNull($result);
+ $this->assertEquals($invoice->getId(), $result->getId());
+ return $result;
+ }
+
+ /**
+ * @depends testCreate
+ * @param $invoice Invoice
+ * @return Invoice
+ */
+ public function testSend($invoice)
+ {
+ $result = $invoice->send(null, $this->mockPPRestCall);
+ $this->assertNotNull($result);
+ return $invoice;
+ }
+
+ /**
+ * @depends testSend
+ * @param $invoice Invoice
+ * @return Invoice
+ */
+ public function testUpdate($invoice)
+ {
+ $this->markTestSkipped('Skipped as the fix is on the way. #PPTIPS-1932');
+ $result = $invoice->update(null, $this->mockPPRestCall);
+ $this->assertNotNull($result);
+ $this->assertEquals($invoice->getId(), $result->getId());
+ }
+
+ /**
+ * @depends testSend
+ * @param $invoice Invoice
+ * @return Invoice
+ */
+ public function testGetAll($invoice)
+ {
+ $result = Invoice::getAll(array('page_size' => '20', 'total_count_required' => 'true'), null, $this->mockPPRestCall);
+ $this->assertNotNull($result);
+ $this->assertNotNull($result->getTotalCount());
+ $totalPages = ceil($result->getTotalCount()/20);
+ $found = false;
+ $foundObject = null;
+ do {
+ foreach ($result->getInvoices() as $obj) {
+ if ($obj->getId() == $invoice->getId()) {
+ $found = true;
+ $foundObject = $obj;
+ break;
+ }
+ }
+ if (!$found) {
+ $result = Invoice::getAll(array('page' => --$totalPages, 'page_size' => '20', 'total_required' => 'yes'), null, $this->mockPPRestCall);
+
+ }
+ } while ($totalPages > 0 && $found == false);
+ $this->assertTrue($found, "The Created Invoice was not found in the get list");
+ $this->assertEquals($invoice->getId(), $foundObject->getId());
+ }
+
+ /**
+ * @depends testSend
+ * @param $invoice Invoice
+ * @return Invoice
+ */
+ public function testSearch($invoice)
+ {
+ $request = $this->operation['request']['body'];
+ $search = new Search($request);
+ $result = Invoice::search($search, null, $this->mockPPRestCall);
+ $this->assertNotNull($result);
+ $this->assertNotNull($result->getTotalCount());
+ }
+
+ /**
+ * @depends testSend
+ * @param $invoice Invoice
+ * @return Invoice
+ */
+ public function testRemind($invoice)
+ {
+ $request = $this->operation['request']['body'];
+ $notification = new Notification($request);
+ $result = $invoice->remind($notification, null, $this->mockPPRestCall);
+ $this->assertNotNull($result);
+ }
+
+ /**
+ * @depends testSend
+ * @param $invoice Invoice
+ * @return Invoice
+ */
+ public function testCancel($invoice)
+ {
+ $request = $this->operation['request']['body'];
+ $notification = new CancelNotification($request);
+ $result = $invoice->cancel($notification, null, $this->mockPPRestCall);
+ $this->assertNotNull($result);
+ }
+
+ /**
+ * @depends testSend
+ * @param $invoice Invoice
+ * @return Invoice
+ */
+ public function testQRCode($invoice)
+ {
+ $result = Invoice::qrCode($invoice->getId(), array(), null, $this->mockPPRestCall);
+ $this->assertNotNull($result);
+ $this->assertNotNull($result->getImage());
+ }
+
+ /**
+ * @depends testSend
+ * @param $invoice Invoice
+ * @return Invoice
+ */
+ public function testRecordPayment($invoice)
+ {
+ $this->setupTest($this->getClassName(), 'testCreate');
+ $invoice = $this->testCreate($invoice);
+ $this->setupTest($this->getClassName(), 'testSend');
+ $invoice = $this->testSend($invoice);
+ $this->setupTest($this->getClassName(), 'testRecordPayment');
+ $request = $this->operation['request']['body'];
+ $paymentDetail = new PaymentDetail($request);
+ $result = $invoice->recordPayment($paymentDetail, null, $this->mockPPRestCall);
+ $this->assertNotNull($result);
+ return $invoice;
+ }
+
+
+ /**
+ * @depends testRecordPayment
+ * @param $invoice Invoice
+ * @return Invoice
+ */
+ public function testRecordRefund($invoice)
+ {
+ $request = $this->operation['request']['body'];
+ $refundDetail = new RefundDetail($request);
+ $result = $invoice->recordRefund($refundDetail, null, $this->mockPPRestCall);
+ $this->assertNotNull($result);
+ $this->setupTest($this->getClassName(), 'testDelete');
+ $invoice = $this->testDelete($invoice);
+ return $invoice;
+ }
+
+ /**
+ * @depends testGet
+ * @param $invoice Invoice
+ * @return Invoice
+ */
+ public function testDelete($invoice)
+ {
+ $this->setupTest($this->getClassName(), 'testCreate');
+ $invoice = $this->testCreate($invoice);
+ $this->setupTest($this->getClassName(), 'testDelete');
+ $result = $invoice->delete(null, $this->mockPPRestCall);
+ $this->assertNotNull($result);
+ }
+
+
+}
diff --git a/tests/PayPal/Test/Functional/resources/InvoiceFunctionalTest/testCancel.json b/tests/PayPal/Test/Functional/resources/InvoiceFunctionalTest/testCancel.json
new file mode 100644
index 0000000..36c641c
--- /dev/null
+++ b/tests/PayPal/Test/Functional/resources/InvoiceFunctionalTest/testCancel.json
@@ -0,0 +1,35 @@
+{
+ "operationId": "invoice.cancel",
+ "title": "Cancel an invoice",
+ "description": "Cancel an invoice",
+ "runnable": true,
+ "user": {
+ "scopes": []
+ },
+ "credentials": {
+ "oauth": {
+ "clientId": "",
+ "clientSecret": "",
+ "path": ""
+ },
+ "login": {},
+ "openIdConnect": {}
+ },
+ "request": {
+ "path": "v1/invoicing/invoices/INV2-WW57-VFCD-X5H4-XTUP/cancel",
+ "method": "POST",
+ "headers": {
+ "X-PAYPAL-SECURITY-CONTEXT": "{\"actor\":{\"auth_claims\":[\"CLIENT_ID_SECRET\"],\"auth_state\":\"LOGGEDIN\",\"account_number\":\"1942617323817135416\",\"encrypted_account_number\":\"6QNCBKP95EWWN\",\"party_id\":\"1942617323817135416\"},\"auth_token\":\"A015vRRfXmgj2UscSiBbwz1Elw8RW.ypMlPJsMH77snr6fc\",\"auth_token_type\":\"ACCESS_TOKEN\",\"last_validated\":1405632568,\"scopes\":[\"openid\",\"https://uri.paypal.com/services/invoicing\",\"https://uri.paypal.com/services/subscriptions\",\"https://api.paypal.com/v1/payments/.*\",\"https://api.paypal.com/v1/vault/credit-card/.*\",\"https://api.paypal.com/v1/vault/credit-card\"],\"client_id\":\"AewC1RCK3i4Z7WTbE0cz5buvd_NW17sYbYI4kc29c5qGxeh-0P7sMuXh2chc\",\"claims\":{\"actor_payer_id\":\"6QNCBKP95EWWN\"},\"subjects\":[]}"
+ },
+ "body": {
+ "subject": "Past due",
+ "note": "Canceling invoice",
+ "send_to_merchant": true,
+ "send_to_payer": true
+ }
+ },
+ "response": {
+ "headers": {},
+ "status": ""
+ }
+}
\ No newline at end of file
diff --git a/tests/PayPal/Test/Functional/resources/InvoiceFunctionalTest/testCreate.json b/tests/PayPal/Test/Functional/resources/InvoiceFunctionalTest/testCreate.json
new file mode 100644
index 0000000..4d19ff6
--- /dev/null
+++ b/tests/PayPal/Test/Functional/resources/InvoiceFunctionalTest/testCreate.json
@@ -0,0 +1,150 @@
+{
+ "operationId": "invoice.create",
+ "title": "Create an invoice",
+ "description": "Create an invoice",
+ "runnable": true,
+ "user": {
+ "scopes": [
+ "https://uri.paypal.com/services/invoicing"
+ ]
+ },
+ "credentials": {
+ "oauth": {
+ "clientId": "stage2managed",
+ "clientSecret": "secret",
+ "path": "/v1/oauth2/token"
+ },
+ "login": {},
+ "openIdConnect": {}
+ },
+ "request": {
+ "path": "v1/invoicing/invoices/",
+ "method": "POST",
+ "headers": {
+ "X-PAYPAL-SECURITY-CONTEXT": "{\"actor\":{\"auth_claims\":[\"CLIENT_ID_SECRET\"],\"auth_state\":\"LOGGEDIN\",\"account_number\":\"1942617323817135416\",\"encrypted_account_number\":\"6QNCBKP95EWWN\",\"party_id\":\"1942617323817135416\"},\"auth_token\":\"A015vRRfXmgj2UscSiBbwz1Elw8RW.ypMlPJsMH77snr6fc\",\"auth_token_type\":\"ACCESS_TOKEN\",\"last_validated\":1405632568,\"scopes\":[\"openid\",\"https://uri.paypal.com/services/invoicing\",\"https://uri.paypal.com/services/subscriptions\",\"https://api.paypal.com/v1/payments/.*\",\"https://api.paypal.com/v1/vault/credit-card/.*\",\"https://api.paypal.com/v1/vault/credit-card\"],\"client_id\":\"AewC1RCK3i4Z7WTbE0cz5buvd_NW17sYbYI4kc29c5qGxeh-0P7sMuXh2chc\",\"claims\":{\"actor_payer_id\":\"6QNCBKP95EWWN\"},\"subjects\":[]}"
+ },
+ "body": {"merchant_info": {
+ "email": "jaypatel512-facilitator@hotmail.com",
+ "first_name": "Dennis",
+ "last_name": "Doctor",
+ "business_name": "Medical Professionals, LLC",
+ "phone": {
+ "country_code": "001",
+ "national_number": "5032141716"
+ },
+ "address": {
+ "line1": "1234 Main St.",
+ "city": "Portland",
+ "state": "OR",
+ "postal_code": "97217",
+ "country_code": "US"
+ }
+ },
+ "billing_info": [
+ {
+ "email": "example@example.com"
+ }
+ ],
+ "items": [
+ {
+ "name": "Sutures",
+ "quantity": 100,
+ "unit_price": {
+ "currency": "USD",
+ "value": "5.00"
+ }
+ }
+ ],
+ "note": "Medical Invoice 16 Jul, 2013 PST",
+ "payment_term": {
+ "term_type": "NET_45"
+ },
+ "shipping_info": {
+ "first_name": "Sally",
+ "last_name": "Patient",
+ "business_name": "Not applicable",
+ "phone": {
+ "country_code": "001",
+ "national_number": "5039871234"
+ },
+ "address": {
+ "line1": "1234 Main St.",
+ "city": "Portland",
+ "state": "OR",
+ "postal_code": "97217",
+ "country_code": "US"
+ }
+ }
+ }
+ },
+ "response": {
+ "status": "201 Created",
+ "headers": {},
+ "body": {
+ "id": "INV2-RF6D-L66T-D7H2-CRU7",
+ "number": "ABCD4971",
+ "status": "DRAFT",
+ "merchant_info": {
+ "email": "ppaas_default@paypal.com",
+ "first_name": "Dennis",
+ "last_name": "Doctor",
+ "business_name": "Medical Professionals, LLC",
+ "phone": {
+ "country_code": "1",
+ "national_number": "5032141234"
+ },
+ "address": {
+ "line1": "1234 Main St.",
+ "city": "Portland",
+ "state": "OR",
+ "postal_code": "97217",
+ "country_code": "US"
+ }
+ },
+ "billing_info": [
+ {
+ "email": "email@example.com"
+ }
+ ],
+ "shipping_info": {
+ "first_name": "Sally",
+ "last_name": "Patient",
+ "business_name": "Not applicable",
+ "phone": {
+ "country_code": "1",
+ "national_number": "5039871234"
+ },
+ "address": {
+ "line1": "1234 Broad St.",
+ "city": "Portland",
+ "state": "OR",
+ "postal_code": "97216",
+ "country_code": "US"
+ }
+ },
+ "items": [
+ {
+ "name": "Sutures",
+ "quantity": 100,
+ "unit_price": {
+ "currency": "USD",
+ "value": "5.00"
+ }
+ }
+ ],
+ "invoice_date": "2014-02-27 PST",
+ "payment_term": {
+ "term_type": "NET_45",
+ "due_date": "2015-04-13 PDT"
+ },
+ "tax_calculated_after_discount": false,
+ "tax_inclusive": false,
+ "note": "Medical Invoice 16 Jul, 2013 PST",
+ "total_amount": {
+ "currency": "USD",
+ "value": "500.00"
+ }
+
+ }
+ }
+}
diff --git a/tests/PayPal/Test/Functional/resources/InvoiceFunctionalTest/testDelete.json b/tests/PayPal/Test/Functional/resources/InvoiceFunctionalTest/testDelete.json
new file mode 100644
index 0000000..a487397
--- /dev/null
+++ b/tests/PayPal/Test/Functional/resources/InvoiceFunctionalTest/testDelete.json
@@ -0,0 +1,31 @@
+{
+ "description": "Delete an invoice",
+ "title": "Delete an invoice",
+ "runnable": true,
+ "operationId": "invoice.delete",
+ "user": {
+ "scopes": []
+ },
+ "credentials": {
+ "oauth": {
+ "clientId": "",
+ "clientSecret": "",
+ "path": ""
+ },
+ "login": {},
+ "openIdConnect": {}
+ },
+ "request": {
+ "path": "v1/invoicing/invoices/INV2-92MG-CNXV-ND7G-P3D2",
+ "method": "DELETE",
+ "headers": {
+ "X-PAYPAL-SECURITY-CONTEXT": "{\"actor\":{\"auth_claims\":[\"CLIENT_ID_SECRET\"],\"auth_state\":\"LOGGEDIN\",\"account_number\":\"1942617323817135416\",\"encrypted_account_number\":\"6QNCBKP95EWWN\",\"party_id\":\"1942617323817135416\"},\"auth_token\":\"A015vRRfXmgj2UscSiBbwz1Elw8RW.ypMlPJsMH77snr6fc\",\"auth_token_type\":\"ACCESS_TOKEN\",\"last_validated\":1405632568,\"scopes\":[\"openid\",\"https://uri.paypal.com/services/invoicing\",\"https://uri.paypal.com/services/subscriptions\",\"https://api.paypal.com/v1/payments/.*\",\"https://api.paypal.com/v1/vault/credit-card/.*\",\"https://api.paypal.com/v1/vault/credit-card\"],\"client_id\":\"AewC1RCK3i4Z7WTbE0cz5buvd_NW17sYbYI4kc29c5qGxeh-0P7sMuXh2chc\",\"claims\":{\"actor_payer_id\":\"6QNCBKP95EWWN\"},\"subjects\":[]}"
+ },
+ "body": {}
+ },
+ "response": {
+ "status": "",
+ "headers": {},
+ "body": {}
+ }
+}
\ No newline at end of file
diff --git a/tests/PayPal/Test/Functional/resources/InvoiceFunctionalTest/testGet.json b/tests/PayPal/Test/Functional/resources/InvoiceFunctionalTest/testGet.json
new file mode 100644
index 0000000..65d607d
--- /dev/null
+++ b/tests/PayPal/Test/Functional/resources/InvoiceFunctionalTest/testGet.json
@@ -0,0 +1,98 @@
+{
+ "description": "Get the invoice resource for the given identifier.",
+ "title": "Get invoice details",
+ "runnable": true,
+ "operationId": "invoice.get",
+ "user": {
+ "scopes": []
+ },
+ "credentials": {
+ "oauth": {
+ "clientId": "",
+ "clientSecret": "",
+ "path": ""
+ },
+ "login": {},
+ "openIdConnect": {}
+ },
+ "request": {
+ "path": "v1/invoicing/invoices/INV2-RF6D-L66T-D7H2-CRU7",
+ "method": "GET",
+ "headers": {
+ "X-PAYPAL-SECURITY-CONTEXT": "{\"actor\":{\"auth_claims\":[\"CLIENT_ID_SECRET\"],\"auth_state\":\"LOGGEDIN\",\"account_number\":\"1942617323817135416\",\"encrypted_account_number\":\"6QNCBKP95EWWN\",\"party_id\":\"1942617323817135416\"},\"auth_token\":\"A015vRRfXmgj2UscSiBbwz1Elw8RW.ypMlPJsMH77snr6fc\",\"auth_token_type\":\"ACCESS_TOKEN\",\"last_validated\":1405632568,\"scopes\":[\"openid\",\"https://uri.paypal.com/services/invoicing\",\"https://uri.paypal.com/services/subscriptions\",\"https://api.paypal.com/v1/payments/.*\",\"https://api.paypal.com/v1/vault/credit-card/.*\",\"https://api.paypal.com/v1/vault/credit-card\"],\"client_id\":\"AewC1RCK3i4Z7WTbE0cz5buvd_NW17sYbYI4kc29c5qGxeh-0P7sMuXh2chc\",\"claims\":{\"actor_payer_id\":\"6QNCBKP95EWWN\"},\"subjects\":[]}"
+ },
+ "body": {}
+ },
+ "response": {
+ "status": "",
+ "headers": {},
+ "body": {
+ "id": "INV2-RF6D-L66T-D7H2-CRU7",
+ "number": "0002",
+ "status": "DRAFT",
+ "merchant_info": {
+ "email": "ppaas_default@paypal.com",
+ "first_name": "Dennis",
+ "last_name": "Doctor",
+ "business_name": "Medical Professionals, LLC",
+ "phone": {
+ "country_code": "1",
+ "national_number": "5032141716"
+ },
+ "address": {
+ "line1": "1234 Main St.",
+ "city": "Portland",
+ "state": "OR",
+ "postal_code": "97217",
+ "country_code": "US"
+ }
+ },
+ "billing_info": [
+ {
+ "email": "example@example.com"
+ }
+ ],
+ "shipping_info": {
+ "first_name": "Sally",
+ "last_name": "Patient",
+ "business_name": "Not applicable",
+ "phone": {
+ "country_code": "1",
+ "national_number": "5039871234"
+ },
+ "address": {
+ "line1": "1234 Broad St.",
+ "city": "Portland",
+ "state": "OR",
+ "postal_code": "97216",
+ "country_code": "US"
+ }
+ },
+ "items": [
+ {
+ "name": "Sutures",
+ "quantity": 100,
+ "unit_price": {
+ "currency": "USD",
+ "value": "5.00"
+ }
+ }
+ ],
+ "invoice_date": "2014-03-24 PDT",
+ "payment_term": {
+ "term_type": "NET_45",
+ "due_date": "2014-05-08 PDT"
+ },
+ "tax_calculated_after_discount": false,
+ "tax_inclusive": false,
+ "note": "Medical Invoice 16 Jul, 2013 PST",
+ "total_amount": {
+ "currency": "USD",
+ "value": "500.00"
+ },
+ "metadata": {
+ "created_date": "2014-03-24 12:11:52 PDT"
+ }
+ }
+ }
+}
diff --git a/tests/PayPal/Test/Functional/resources/InvoiceFunctionalTest/testGetAll.json b/tests/PayPal/Test/Functional/resources/InvoiceFunctionalTest/testGetAll.json
new file mode 100644
index 0000000..a5f3c4d
--- /dev/null
+++ b/tests/PayPal/Test/Functional/resources/InvoiceFunctionalTest/testGetAll.json
@@ -0,0 +1,148 @@
+{
+ "description": "get all invoices",
+ "title": "get all invoices",
+ "runnable": true,
+ "operationId": "invoice.get_all",
+ "user": {
+ "scopes": []
+ },
+ "credentials": {
+ "oauth": {
+ "clientId": "",
+ "clientSecret": "",
+ "path": ""
+ },
+ "login": {},
+ "openIdConnect": {}
+ },
+ "request": {
+ "path": "v1/invoicing/invoices?page=0&page_size=10&total_count_required=true",
+ "method": "GET",
+ "headers": {
+ "X-PAYPAL-SECURITY-CONTEXT": "{\"actor\":{\"auth_claims\":[\"CLIENT_ID_SECRET\"],\"auth_state\":\"LOGGEDIN\",\"account_number\":\"1942617323817135416\",\"encrypted_account_number\":\"6QNCBKP95EWWN\",\"party_id\":\"1942617323817135416\"},\"auth_token\":\"A015vRRfXmgj2UscSiBbwz1Elw8RW.ypMlPJsMH77snr6fc\",\"auth_token_type\":\"ACCESS_TOKEN\",\"last_validated\":1405632568,\"scopes\":[\"openid\",\"https://uri.paypal.com/services/invoicing\",\"https://uri.paypal.com/services/subscriptions\",\"https://api.paypal.com/v1/payments/.*\",\"https://api.paypal.com/v1/vault/credit-card/.*\",\"https://api.paypal.com/v1/vault/credit-card\"],\"client_id\":\"AewC1RCK3i4Z7WTbE0cz5buvd_NW17sYbYI4kc29c5qGxeh-0P7sMuXh2chc\",\"claims\":{\"actor_payer_id\":\"6QNCBKP95EWWN\"},\"subjects\":[]}"
+ },
+ "body": {}
+ },
+ "response": {
+ "status": "",
+ "headers": {},
+ "body": {
+ "total_count": 5,
+ "invoices": [
+ {
+ "id": "INV2-2NB5-UJ7A-YSUJ-ABCD",
+ "number": "9879878979003791",
+ "status": "DRAFT",
+ "merchant_info": {
+ "email": "sample@sample.com"
+ },
+ "billing_info": [
+ {
+ "email": "example@example.com"
+ }
+ ],
+ "shipping_info": {
+ "email": "example@example.com",
+ "first_name": "Sally",
+ "last_name": "Patient",
+ "business_name": "Not applicable"
+ },
+ "invoice_date": "2014-02-27 PST",
+ "note": "Medical Invoice 16 Jul, 2013 PST",
+ "total_amount": {
+ "currency": "USD",
+ "value": "0.00"
+ },
+ "metadata": {
+ "created_date": "2014-02-27 23:55:58 PST"
+ }
+ },
+ {
+ "id": "INV2-5AYC-UE5K-XXEG-ABCD",
+ "number": "9879878979003790",
+ "status": "DRAFT",
+ "merchant_info": {
+ "email": "sample@sample.com"
+ },
+ "billing_info": [
+ {
+ "email": "example@example.com"
+ }
+ ],
+ "shipping_info": {
+ "email": "example@example.com",
+ "first_name": "Sally",
+ "last_name": "Patient",
+ "business_name": "Not applicable"
+ },
+ "invoice_date": "2014-02-27 PST",
+ "note": "Medical Invoice 16 Jul, 2013 PST",
+ "total_amount": {
+ "currency": "USD",
+ "value": "0.00"
+ },
+ "metadata": {
+ "created_date": "2014-02-27 19:41:56 PST"
+ }
+ },
+ {
+ "id": "INV2-C4QH-KEKM-C5QE-ABCD",
+ "number": "9879878979003789",
+ "status": "DRAFT",
+ "merchant_info": {
+ "email": "sample@sample.com"
+ },
+ "billing_info": [
+ {
+ "email": "example@example.com"
+ }
+ ],
+ "shipping_info": {
+ "email": "example@example.com",
+ "first_name": "Sally",
+ "last_name": "Patient",
+ "business_name": "Not applicable"
+ },
+ "invoice_date": "2014-02-27 PST",
+ "note": "Medical Invoice 16 Jul, 2013 PST",
+ "total_amount": {
+ "currency": "USD",
+ "value": "0.00"
+ },
+ "metadata": {
+ "created_date": "2014-02-27 15:34:11 PST"
+ }
+ },
+ {
+ "id": "INV2-RF6D-L66T-D7H2-CRU7",
+ "number": "9879878979003788",
+ "status": "DRAFT",
+ "merchant_info": {
+ "email": "sample@sample.com"
+ },
+ "billing_info": [
+ {
+ "email": "example@example.com"
+ }
+ ],
+ "shipping_info": {
+ "email": "example@example.com",
+ "first_name": "Sally",
+ "last_name": "Patient",
+ "business_name": "Not applicable"
+ },
+ "invoice_date": "2014-02-27 PST",
+ "note": "Medical Invoice 16 Jul, 2013 PST",
+ "total_amount": {
+ "currency": "USD",
+ "value": "12.00"
+ },
+ "metadata": {
+ "created_date": "2014-02-27 15:34:01 PST"
+ }
+ }
+ ]
+ }
+
+ }
+}
diff --git a/tests/PayPal/Test/Functional/resources/InvoiceFunctionalTest/testQRCode.json b/tests/PayPal/Test/Functional/resources/InvoiceFunctionalTest/testQRCode.json
new file mode 100644
index 0000000..01e3188
--- /dev/null
+++ b/tests/PayPal/Test/Functional/resources/InvoiceFunctionalTest/testQRCode.json
@@ -0,0 +1,33 @@
+{
+ "description": "Generates QR code for the Invoice URL identified by invoice_id.",
+ "title": "Get QR code",
+ "runnable": true,
+ "operationId": "invoice.qr_code",
+ "user": {
+ "scopes": []
+ },
+ "credentials": {
+ "oauth": {
+ "clientId": "",
+ "clientSecret": "",
+ "path": ""
+ },
+ "login": {},
+ "openIdConnect": {}
+ },
+ "request": {
+ "path": "v1/invoicing/invoices/INV2-S6FG-ZZCK-VXMM-8KKP/qr-code",
+ "method": "GET",
+ "headers": {
+ "X-PAYPAL-SECURITY-CONTEXT": "{\"actor\":{\"auth_claims\":[\"CLIENT_ID_SECRET\"],\"auth_state\":\"LOGGEDIN\",\"account_number\":\"1942617323817135416\",\"encrypted_account_number\":\"6QNCBKP95EWWN\",\"party_id\":\"1942617323817135416\"},\"auth_token\":\"A015vRRfXmgj2UscSiBbwz1Elw8RW.ypMlPJsMH77snr6fc\",\"auth_token_type\":\"ACCESS_TOKEN\",\"last_validated\":1405632568,\"scopes\":[\"openid\",\"https://uri.paypal.com/services/invoicing\",\"https://uri.paypal.com/services/subscriptions\",\"https://api.paypal.com/v1/payments/.*\",\"https://api.paypal.com/v1/vault/credit-card/.*\",\"https://api.paypal.com/v1/vault/credit-card\"],\"client_id\":\"AewC1RCK3i4Z7WTbE0cz5buvd_NW17sYbYI4kc29c5qGxeh-0P7sMuXh2chc\",\"claims\":{\"actor_payer_id\":\"6QNCBKP95EWWN\"},\"subjects\":[]}"
+ },
+ "body": {}
+ },
+ "response": {
+ "status": "",
+ "headers": {},
+ "body": {
+ "image": "iVBORw0KGgoAA......XUDM"
+ }
+ }
+}
\ No newline at end of file
diff --git a/tests/PayPal/Test/Functional/resources/InvoiceFunctionalTest/testRecordPayment.json b/tests/PayPal/Test/Functional/resources/InvoiceFunctionalTest/testRecordPayment.json
new file mode 100644
index 0000000..ec67a02
--- /dev/null
+++ b/tests/PayPal/Test/Functional/resources/InvoiceFunctionalTest/testRecordPayment.json
@@ -0,0 +1,21 @@
+{
+ "description": "Record a payment for an invoice.",
+ "title": "Record a payment for an invoice.",
+ "runnable": true,
+ "operationId": "invoice.record-payment",
+ "request": {
+ "path": "v1/invoicing/invoices/INV2-T4UQ-VW4W-K7N7-XM2R/record-payment",
+ "method": "POST",
+ "headers": {},
+ "body": {
+ "method": "CASH",
+ "date": "2014-07-06 03:30:00 PST",
+ "note": "Cash received."
+ }
+ },
+ "response": {
+ "status": "",
+ "headers": {},
+ "body": {}
+ }
+}
diff --git a/tests/PayPal/Test/Functional/resources/InvoiceFunctionalTest/testRecordRefund.json b/tests/PayPal/Test/Functional/resources/InvoiceFunctionalTest/testRecordRefund.json
new file mode 100644
index 0000000..90c630d
--- /dev/null
+++ b/tests/PayPal/Test/Functional/resources/InvoiceFunctionalTest/testRecordRefund.json
@@ -0,0 +1,20 @@
+{
+ "description": "Record a refund for an invoice.",
+ "title": "Record a refund for an invoice.",
+ "runnable": true,
+ "operationId": "invoice.record-refund",
+ "request": {
+ "path": "v1/invoicing/invoices/INV2-T4UQ-VW4W-K7N7-XM2R/record-refund",
+ "method": "POST",
+ "headers": {},
+ "body": {
+ "date" : "2013-11-10 14:00:00 PST",
+ "note" : "Refunded by cash!"
+ }
+ },
+ "response": {
+ "status": "",
+ "headers": {},
+ "body": {}
+ }
+}
diff --git a/tests/PayPal/Test/Functional/resources/InvoiceFunctionalTest/testRemind.json b/tests/PayPal/Test/Functional/resources/InvoiceFunctionalTest/testRemind.json
new file mode 100644
index 0000000..6379558
--- /dev/null
+++ b/tests/PayPal/Test/Functional/resources/InvoiceFunctionalTest/testRemind.json
@@ -0,0 +1,35 @@
+{
+ "description": "Reminds the payer to pay the invoice.",
+ "title": "Reminds the payer to pay the invoice.",
+ "runnable": true,
+ "operationId": "invoice.remind",
+ "user": {
+ "scopes": []
+ },
+ "credentials": {
+ "oauth": {
+ "clientId": "",
+ "clientSecret": "",
+ "path": ""
+ },
+ "login": {},
+ "openIdConnect": {}
+ },
+ "request": {
+ "path": "v1/invoicing/invoices/INV2-T4UQ-VW4W-K7N7-XM2R/remind",
+ "method": "POST",
+ "headers": {
+ "X-PAYPAL-SECURITY-CONTEXT": "{\"actor\":{\"auth_claims\":[\"CLIENT_ID_SECRET\"],\"auth_state\":\"LOGGEDIN\",\"account_number\":\"1942617323817135416\",\"encrypted_account_number\":\"6QNCBKP95EWWN\",\"party_id\":\"1942617323817135416\"},\"auth_token\":\"A015vRRfXmgj2UscSiBbwz1Elw8RW.ypMlPJsMH77snr6fc\",\"auth_token_type\":\"ACCESS_TOKEN\",\"last_validated\":1405632568,\"scopes\":[\"openid\",\"https://uri.paypal.com/services/invoicing\",\"https://uri.paypal.com/services/subscriptions\",\"https://api.paypal.com/v1/payments/.*\",\"https://api.paypal.com/v1/vault/credit-card/.*\",\"https://api.paypal.com/v1/vault/credit-card\"],\"client_id\":\"AewC1RCK3i4Z7WTbE0cz5buvd_NW17sYbYI4kc29c5qGxeh-0P7sMuXh2chc\",\"claims\":{\"actor_payer_id\":\"6QNCBKP95EWWN\"},\"subjects\":[]}"
+ },
+ "body": {
+ "subject": "Past due",
+ "note": "Please pay soon",
+ "send_to_merchant": true
+ }
+ },
+ "response": {
+ "status": "",
+ "headers": {},
+ "body": {}
+ }
+}
\ No newline at end of file
diff --git a/tests/PayPal/Test/Functional/resources/InvoiceFunctionalTest/testSearch.json b/tests/PayPal/Test/Functional/resources/InvoiceFunctionalTest/testSearch.json
new file mode 100644
index 0000000..a136578
--- /dev/null
+++ b/tests/PayPal/Test/Functional/resources/InvoiceFunctionalTest/testSearch.json
@@ -0,0 +1,67 @@
+{
+ "description": "Search for invoice resources.",
+ "title": "Search for invoice resources.",
+ "runnable": true,
+ "operationId": "invoice.search",
+ "user": {
+ "scopes": []
+ },
+ "credentials": {
+ "oauth": {
+ "clientId": "",
+ "clientSecret": "",
+ "path": ""
+ },
+ "login": {},
+ "openIdConnect": {}
+ },
+ "request": {
+ "path": "v1/invoicing/search/",
+ "method": "POST",
+ "headers": {
+ "X-PAYPAL-SECURITY-CONTEXT": "{\"actor\":{\"auth_claims\":[\"CLIENT_ID_SECRET\"],\"auth_state\":\"LOGGEDIN\",\"account_number\":\"1942617323817135416\",\"encrypted_account_number\":\"6QNCBKP95EWWN\",\"party_id\":\"1942617323817135416\"},\"auth_token\":\"A015vRRfXmgj2UscSiBbwz1Elw8RW.ypMlPJsMH77snr6fc\",\"auth_token_type\":\"ACCESS_TOKEN\",\"last_validated\":1405632568,\"scopes\":[\"openid\",\"https://uri.paypal.com/services/invoicing\",\"https://uri.paypal.com/services/subscriptions\",\"https://api.paypal.com/v1/payments/.*\",\"https://api.paypal.com/v1/vault/credit-card/.*\",\"https://api.paypal.com/v1/vault/credit-card\"],\"client_id\":\"AewC1RCK3i4Z7WTbE0cz5buvd_NW17sYbYI4kc29c5qGxeh-0P7sMuXh2chc\",\"claims\":{\"actor_payer_id\":\"6QNCBKP95EWWN\"},\"subjects\":[]}"
+ },
+ "body": {
+ "page": 0,
+ "page_size": 3,
+ "total_count_required": true
+ }
+ },
+ "response": {
+ "status": "",
+ "headers": {},
+ "body": {
+ "total_count": 1,
+ "invoices": [
+ {
+ "id": "INV2-RF6D-L66T-D7H2-CRU7",
+ "number": "0001",
+ "status": "SENT",
+ "merchant_info": {
+ "email": "dennis@sample.com"
+ },
+ "billing_info": [
+ {
+ "email": "sally-patient@example.com"
+ }
+ ],
+ "shipping_info": {
+ "email": "sally-patient@example.com"
+ },
+ "invoice_date": "2012-05-09 PST",
+ "payment_term": {
+ "due_date": "2012-05-24 PST"
+ },
+ "total_amount": {
+ "currency": "USD",
+ "value": "250"
+ },
+ "metadata": {
+ "created_date": "2012-05-09 04:48:57 PST"
+ }
+ }
+ ]
+ }
+
+ }
+}
diff --git a/tests/PayPal/Test/Functional/resources/InvoiceFunctionalTest/testSend.json b/tests/PayPal/Test/Functional/resources/InvoiceFunctionalTest/testSend.json
new file mode 100644
index 0000000..41d37f3
--- /dev/null
+++ b/tests/PayPal/Test/Functional/resources/InvoiceFunctionalTest/testSend.json
@@ -0,0 +1,31 @@
+{
+ "description": "Sends a legitimate invoice to the payer.",
+ "title": "Sends a legitimate invoice to the payer.",
+ "runnable": true,
+ "operationId": "invoice.send",
+ "user": {
+ "scopes": []
+ },
+ "credentials": {
+ "oauth": {
+ "clientId": "",
+ "clientSecret": "",
+ "path": ""
+ },
+ "login": {},
+ "openIdConnect": {}
+ },
+ "request": {
+ "path": "v1/invoicing/invoices/INV2-EHNV-LJ5S-A7DZ-V6NJ/send",
+ "method": "POST",
+ "headers": {
+ "X-PAYPAL-SECURITY-CONTEXT": "{\"actor\":{\"auth_claims\":[\"CLIENT_ID_SECRET\"],\"auth_state\":\"LOGGEDIN\",\"account_number\":\"1942617323817135416\",\"encrypted_account_number\":\"6QNCBKP95EWWN\",\"party_id\":\"1942617323817135416\"},\"auth_token\":\"A015vRRfXmgj2UscSiBbwz1Elw8RW.ypMlPJsMH77snr6fc\",\"auth_token_type\":\"ACCESS_TOKEN\",\"last_validated\":1405632568,\"scopes\":[\"openid\",\"https://uri.paypal.com/services/invoicing\",\"https://uri.paypal.com/services/subscriptions\",\"https://api.paypal.com/v1/payments/.*\",\"https://api.paypal.com/v1/vault/credit-card/.*\",\"https://api.paypal.com/v1/vault/credit-card\"],\"client_id\":\"AewC1RCK3i4Z7WTbE0cz5buvd_NW17sYbYI4kc29c5qGxeh-0P7sMuXh2chc\",\"claims\":{\"actor_payer_id\":\"6QNCBKP95EWWN\"},\"subjects\":[]}"
+ },
+ "body": {}
+ },
+ "response": {
+ "status": "",
+ "headers": {},
+ "body": {}
+ }
+}
\ No newline at end of file
diff --git a/tests/PayPal/Test/Functional/resources/InvoiceFunctionalTest/testUpdate.json b/tests/PayPal/Test/Functional/resources/InvoiceFunctionalTest/testUpdate.json
new file mode 100644
index 0000000..1c45eb4
--- /dev/null
+++ b/tests/PayPal/Test/Functional/resources/InvoiceFunctionalTest/testUpdate.json
@@ -0,0 +1,148 @@
+{
+ "description": "Full update of the invoice resource for the given identifier.",
+ "title": "Full update of the invoice resource for the given identifier.",
+ "runnable": true,
+ "operationId": "invoice.update",
+ "user": {
+ "scopes": []
+ },
+ "credentials": {
+ "oauth": {
+ "clientId": "",
+ "clientSecret": "",
+ "path": ""
+ },
+ "login": {},
+ "openIdConnect": {}
+ },
+ "request": {
+ "path": "v1/invoicing/invoices/INV2-8UZ6-Q3DK-VZXV-SXQB",
+ "method": "PUT",
+ "headers": {
+ "X-PAYPAL-SECURITY-CONTEXT": "{\"actor\":{\"auth_claims\":[\"CLIENT_ID_SECRET\"],\"auth_state\":\"LOGGEDIN\",\"account_number\":\"1942617323817135416\",\"encrypted_account_number\":\"6QNCBKP95EWWN\",\"party_id\":\"1942617323817135416\"},\"auth_token\":\"A015vRRfXmgj2UscSiBbwz1Elw8RW.ypMlPJsMH77snr6fc\",\"auth_token_type\":\"ACCESS_TOKEN\",\"last_validated\":1405632568,\"scopes\":[\"openid\",\"https://uri.paypal.com/services/invoicing\",\"https://uri.paypal.com/services/subscriptions\",\"https://api.paypal.com/v1/payments/.*\",\"https://api.paypal.com/v1/vault/credit-card/.*\",\"https://api.paypal.com/v1/vault/credit-card\"],\"client_id\":\"AewC1RCK3i4Z7WTbE0cz5buvd_NW17sYbYI4kc29c5qGxeh-0P7sMuXh2chc\",\"claims\":{\"actor_payer_id\":\"6QNCBKP95EWWN\"},\"subjects\":[]}"
+ },
+ "body": {
+ "merchant_info": {
+ "email": "ppaas_default@paypal.com",
+ "first_name": "Dennis",
+ "last_name": "Doctor",
+ "business_name": "Medical Professionals, LLC",
+ "phone": {
+ "country_code": "001",
+ "national_number": "5032141716"
+ },
+ "address": {
+ "line1": "1234 Main St.",
+ "city": "Portland",
+ "state": "OR",
+ "postal_code": "97217",
+ "country_code": "US"
+ }
+ },
+ "billing_info": [
+ {
+ "email": "example@example.com"
+ }
+ ],
+ "items": [
+ {
+ "name": "Sutures",
+ "quantity": 100,
+ "unit_price": {
+ "currency": "USD",
+ "value": "5"
+ }
+ }
+ ],
+ "note": "Medical Invoice 16 Jul, 2013 PST",
+ "payment_term": {
+ "term_type": "NET_45"
+ },
+ "shipping_info": {
+ "first_name": "Sally",
+ "last_name": "Patient",
+ "business_name": "Not applicable",
+ "phone": {
+ "country_code": "001",
+ "national_number": "5039871234"
+ },
+ "address": {
+ "line1": "1234 Broad St.",
+ "city": "Portland",
+ "state": "OR",
+ "postal_code": "97216",
+ "country_code": "US"
+ }
+ }
+ }
+ },
+ "response": {
+ "status": "",
+ "headers": {},
+ "body": {
+ "id": "INV2-8UZ6-Q3DK-VZXV-SXQB",
+ "number": "0014",
+ "status": "DRAFT",
+ "merchant_info": {
+ "email": "ppaas_default@paypal.com",
+ "first_name": "Dennis",
+ "last_name": "Doctor",
+ "business_name": "Medical Professionals, LLC",
+ "phone": {
+ "country_code": "1",
+ "national_number": "5032141716"
+ },
+ "address": {
+ "line1": "1234 Main St.",
+ "city": "Portland",
+ "state": "OR",
+ "postal_code": "97217",
+ "country_code": "US"
+ }
+ },
+ "billing_info": [
+ {
+ "email": "example@example.com"
+ }
+ ],
+ "shipping_info": {
+ "first_name": "Sally",
+ "last_name": "Patient",
+ "business_name": "Not applicable",
+ "phone": {
+ "country_code": "1",
+ "national_number": "5039871234"
+ },
+ "address": {
+ "line1": "1234 Broad St.",
+ "city": "Portland",
+ "state": "OR",
+ "postal_code": "97216",
+ "country_code": "US"
+ }
+ },
+ "items": [
+ {
+ "name": "Sutures",
+ "quantity": 100,
+ "unit_price": {
+ "currency": "USD",
+ "value": "5.00"
+ }
+ }
+ ],
+ "invoice_date": "2014-03-24 PDT",
+ "payment_term": {
+ "term_type": "NET_45",
+ "due_date": "2014-05-08 PDT"
+ },
+ "tax_calculated_after_discount": false,
+ "tax_inclusive": false,
+ "note": "Medical Invoice 16 Jul, 2013 PST",
+ "total_amount": {
+ "currency": "USD",
+ "value": "500.00"
+ }
+ }
+ }
+}