Merge pull request #17719 from civicrm/5.27
[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:720f0e7cb082e98a9ec58b94de532db3)
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 ],
172 'contact_id' => [
173 'name' => 'contact_id',
174 'type' => CRM_Utils_Type::T_INT,
175 'title' => ts('Contact ID'),
176 'description' => ts('FK to Contact ID for the owner of the token'),
177 'required' => TRUE,
178 'where' => 'civicrm_payment_token.contact_id',
179 'table_name' => 'civicrm_payment_token',
180 'entity' => 'PaymentToken',
181 'bao' => 'CRM_Financial_DAO_PaymentToken',
182 'localizable' => 0,
183 'FKClassName' => 'CRM_Contact_DAO_Contact',
184 ],
185 'payment_processor_id' => [
186 'name' => 'payment_processor_id',
187 'type' => CRM_Utils_Type::T_INT,
188 'title' => ts('Payment Processor ID'),
189 'required' => TRUE,
190 'where' => 'civicrm_payment_token.payment_processor_id',
191 'table_name' => 'civicrm_payment_token',
192 'entity' => 'PaymentToken',
193 'bao' => 'CRM_Financial_DAO_PaymentToken',
194 'localizable' => 0,
195 'FKClassName' => 'CRM_Financial_DAO_PaymentProcessor',
196 ],
197 'token' => [
198 'name' => 'token',
199 'type' => CRM_Utils_Type::T_STRING,
200 'title' => ts('Token'),
201 'description' => ts('Externally provided token string'),
202 'required' => TRUE,
203 'maxlength' => 255,
204 'size' => CRM_Utils_Type::HUGE,
205 'where' => 'civicrm_payment_token.token',
206 'table_name' => 'civicrm_payment_token',
207 'entity' => 'PaymentToken',
208 'bao' => 'CRM_Financial_DAO_PaymentToken',
209 'localizable' => 0,
210 ],
211 'created_date' => [
212 'name' => 'created_date',
213 'type' => CRM_Utils_Type::T_TIMESTAMP,
214 'title' => ts('Created Date'),
215 'description' => ts('Date created'),
216 'where' => 'civicrm_payment_token.created_date',
217 'default' => 'CURRENT_TIMESTAMP',
218 'table_name' => 'civicrm_payment_token',
219 'entity' => 'PaymentToken',
220 'bao' => 'CRM_Financial_DAO_PaymentToken',
221 'localizable' => 0,
222 ],
223 'created_id' => [
224 'name' => 'created_id',
225 'type' => CRM_Utils_Type::T_INT,
226 'title' => ts('Created ID'),
227 'description' => ts('Contact ID of token creator'),
228 'where' => 'civicrm_payment_token.created_id',
229 'table_name' => 'civicrm_payment_token',
230 'entity' => 'PaymentToken',
231 'bao' => 'CRM_Financial_DAO_PaymentToken',
232 'localizable' => 0,
233 'FKClassName' => 'CRM_Contact_DAO_Contact',
234 ],
235 'expiry_date' => [
236 'name' => 'expiry_date',
237 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
238 'title' => ts('Expiry Date'),
239 'description' => ts('Date this token expires'),
240 'where' => 'civicrm_payment_token.expiry_date',
241 'table_name' => 'civicrm_payment_token',
242 'entity' => 'PaymentToken',
243 'bao' => 'CRM_Financial_DAO_PaymentToken',
244 'localizable' => 0,
245 ],
246 'email' => [
247 'name' => 'email',
248 'type' => CRM_Utils_Type::T_STRING,
249 'title' => ts('Email'),
250 'description' => ts('Email at the time of token creation. Useful for fraud forensics'),
251 'maxlength' => 255,
252 'size' => CRM_Utils_Type::HUGE,
253 'where' => 'civicrm_payment_token.email',
254 'table_name' => 'civicrm_payment_token',
255 'entity' => 'PaymentToken',
256 'bao' => 'CRM_Financial_DAO_PaymentToken',
257 'localizable' => 0,
258 ],
259 'billing_first_name' => [
260 'name' => 'billing_first_name',
261 'type' => CRM_Utils_Type::T_STRING,
262 'title' => ts('Billing First Name'),
263 'description' => ts('Billing first name at the time of token creation. Useful for fraud forensics'),
264 'maxlength' => 255,
265 'size' => CRM_Utils_Type::HUGE,
266 'where' => 'civicrm_payment_token.billing_first_name',
267 'table_name' => 'civicrm_payment_token',
268 'entity' => 'PaymentToken',
269 'bao' => 'CRM_Financial_DAO_PaymentToken',
270 'localizable' => 0,
271 ],
272 'billing_middle_name' => [
273 'name' => 'billing_middle_name',
274 'type' => CRM_Utils_Type::T_STRING,
275 'title' => ts('Billing Middle Name'),
276 'description' => ts('Billing middle name at the time of token creation. Useful for fraud forensics'),
277 'maxlength' => 255,
278 'size' => CRM_Utils_Type::HUGE,
279 'where' => 'civicrm_payment_token.billing_middle_name',
280 'table_name' => 'civicrm_payment_token',
281 'entity' => 'PaymentToken',
282 'bao' => 'CRM_Financial_DAO_PaymentToken',
283 'localizable' => 0,
284 ],
285 'billing_last_name' => [
286 'name' => 'billing_last_name',
287 'type' => CRM_Utils_Type::T_STRING,
288 'title' => ts('Billing Last Name'),
289 'description' => ts('Billing last name at the time of token creation. Useful for fraud forensics'),
290 'maxlength' => 255,
291 'size' => CRM_Utils_Type::HUGE,
292 'where' => 'civicrm_payment_token.billing_last_name',
293 'table_name' => 'civicrm_payment_token',
294 'entity' => 'PaymentToken',
295 'bao' => 'CRM_Financial_DAO_PaymentToken',
296 'localizable' => 0,
297 ],
298 'masked_account_number' => [
299 'name' => 'masked_account_number',
300 'type' => CRM_Utils_Type::T_STRING,
301 'title' => ts('Masked Account Number'),
302 'description' => ts('Holds the part of the card number or account details that may be retained or displayed'),
303 'maxlength' => 255,
304 'size' => CRM_Utils_Type::HUGE,
305 'where' => 'civicrm_payment_token.masked_account_number',
306 'table_name' => 'civicrm_payment_token',
307 'entity' => 'PaymentToken',
308 'bao' => 'CRM_Financial_DAO_PaymentToken',
309 'localizable' => 0,
310 ],
311 'ip_address' => [
312 'name' => 'ip_address',
313 'type' => CRM_Utils_Type::T_STRING,
314 'title' => ts('IP Address'),
315 'description' => ts('IP used when creating the token. Useful for fraud forensics'),
316 'maxlength' => 255,
317 'size' => CRM_Utils_Type::HUGE,
318 'where' => 'civicrm_payment_token.ip_address',
319 'table_name' => 'civicrm_payment_token',
320 'entity' => 'PaymentToken',
321 'bao' => 'CRM_Financial_DAO_PaymentToken',
322 'localizable' => 0,
323 ],
324 ];
325 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
326 }
327 return Civi::$statics[__CLASS__]['fields'];
328 }
329
330 /**
331 * Return a mapping from field-name to the corresponding key (as used in fields()).
332 *
333 * @return array
334 * Array(string $name => string $uniqueName).
335 */
336 public static function &fieldKeys() {
337 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
338 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
339 }
340 return Civi::$statics[__CLASS__]['fieldKeys'];
341 }
342
343 /**
344 * Returns the names of this table
345 *
346 * @return string
347 */
348 public static function getTableName() {
349 return self::$_tableName;
350 }
351
352 /**
353 * Returns if this table needs to be logged
354 *
355 * @return bool
356 */
357 public function getLog() {
358 return self::$_log;
359 }
360
361 /**
362 * Returns the list of fields that can be imported
363 *
364 * @param bool $prefix
365 *
366 * @return array
367 */
368 public static function &import($prefix = FALSE) {
369 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'payment_token', $prefix, []);
370 return $r;
371 }
372
373 /**
374 * Returns the list of fields that can be exported
375 *
376 * @param bool $prefix
377 *
378 * @return array
379 */
380 public static function &export($prefix = FALSE) {
381 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'payment_token', $prefix, []);
382 return $r;
383 }
384
385 /**
386 * Returns the list of indices
387 *
388 * @param bool $localize
389 *
390 * @return array
391 */
392 public static function indices($localize = TRUE) {
393 $indices = [];
394 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
395 }
396
397 }