[cvs] [Wiki] changed: Project/Horde_Payment

Duck duck at obala.net
Sun Nov 30 19:08:10 UTC 2008


duck  Sun, 30 Nov 2008 14:08:10 -0500

Modified page: http://wiki.horde.org/Project/Horde_Payment
New Revision:  1.4
Change log:  authorizationResponse example

@@ -22,9 +22,9 @@
  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.

-++ Features
++++ Features

  * Build in payment methods
   * Cash on delivery
   * Proforma invoice
@@ -36,8 +36,55 @@
  * Configurable payment methods
  * Limit payment methods per application
  * Virtual host support
  * Possibility to add a testing process request
+
++++ authorizationResponse example
+
+<code type="php">
+
+/**
+ * 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"));
+
+    }
+}
+</code>

  ++ Screenshots

  Configure payment methods


More information about the cvs mailing list