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