Skip to content

Commit 8e4acfd

Browse files
Moussa Sidibesidibos
authored andcommitted
SDK-603: Add ability to cast DocumentDetails in the RequestBuilder
1 parent fef8f94 commit 8e4acfd

File tree

3 files changed

+43
-3
lines changed

3 files changed

+43
-3
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
namespace YotiSandbox\Entity;
4+
5+
use Yoti\Entity\DocumentDetails;
6+
7+
class SandboxDocumentDetails extends DocumentDetails
8+
{
9+
public function getValue()
10+
{
11+
$value = $this->getType() . ' ' . $this->getIssuingAuthority() . ' ' . $this->getDocumentNumber() . ' ';
12+
13+
$expirationDate = $this->getExpirationDate();
14+
$value .= (NULL !== $expirationDate) ? $expirationDate->format('d-m-Y') : '-';
15+
$value .= (NULL !== $this->getIssuingAuthority()) ? ' ' .$this->getIssuingAuthority() : '';
16+
17+
return $value;
18+
}
19+
}

sandbox/src/Http/RequestBuilder.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use YotiSandbox\Entity\SandboxAnchor;
66
use YotiSandbox\Entity\SandboxAttribute;
77
use YotiSandbox\Entity\SandboxAgeVerification;
8+
use YotiSandbox\Entity\SandboxDocumentDetails;
89

910
class RequestBuilder
1011
{
@@ -165,11 +166,11 @@ public function setStructuredPostalAddress($value, $optional = 'false', array $a
165166
return $this;
166167
}
167168

168-
public function setDocumentDetails($value, $optional = 'true', array $anchors = [])
169+
public function setDocumentDetails(SandboxDocumentDetails $documentDetails, $optional = 'true', array $anchors = [])
169170
{
170171
$this->addAttribute($this->createAttribute(
171172
Profile::ATTR_DOCUMENT_DETAILS,
172-
$value,
173+
$documentDetails->getValue(),
173174
'',
174175
$optional,
175176
$anchors

src/Yoti/ActivityDetails.php

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ class ActivityDetails
2222
*/
2323
private $rememberMeId;
2424

25+
/**
26+
* @var string parent receipt identifier
27+
*/
28+
private $parentRememberMeId;
29+
2530
/**
2631
* @var \Yoti\Entity\Profile
2732
*/
@@ -69,6 +74,11 @@ private function setRememberMeId()
6974
$this->rememberMeId = $this->receipt->getRememberMeId();
7075
}
7176

77+
private function setParentRememberMeId()
78+
{
79+
$this->parentRememberMeId = $this->receipt->getParentRememberMeId();
80+
}
81+
7282
private function setTimestamp()
7383
{
7484
try {
@@ -157,10 +167,20 @@ public function getProfile()
157167
/**
158168
* Get rememberMeId.
159169
*
160-
* @return string
170+
* @return null|string
161171
*/
162172
public function getRememberMeId()
163173
{
164174
return $this->rememberMeId;
165175
}
176+
177+
/**
178+
* Get Parent Remember Me Id.
179+
*
180+
* @return null|string
181+
*/
182+
public function getParentRememberMeId()
183+
{
184+
return $this->parentRememberMeId;
185+
}
166186
}

0 commit comments

Comments
 (0)