688255; #--------------------------------------------------------------- # # Generated by DHOCCControlOCCConfigCtrl # #--------------------------------------------------------------- # my $bCompleteOnTechnicalFailures = $::FALSE; my $bCompleteOnFinancialFailures = $::FALSE; my $bAuthorize = $::FALSE; my $bTestMode = $::FALSE; my $sProcessScriptURL = 'https://www.secure-server-hosting.com/secutran/actinic.php'; my $sMerchantName = ''; my $sMerchantID = 'SH210989/219667'; my $sSigType = '2'; # #--------------------------------------------------------------- # # OCCPspKitScriptTemplate.pl - code part of OCC script # # Copyright (c) Actinic Software Ltd 2001 All rights reserved # # *** Do not change this code unless you know what you are doing *** # # Adapted from OCCAuthorizeNetScriptTemplate.pl by Bill Birthisel # Written by Mike Purnell # # This script is called by an eval() function and it will already # have the following variables set up: # # Expects: $::sOrderNumber - the alphanumeric order number for this order # $::nOrderTotal - the total for this order (stored in based currency format e.g. 1000 = $10.00) # %::PriceFormatBlob - the price format data # %::InvoiceContact - customer invoice contact information # %::OCCShipData - customer invoice shipping information # $::sCallBackURLAuth - the URL of the authorization callback script # $::sCallBackURLBack - the URL of the backup script # $::sCallBackURLUser - the URL of the receipt script # $::sPath - the path to the Catalog directory # $::sWebSiteUrl - the Catalog web site URL # $::sContentUrl - the content URL # $::sCartID - the cart id # # Affects: $::eStatus - the status of the transaction: # $::FAILURE - Failure # $::ACCEPTED - Accepted # $::REJECTED - Rejected # $::PENDING - Pending # $::sErrorMessage - error message if any # $::sHTML - the HTML to display # $::sRedirectURL - (optional) data for logging or # for redirect if implemented someday # # $Revision: 18819 $ # #--------------------------------------------------------------- use strict; # # This block of code isolates the plug-in scripts from version specific code that they have historically used # BEGIN my $sCartID; if (defined $::EC_MAJOR_VERSION) # EC version 6 or greater { $sCartID = $::sCartID; # Use the value setup by OrderScript.pl } else # Pre-version 6 { $sCartID = $::g_sCartId; # copy the global value } # END # This block of code isolates the plug-in scripts from version specific code that they have historically used # # # The OCC plug-in runs in pending mode. This script does not # perform the transaction. Rather, it forwards the customer to # the OCC site for completion. # $::eStatus = $::PENDING; # # constants # my $ALWAYS = 1; my $OPTION = 0; my $NOENCODE = 0; my $ENCODE = 1; # encode both bounce and redirect my $REDIRECT = 2; # encode redirect only my %VarTable; # substitution hash for template # # insert the OCC web site URL into the HTML template # $VarTable{$::VARPREFIX . 'OCC_URL'} = $sProcessScriptURL; # # build up a string of all of the values that must be passed to OCC # my $sHiddenValues; my $sRedirectData = $sProcessScriptURL; # # sprintf template for data form sent to the OCC # my $OCC_template = ''."\n"; my $POST_template = '%s%s=%s'; # # AddPostValues ($sPostSeparator, $sPostName, $sPostValue, $bAlways, $bEncode) # # adds a name/value pair to $sHiddenValues and $sRedirectData # sub AddPostValues { my ($sDelim, $sName, $sValue, $bAlways, $eEncode) = @_; if ($sValue || $bAlways) { my $sEncValue = $sValue; if ($eEncode) { $sEncValue = ACTINIC::EncodeText2 ($sValue, $::FALSE); } if ($eEncode == $REDIRECT) { $sHiddenValues .= sprintf ($OCC_template, $sName, $sValue); } else { $sHiddenValues .= sprintf ($OCC_template, $sName, $sEncValue); } $sRedirectData .= sprintf ($POST_template, $sDelim, $sName, $sEncValue); } } # # order details # AddPostValues ('?', 'MERCHANTID', $sMerchantID, $ALWAYS, $NOENCODE); AddPostValues ('&', 'ORDERNUMBER', $::sOrderNumber, $ALWAYS, $NOENCODE); AddPostValues ('&', 'CURRENCY', $::PriceFormatBlob{SINTLSYMBOLS}, $ALWAYS, $NOENCODE); AddPostValues ('&', 'AMOUNT', $::nOrderTotal, $ALWAYS, $NOENCODE); AddPostValues ('&', 'SIGTYPE', $sSigType, $OPTION, $NOENCODE); # # Calculate the conversion factor for the currency # my $nFactor = 100; my $nNumDigits = $::PriceFormatBlob{"ICURRDIGITS"}; # read the currency format values if(defined $nNumDigits) { $nFactor = (10 ** $nNumDigits); } AddPostValues ('&', 'FACTOR', $nFactor, $ALWAYS, $NOENCODE); # # Add the upload data signature - this is a light signature - just an MD5 hash of the order number, currency, amount and # factor with a fixed semi-secret "secret" # my $sStringToSign = $::sOrderNumber . $::PriceFormatBlob{SINTLSYMBOLS} . $::nOrderTotal . $nFactor . 'z02(nv!io*x%)-+43Huaspl'; my $sSignature; eval '$sSignature = md5_hex($sStringToSign)'; # attempt to hash the string - pre v6 EC doesn't have md5 loaded and will fail AddPostValues ('&', 'SIG', $sSignature, $OPTION, $NOENCODE); # add the signature to the list only if it was created (i.e. md5_hex was loaded) # # supply the cardholder's address details # AddPostValues ('&', 'SALUTATION', $::InvoiceContact{SALUTATION}, $OPTION, $REDIRECT); AddPostValues ('&', 'NAME', $::InvoiceContact{NAME}, $ALWAYS, $REDIRECT); AddPostValues ('&', 'JOBTITLE', $::InvoiceContact{JOBTITLE}, $OPTION, $REDIRECT); AddPostValues ('&', 'COMPANY', $::InvoiceContact{COMPANY}, $OPTION, $REDIRECT); AddPostValues ('&', 'ADDRESS1', $::InvoiceContact{ADDRESS1}, $ALWAYS, $REDIRECT); AddPostValues ('&', 'ADDRESS2', $::InvoiceContact{ADDRESS2}, $OPTION, $REDIRECT); AddPostValues ('&', 'ADDRESS3', $::InvoiceContact{ADDRESS3}, $OPTION, $REDIRECT); AddPostValues ('&', 'ADDRESS4', $::InvoiceContact{ADDRESS4}, $OPTION, $REDIRECT); AddPostValues ('&', 'COUNTRY', $::InvoiceContact{COUNTRY}, $OPTION, $REDIRECT); AddPostValues ('&', 'PHONE', $::InvoiceContact{PHONE}, $OPTION, $REDIRECT); AddPostValues ('&', 'FAX', $::InvoiceContact{FAX}, $OPTION, $REDIRECT); AddPostValues ('&', 'EMAIL', $::InvoiceContact{EMAIL}, $ALWAYS, $NOENCODE); # # limit the buyer's postcode to 10 charcters # AddPostValues ('&', 'INVOICEPOSTCODE', substr($::InvoiceContact{POSTALCODE}, 0, 10), $ALWAYS, $REDIRECT); # # other fields # AddPostValues ('&', 'MOVINGCHECKSTATUS', $::InvoiceContact{MOVINGCHECKSTATUS}, $ALWAYS, $NOENCODE); AddPostValues ('&', 'USERDEFINED', $::InvoiceContact{USERDEFINED}, $ALWAYS, $NOENCODE); # # end of the invoice address details # if ($bAuthorize) # if in pre-authorize mode, set the flag { AddPostValues ('&', 'PREAUTH', '1', $ALWAYS, $NOENCODE); } if ($bTestMode) # only include the test mode flag if it is on { AddPostValues ('&', 'TESTMODE', '1', $ALWAYS, $NOENCODE); } # # add the cart ID for validation # AddPostValues ('&', 'CARTID', $sCartID, $ALWAYS, $NOENCODE); # # URLs: # # AUTH - the URL to create the authorization blob # BACK - the URL to return to the Catalog checkout process # USER - the URL to the receipt script # AddPostValues ('&', 'CALLBACKURLAUTH', $::sCallBackURLAuth, $ALWAYS, $REDIRECT); AddPostValues ('&', 'CALLBACKURLBACK', $::sCallBackURLBack, $ALWAYS, $REDIRECT); AddPostValues ('&', 'CALLBACKURLUSER', $::sCallBackURLUser, $ALWAYS, $REDIRECT); # # add the OCC values to the template # $VarTable{$::VARPREFIX . 'OCC_VALUES'} = $sHiddenValues; my $sLinkHTML = 'occlink.html'; if(defined $::g_pPaymentList) { $sLinkHTML = $$::g_pPaymentList{ActinicOrder::PaymentStringToEnum($::g_PaymentInfo{'METHOD'})}{BOUNCE_HTML}; } @Response = ACTINIC::TemplateFile($::sPath . $sLinkHTML, \%VarTable); # build the file if ($Response[0] != $::SUCCESS) { $::eStatus = $::FAILURE; # return a plug-in error $::sErrorMessage = $Response[1]; return ($::SUCCESS); # always return success if the script runs } @Response = ACTINIC::MakeLinksAbsolute($Response[2], $::sWebSiteUrl, $::sContentUrl); if ($Response[0] != $::SUCCESS) { $::eStatus = $::FAILURE; # return a plug-in error $::sErrorMessage = $Response[1]; return ($::SUCCESS); # always return success if the script runs } $::sHTML = $Response[2]; # grab the resulting HTML $::sRedirectURL = $sRedirectData; # data for log or redirect # # process the test mode warning # my ($sDelimiter) = $::DELPREFIX . 'TESTMODE'; if ($bTestMode) # only include the test mode block if we are in test mode { $::sHTML =~ s/$sDelimiter//g; # remove the delimiter text } else # not in test mode - remove the block { $::sHTML =~ s/$sDelimiter(.*?)$sDelimiter//gs; # remove the test mode warning blob (/s removes the \n limitation of .) } return ($::SUCCESS); # # End of OCCPspKitScriptTemplate.pl # # # End of File