/** * @depends testCreatePayment */ public function testCreate(Payment\Payment $payment) { $method = new Void\Create($payment->getId(), 'my description'); $result = $this->client->call($method); $this->assertInstanceOf('Cardinity\\Method\\Void\\Void', $result); return $result; }
/** * @depends testCreatePayment */ public function testCreate(Payment\Payment $payment) { $method = new Settlement\Create($payment->getId(), 10.0, 'my description'); $result = $this->client->call($method); $this->assertInstanceOf('Cardinity\\Method\\Settlement\\Settlement', $result); $this->assertSame('10.00', $result->getAmount()); return $result; }
function it_returns_erros_from_payment_result_object(\RuntimeException $exception) { $msg = 'Payment error'; $payment = new Payment(); $payment->setError($msg); $this->beConstructedWith($exception, $payment); $this->getErrors()->shouldReturn([['field' => 'status', 'message' => $msg]]); $this->getErrorsAsString()->shouldReturn("status: Payment error;"); }
function it_maps_authorization_information(Payment $payment) { $data = ['authorization_information' => ['url' => 'https://authorization.url/auth', 'data' => 'eJxdUl1vwj.......']]; $info = new AuthorizationInformation(); $info->setUrl('https://authorization.url/auth'); $info->setData('eJxdUl1vwj.......'); $payment->setAuthorizationInformation($info)->shouldBeCalled(); $this->map($data, $payment); }
public function testProcessAuthorization() { $session = $this->client->getContainer()->get('session'); $payment = new Payment(); $payment->setStatus('approved'); $payment->setOrderId('identifier_value'); $payment->setDescription('pares_value'); $session->set('cardinity_payment', $payment->serialize()); $crawler = $this->client->request('POST', '/cardinity/authorization/process', ['MD' => 'identifier_value', 'PaRes' => 'pares_value']); $this->assertTrue($this->client->getResponse()->isRedirect('/cardinity/success')); }
/** * Dummy success page * @return Response */ public function successAction() { if (!$this->session->has('cardinity_payment')) { return $this->errorResponse('Session expired.'); } $payment = new Payment\Payment(); $payment->unserialize($this->session->get('cardinity_payment')); $this->session->remove('cardinity_payment'); return $this->templating->renderResponse('CardinityClientBundle:Payment:success.html.twig', ['payment' => $payment]); }