public function testDetails() { $json = '{ "account": "cperformance", "accountType": "GLOBAL", "capabilityFlags": [ "CAN_SEND", "CAN_SIGN", "CAN_REPLACE_SIGNER" ], "channel": "_default", "company": "John Law Group", "email": "*****@*****.**", "firstName": "Bill", "initials": "NJ", "lastName": "John", "passwordExpiration": "2021-11-11T08:26:30-08:00" }'; $transport = new \Echosign\Transports\GuzzleTransport(); $client = $transport->getClient(); $stream = Stream::factory($json); $mock = new Mock([new Response(200, ['content-type' => 'application/json'], $stream)]); $client->getEmitter()->attach($mock); $users = new Users('465789', $transport); $response = $users->details('123456'); $this->assertInstanceOf('Echosign\\Responses\\UserDetailsInfo', $response); $this->assertEquals('*****@*****.**', $response->getEmail()); $capabilities = $response->getCapabilityFlags(); $this->assertEquals(3, count($capabilities)); }
/** * Create a new user in your echosign account. * @param $firstName * @param $lastName * @param $email * @param $password * @return bool|mixed */ public function create($firstName, $lastName, $email, $password) { $this->user = new Users($this->getToken(), $this->getTransport()); $userInfo = new UserCreationInfo($firstName, $lastName, $email, $password); try { $this->response = $this->user->create($userInfo); } catch (JsonApiResponseException $e) { $this->errorMessages[$e->getCode()] = sprintf('%s - %s', $e->getApiCode(), $e->getMessage()); return false; } catch (\Exception $e) { $this->errorMessages[$e->getCode()] = $e->getMessage(); return false; } return $this->response->getUserId(); }