Ejemplo n.º 1
0
 /**
  * @group integration
  */
 public function testCreatePaymentWithKey()
 {
     $payment = new Payment();
     $payment->setValue(12);
     $payment->setKey('secret');
     $request = new CreatePayment($payment);
     $response = $this->getClient()->request($request);
     $this->assertTrue($response->isValid());
     $this->assertSame('ok0', $response->getStatus());
     $this->assertStringStartsWith('ep_country and ep_entity and ep_user and ep_cin ok', $response->getMessage());
     $this->assertSame($this->getConfig()->getCin(), $response->getCin());
     $this->assertSame($this->getConfig()->getUser(), $response->getUser());
     $this->assertSame($this->getConfig()->getEntity(), $response->getEntity());
     $this->assertTrue($response->getReference() != null);
     $this->assertSame($payment->getValue(), $response->getValue());
     $this->assertSame($payment->getKey(), $response->getKey());
     $this->assertRegExp('#https?://(test\\.|www\\.)?easypay.pt/_s/.*#', $response->getLink());
     $this->assertSame($payment->getKey(), $response->getKey());
 }
Ejemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function handleRequest(Config $config)
 {
     $parameters = array('ep_cin' => $config->getCin(), 'ep_user' => $config->getUser(), 'ep_entity' => $config->getEntity(), 'ep_language' => $config->getLanguage(), 'ep_country' => $config->getCountry(), 'ep_ref_type' => 'auto', 't_value' => strval($this->payment->getValue()), 't_key' => $this->payment->getKey());
     if ($this->payment->getCustomerInfo() instanceof CustomerInfo) {
         $parameters = array_merge($parameters, $this->payment->getCustomerInfo()->toArray());
     }
     // Optional authentication code
     if ($config->getCode()) {
         $parameters['s_code'] = $config->getCode();
     }
     // Optional maximum date for payment acceptance
     if ($this->payment->getMaxDate()) {
         $parameters['o_max_date'] = $this->payment->getMaxDate();
         $parameters['ep_partner'] = $config->getUser();
     }
     switch ($this->payment->getType()) {
         case Payment::TYPE_BOLETO:
         case Payment::TYPE_MOTO:
             $parameters['ep_type'] = $this->payment->getType();
             break;
     }
     return $parameters;
 }
Ejemplo n.º 3
0
 public function getRequest()
 {
     $payment = new Payment();
     $payment->setValue(10);
     return new CreatePayment($payment);
 }
Ejemplo n.º 4
0
 /**
  * @expectedException InvalidArgumentException
  */
 public function testInvalidMaxDateYear()
 {
     $payment = new Payment();
     $payment->setMaxDate('14-11-21');
 }