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:2923b7966bbe25d435eb7b909d35541f)
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';
20 * Static instance to hold the table name.
24 public static $_tableName = 'civicrm_payment_token';
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
31 public static $_log = FALSE;
41 * FK to Contact ID for the owner of the token
50 public $payment_processor_id;
53 * Externally provided token string
67 * Contact ID of token creator
74 * Date this token expires
81 * Email at the time of token creation. Useful for fraud forensics
88 * Billing first name at the time of token creation. Useful for fraud forensics
92 public $billing_first_name;
95 * Billing middle name at the time of token creation. Useful for fraud forensics
99 public $billing_middle_name;
102 * Billing last name at the time of token creation. Useful for fraud forensics
106 public $billing_last_name;
109 * Holds the part of the card number or account details that may be retained or displayed
113 public $masked_account_number;
116 * IP used when creating the token. Useful for fraud forensics
125 public function __construct() {
126 $this->__table
= 'civicrm_payment_token';
127 parent
::__construct();
131 * Returns localized title of this entity.
133 * @param bool $plural
134 * Whether to return the plural version of the title.
136 public static function getEntityTitle($plural = FALSE) {
137 return $plural ?
ts('Payment Tokens') : ts('Payment Token');
141 * Returns foreign keys and entity references.
144 * [CRM_Core_Reference_Interface]
146 public static function getReferenceColumns() {
147 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
148 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
149 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contact_id', 'civicrm_contact', 'id');
150 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'payment_processor_id', 'civicrm_payment_processor', 'id');
151 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'created_id', 'civicrm_contact', 'id');
152 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
154 return Civi
::$statics[__CLASS__
]['links'];
158 * Returns all the column names of this table
162 public static function &fields() {
163 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
164 Civi
::$statics[__CLASS__
]['fields'] = [
165 'payment_token_id' => [
167 'type' => CRM_Utils_Type
::T_INT
,
168 'title' => ts('Payment Token ID'),
169 'description' => ts('Payment Token ID'),
171 'where' => 'civicrm_payment_token.id',
172 'table_name' => 'civicrm_payment_token',
173 'entity' => 'PaymentToken',
174 'bao' => 'CRM_Financial_DAO_PaymentToken',
179 'name' => 'contact_id',
180 'type' => CRM_Utils_Type
::T_INT
,
181 'title' => ts('Contact ID'),
182 'description' => ts('FK to Contact ID for the owner of the token'),
184 'where' => 'civicrm_payment_token.contact_id',
185 'table_name' => 'civicrm_payment_token',
186 'entity' => 'PaymentToken',
187 'bao' => 'CRM_Financial_DAO_PaymentToken',
189 'FKClassName' => 'CRM_Contact_DAO_Contact',
192 'payment_processor_id' => [
193 'name' => 'payment_processor_id',
194 'type' => CRM_Utils_Type
::T_INT
,
195 'title' => ts('Payment Processor ID'),
197 'where' => 'civicrm_payment_token.payment_processor_id',
198 'table_name' => 'civicrm_payment_token',
199 'entity' => 'PaymentToken',
200 'bao' => 'CRM_Financial_DAO_PaymentToken',
202 'FKClassName' => 'CRM_Financial_DAO_PaymentProcessor',
207 'type' => CRM_Utils_Type
::T_STRING
,
208 'title' => ts('Token'),
209 'description' => ts('Externally provided token string'),
212 'size' => CRM_Utils_Type
::HUGE
,
213 'where' => 'civicrm_payment_token.token',
214 'table_name' => 'civicrm_payment_token',
215 'entity' => 'PaymentToken',
216 'bao' => 'CRM_Financial_DAO_PaymentToken',
221 'name' => 'created_date',
222 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
223 'title' => ts('Created Date'),
224 'description' => ts('Date created'),
225 'where' => 'civicrm_payment_token.created_date',
226 'default' => 'CURRENT_TIMESTAMP',
227 'table_name' => 'civicrm_payment_token',
228 'entity' => 'PaymentToken',
229 'bao' => 'CRM_Financial_DAO_PaymentToken',
234 'name' => 'created_id',
235 'type' => CRM_Utils_Type
::T_INT
,
236 'title' => ts('Created ID'),
237 'description' => ts('Contact ID of token creator'),
238 'where' => 'civicrm_payment_token.created_id',
239 'table_name' => 'civicrm_payment_token',
240 'entity' => 'PaymentToken',
241 'bao' => 'CRM_Financial_DAO_PaymentToken',
243 'FKClassName' => 'CRM_Contact_DAO_Contact',
247 'name' => 'expiry_date',
248 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
249 'title' => ts('Expiry Date'),
250 'description' => ts('Date this token expires'),
251 'where' => 'civicrm_payment_token.expiry_date',
252 'table_name' => 'civicrm_payment_token',
253 'entity' => 'PaymentToken',
254 'bao' => 'CRM_Financial_DAO_PaymentToken',
260 'type' => CRM_Utils_Type
::T_STRING
,
261 'title' => ts('Email'),
262 'description' => ts('Email at the time of token creation. Useful for fraud forensics'),
264 'size' => CRM_Utils_Type
::HUGE
,
265 'where' => 'civicrm_payment_token.email',
266 'table_name' => 'civicrm_payment_token',
267 'entity' => 'PaymentToken',
268 'bao' => 'CRM_Financial_DAO_PaymentToken',
272 'billing_first_name' => [
273 'name' => 'billing_first_name',
274 'type' => CRM_Utils_Type
::T_STRING
,
275 'title' => ts('Billing First Name'),
276 'description' => ts('Billing first name at the time of token creation. Useful for fraud forensics'),
278 'size' => CRM_Utils_Type
::HUGE
,
279 'where' => 'civicrm_payment_token.billing_first_name',
280 'table_name' => 'civicrm_payment_token',
281 'entity' => 'PaymentToken',
282 'bao' => 'CRM_Financial_DAO_PaymentToken',
286 'billing_middle_name' => [
287 'name' => 'billing_middle_name',
288 'type' => CRM_Utils_Type
::T_STRING
,
289 'title' => ts('Billing Middle Name'),
290 'description' => ts('Billing middle name at the time of token creation. Useful for fraud forensics'),
292 'size' => CRM_Utils_Type
::HUGE
,
293 'where' => 'civicrm_payment_token.billing_middle_name',
294 'table_name' => 'civicrm_payment_token',
295 'entity' => 'PaymentToken',
296 'bao' => 'CRM_Financial_DAO_PaymentToken',
300 'billing_last_name' => [
301 'name' => 'billing_last_name',
302 'type' => CRM_Utils_Type
::T_STRING
,
303 'title' => ts('Billing Last Name'),
304 'description' => ts('Billing last name at the time of token creation. Useful for fraud forensics'),
306 'size' => CRM_Utils_Type
::HUGE
,
307 'where' => 'civicrm_payment_token.billing_last_name',
308 'table_name' => 'civicrm_payment_token',
309 'entity' => 'PaymentToken',
310 'bao' => 'CRM_Financial_DAO_PaymentToken',
314 'masked_account_number' => [
315 'name' => 'masked_account_number',
316 'type' => CRM_Utils_Type
::T_STRING
,
317 'title' => ts('Masked Account Number'),
318 'description' => ts('Holds the part of the card number or account details that may be retained or displayed'),
320 'size' => CRM_Utils_Type
::HUGE
,
321 'where' => 'civicrm_payment_token.masked_account_number',
322 'table_name' => 'civicrm_payment_token',
323 'entity' => 'PaymentToken',
324 'bao' => 'CRM_Financial_DAO_PaymentToken',
329 'name' => 'ip_address',
330 'type' => CRM_Utils_Type
::T_STRING
,
331 'title' => ts('IP Address'),
332 'description' => ts('IP used when creating the token. Useful for fraud forensics'),
334 'size' => CRM_Utils_Type
::HUGE
,
335 'where' => 'civicrm_payment_token.ip_address',
336 'table_name' => 'civicrm_payment_token',
337 'entity' => 'PaymentToken',
338 'bao' => 'CRM_Financial_DAO_PaymentToken',
343 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
345 return Civi
::$statics[__CLASS__
]['fields'];
349 * Return a mapping from field-name to the corresponding key (as used in fields()).
352 * Array(string $name => string $uniqueName).
354 public static function &fieldKeys() {
355 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
356 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
358 return Civi
::$statics[__CLASS__
]['fieldKeys'];
362 * Returns the names of this table
366 public static function getTableName() {
367 return self
::$_tableName;
371 * Returns if this table needs to be logged
375 public function getLog() {
380 * Returns the list of fields that can be imported
382 * @param bool $prefix
386 public static function &import($prefix = FALSE) {
387 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'payment_token', $prefix, []);
392 * Returns the list of fields that can be exported
394 * @param bool $prefix
398 public static function &export($prefix = FALSE) {
399 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'payment_token', $prefix, []);
404 * Returns the list of indices
406 * @param bool $localize
410 public static function indices($localize = TRUE) {
412 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;