class BankIDResponse

Upstream API response value object.

Represents a direct response payload from the BankID REST API (auth, sign, collect, or cancel) containing raw protocol fields, hint codes, and completion data.

Constants

STATUS_OK

STATUS_COMPLETE

STATUS_PENDING

STATUS_FAILED

HINT_CODE_NO_CLIENT

HINT_CODE_USER_CANCEL

HINT_CODE_EXPIRED_TRANSACTION

HINT_CODE_USER_SIGN

HINT_CODE_OUTSTANDING_TRANSACTION

HINT_CODE_STARTED

HINT_CODE_CERTIFICATE_ERROR

HINT_CODE_START_FAILED

HINT_CODE_USER_MRTD

HINT_CODE_USER_CALL_CONFIRM

ERROR_CODE_CANCELED

ERROR_CODE_ALREADY_IN_PROGRESS

ERROR_CODE_REQUEST_TIMEOUT

ERROR_CODE_MAINTENANCE

ERROR_CODE_INTERNAL_ERROR

ERROR_CODE_INVALID_PARAMETERS

ERROR_CODE_UNAUTHORIZED

ERROR_CODE_NOT_FOUND

ERROR_CODE_METHOD_NOT_ALLOWED

ERROR_CODE_UNSUPPORTED_MEDIA_TYPE

ERROR_CODE_CLIENT_CONSTRUCT_ERROR

RFA1

RFA2

RFA3

RFA4

RFA5

RFA6

RFA8

RFA9

RFA13

RFA14A

RFA14B

RFA15A

RFA15B

RFA16

RFA17A

RFA17B

RFA18

RFA19

RFA20

RFA21

RFA22

RFA23

Properties

protected string $orderRef

The order reference.

protected string $status

BankIDResponse status.

protected string|null $autoStartToken

The auto start token.

protected string|null $qrStartToken

The QR start token.

protected string|null $qrStartSecret

The QR start secret.

protected string|null $hintCode

The hint code.

protected string|null $errorCode

The error code.

protected string|null $details

Error details.

protected array<string, mixed>|null $completionData

The completion data.

protected array<string, mixed> $body

BankIDResponse body.

Methods

__construct(string $orderRef, string $status = self::STATUS_OK, array|null $body = NULL)

Constructs a new BankIDResponse object.

static BankIDResponse
fromPayload(string $orderRef, string $status, array $payload = [])

Creates a response from a raw payload array.

static BankIDResponse
createStart(string $order_ref, string $auto_start_token, string $qr_start_token, string $qr_start_secret, array $payload = [])

Creates a successful order start response.

static BankIDResponse
createCollectPending(string $order_ref, string $hint_code, array $payload = [])

Creates a pending collect response.

static BankIDResponse
createCollectComplete(string $order_ref, array $completion_data, array $payload = [])

Creates a completed collect response.

static BankIDResponse
createCollectFailed(string $order_ref, string $hint_code, array $payload = [])

Creates a failed collect response with a hint code.

static BankIDResponse
createCancel(string $order_ref, array $payload = [])

Creates a successful cancel response.

bool
isSuccess()

Checks if the response represents a success/pending state.

bool
isFailed()

Checks if the response represents a failed state.

string|null
getShortName()

Get the short name.

array
getBody()

Get the body.

string
getStatus()

Get the status.

string
getOrderRef()

Get the order reference.

string|null
getQrStartSecret()

Get the qr start secret.

string|null
getQrStartToken()

Get the qr start token.

array|null
getCompletionData()

Get the completion data.

string|null
getPersonalNumber()

Get the personalNumber.

string|null
getErrorCode()

Get the error code.

string|null
getErrorDetails()

Get the details.

string|null
getHintCode()

Get the hint code.

string|null
getAutoStartToken()

Get the auto start token.

Details

at line 135
__construct(string $orderRef, string $status = self::STATUS_OK, array|null $body = NULL)

Constructs a new BankIDResponse object.

Parameters

string $orderRef

The order reference.

string $status

The status of the response.

array|null $body

The body of the response.

at line 164
static BankIDResponse fromPayload(string $orderRef, string $status, array $payload = [])

Creates a response from a raw payload array.

Parameters

string $orderRef

The order reference.

string $status

The status.

array $payload

The payload array.

Return Value

BankIDResponse

A new instance.

at line 185
static BankIDResponse createStart(string $order_ref, string $auto_start_token, string $qr_start_token, string $qr_start_secret, array $payload = [])

Creates a successful order start response.

Parameters

string $order_ref

The order reference.

string $auto_start_token

The auto start token.

string $qr_start_token

The QR start token.

string $qr_start_secret

The QR start secret.

array $payload

Optional extra payload data.

Return Value

BankIDResponse

A new start response instance.

at line 211
static BankIDResponse createCollectPending(string $order_ref, string $hint_code, array $payload = [])

Creates a pending collect response.

Parameters

string $order_ref

The order reference.

string $hint_code

The hint code.

array $payload

Optional extra payload data.

Return Value

BankIDResponse

A new pending response instance.

at line 229
static BankIDResponse createCollectComplete(string $order_ref, array $completion_data, array $payload = [])

Creates a completed collect response.

Parameters

string $order_ref

The order reference.

array $completion_data

The completion data.

array $payload

Optional extra payload data.

Return Value

BankIDResponse

A new complete response instance.

at line 247
static BankIDResponse createCollectFailed(string $order_ref, string $hint_code, array $payload = [])

Creates a failed collect response with a hint code.

Parameters

string $order_ref

The order reference.

string $hint_code

The failure hint code.

array $payload

Optional extra payload data.

Return Value

BankIDResponse

A new failed response instance.

at line 263
static BankIDResponse createCancel(string $order_ref, array $payload = [])

Creates a successful cancel response.

Parameters

string $order_ref

The order reference.

array $payload

Optional payload data.

Return Value

BankIDResponse

A new instance.

at line 273
bool isSuccess()

Checks if the response represents a success/pending state.

Return Value

bool

TRUE if status is OK, complete, or pending.

at line 283
bool isFailed()

Checks if the response represents a failed state.

Return Value

bool

TRUE if status is failed.

at line 290
string|null getShortName()

Get the short name.

Return Value

string|null

at line 300
array getBody()

Get the body.

Return Value

array

The response body.

at line 307
string getStatus()

Get the status.

Return Value

string

at line 314
string getOrderRef()

Get the order reference.

Return Value

string

at line 321
string|null getQrStartSecret()

Get the qr start secret.

Return Value

string|null

at line 328
string|null getQrStartToken()

Get the qr start token.

Return Value

string|null

at line 338
array|null getCompletionData()

Get the completion data.

Return Value

array|null

The completion data or NULL.

at line 345
string|null getPersonalNumber()

Get the personalNumber.

Return Value

string|null

at line 358
string|null getErrorCode()

Get the error code.

Return Value

string|null

at line 365
string|null getErrorDetails()

Get the details.

Return Value

string|null

at line 372
string|null getHintCode()

Get the hint code.

Return Value

string|null

at line 379
string|null getAutoStartToken()

Get the auto start token.

Return Value

string|null