Update Payment Experience API to v1.3

This commit is contained in:
mrak and stevecoffey
2016-10-10 10:45:55 -07:00
parent d51a8d39ac
commit 3f909f7f5e
8 changed files with 186 additions and 63 deletions

View File

@@ -2,6 +2,7 @@
namespace PayPal\Test\Api;
use PayPal\Common\PayPalModel;
use PayPal\Api\FlowConfig;
/**
@@ -17,7 +18,7 @@ class FlowConfigTest extends \PHPUnit_Framework_TestCase
*/
public static function getJson()
{
return '{"landing_page_type":"TestSample","bank_txn_pending_url":"http://www.google.com"}';
return '{"landing_page_type":"TestSample","bank_txn_pending_url":"http://www.google.com","user_action":"TestSample","return_uri_http_method":"TestSample"}';
}
/**
@@ -40,6 +41,8 @@ class FlowConfigTest extends \PHPUnit_Framework_TestCase
$this->assertNotNull($obj);
$this->assertNotNull($obj->getLandingPageType());
$this->assertNotNull($obj->getBankTxnPendingUrl());
$this->assertNotNull($obj->getUserAction());
$this->assertNotNull($obj->getReturnUriHttpMethod());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
@@ -52,6 +55,8 @@ class FlowConfigTest extends \PHPUnit_Framework_TestCase
{
$this->assertEquals($obj->getLandingPageType(), "TestSample");
$this->assertEquals($obj->getBankTxnPendingUrl(), "http://www.google.com");
$this->assertEquals($obj->getUserAction(), "TestSample");
$this->assertEquals($obj->getReturnUriHttpMethod(), "TestSample");
}
/**
@@ -63,4 +68,5 @@ class FlowConfigTest extends \PHPUnit_Framework_TestCase
$obj = new FlowConfig();
$obj->setBankTxnPendingUrl(null);
}
}

View File

@@ -17,7 +17,7 @@ class InputFieldsTest extends \PHPUnit_Framework_TestCase
*/
public static function getJson()
{
return json_encode(json_decode('{"allow_note":true,"no_shipping":123,"address_override":123}'));
return '{"allow_note":true,"no_shipping":123,"address_override":123}';
}
/**
@@ -55,4 +55,6 @@ class InputFieldsTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($obj->getNoShipping(), 123);
$this->assertEquals($obj->getAddressOverride(), 123);
}
}

View File

@@ -17,7 +17,7 @@ class PresentationTest extends \PHPUnit_Framework_TestCase
*/
public static function getJson()
{
return json_encode(json_decode('{"brand_name":"TestSample","logo_image":"TestSample","locale_code":"TestSample"}'));
return '{"brand_name":"TestSample","logo_image":"TestSample","locale_code":"TestSample","return_url_label":"TestSample","note_to_seller_label":"TestSample"}';
}
/**
@@ -41,6 +41,8 @@ class PresentationTest extends \PHPUnit_Framework_TestCase
$this->assertNotNull($obj->getBrandName());
$this->assertNotNull($obj->getLogoImage());
$this->assertNotNull($obj->getLocaleCode());
$this->assertNotNull($obj->getReturnUrlLabel());
$this->assertNotNull($obj->getNoteToSellerLabel());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
@@ -54,5 +56,9 @@ class PresentationTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($obj->getBrandName(), "TestSample");
$this->assertEquals($obj->getLogoImage(), "TestSample");
$this->assertEquals($obj->getLocaleCode(), "TestSample");
$this->assertEquals($obj->getReturnUrlLabel(), "TestSample");
$this->assertEquals($obj->getNoteToSellerLabel(), "TestSample");
}
}

View File

@@ -17,7 +17,7 @@ class WebProfileTest extends \PHPUnit_Framework_TestCase
*/
public static function getJson()
{
return '{"id":"TestSample","name":"TestSample","flow_config":' .FlowConfigTest::getJson() . ',"input_fields":' .InputFieldsTest::getJson() . ',"presentation":' .PresentationTest::getJson() . '}';
return '{"id":"TestSample","name":"TestSample","temporary":true,"flow_config":' .FlowConfigTest::getJson() . ',"input_fields":' .InputFieldsTest::getJson() . ',"presentation":' .PresentationTest::getJson() . '}';
}
/**
@@ -40,6 +40,7 @@ class WebProfileTest extends \PHPUnit_Framework_TestCase
$this->assertNotNull($obj);
$this->assertNotNull($obj->getId());
$this->assertNotNull($obj->getName());
$this->assertNotNull($obj->getTemporary());
$this->assertNotNull($obj->getFlowConfig());
$this->assertNotNull($obj->getInputFields());
$this->assertNotNull($obj->getPresentation());
@@ -55,6 +56,7 @@ class WebProfileTest extends \PHPUnit_Framework_TestCase
{
$this->assertEquals($obj->getId(), "TestSample");
$this->assertEquals($obj->getName(), "TestSample");
$this->assertEquals($obj->getTemporary(), true);
$this->assertEquals($obj->getFlowConfig(), FlowConfigTest::getObject());
$this->assertEquals($obj->getInputFields(), InputFieldsTest::getObject());
$this->assertEquals($obj->getPresentation(), PresentationTest::getObject());
@@ -66,17 +68,17 @@ class WebProfileTest extends \PHPUnit_Framework_TestCase
*/
public function testCreate($obj, $mockApiContext)
{
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
->disableOriginalConstructor()
->getMock();
$mockPayPalRestCall->expects($this->any())
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
CreateProfileResponseTest::getJson()
self::getJson()
));
$result = $obj->create($mockApiContext, $mockPayPalRestCall);
$result = $obj->create($mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
/**
@@ -85,17 +87,17 @@ class WebProfileTest extends \PHPUnit_Framework_TestCase
*/
public function testUpdate($obj, $mockApiContext)
{
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
->disableOriginalConstructor()
->getMock();
$mockPayPalRestCall->expects($this->any())
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
true
));
$result = $obj->update($mockApiContext, $mockPayPalRestCall);
$result = $obj->update($mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
/**
@@ -104,18 +106,18 @@ class WebProfileTest extends \PHPUnit_Framework_TestCase
*/
public function testPartialUpdate($obj, $mockApiContext)
{
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
->disableOriginalConstructor()
->getMock();
$mockPayPalRestCall->expects($this->any())
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
true
));
$patch = array(PatchTest::getObject());
$result = $obj->partial_update($patch, $mockApiContext, $mockPayPalRestCall);
$result = $obj->partial_update($patch, $mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
/**
@@ -124,17 +126,17 @@ class WebProfileTest extends \PHPUnit_Framework_TestCase
*/
public function testGet($obj, $mockApiContext)
{
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
->disableOriginalConstructor()
->getMock();
$mockPayPalRestCall->expects($this->any())
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
WebProfileTest::getJson()
));
$result = $obj->get("profileId", $mockApiContext, $mockPayPalRestCall);
$result = $obj->get("profileId", $mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
/**
@@ -143,17 +145,17 @@ class WebProfileTest extends \PHPUnit_Framework_TestCase
*/
public function testGetList($obj, $mockApiContext)
{
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
->disableOriginalConstructor()
->getMock();
$mockPayPalRestCall->expects($this->any())
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
json_encode(array(json_decode(WebProfileTest::getJson())))
));
$result = $obj->get_list($mockApiContext, $mockPayPalRestCall);
$result = $obj->get_list($mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
/**
@@ -162,17 +164,17 @@ class WebProfileTest extends \PHPUnit_Framework_TestCase
*/
public function testDelete($obj, $mockApiContext)
{
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
->disableOriginalConstructor()
->getMock();
$mockPayPalRestCall->expects($this->any())
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
true
));
$result = $obj->delete($mockApiContext, $mockPayPalRestCall);
$result = $obj->delete($mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}