|
@@ 245-274 (lines=30) @@
|
| 242 |
|
* @loadExpectation messageReplies |
| 243 |
|
* @dataProvider provideTrueFalse |
| 244 |
|
*/ |
| 245 |
|
public function testSetExpressCheckout($isSuccessful) |
| 246 |
|
{ |
| 247 |
|
$this->injectConfig([ |
| 248 |
|
'apiOperationSetExpressCheckout' => 'paypal/setExpress', |
| 249 |
|
'apiService' => 'payments', |
| 250 |
|
]); |
| 251 |
|
list($request, $reply) = $this->mockSetExpressPayloads($isSuccessful); |
| 252 |
|
$this->sdk->expects($this->any()) |
| 253 |
|
->method('getRequestBody') |
| 254 |
|
->will($this->returnValue($request)); |
| 255 |
|
// test setExpressCheckout |
| 256 |
|
$api = $this->getModelMock( |
| 257 |
|
'ebayenterprise_paypal/express_api', |
| 258 |
|
['sendRequest'] |
| 259 |
|
); |
| 260 |
|
$api->expects($this->any()) |
| 261 |
|
->method('sendRequest') |
| 262 |
|
->will($this->returnValue($reply)); |
| 263 |
|
EcomDev_Utils_Reflection::setRestrictedPropertyValues( |
| 264 |
|
$api, |
| 265 |
|
['helper' => $this->helper, 'coreHelper' => $this->coreHelper] |
| 266 |
|
); |
| 267 |
|
if (!$isSuccessful) { |
| 268 |
|
$message |
| 269 |
|
= EbayEnterprise_PayPal_Model_Express_Api::EBAYENTERPRISE_PAYPAL_API_FAILED; |
| 270 |
|
$this->setExpectedException('EbayEnterprise_PayPal_Exception', $message); |
| 271 |
|
} |
| 272 |
|
$result = $api->setExpressCheckout($this->cancelUrl, $this->returnUrl, $this->quote); |
| 273 |
|
$this->assertEquals($this->expected('setExpress')->getData(), $result); |
| 274 |
|
} |
| 275 |
|
|
| 276 |
|
/** |
| 277 |
|
* setup payloads for getExpressCheckout |
|
@@ 311-339 (lines=29) @@
|
| 308 |
|
* @loadExpectation messageReplies |
| 309 |
|
* @dataProvider provideTrueFalse |
| 310 |
|
*/ |
| 311 |
|
public function testGetExpressCheckout($isSuccessful) |
| 312 |
|
{ |
| 313 |
|
$this->injectConfig( |
| 314 |
|
[ |
| 315 |
|
'apiOperationGetExpressCheckout' => 'paypal/getExpress', |
| 316 |
|
'apiService' => 'payments', |
| 317 |
|
] |
| 318 |
|
); |
| 319 |
|
list($request, $reply) = $this->mockGetExpressPayoads($isSuccessful); |
| 320 |
|
$this->sdk->expects($this->any()) |
| 321 |
|
->method('getRequestBody') |
| 322 |
|
->will($this->returnValue($request)); |
| 323 |
|
// test setExpressCheckout |
| 324 |
|
$api = $this->getModelMock('ebayenterprise_paypal/express_api', ['sendRequest']); |
| 325 |
|
$api->expects($this->any()) |
| 326 |
|
->method('sendRequest') |
| 327 |
|
->will($this->returnValue($reply)); |
| 328 |
|
EcomDev_Utils_Reflection::setRestrictedPropertyValues( |
| 329 |
|
$api, |
| 330 |
|
['helper' => $this->helper, 'coreHelper' => $this->coreHelper] |
| 331 |
|
); |
| 332 |
|
if (!$isSuccessful) { |
| 333 |
|
$message |
| 334 |
|
= EbayEnterprise_PayPal_Model_Express_Api::EBAYENTERPRISE_PAYPAL_API_FAILED; |
| 335 |
|
$this->setExpectedException('EbayEnterprise_PayPal_Exception', $message); |
| 336 |
|
} |
| 337 |
|
$result = $api->getExpressCheckout($this->orderId, $this->token, $this->currencyCode); |
| 338 |
|
$this->assertEquals($this->expected('getExpress')->getData(), $result); |
| 339 |
|
} |
| 340 |
|
|
| 341 |
|
/** |
| 342 |
|
* verify |