API/DAO Metadata - Retain versioning metadata for possible usage in runtime+tooling
[civicrm-core.git] / CRM / Financial / DAO / PaymentToken.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Financial/PaymentToken.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:c135e4bffc93086e83c082bbebc84372)
10 */
11
12 /**
13 * Database access object for the PaymentToken entity.
14 */
15 class CRM_Financial_DAO_PaymentToken extends CRM_Core_DAO {
16
17 /**
18 * Static instance to hold the table name.
19 *
20 * @var string
21 */
22 public static $_tableName = 'civicrm_payment_token';
23
24 /**
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
26 *
27 * @var bool
28 */
29 public static $_log = FALSE;
30
31 /**
32 * Payment Token ID
33 *
34 * @var int
35 */
36 public $id;
37
38 /**
39 * FK to Contact ID for the owner of the token
40 *
41 * @var int
42 */
43 public $contact_id;
44
45 /**
46 * @var int
47 */
48 public $payment_processor_id;
49
50 /**
51 * Externally provided token string
52 *
53 * @var string
54 */
55 public $token;
56
57 /**
58 * Date created
59 *
60 * @var timestamp
61 */
62 public $created_date;
63
64 /**
65 * Contact ID of token creator
66 *
67 * @var int
68 */
69 public $created_id;
70
71 /**
72 * Date this token expires
73 *
74 * @var datetime
75 */
76 public $expiry_date;
77
78 /**
79 * Email at the time of token creation. Useful for fraud forensics
80 *
81 * @var string
82 */
83 public $email;
84
85 /**
86 * Billing first name at the time of token creation. Useful for fraud forensics
87 *
88 * @var string
89 */
90 public $billing_first_name;
91
92 /**
93 * Billing middle name at the time of token creation. Useful for fraud forensics
94 *
95 * @var string
96 */
97 public $billing_middle_name;
98
99 /**
100 * Billing last name at the time of token creation. Useful for fraud forensics
101 *
102 * @var string
103 */
104 public $billing_last_name;
105
106 /**
107 * Holds the part of the card number or account details that may be retained or displayed
108 *
109 * @var string
110 */
111 public $masked_account_number;
112
113 /**
114 * IP used when creating the token. Useful for fraud forensics
115 *
116 * @var string
117 */
118 public $ip_address;
119
120 /**
121 * Class constructor.
122 */
123 public function __construct() {
124 $this->__table = 'civicrm_payment_token';
125 parent::__construct();
126 }
127
128 /**
129 * Returns localized title of this entity.
130 */
131 public static function getEntityTitle() {
132 return ts('Payment Tokens');
133 }
134
135 /**
136 * Returns foreign keys and entity references.
137 *
138 * @return array
139 * [CRM_Core_Reference_Interface]
140 */
141 public static function getReferenceColumns() {
142 if (!isset(Civi::$statics[__CLASS__]['links'])) {
143 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
144 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id');
145 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'payment_processor_id', 'civicrm_payment_processor', 'id');
146 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'created_id', 'civicrm_contact', 'id');
147 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
148 }
149 return Civi::$statics[__CLASS__]['links'];
150 }
151
152 /**
153 * Returns all the column names of this table
154 *
155 * @return array
156 */
157 public static function &fields() {
158 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
159 Civi::$statics[__CLASS__]['fields'] = [
160 'payment_token_id' => [
161 'name' => 'id',
162 'type' => CRM_Utils_Type::T_INT,
163 'title' => ts('Payment Token ID'),
164 'description' => ts('Payment Token ID'),
165 'required' => TRUE,
166 'where' => 'civicrm_payment_token.id',
167 'table_name' => 'civicrm_payment_token',
168 'entity' => 'PaymentToken',
169 'bao' => 'CRM_Financial_DAO_PaymentToken',
170 'localizable' => 0,
171 'add' => '4.6',
172 ],
173 'contact_id' => [
174 'name' => 'contact_id',
175 'type' => CRM_Utils_Type::T_INT,
176 'title' => ts('Contact ID'),
177 'description' => ts('FK to Contact ID for the owner of the token'),
178 'required' => TRUE,
179 'where' => 'civicrm_payment_token.contact_id',
180 'table_name' => 'civicrm_payment_token',
181 'entity' => 'PaymentToken',
182 'bao' => 'CRM_Financial_DAO_PaymentToken',
183 'localizable' => 0,
184 'FKClassName' => 'CRM_Contact_DAO_Contact',
185 'add' => '4.6',
186 ],
187 'payment_processor_id' => [
188 'name' => 'payment_processor_id',
189 'type' => CRM_Utils_Type::T_INT,
190 'title' => ts('Payment Processor ID'),
191 'required' => TRUE,
192 'where' => 'civicrm_payment_token.payment_processor_id',
193 'table_name' => 'civicrm_payment_token',
194 'entity' => 'PaymentToken',
195 'bao' => 'CRM_Financial_DAO_PaymentToken',
196 'localizable' => 0,
197 'FKClassName' => 'CRM_Financial_DAO_PaymentProcessor',
198 'add' => '4.6',
199 ],
200 'token' => [
201 'name' => 'token',
202 'type' => CRM_Utils_Type::T_STRING,
203 'title' => ts('Token'),
204 'description' => ts('Externally provided token string'),
205 'required' => TRUE,
206 'maxlength' => 255,
207 'size' => CRM_Utils_Type::HUGE,
208 'where' => 'civicrm_payment_token.token',
209 'table_name' => 'civicrm_payment_token',
210 'entity' => 'PaymentToken',
211 'bao' => 'CRM_Financial_DAO_PaymentToken',
212 'localizable' => 0,
213 'add' => '4.6',
214 ],
215 'created_date' => [
216 'name' => 'created_date',
217 'type' => CRM_Utils_Type::T_TIMESTAMP,
218 'title' => ts('Created Date'),
219 'description' => ts('Date created'),
220 'where' => 'civicrm_payment_token.created_date',
221 'default' => 'CURRENT_TIMESTAMP',
222 'table_name' => 'civicrm_payment_token',
223 'entity' => 'PaymentToken',
224 'bao' => 'CRM_Financial_DAO_PaymentToken',
225 'localizable' => 0,
226 'add' => '4.6',
227 ],
228 'created_id' => [
229 'name' => 'created_id',
230 'type' => CRM_Utils_Type::T_INT,
231 'title' => ts('Created ID'),
232 'description' => ts('Contact ID of token creator'),
233 'where' => 'civicrm_payment_token.created_id',
234 'table_name' => 'civicrm_payment_token',
235 'entity' => 'PaymentToken',
236 'bao' => 'CRM_Financial_DAO_PaymentToken',
237 'localizable' => 0,
238 'FKClassName' => 'CRM_Contact_DAO_Contact',
239 'add' => '4.6',
240 ],
241 'expiry_date' => [
242 'name' => 'expiry_date',
243 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
244 'title' => ts('Expiry Date'),
245 'description' => ts('Date this token expires'),
246 'where' => 'civicrm_payment_token.expiry_date',
247 'table_name' => 'civicrm_payment_token',
248 'entity' => 'PaymentToken',
249 'bao' => 'CRM_Financial_DAO_PaymentToken',
250 'localizable' => 0,
251 'add' => '4.6',
252 ],
253 'email' => [
254 'name' => 'email',
255 'type' => CRM_Utils_Type::T_STRING,
256 'title' => ts('Email'),
257 'description' => ts('Email at the time of token creation. Useful for fraud forensics'),
258 'maxlength' => 255,
259 'size' => CRM_Utils_Type::HUGE,
260 'where' => 'civicrm_payment_token.email',
261 'table_name' => 'civicrm_payment_token',
262 'entity' => 'PaymentToken',
263 'bao' => 'CRM_Financial_DAO_PaymentToken',
264 'localizable' => 0,
265 'add' => '4.6',
266 ],
267 'billing_first_name' => [
268 'name' => 'billing_first_name',
269 'type' => CRM_Utils_Type::T_STRING,
270 'title' => ts('Billing First Name'),
271 'description' => ts('Billing first name at the time of token creation. Useful for fraud forensics'),
272 'maxlength' => 255,
273 'size' => CRM_Utils_Type::HUGE,
274 'where' => 'civicrm_payment_token.billing_first_name',
275 'table_name' => 'civicrm_payment_token',
276 'entity' => 'PaymentToken',
277 'bao' => 'CRM_Financial_DAO_PaymentToken',
278 'localizable' => 0,
279 'add' => '4.6',
280 ],
281 'billing_middle_name' => [
282 'name' => 'billing_middle_name',
283 'type' => CRM_Utils_Type::T_STRING,
284 'title' => ts('Billing Middle Name'),
285 'description' => ts('Billing middle name at the time of token creation. Useful for fraud forensics'),
286 'maxlength' => 255,
287 'size' => CRM_Utils_Type::HUGE,
288 'where' => 'civicrm_payment_token.billing_middle_name',
289 'table_name' => 'civicrm_payment_token',
290 'entity' => 'PaymentToken',
291 'bao' => 'CRM_Financial_DAO_PaymentToken',
292 'localizable' => 0,
293 'add' => '4.6',
294 ],
295 'billing_last_name' => [
296 'name' => 'billing_last_name',
297 'type' => CRM_Utils_Type::T_STRING,
298 'title' => ts('Billing Last Name'),
299 'description' => ts('Billing last name at the time of token creation. Useful for fraud forensics'),
300 'maxlength' => 255,
301 'size' => CRM_Utils_Type::HUGE,
302 'where' => 'civicrm_payment_token.billing_last_name',
303 'table_name' => 'civicrm_payment_token',
304 'entity' => 'PaymentToken',
305 'bao' => 'CRM_Financial_DAO_PaymentToken',
306 'localizable' => 0,
307 'add' => '4.6',
308 ],
309 'masked_account_number' => [
310 'name' => 'masked_account_number',
311 'type' => CRM_Utils_Type::T_STRING,
312 'title' => ts('Masked Account Number'),
313 'description' => ts('Holds the part of the card number or account details that may be retained or displayed'),
314 'maxlength' => 255,
315 'size' => CRM_Utils_Type::HUGE,
316 'where' => 'civicrm_payment_token.masked_account_number',
317 'table_name' => 'civicrm_payment_token',
318 'entity' => 'PaymentToken',
319 'bao' => 'CRM_Financial_DAO_PaymentToken',
320 'localizable' => 0,
321 'add' => '4.6',
322 ],
323 'ip_address' => [
324 'name' => 'ip_address',
325 'type' => CRM_Utils_Type::T_STRING,
326 'title' => ts('IP Address'),
327 'description' => ts('IP used when creating the token. Useful for fraud forensics'),
328 'maxlength' => 255,
329 'size' => CRM_Utils_Type::HUGE,
330 'where' => 'civicrm_payment_token.ip_address',
331 'table_name' => 'civicrm_payment_token',
332 'entity' => 'PaymentToken',
333 'bao' => 'CRM_Financial_DAO_PaymentToken',
334 'localizable' => 0,
335 'add' => '4.6',
336 ],
337 ];
338 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
339 }
340 return Civi::$statics[__CLASS__]['fields'];
341 }
342
343 /**
344 * Return a mapping from field-name to the corresponding key (as used in fields()).
345 *
346 * @return array
347 * Array(string $name => string $uniqueName).
348 */
349 public static function &fieldKeys() {
350 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
351 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
352 }
353 return Civi::$statics[__CLASS__]['fieldKeys'];
354 }
355
356 /**
357 * Returns the names of this table
358 *
359 * @return string
360 */
361 public static function getTableName() {
362 return self::$_tableName;
363 }
364
365 /**
366 * Returns if this table needs to be logged
367 *
368 * @return bool
369 */
370 public function getLog() {
371 return self::$_log;
372 }
373
374 /**
375 * Returns the list of fields that can be imported
376 *
377 * @param bool $prefix
378 *
379 * @return array
380 */
381 public static function &import($prefix = FALSE) {
382 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'payment_token', $prefix, []);
383 return $r;
384 }
385
386 /**
387 * Returns the list of fields that can be exported
388 *
389 * @param bool $prefix
390 *
391 * @return array
392 */
393 public static function &export($prefix = FALSE) {
394 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'payment_token', $prefix, []);
395 return $r;
396 }
397
398 /**
399 * Returns the list of indices
400 *
401 * @param bool $localize
402 *
403 * @return array
404 */
405 public static function indices($localize = TRUE) {
406 $indices = [];
407 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
408 }
409
410 }