activemerchant / active_merchant

Active Merchant is a simple payment abstraction library extracted from Shopify. The aim of the project is to feel natural to Ruby users and to abstract as many parts as possible away from the user to offer a consistent interface across all supported gateways.
http://activemerchant.org
MIT License
4.53k stars 2.5k forks source link

Worldpay: refund not possible? #423

Closed omh closed 12 years ago

omh commented 12 years ago

Looking at the Worldpay gateway it would seem refunds are not possible due to:

  1. According to the Worldpay documentation refunds can only be issued on payments with the status CAPTURED
  2. #refund performs an "inquire" before issuing the refund request
  3. #success_from checks if the :last_event field of the response of the previous request is either "AUTHORISED" or has :ok.

    success_from fails on the inquire request as the inquire returns CAPTURED for the status, not AUTHORISED and it does not have an :ok field. So as far as I can see refunds will never work, or am I missing something here?

Soleone commented 12 years ago

Hi,

thanks for the report! It looks indeed like refunding with WorldPay is completely broken at the moment. I was starting to investigate this last week.

Do you have any more information by chance on how to get this fixed best? I do have a test account available for remote tests, but I'm not familiar with their API yet. Would you be willing to submit a pull request for a fix?

Any more help you can provide would be greatly appreciated!

Thanks, Dennis

ntalbott commented 12 years ago

There is a remote test for refunds, and I'm pretty sure it was working when I originally coded the functionality. Of course, it may be incorrect/insufficient, so that's no guarantee that this hasn't always been broken.

I can look into the functionality, but it's going to have to wait until I can get Worldpay to get my test account working again. Worldpay is... aggravating to deal with.

Soleone commented 12 years ago

Hey Nathaniel,

I have spoken to WorldPay support last week, and after a few days of going back and forth they did provide me with a test account. If you send me a quick email to dennis@jadedpixel.com I can forward you my test account information.

Thanks a ton!

Dennis

ntalbott commented 12 years ago

I actually have a test account, which I'd prefer to use, but it's somehow gone stale. I'll ping you if I can't get it back up and running in a reasonable amount of time.

omh commented 12 years ago

I have a working Worldpay account set up so I'm happy to work on this fix and put together a pull request.

ntalbott commented 12 years ago

Go for it - I'll drop a note here if I get a chance to work on it at all myself.

Soleone commented 12 years ago

thanks a lot, much appreciated!

omh commented 12 years ago

Added a fix + test in pull request 426