You are here

function uc_payment_configuration in Ubercart 5

File

payment/uc_payment/uc_payment_workflow.inc, line 15
This file contains the Workflow-ng hooks and functions necessary to make the order related entity, conditions, events, and actions work.

Code

function uc_payment_configuration() {

  // Set the order status to "Payment Received" when a payment is received
  // and the balance is less than or equal to 0.
  $configurations['uc_payment_received'] = array(
    '#type' => 'configuration',
    '#label' => t('Update order status on full payment'),
    '#event' => 'payment_entered',
    '#module' => 'uc_payment',
    '#active' => TRUE,
  );
  $configurations['uc_payment_received'][] = array(
    '#type' => 'condition',
    '#name' => 'uc_payment_condition_balance',
    '#argument map' => array(
      'order' => 'order',
    ),
    '#settings' => array(
      'balance_comparison' => 'less_equal',
    ),
  );
  $configurations['uc_payment_received'][] = array(
    '#type' => 'action',
    '#name' => 'uc_order_action_update_status',
    '#argument map' => array(
      'order' => 'order',
    ),
    '#settings' => array(
      'order_status' => 'payment_received',
    ),
  );

  // Set the order status to "Completed" when checkout is complete, none
  // of the products are shippable, and the balance is less than or equal to 0.
  $configurations['uc_checkout_complete_paid'] = array(
    '#type' => 'configuration',
    '#label' => t('Update order status upon checkout completion with full payment'),
    '#event' => 'checkout_complete',
    '#module' => 'uc_payment',
    '#active' => TRUE,
  );
  $configurations['uc_checkout_complete_paid'][] = array(
    '#type' => 'condition',
    '#name' => 'uc_payment_condition_balance',
    '#argument map' => array(
      'order' => 'order',
    ),
    '#settings' => array(
      'balance_comparison' => 'less_equal',
    ),
  );
  $configurations['uc_checkout_complete_paid'][] = array(
    '#type' => 'condition',
    '#name' => 'uc_order_condition_is_shippable',
    '#argument map' => array(
      'order' => 'order',
    ),
    '#negate' => TRUE,
  );
  $configurations['uc_checkout_complete_paid'][] = array(
    '#type' => 'action',
    '#name' => 'uc_order_action_update_status',
    '#argument map' => array(
      'order' => 'order',
    ),
    '#settings' => array(
      'order_status' => 'completed',
    ),
  );
  return $configurations;
}