magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.53k stars 9.31k forks source link

Braintree refunds should return Refund transaction id instead of parent id with "-refund" appended #31655

Closed Dannez83 closed 3 years ago

Dannez83 commented 3 years ago

Description (*)

Braintree refunds display the original/parent transaction id with "-refund" appended. This is not helpful from an accounts reconciliation point of view or from a customer service point of view when communicating the transaction id of the refund to the customer. The actual refund transaction id would be much more suitable. The parent transaction ID is already set in a separate field in the table. Duplicating the transaction ID into another field and adding "-refund" onto the end provides no benefit and actually fails to provide accurate information

Expected behavior (*)

The refund transaction ID should match the refund transaction id in Braintree.

Benefits

The refund transaction id will match the refund transaction id in Braintree. The customer is given more accurate information. The store owner is able to reconcile payments more easily

Additional information

None necessary. This seems pretty self explanatory to me. Real transaction id better than made up transaction id.

m2-assistant[bot] commented 3 years ago

Hi @Dannez83. Thank you for your report. To help us process this issue please make sure that you provided the following information:

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, please, review the Magento Contributor Assistant documentation.

Please, add a comment to assign the issue: @magento I am working on this


:clock10: You can find the schedule on the Magento Community Calendar page.

:telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket.

:movie_camera: You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel

:pencil2: Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

Dannez83 commented 3 years ago

@magento give me 2.4-develop instance

magento-deployment-service[bot] commented 3 years ago

Hi @Dannez83. Thank you for your request. I'm working on Magento instance for you.

magento-deployment-service[bot] commented 3 years ago

Hi @Dannez83, here is your Magento Instance: https://867d47e268d04f63a0aacd52ed9f3943-2-4-develop.instances.magento-community.engineering Admin access: https://867d47e268d04f63a0aacd52ed9f3943-2-4-develop.instances.magento-community.engineering/admin_2722 Login: 22fad94e Password: 76109a82fc5b

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 14 days if no further activity occurs. Is this issue still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? Thank you for your contributions!

tobiasolge commented 1 year ago

+1

mosky17 commented 1 year ago

+1

nicolasperic-ba commented 3 months ago

To get this fixed after refund on payment method you need to set the following payment fields with the generated refund transaction ID ($refund->getId() is just an example)

    $payment->setLastTransId($refund->getId());
    $payment->setTransactionId($refund->getId());

Check in here vendor/magento/module-sales/Model/Order/Payment.php When a refund is made with a $creditmemo, lines 699-701

    $gateway->refund($this, $baseAmountToRefund);

    $creditmemo->setTransactionId($this->getLastTransId());

Some lines below it will call addTransaction function that will use from payment the transaction_id

    // update transactions and order state
    $transaction = $this->addTransaction(
        Transaction::TYPE_REFUND,
        $creditmemo,
        $isOnline
    );