Kryptronic Software Support Forum

You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.

#1 02-13-2006 11:40:52

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19124
Website

Godaddy.com Curl Config

Recently we have been made aware that GoDaddy has implemented a proxy requirement for all https requests made via software running on their hosting accounts.  The https proxy URL is: .

The following changes are needed for CCP installs running on GoDaddy accounts if you are using any of these features:

## LWP Based Connections (Processors):

# Authorize.Net (AIM Only)
# Wells Fargo (Secure Source Only)
# ECHOnline
# EFSNET
# Caledon
# SurePay
# BluePay (API)
# FirstPay

## cURL Based Connections (Processors):

# Cardservice Linkpoint (API Only)
# PayPal (Pro Express Method) - Payment Form
# PayPal (Pro Direct Method) - Secure Server

## LWP Based Connections (Shippers):

# UPS Online Tools
# FedEx Direct Connect

The following changes need to be made to the codebase if you are using those methods:

In the file ./cgi-bin/library/common/vars.pl in the routine 'vars_set' right at the top, above the comment:

Code:


#########
######### Initiate database settings.
#########

Add:

Code:


$ENV{HTTPS_PROXY} = 'http://64.202.165.130:3128';

In the file ./cgi-bin/library/modules/ste_paypalpro.pl in the routine 'ste_paypalpro_soap_proc' right below:

Code:


my $curl = $curl_path . " -s -S -m 90";

Add:

Code:


$proxy = "http://64.202.165.130:3128";
$curl .= " -p";
$curl .= " -x " . (($OS eq "WINDOWS") ? "\"$proxy\""   : "'$proxy'");

In the file ./cgi-bin/modules_lib/LPERL.pm in the routine 'process', right below:

Code:


