-
Notifications
You must be signed in to change notification settings - Fork 5
/
commerce_funds.rules.inc
74 lines (66 loc) · 1.57 KB
/
commerce_funds.rules.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<?php
/**
* @file
* commerce_funds.rules.inc
*/
/**
* Implements hook_rules_condition_info().
*/
function commerce_funds_rules_condition_info() {
$condition = array();
$condition['commerce_funds_checkout_deposit_type'] = array(
'label' => t('Line item comparison'),
'parameter' => array(
'order' => array(
'type' => 'commerce_order',
'label' => 'Withdraw for the current user',
),
),
'group' => t('Commerce Funds'),
'callbacks' => array(
'execute' => 'commerce_line_item_comparison',
),
);
return $condition;
}
/**
* Implements hook_rules_action_info().
*/
function commerce_funds_rules_action_info() {
$actions = array();
$actions['commerce_funds_credit'] = array(
'label' => t('Credit user account balance'),
'parameter' => array(
'account_user' => array(
'type' => 'user',
'label' => t('User'),
),
'amount' => array(
'type' => 'commerce_price',
'label' => t('Amount'),
),
),
'group' => t('Commerce Funds'),
'callbacks' => array(
'execute' => 'commerce_funds_credit',
),
);
$actions['commerce_funds_debit'] = array(
'label' => t('Debit user account balance'),
'parameter' => array(
'account_user' => array(
'type' => 'user',
'label' => t('User'),
),
'amount' => array(
'type' => 'commerce_price',
'label' => t('Amount'),
),
),
'group' => t('Commerce Funds'),
'callbacks' => array(
'execute' => 'commerce_funds_debit',
),
);
return $actions;
}