public static function createRelatedResources() { $relatedResources = new RelatedResources(); $relatedResources->setAuthorization(AuthorizationTest::createAuthorization()); $relatedResources->setCapture(CaptureTest::createCapture()); return $relatedResources; }
public static function createSubTransaction() { $subTransaction = new SubTransaction(); $subTransaction->setAuthorization(AuthorizationTest::createAuthorization()); $subTransaction->setCapture(CaptureTest::createCapture()); return $subTransaction; }
/** * @group integration */ public function testOperations() { try { $authId = AuthorizationTest::authorize(); $auth = Authorization::get($authId); $amount = new Amount(); $amount->setCurrency("USD"); $amount->setTotal("1.00"); $captr = new Capture(); $captr->setId($authId); $captr->setAmount($amount); $capt = $auth->capture($captr); $captureId = $capt->getId(); $this->assertNotNull($captureId); $refund = new Refund(); $refund->setId($captureId); $refund->setAmount($amount); $capture = Capture::get($captureId); $this->assertNotNull($capture->getId()); $retund = $capture->refund($refund); $this->assertNotNull($retund->getId()); } catch (PayPalConnectionException $ex) { $this->markTestSkipped('Tests failing because of intermittent failures in Paypal Sandbox environment.' . $ex->getMessage()); } }
/** * @dataProvider mockProvider * @param Authorization $obj */ public function testGet($obj, $mockApiContext) { $mockPPRestCall = $this->getMockBuilder('\\PayPal\\Transport\\PayPalRestCall')->disableOriginalConstructor()->getMock(); $mockPPRestCall->expects($this->any())->method('execute')->will($this->returnValue(AuthorizationTest::getJson())); $result = $obj->get("authorizationId", $mockApiContext, $mockPPRestCall); $this->assertNotNull($result); }
/** * @depends testSerializationDeserialization * @param RelatedResources $obj */ public function testGetters($obj) { $this->assertEquals($obj->getSale(), SaleTest::getObject()); $this->assertEquals($obj->getAuthorization(), AuthorizationTest::getObject()); $this->assertEquals($obj->getOrder(), OrderTest::getObject()); $this->assertEquals($obj->getCapture(), CaptureTest::getObject()); $this->assertEquals($obj->getRefund(), RefundTest::getObject()); }
public function testOperations() { $authId = AuthorizationTest::authorize(); $auth = Authorization::get($authId); $amount = new Amount(); $amount->setCurrency("USD"); $amount->setTotal("1.00"); $captr = new Capture(); $captr->setId($authId); $captr->setAmount($amount); $capt = $auth->capture($captr); $captureId = $capt->getId(); $this->assertNotNull($captureId); $refund = new Refund(); $refund->setId($captureId); $refund->setAmount($amount); $capture = Capture::get($captureId); $this->assertNotNull($capture->getId()); $retund = $capture->refund($refund); $this->assertNotNull($retund->getId()); }