Payments API Updates

This commit is contained in:
Jay Patel
2015-10-02 14:25:46 -05:00
parent 02fca1bda4
commit a37b880e96
112 changed files with 3857 additions and 1495 deletions

View File

@@ -13,15 +13,17 @@ class CartBaseTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object CartBase
*
* @return string
*/
public static function getJson()
{
return '{"amount":' .AmountTest::getJson() . ',"payee":' .PayeeTest::getJson() . ',"description":"TestSample","note_to_payee":"TestSample","custom":"TestSample","invoice_number":"TestSample","soft_descriptor":"TestSample","payment_options":' .PaymentOptionsTest::getJson() . ',"item_list":' .ItemListTest::getJson() . ',"notify_url":"http://www.google.com","order_url":"http://www.google.com"}';
return '{"reference_id":"TestSample","amount":' . AmountTest::getJson() . ',"payee":' . PayeeTest::getJson() . ',"description":"TestSample","note_to_payee":"TestSample","custom":"TestSample","invoice_number":"TestSample","soft_descriptor":"TestSample","soft_descriptor_city":"TestSample","payment_options":' . PaymentOptionsTest::getJson() . ',"item_list":' . ItemListTest::getJson() . ',"notify_url":"http://www.google.com","order_url":"http://www.google.com","external_funding":' . ExternalFundingTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
*
* @return CartBase
*/
public static function getObject()
@@ -32,12 +34,14 @@ class CartBaseTest extends \PHPUnit_Framework_TestCase
/**
* Tests for Serialization and Deserialization Issues
*
* @return CartBase
*/
public function testSerializationDeserialization()
{
$obj = new CartBase(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getReferenceId());
$this->assertNotNull($obj->getAmount());
$this->assertNotNull($obj->getPayee());
$this->assertNotNull($obj->getDescription());
@@ -45,10 +49,12 @@ class CartBaseTest extends \PHPUnit_Framework_TestCase
$this->assertNotNull($obj->getCustom());
$this->assertNotNull($obj->getInvoiceNumber());
$this->assertNotNull($obj->getSoftDescriptor());
$this->assertNotNull($obj->getSoftDescriptorCity());
$this->assertNotNull($obj->getPaymentOptions());
$this->assertNotNull($obj->getItemList());
$this->assertNotNull($obj->getNotifyUrl());
$this->assertNotNull($obj->getOrderUrl());
$this->assertNotNull($obj->getExternalFunding());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
@@ -59,6 +65,7 @@ class CartBaseTest extends \PHPUnit_Framework_TestCase
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getReferenceId(), "TestSample");
$this->assertEquals($obj->getAmount(), AmountTest::getObject());
$this->assertEquals($obj->getPayee(), PayeeTest::getObject());
$this->assertEquals($obj->getDescription(), "TestSample");
@@ -66,10 +73,12 @@ class CartBaseTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($obj->getCustom(), "TestSample");
$this->assertEquals($obj->getInvoiceNumber(), "TestSample");
$this->assertEquals($obj->getSoftDescriptor(), "TestSample");
$this->assertEquals($obj->getSoftDescriptorCity(), "TestSample");
$this->assertEquals($obj->getPaymentOptions(), PaymentOptionsTest::getObject());
$this->assertEquals($obj->getItemList(), ItemListTest::getObject());
$this->assertEquals($obj->getNotifyUrl(), "http://www.google.com");
$this->assertEquals($obj->getOrderUrl(), "http://www.google.com");
$this->assertEquals($obj->getExternalFunding(), ExternalFundingTest::getObject());
}
/**
@@ -81,6 +90,7 @@ class CartBaseTest extends \PHPUnit_Framework_TestCase
$obj = new CartBase();
$obj->setNotifyUrl(null);
}
/**
* @expectedException \InvalidArgumentException
* @expectedExceptionMessage OrderUrl is not a fully qualified URL
@@ -90,4 +100,5 @@ class CartBaseTest extends \PHPUnit_Framework_TestCase
$obj = new CartBase();
$obj->setOrderUrl(null);
}
}