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

@@ -14,15 +14,17 @@ class AuthorizationTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object Authorization
*
* @return string
*/
public static function getJson()
{
return '{"id":"TestSample","amount":' .AmountTest::getJson() . ',"payment_mode":"TestSample","state":"TestSample","reason_code":"TestSample","pending_reason":"TestSample","protection_eligibility":"TestSample","protection_eligibility_type":"TestSample","fmf_details":' .FmfDetailsTest::getJson() . ',"parent_payment":"TestSample","valid_until":"TestSample","create_time":"TestSample","update_time":"TestSample","links":' .LinksTest::getJson() . '}';
return '{"id":"TestSample","amount":' . AmountTest::getJson() . ',"payment_mode":"TestSample","state":"TestSample","reason_code":"TestSample","pending_reason":"TestSample","protection_eligibility":"TestSample","protection_eligibility_type":"TestSample","fmf_details":' . FmfDetailsTest::getJson() . ',"parent_payment":"TestSample","valid_until":"TestSample","create_time":"TestSample","update_time":"TestSample","links":' . LinksTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
*
* @return Authorization
*/
public static function getObject()
@@ -33,6 +35,7 @@ class AuthorizationTest extends \PHPUnit_Framework_TestCase
/**
* Tests for Serialization and Deserialization Issues
*
* @return Authorization
*/
public function testSerializationDeserialization()
@@ -79,7 +82,6 @@ class AuthorizationTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($obj->getLinks(), LinksTest::getObject());
}
/**
* @dataProvider mockProvider
* @param Authorization $obj
@@ -93,12 +95,13 @@ class AuthorizationTest extends \PHPUnit_Framework_TestCase
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
AuthorizationTest::getJson()
AuthorizationTest::getJson()
));
$result = $obj->get("authorizationId", $mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Authorization $obj
@@ -112,13 +115,14 @@ class AuthorizationTest extends \PHPUnit_Framework_TestCase
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
CaptureTest::getJson()
CaptureTest::getJson()
));
$capture = CaptureTest::getObject();
$result = $obj->capture($capture, $mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Authorization $obj
@@ -132,12 +136,13 @@ class AuthorizationTest extends \PHPUnit_Framework_TestCase
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
self::getJson()
self::getJson()
));
$result = $obj->void($mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Authorization $obj
@@ -151,7 +156,7 @@ class AuthorizationTest extends \PHPUnit_Framework_TestCase
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
self::getJson()
self::getJson()
));
$result = $obj->reauthorize($mockApiContext, $mockPPRestCall);
@@ -162,8 +167,8 @@ class AuthorizationTest extends \PHPUnit_Framework_TestCase
{
$obj = self::getObject();
$mockApiContext = $this->getMockBuilder('ApiContext')
->disableOriginalConstructor()
->getMock();
->disableOriginalConstructor()
->getMock();
return array(
array($obj, $mockApiContext),
array($obj, null)