Skip to content

Commit

Permalink
Renaming Address entity to PaymentAddress.
Browse files Browse the repository at this point in the history
  • Loading branch information
brentscheffler committed Jun 28, 2020
1 parent bb570c1 commit 95cc67a
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ For a full description of the response payload, please see the [official Plaid A

### Payment Initiation (UK only)

* `createRecipient(string $name, string $iban, Address $address): object` [[?]](https://plaid.com/docs/#payment-initiation) **Note:** See the **Entities** section for details about the `Address` entity needed for this method.
* `createRecipient(string $name, string $iban, PaymentAddress $address): object` [[?]](https://plaid.com/docs/#payment-initiation) **Note:** See the **Entities** section for details about the `PaymentAddress` entity needed for this method.
* `getRecipient(string $recipient_id): object` [[?]](https://plaid.com/docs/#payment-initiation)
* `listRecipients(): object` [[?]](https://plaid.com/docs/#payment-initiation)
* `createPayment(string $recipient_id, string $reference, float $amount, string $currency): object` [[?]](https://plaid.com/docs/#payment-initiation)
Expand All @@ -187,14 +187,14 @@ For a full description of the response payload, please see the [official Plaid A

## Entities

### Address
### PaymentAddress

The `TomorrowIdeas\Plaid\Entities\Address` entity is used to represent an address object for endpoints that require it. Currently, only the `createRecipient` method uses this entity.
The `TomorrowIdeas\Plaid\Entities\PaymentAddress` entity is used to represent an address object for the recipient of a payment request.

Example:

```php
$address = new TomorrowIdeas\Plaid\Entities\Address("123 Elm St.", "Apt 1", "Anytown", "ABC 123", "GB");
$address = new TomorrowIdeas\Plaid\Entities\PaymentAddress("123 Elm St.", "Apt 1", "Anytown", "ABC 123", "GB");
```

## Errors
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace TomorrowIdeas\Plaid\Entities;

class Address
class PaymentAddress
{
/**
* Street address.
Expand Down
8 changes: 4 additions & 4 deletions src/Plaid.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
use Shuttle\Shuttle;
use TomorrowIdeas\Plaid\Entities\Address;
use TomorrowIdeas\Plaid\Entities\PaymentAddress;

class Plaid
{
Expand Down Expand Up @@ -819,10 +819,10 @@ public function getWebhookVerificationKey(string $key_id): object
*
* @param string $name
* @param string $iban
* @param Address $address
* @param PaymentAddress $address
* @return object
*/
public function createRecipient(string $name, string $iban, Address $address): object
public function createRecipient(string $name, string $iban, PaymentAddress $address): object
{
$params = [
"name" => $name,
Expand Down Expand Up @@ -879,7 +879,7 @@ public function createPayment(string $recipient_id, string $reference, float $am
"recipient_id" => $recipient_id,
"reference" => $reference,
"amount" => [
"value" => (float) $amount,
"value" => $amount,
"currency" => $currency
]
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

namespace TomorrowIdeas\Plaid\Tests;

use TomorrowIdeas\Plaid\Entities\Address;
use TomorrowIdeas\Plaid\Entities\PaymentAddress;

/**
* @covers TomorrowIdeas\Plaid\Entities\Address
* @covers TomorrowIdeas\Plaid\Entities\PaymentAddress
*/
class AddressEntityTest extends TestCase
class PaymentAddressEntityTest extends TestCase
{
public function test_to_array_with_single_street(): void
{
$address = new Address("123 Elm St", null, "Anytown", "ABC 123", "US");
$address = new PaymentAddress("123 Elm St", null, "Anytown", "ABC 123", "US");

$this->assertEquals(
[
Expand All @@ -26,7 +26,7 @@ public function test_to_array_with_single_street(): void

public function test_to_array_with_additional_street(): void
{
$address = new Address("123 Elm St", "Apt A", "Anytown", "ABC 123", "US");
$address = new PaymentAddress("123 Elm St", "Apt A", "Anytown", "ABC 123", "US");

$this->assertEquals(
[
Expand Down
6 changes: 3 additions & 3 deletions tests/PaymentInitiationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

namespace TomorrowIdeas\Plaid\Tests;

use TomorrowIdeas\Plaid\Entities\Address;
use TomorrowIdeas\Plaid\Entities\PaymentAddress;

/**
* @covers TomorrowIdeas\Plaid\Plaid
* @covers TomorrowIdeas\Plaid\Entities\Address
* @covers TomorrowIdeas\Plaid\Entities\PaymentAddress
*/
class PaymentInitiationTest extends TestCase
{
public function test_create_recipient(): void
{
$response = $this->getPlaidClient()->createRecipient("name", "iban", new Address("139 The Esplanade", null, "Weymouth", "DT4 7NR", "GB"));
$response = $this->getPlaidClient()->createRecipient("name", "iban", new PaymentAddress("139 The Esplanade", null, "Weymouth", "DT4 7NR", "GB"));

$this->assertEquals("POST", $response->method);
$this->assertEquals("2019-05-29", $response->version);
Expand Down

0 comments on commit 95cc67a

Please sign in to comment.