class BankIDResponseFactory implements BankIDResponseFactoryInterface

Factory for creating BankIDResponse instances from HTTP responses and errors.

Methods

fromStartResponse(ResponseInterface $response)

Creates a BankIDResponse from a successful HTTP start response.

fromCollectResponse(ResponseInterface $response)

Creates a BankIDResponse from a successful HTTP collect response.

fromCancelResponse(ResponseInterface $response, string $orderRef)

Creates a BankIDResponse from a successful HTTP cancel response.

never
fromThrowable(Throwable $e, string|null $orderRef = NULL)

Throws a BankIDRequestException from a caught throwable or API error.

never
fromClientConfigurationError(string $message = 'BankID client could not be configured. Please verify key settings.')

Throws a BankIDRequestException when the client cannot be configured.

array
decodeResponse(ResponseInterface $response)

Decodes a PSR-7 response body to an array.

Details

at line 21
BankIDResponse fromStartResponse(ResponseInterface $response)

Creates a BankIDResponse from a successful HTTP start response.

Parameters

ResponseInterface $response

The HTTP response.

Return Value

BankIDResponse

The BankID response.

Exceptions

BankIDRequestException

at line 45
BankIDResponse fromCollectResponse(ResponseInterface $response)

Creates a BankIDResponse from a successful HTTP collect response.

Parameters

ResponseInterface $response

The HTTP response.

Return Value

BankIDResponse

The BankID response.

Exceptions

BankIDRequestException

at line 74
BankIDResponse fromCancelResponse(ResponseInterface $response, string $orderRef)

Creates a BankIDResponse from a successful HTTP cancel response.

Parameters

ResponseInterface $response

The HTTP response.

string $orderRef

The order reference.

Return Value

BankIDResponse

The BankID response.

at line 82
never fromThrowable(Throwable $e, string|null $orderRef = NULL)

Throws a BankIDRequestException from a caught throwable or API error.

Parameters

Throwable $e

The throwable.

string|null $orderRef

Optional order reference.

Return Value

never

This method always throws an exception.

Exceptions

BankIDRequestException

at line 139
never fromClientConfigurationError(string $message = 'BankID client could not be configured. Please verify key settings.')

Throws a BankIDRequestException when the client cannot be configured.

Parameters

string $message

Optional error message.

Return Value

never

This method always throws an exception.

Exceptions

BankIDRequestException

at line 155
protected array decodeResponse(ResponseInterface $response)

Decodes a PSR-7 response body to an array.

Parameters

ResponseInterface $response

The HTTP response.

Return Value

array

The decoded response body array.