Error on refund if payment hasn't been settled

Created on 26 September 2017, about 7 years ago
Updated 20 September 2024, 3 months ago

Maybe the component should be User Interface for this one, and maybe it should in Commerce project, not sure.

As a user with appropriate permissions, I can click "Refund" at admin/commerce/orders/{order_id}/payments for payments even if they have not been settled. This results in an error from Authorize.net because un-settled transactions can only be voided, not refunded.

Possible solutions?
- Use the API to get the settlement status & implement a voidPayment method
- Hide the refund button for 24 hours (yuck)
- SupportsVoidInterface?

We could also consider providing helpful messaging instead of a code fix, but the error from Authorize.net is less than helpful: E000027 The transaction was unsuccessful. We'd be making an educated guess as to why.

πŸ› Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States chrisrockwell

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States andyg5000 North Carolina, USA

    Thanks for the re-roll Ryan. This is working well, but commerce core doesn't support the balance recalculation properly after a void (see πŸ› Order balance calculation discrepancy for voided and expired payments. Active ).

    I've updated the patch to include a forced refresh of the balance. This won't break anything with related to a fix for 3356936, but should be removed once that's resolved.

  • πŸ‡ΊπŸ‡ΈUnited States rhovland Oregon

    So there's an issue if you're using authorize and capture. The void button is shown on settled transactions if you previously viewed it when it was unsettled. It's because of the section of code where it checks if it should refresh the status or not is missing capturedPendingSettlement as one of the status codes.

    Attached a patch that fixes this problem.

  • πŸ‡ΊπŸ‡ΈUnited States rhovland Oregon

    Here is an updated patch to account for changes in the latest release.
    Switched commerce_payment.order_updater to use dependency injection
    Fixed a couple minor errors in the comments

  • Pipeline finished with Failed
    8 months ago
    Total: 241s
    #155732
  • πŸ‡ΊπŸ‡ΈUnited States rhovland Oregon
  • Pipeline finished with Failed
    8 months ago
    Total: 225s
    #155745
  • πŸ‡ΊπŸ‡ΈUnited States rhovland Oregon

    I screwed up dependency injection in the patch. Here's the correct version

  • Pipeline finished with Success
    8 months ago
    #155759
  • Pipeline finished with Success
    8 months ago
    Total: 286s
    #155776
  • Pipeline finished with Success
    4 months ago
    Total: 295s
    #259736
  • Pipeline finished with Success
    4 months ago
    Total: 295s
    #259746
  • πŸ‡ΊπŸ‡ΈUnited States rhovland Oregon

    Rebased changes to account for removing the constructor override in OnsiteBase. Tested changes to ensure I added the dependency correctly and everything is good.

    This probably needs a test but I'm uncertain how to do that since the changes depend on an external API and service.

  • πŸ‡ΊπŸ‡ΈUnited States andyg5000 North Carolina, USA

    Thanks Ryan!

    Once we have some feedback on πŸ› Error 33: Email is required (and E00027) Needs review , we should update this MR to include the customer->email element to the request.

Production build 0.71.5 2024