From 1bd6506437d1329616ee97321187b1868f6a76de Mon Sep 17 00:00:00 2001 From: Mark Wells Date: Thu, 31 Jan 2013 20:16:10 -0800 Subject: changes for cardfortress --- BatchPayment/Transport/HTTPS.pm | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'BatchPayment/Transport') 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); } -- cgit v1.2.1