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:f1c4b32a0722841ec435f9b6c4ecfe54)
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;
42 * FK to Contact ID for the owner of the token
51 public $payment_processor_id;
54 * Externally provided token string
68 * Contact ID of token creator
75 * Date this token expires
82 * Email at the time of token creation. Useful for fraud forensics
89 * Billing first name at the time of token creation. Useful for fraud forensics
93 public $billing_first_name;
96 * Billing middle name at the time of token creation. Useful for fraud forensics
100 public $billing_middle_name;
103 * Billing last name at the time of token creation. Useful for fraud forensics
107 public $billing_last_name;
110 * Holds the part of the card number or account details that may be retained or displayed
114 public $masked_account_number;
117 * IP used when creating the token. Useful for fraud forensics
126 public function __construct() {
127 $this->__table
= 'civicrm_payment_token';
128 parent
::__construct();
132 * Returns localized title of this entity.
134 * @param bool $plural
135 * Whether to return the plural version of the title.
137 public static function getEntityTitle($plural = FALSE) {
138 return $plural ?
ts('Payment Tokens') : ts('Payment Token');
142 * Returns foreign keys and entity references.
145 * [CRM_Core_Reference_Interface]
147 public static function getReferenceColumns() {
148 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
149 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
150 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contact_id', 'civicrm_contact', 'id');
151 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'payment_processor_id', 'civicrm_payment_processor', 'id');
152 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'created_id', 'civicrm_contact', 'id');
153 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
155 return Civi
::$statics[__CLASS__
]['links'];
159 * Returns all the column names of this table
163 public static function &fields() {
164 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
165 Civi
::$statics[__CLASS__
]['fields'] = [
166 'payment_token_id' => [
168 'type' => CRM_Utils_Type
::T_INT
,
169 'title' => ts('Payment Token ID'),
170 'description' => ts('Payment Token ID'),
172 'where' => 'civicrm_payment_token.id',
173 'table_name' => 'civicrm_payment_token',
174 'entity' => 'PaymentToken',
175 'bao' => 'CRM_Financial_DAO_PaymentToken',
184 'name' => 'contact_id',
185 'type' => CRM_Utils_Type
::T_INT
,
186 'title' => ts('Contact ID'),
187 'description' => ts('FK to Contact ID for the owner of the token'),
189 'where' => 'civicrm_payment_token.contact_id',
190 'table_name' => 'civicrm_payment_token',
191 'entity' => 'PaymentToken',
192 'bao' => 'CRM_Financial_DAO_PaymentToken',
194 'FKClassName' => 'CRM_Contact_DAO_Contact',
196 'label' => ts("Contact"),
200 'payment_processor_id' => [
201 'name' => 'payment_processor_id',
202 'type' => CRM_Utils_Type
::T_INT
,
203 'title' => ts('Payment Processor ID'),
205 'where' => 'civicrm_payment_token.payment_processor_id',
206 'table_name' => 'civicrm_payment_token',
207 'entity' => 'PaymentToken',
208 'bao' => 'CRM_Financial_DAO_PaymentToken',
210 'FKClassName' => 'CRM_Financial_DAO_PaymentProcessor',
212 'label' => ts("Payment Processor"),
218 'type' => CRM_Utils_Type
::T_STRING
,
219 'title' => ts('Token'),
220 'description' => ts('Externally provided token string'),
223 'size' => CRM_Utils_Type
::HUGE
,
224 'where' => 'civicrm_payment_token.token',
225 'table_name' => 'civicrm_payment_token',
226 'entity' => 'PaymentToken',
227 'bao' => 'CRM_Financial_DAO_PaymentToken',
232 'name' => 'created_date',
233 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
234 'title' => ts('Created Date'),
235 'description' => ts('Date created'),
236 'where' => 'civicrm_payment_token.created_date',
237 'default' => 'CURRENT_TIMESTAMP',
238 'table_name' => 'civicrm_payment_token',
239 'entity' => 'PaymentToken',
240 'bao' => 'CRM_Financial_DAO_PaymentToken',
245 'name' => 'created_id',
246 'type' => CRM_Utils_Type
::T_INT
,
247 'title' => ts('Created ID'),
248 'description' => ts('Contact ID of token creator'),
249 'where' => 'civicrm_payment_token.created_id',
250 'table_name' => 'civicrm_payment_token',
251 'entity' => 'PaymentToken',
252 'bao' => 'CRM_Financial_DAO_PaymentToken',
254 'FKClassName' => 'CRM_Contact_DAO_Contact',
256 'label' => ts("Created"),
261 'name' => 'expiry_date',
262 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
263 'title' => ts('Expiry Date'),
264 'description' => ts('Date this token expires'),
265 'where' => 'civicrm_payment_token.expiry_date',
266 'table_name' => 'civicrm_payment_token',
267 'entity' => 'PaymentToken',
268 'bao' => 'CRM_Financial_DAO_PaymentToken',
274 'type' => CRM_Utils_Type
::T_STRING
,
275 'title' => ts('Email'),
276 'description' => ts('Email at the time of token creation. Useful for fraud forensics'),
278 'size' => CRM_Utils_Type
::HUGE
,
279 'where' => 'civicrm_payment_token.email',
280 'table_name' => 'civicrm_payment_token',
281 'entity' => 'PaymentToken',
282 'bao' => 'CRM_Financial_DAO_PaymentToken',
286 'billing_first_name' => [
287 'name' => 'billing_first_name',
288 'type' => CRM_Utils_Type
::T_STRING
,
289 'title' => ts('Billing First Name'),
290 'description' => ts('Billing first name at the time of token creation. Useful for fraud forensics'),
292 'size' => CRM_Utils_Type
::HUGE
,
293 'where' => 'civicrm_payment_token.billing_first_name',
294 'table_name' => 'civicrm_payment_token',
295 'entity' => 'PaymentToken',
296 'bao' => 'CRM_Financial_DAO_PaymentToken',
300 'billing_middle_name' => [
301 'name' => 'billing_middle_name',
302 'type' => CRM_Utils_Type
::T_STRING
,
303 'title' => ts('Billing Middle Name'),
304 'description' => ts('Billing middle name at the time of token creation. Useful for fraud forensics'),
306 'size' => CRM_Utils_Type
::HUGE
,
307 'where' => 'civicrm_payment_token.billing_middle_name',
308 'table_name' => 'civicrm_payment_token',
309 'entity' => 'PaymentToken',
310 'bao' => 'CRM_Financial_DAO_PaymentToken',
314 'billing_last_name' => [
315 'name' => 'billing_last_name',
316 'type' => CRM_Utils_Type
::T_STRING
,
317 'title' => ts('Billing Last Name'),
318 'description' => ts('Billing last name at the time of token creation. Useful for fraud forensics'),
320 'size' => CRM_Utils_Type
::HUGE
,
321 'where' => 'civicrm_payment_token.billing_last_name',
322 'table_name' => 'civicrm_payment_token',
323 'entity' => 'PaymentToken',
324 'bao' => 'CRM_Financial_DAO_PaymentToken',
328 'masked_account_number' => [
329 'name' => 'masked_account_number',
330 'type' => CRM_Utils_Type
::T_STRING
,
331 'title' => ts('Masked Account Number'),
332 'description' => ts('Holds the part of the card number or account details that may be retained or displayed'),
334 'size' => CRM_Utils_Type
::HUGE
,
335 'where' => 'civicrm_payment_token.masked_account_number',
336 'table_name' => 'civicrm_payment_token',
337 'entity' => 'PaymentToken',
338 'bao' => 'CRM_Financial_DAO_PaymentToken',
343 'name' => 'ip_address',
344 'type' => CRM_Utils_Type
::T_STRING
,
345 'title' => ts('IP Address'),
346 'description' => ts('IP used when creating the token. Useful for fraud forensics'),
348 'size' => CRM_Utils_Type
::HUGE
,
349 'where' => 'civicrm_payment_token.ip_address',
350 'table_name' => 'civicrm_payment_token',
351 'entity' => 'PaymentToken',
352 'bao' => 'CRM_Financial_DAO_PaymentToken',
357 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
359 return Civi
::$statics[__CLASS__
]['fields'];
363 * Return a mapping from field-name to the corresponding key (as used in fields()).
366 * Array(string $name => string $uniqueName).
368 public static function &fieldKeys() {
369 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
370 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
372 return Civi
::$statics[__CLASS__
]['fieldKeys'];
376 * Returns the names of this table
380 public static function getTableName() {
381 return self
::$_tableName;
385 * Returns if this table needs to be logged
389 public function getLog() {
394 * Returns the list of fields that can be imported
396 * @param bool $prefix
400 public static function &import($prefix = FALSE) {
401 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'payment_token', $prefix, []);
406 * Returns the list of fields that can be exported
408 * @param bool $prefix
412 public static function &export($prefix = FALSE) {
413 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'payment_token', $prefix, []);
418 * Returns the list of indices
420 * @param bool $localize
424 public static function indices($localize = TRUE) {
426 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;