diff --git a/CHANGELOG.md b/CHANGELOG.md index f0f9aeec2..98e0c8c5a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ Security - in case of vulnerabilities. - [x] Added **Blocklist API** - [x] Added **Plaid Credentials API** +- [x] Added **Experian Credentials API** - [x] Added **Payment Instruments API** - [x] Added `PaymentToken` - [x] Added `Client::paymentTokens()` factory diff --git a/src/Client.php b/src/Client.php index d44ed3b7b..5611eaac4 100644 --- a/src/Client.php +++ b/src/Client.php @@ -82,6 +82,7 @@ * @method Services\WebhooksService webhooks() * @method Services\WebhookCredentialsService webhookCredentials() * @method Services\PlaidCredentialsService plaidCredentials() + * @method Services\ExperianCredentialsService experianCredentials() * @method Services\ValuesListService lists() * @method Services\ValuesListTrackingService listsTracking() * @method Services\WebhookTrackingService webhooksTracking() @@ -154,6 +155,7 @@ final class Client 'customerTimeline' => Services\CustomerTimelineService::class, 'aml' => Services\AmlService::class, 'plaidCredentials' => Services\PlaidCredentialsService::class, + 'experianCredentials' => Services\ExperianCredentialsService::class, 'paymentInstruments' => Services\PaymentInstrumentService::class, ]; diff --git a/src/Entities/ExperianCredential.php b/src/Entities/ExperianCredential.php new file mode 100644 index 000000000..06e184844 --- /dev/null +++ b/src/Entities/ExperianCredential.php @@ -0,0 +1,131 @@ +getHash(); + } + + /** + * @return string + */ + public function getHash() + { + return $this->getAttribute('hash'); + } + + /** + * @return string + */ + public function getStatus() + { + return $this->getAttribute('status'); + } + + /** + * @param string $value + * + * @return $this + */ + public function setStatus($value) + { + return $this->setAttribute('status', $value); + } + + /** + * @return string + */ + public function getUsername() + { + return $this->getAttribute('username'); + } + + /** + * @param string $value + * + * @return $this + */ + public function setUsername($value) + { + return $this->setAttribute('username', $value); + } + + /** + * @return string + */ + public function getPassword() + { + return $this->getAttribute('password'); + } + + /** + * @param string $value + * + * @return $this + */ + public function setPassword($value) + { + return $this->setAttribute('password', $value); + } + + /** + * @return string + */ + public function getHmacKey() + { + return $this->getAttribute('hmacKey'); + } + + /** + * @param string $value + * + * @return $this + */ + public function setHmacKey($value) + { + return $this->setAttribute('hmacKey', $value); + } + + /** + * @return string + */ + public function getPublicKey() + { + return $this->getAttribute('publicKey'); + } + + /** + * @param string $value + * + * @return $this + */ + public function setPublicKey($value) + { + return $this->setAttribute('publicKey', $value); + } + + /** + * @return string + */ + public function getDeactivationTime() + { + return $this->getAttribute('deactivationTime'); + } +} diff --git a/src/Entities/Schema.php b/src/Entities/Schema.php index fd41001d8..e5e5b0583 100644 --- a/src/Entities/Schema.php +++ b/src/Entities/Schema.php @@ -345,6 +345,12 @@ public function __construct() 'payment-instruments/{paymentInstrumentId}' => function (array $content) { return new CommonPaymentInstrument($content); }, + 'credential-hashes/experian' => function (array $content) { + return new Collection(new ExperianCredential(), $content); + }, + 'credential-hashes/experian/{hash}' => function (array $content) { + return new ExperianCredential($content); + }, ]; } diff --git a/src/Services/ExperianCredentialsService.php b/src/Services/ExperianCredentialsService.php new file mode 100644 index 000000000..b3f449b5a --- /dev/null +++ b/src/Services/ExperianCredentialsService.php @@ -0,0 +1,59 @@ +client()->get('credential-hashes/experian'); + } + + /** + * @param array|JsonSerializable|ExperianCredential $data + * + * @return ExperianCredential + */ + public function create($data) + { + return $this->client()->post($data, 'credential-hashes/experian'); + } + + /** + * @param string $hash + * + * @return ExperianCredential + */ + public function load($hash) + { + return $this->client()->get('credential-hashes/experian/{hash}', ['hash' => $hash]); + } + + /** + * @param string $hash + * @param array|JsonSerializable|ExperianCredential $data + * + * @return ExperianCredential + */ + public function patch($hash, $data) + { + return $this->client()->patch($data, 'credential-hashes/experian/{hash}', ['hash' => $hash]); + } +} diff --git a/tests/Api/ApiTest.php b/tests/Api/ApiTest.php index 616a336b5..49e1d0fed 100644 --- a/tests/Api/ApiTest.php +++ b/tests/Api/ApiTest.php @@ -212,6 +212,7 @@ public function provideEntityClasses(): iterable [Entities\PaymentRetryAttempt::class], [Entities\GatewayAccountDowntime::class], [Entities\PlaidCredential::class, 'hash'], + [Entities\ExperianCredential::class, 'hash'], [Entities\CommonPaymentInstrument::class], ]; diff --git a/tests/Api/ServiceTest.php b/tests/Api/ServiceTest.php index d1fe2e622..f42d1ecfe 100644 --- a/tests/Api/ServiceTest.php +++ b/tests/Api/ServiceTest.php @@ -1351,6 +1351,11 @@ public function provideServiceClasses() Services\PlaidCredentialsService::class, Entities\PlaidCredential::class, ], + [ + 'experianCredentials', + Services\ExperianCredentialsService::class, + Entities\ExperianCredential::class, + ], [ 'webhooksTracking', Services\WebhookTrackingService::class, diff --git a/tests/TestCase.php b/tests/TestCase.php index b42664c15..899473c25 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -150,6 +150,9 @@ protected function getFakeValue($attribute, $class) case 'response': case 'acquirerReferenceNumber': case 'bic': + case 'hmacKey': + case 'publicKey': + case 'username': return $faker->word; case 'redirectUrl': return $redirectUrl;