diff options
author | Mark Wells <mark@freeside.biz> | 2013-01-31 20:16:10 -0800 |
---|---|---|
committer | Mark Wells <mark@freeside.biz> | 2013-01-31 20:16:10 -0800 |
commit | 1bd6506437d1329616ee97321187b1868f6a76de (patch) | |
tree | dbb84a141084d8f2ee5839b4124f5ae125d0afd3 /BatchPayment/Transport | |
parent | 0bf7a1ffc63873be09e848b900d89eb23cb99beb (diff) |
changes for cardfortress
Diffstat (limited to 'BatchPayment/Transport')
-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); } |