Contributions
PSiGate XML Interface
Data is put into XML and sent securely to the gateway, and then the module parses the XML responses for approval and stores them in a separate database table.
The module supports 2 store id's (one for CAD currency, the other for USD currency) and automatically sends the correct store id based upon the currency that your customer has selected during the checkout process (assuming you support multiple currencies on your store).
Future development will include displaying the data stored in the database on the admin order page, and e-checks once psigate begins to support it on their gateway.
Expand All / Collapse All
Files to be altered:
catalog/includes/modules/payment/psigate_xml.php
catalog/includes/languages/english/payment/psigate_xml.php
***Note - the javascript function and the decline error message are
necessary changes, the others are preferences.
Alterations:
1. Added an email title for the payment method so it says
Payment Method: Credit Card, instead of PSI Gate XML on the confirmation email.
2. Updated the previously submitted js validation script, just needed ''s in front of the n's
3. Added the display of Card Type on the checkout confirmation page.
4. Changed display of CC Number on checkout confirmation page to only show last 4 digits.
5. Fixed the Declined Credit Card code in the before_process function - was previously not
displaying the error on the page, only redirecting them to the payment page without feedback.
/**** Function javascript_validation******/
/**** Added missing } in the end******/
/**** FILE: catalog->modules->payment->psigate_xml.php *****/
/**** Find replace function below ****/
function javascript_validation() {
$js = ' if (payment_value == "' . $this->code . '") {' . "n" .
' var cc_owner = document.checkout_payment.psigate_xml_cc_owner.value;' . "n" .
' var cc_number = document.checkout_payment.psigate_xml_cc_number.value;' . "n";
$js .= ' if (cc_owner == "" || cc_owner.length < ' . CC_OWNER_MIN_LENGTH . ') {' . "n" .
' error_message = error_message + "' . MODULE_PAYMENT_PSIGATE_XML_TEXT_JS_CC_OWNER . '";' . "n" .
' error = 1;' . "n" .
' }' . "n" .
' if (cc_number == "" || cc_number.length < ' . CC_NUMBER_MIN_LENGTH . ') {' . "n" .
' error_message = error_message + "' . MODULE_PAYMENT_PSIGATE_XML_TEXT_JS_CC_NUMBER . '";' . "n" .
' error = 1;' . "n" .
' }' . "n" .
' }' . "n"; /** Added missing bracket, make sure ; (semicolon) above is changed to . (dot)**/
return $js;
}
/**** Function get_process******/
/**** Added tep_db_prepare_input statement to fields that can create error in mysql******/
/**** FILE: catalog->modules->payment->psigate_xml.php *****/
/**** Find replace below code ****/
1) Find
$Psi_ErrMsg = $psi->getTrxnErrMsg();
Replace with
$Psi_ErrMsg = tep_db_prepare_input($psi->getTrxnErrMsg());
2) Find
$Psi_IPRegion = $psi->getTrxnIPRegion();
Replace with
$Psi_IPRegion = tep_db_prepare_input($psi->getTrxnIPRegion()); /* fix for regions with ' in the name */
3) Find
$Psi_IPCity = $psi->getTrxnIPCity(); /* fix for city with ' in the name */
Replace with
$Psi_IPCity = tep_db_prepare_input($psi->getTrxnIPCity());
CURL Error 768 forces valid cards to be reported as invalid.
class.psigate_xml.php, line 435:
---------------------------------
if( curl_errno( $ch ) == CURLE_OK )
---------------------------------
can be an unsatisfied condition, where successful CURLOPT_RETURNTRANSFER forces curl_errno( $ch ) = 768. Replace line 435 with:
---------------------------------
if(( curl_errno( $ch ) == CURLE_OK ) || ( curl_errno( $ch ) == 768 )){ // allow for successful CURLOPT_RETURNTRANSFER
---------------------------------
Note: http://bugs.php.net/bug.php?id=15150
To Fix PSI-0013:Invalid SubTotal
This problem is due to comma being added if the subtotal is over 1000. Fix is simple
File: catalog/includes/modules/payment/psigate_xml.php
Replace Line: 201
$psi->setSubTotal(number_format($order->info['total'] * $currencies->get_value($currency), 2));
With
$psi->setSubTotal(number_format($order->info['total'] * $currencies->get_value($currency), 2,'.','')); //number_format($number, 2); fix for comma in subtotal field
Not much changed to the code from 1.2, this mainly is for the looks and popup window. I found that the popup window wasn't working, and I wanted to fix up the look. Hope you like it.
Orginal Support thread:
http://forums.oscommerce.com/index.php?showtopic=159787&hl=
Thanks networkdad!
There has been a currency issue that i was unaware of. New files are here. Prior users upgrading should just replace includes/modules/payment/psigate_xml.php with the new file.
Updated. Upgrading: Replace catalog/includes/modules/payment/psigate_xml.php with new file.
Data is put into XML and sent securely to the gateway, and then the module parses the XML responses for approval and stores them in a separate database table.
The module supports 2 store id's (one for CAD currency, the other for USD currency) and automatically sends the correct store id based upon the currency that your customer has selected during the checkout process (assuming you support multiple currencies on your store).
Future development will include displaying the data stored in the database on the admin order page, and e-checks once psigate begins to support it on their gateway.
Note: Contributions are used at own risk.