-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from getyoti/release-1.2.0
Release 1.2.0
- Loading branch information
Showing
24 changed files
with
704 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Yoti\Sandbox\Profile\Request\ExtraData; | ||
|
||
abstract class SandboxDataEntry implements \JsonSerializable | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
private $type; | ||
|
||
/** | ||
* @var \JsonSerializable | ||
*/ | ||
private $value; | ||
|
||
/** | ||
* @param string $type | ||
* @param \JsonSerializable $value | ||
*/ | ||
public function __construct(string $type, \JsonSerializable $value) | ||
{ | ||
$this->type = $type; | ||
$this->value = $value; | ||
} | ||
|
||
/** | ||
* @return \stdClass | ||
*/ | ||
public function jsonSerialize(): \stdClass | ||
{ | ||
return (object) [ | ||
'type' => $this->type, | ||
'value' => $this->value, | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Yoti\Sandbox\Profile\Request\ExtraData; | ||
|
||
use Yoti\Util\Validation; | ||
|
||
class SandboxExtraData implements \JsonSerializable | ||
{ | ||
/** | ||
* @var SandboxDataEntry[] | ||
*/ | ||
private $dataEntries; | ||
|
||
/** | ||
* @param SandboxDataEntry[] $dataEntries | ||
*/ | ||
public function __construct(array $dataEntries) | ||
{ | ||
Validation::isArrayOfType($dataEntries, [SandboxDataEntry::class], 'dataEntries'); | ||
$this->dataEntries = $dataEntries; | ||
} | ||
|
||
/** | ||
* @return \stdClass | ||
*/ | ||
public function jsonSerialize(): \stdClass | ||
{ | ||
return (object) [ | ||
'data_entry' => $this->dataEntries, | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Yoti\Sandbox\Profile\Request\ExtraData; | ||
|
||
class SandboxExtraDataBuilder | ||
{ | ||
/** | ||
* @var SandboxDataEntry[] | ||
*/ | ||
private $dataEntries = []; | ||
|
||
/** | ||
* @param SandboxDataEntry $dataEntry | ||
* | ||
* @return $this | ||
*/ | ||
public function withDataEntry(SandboxDataEntry $dataEntry): self | ||
{ | ||
$this->dataEntries[] = $dataEntry; | ||
return $this; | ||
} | ||
|
||
/** | ||
* @return SandboxExtraData | ||
*/ | ||
public function build(): SandboxExtraData | ||
{ | ||
return new SandboxExtraData($this->dataEntries); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
src/Profile/Request/ExtraData/ThirdParty/SandboxAttributeIssuanceDetails.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Yoti\Sandbox\Profile\Request\ExtraData\ThirdParty; | ||
|
||
use Yoti\Sandbox\Profile\Request\ExtraData\SandboxDataEntry; | ||
|
||
class SandboxAttributeIssuanceDetails extends SandboxDataEntry | ||
{ | ||
private const TYPE = 'THIRD_PARTY_ATTRIBUTE'; | ||
|
||
/** | ||
* @param SandboxAttributeIssuanceDetailsValue $value | ||
*/ | ||
public function __construct(SandboxAttributeIssuanceDetailsValue $value) | ||
{ | ||
parent::__construct(self::TYPE, $value); | ||
} | ||
} |
72 changes: 72 additions & 0 deletions
72
src/Profile/Request/ExtraData/ThirdParty/SandboxAttributeIssuanceDetailsBuilder.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Yoti\Sandbox\Profile\Request\ExtraData\ThirdParty; | ||
|
||
use Yoti\Util\Validation; | ||
|
||
class SandboxAttributeIssuanceDetailsBuilder | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
private $issuanceToken; | ||
|
||
/** | ||
* @var \DateTime | ||
*/ | ||
private $expiryDate; | ||
|
||
/** | ||
* @var SandboxDefinition[] | ||
*/ | ||
private $definitions; | ||
|
||
/** | ||
* @param string $issuanceToken | ||
* | ||
* @return $this | ||
*/ | ||
public function withIssuanceToken(string $issuanceToken): self | ||
{ | ||
Validation::notEmptyString($issuanceToken, 'issuanceToken'); | ||
$this->issuanceToken = $issuanceToken; | ||
return $this; | ||
} | ||
|
||
/** | ||
* @param \DateTime $expiryDate | ||
* | ||
* @return $this | ||
*/ | ||
public function withExpiryDate(\DateTime $expiryDate): self | ||
{ | ||
$this->expiryDate = $expiryDate; | ||
return $this; | ||
} | ||
|
||
/** | ||
* @param string $definition | ||
* | ||
* @return self | ||
*/ | ||
public function withDefinition(string $definition): self | ||
{ | ||
Validation::notEmptyString($definition, 'definition'); | ||
$this->definitions[] = new SandboxDefinition($definition); | ||
return $this; | ||
} | ||
|
||
/** | ||
* @return SandboxAttributeIssuanceDetails | ||
*/ | ||
public function build(): SandboxAttributeIssuanceDetails | ||
{ | ||
$value = new SandboxAttributeIssuanceDetailsValue( | ||
$this->issuanceToken, | ||
new SandboxIssuingAttributes($this->expiryDate, $this->definitions) | ||
); | ||
return new SandboxAttributeIssuanceDetails($value); | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
src/Profile/Request/ExtraData/ThirdParty/SandboxAttributeIssuanceDetailsValue.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Yoti\Sandbox\Profile\Request\ExtraData\ThirdParty; | ||
|
||
class SandboxAttributeIssuanceDetailsValue implements \JsonSerializable | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
private $issuanceToken; | ||
|
||
/** | ||
* @var SandboxIssuingAttributes | ||
*/ | ||
private $issuingAttributes; | ||
|
||
/** | ||
* @param string $issuanceToken | ||
* @param SandboxIssuingAttributes $issuingAttributes | ||
*/ | ||
public function __construct(string $issuanceToken, SandboxIssuingAttributes $issuingAttributes) | ||
{ | ||
$this->issuanceToken = $issuanceToken; | ||
$this->issuingAttributes = $issuingAttributes; | ||
} | ||
|
||
/** | ||
* @return \stdClass | ||
*/ | ||
public function jsonSerialize(): \stdClass | ||
{ | ||
return (object) [ | ||
'issuance_token' => $this->issuanceToken, | ||
'issuing_attributes' => $this->issuingAttributes, | ||
]; | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
src/Profile/Request/ExtraData/ThirdParty/SandboxDefinition.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Yoti\Sandbox\Profile\Request\ExtraData\ThirdParty; | ||
|
||
use Yoti\Util\Validation; | ||
|
||
class SandboxDefinition implements \JsonSerializable | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
private $name; | ||
|
||
/** | ||
* @param string $name | ||
*/ | ||
public function __construct(string $name) | ||
{ | ||
Validation::notEmptyString($name, 'name'); | ||
$this->name = $name; | ||
} | ||
|
||
/** | ||
* @return \stdClass | ||
*/ | ||
public function jsonSerialize(): \stdClass | ||
{ | ||
return (object) [ | ||
'name' => $this->name, | ||
]; | ||
} | ||
} |
Oops, something went wrong.