1
|
<?php
|
2
|
|
3
|
/**
|
4
|
* @file
|
5
|
* Provides metadata for the payment transaction entity.
|
6
|
*/
|
7
|
|
8
|
/**
|
9
|
* Implements hook_entity_property_info().
|
10
|
*/
|
11
|
function commerce_payment_entity_property_info() {
|
12
|
$info = array();
|
13
|
|
14
|
// Add meta-data about the basic commerce_payment_transaction properties.
|
15
|
$properties = &$info['commerce_payment_transaction']['properties'];
|
16
|
|
17
|
$properties['transaction_id'] = array(
|
18
|
'label' => t('Transaction ID'),
|
19
|
'description' => t('The internal numeric ID of the transaction.'),
|
20
|
'type' => 'integer',
|
21
|
'schema field' => 'transaction_id',
|
22
|
);
|
23
|
$properties['uid'] = array(
|
24
|
'label' => t('User ID'),
|
25
|
'type' => 'integer',
|
26
|
'description' => t("The unique ID of the user who created the transaction."),
|
27
|
'setter callback' => 'entity_property_verbatim_set',
|
28
|
'setter permission' => 'administer payment transactions',
|
29
|
'clear' => array('user'),
|
30
|
'schema field' => 'uid',
|
31
|
);
|
32
|
$properties['user'] = array(
|
33
|
'label' => t('User'),
|
34
|
'type' => 'user',
|
35
|
'description' => t("The user who created the transaction."),
|
36
|
'getter callback' => 'commerce_payment_transaction_get_properties',
|
37
|
'setter callback' => 'commerce_payment_transaction_set_properties',
|
38
|
'setter permission' => 'administer payment transactions',
|
39
|
'required' => TRUE,
|
40
|
'computed' => TRUE,
|
41
|
'clear' => array('uid'),
|
42
|
);
|
43
|
$properties['order_id'] = array(
|
44
|
'label' => t('Order ID', array(), array('context' => 'a drupal commerce order')),
|
45
|
'type' => 'integer',
|
46
|
'description' => t("The unique ID of the order the transaction belongs to."),
|
47
|
'setter callback' => 'entity_property_verbatim_set',
|
48
|
'setter permission' => 'administer payment transactions',
|
49
|
'clear' => array('order'),
|
50
|
'schema field' => 'order_id',
|
51
|
);
|
52
|
$properties['order'] = array(
|
53
|
'label' => t('Order', array(), array('context' => 'a drupal commerce order')),
|
54
|
'type' => 'commerce_order',
|
55
|
'description' => t("The order the transaction belongs to."),
|
56
|
'getter callback' => 'commerce_payment_transaction_get_properties',
|
57
|
'setter callback' => 'commerce_payment_transaction_set_properties',
|
58
|
'setter permission' => 'administer payment transactions',
|
59
|
'required' => TRUE,
|
60
|
'computed' => TRUE,
|
61
|
'clear' => array('order_id'),
|
62
|
);
|
63
|
$properties['payment_method'] = array(
|
64
|
'label' => t('Payment method'),
|
65
|
'description' => t('The payment method of the transaction.'),
|
66
|
'type' => 'token',
|
67
|
'setter callback' => 'entity_property_verbatim_set',
|
68
|
'setter permission' => 'administer payment transactions',
|
69
|
'options list' => 'commerce_payment_method_options_list',
|
70
|
'required' => TRUE,
|
71
|
'schema field' => 'payment_method',
|
72
|
);
|
73
|
$properties['created'] = array(
|
74
|
'label' => t('Date created'),
|
75
|
'description' => t('The date the payment was created.'),
|
76
|
'type' => 'date',
|
77
|
'setter callback' => 'entity_property_verbatim_set',
|
78
|
'setter permission' => 'administer payment transactions',
|
79
|
'schema field' => 'created',
|
80
|
);
|
81
|
$properties['changed'] = array(
|
82
|
'label' => t('Date updated'),
|
83
|
'description' => t('The date the payment was last updated.'),
|
84
|
'type' => 'date',
|
85
|
'setter callback' => 'entity_property_verbatim_set',
|
86
|
'setter permission' => 'administer payment transactions',
|
87
|
'schema field' => 'changed',
|
88
|
);
|
89
|
$properties['remote_id'] = array(
|
90
|
'label' => t('Remote id'),
|
91
|
'description' => t('The remote identifier for this transaction.'),
|
92
|
'type' => 'text',
|
93
|
'schema field' => 'remote_id',
|
94
|
);
|
95
|
$properties['amount'] = array(
|
96
|
'label' => t('Amount'),
|
97
|
'description' => t('The amount for this transaction.'),
|
98
|
'type' => 'decimal',
|
99
|
'schema field' => 'amount',
|
100
|
);
|
101
|
$properties['currency_code'] = array(
|
102
|
'label' => t('Currency Code'),
|
103
|
'description' => t('The currency code for this transaction.'),
|
104
|
'type' => 'text',
|
105
|
'schema field' => 'currency_code',
|
106
|
);
|
107
|
$properties['message'] = array(
|
108
|
'label' => t('Message'),
|
109
|
'description' => t('Message for this transaction.'),
|
110
|
'type' => 'text',
|
111
|
'getter callback' => 'commerce_payment_transaction_get_properties',
|
112
|
'computed' => TRUE,
|
113
|
);
|
114
|
$properties['status'] = array(
|
115
|
'label' => t('Status'),
|
116
|
'description' => t('Status of the payment transaction.'),
|
117
|
'type' => 'text',
|
118
|
'setter callback' => 'entity_property_verbatim_set',
|
119
|
'setter permission' => 'administer payment transactions',
|
120
|
'options list' => 'commerce_payment_transaction_status_options_list',
|
121
|
'schema field' => 'status',
|
122
|
);
|
123
|
$properties['remote_status'] = array(
|
124
|
'label' => t('Remote status'),
|
125
|
'description' => t('Remote status of the payment transaction.'),
|
126
|
'type' => 'text',
|
127
|
'setter callback' => 'entity_property_verbatim_set',
|
128
|
'setter permission' => 'administer payment transactions',
|
129
|
'schema field' => 'remote_status',
|
130
|
);
|
131
|
|
132
|
return $info;
|
133
|
}
|