package PayProp::API::Public::Client::Role::JSON;
use strict;
use warnings;
use Mouse::Role;
sub TO_JSON {
my ( $self, $value, $structure ) = @_;
$value //= $self unless $structure;
$structure
@items, $self->TO_JSON( $item, $structure );
}
return \@items;
}
elsif ( $ref_type eq 'HASH' ) {
foreach my $key ( keys $value->%* ) {
$structure->{ $key } = $self->TO_JSON( $value->{ $key
my $item = $value->$reader;
$structure->{ $key } //= {};
$structure->{ $key } = $self->TO_JSON( $item, $structure->{ $key } );
}
}
else {
die "Unhandled ref_type: $ref_type";
}
return
},
})
;
}
sub _get_beneficiaries {
my ( $self, $response_json ) = @_;
my @beneficiaries;
for my $beneficiary ( @{ $response_json->{items} // [] } ) {
my $Beneficiary = PayProp::API::Public:
ntent = $args->{content};
return $self
->api_request_p({
method => 'POST',
content => { json => $content },
handle_response_cb => sub { $self->_get_tags( @_ ) },
})
;
}
sub link_entit
rn $self
->api_request_p({
method => 'POST',
path_params => $path_params,
content => { json => $content },
handle_response_cb => sub { $self->_get_tags( @_ ) },
})
;
}
sub list_tagge
urn $self
->api_request_p({
method => 'PUT',
path_params => $path_params,
content => { json => $req_content },
handle_response_cb => sub { $self->_get_tags( @_ ) },
})
;
}
sub delete
for returned values.
$self
->post_req_p({
params => {},
headers => {},
content => { json => { ... } },
})
->then( sub {
my ( $Transaction, ... ) = @_;
...;
} )
->wait
;
=
> for returned values.
$self
->put_req_p({
params => {},
headers => {},
content => { json => { ... } },
})
->then( sub {
my ( $Transaction, ... ) = @_;
...;
} )
->wait
;
=
my ( $Transaction ) = @_;
my $Result = $Transaction->result;
my $json = $Result->json // {};
my $access_token = $json->{access_token};
PayProp::API::Public::Client::Exception::Authoriza
status_code => $Result->code,
errors => [
{
code => $json->{error} // 'NO_ERROR_CODE',
message => $json->{error_description} // 'NO_ERROR_MESSAGE',
},
],
)
unl
nings;
use Mouse;
use Mouse::Util::TypeConstraints;
with qw/ PayProp::API::Public::Client::Role::JSON /;
has id => ( is => 'ro', isa => 'Str' );
has tax => ( is =>
>json;
} )
->then( sub {
my ( $response_json ) = @_;
return (
( $handle_response_cb ? $handle_response_cb->( $response_json ) : $response_json ),
{
pagination => $response_json
{
my ( $self, $Result ) = @_;
return undef if $Result->is_success;
my $json = $Result->json // {};
my $errors = $json->{errors} // [ { path => '/NO_PATH', message => 'NO_ERROR_MESSAGE' } ];
P
nings;
use Mouse;
use Mouse::Util::TypeConstraints;
with qw/ PayProp::API::Public::Client::Role::JSON /;
subtype 'NumOrStr' => as 'Num | Str';
has id => ( is => 'ro', isa => 'Str
enants( @_ ) },
})
;
}
sub _get_tenants {
my ( $self, $response_json ) = @_;
my @tenants;
for my $tenant ( @{ $response_json->{items} // [] } ) {
my $Tenant = PayProp::API::Public::Client::R
ntent = $args->{content};
return $self
->api_request_p({
method => 'POST',
content => { json => $content },
handle_response_cb => sub { $self->_get_invoice( @_ ) },
})
;
}
sub update
> $path_params,
content => { json => $content },
handle_response_cb => sub { $self->_get_invoice( @_ ) },
})
;
}
sub _get_invoice {
my ( $self, $response_json ) = @_;
my $Invoice = PayPro
_json->{id},
tax => $response_json->{tax},
amount => $response_json->{amount},
has_tax => $response_json->{has_tax},
end_date => $response_json-
ntent = $args->{content};
return $self
->api_request_p({
method => 'POST',
content => { json => $content },
handle_response_cb => sub { $self->_get_payment( @_ ) },
})
;
}
sub update_
> $path_params,
content => { json => $content },
handle_response_cb => sub { $self->_get_payment( @_ ) },
})
;
}
sub _get_payment {
my ( $self, $response_json ) = @_;
my $Payment = PayPro
=> $response_json->{id},
tax => $response_json->{tax},
amount => $response_json->{amount},
enabled => $response_json->{enabled},
has_tax
:Beneficiary;
use strict;
use warnings;
use Mouse;
with qw/ PayProp::API::Public::Client::Role::JSON /;
has id => (is => 'ro', isa => 'Str' );
has is_owner => (is => 'ro'
port::Tenant;
use strict;
use warnings;
use Mouse;
with qw/ PayProp::API::Public::Client::Role::JSON /;
has id => (is => 'ro', isa => 'Str' );
has notify_sms => (is => 'ro',
esponse::Tag;
use strict;
use warnings;
use Mouse;
with qw/ PayProp::API::Public::Client::Role::JSON /;
has name => (is => 'ro', isa => 'Str');
has id => (is => 'ro', isa => 'Str' );
has type