There is the possibilty of defining webhooks that notify of transaction status, etc. That could be used instead or additionally to the Cron implementation

Here's the documentation: https://docs.oppwa.com/tutorials/webhooks

Comments

agoradesign created an issue. See original summary.

jrochate’s picture

This is fundamental aspect of commerce_opp, specially on transaction types that must wait for user to take action, like:
- SIBS_MULTIBANCO
- MB WAY
- maybe others

Instead of polling the server for the transaction state, with a web hook the module would be contacted in case of a transaction state change.

For a large number of transactions, the web hook are the only solution to avoid Drupal server overflow with requests.

There are some examples about implementing a Webhook on Drupal 8, where we could start paving the way:

Webhook project that is lagging on time for another alpha or RC to merge all pending patches

article about Webhooks explaining the process and with code examples

The API of OPP needs some decrypting of the payload that will need Libsodium if PHP is <7.1:

https://sibs.docs.onlinepayments.pt/tutorials/webhooks/decryption-example

If you think on the structure and best methodology, maybe we can work in this.

agoradesign’s picture

thanks for the input..

Processing the webhook requests shouldn't be too different to processing the payment notifications, we already do.

We will define an explicit route, that we can fully control by an own controller, so modules like the mentioned webhook module would only complicate things :)

regarding decrpytion: we will just raise requirements to PHP 7.1, as PHP 7.0 is officially not maintained any more - I know, Drupal Core officially still support it, while not recommending it.

  • agoradesign committed 1b86f1f on 8.x-1.x
    Issue #3020030 by agoradesign: Implement web hooks
    
agoradesign’s picture

Pushed an untested implementation - no real test requests done so far. Additonally, the README must be extended with a webhooks section, describing how to configure them

And we'll have to create a follow up issue on providing config settings on a per-gateway base, for allowing to en-/disable processing the pending payments on cron, as well as deleting expired authorizations on cron.

agoradesign’s picture

added child issues for README updates and configuration changes

  • agoradesign committed 6508b6d on 8.x-1.x
    Issue #3020030 by agoradesign: Implement web hooks
    

  • agoradesign committed b060e29 on 8.x-1.x
    Issue #3020030 by agoradesign: Implement web hooks
    

  • agoradesign committed 4f6a0de on 8.x-1.x
    Issue #3020030 by agoradesign: Implement web hooks
    

  • agoradesign committed d1671aa on 8.x-1.x
    Issue #3020030 by agoradesign: Implement web hooks
    

  • agoradesign committed 67162b2 on 8.x-1.x
    Issue #3020030 by agoradesign: Implement web hooks
    

  • agoradesign committed 6344617 on 8.x-1.x
    Issue #3020030 by agoradesign: Implement web hooks
    
agoradesign’s picture

Test payments with different brands (VISA, SOFORT, Paypal) were successful.. however, we found out that all of our 3 currently global settings should be shifted to gateway configuration level instead, see #3104794: Allow to control cron operations per configuration for more information... We'll keep this one open, until the other issue is resolved

agoradesign’s picture

Status: Active » Fixed

Related issues are marked as fixed, so we can fix this too

Status: Fixed » Closed (fixed)

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