Skip to content

Instantly share code, notes, and snippets.

@alex-zige
Created March 12, 2012 00:56
Show Gist options
  • Save alex-zige/2018978 to your computer and use it in GitHub Desktop.
Save alex-zige/2018978 to your computer and use it in GitHub Desktop.
makedown:magento dps
###Magento DPS Problem
#problem with Magento DPS
#Shipping address within NZ works fine. Shipping outside NZ using DPS payment failed even though the credit card transaction has been approved.
# changed the rounding from 2 digits to 4 digits for correcting the rounding amomunt. but seesm it break on the DPS default 2 digits rounding seting.
# Plugin URL: [wiki]
*http://trac.fooman.co.nz/MB0002_DpsPaymentExpress/
# Payment selected PaxPay [DPS hosted mode]
# Debugging in DPS magent moduel
# how to turn on
# where to find it
public_html/ss/shop/var/log/magebase_dps_pxpay.log [it helps on the identifying the errors]
# whats the error
# Error Message :defect: Totals Mismatched [causing thie problem]
# Fix
# Refer
magebase.com/magento-extensions/extension-magebase-dps-payment-express-gateway/
All my credit card orders are coming through as ‘cancelled’ even though DPS has taken the money and put it in our account. Anyone know why this would be happening?
I’m using 1.6.1.0 with v1.2.3 of this plugin.
I don’t think we’ve changed anything recently.
Reply
Did you change / add some shipping costs perhaps? Maybe you added some extension that implements some additional charges? Best to check the magebase_dps log under [siteroot]/var/log/ for any messages. You may need to enable logging in your admin backend.
My guess is that you’re getting a value mismatch for the order total. In my experience this happens when you use shipping costs that have more than 2 non-zero decimal places. ie.: 3.5692. There is a stringent check on payment return that verifies that the paid total matches the order total. The discrepancy comes from the order total being calculated at the full precision and the paid total being rounded to 2 decimals.
There are two ways around this, you can alter the validation code in app/code/community/MageBase/DpsPaymentExpress/Model/Method/Pxpay.php around line 353:
1
2
if (abs((float)$resultXml->AmountSettlement - $order->getBaseGrandTotal()) >0.0005) {
...
and change the 0.0005 to say 0.05
or revisit your shipping costs and change them to 2 decimal values if that’s what was causing the issue.
But before changing the code, make sure you establish the actual reason for failure.
Reply
Darren
Darren
December 20, 2011 at 2:15 pm / Permalink
That worked – we implemented the rounding error fix for prices and that’s what had happened.
Shipping costs are already set to 2 digits, so I implemented your fix above and it’s now fine again. Thanks heaps for that. I hope you and Leanne have a great Xmas.
Reply
Robert Popovic
Robert Popovic
December 20, 2011 at 2:21 pm / Permalink
Great you managed to fix your site. You have a fantastic Christmas too.
Reply
Darren
Darren
December 20, 2011 at 2:23 pm / Permalink
99% fixed. I now can’t cancel orders, but I’ll look into that later! :)
Reply
Robert Popovic
Robert Popovic
December 20, 2011 at 2:28 pm / Permalink
Once an order is “Invoiced” you can’t cancel it, you need to refund it by issuing a credit note.
It’s standard Magento order workflow. You can only cancel orders without invoices/shipments, ie. only Pending ones. You can change your payment method to Authorize (instead of Purchase) then you would be able to cancel them, but also, you will have to create invoices manually and your orders would come in Pending.
Reply
Darren
Darren
December 20, 2011 at 2:34 pm / Permalink
Ah, of course – the orders that failed weren’t invoiced. That makes sense. All sorted now.
Reply
Dan
Dan
December 23, 2011 at 9:35 am / Permalink
Hi Robert,
Can you please advise if this DPS extension runs on Magento 1.6?
Just that the MagentoConnect site says only up to 1.5.
Thanks.
Reply
Darren
Darren
December 23, 2011 at 9:54 am / Permalink
I’m running it on 1.6.1.0 and 1.4.1.1 and it’s fine.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment