(Definitely under construction)
The payment system provides the site admin ways of configuring the available payment methods and the customer to choose from them.
The payment system is driven by hook_payment_method. These pages documents the arguments of the callback function defined through hook_payment_method.
The operation available are
- cart-details
- The customer can fill in the payment details
- cart-process
- processing the posted data. This is the place to block continuing the checkout by returning false.
- cart-review
- a list of given payment data
- edit-process
- processing the posted data
- order-delete
- ?
- order-details
- ?
- order-load
- ?
- order-save
- ?
- order-submit
- ?
- order-view
- ?
- settings
- setting the configuration items for this payment method
This op is still puzzling me
- customer-view. Does it exists?
The callback function signatures below are based on:
- on the uc_payment_payment_method.inc function uc_payment_method_cod.
- http://www.ubercart.org/files/uc_payment.module.txt
- uc_credit.module shows us we have to use hook_order together with the callback defined with hook_payment_method.
- and probably more
Note that ops from hook_order are part of the ops below.
Note also the different signatures of the return value.
<?php
function uc_payment_method_cod($op, &$arg1) {
switch ($op) {
case 'cart-details':
// @return text and striped form
$details = ""
return $details;
case
'cart-process':
// @return TRUE | FALSE to process cart
return TRUE | FALSE;
case
'cart-review':
// @return : array of arrays
$review[] = array ( 'title' => t(), 'data'=> value)
..
return $review;
case
'edit-process':
$changes['payment_details']['pm_other_description'] = check_plain($_POST['pm_other_description']);
return $changes;
case
'order-delete':
db_query("DELETE FROM {uc_payment_cod} WHERE order_id = %d", $arg1->order_id);
break;
case
'order-details':
// @return a striped form
$details = uc_strip_form(drupal_get_form( ...
return $details;
case
'order-load':
// @return NULL
// Database load and changing $arg1 accordingly
break;
case
'order-save':
// @return NULL
// Database update
break;
case
'order-submit':
// @return array ( 'pass' => TRUE | FALSE, 'message' => 'text');
// I noted some SESSION manipulation
return $result;
case
'order-view':
// @return text
$output = ... some text
return $output;
case
'settings':
// @return drupal form
return $form;
}
}
?>