Business-GoCardless

 view release on metacpan or  search on metacpan

lib/Business/GoCardless/Client.pm  view on Meta::CPAN

        resource_id   => $params->{resource_id},
        resource_type => $params->{resource_type},
    };

    my $credentials = encode_base64( $self->app_id . ':' . $self->app_secret );
    $credentials    =~ s/\s//g;

    my $ua = LWP::UserAgent->new;
    $ua->agent( $self->user_agent );

    my $req = HTTP::Request->new(
        POST => join( '/',$self->base_url . $self->api_path,'confirm' )
    );

    $req->header( 'Authorization' => "Basic $credentials" );
    $req->header( 'Accept' => 'application/json' );

    $req->content_type( 'application/x-www-form-urlencoded' );
    $req->content( $self->normalize_params( $data ) );

    my $res = $ua->request( $req );

lib/Business/GoCardless/Client.pm  view on Meta::CPAN

    my ( $self,$path,$params ) = @_;
    return $self->_api_request( 'PUT',$path,$params );
}

sub _api_request {
    my ( $self,$method,$path,$params ) = @_;

    my $ua = LWP::UserAgent->new;
    $ua->agent( $self->user_agent );

    my $req = HTTP::Request->new(
        # passing through the absolute URL means we don't build it
        $method => my $uri = $path =~ /^http/
            ? $path : join( '/',$self->base_url . $self->api_path . $path ),
    );

    say STDERR "GOCARDLESS -> $uri" if $ENV{GOCARDLESS_DEBUG};

    $req->header( 'Authorization' => "Bearer " . $self->token );
    $req->header( 'Accept' => 'application/json' );



( run in 0.301 second using v1.01-cache-2.11-cpan-de7293f3b23 )