Merge pull request #14326 from civicrm/5.14
[civicrm-core.git] / CRM / Financial / DAO / PaymentToken.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC (c) 2004-2019
6 *
7 * Generated from xml/schema/CRM/Financial/PaymentToken.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:9ef72f3d1fba1b5b89841d36382c3eb6)
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 foreign keys and entity references.
130 *
131 * @return array
132 * [CRM_Core_Reference_Interface]
133 */
134 public static function getReferenceColumns() {
135 if (!isset(Civi::$statics[__CLASS__]['links'])) {
136 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
137 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id');
138 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'payment_processor_id', 'civicrm_payment_processor', 'id');
139 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'created_id', 'civicrm_contact', 'id');
140 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
141 }
142 return Civi::$statics[__CLASS__]['links'];
143 }
144
145 /**
146 * Returns all the column names of this table
147 *
148 * @return array
149 */
150 public static function &fields() {
151 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
152 Civi::$statics[__CLASS__]['fields'] = [
153 'payment_token_id' => [
154 'name' => 'id',
155 'type' => CRM_Utils_Type::T_INT,
156 'title' => ts('Payment Token ID'),
157 'description' => ts('Payment Token ID'),
158 'required' => TRUE,
159 'where' => 'civicrm_payment_token.id',
160 'table_name' => 'civicrm_payment_token',
161 'entity' => 'PaymentToken',
162 'bao' => 'CRM_Financial_DAO_PaymentToken',
163 'localizable' => 0,
164 ],
165 'contact_id' => [
166 'name' => 'contact_id',
167 'type' => CRM_Utils_Type::T_INT,
168 'title' => ts('Contact ID'),
169 'description' => ts('FK to Contact ID for the owner of the token'),
170 'required' => TRUE,
171 'where' => 'civicrm_payment_token.contact_id',
172 'table_name' => 'civicrm_payment_token',
173 'entity' => 'PaymentToken',
174 'bao' => 'CRM_Financial_DAO_PaymentToken',
175 'localizable' => 0,
176 'FKClassName' => 'CRM_Contact_DAO_Contact',
177 ],
178 'payment_processor_id' => [
179 'name' => 'payment_processor_id',
180 'type' => CRM_Utils_Type::T_INT,
181 'title' => ts('Payment Processor ID'),
182 'required' => TRUE,
183 'where' => 'civicrm_payment_token.payment_processor_id',
184 'table_name' => 'civicrm_payment_token',
185 'entity' => 'PaymentToken',
186 'bao' => 'CRM_Financial_DAO_PaymentToken',
187 'localizable' => 0,
188 'FKClassName' => 'CRM_Financial_DAO_PaymentProcessor',
189 ],
190 'token' => [
191 'name' => 'token',
192 'type' => CRM_Utils_Type::T_STRING,
193 'title' => ts('Token'),
194 'description' => ts('Externally provided token string'),
195 'required' => TRUE,
196 'maxlength' => 255,
197 'size' => CRM_Utils_Type::HUGE,
198 'where' => 'civicrm_payment_token.token',
199 'table_name' => 'civicrm_payment_token',
200 'entity' => 'PaymentToken',
201 'bao' => 'CRM_Financial_DAO_PaymentToken',
202 'localizable' => 0,
203 ],
204 'created_date' => [
205 'name' => 'created_date',
206 'type' => CRM_Utils_Type::T_TIMESTAMP,
207 'title' => ts('Created Date'),
208 'description' => ts('Date created'),
209 'where' => 'civicrm_payment_token.created_date',
210 'default' => 'CURRENT_TIMESTAMP',
211 'table_name' => 'civicrm_payment_token',
212 'entity' => 'PaymentToken',
213 'bao' => 'CRM_Financial_DAO_PaymentToken',
214 'localizable' => 0,
215 ],
216 'created_id' => [
217 'name' => 'created_id',
218 'type' => CRM_Utils_Type::T_INT,
219 'title' => ts('Created ID'),
220 'description' => ts('Contact ID of token creator'),
221 'where' => 'civicrm_payment_token.created_id',
222 'table_name' => 'civicrm_payment_token',
223 'entity' => 'PaymentToken',
224 'bao' => 'CRM_Financial_DAO_PaymentToken',
225 'localizable' => 0,
226 'FKClassName' => 'CRM_Contact_DAO_Contact',
227 ],
228 'expiry_date' => [
229 'name' => 'expiry_date',
230 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
231 'title' => ts('Expiry Date'),
232 'description' => ts('Date this token expires'),
233 'where' => 'civicrm_payment_token.expiry_date',
234 'table_name' => 'civicrm_payment_token',
235 'entity' => 'PaymentToken',
236 'bao' => 'CRM_Financial_DAO_PaymentToken',
237 'localizable' => 0,
238 ],
239 'email' => [
240 'name' => 'email',
241 'type' => CRM_Utils_Type::T_STRING,
242 'title' => ts('Email'),
243 'description' => ts('Email at the time of token creation. Useful for fraud forensics'),
244 'maxlength' => 255,
245 'size' => CRM_Utils_Type::HUGE,
246 'where' => 'civicrm_payment_token.email',
247 'table_name' => 'civicrm_payment_token',
248 'entity' => 'PaymentToken',
249 'bao' => 'CRM_Financial_DAO_PaymentToken',
250 'localizable' => 0,
251 ],
252 'billing_first_name' => [
253 'name' => 'billing_first_name',
254 'type' => CRM_Utils_Type::T_STRING,
255 'title' => ts('Billing First Name'),
256 'description' => ts('Billing first name at the time of token creation. Useful for fraud forensics'),
257 'maxlength' => 255,
258 'size' => CRM_Utils_Type::HUGE,
259 'where' => 'civicrm_payment_token.billing_first_name',
260 'table_name' => 'civicrm_payment_token',
261 'entity' => 'PaymentToken',
262 'bao' => 'CRM_Financial_DAO_PaymentToken',
263 'localizable' => 0,
264 ],
265 'billing_middle_name' => [
266 'name' => 'billing_middle_name',
267 'type' => CRM_Utils_Type::T_STRING,
268 'title' => ts('Billing Middle Name'),
269 'description' => ts('Billing middle name at the time of token creation. Useful for fraud forensics'),
270 'maxlength' => 255,
271 'size' => CRM_Utils_Type::HUGE,
272 'where' => 'civicrm_payment_token.billing_middle_name',
273 'table_name' => 'civicrm_payment_token',
274 'entity' => 'PaymentToken',
275 'bao' => 'CRM_Financial_DAO_PaymentToken',
276 'localizable' => 0,
277 ],
278 'billing_last_name' => [
279 'name' => 'billing_last_name',
280 'type' => CRM_Utils_Type::T_STRING,
281 'title' => ts('Billing Last Name'),
282 'description' => ts('Billing last name at the time of token creation. Useful for fraud forensics'),
283 'maxlength' => 255,
284 'size' => CRM_Utils_Type::HUGE,
285 'where' => 'civicrm_payment_token.billing_last_name',
286 'table_name' => 'civicrm_payment_token',
287 'entity' => 'PaymentToken',
288 'bao' => 'CRM_Financial_DAO_PaymentToken',
289 'localizable' => 0,
290 ],
291 'masked_account_number' => [
292 'name' => 'masked_account_number',
293 'type' => CRM_Utils_Type::T_STRING,
294 'title' => ts('Masked Account Number'),
295 'description' => ts('Holds the part of the card number or account details that may be retained or displayed'),
296 'maxlength' => 255,
297 'size' => CRM_Utils_Type::HUGE,
298 'where' => 'civicrm_payment_token.masked_account_number',
299 'table_name' => 'civicrm_payment_token',
300 'entity' => 'PaymentToken',
301 'bao' => 'CRM_Financial_DAO_PaymentToken',
302 'localizable' => 0,
303 ],
304 'ip_address' => [
305 'name' => 'ip_address',
306 'type' => CRM_Utils_Type::T_STRING,
307 'title' => ts('IP Address'),
308 'description' => ts('IP used when creating the token. Useful for fraud forensics'),
309 'maxlength' => 255,
310 'size' => CRM_Utils_Type::HUGE,
311 'where' => 'civicrm_payment_token.ip_address',
312 'table_name' => 'civicrm_payment_token',
313 'entity' => 'PaymentToken',
314 'bao' => 'CRM_Financial_DAO_PaymentToken',
315 'localizable' => 0,
316 ],
317 ];
318 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
319 }
320 return Civi::$statics[__CLASS__]['fields'];
321 }
322
323 /**
324 * Return a mapping from field-name to the corresponding key (as used in fields()).
325 *
326 * @return array
327 * Array(string $name => string $uniqueName).
328 */
329 public static function &fieldKeys() {
330 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
331 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
332 }
333 return Civi::$statics[__CLASS__]['fieldKeys'];
334 }
335
336 /**
337 * Returns the names of this table
338 *
339 * @return string
340 */
341 public static function getTableName() {
342 return self::$_tableName;
343 }
344
345 /**
346 * Returns if this table needs to be logged
347 *
348 * @return bool
349 */
350 public function getLog() {
351 return self::$_log;
352 }
353
354 /**
355 * Returns the list of fields that can be imported
356 *
357 * @param bool $prefix
358 *
359 * @return array
360 */
361 public static function &import($prefix = FALSE) {
362 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'payment_token', $prefix, []);
363 return $r;
364 }
365
366 /**
367 * Returns the list of fields that can be exported
368 *
369 * @param bool $prefix
370 *
371 * @return array
372 */
373 public static function &export($prefix = FALSE) {
374 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'payment_token', $prefix, []);
375 return $r;
376 }
377
378 /**
379 * Returns the list of indices
380 *
381 * @param bool $localize
382 *
383 * @return array
384 */
385 public static function indices($localize = TRUE) {
386 $indices = [];
387 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
388 }
389
390 }