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