Skip to content

Commit

Permalink
Merge pull request #2 from asjustas/master
Browse files Browse the repository at this point in the history
Update ParsedDocumentDataMapper to map all fields
  • Loading branch information
velser committed Nov 4, 2019
2 parents 60d1ab4 + 2944f52 commit 63efa89
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 9 deletions.
14 changes: 7 additions & 7 deletions src/Kyc/Entity/ParsedDocumentData.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function setPersonCode(string $personCode): ParsedDocumentData
return $this;
}

public function getIssueDate(): string
public function getIssueDate(): ?string
{
return $this->issueDate;
}
Expand All @@ -43,7 +43,7 @@ public function setIssueDate($issueDate): ParsedDocumentData
return $this;
}

public function getGender(): string
public function getGender(): ?string
{
return $this->gender;
}
Expand All @@ -55,7 +55,7 @@ public function setGender($gender): ParsedDocumentData
return $this;
}

public function getAddress(): string
public function getAddress(): ?string
{
return $this->address;
}
Expand Down Expand Up @@ -91,14 +91,14 @@ public function setFirstName(string $firstName): ParsedDocumentData
return $this;
}

public function geMiddleName(): ?string
public function getMiddleName(): ?string
{
return $this->firstName;
return $this->middleName;
}

public function setMiddleName(string $firstName): ParsedDocumentData
public function setMiddleName(string $middleName): ParsedDocumentData
{
$this->firstName = $firstName;
$this->middleName = $middleName;

return $this;
}
Expand Down
16 changes: 16 additions & 0 deletions src/Kyc/Mapper/ParsedDocumentDataMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ public function mapFromEntity($entity): array
$data['firstName'] = $entity->getFirstName();
}

if ($entity->getMiddleName() !== null) {
$data['middleName'] = $entity->getMiddleName();
}

if ($entity->getLastName() !== null) {
$data['lastName'] = $entity->getLastName();
}
Expand All @@ -105,6 +109,10 @@ public function mapFromEntity($entity): array
$data['expireDate'] = $entity->getExpireDate();
}

if ($entity->getIssueDate() !== null) {
$data['issueDate'] = $entity->getIssueDate();
}

if ($entity->getCountry() !== null) {
$data['country'] = $entity->getCountry();
}
Expand All @@ -113,6 +121,14 @@ public function mapFromEntity($entity): array
$data['nationality'] = $entity->getNationality();
}

if ($entity->getGender() !== null) {
$data['gender'] = $entity->getGender();
}

if ($entity->getAddress() !== null) {
$data['address'] = $entity->getAddress();
}

return $data;
}
}
2 changes: 0 additions & 2 deletions src/KycApiClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ public function startSession(StartSessionRequest $startSessionRequest): StartSes

return $startSessionMapper->mapToEntity(json_decode($response->getBody()->getContents(), true));
} catch (ClientException $exception) {
$this->handleClientException($exception);

throw $exception;
}
}
Expand Down

0 comments on commit 63efa89

Please sign in to comment.