Alright, Here is my last 2nd and last problem.
 
Again in the top I added the var's...
 
qw( I added $merchID $price $Tprice $domprice
 
also I added
use Net::SSLeay qw(post_https make_form);
for the subroutine below (charge)
 
In the listed subroutine I was having lots of problems. I am doing this in the Test environment, so I added a fake credit card to it...
 
sub process_order {
 
# At the bottom, just above
 
    my $xcp_request = {
        action => "sw_register",
        object => "domain",
        attributes => $data,
    };
    my $register_results = $XML_Client->send_cmd( $xcp_request );
    unless  ($register_results->{is_success}) {
        throw Exception "Register","Error occured while was trying to process your order:<br>\n".$register_results->{response_text};
    }
 
# I added this line... (charge() being the last subroutine - sub charge {
 
    if ($in{p_cc_num} != 4111111111111111) { # if the card presented is 4111111111111111 then ignore that subroutine and process order.. THAT WORKS..
  if(!charge()) {
    throw Exception "Register", "Sorry, Your card was denied. Please use a different card.\n";
  }
} # I really think the problem is either in the throw exception, but yet I am not sure because....
 
 
Here is the sub charge { subroutine...
 
 
sub charge {
 
if ($in{email_bundle} == 1) {
my $domprice = "26.95";
} else {
my $domprice = "13.95";
}
 

my $price += $domprice*$in{period};
 
$price = sprintf("%.2f", $price); # I am not sure what this does, but I THINK it formats the dollar amount so that it's xx.xx not xx.xxxxxxx
 
my ($page, $response, %headers) = post_https('www.mygate.way', 443,
        '/securedir/file.asp', '',
        make_form(
         'Amount' => $price,
         'CC_Number' => $in{p_cc_num},
         'Name' => "$in{billing_first_name} $in{billing_last_name}",
         'Month' => $in{p_cc_exp_mon},
         'Year' => $in{p_cc_exp_yr},
         'Street' => $in{billing_address1},
         'City' =>  $in{billing_city},
         'State' => $in{billing_state},
         'Zip' => $in{billing_postal_code},
         'Email' => $in{billing_email},
         'Merch_ID' => $merchID, #  $merchID is defined in OpenSRS.conf
         'Tr_Type' => 'PREAUTH',
                                    'Comment1' => $in{Comment1},
                                    'Comment2' => $in{renewal_period},
         'AVSREQ' => '0',
 
         ));
 
my ($a, $num, $c, $d) = split /\,/, $page, 4; # my Gateway company sends back 4 variables, first of which is either Y for approved or N for declined...
 

if($a eq 'Y') { # therefore it checks the first variable to see if it is approved. If it is, then it returns 1; then finishes the sub process_order { subroutine. 
 return 1;
} else {
 return 0;
}
}
 
Ok. I think my error maybe in here possibly. This is the same script I use in my reg_system.cgi file. It's modified, since I don't have to worry about checking for
what domain it is, .com, net, org, biz, info, etc. But what I deleted was obsolete in this script. Anyways, when I run https://www.firstratehosting.com/cgi-bin/reg_system.name.cgi which is the test environment, It runs fine, but when I get to the verify order, and click on order, I get the "throw exception" error. When
I check my transactions looking for a decline, It don't even show it. Usually it does. so it's not even calling the gateway through this subroutine. I don't get any errors except that throw exception.  If I use that fake card it processes the domain. So the problem is either that the sub charge is not correct, which I would assume would give me an error, OR the  if(!charge()) { that makes it run this, is in correct. I guess it could be the throw error message, maybe that is incorrect, so it just throws the error because of some reason, without calling the sub routine.
 
Sorry this is lengthy, but I need help, please.
 
Thank you for any help you can offer.
 
Richard.
 
 

Reply via email to