We are developing a payment gateway in Bolivia that uses cash payments in stores (https://www.drupal.org/project/commerce_pagos_net). The plugin is implementing both the OnsitePaymentInterface (because during checkout we call a web service to send the code that the user will have to present at the physical store to pay) and also implements the OffistePaymentInterface, because the payments provider sends a JSON back to our site once the user pays in any store. It works right now because in the PaymentProcess class, the `if` checks before if we are implementing the OnsitePaymentInterface, but if the if order changed then it would no longer work. I think it would be better to separate the onNotify method of the OffsitePaymentInterface to another interface so that any payment gateway can implement the onNotify method and use the OffsitePaymentController.

Comments

jackbravo created an issue. See original summary.

jackbravo’s picture

Status: Active » Needs review
StatusFileSize
new4.59 KB

Here is the patch.

This is from this PR on github: https://github.com/drupalcommerce/commerce/pull/782

bojanz’s picture

Title: Split Offsite interface onNotify method to a new interface » Move OffsitePaymentGatewayInterface::onNotify to its own interface
Status: Needs review » Needs work

Better title. Suggested naming it SupportsNotificationsInterface in the PR.

jackbravo’s picture

Status: Needs work » Needs review

Sounds good. I've just updated the PR.

Is it too much noise updating both the PR and the issue in d.o? Do you prefer one over the other?

bojanz’s picture

I get notified for both, so it's your choice. I don't mind seeing both.

  • bojanz committed 755924e on 8.x-2.x authored by jackbravo
    Issue #2906360 by jackbravo, bojanz: Move OffsitePaymentGatewayInterface...
bojanz’s picture

Status: Needs review » Fixed

Added more docs, split the controller into two (since notifications are not off-site specific anymore), and committed.

Thanks! This will allow onsite gateways to implement webhooks, which is important.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.