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