예제 #1
0
 /**
  * @param  User        $user defaults to null
  * @return PaymentCard
  */
 protected function createPaymentCard($user = null)
 {
     if ($user === null) {
         $user = $this->createUser();
     }
     $entity = new PaymentCard();
     $entity->setReturnURL('http://inpakt.com/ok');
     $entity->setOwnerID($user->getID());
     $response = $this->getClient()->request(new CreatePaymentCard($entity));
     $this->assertInstanceOf('Gordalina\\Mangopay\\Response\\ResponseInterface', $response);
     $this->assertTrue($response->isSuccessful());
     return $response->getModel();
 }
 public function testRequiredFields()
 {
     $user = $this->createUser();
     $entity = new PaymentCard();
     $entity->setReturnURL('http://inpakt.com/ok');
     $entity->setOwnerID($user->getID());
     $response = $this->getClient()->request(new CreatePaymentCard($entity));
     $this->assertInstanceOf('Gordalina\\Mangopay\\Response\\ResponseInterface', $response);
     $this->assertTrue($response->isSuccessful());
     $responseEntity = $response->getModel();
     $this->assertFalse($entity === $responseEntity);
     $this->assertSame($entity->getOwnerID(), $responseEntity->getOwnerID());
     $this->assertSame(sprintf('%s?PaymentCardID=%s', $entity->getReturnURL(), $responseEntity->getID()), $responseEntity->getReturnURL());
     $this->assertNotNull($responseEntity->getRedirectURL());
     $this->assertNull($responseEntity->getCardNumber());
     $this->assertNull($responseEntity->getTemplateURL());
     $this->assertGreaterThan(0, $responseEntity->getID());
     $this->assertNull($entity->getTag());
     // These values are completely erronous
     // $this->assertGreaterThan(0, $responseEntity->getCreationDate());
     // $this->assertGreaterThan(0, $responseEntity->getUpdateDate());
 }