ABN Module
Validation Rules
This module adds Laravel validation rules for ABNs and ACNs. These check the format only using the checksum algorithms.
- https://abr.business.gov.au/Help/AbnFormat
- https://asic.gov.au/for-business/registering-a-company/steps-to-register-a-company/australian-company-numbers/australian-company-number-digit-check/
Business Lookup using the ABN API
The ABNLookupService allows you to check the business details from the API. It returns a ABNResultDTO response with details about active status, address and name. If no matching business was found the service will return null.
If the ABN was invalid (wrong format), or the actual request fails the service will throw an Exception. The calling code can decide how to handle that Exception.
Usage
use Modules\ABN\Services\ABNLookupClient;
use Modules\ABN\Services\ABNLookupService;
try {
$abnToCheck = '51824753556';
$client = new ABNLookupClient(config('abn.apiGuid'));
$abnService = new ABNLookupService($client);
$dto = $abnService->lookup($abnToCheck);
// Check if business registration is active.
$dto->businessActive();
// Business' state.
$dto->state;
} catch (Exception $e) {
// ...
}
API lookups are currently only supported for ABNs.
About Business Names
Different types of 'name' might be present depending on the type of business being checked. For example sole traders might have the legalName object on the respose (the individual's own name), while registered businesses or companies might have mainName and optionally a tradingName (or names).
The DTO will contain mainName, tradingName and legalName objects (each may be null).