NAME

Business::TrueLayer::Webhook

SYNOPSIS

my $Webhook = Business::TrueLayer::Webhook->new({
    jwt  => $jwt,
    jwks => $jwkset, # optional
});

DESCRIPTION

A class for TrueLayer webhooks

For more details see the TreuLayer API documentation specific to webhooks: https://docs.truelayer.com/docs/mandate-webhooks

ATTRIBUTES

jwt

The JWT as sent in the webhook by TrueLayer - this is required in the object constructor as its signature will be validated and the payload will be used to populate more data on the object.

jwkset

A JWKS used to validate the signature of the JWT. This can be provided as an array reference of keys, however if not provide the jku in the JWT will be used to download the JWKS.

jku_accept_list

A hashref of acceptable URLs that can provide the JWKS. Keyed by URL:

{
    $url => 1,
    $alternative_url => 1,
}

If the jku in the JWT is not amongst the keys of the jku_accept_list then an exception will be thrown.

Operations on a webhook

resource

Returns an object (Business::TrueLayer::Webhook::Payment, ...::Mandate, etc) that the webhook is referring to allowing you to do things with it or update your own data:

if ( $Webhook->is_payment ) {
    my $Payment = $Webhook->resource;
    ...
} elsif ( $Webhook->is_mandate ) {
    my $Mandate = $Webhook->resource;
    ...
}

is_payment

is_mandate

Shortcut methods to get the type of data in the webhook, and thus the type of objects that will be returned by the call to ->resources

SEE ALSO

Business::TrueLayer::Webhook::Payment

Business::TrueLayer::Webhook::Mandate