use Win32::OLE;
###################################################################
# Create a SecureTrading Object using Win32::OLE
$stm = Win32::OLE->new ("SecureTrading.STMerchant") || die "CreateObje
+ct: $!"; # create ST object
my %Result; # SecureTrading Response Codes
$Result{authorised} = 1; # ...
$Result{declined} = 2; # ...
$Result{error} = 3; # ...
$Result{other} = 4; # ...
$stroot = "."; # Path to certificate files
###################################################################
# SecureTrading merchant reference for this site
$stm->{SiteReference} = "T16002";
###################################################################
# SecureTrading certificate files
$stm->{CertificateFile} = "$stroot/pem/xyzcotestcert.pem";
$stm->{PrivateKeyFile} = "$stroot/pem/xyzcotestkey.pem";
$stm->{ServerCAFile} = "$stroot/pem/testserverca.pem";
$stm->{GatewaysFile} = "$stroot/testgateways.txt";
###################################################################
# Open Connection
$stm->Open();
###################################################################
# Transaction information
$stm->{TransactionType} = "AUTHORIZE";
$stm->{CardType} = "VISA";
# Use this number for rejection = "4242 4242 4242 4242"
$stm->{CardNumber} = "4111 1111 1111 1111";
$stm->{ExpiryDate} = "02/99";
$stm->{IssueNumber} = "0";
$stm->{Amount} = "1500";
$stm->{Currency} = "GPB";
###################################################################
# Settlement Information
$stm->{SettleNow} = 1;
###################################################################
# CardHolder Information
$stm->{CardHolderPresent} = 1;
$stm->{CardHolderEmail} = "test\@test.com";
$stm->{CardHolderCountry} = "UK";
$stm->{CardHolderAddress} = "A test address; somewhere; here;";
$stm->{CardHolderTelephone} = "01233 456 789";
$stm->{CardHolderName} = "Ted tester";
###################################################################
# Internet information about card holder
$stm->{CardHolderIp} = $ENV{'REMOTE_IP'};
$stm->{CardHolderBrowser} = $ENV{'BROWSER'};
###################################################################
# Merchant information about order
$stm->{MerchantOrderReference} = "TEST-0001#a";
$stm->{MerchantOrderInfo} = "A test transaction";
###################################################################
# Create the STMerchant details
print "Creating Transation...\n";
$stm->Create();
###################################################################
# Send Transaction
print "Sending Transation...\n";
$stm->Send();
print "Transaction Sent.\n\n";
###################################################################
# Display results
print "**** RESULT ****\n";
print "Reference Number: ", $stm->{ReferenceNumber}, "\n";
if ($stm->{result} == $Result{authorised}) {
print "Transaction: Authorized\n";
print "Auth Code: ", $stm->{AuthCode}, "\n";
print "Confidence Rating: ", $stm->{ConfidenceRating}, "\n"
+;
}
elsif ($stm->{result} == $Result{declined}) {
print "Transaction: Declined\n"; }
elsif ($stm->{result} == $Result{error}) {
print "There was an error in authorizing the transaction\n";
print "Error : ", $stm->{Error}, "\n";
}
else {
print "There was an unknown error!!\n";
}
###################################################################
# Close the connection to the SecureTrading Module
$stm->Close($stm);
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|