Unified payment processor providing payment gateway for any Horde module.
List any tickets on http://bugs.horde.org/ that cover this issue or are relevant to it.
Duck duck@obala.net
http://cvs.horde.org/incubator/Horde_Payment/
A payment processing module encapsulating all communications with various payment interfaces.
The application just push a payment requests with authorizationRequest API call. When a payment is processed, the payment module calls the selling applications authorizationResponse callback API method to notify it of the results.
The payment module provides an administrative interface to list and search payment requests per module, amount, user status etc.
$app = $registry->getApp(); // Calling app $transaction_id = "myID123"; // App internal unique id $total = 500; // Total requested amount $params = array(); // Optional: Additional payment parameters, like user details (name, address etc..) // Check if any authorization method exits and is linked to this $authorization_methods = $registry->call('payment/getMethods', array($app)); // Push an paymnet authorization request $authorizationID = $registry->call('payment/authorizationRequest', array($app, $transaction_id, $total, $params)); // Redirect to paymnet system // $redirect_url = $registry->link('payment/show', array('id' => $transaction_id, 'module' => $app)); $redirect_url = $registry->link('payment/show', array('id' => $authorizationID)); header('Location:' . $redirect_url); exit;
... $_services['authorizationResponse'] = array( 'args' => array('id' => 'id', 'params' => '{urn:horde}stringArray'), 'type' => 'string' ); .... /** * Handle authorization response. * * @param string $id Invoice identification number * @param string $params Additional parameters */ function _manios_authorizationResponse($id, $params) { require_once dirname(__FILE__) . '/base.php'; $manios_driver = Manios_Driver::singleton(); if ($manios_driver instanceof PEAR_Error) { return $manios_driver; } $transaction = $manios_driver->getTransaction($id); if ($transaction instanceof PEAR_Error) { return $transaction; } switch ($params['status_id']) { case Payment::PENDING: // We have noting to do return true; break; case Payment::VOID: case Payment::REVOKED: // Cancle order return $manios_driver->deleteTransaction($id, $transaction['advertiser_id']); case Payment::SUCCESSFUL: // Payment was successfully, process order return $manios_driver->confirmTransaction($id); default: // Unknown return PEAR::raiseError(_("Unknown response status")); } }
Configure payment methods
Link payment methods to application
Search authorizations
Add a testing process request
Back to the Project List