Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
craigpotter committed May 15, 2023
1 parent b8717fb commit bbe3bb4
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 5 deletions.
1 change: 0 additions & 1 deletion .github/FUNDING

This file was deleted.

43 changes: 40 additions & 3 deletions .github/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ $fca = new Fca('my.email@dev.test', 'my-api-key');

$paginatedData = $fa->firm(12345)->individuals(); // Returns a Saloon response object

$paginatedData->getTotalPages(); // Returns the total number of pages
$paginatedData->getTotalResults(); // Returns the total number of results
$paginatedData->totalPages(); // Returns the total number of pages
$paginatedData->totalResults(); // Returns the total number of results
foreach ($paginatedData as $page) {
$paginatedData->getCurrentPage(); // Returns the current page number
$individuals = $page->dto(); // Returns an array of Individual DTOs for this page
Expand All @@ -115,10 +115,47 @@ foreach ($paginatedData as $page) {
$individual->status; // "Approved by regulator"
}
}

```

#### Get the addresses associated with a firm by FRN
This endpoint is paginated and will return a maximum of 20 results per page.
You should loop through the pages to get all results.
```php
use CraigPotter\Fca\Fca;

// Create a new FCA instance (This is required for all requests)
use CraigPotter\Fca\Fca;

// Create a new FCA instance (This is required for all requests)
$fca = new Fca('my.email@dev.test', 'my-api-key');

// 12345 is the FCA firm reference number

$paginatedData = $fa->firm(12345)->addresses(); // Returns a Saloon response object

$paginatedData->totalPages(); // Returns the total number of pages
$paginatedData->totalResults(); // Returns the total number of results
foreach ($paginatedData as $page) {
$paginatedData->getCurrentPage(); // Returns the current page number
$addresses = $page->dto(); // Returns an array of Address DTOs for this page
$json = $page->json(); // Returns the raw JSON response for this page


foreach ($addresses as $address) {
$address->website; // "www.example.org"
$address->phoneNumber; // "44123456778"
$address->type; // "Principal Place of Business"
$address->contactName; // "John Smith"
$address->addressLine1; // "1 Example Street"
$address->addressLine2; // "Aberdeen"
$address->addressLine3; // "Aberdeen"
$address->addressLine4; // "Aberdeen"
$address->town; // "Aberdeen"
$address->county; // "Aberdeenshire"
$address->country; // "United Kingdom"
$address->postcode; // "AB1 2CD"
}
}
```

## Testing
Expand Down
2 changes: 1 addition & 1 deletion src/DataObjects/Firm.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public static function fromResponse(Response $response): self
ray($data);

return new static(

Check failure on line 28 in src/DataObjects/Firm.php

View workflow job for this annotation

GitHub Actions / phpstan

Unsafe usage of new static().
$data['FRN'],
(int) $data['FRN'],
$data['Organisation Name'],
$data['Business Type'],
$data['Status'],
Expand Down

0 comments on commit bbe3bb4

Please sign in to comment.