
[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
[ic] linkpt GlobalSub
Here is a global sub for Card Services
International / Linkpoint.
First let me say that the formating is bad.
(email client).
This one does work, once you get the perl wrapper
from CSI/Linkpt.
Please feel free to change this. I am sure that
there are better ways of doing this.
Hope this helps someone,
rick
************************************************
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/lib/LPERL/lbin",
"FILE",
"/usr/lib/interchange/lib/LPERL/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 = "370544";
my $keyfile =
"/usr/lib/interchange/lib/cert.pem";
my $transactionresult = "GOOD";
my $testip = "127.0.0.1";
############################################################
#
# 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
__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/
_______________________________________________
interchange-users mailing list
interchange-users@lists.akopia.com
http://lists.akopia.com/mailman/listinfo/interchange-users