public function testLegalPersonalityFields() { $entity = new User(); $entity->setEmail('*****@*****.**'); $entity->setFirstName('John'); $entity->setLastName('Doe'); $entity->setIP('127.0.0.1'); $entity->setBirthday(new \DateTime('1980-10-31')); $entity->setNationality('US'); $entity->setPersonType(User::LEGAL_PERSONALITY); $response = $this->getClient()->request(new CreateUser($entity)); var_dump($response); die; $this->assertInstanceOf('Gordalina\\Mangopay\\Response\\ResponseInterface', $response); $this->assertTrue($response->isSuccessful()); $responseEntity = $response->getModel(); $this->assertFalse($entity === $responseEntity); $this->assertSame($entity->getEmail(), $responseEntity->getEmail()); $this->assertSame($entity->getFirstName(), $responseEntity->getFirstName()); $this->assertSame($entity->getLastName(), $responseEntity->getLastName()); $this->assertSame($entity->getIP(), $responseEntity->getIP()); $this->assertSame($entity->getBirthday(), $responseEntity->getBirthday()); $this->assertSame($entity->getPersonType(), $responseEntity->getPersonType()); $this->assertSame($entity->getNationality(), $responseEntity->getNationality()); $this->assertGreaterThan(0, $responseEntity->getID()); $this->assertGreaterThan(0, $responseEntity->getCreationDate()); $this->assertFalse($responseEntity->getHasRegisteredMeansOfPayment()); $this->assertFalse($responseEntity->getCanRegisterMeanOfPayment()); $this->assertSame(0, $responseEntity->getPersonalWalletAmount()); $this->assertFalse($responseEntity->getIsStrongAuthenticated()); }
/** * @return User */ protected function createUser() { $entity = new User(); $entity->setEmail('*****@*****.**'); $entity->setFirstName('John'); $entity->setLastName('Doe'); $entity->setIP('127.0.0.1'); $entity->setBirthday(new \DateTime('1980-10-31')); $entity->setNationality('US'); $entity->setPersonType(User::NATURAL_PERSON); $response = $this->getClient()->request(new CreateUser($entity)); $this->assertInstanceOf('Gordalina\\Mangopay\\Response\\ResponseInterface', $response); $this->assertTrue($response->isSuccessful()); return $response->getModel(); }
public function testFetch() { $user = new User(); $user->setTag('no-tag'); $user->setEmail('*****@*****.**'); $user->setFirstName('John'); $user->setLastName('Doe'); $user->setIP('127.0.0.1'); $user->setBirthday(new \DateTime('1980-10-31')); $user->setNationality('US'); $user->setPersonType(User::NATURAL_PERSON); $response = $this->getClient()->request(new CreateUser($user)); $this->assertInstanceOf('Gordalina\\Mangopay\\Response\\ResponseInterface', $response); $this->assertTrue($response->isSuccessful()); $user = $response->getModel(); $user->setTag('tag'); $user->setEmail('*****@*****.**'); $user->setFirstName('Joanne'); $user->setLastName('Doanne'); $user->setHasRegisteredMeansOfPayment(true); $user->setCanRegisterMeanOfPayment(true); $user->setIP('192.168.0.1'); $user->setBirthday(new \DateTime('1981-10-31')); $user->setPassword('password'); $user->setNationality('CA'); $user->setPersonType(User::LEGAL_PERSONALITY); $user->setPersonalWalletAmount(1000); $user->setIsStrongAuthenticated(true); $response = $this->getClient()->request(new ModifyUser($user)); $this->assertInstanceOf('Gordalina\\Mangopay\\Response\\ResponseInterface', $response); $this->assertTrue($response->isSuccessful()); $responseUser = $response->getModel(); $this->assertFalse($user === $responseUser); $this->assertSame($user->getTag(), $responseUser->getTag()); $this->assertSame($user->getEmail(), $responseUser->getEmail()); $this->assertSame($user->getFirstName(), $responseUser->getFirstName()); $this->assertSame($user->getLastName(), $responseUser->getLastName()); $this->assertFalse($responseUser->getHasRegisteredMeansOfPayment()); $this->assertSame($user->getCanRegisterMeanOfPayment(), $responseUser->getCanRegisterMeanOfPayment()); $this->assertSame($user->getIP(), $responseUser->getIP()); $this->assertSame($user->getBirthday(), $responseUser->getBirthday()); $this->assertSame($user->getPassword(), $responseUser->getPassword()); $this->assertSame($user->getNationality(), $responseUser->getNationality()); $this->assertSame(User::NATURAL_PERSON, $responseUser->getPersonType()); $this->assertSame(0, $responseUser->getPersonalWalletAmount()); $this->assertFalse($responseUser->getIsStrongAuthenticated()); $id = $responseUser->getID(); $response = $this->getClient()->request(new FetchUser($id)); $this->assertInstanceOf('Gordalina\\Mangopay\\Response\\ResponseInterface', $response); $this->assertTrue($response->isSuccessful()); $responseUser = $response->getModel(); $this->assertSame($user->getTag(), $responseUser->getTag()); $this->assertSame($user->getEmail(), $responseUser->getEmail()); $this->assertSame($user->getFirstName(), $responseUser->getFirstName()); $this->assertSame($user->getLastName(), $responseUser->getLastName()); $this->assertFalse($responseUser->getHasRegisteredMeansOfPayment()); $this->assertSame($user->getCanRegisterMeanOfPayment(), $responseUser->getCanRegisterMeanOfPayment()); $this->assertSame($user->getIP(), $responseUser->getIP()); $this->assertSame($user->getBirthday(), $responseUser->getBirthday()); $this->assertSame($user->getPassword(), $responseUser->getPassword()); $this->assertSame($user->getNationality(), $responseUser->getNationality()); $this->assertSame(User::NATURAL_PERSON, $responseUser->getPersonType()); $this->assertSame(0, $responseUser->getPersonalWalletAmount()); $this->assertFalse($responseUser->getIsStrongAuthenticated()); }