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