5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Financial/PaymentToken.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:e5c6457ebb1ae691f811a3472d1a9eec)
13 * Database access object for the PaymentToken entity.
15 class CRM_Financial_DAO_PaymentToken
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '4.6';
18 const COMPONENT
= 'CiviContribute';
21 * Static instance to hold the table name.
25 public static $_tableName = 'civicrm_payment_token';
28 * Should CiviCRM log any modifications to this table in the civicrm_log table.
32 public static $_log = FALSE;
37 * @var int|string|null
38 * (SQL type: int unsigned)
39 * Note that values will be retrieved from the database as a string.
44 * FK to Contact ID for the owner of the token
47 * (SQL type: int unsigned)
48 * Note that values will be retrieved from the database as a string.
54 * (SQL type: int unsigned)
55 * Note that values will be retrieved from the database as a string.
57 public $payment_processor_id;
60 * Externally provided token string
63 * (SQL type: varchar(255))
64 * Note that values will be retrieved from the database as a string.
72 * (SQL type: timestamp)
73 * Note that values will be retrieved from the database as a string.
78 * Contact ID of token creator
80 * @var int|string|null
81 * (SQL type: int unsigned)
82 * Note that values will be retrieved from the database as a string.
87 * Date this token expires
90 * (SQL type: datetime)
91 * Note that values will be retrieved from the database as a string.
96 * Email at the time of token creation. Useful for fraud forensics
99 * (SQL type: varchar(255))
100 * Note that values will be retrieved from the database as a string.
105 * Billing first name at the time of token creation. Useful for fraud forensics
108 * (SQL type: varchar(255))
109 * Note that values will be retrieved from the database as a string.
111 public $billing_first_name;
114 * Billing middle name at the time of token creation. Useful for fraud forensics
117 * (SQL type: varchar(255))
118 * Note that values will be retrieved from the database as a string.
120 public $billing_middle_name;
123 * Billing last name at the time of token creation. Useful for fraud forensics
126 * (SQL type: varchar(255))
127 * Note that values will be retrieved from the database as a string.
129 public $billing_last_name;
132 * Holds the part of the card number or account details that may be retained or displayed
135 * (SQL type: varchar(255))
136 * Note that values will be retrieved from the database as a string.
138 public $masked_account_number;
141 * IP used when creating the token. Useful for fraud forensics
144 * (SQL type: varchar(255))
145 * Note that values will be retrieved from the database as a string.
152 public function __construct() {
153 $this->__table
= 'civicrm_payment_token';
154 parent
::__construct();
158 * Returns localized title of this entity.
160 * @param bool $plural
161 * Whether to return the plural version of the title.
163 public static function getEntityTitle($plural = FALSE) {
164 return $plural ?
ts('Payment Tokens') : ts('Payment Token');
168 * Returns foreign keys and entity references.
171 * [CRM_Core_Reference_Interface]
173 public static function getReferenceColumns() {
174 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
175 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
176 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contact_id', 'civicrm_contact', 'id');
177 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'payment_processor_id', 'civicrm_payment_processor', 'id');
178 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'created_id', 'civicrm_contact', 'id');
179 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
181 return Civi
::$statics[__CLASS__
]['links'];
185 * Returns all the column names of this table
189 public static function &fields() {
190 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
191 Civi
::$statics[__CLASS__
]['fields'] = [
192 'payment_token_id' => [
194 'type' => CRM_Utils_Type
::T_INT
,
195 'title' => ts('Payment Token ID'),
196 'description' => ts('Payment Token ID'),
198 'where' => 'civicrm_payment_token.id',
199 'table_name' => 'civicrm_payment_token',
200 'entity' => 'PaymentToken',
201 'bao' => 'CRM_Financial_DAO_PaymentToken',
210 'name' => 'contact_id',
211 'type' => CRM_Utils_Type
::T_INT
,
212 'title' => ts('Contact ID'),
213 'description' => ts('FK to Contact ID for the owner of the token'),
215 'where' => 'civicrm_payment_token.contact_id',
216 'table_name' => 'civicrm_payment_token',
217 'entity' => 'PaymentToken',
218 'bao' => 'CRM_Financial_DAO_PaymentToken',
220 'FKClassName' => 'CRM_Contact_DAO_Contact',
222 'label' => ts("Contact"),
226 'payment_processor_id' => [
227 'name' => 'payment_processor_id',
228 'type' => CRM_Utils_Type
::T_INT
,
229 'title' => ts('Payment Processor ID'),
231 'where' => 'civicrm_payment_token.payment_processor_id',
232 'table_name' => 'civicrm_payment_token',
233 'entity' => 'PaymentToken',
234 'bao' => 'CRM_Financial_DAO_PaymentToken',
236 'FKClassName' => 'CRM_Financial_DAO_PaymentProcessor',
238 'label' => ts("Payment Processor"),
244 'type' => CRM_Utils_Type
::T_STRING
,
245 'title' => ts('Token'),
246 'description' => ts('Externally provided token string'),
249 'size' => CRM_Utils_Type
::HUGE
,
250 'where' => 'civicrm_payment_token.token',
251 'table_name' => 'civicrm_payment_token',
252 'entity' => 'PaymentToken',
253 'bao' => 'CRM_Financial_DAO_PaymentToken',
258 'name' => 'created_date',
259 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
260 'title' => ts('Created Date'),
261 'description' => ts('Date created'),
262 'where' => 'civicrm_payment_token.created_date',
263 'default' => 'CURRENT_TIMESTAMP',
264 'table_name' => 'civicrm_payment_token',
265 'entity' => 'PaymentToken',
266 'bao' => 'CRM_Financial_DAO_PaymentToken',
271 'name' => 'created_id',
272 'type' => CRM_Utils_Type
::T_INT
,
273 'title' => ts('Created ID'),
274 'description' => ts('Contact ID of token creator'),
275 'where' => 'civicrm_payment_token.created_id',
276 'table_name' => 'civicrm_payment_token',
277 'entity' => 'PaymentToken',
278 'bao' => 'CRM_Financial_DAO_PaymentToken',
280 'FKClassName' => 'CRM_Contact_DAO_Contact',
282 'label' => ts("Created"),
287 'name' => 'expiry_date',
288 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
289 'title' => ts('Expiry Date'),
290 'description' => ts('Date this token expires'),
291 'where' => 'civicrm_payment_token.expiry_date',
292 'table_name' => 'civicrm_payment_token',
293 'entity' => 'PaymentToken',
294 'bao' => 'CRM_Financial_DAO_PaymentToken',
300 'type' => CRM_Utils_Type
::T_STRING
,
301 'title' => ts('Email'),
302 'description' => ts('Email at the time of token creation. Useful for fraud forensics'),
304 'size' => CRM_Utils_Type
::HUGE
,
305 'where' => 'civicrm_payment_token.email',
306 'table_name' => 'civicrm_payment_token',
307 'entity' => 'PaymentToken',
308 'bao' => 'CRM_Financial_DAO_PaymentToken',
312 'billing_first_name' => [
313 'name' => 'billing_first_name',
314 'type' => CRM_Utils_Type
::T_STRING
,
315 'title' => ts('Billing First Name'),
316 'description' => ts('Billing first name at the time of token creation. Useful for fraud forensics'),
318 'size' => CRM_Utils_Type
::HUGE
,
319 'where' => 'civicrm_payment_token.billing_first_name',
320 'table_name' => 'civicrm_payment_token',
321 'entity' => 'PaymentToken',
322 'bao' => 'CRM_Financial_DAO_PaymentToken',
326 'billing_middle_name' => [
327 'name' => 'billing_middle_name',
328 'type' => CRM_Utils_Type
::T_STRING
,
329 'title' => ts('Billing Middle Name'),
330 'description' => ts('Billing middle name at the time of token creation. Useful for fraud forensics'),
332 'size' => CRM_Utils_Type
::HUGE
,
333 'where' => 'civicrm_payment_token.billing_middle_name',
334 'table_name' => 'civicrm_payment_token',
335 'entity' => 'PaymentToken',
336 'bao' => 'CRM_Financial_DAO_PaymentToken',
340 'billing_last_name' => [
341 'name' => 'billing_last_name',
342 'type' => CRM_Utils_Type
::T_STRING
,
343 'title' => ts('Billing Last Name'),
344 'description' => ts('Billing last name at the time of token creation. Useful for fraud forensics'),
346 'size' => CRM_Utils_Type
::HUGE
,
347 'where' => 'civicrm_payment_token.billing_last_name',
348 'table_name' => 'civicrm_payment_token',
349 'entity' => 'PaymentToken',
350 'bao' => 'CRM_Financial_DAO_PaymentToken',
354 'masked_account_number' => [
355 'name' => 'masked_account_number',
356 'type' => CRM_Utils_Type
::T_STRING
,
357 'title' => ts('Masked Account Number'),
358 'description' => ts('Holds the part of the card number or account details that may be retained or displayed'),
360 'size' => CRM_Utils_Type
::HUGE
,
361 'where' => 'civicrm_payment_token.masked_account_number',
362 'table_name' => 'civicrm_payment_token',
363 'entity' => 'PaymentToken',
364 'bao' => 'CRM_Financial_DAO_PaymentToken',
369 'name' => 'ip_address',
370 'type' => CRM_Utils_Type
::T_STRING
,
371 'title' => ts('IP Address'),
372 'description' => ts('IP used when creating the token. Useful for fraud forensics'),
374 'size' => CRM_Utils_Type
::HUGE
,
375 'where' => 'civicrm_payment_token.ip_address',
376 'table_name' => 'civicrm_payment_token',
377 'entity' => 'PaymentToken',
378 'bao' => 'CRM_Financial_DAO_PaymentToken',
383 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
385 return Civi
::$statics[__CLASS__
]['fields'];
389 * Return a mapping from field-name to the corresponding key (as used in fields()).
392 * Array(string $name => string $uniqueName).
394 public static function &fieldKeys() {
395 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
396 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
398 return Civi
::$statics[__CLASS__
]['fieldKeys'];
402 * Returns the names of this table
406 public static function getTableName() {
407 return self
::$_tableName;
411 * Returns if this table needs to be logged
415 public function getLog() {
420 * Returns the list of fields that can be imported
422 * @param bool $prefix
426 public static function &import($prefix = FALSE) {
427 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'payment_token', $prefix, []);
432 * Returns the list of fields that can be exported
434 * @param bool $prefix
438 public static function &export($prefix = FALSE) {
439 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'payment_token', $prefix, []);
444 * Returns the list of indices
446 * @param bool $localize
450 public static function indices($localize = TRUE) {
452 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;