-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpinapi_rules.rules.inc
111 lines (108 loc) · 3.19 KB
/
pinapi_rules.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<?php
/**
* @file
* Provides integration of Pin API with rules.
*/
/**
* Implements hook_rules_data_info().
*/
function pinapi_rules_rules_data_info() {
return array(
'pinapi_pin' => array(
'label' => t('Pin API Pin'),
'wrap' => TRUE,
'property info' => array(
'pid' => array(
'type' => 'integer',
'label' => t('Pin ID'),
'description' => t('The Pin ID'),
'restriction' => 'input',
'getter callback' => 'entity_property_verbatim_get',
),
'code' => array(
'type' => 'text',
'label' => t('Pin Code'),
'description' => t('The Pin Code'),
'restriction' => 'input',
'getter callback' => 'entity_property_verbatim_get',
),
),
),
'pinapi_txn' => array(
'label' => t('Pin API Transaction'),
'wrap' => TRUE,
'property info' => array(
'txn_id' => array(
'type' => 'integer',
'label' => t('Transaction ID'),
'description' => t('The transaction ID'),
'restriction' => 'input',
'getter callback' => 'entity_property_verbatim_get',
),
'user' => array(
'type' => 'user',
'label' => t('User'),
'description' => t('The user that created the transaction'),
'setter callback' => 'entity_property_verbatim_set',
),
'timestamp' => array(
'type' => 'date',
'label' => t('Transaction date'),
'description' => t('The transaction date.'),
'setter callback' => 'entity_property_verbatim_set',
'getter callback' => 'entity_property_verbatim_get',
),
'changed' => array(
'type' => 'date',
'label' => t('Transaction last changed date.'),
'description' => t('The transaction last changed date.'),
'setter callback' => 'entity_property_verbatim_set',
'getter callback' => 'entity_property_verbatim_get',
),
'hostname' => array(
'type' => 'text',
'label' => t('Transaction Hostname'),
'description' => t('The hostname used during the transaction.'),
'restriction' => 'input',
),
),
),
);
}
/**
* Implements hook_rules_event_info().
*/
function pinapi_rules_rules_event_info() {
return array(
'pinapi_event_txn_create' => array(
'label' => t('After creating pin transaction'),
'variables' => array(
'pinapi_txn' => array(
'type' => 'pinapi_txn',
'label' => t('Pin API Transaction'),
),
),
'group' => t('Pin API'),
),
'pinapi_event_txn_pre_redeem' => array(
'label' => t('Before redeeming pin transaction'),
'variables' => array(
'pinapi_txn' => array(
'type' => 'pinapi_txn',
'label' => t('Pin API Transaction'),
),
),
'group' => t('Pin API'),
),
'pinapi_event_txn_redeem' => array(
'label' => t('After redeeming pin transaction'),
'variables' => array(
'pinapi_txn' => array(
'type' => 'pinapi_txn',
'label' => t('Pin API Transaction'),
),
),
'group' => t('Pin API'),
),
);
}