function uc_recurring_ca_predicate in UC Recurring Payments and Subscriptions 7.2
Same name and namespace in other branches
- 6.2 uc_recurring.ca.inc \uc_recurring_ca_predicate()
Implements hook_ca_predicate().
File
- ./
uc_recurring.ca.inc, line 34 - This file contains the Conditional Actions hooks and functions necessary to make the recurring-related entity, conditions, events, and actions work.
Code
function uc_recurring_ca_predicate() {
$predicates = array();
// 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.
$predicates['uc_recurring_renewal_complete_paid'] = array(
'#title' => t('Update order status upon renewal completion with full payment'),
'#trigger' => 'uc_recurring_renewal_complete',
'#class' => 'payment',
'#status' => 1,
'#weight' => 1,
'#conditions' => array(
'#operator' => 'AND',
'#conditions' => array(
array(
'#name' => 'uc_payment_condition_order_balance',
'#title' => t('If the balance is less than or equal to $0.00.'),
'#argument_map' => array(
'order' => 'order',
),
'#settings' => array(
'negate' => FALSE,
'balance_comparison' => 'less_equal',
),
),
array(
'#name' => 'uc_order_condition_is_shippable',
'#title' => t('If the order is not shippable.'),
'#argument_map' => array(
'order' => 'order',
),
'#settings' => array(
'negate' => TRUE,
),
),
),
),
'#actions' => array(
array(
'#name' => 'uc_order_update_status',
'#title' => t('Update the order status to Completed.'),
'#argument_map' => array(
'order' => 'order',
),
'#settings' => array(
'order_status' => 'completed',
),
),
),
);
$predicates['uc_recurring_renewal_email_completed'] = array(
'#title' => t('Notify customer when a renewal has occurred.'),
'#trigger' => 'uc_recurring_renewal_complete',
'#class' => 'notification',
'#status' => 0,
'#weight' => 2,
'#conditions' => array(
'#operator' => 'AND',
'#conditions' => array(
array(
'#name' => 'uc_recurring_renewal_status_condition',
'#title' => t('If the order contains product renewal.'),
'#argument_map' => array(
'order' => 'order',
),
'#settings' => array(),
),
),
),
'#actions' => array(
array(
'#name' => 'uc_recurring_renewal_email',
'#title' => t('Send an order email regarding order renewal.'),
'#argument_map' => array(
'order' => 'order',
'recurring_fee' => 'recurring_fee',
),
'#settings' => array(
'from' => uc_store_email_from(),
'addresses' => '[order-email]',
'subject' => uc_get_message('uc_recurring_renewal_completed_subject'),
'message' => uc_get_message('uc_recurring_renewal_completed_message'),
'format' => 1,
),
),
),
);
$predicates['uc_recurring_renewal_email_failed'] = array(
'#title' => t('Notify customer when a renewal has failed.'),
'#trigger' => 'uc_recurring_renewal_failed',
'#class' => 'notification',
'#status' => 0,
'#weight' => 1,
'#conditions' => array(
'#operator' => 'AND',
'#conditions' => array(
array(
'#name' => 'uc_recurring_renewal_status_condition',
'#title' => t('If the order contains product renewal.'),
'#argument_map' => array(
'order' => 'order',
),
'#settings' => array(),
),
),
),
'#actions' => array(
array(
'#name' => 'uc_recurring_renewal_email',
'#title' => t('Send an order email regarding order renewal.'),
'#argument_map' => array(
'order' => 'order',
'recurring_fee' => 'recurring_fee',
),
'#settings' => array(
'from' => uc_store_email_from(),
'addresses' => '[order-email]',
'subject' => uc_get_message('uc_recurring_renewal_failed_subject'),
'message' => uc_get_message('uc_recurring_renewal_failed_message'),
'format' => 1,
),
),
),
);
$predicates['uc_recurring_renewal_email_expired'] = array(
'#title' => t('Notify customer when a renewal has expired due to failed payment.'),
'#trigger' => 'uc_recurring_renewal_failed',
'#class' => 'notification',
'#status' => 0,
'#weight' => 1,
'#conditions' => array(
'#operator' => 'AND',
'#conditions' => array(
array(
'#name' => 'uc_recurring_renewal_status_condition',
'#title' => t('If the order contains product renewal.'),
'#argument_map' => array(
'order' => 'order',
),
'#settings' => array(),
),
array(
'#name' => 'uc_recurring_renewal_expired_condition',
'#title' => t('If the recurring fee has expired.'),
'#argument_map' => array(
'recurring_fee' => 'recurring_fee',
),
'#settings' => array(),
),
),
),
'#actions' => array(
array(
'#name' => 'uc_recurring_renewal_email',
'#title' => t('Send an order email regarding order renewal.'),
'#argument_map' => array(
'order' => 'order',
'recurring_fee' => 'recurring_fee',
),
'#settings' => array(
'from' => uc_store_email_from(),
'addresses' => '[order-email]',
'subject' => uc_get_message('uc_recurring_renewal_expired_subject'),
'message' => uc_get_message('uc_recurring_renewal_expired_message'),
'format' => 1,
),
),
),
);
return $predicates;
}