| Project: | Paypal Framework |
| Version: | 4.7.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Issue Summary
I wanted a feature for this module that would let other modules interact with verified paypal transactions without gronking through the database for new transactions, so I added a simple callback mechanism to the framework.
The interface is simple: If a developer wants their module to take action on a verified PayPal transaction, in the hook_menu !$may_cache section, put:
<?php
paypal_framework_register_verify_callback("my_callback_function");
?>Then, when a PayPal transaction is verfied, all functions that have been registered are called with the hash containing the PayPal post data as its single argument. So, the callback function should be defined as follows:
<?php
function my_callback_function($args) {
/* stuff to do when PayPal transactions are handled goes here */
}
?>This works in real time or with queueing trurned on. The callbacks are called after the framework transaction log is run, so in case of an error, at least the verified transaction is still recorded. An arbitrary number of callbacks may be registered. The order of execution of the callbacks is undefined (most probably in the order Drupal initializes modules).
It's a super simple patch, which I did for 4.6, but would be happy to do for 4.7 as well, if you're interested in it.
Randy, 31 AUG 2006 2258Z.