use strict;
use Carp;
-use Business::OnlinePayment;
+use Business::OnlinePayment 3;
+use Business::OnlinePayment::HTTPS;
use Business::CreditCard;
-use Net::SSLeay qw( post_https );
use XML::Simple;
-use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $DEBUG);
+use vars qw($VERSION @ISA $DEBUG);
-require Exporter;
-
-@ISA = qw(Exporter AutoLoader Business::OnlinePayment);
-@EXPORT = qw();
-@EXPORT_OK = qw();
+@ISA = qw(Business::OnlinePayment::HTTPS);
$VERSION = '0.01';
-$DEBUG = 1;
+$DEBUG = 0;
my $default_path = '/gateway/xmlpayment.asp';
my $default_cvn_path = '/gateway_cvn/xmlpayment.asp';
if ( $DEBUG ) {
warn $pd,"\n";
}
- my $server = $self->server();
- my $port = $self->port();
- my $path = $self->path();
- if ($post_data{ewayCVN} && $path eq $default_path){
- $path = $default_cvn_path;
+ my $oldpath = $self->path;
+ if ($post_data{ewayCVN} && $self->path eq $default_path){
+ $self->path($default_cvn_path);
}
if ($self->test_transaction) {
- if ($path eq $default_path) {
- $path = $default_test_path;
- }elsif ($path eq $default_cvn_path){
- $path = $default_cvn_test_path;
+ if ($self->path eq $default_path) {
+ $self->path($default_test_path);
+ }elsif ($self->path eq $default_cvn_path){
+ $self->path($default_cvn_test_path);
}else{
- croak "Test mode not supported for path: $path\n";
+ croak "Test mode not supported for path: " . $self->path . "\n";
}
}
- my($page,$server_response) =
- post_https($server,$port,$path,'',$pd);
+ my($page,$server_response) = $self->https_post($pd);
+ $self->path($oldpath);
if ( $DEBUG ) {
warn $page,"\n";
}
my $response;
- if ($server_response =~ /HTTP\/1\.1 200 OK/){
+ if ($server_response =~ /200/){
$response = XMLin($page);
}else{
$response->{ewayTrxnError} = $server_response;