hps / heartland-magento-extension

Magento Tokenized Payment Gateway Extension
Other
5 stars 18 forks source link

Tried to refund the shipping, but the entire amount got cancelled on the Credit Card #99

Open jonathonbyrdziak opened 8 years ago

jonathonbyrdziak commented 8 years ago

Found another issue. The last few credit memos we're issued for partial amounts have been refunding the entire order. Here are some examples to check out:

jonathonbyrdziak commented 8 years ago

StackTrace

  1. In Hps_Securesubmit_Model_Paypal on line 241 you have $payment->getBaseTotalDue() == $amount, which will send a TRUE boolean to
  2. HpsAltPaymentService on line 80.

The receiving parameter on line 80 public function refund($transactionId, $isPartial = false, $partialAmount = null) is $isPartial, but $payment->getBaseTotalDue() == $amount, will only send TRUE if it is NOT partial.

I am just looking at the code and haven't tested this yet, but if I'm correct, it could be leading to the problem of refunding 100% of the order when I only wanted to partially refund the order.

I realize that this is related to the HPS Paypal and my original issue did not deal with paypal. I'm going to go look to see if this is the same with standard HPS payments.

jonathonbyrdziak commented 8 years ago

XML

I've tested the standard payment direct post to Heartland. The xml that I'm sending over is correct according to your documentation.

<?xml version="1.0"?>
<hps:Transaction>
    <hps:CreditReversal>
        <hps:Block1>
            <hps:Amt>29.50</hps:Amt>
            <hps:AuthAmt>12.51</hps:AuthAmt>
            <hps:GatewayTxnId>1014062970</hps:GatewayTxnId>
            <hps:AdditionalTxnFields>
                <hps:Description>Customer IP Address: 127.0.0.1, User Agent:
                    Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:44.0) Gecko/20100101
                    Firefox/44.0</hps:Description>
                <hps:InvoiceNbr>100002793</hps:InvoiceNbr>
                <hps:CustomerID>asdf@asdf.com</hps:CustomerID>
            </hps:AdditionalTxnFields>
        </hps:Block1>
    </hps:CreditReversal>
</hps:Transaction>

Can you look into this and find out if your system is handling the refunds properly?