Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ACL-80] Signup Plus #72

Merged
merged 12 commits into from
Feb 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.idea
.phpunit.cache
.phpunit.result.cache
.php-cs-fixer.cache
vendor/
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres
to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [3.0.2] - 2025-02-27

### Added

- Support for SignUp Plus authentication link creation
- Support for SignUp Plus user data retrieval

## [3.0.1] - 2025-01-09

### Changed
Expand Down
32 changes: 28 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@
10. [Payouts](#payouts)
11. [Merchant accounts](#merchant-accounts)
12. [Account identifiers](#account-identifiers)
13. [Receiving webhook notifications](#webhooks)
14. [Custom idempotency keys](#idempotency)
15. [Custom API calls](#custom-api-calls)
16. [Error Handling](#error-handling)
13. [SignUp Plus](#signup-plus)
14. [Receiving webhook notifications](#webhooks)
15. [Custom idempotency keys](#idempotency)
16. [Custom API calls](#custom-api-calls)
17. [Error Handling](#error-handling)

<a name="why"></a>

Expand Down Expand Up @@ -1011,6 +1012,29 @@ foreach ($merchantAccount->getAccountIdentifiers() as $accountIdentifier) {
}
```

<a name="signup-plus"></a>

# SignUp Plus

Generating a SignUp Plus authentication link:

```php
$client->signupPlus()
->authUri()
->paymentId('some_payment_id')
->state('some_state')
->create();
```

Retrieving user data:

```php
$response = $client->signupPlus()
->userData()
->paymentId('fake_payment_id')
->retrieve(); // SignupPlusUserDataRetrievedInterface
```

<a name="webhooks"></a>

# Receiving webhook notifications
Expand Down
8 changes: 8 additions & 0 deletions config/bindings.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
Interfaces\HppInterface::class => 'makeHpp',

Interfaces\AddressInterface::class => Entities\Address::class,
Interfaces\AddressRetrievedInterface::class => Entities\AddressRetrieved::class,
Interfaces\UserInterface::class => Entities\User::class,

Interfaces\Payment\Beneficiary\BeneficiaryBuilderInterface::class => Entities\Payment\Beneficiary\BeneficiaryBuilder::class,
Expand Down Expand Up @@ -109,5 +110,12 @@
Interfaces\Webhook\Beneficiary\ExternalAccountBeneficiaryInterface::class => Entities\Webhook\Beneficiary\ExternalAccountBeneficiary::class,
Interfaces\Webhook\Beneficiary\BeneficiaryInterface::class => Entities\Webhook\Beneficiary\Beneficiary::class,

Interfaces\SignupPlus\SignupPlusBuilderInterface::class => Entities\SignupPlus\SignupPlusBuilder::class,
Interfaces\SignupPlus\SignupPlusAuthUriRequestInterface::class => Entities\SignupPlus\SignupPlusAuthUriRequest::class,
Interfaces\SignupPlus\SignupPlusAuthUriCreatedInterface::class => Entities\SignupPlus\SignupPlusAuthUriCreated::class,
Interfaces\SignupPlus\SignupPlusAccountDetailsInterface::class => Entities\SignupPlus\SignupPlusAccountDetails::class,
Interfaces\SignupPlus\SignupPlusUserDataRequestInterface::class => Entities\SignupPlus\SignupPlusUserDataRequest::class,
Interfaces\SignupPlus\SignupPlusUserDataRetrievedInterface::class => Entities\SignupPlus\SignupPlusUserDataRetrieved::class,

Interfaces\RequestOptionsInterface::class => Entities\RequestOptions::class,
];
3 changes: 3 additions & 0 deletions src/Constants/Endpoints.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,7 @@ class Endpoints

public const PAYOUTS_CREATE = '/v3/payouts';
public const PAYOUTS_RETRIEVE = '/v3/payouts/{id}';
public const SIGNUP_PLUS_AUTH = '/signup-plus/authuri';
public const SIGNUP_PLUS_PAYMENTS = '/signup-plus/payments?payment_id={id}';
public const SIGNUP_PLUS_MANDATES = '/signup-plus/mandates?mandate_id={id}';
}
92 changes: 1 addition & 91 deletions src/Entities/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,58 +6,8 @@

use TrueLayer\Interfaces\AddressInterface;

class Address extends Entity implements AddressInterface
class Address extends AddressRetrieved implements AddressInterface
{
/**
* @var string
*/
protected string $addressLine1;

/**
* @var string
*/
protected string $addressLine2;

/**
* @var string
*/
protected string $city;

/**
* @var string
*/
protected string $state;

/**
* @var string
*/
protected string $zip;

/**
* @var string
*/
protected string $countryCode;

/**
* @var string[]
*/
protected array $arrayFields = [
'address_line1',
'address_line2',
'city',
'state',
'zip',
'country_code',
];

/**
* @return string|null
*/
public function getAddressLine1(): ?string
{
return $this->addressLine1 ?? null;
}

/**
* @param string $addressLine1
*
Expand All @@ -70,14 +20,6 @@ public function addressLine1(string $addressLine1): AddressInterface
return $this;
}

/**
* @return string|null
*/
public function getAddressLine2(): ?string
{
return $this->addressLine2 ?? null;
}

/**
* @param string $addressLine2
*
Expand All @@ -90,14 +32,6 @@ public function addressLine2(string $addressLine2): AddressInterface
return $this;
}

/**
* @return string|null
*/
public function getCity(): ?string
{
return $this->city ?? null;
}

/**
* @param string $city
*
Expand All @@ -110,14 +44,6 @@ public function city(string $city): AddressInterface
return $this;
}

/**
* @return string|null
*/
public function getState(): ?string
{
return $this->state ?? null;
}

/**
* @param string $state
*
Expand All @@ -130,14 +56,6 @@ public function state(string $state): AddressInterface
return $this;
}

/**
* @return string|null
*/
public function getZip(): ?string
{
return $this->zip ?? null;
}

/**
* @param string $zip
*
Expand All @@ -150,14 +68,6 @@ public function zip(string $zip): AddressInterface
return $this;
}

/**
* @return string|null
*/
public function getCountryCode(): ?string
{
return $this->countryCode ?? null;
}

/**
* @param string $countryCode
*
Expand Down
100 changes: 100 additions & 0 deletions src/Entities/AddressRetrieved.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
<?php

declare(strict_types=1);

namespace TrueLayer\Entities;

use TrueLayer\Interfaces\AddressRetrievedInterface;

class AddressRetrieved extends Entity implements AddressRetrievedInterface
{
/**
* @var string
*/
protected string $addressLine1;

/**
* @var string
*/
protected string $addressLine2;

/**
* @var string
*/
protected string $city;

/**
* @var string
*/
protected string $state;

/**
* @var string
*/
protected string $zip;

/**
* @var string
*/
protected string $countryCode;

/**
* @var string[]
*/
protected array $arrayFields = [
'address_line1',
'address_line2',
'city',
'state',
'zip',
'country_code',
];

/**
* @return string|null
*/
public function getAddressLine1(): ?string
{
return $this->addressLine1 ?? null;
}

/**
* @return string|null
*/
public function getAddressLine2(): ?string
{
return $this->addressLine2 ?? null;
}

/**
* @return string|null
*/
public function getCity(): ?string
{
return $this->city ?? null;
}

/**
* @return string|null
*/
public function getState(): ?string
{
return $this->state ?? null;
}

/**
* @return string|null
*/
public function getZip(): ?string
{
return $this->zip ?? null;
}

/**
* @return string|null
*/
public function getCountryCode(): ?string
{
return $this->countryCode ?? null;
}
}
Loading
Loading