) = @_;
return Business::GoCardless::Webhook->new(
client => $self->client,
json => $data,
);
}
sub _generic_find_obj {
my ( $self,$id,$class,$sub_key ) = @_;
$cla
GoCardless::Utils';
use JSON ();
use Business::GoCardless::Client;
use Business::GoCardless::Exception;
use Business::GoCardless::Webhook::Event;
=head1 ATTRIBUTES
json
signature
has_le
}
=head2 json
Allows you to set the json data sent to you in the webhook:
$Webhook->json( $json_data )
Will throw a L<Business::GoCardless::Exception> exception if the json fails to
parse
has json => (
is => 'rw',
required => 1,
trigger => sub {
my ( $self,$json ) = @_;
# defensive decoding
my $params;
eval { $params = JSON->new->decode( $json ) };
ngs;
use Moo;
extends 'Business::GoCardless::Resource';
with 'Business::GoCardless::Utils';
use JSON ();
use Business::GoCardless::Exception;
=head1 ATTRIBUTES
resource_type
action
=cut
webhook
=head2 json
Allows you to set the json data sent to you in the webhook:
$Webhook->json( $json_data )
Will throw a L<Business::GoCardless::Exception> exception if the json fails to
parse
has json => (
is => 'rw',
required => 1,
trigger => sub {
my ( $self,$json ) = @_;
# defensive decoding
my $params;
eval { $params = JSON->new->decode( $json ) };
> $class,
client => $self->client,
links => $links,
info => $info ? JSON->new->decode( $info ) : {},
objects => \@objects,
);
}
=head1 AUTHOR
Lee Johnson -
ut extend it instead.
=cut
use strict;
use warnings;
use Moo;
use Carp qw/ carp confess /;
use JSON ();
=head1 ATTRIBUTES
=head2 endpoint
The gocardless API endpoint that corresponds to the reso
the object.
my %data = $Bill->to_hash;
=head2 to_json
Returns a json string representation of the object.
my $json = $Bill->to_json;
=cut
sub to_hash {
my ( $self ) = @_;
my %h
ash = %{ $self };
delete( $hash{client} );
return %hash;
}
sub to_json {
my ( $self ) = @_;
return JSON->new->canonical->encode( { $self->to_hash } );
}
=head1 AUTHOR
Lee Johnson -
onfess /;
use POSIX qw/ strftime /;
use MIME::Base64 qw/ encode_base64 /;
use LWP::UserAgent;
use JSON ();
=head1 ATTRIBUTES
=head2 token
Your gocardless API token, this attribute is required.
=he
eq->header( 'Authorization' => "Basic $credentials" );
$req->header( 'Accept' => 'application/json' );
$req->content_type( 'application/x-www-form-urlencoded' );
$req->content( $self->nor
header( 'Authorization' => "Bearer " . $self->token );
$req->header( 'Accept' => 'application/json' );
if ( $self->api_version > 1 ) {
# pegged to a specific version for this library
ut
use strict;
use warnings;
use Moo;
use JSON ();
use Carp qw/ cluck /;
with 'Throwable';
=head1 ATTRIBUTES
=head2 message
The error message, if JSON is passed this will be coerced to a string.
code.
=head2 response
The error response, generally the HTTP response.
=cut
# plain string or JSON
has message => (
is => 'ro',
required => 1,
coerce => sub {
my ( $mes
# defensive decoding
eval { $message = JSON->new->decode( $message ) };
$@ && do { return "Failed to parse JSON response ($message): $@"; };
if ( ref( $mess
a list.
=cut
use strict;
use warnings;
use Moo;
extends 'Business::GoCardless::Resource';
use JSON ();
use Business::GoCardless::Bill;
use Business::GoCardless::PreAuthorization;
use Business::Go
# defensive decoding
eval { $info = JSON->new->decode( $info ) };
$@ && do { return "Failed to parse JSON response ($info): $@"; };
}
return $info;
ts( %filter );
# on any resource object:
my %data = $Payment->to_hash;
my $json = $Payment->to_json;
=head1 PAGINATION
Any methods marked as B<pager> have a dual interface, when called
ect from the data sent to you via a
GoCardless webhook:
my $Webhook = $GoCardless->webhook( $json_data,$signature );
Note that GoCardless may continue to send old style webhooks even after you h
=> $self->client,
json => $data,
# load ordering handled by setting _signature rather than signature
# signature will be set in the json trigger
_signature =>
) = @_;
return Business::GoCardless::Webhook->new(
client => $self->client,
json => $data,
);
}
sub _generic_find_obj {
my ( $self,$id,$class,$sub_key ) = @_;
$cla