if (defined $data->{keyfile}) {
$curl .= " -E " . (($OS eq "WINDOWS") ? "\"$data->{keyfile}\"" : '$data->{keyfile}'");
}

Add:

Code:


my $proxy = "http://64.202.165.130:3128";
$curl .= " -p";
$curl .= " -x " . (($OS eq "WINDOWS") ? "\"$proxy\""   : "'$proxy'");

These changes will ensure the proper https proxy is used for all https requests made by CCP on GoDaddy servers.


Nick Hendler

Offline

 

#2 03-15-2006 21:59:11

SederGraphics
Member
From: Sonora, CA - USA
Registered: 01-23-2004
Posts: 41
Website

Re: Godaddy.com Curl Config

Can't thank you enough for posting this. My client is hosted at GoDaddy and I was beating my head against the wall on this one.

Fixed it 3 minutes after reading this.


Kraig
wwwsedergraphics.com

Offline

 

#3 03-17-2006 22:28:16

hms
Member
Registered: 03-16-2006
Posts: 9

Re: Godaddy.com Curl Config

I have a question about the cURL that runs on godaddy.com servers.  My client is in much need for a script or adjustment to allow payments to process via PayPal Website Pro and this person is being hosted by iPowerweb.com

Do you have any suggestions on how I should find out the proxy numbers are for their server.  Everything else in your post... I believe I understand, and I just need to implement the proxy numbers...this is my assumption.

Thank you for enlightening those like myself on overcoming a few hurdles here and there, and I appreciate any advise you may have.

Thank you MUCH
Debbie

Offline

 

#4 03-21-2006 08:27:06

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19124
Website

Re: Godaddy.com Curl Config

GoDaddy is the only host I'm aware of that requires a proxy right now.  If ipowerweb requires one (or any other host for that matter) then the host should be able to provide you with the numbers.


Nick Hendler

Offline

 

#5 05-25-2006 12:22:41

acetracer
Member
Registered: 02-20-2004
Posts: 48

Re: Godaddy.com Curl Config

I had a helluva time trying to get a GoDaddy SSL certificate installed for a client recently (worsened by it also being my first PayPal Pro installation). They require an intermediate certificate to validate the connection. Furthermore trying to get any kind of CGI scripts to run or dealing with any of their hosting environments has been a pain in my side the last several weeks.

As more of our clients move to their relatively cheap or free services, I have a feeling I'll be dealing more with this kind of stuff. I'm not looking forward to it. 

Offline

 

#6 05-25-2006 13:03:59

SederGraphics
Member
From: Sonora, CA - USA
Registered: 01-23-2004
Posts: 41
Website

Re: Godaddy.com Curl Config

Actually most of the low cost hosting doesn't have this problem. GoDaddy is the first I ran into that I needed to jump though the hoops on. iPowerWeb.com has very low cost hosting without these problems.


Kraig
wwwsedergraphics.com

Offline

 

#7 12-04-2006 23:06:01

pugletgirl
Member
Registered: 12-04-2006
Posts: 7

Re: Godaddy.com Curl Config

Can someone confirm that these file modifications are still necessary with Go Daddy?  I did this and I got an error message about "configuration debugging" that gave all my api password stuff and whatnot.

I asked Go Daddy about cURL and they "helpfully" gave me some pat answer about putting some PHP code somewhere.  I think it should go up their butts to keep their heads company, but WHATEVER.

Here's what they say about cURL:

Below is a PHP script that uses CURL to obtain data from a remote system (http://www.paypal.com) and then creates a Web page based on that data.

<?

$URL="https://www.paypal.com";
if (isset($_GET["site"])) { $URL = $_GET["site"]; }
$ch = curl_init();
echo "URL = $URL <br>\n";
curl_setopt($ch, CURLOPT_VERBOSE, 1);
//curl_setopt ($ch, CURLOPT_HTTPPROXYTUNNEL, TRUE);
curl_setopt ($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
curl_setopt ($ch, CURLOPT_PROXY,"http://proxy.shr.secureserver.net:3128");
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt ($ch, CURLOPT_URL, $URL);
curl_setopt ($ch, CURLOPT_TIMEOUT, 120);
$result = curl_exec ($ch);
echo "<hr><br>\n";
echo 'Errors: ' . curl_errno($ch) . ' ' . curl_error($ch) . '<br><br>';
echo "<hr><br>\n";
curl_close ($ch);
print "result - $result";
echo "<hr><br>\n";

?>

Offline

 

#8 12-05-2006 13:39:27

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19124
Website

Re: Godaddy.com Curl Config

These changes are necessary for GoDaddy.  Do not use the PHP code they provided - instead use the Perl code posted here.


Nick Hendler

Offline

 

#9 12-05-2006 13:43:47

pugletgirl
Member
Registered: 12-04-2006
Posts: 7

Re: Godaddy.com Curl Config

Thanks, Nick.  I did do this and still can't get it to work, so it must be messed up somewhere else.  I purchased a help ticket, and I will wait patiently for your help. 

(And by that I mean I will curl up in a ball under my desk and whimper quietly until I hear from you.  No pressure...)

Offline

 

#10 12-05-2006 14:02:31

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19124
Website

Re: Godaddy.com Curl Config

I'm hitting all the support tickets today - so you won't have to *cURL* up too long...


Nick Hendler

Offline

 

#11 12-05-2006 14:14:29

kelly518
Member
Registered: 01-10-2006
Posts: 274

Re: Godaddy.com Curl Config

webmaster wrote:

I'm hitting all the support tickets today - so you won't have to *cURL* up too long...

Good to see Nick still has a sense of humor. smile

Offline

 

#12 08-06-2007 05:54:10

Dave
Member
Registered: 07-05-2003
Posts: 11233

Re: Godaddy.com Curl Config

The address for the cURL proxy server on GoDaddy.com for shared accounts is  and it is  required for secure cURL connections.

When doing an installation enter the address and port number as shown above and check  the box for .  Leave the cURL Proxy Username and cURL Proxy Password fields blank.

Last edited by Dave (08-06-2007 06:09:25)

Offline

 

#13 06-04-2008 01:31:04

AskFred
Member
Registered: 05-23-2008
Posts: 16

Re: Godaddy.com Curl Config

My site is hosted on Godaddy and using the codes provided above I tried to rectify my Paypal problem,

I managed to add the provided code to ./cgi-bin/library/common/vars.pl

But these are some problems I have faced:

1. I don't have the file ./cgi-bin/library/modules/ste_paypalpro.pl  on my server. So what do I do about it?

2. My ./cgi-bin/modules_lib/LPERL.pm doesn't have the entry:
if (defined $data->{keyfile}) {
$curl .= " -E " . (($OS eq "WINDOWS") ? "\"$data->{keyfile}\"" : '$data->{keyfile}'");
}

This are the codes in my LPERL.pm

Code:

package LPERL;
#LGSGPERL v 2.0 (the name 'LPERL' retained for backwards compatibility)

require 5.000;
use strict;

require Exporter;
use Class::Struct;
use Data::Dumper;

my @ISA = qw(Exporter);
my @EXPORT = qw(&process &new);

#######################################################################
# Copyright 1999-2003 Linkpoint International.  All rights reserved.  #
# This file can not be redistributed in ANY way!                      #
#######################################################################

$LPERL::REVISION = '$Id: LPERL.pm,v 2.6.002 04/04/2003 12:00:00 kfisk/solson $';
$LPERL::VERSION  = '2.6.002';

my $EZ_CONVERSION = 1;     # 1: always use port 1129    0: use incoming port field
my $debugging     = 0;     # 1: Prints input and output 0: none
my $CLONE_BILLING = 1;     # 1: Copy billing data to shipping data if not provided

my $curlswitch;

if ($debugging > 0) 
{
     $curlswitch = '-v -s -S -m 90';
}
else
{
     $curlswitch = '-s -S -m 90';     
}

###
### HACK - webmaster@kryptronic.com
###
### Commented the two following lines and added blank curlpath.
###

#my $curlpath= '/usr/local/bin/curl';    #Set your correct path
#my $curlpath= 'c:\\localcurlpath\\curl.exe'; #set the right path

my $curlpath = "";

###
### HACK - webmaster@kryptronic.com
###

########################## BEGIN LIBRARY #########################
#
# This file shall not be modified BELOW THIS POINT!
#
##################################################################

my $DefaultClass = "LPERL";
my $OS;

# FIGURE OUT THE OS WE'RE RUNNING UNDER
# Some systems support the $^O variable.  If not
# available then require() the Config library

if ($debugging > 0) { print "Determining OS: "; }
unless($OS || ($OS = $^O)) {
     if ($debugging > 0) { print "using Config: " }
     require Config;
     $OS = $Config::Config{'osname'};
}

if($OS=~/MSWin/i)          { $OS = 'WINDOWS'; }
elsif($OS=~/vms/i)          { $OS = 'VMS'; }
elsif($OS=~/bsdos/i)     { $OS = 'UNIX'; }
elsif($OS=~/dos/i)          { $OS = 'DOS'; }
elsif($OS=~/os2/i)          { $OS = 'OS2'; }
else                         { $OS = 'UNIX'; }

if ($debugging > 0) { print "$OS\n"; }

my $WHOAMI = ref bless [];
if ($debugging > 0) { print "WHOAMI: $WHOAMI\n"; }

###
### HACK - webmaster@kryptronic.com
###
### Added routine.
###

sub curlpath {

$curlpath = shift;

}

###
### HACK - webmaster@kryptronic.com
###

sub new
{

    if ($debugging > 0) { print "Creating new instance of $WHOAMI\n"; }
    if ($debugging > 3) { printStackTrace (@_); }
    my($class, $initializer) = @_;
    my $self = {};
    if($class eq "LPERL")
    {
         bless $self, ref $class || $class || $DefaultClass;
    }
    else
    {
         bless $self, ref $class || $class;
    }
    return $self;
}

#############################################################################
#    CalculateTax
#############################################################################
sub CalculateTax
{
    if ($debugging > 3) { printStackTrace (@_); }

    my ($class, $data, $base_type, $ret, $txn);

    if ($_[0] eq $WHOAMI)               { $class = undef;     shift; }
     elsif (ref $_[0] eq $WHOAMI)     { $class = shift; }

    $ret = {};
    $base_type = ref($_[0]);
    if($base_type ne "HASH")
    {
          @{$ret}{qw !statusCode statusMessage!} =
               (0, "$WHOAMI: CalculateTax: Invalid Usage... expected a hash table, got $base_type");
     } else {
          $data = shift;
          my %x = process($data, "CALCTAX");

          if (defined $x{r_tax})
          {
               @{$ret}{qw !r_approved tax statusCode!}          = ("APPROVED", $x{r_tax}, 1);
          }
          else
          {
               @{$ret}{qw !statusCode r_approved statusMessage errornum!} =
                 (0, "FAILED", @x{qw !r_error r_errornum!});
          }
     }
    return %$ret;
}

#############################################################################
#   Calculate Shipping
#############################################################################
sub CalculateShipping
{
    if ($debugging > 3) { printStackTrace (@_); }
    my ($class, $data, $base_type, $ret, $txn);

    if ($_[0] eq $WHOAMI)               { $class = undef;     shift; }
     elsif (ref $_[0] eq $WHOAMI)     { $class = shift; }

    $ret = {};
    $base_type = ref($_[0]);
    if($base_type ne "HASH")
    {
          @{$ret}{qw !statusCode statusMessage!} =
               (0, "$WHOAMI: CalculateShipping: Invalid Usage... expected a hash table, got $base_type");
     } else {
          $data = shift;
          my %x = process($data, "CALCSHIPPING");

          if (defined $x{r_shipping})
          {
               @{$ret}{qw !r_approved shipping statusCode!}          = ("APPROVED", $x{r_shipping}, 1);
          }
          else
          {
               @{$ret}{qw !statusCode r_approved statusMessage errornum!} =
                 (0, "FAILED", @x{qw !r_error r_errornum!});
          }
     }
    return %$ret;
}

#############################################################################
#   Approve Sale     
#   Purpose: obtain authorization and submit the transaction
#   for settlement to transfer funds
#############################################################################

sub ApproveSale
{
    if ($debugging > 3) { printStackTrace (@_); }
    my ($class, $data, $base_type, $ret, $txn);

    if ($_[0] eq $WHOAMI)               { $class = undef;     shift; }
     elsif (ref $_[0] eq $WHOAMI)     { $class = shift; }

    $ret = {};
    $base_type = ref($_[0]);
    if($base_type ne "HASH")
    {
          @{$ret}{qw !statusCode statusMessage!} =
               (0, "$WHOAMI: ApproveSale: Invalid Usage... expected a hash table, got $base_type");
     } else {       
          $data = shift;
          my %x = process($data, "SALE");

          if($x{statusCode} == 1) {
               @{$ret}{qw !statusCode statusMessage r_approved trackingID neworderID code time errornum AVSCode!} = 
                    @x{qw !statusCode r_error r_approved r_ref r_ordernum r_code r_time r_errorcode r_code!};
                    
               # Compatibility
               @{$ret}{qw !tax total subtotal shipping!} = @{$data}{qw !tax total subtotal shipping!};
          }
          else
          {
               @{$ret}{qw !statusMessage statusApproval!} = @x{qw !r_error r_approved!};
          }
     }
     
    return %$ret;
}

#############################################################################
#   Void Sale
#############################################################################
sub VoidSale
{
    if ($debugging > 3) { printStackTrace (@_); }
    my ($class, $data, $base_type, $ret, $txn);

    if ($_[0] eq $WHOAMI)               { $class = undef;     shift; }
     elsif (ref $_[0] eq $WHOAMI)     { $class = shift; }

    $ret = {};
    $base_type = ref($_[0]);
    if($base_type ne "HASH")
    {
          @{$ret}{qw !statusCode statusMessage!} =
               (0, "$WHOAMI: ApproveSale: Invalid Usage... expected a hash table, got $base_type");
     } else {       
          $data = shift;
          my %x = process($data, "VOID");
          
          if($x{statusCode} == 1) {
               @{$ret}{qw !statusCode statusMessage r_approved trackingID neworderID code time errornum AVSCode!} = 
                    @x{qw !statusCode r_error r_approved r_ref r_ordernum r_code r_time r_errorcode r_code!};
                    
               # Compatibility
               @{$ret}{qw !tax total subtotal shipping!} = @{$data}{qw !tax total subtotal shipping!};
          }
          else
          {
              @{$ret}{qw !statusMessage statusApproval!} = @x{qw !r_error r_approved!};
          }          
     }
    return %$ret;
}



#############################################################################
#   Periodic Billing
#############################################################################
sub SetPeriodic
{
     if ($debugging > 3) { printStackTrace (@_); }
    my ($class, $data, $base_type, $ret, $txn);

    if ($_[0] eq $WHOAMI)               { $class = undef;     shift; }
     elsif (ref $_[0] eq $WHOAMI)     { $class = shift; }

    $ret = {};
    $base_type = ref($_[0]);
    if($base_type ne "HASH")
    {
          @{$ret}{qw !statusCode statusMessage!} =
               (0, "$WHOAMI: SetPeriodic: Invalid Usage... expected a hash table, got $base_type");
     } else {
          $data = shift;
          my %x = process($data, "SALE", { pbordertype => 'pborder_submit' });
          
          if($x{statusCode} == 1) {
               @{$ret}{qw !statusCode statusMessage r_approved trackingID neworderID code time errornum AVSCode!} = 
                    @x{qw !statusCode r_error r_approved r_ref r_ordernum r_code r_time r_errorcode r_code!};
                    
               # Compatibility
               @{$ret}{qw !tax total subtotal shipping!} = @{$data}{qw !tax total subtotal shipping!};
          }
          else
          {
              @{$ret}{qw !statusMessage statusApproval!} = @x{qw !r_error r_approved!};
          }
     }
    return %$ret;
}

#############################################################################
#     VirtualCheck
#############################################################################
sub VirtualCheck
{
    if ($debugging > 3) { printStackTrace (@_); }
    my ($class, $data, $base_type, $ret, $txn);

    if ($_[0] eq $WHOAMI)               { $class = undef;     shift; }
     elsif (ref $_[0] eq $WHOAMI)     { $class = shift; }

    $ret = {};
    $base_type = ref($_[0]);
    if($base_type ne "HASH")
    {
          @{$ret}{qw !statusCode statusMessage!} =
               (0, "$WHOAMI: VirtualCheck: Invalid Usage... expected a hash table, got $base_type");
     } else {
          $data = shift;
          my %x = process($data, "SALE");
          
          if($x{statusCode} == 1) {
               @{$ret}{qw !statusCode statusMessage r_approved trackingID neworderID code time errornum AVSCode!} = 
                    @x{qw !statusCode r_error r_approved r_ref r_ordernum r_code r_time r_errorcode r_code!};
                    
               # Compatibility
               @{$ret}{qw !tax total subtotal shipping!} = @{$data}{qw !tax total subtotal shipping!};
          }
          else
          {
              @{$ret}{qw !statusMessage statusApproval!} = @x{qw !r_error r_approved!};
          }
     }
    return %$ret;
}


#############################################################################
#     VoidCheck   #
#############################################################################
sub VoidCheck
{
    if ($debugging > 3) { printStackTrace (@_); }
    my ($class, $data, $base_type, $ret, $txn);

    if ($_[0] eq $WHOAMI)               { $class = undef;     shift; }
     elsif (ref $_[0] eq $WHOAMI)     { $class = shift; }

    $ret = {};
    $base_type = ref($_[0]);
    if($base_type ne "HASH")
    {
          @{$ret}{qw !statusCode statusMessage!} =
               (0, "$WHOAMI: VoidCheck: Invalid Usage... expected a hash table, got $base_type");
     } else {       
          $data = shift;
          my %x = process($data, "VOID", { voidcheck => 1 });
          
          if($x{statusCode} == 1) {
               @{$ret}{qw !statusCode statusMessage r_approved trackingID neworderID code time errornum AVSCode!} = 
                    @x{qw !statusCode r_error r_approved r_ref r_ordernum r_code r_time r_errorcode r_code!};
                    
               # Compatibility
               @{$ret}{qw !tax total subtotal shipping!} = @{$data}{qw !tax total subtotal shipping!};
          }
          else
          {
              @{$ret}{qw !statusMessage statusApproval!} = @x{qw !r_error r_approved!};
          }          
     }
    return %$ret;
}



#############################################################################
#   Capture Payment
#############################################################################
sub CapturePayment
{
    if ($debugging > 3) { printStackTrace (@_); }
    my ($class, $data, $base_type, $ret, $txn);

    if ($_[0] eq $WHOAMI)               { $class = undef;     shift; }
     elsif (ref $_[0] eq $WHOAMI)     { $class = shift; }

    $ret = {};
    $base_type = ref($_[0]);
    if($base_type ne "HASH")
    {
          @{$ret}{qw !statusCode statusMessage!} =
               (0, "$WHOAMI: CapturePayment: Invalid Usage... expected a hash table, got $base_type");
     } else {       
          $data = shift;
          my %x = process($data, "PREAUTH");
          
          if($x{statusCode} == 1) {
               @{$ret}{qw !statusCode statusMessage r_approved trackingID neworderID code time errornum AVSCode!} = 
                    @x{qw !statusCode r_error r_approved r_ref r_ordernum r_code r_time r_errorcode r_code!};
                    
               # Compatibility
               @{$ret}{qw !tax total subtotal shipping!} = @{$data}{qw !tax total subtotal shipping!};
          }
          else
          {
              @{$ret}{qw !statusMessage statusApproval!} = @x{qw !r_error r_approved!};
          }          
     }
    return %$ret;
}

#############################################################################
#   Return Order
#############################################################################
sub ReturnOrder
{
    if ($debugging > 3) { printStackTrace (@_); }
    my ($class, $data, $base_type, $ret, $txn);

    if ($_[0] eq $WHOAMI)               { $class = undef;     shift; }
     elsif (ref $_[0] eq $WHOAMI)     { $class = shift; }

    $ret = {};
    $base_type = ref($_[0]);
    if($base_type ne "HASH")
    {
          @{$ret}{qw !statusCode statusMessage!} =
               (0, "$WHOAMI: ReturnOrder: Invalid Usage... expected a hash table, got $base_type");
     } else {       
          $data = shift;
          my %x = process($data, "CREDIT");
          
          if($x{statusCode} == 1) {
               @{$ret}{qw !statusCode statusMessage r_approved trackingID neworderID code time errornum AVSCode!} = 
                    @x{qw !statusCode r_error r_approved r_ref r_ordernum r_code r_time r_errorcode r_code!};
                    
               # Compatibility
               @{$ret}{qw !tax total subtotal shipping!} = @{$data}{qw !tax total subtotal shipping!};
          }
          else
          {
              @{$ret}{qw !statusMessage statusApproval!} = @x{qw !r_error r_approved!};
          }
     }
    return %$ret;
}


#############################################################################
#   Return Card
#############################################################################
sub ReturnCard
{
    if ($debugging > 3) { printStackTrace (@_); }
    my ($class, $data, $base_type, $ret, $txn);

    if ($_[0] eq $WHOAMI)               { $class = undef;     shift; }
     elsif (ref $_[0] eq $WHOAMI)     { $class = shift; }

    $ret = {};
    $base_type = ref($_[0]);
    if($base_type ne "HASH")
    {
          @{$ret}{qw !statusCode statusMessage!} =
               (0, "$WHOAMI: ReturnCard: Invalid Usage... expected a hash table, got $base_type");
     } else {       
          $data = shift;
          my %x = process($data, "CREDIT");
          
          if ($x{statusCode} == 1) {
               @{$ret}{qw !statusCode statusMessage r_approved trackingID neworderID code time errornum AVSCode!} = 
                    @x{qw !statusCode r_error r_approved r_ref r_ordernum r_code r_time r_errorcode r_code!};
                    
               # Compatibility
               @{$ret}{qw !tax total subtotal shipping!} = @{$data}{qw !tax total subtotal shipping!};
          }
          else
          {
              @{$ret}{qw !statusMessage statusApproval!} = @x{qw !r_error r_approved!};
          }
     }
    return %$ret;
}

#############################################################################
#   Bill Orders
#   Purpose: post-authorize payment against 1 or more orders
#############################################################################
sub BillOrders
{
    if ($debugging > 3) { printStackTrace (@_); }
    my ($class, $data, $txn, $orders, $order, %status, $h);

    if ($_[0] eq $WHOAMI)               { $class = undef;     shift; }
     elsif (ref $_[0] eq $WHOAMI)     { $class = shift; }

    my ($cnt, $apr) = (0,0);

    if ((ref ($h = $_[0]) eq "HASH") && 
          (ref ($orders = $h->{orders}) eq "ARRAY") && 
          (ref ($orders->[0]) eq "HASH")
        ) {
          $data = shift;
          my $gw = {};
          my $d;

          if (defined ($d = $data->{gateway}))                                   { $gw->{gateway} = $d; }
          if (defined ($d = $data->{hostname} || $data->{host}))               { $gw->{host} = $d; }
          if (defined ($d = $data->{port}))                                        { $gw->{port} = $d; }
          if (defined ($d = $data->{storename} || $data->{configfile}))     { $gw->{configfile} = $d; }
          if (defined ($d = $data->{keyfile}))                                   { $gw->{keyfile} = $d; }
          if (defined ($d = $data->{result}))                                        { $gw->{result} = $d; }
         
          foreach $order ( @{$orders} ) {
               %status = BillOrder ($WHOAMI, $order, $gw);
               if ( $status{statusCode} == 1) { 
                    $cnt++; 
                    if ($status{r_approved} eq "APPROVED") { $apr++; }
               }
          }
    }

    return "$apr/$cnt";
}

#############################################################################
#   Bill Order
#   Purpose: This function is used internally by BillOrders
#   and is not typically used in your own Perl programs.
#############################################################################
sub BillOrder
{
    if ($debugging > 3) { printStackTrace (@_); }
    my ($class, $data, $base_type, $ret, $txn);

    if ($_[0] eq $WHOAMI)               { $class = undef;     shift; }
     elsif (ref $_[0] eq $WHOAMI)     { $class = shift; }

    $ret = {};
    $base_type = ref($_[0]);
    if($base_type ne "HASH")
    {
          @{$ret}{qw !statusCode statusMessage!} =
               (0, "$WHOAMI: BillOrder: Invalid Usage... expected a hash table, got $base_type");
     } else {       
          $data = shift;
          my $xtra = shift;
          my %x = process($data, "POSTAUTH", $xtra);
          
          if($x{statusCode} == 1) {
               @{$ret}{qw !statusCode statusMessage r_approved trackingID neworderID code time errornum AVSCode!} = 
                    @x{qw !statusCode r_error r_approved r_ref r_ordernum r_code r_time r_errorcode r_code!};
                    
               # Compatibility
               @{$ret}{qw !tax total subtotal shipping!} = @{$data}{qw !tax total subtotal shipping!};
          }
          else
          {
              @{$ret}{qw !statusMessage statusApproval!} = @x{qw !r_error r_approved!};
          }
     }
    return %$ret;
}

########################################
# Process converts incoming hash to XML,
# then calls cURL to do the transaction
########################################

sub process
{
     if ($debugging > 3) { printStackTrace (@_); }
     my ($class, $data, $txntype);
    my $ret               = {};
     
     if ((! defined $curlpath) || ($curlpath eq "")) {
          @{$ret}{qw !statusCode statusMessage!} = 
               (0, "$WHOAMI: process: /path/to/curl (\$curlpath) is not defined");
     }
     elsif (! -f $curlpath) {
          @{$ret}{qw !statusCode statusMessage!} = (0, "$WHOAMI: process: $curlpath does not exist!");
     }
     elsif (! -x $curlpath) {
          @{$ret}{qw !statusCode statusMessage!} = (0, "$WHOAMI: process: Cannot execute $curlpath!");
     }
     else {
          if ($_[0] eq $WHOAMI)               { $class = undef;     shift; }
          elsif (ref $_[0] eq $WHOAMI)     { $class = shift; }

          if (ref $_[0] eq "HASH") {
               $data = {};
               my $x = shift;
               while (my ($key, $val) = each (%$x)) { $data->{$key} = $val; }
               if (defined $_[0]) { $data->{chargetype} = shift; }
               if (defined $_[0]) {          # See if there where any "additional" parameters 
                    $x = shift;                    # Add them to the "transaction"
                    while (my ($key, $val) = each (%$x)) { $data->{$key} = $val; }
               }
          }
          
          my $rdata;

          my $xmlstg          = buildXml ($data);
          my $port          = ($EZ_CONVERSION == 1) ? 1129 : ($data->{port} || 1129);
          my $hoststg          = "https://$data->{hostname}:$port/LSGSXML";
          my $curl          = "$curlpath $curlswitch";
             $curl          =~ s!\s*$!!s;
               
          if (defined $data->{keyfile}) {
               $curl .= " -E " . (($OS eq "WINDOWS") ? "\"$data->{keyfile}\"" : "'$data->{keyfile}'");
          }
          
          $curl .= " -d " . (($OS eq "WINDOWS") ? "\"$xmlstg\"" : "'$xmlstg'");
          $curl .= " " . (($OS eq "WINDOWS") ? $hoststg : "'$hoststg'");
           
          if ($debugging)     { print "\nPOST $hoststg\n$xmlstg\n\nSHELL> $curl\n"; }

          if (! ($rdata = `$curl`))  # If $rdata comes back empty, it's a curl error
          {
               if ($debugging) { print "\n\ncurl error. aborting\n\n"; }
               $ret->{statusCode} = 0;
               $ret->{r_error} = "curl connection error"; 
               return %$ret;
          }
          else {
               $ret->{statusCode} = 1;
               if ($debugging)  { print "\nserver response:\n$rdata\n"; }
    
               #stuff the return hash
               while ($rdata =~ /<(.*?)>(.*?)<\x2f\1>/gi) { $ret->{$1} = $2; }

               if ($debugging) # look at server response as %results hash
               {
                    print "\nreturn hash:\n";
                         
                    while(my($key, $value) = each %$ret) { print "\t$key = $value\n"; }
                    print "\n";
               }
          }
     }

    return %$ret;
}

################################################
# buildXml takes the incoming hash and converts
# it to the XML format LSGS understands
################################################

my $xlat = {
     cardNumber                    =>     'creditcard.cardnumber',
     cardnumber                    =>     'creditcard.cardnumber',
     cardExpMonth               =>     'creditcard.cardexpmonth',
     expmonth                    =>     'creditcard.cardexpmonth',
     cardExpYear                    =>     'creditcard.cardexpyear',
     expyear                         =>     'creditcard.cardexpyear',
     cvmvalue                    =>     'creditcard.cvmvalue',
     cvmindicator               =>     'creditcard.cvmindicator',
     track                         =>     'creditcard.track',
     chargetype                    =>     'orderoptions.ordertype',
     result                         =>     'orderoptions.result',
     debuglevel                    =>     'orderoptions.debuglevel',
     name                         =>     'billing.name',
     bname                         =>     'billing.name',
     bcompany                    =>     'billing.company',
     address                         =>     'billing.address1',
     baddr1                         =>     'billing.address1',
     baddr                         =>     'billing.address1',
     address2                    =>     'billing.address2',
     baddr2                         =>     'billing.address2',
     city                         =>     'billing.city',
     bcity                         =>     'billing.city',
     state                         =>     'billing.state',
     bstate                         =>     'billing.state',
     zip                              =>     'billing.zip',
     bzip                         =>     'billing.zip',
     country                         =>     'billing.country',
     bcountry                    =>     'billing.country',
     userid                         =>     'billing.userid',
     email                         =>     'billing.email',
     phone                         =>     'billing.phone',
     fax                              =>     'billing.fax',
     addrnum                         =>     'billing.addrnum',
     sname                         =>     'shipping.name',
     saddr                         =>     'shipping.address1',
     saddr1                         =>     'shipping.address1',
     saddr2                         =>     'shipping.address2',
     scity                         =>     'shipping.city',
     shipcountry                    =>     'shipping.country',
     scountry                    =>     'shipping.country',
     shipcarrier                    =>     'shipping.carrier',
     shipitems                    =>     'shipping.items',
     shiptotal                    =>     'shipping.total',
     taxstate                    =>     'shipping.state',
     shipstate                    =>     'shipping.state',
     sstate                         =>     'shipping.state',
     taxzip                         =>     'shipping.zip',
     shipzip                         =>     'shipping.zip',
     szip                         =>     'shipping.zip',
     amount                         =>     'payment.chargetotal',
     chargetotal                    =>     'payment.chargetotal',
     tax                              =>     'payment.tax',
     taxtotal                    =>     'payment.subtotal',
     subtotal                    =>     'payment.subtotal',
     vatax                         =>     'payment.vatax',
     shipping                    =>     'payment.shipping',
     orderID                         =>     'transactiondetails.oid',
     oid                              =>     'transactiondetails.oid',
     ponumber                    =>     'transactiondetails.ponumber',
     recurringtransaction     =>     'transactiondetails.recurring',
     recurring                    =>     'transactiondetails.recurring',
     taxexempt                    =>     'transactiondetails.taxexempt',
     taxexmpt                    =>     'transactiondetails.taxexempt',
     terminaltype               =>     'transactiondetails.terminaltype',
     ip                              =>     'transactiondetails.ip',
     trackingID                    =>     'transactiondetails.reference_number',
     code                         =>     'transactiondetails.reference_number',
     mototransaction               =>     'transactiondetails.transactionorigin',
     tdate                         =>     'transactiondetails.tdate',
     storename                    =>     'merchantinfo.configfile',
     configfile                    =>     'merchantinfo.configfile',
     keyfile                         =>     'merchantinfo.keyfile',
     hostname                    =>     'merchantinfo.host',
     host                         =>     'merchantinfo.host',
     port                         =>     'merchantinfo.port',
     routing                         =>     'telecheck.routing',
     account                         =>     'telecheck.account',
     accountnum                    =>     'telecheck.account',
     bankname                    =>     'telecheck.bankname',
     bankstate                    =>     'telecheck.bankstate',
     checknum                    =>     'telecheck.checknumber',
     checknumber                    =>     'telecheck.checknumber',
     voidcheck                    =>     'telecheck.void',
     accounttype                    =>     'telecheck.accounttype',
     acnttype                    =>     'telecheck.accounttype',
     ssn                              =>     'telecheck.ssn',
     dl                              =>     'telecheck.dl',
     dlstate                         =>     'telecheck.dlstate',
     startdate                    =>     'periodic.startdate',
     installments               =>     'periodic.installments',
     threshold                    =>     'periodic.threshold',
     periodicity                    =>     'periodic.periodicity',
     pbcomments                    =>     'periodic.comments',
     pbordertype                    =>     'periodic.action',
     action                         =>     'periodic.action',
     comments                    =>     'notes.comments',
     refer                         =>     'notes.referred'
};

sub fixHash {
     if ($debugging > 3) { printStackTrace (@_); }
     # Unfortunately to provide compatibility some of the incoming data has to be massaged

     my ($data) = @_;
     my $node;
     my $d;

     
     if (defined ($node = $data->{creditcard})) {
          if (defined ($d = $node->{cvmindicator})) {
               $d = lc($d);
               my $cvm = { 
                    0     => 'not_provided', 
                    1     => 'provided', 
                    2     => 'illegible', 
                    9     => 'no_imprint',
                    ' '     => 'not_present'
               };
               my $o = $d;

               if ($debugging > 4) { print "fixHash: creditcard#cvmindicator: $d = "; }
               
               $d =~     s!^cvm_?!!s;
               if (($debugging > 4) && ($o ne $d)) { print "$d = "; }
               $o = $d;

               $d =~     s!provide$!provided!gs;          # (not_)provide = (not_)provided
               if (($debugging > 4) && ($o ne $d)) { print "$d = "; }
               $o = $d;

               $d =~     s!^(not?)_?(.*)!$1_$2!;     # noimprint = no_imprint, notprovided = not_provided
               if (($debugging > 4) && ($o ne $d)) { print "$d = "; }

               $node->{cvmindicator} = $cvm->{$d} || $d;
               if ($debugging > 4) { print "$node->{cvmindicator}\n"; }
          }
          
     
          if (defined ($d = $node->{cardexpyear})) { 
               $node->{cardexpyear} = sprintf ("%02d", $d % 100); 

               if ($debugging > 4) {
                    if ($d ne $node->{cardexpyear}) { 
                         print "fixHash: creditcard#cardexpyear $d = $node->{cardexpyear}\n";
                    }
               }
          }
     }

     if (defined ($node = $data->{billing})) {
          if ($CLONE_BILLING) {
               if ($debugging > 4) { print "fixHash: Clone billing address to shipping address\n"; }
               
               my $ship_node = $data->{shipping};

               if (! defined $ship_node) { 
                    if ($debugging > 4) { print "fixHash: creating shipping node\n"; }
                    $data->{shipping} = $ship_node = {}; 
               } 
               while (my ($k, $v) = each %$node) {
                    if (! defined $ship_node->{$k}) { 
                         if ($k =~ m!^name|address1|address2|city|state|zip|country$!) {
                              if ($debugging > 4) {
                                   print "fixHash: shipping#$k = $v\n";
                                   $ship_node->{$k} = $v; 
                              }
                         }
                    }
                    else {
                         if ($debugging > 4) { print "fixHash: shipping#$k already exists!\n"; }
                    }
               }
          }
          if (defined ($d = $node->{phone})) {
               my $o = $d;
               $node->{phone} = (($d =~ s!\D!!gs) ? $d : $d);

               if (($debugging >4) && ($o ne $d)) { print "fixHash: Strip non-digits from billing#phone\n"; }
                    
          }
     }

     if (defined ($node = $data->{transactiondetails})) {
          if (defined ($d = $node->{recurring})) {
               $d = uc($d);
               if          ($d eq "RECURRING_TRANSACTION")          { $node->{recurring} = "yes"; }
               elsif     ($d eq "NON_RECURRING_TRANSACTION") { $node->{recurring} = "no"; }
               if (($debugging > 4) && ($d ne $node->{recurring})) {
                    print "fixHash: transactiondetails#recurring $d = $node->{recurring}\n";
               }
          }

          if(defined ($d = $node->{taxexempt})) {
               if          (($d eq "") || ($d eq " ") || ($d eq "0"))     { 
                 $node->{taxexempt} = "no"; 
               }
               elsif     ($d eq "1")     { 
                    $node->{taxexempt} = "yes"; 
               }
               if (($debugging > 4) && ($d ne $node->{taxexempt})) {
                    print "fixHash: transactiondetails#taxexempt $d = $node->{taxexempt}\n";
               }
          }

          if (defined ($d = $node->{terminaltype})) {
               $node->{terminaltype} = (($d =~ /^TTYPE_(.*)/i) ? lc($1) : $d);
               if (($debugging > 4) && ($d ne $node->{terminaltype})) {
                    print "fixHash: transactiondetails#terminaltype $d = $node->{terminaltype}\n";
               }
          }

          if (defined ($d = $node->{transactionorigin})) {
               $node->{transactionorigin} = (($d =~ /^(.*)_TRANSACTION/i) ? uc($1) : $d);
               if (($debugging > 4) && ($d ne $node->{transactionorigin})) {
                    print "fixHash: transactiondetails#transactionorigin $d = $node->{transactionorigin}\n";
               }
          }

     }

     if (defined ($node = $data->{telecheck})) {
         if (defined $node->{void}) { 
               $node->{void} = 1;
               if ($debugging > 4) { print "fixHash: telecheck#void = 1\n"; }
          }
     }

    if (defined ($node = $data->{periodic})) {
        if (defined ($d = $node->{action})) {
               $node->{action} = (($d =~ /^pborder_(.*)$/i) ? lc($1) : lc($d));
               if (($debugging > 4) && ($d ne $node->{action})) {
                    print "fixHash: periodic#action $d = $node->{action}\n";
               }
          }
     }

     # <Payment> is required
     if (! defined $data->{payment}) { 
          if ($debugging > 4) { print "fixHash: creating empty payment tag\n"; }
          $data->{payment} = {}; 
     }


}     

sub buildHash {
     if ($debugging > 3) { printStackTrace (@_); }
     my ($data, $x) =  @_;

     while (my ($key, $val) = each (%$x)) { 
          my $k = $xlat->{$key} || $key;
          my $p = undef;
          if ($k =~ /[.]/) {
            ($p, $k) = $k =~ /^([^.]*)[.](.*)$/;
          }
          if (defined $p) {
             if (! defined $data->{$p}) { $data->{$p} = {}; }
             $data->{$p}->{$k} = $val;
          } 
          else {
               $data->{$k} = $val; 
          }
     }
}

sub dumpHash {
     my ($data, $level) = @_;
     if ($debugging > 3) { if (! $level) { printStackTrace (@_); } }
     while(my($key, $value) = each %$data) { 
          $level = $level || 0;
          if ($level > 0) { print "\t" x $level; }
          
          if     (ref $value eq 'ARRAY')               { print "$key = " . join (',', @$value) . "\n"; }
          elsif     (ref $value eq 'HASH')          { print "$key\n"; dumpHash ($value, $level + 1); }
          else                                        { print "$key = $value\n"; }
     }
}

sub buildXml
{
     if ($debugging > 3) { printStackTrace (@_); }
     my ($class, $data);
     
     if ($_[0] eq $WHOAMI)               { $class = undef;     shift; }
     elsif (ref $_[0] eq $WHOAMI)     { $class = shift; }

     if (ref $_[0] eq "HASH") {
          $data = {};
          my $x = shift;
          buildHash ($data, $x);

          if (defined $_[0]) {          # See if there where any "additional" parameters 
               $x = shift;                         # Add them to the "transaction"
               buildHash ($data, $x);
          }
     }

     fixHash $data;

    if ($debugging)
    {
        print "\nat buildXML, incoming hash:\n"; 
        
        dumpHash $data;
        print "\n";
    }


    my $xml = "<order>";

    my $node_named;
     foreach $node_named (qw !creditcard orderoptions billing shipping payment transactiondetails
                                    merchantinfo telecheck periodic notes!) {
          my $node;
          if (defined ($node = $data->{$node_named})) {
               $xml .= "<$node_named>";
               while (my ($k, $v) = each %$node) {
                    $xml .= "<$k>$v</$k>";
               }
               $xml .= "</$node_named>";
          }
     }
     $xml .= "</order>";

    return $xml;
}

sub printStackTrace {
  print sprintf("Called from: %s in %s at line %d %s\n", caller(1));
  if ($debugging > 5) { print "Stack:\n" . Dumper(@_); }
}

1;

__END__

I am stuck and don't know what to do. Any help would be heartily appreciated.

Thanks!

Offline

 

#14 06-04-2008 01:37:41

AskFred
Member
Registered: 05-23-2008
Posts: 16

Re: Godaddy.com Curl Config

Sorry to bother you guys but I have found the
if (defined $data->{keyfile}) {
$curl .= " -E " . (($OS eq "WINDOWS") ? "\"$data->{keyfile}\"" : '$data->{keyfile}'");
}

code in the LPERL.pm file

So currently my only issue is the missing file /cgi-bin/library/modules/ste_paypalpro.pl sad

Offline

 

#15 06-04-2008 08:47:52

rachaelseven
Member
From: Massachusetts, USA
Registered: 01-23-2006
Posts: 3169
Website

Re: Godaddy.com Curl Config

ste_paypalpro.pl is part of the standard installation.  If you don't have it, extract it from the original zip file and put it there via FTP.


Rachael Katz
- Custom Focusing Screens for DSLR Cameras

Offline

 

#16 06-05-2008 23:18:06

AskFred
Member
Registered: 05-23-2008
Posts: 16

Re: Godaddy.com Curl Config

I don't have the original zip file, the guys at CCP had installed the software on my server. What or from where else can I get that file. I have written to CCP for the original zip file but no reply as yet.

Offline

 

#17 06-06-2008 04:04:47

Dave
Member
Registered: 07-05-2003
Posts: 11233

Re: Godaddy.com Curl Config

Check your mail Fred.

Offline

 

#18 06-06-2008 05:32:32

AskFred
Member
Registered: 05-23-2008
Posts: 16

Re: Godaddy.com Curl Config

Dave thanks for the file. Do it need to modify the file or just upload it as you have sent it.

Thanks once again.

Offline

 

#19 06-06-2008 05:36:49

Dave
Member
Registered: 07-05-2003
Posts: 11233

Re: Godaddy.com Curl Config

I don't actually know Fred.  I haven't been following this thread but noticed that Rachael said you needed the file so I sent it along.  Looking back I suspect that you don't/won't need to modify it and may use it as delivered.

Offline

 

#20 06-06-2008 06:51:22

AskFred
Member
Registered: 05-23-2008
Posts: 16

Re: Godaddy.com Curl Config

Dave, I have entered the code in the ste_paypalpro.pl file

is this the way it should look;

#########
######### Build out the curl request.
#########

my $curl = $curl_path . " -s -S -m 90";

$proxy = "http://64.202.165.130:3128";
$curl .= " -p";
$curl .= " -x " . (($OS eq "WINDOWS") ? "\"$proxy\""   : "'$proxy'");

if ($OS eq "WINDOWS") {$xml =~ s/\"/\\\"/gs;}

$curl   .= " -E " . (($OS eq "WINDOWS") ? "\"$keyfile\""   : "'$keyfile'");
$curl   .= " -d " . (($OS eq "WINDOWS") ? "\"$xml\""       : "'$xml'");
$curl   .= " "    . (($OS eq "WINDOWS") ? "$paypalpro_url" : "'$paypalpro_url'");

#########
######### Execute the curl request.
#########

Offline

 

#21 06-06-2008 07:01:49

AskFred
Member
Registered: 05-23-2008
Posts: 16

Re: Godaddy.com Curl Config

This is the code entered in the LPERL.pm file

if (defined $data->{keyfile}) {
            $curl .= " -E " . (($OS eq "WINDOWS") ? "\"$data->{keyfile}\"" : "'$data->{keyfile}'");
        }

                my $proxy = "http://64.202.165.130:3128";
                $curl .= " -p";
                $curl .= " -x " . (($OS eq "WINDOWS") ? "\"$proxy\""   : "'$proxy'");

       
        $curl .= " -d " . (($OS eq "WINDOWS") ? "\"$xmlstg\"" : "'$xmlstg'");
        $curl .= " " . (($OS eq "WINDOWS") ? $hoststg : "'$hoststg'");

Offline

 

#22 06-06-2008 07:06:46

AskFred
Member
Registered: 05-23-2008
Posts: 16

Re: Godaddy.com Curl Config

This is how the code has been added on the vars.pl file

#########
######### Initiate database settings.
#########

$ENV{HTTPS_PROXY} = 'http://64.202.165.130:3128';

$alt_dbh_used = &database_definitions;

#########
######### Open the settings database to get global variables.
#########

All I want to know if I have added the codes in the three files correctly, as still it's not working (get a blank screen after clicking on Checkout via Paypal)

Last edited by AskFred (06-06-2008 08:53:32)

Offline

 

#23 06-06-2008 09:16:13

AskFred
Member
Registered: 05-23-2008
Posts: 16

Re: Godaddy.com Curl Config

I wrote to Godaddy of the problem I am having with paypal checkout and this is the reply I got back


Incorrect link

http://www.abcfurnishing.com/ccp51/medi … PAYPAL.gif

This is the link that you have connected to the paypal button.  This is incorrect.  Have your web master fix it.
.gif's are not going to connect you to a shopping cart.

So what should be the format for this image (.jpg or ?) and where in CCP do I have to make modifications in the code, which file.

Thanks!

Offline

 

#24 06-06-2008 12:37:59

rachaelseven
Member
From: Massachusetts, USA
Registered: 01-23-2006
Posts: 3169
Website

Re: Godaddy.com Curl Config

That reply doesn't make any sense.  The button is a gif, but it links to the subroutine that sends the XML request to PayPal... the format of the image is not relevant.  I understand that the host is reluctant to diagnose problems that appear to be application related, and perhaps rightly so, but that answer is definitely incorrect.  As near as I can tell, the button on your page is linked to the correct subroutine, so the problem must lie elsewhere - almost certainly with the request/response interaction that is happening behind the scenes.


Rachael Katz
- Custom Focusing Screens for DSLR Cameras

Offline

 

#25 06-08-2008 13:25:49

AskFred
Member
Registered: 05-23-2008
Posts: 16

Re: Godaddy.com Curl Config

Now when I try to checkout via Website Paypal Pro, I get this error message -

Script Execution Error
The following error was returned:

There was a problem retrieving a response from the cURL executable. The executable was found, however it does not appear to be working properly.

http://www.abcfurnishing.com/cgi/ccp51/ … p;secure=Y

Any suggestions would be appreciated.

Thanks

Offline

 

Board footer