public function testValid()
 {
     $payment = new RecurringPayment();
     $payment->setValue(10);
     $payment->setFrequency(RecurringPayment::DAILY);
     $this->assertTrue($payment->isValid());
 }
 /**
  * @group integration
  */
 public function testCreatePayment()
 {
     $payment = new RecurringPayment();
     $payment->setValue(12);
     $payment->setFrequency(RecurringPayment::DAILY);
     $request = new CreateRecurringPayment($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->assertRegExp('#https?://(test\\.|www\\.)?easypay.pt/_s/.*#', $response->getCreditCardLink());
     $this->assertRegExp('#https?://(test\\.|www\\.)?easypay.pt/_s/.*#', $response->getDirectDebitLink());
     $this->assertSame($payment->getFrequency(), $response->getFrequency());
     $this->assertRegExp('/[A-F0-9]+/', $response->getK1());
 }
 public function getRequest()
 {
     $payment = new RecurringPayment();
     $payment->setFrequency(RecurringPayment::DAILY);
     $payment->setValue(10);
     return new CreateRecurringPayment($payment);
 }