Reputation: 2446
I'm looking into an issue where the Refund button isn't available for orders that were placed prior to an upgrade of a client site from 1.3 to 1.7. I'm attempting to create a credit memo from Sales Order > Invoice > Credit Memo.
Drilling into the code and data, it seems that $this->getCardsStorage()
is not returning any stored credit cards for order payments made prior to the upgrade. In fact, the additional_information
field in the sales_flat_order_payment table is NULL for those orders - I believe that field was created in 1.4 or later.
The thing that seems odd to me is that there would be no backwards compatibility for payment data created prior to 1.4. I've done a decent bit of searching for this problem and the closest thing I can find is where people are having problems with refunds entirely after upgrading. That's not the case for me - refunds appear to be working fine for post-upgrade orders.
If it is the case that there simply is not backwards-compatibility, it would be good to at least see a bug report on it.
I posted this to the magento bug tracker: Bug #28601
Upvotes: 3
Views: 952
Reputation: 9223
That's true, there is a problem with it in 1.4 upgrades.
In 1.4 were introduced transactions and were used additional_information
field, there were different field before, called additional_data
, that was also serialized, but in different manner, you can look up for payment record before 1.4 and after 1.4 to compare how the data structure is changed. And when you will see the difference in data, you can create a script that will migrate old values.
Sincerely, Ivan
UPDATE
Check the following code: https://github.com/LokeyCoding/magento-mirror/blob/magento-1.3/app/code/core/Mage/Paygate/Model/Authorizenet.php
During authorization process, transaction id is stored in both properties: cc_trans_id and last_trans_id. When customer perform a capture only last_trans_id get updated.
In 1.3 method getRefundTransactionId() was returning last_trans_id value.
In 1.7 the same method is looks like the following: https://github.com/LokeyCoding/magento-mirror/blob/magento-1.7/app/code/core/Mage/Paygate/Model/Authorizenet.php
So you see it is completely rewritten!
For making your 1.7 code work for 1.3 transaction, you need to do the following for old transactions:
last_trans_id == cc_trans_id
and order has invoice, then create only capture transaction record in order_payment_transaction table.last_trans_id == cc_trans_id
and order does not have invoice, create authorization transaction recordlast_trans_id !== cc_trans_id
create 2 records, first with cc_trans_id
and it will be auth transaction and second one will be a child transaction with capture type.When you will export this old orders with such values, you will be able to refund old order from the admin.
Upvotes: 3