[ic] CSI Linkpoint API woes !!

Thomas Cherryhomes interchange-users@interchange.redhat.com
Tue Oct 9 12:11:03 2001


I have a globalsub included in my interchange.cfg (I saved it as
eg/globalsub/linkpt)... And I seem to be getting the following error
when starting up Interchange:

- - - [05/October/2001:00:22:51 -0500] - - Bad GlobalSub 'linkpt'
> In line 144 of the configuration file 'eg/globalsub/linkpt':
> GlobalSub <<EOF
> 
> 

Here is the globalsub in question:
(/usr/lib/interchange/eg/globalsub/linkpt)

GlobalSub <<EOF
sub linkpt {
use LPERL;
##use LPERL 'CapturePayment';

###################################################
# create a new instance of LPERL ...
#
# The first parameter is the path and name of the
# binary executable that processes transactions.
#
# The second parameter is passed to the binary
# executable
#
# The third parameter is the path to the directory
# where temporary data files will be stored for the
# transaction data.
#
# PLEASE NOTE:  These data files contain transaction
# data such as credit card numbers and should only
# be stored in a directory that is secure.
###################################################

my $lperl = new LPERL("/usr/lib/interchange/csi/lbin", "FILE",
"/usr/lib/interchange/csi/temp/");

#######################################################
#
# These parameters must be modified to reflect the
# information provided to you for YOUR store
#
# $transacitonresult should be set to LIVE when doing
# live transactions on https://secure.linkpt.net
#
#######################################################

my $hostname           = "secure.linkpt.net";
my $port               = "1139";
my $storename          = "534510";
my $keyfile            = "/usr/lib/interchange/lib/cert.pem";
my $transactionresult  = "GOOD";
my $testip             = "64.64.113.119";


############################################################
#
#    BillOrders Test (capturepayment ... then billorders)
#
#      This function is used to bill all orders contained
#      within the included hash table.  To keep the example
#      simple, only one order is used.  CapturePayment is
#      called immediately before BillOrders in order to
#      create a transaction to bill against.
#
#############################################################

my %actual = Vend::Order::map_actual();
my $transaction_hash = {
                        hostname        => $hostname,
                        port            => $port,
                        storename       => $storename,
                        keyfile         => $keyfile,
                        # if this param is empty or missing
                        # a CSI order number will be assigned
                        orderID         => "",
                        amount          =>
Vend::Interpolate::total_cost(),             #$actual{'total-cost'},
                        result          => $transactionresult,
                        cardNumber      =>
$actual{mv_credit_card_number},
                        cardExpMonth    =>
$actual{mv_credit_card_exp_month},
                        cardExpYear     =>
$actual{mv_credit_card_exp_year},
                        name            => "$actual{fname}
$actual{lname}",
                        email           => $actual{email},
                        phone           => $actual{phone_day},
                        address         => $actual{address1},
                        city            => $actual{city},
                        state           => $actual{state},
                        zip             => $actual{zip},
                        country         => $actual{country},
                        ip              => $testip,
                };

my %ret = $lperl->CapturePayment($transaction_hash);
# ---------------------------------------------
# capture the order ID so we can bill the order
# ---------------------------------------------

my $neworderID = $ret{'neworderID'};
my %result;

print "CapturePayment: statusCode: $ret{'statusCode'}\n";

if ( $ret{'statusCode'} eq 0 ) {

    # the transaction failed.  print the reason.
     $result{MStatus} = 'failure';
     $result{MErrMsg} = "$ret{'statusMessage'} ";
print "CapturePayment: statusMessage: $ret{'statusMessage'}\n";
print "CapturePayment: ChargeTotal: Vend::Interpolate::total_cost()\n";

}
else
{
    # the transaction succeeded.  print the results.

#print "CapturePayment: statusMessage: $ret{'statusMessage'}\n";
#print "CapturePayment: AVSCode: $ret{'AVSCode'}\n";
#print "CapturePayment: trackingID: $ret{'trackingID'}\n";
#print "CapturePayment: neworderID: $ret{'neworderID'}\n";
#print "CapturePayment: statusApproval: $ret{'statusApproval'}\n";
#print "CapturePayment: chargetotal: $ret{'chargetotal'}\n";
#print "CapturePayment: shipping: $ret{'shipping'}\n";
#print "CapturePayment: subtotal: $ret{'subtotal'}\n";
#print "CapturePayment: tax: $ret{'tax'}\n";
#print "CapturePayment: time : $ret{'time'}\n\n";

# ------------------
# now bill the order
# ------------------

     $transaction_hash = {
            hostname        => $hostname,
            port            => $port,
            storename       => $storename,
            keyfile         => $keyfile,
            result          => $transactionresult,
            orders          => ([
                          # multiple entries could be used for more
orders
              {orderID      => $neworderID,
               amount       => $actual{'total-cost'},
               backOrdered  => '0',
              }
            ])
        };

%ret = $lperl->BillOrders($transaction_hash);

#print "Successfully billed $ret of 1 order\n";
#print "Order  statusMessage:
$transaction_hash->{'orders'}[0]->{'statusMessage'}\n";
$result{MStatus} = 'success';
$result{'order-id'} = $neworderID;

}
return %result;
}
EOF

I am at my wits end! This is driving me nuts! Does anyone have any
suggestions?

-Thom Cherryhomes
OpenMINDS