コード例 #1
0
ファイル: OgoneTest.php プロジェクト: marlon-be/marlon-ogone
 /**
  * @test
  * @depends AliasCreationIsSuccessful
  */
 public function DirectLinkPaymentIsSuccessful($alias)
 {
     $passphrase = new Passphrase(PASSPHRASE_SHA_IN);
     $shaComposer = new AllParametersShaComposer($passphrase);
     $directLinkRequest = new DirectLinkPaymentRequest($shaComposer);
     $orderId = uniqid('order_');
     // create a unique order id
     $directLinkRequest->setOrderid($orderId);
     $alias = new Alias($alias);
     $directLinkRequest->setPspid(PSPID);
     $directLinkRequest->setUserId(USERID);
     $directLinkRequest->setPassword(PASSWORD);
     $directLinkRequest->setAlias($alias);
     $directLinkRequest->setAmount(100);
     $directLinkRequest->setCurrency('EUR');
     $directLinkRequest->setEci(new Eci(Eci::ECOMMERCE_RECURRING));
     $directLinkRequest->validate();
     $body = array();
     foreach ($directLinkRequest->toArray() as $key => $value) {
         $body[strtoupper($key)] = $value;
     }
     $body['SHASIGN'] = $directLinkRequest->getShaSign();
     $client = new Client($directLinkRequest->getOgoneUri());
     $request = $client->post(null, null, $body);
     $response = $request->send();
     $directLinkResponse = new DirectLinkPaymentResponse($response->getBody(true));
     $this->assertTrue($directLinkResponse->isSuccessful());
     return $alias;
 }
コード例 #2
0
 /** @return DirectLinkPaymentRequest */
 protected function provideMinimalDirectLinkPaymentRequest()
 {
     $directLinkRequest = new DirectLinkPaymentRequest(new FakeShaComposer());
     $directLinkRequest->setPspid('123456');
     $directLinkRequest->setUserId('user_1234');
     $directLinkRequest->setPassword('abracadabra');
     $directLinkRequest->setAmount(100);
     $directLinkRequest->setCurrency('EUR');
     $directLinkRequest->setOrderid('999');
     return $directLinkRequest;
 }
コード例 #3
0
 /**
  * @test
  * @expectedException \RuntimeException
  */
 public function IsInvalidWhenFieldsAreMissing()
 {
     $directLinkPaymentRequest = new DirectLinkPaymentRequest(new FakeShaComposer());
     $directLinkPaymentRequest->validate();
 }