Exemplo n.º 1
0
 /**
  * @test
  */
 public function shouldRedirectToRedsysSite()
 {
     $model = array('Ds_Merchant_Amount' => 1000, 'Ds_Merchant_Order' => '1234', 'Ds_Merchant_Currency' => '978', 'Ds_Merchant_TransactionType' => 0, 'Ds_Merchant_MerchantURL' => 'https://sis-t.sermepa.es:25443/sis/realizarPago');
     $apiMock = $this->createApiMock();
     $gatewayMock = $this->createGatewayMock();
     $gatewayMock->expects($this->never())->method('execute')->with($this->isInstanceOf('Payum\\Core\\Request\\GetHttpRequest'));
     $action = new CaptureAction();
     $action->setApi($apiMock);
     $request = new Capture($model);
     try {
         $action->execute($request);
     } catch (HttpPostRedirect $e) {
         // make sure all fields are passed with the correct value
         $postFields = $e->getFields();
         foreach ($model as $key => $value) {
             $this->assertEquals($value, $postFields[$key]);
         }
         // check oder fields not present in the model are passed
         $this->assertArrayHasKey('Ds_Merchant_MerchantCode', $postFields);
         $this->assertArrayHasKey('Ds_Merchant_Terminal', $postFields);
         $this->assertArrayHasKey('Ds_Signature', $postFields);
         return;
     }
     $this->fail('Expected an HttpPostRedirect');
 }
Exemplo n.º 2
0
 /**
  * @test
  *
  * @expectedException \Payum\Core\Reply\HttpPostRedirect
  */
 public function shouldRedirectToRedsysSite()
 {
     $model = array('Ds_Merchant_Amount' => 1000, 'Ds_Merchant_Order' => '1234', 'Ds_Merchant_Currency' => '978', 'Ds_Merchant_TransactionType' => 0, 'Ds_Merchant_MerchantURL' => 'https://sis-t.sermepa.es:25443/sis/realizarPago');
     $apiMock = $this->createApiMock();
     $gatewayMock = $this->createGatewayMock();
     $gatewayMock->expects($this->never())->method('execute')->with($this->isInstanceOf('Payum\\Core\\Request\\GetHttpRequest'));
     $action = new CaptureAction();
     $action->setApi($apiMock);
     $request = new Capture($model);
     $action->execute($request);
 }