diff options
author | Ivan Kohler <ivan@freeside.biz> | 2015-02-12 15:15:45 -0800 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2015-02-12 15:15:45 -0800 |
commit | 366780069456afaa344870cec40e664c202aafa7 (patch) | |
tree | 04333d1dbf7c5faf9da3edea553c86ba36a4422a /BatchPayment/Transport/HTTPS.pm | |
parent | 7f89ac335f82a836dfce165f72839f3b3c67070a (diff) | |
parent | 76e9eb92ac1dc0f8fc70a18f2cf5651afd1df301 (diff) |
Merge branch 'master' of git.freeside.biz:/home/git/Business-BatchPayment
Diffstat (limited to 'BatchPayment/Transport/HTTPS.pm')
-rw-r--r-- | BatchPayment/Transport/HTTPS.pm | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/BatchPayment/Transport/HTTPS.pm b/BatchPayment/Transport/HTTPS.pm index fdb2c35..0eb783b 100644 --- a/BatchPayment/Transport/HTTPS.pm +++ b/BatchPayment/Transport/HTTPS.pm @@ -14,29 +14,36 @@ use Net::HTTPS::Any 0.10; with 'Business::BatchPayment::Transport'; has [ qw( host port get_path put_path ) ] => ( - is => 'ro', + is => 'rw', isa => 'Str' ); has 'content_type' => ( is => 'rw', isa => 'Str', - default => 'text/plain' + default => '', # application/x-www-form-urlencoded ); sub https_post { my $self = shift; my $path = shift; my $content = shift; - - warn "starting https_post...\n" if $self->debug; - my ( $page, $response, %reply_headers ) = Net::HTTPS::Any::https_post( + my %post = ( host => $self->host, port => $self->port, path => $path, - content => $content, - debug => ($self->debug >= 3), + debug => ($self->debug > 3 ? 1 : 0), + 'Content-Type' => $self->content_type ); + if (ref $content and ref $content eq 'HASH') { + $post{'args'} = $content; + } else { + $post{'content'} = $content; + } + + warn "starting https_post...\n" if $self->debug; + my ( $page, $response, %reply_headers ) = Net::HTTPS::Any::https_post(%post); + warn "PAGE:\n$page\n\nRESPONSE:\n$response\n\n" if $self->debug >= 2; return ($page, $response, %reply_headers); } |