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:c135e4bffc93086e83c082bbebc84372)
13 * Database access object for the PaymentToken entity.
15 class CRM_Financial_DAO_PaymentToken
extends CRM_Core_DAO
{
18 * Static instance to hold the table name.
22 public static $_tableName = 'civicrm_payment_token';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
29 public static $_log = FALSE;
39 * FK to Contact ID for the owner of the token
48 public $payment_processor_id;
51 * Externally provided token string
65 * Contact ID of token creator
72 * Date this token expires
79 * Email at the time of token creation. Useful for fraud forensics
86 * Billing first name at the time of token creation. Useful for fraud forensics
90 public $billing_first_name;
93 * Billing middle name at the time of token creation. Useful for fraud forensics
97 public $billing_middle_name;
100 * Billing last name at the time of token creation. Useful for fraud forensics
104 public $billing_last_name;
107 * Holds the part of the card number or account details that may be retained or displayed
111 public $masked_account_number;
114 * IP used when creating the token. Useful for fraud forensics
123 public function __construct() {
124 $this->__table
= 'civicrm_payment_token';
125 parent
::__construct();
129 * Returns localized title of this entity.
131 public static function getEntityTitle() {
132 return ts('Payment Tokens');
136 * Returns foreign keys and entity references.
139 * [CRM_Core_Reference_Interface]
141 public static function getReferenceColumns() {
142 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
143 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
144 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contact_id', 'civicrm_contact', 'id');
145 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'payment_processor_id', 'civicrm_payment_processor', 'id');
146 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'created_id', 'civicrm_contact', 'id');
147 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
149 return Civi
::$statics[__CLASS__
]['links'];
153 * Returns all the column names of this table
157 public static function &fields() {
158 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
159 Civi
::$statics[__CLASS__
]['fields'] = [
160 'payment_token_id' => [
162 'type' => CRM_Utils_Type
::T_INT
,
163 'title' => ts('Payment Token ID'),
164 'description' => ts('Payment Token ID'),
166 'where' => 'civicrm_payment_token.id',
167 'table_name' => 'civicrm_payment_token',
168 'entity' => 'PaymentToken',
169 'bao' => 'CRM_Financial_DAO_PaymentToken',
174 'name' => 'contact_id',
175 'type' => CRM_Utils_Type
::T_INT
,
176 'title' => ts('Contact ID'),
177 'description' => ts('FK to Contact ID for the owner of the token'),
179 'where' => 'civicrm_payment_token.contact_id',
180 'table_name' => 'civicrm_payment_token',
181 'entity' => 'PaymentToken',
182 'bao' => 'CRM_Financial_DAO_PaymentToken',
184 'FKClassName' => 'CRM_Contact_DAO_Contact',
187 'payment_processor_id' => [
188 'name' => 'payment_processor_id',
189 'type' => CRM_Utils_Type
::T_INT
,
190 'title' => ts('Payment Processor ID'),
192 'where' => 'civicrm_payment_token.payment_processor_id',
193 'table_name' => 'civicrm_payment_token',
194 'entity' => 'PaymentToken',
195 'bao' => 'CRM_Financial_DAO_PaymentToken',
197 'FKClassName' => 'CRM_Financial_DAO_PaymentProcessor',
202 'type' => CRM_Utils_Type
::T_STRING
,
203 'title' => ts('Token'),
204 'description' => ts('Externally provided token string'),
207 'size' => CRM_Utils_Type
::HUGE
,
208 'where' => 'civicrm_payment_token.token',
209 'table_name' => 'civicrm_payment_token',
210 'entity' => 'PaymentToken',
211 'bao' => 'CRM_Financial_DAO_PaymentToken',
216 'name' => 'created_date',
217 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
218 'title' => ts('Created Date'),
219 'description' => ts('Date created'),
220 'where' => 'civicrm_payment_token.created_date',
221 'default' => 'CURRENT_TIMESTAMP',
222 'table_name' => 'civicrm_payment_token',
223 'entity' => 'PaymentToken',
224 'bao' => 'CRM_Financial_DAO_PaymentToken',
229 'name' => 'created_id',
230 'type' => CRM_Utils_Type
::T_INT
,
231 'title' => ts('Created ID'),
232 'description' => ts('Contact ID of token creator'),
233 'where' => 'civicrm_payment_token.created_id',
234 'table_name' => 'civicrm_payment_token',
235 'entity' => 'PaymentToken',
236 'bao' => 'CRM_Financial_DAO_PaymentToken',
238 'FKClassName' => 'CRM_Contact_DAO_Contact',
242 'name' => 'expiry_date',
243 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
244 'title' => ts('Expiry Date'),
245 'description' => ts('Date this token expires'),
246 'where' => 'civicrm_payment_token.expiry_date',
247 'table_name' => 'civicrm_payment_token',
248 'entity' => 'PaymentToken',
249 'bao' => 'CRM_Financial_DAO_PaymentToken',
255 'type' => CRM_Utils_Type
::T_STRING
,
256 'title' => ts('Email'),
257 'description' => ts('Email at the time of token creation. Useful for fraud forensics'),
259 'size' => CRM_Utils_Type
::HUGE
,
260 'where' => 'civicrm_payment_token.email',
261 'table_name' => 'civicrm_payment_token',
262 'entity' => 'PaymentToken',
263 'bao' => 'CRM_Financial_DAO_PaymentToken',
267 'billing_first_name' => [
268 'name' => 'billing_first_name',
269 'type' => CRM_Utils_Type
::T_STRING
,
270 'title' => ts('Billing First Name'),
271 'description' => ts('Billing first name at the time of token creation. Useful for fraud forensics'),
273 'size' => CRM_Utils_Type
::HUGE
,
274 'where' => 'civicrm_payment_token.billing_first_name',
275 'table_name' => 'civicrm_payment_token',
276 'entity' => 'PaymentToken',
277 'bao' => 'CRM_Financial_DAO_PaymentToken',
281 'billing_middle_name' => [
282 'name' => 'billing_middle_name',
283 'type' => CRM_Utils_Type
::T_STRING
,
284 'title' => ts('Billing Middle Name'),
285 'description' => ts('Billing middle name at the time of token creation. Useful for fraud forensics'),
287 'size' => CRM_Utils_Type
::HUGE
,
288 'where' => 'civicrm_payment_token.billing_middle_name',
289 'table_name' => 'civicrm_payment_token',
290 'entity' => 'PaymentToken',
291 'bao' => 'CRM_Financial_DAO_PaymentToken',
295 'billing_last_name' => [
296 'name' => 'billing_last_name',
297 'type' => CRM_Utils_Type
::T_STRING
,
298 'title' => ts('Billing Last Name'),
299 'description' => ts('Billing last name at the time of token creation. Useful for fraud forensics'),
301 'size' => CRM_Utils_Type
::HUGE
,
302 'where' => 'civicrm_payment_token.billing_last_name',
303 'table_name' => 'civicrm_payment_token',
304 'entity' => 'PaymentToken',
305 'bao' => 'CRM_Financial_DAO_PaymentToken',
309 'masked_account_number' => [
310 'name' => 'masked_account_number',
311 'type' => CRM_Utils_Type
::T_STRING
,
312 'title' => ts('Masked Account Number'),
313 'description' => ts('Holds the part of the card number or account details that may be retained or displayed'),
315 'size' => CRM_Utils_Type
::HUGE
,
316 'where' => 'civicrm_payment_token.masked_account_number',
317 'table_name' => 'civicrm_payment_token',
318 'entity' => 'PaymentToken',
319 'bao' => 'CRM_Financial_DAO_PaymentToken',
324 'name' => 'ip_address',
325 'type' => CRM_Utils_Type
::T_STRING
,
326 'title' => ts('IP Address'),
327 'description' => ts('IP used when creating the token. Useful for fraud forensics'),
329 'size' => CRM_Utils_Type
::HUGE
,
330 'where' => 'civicrm_payment_token.ip_address',
331 'table_name' => 'civicrm_payment_token',
332 'entity' => 'PaymentToken',
333 'bao' => 'CRM_Financial_DAO_PaymentToken',
338 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
340 return Civi
::$statics[__CLASS__
]['fields'];
344 * Return a mapping from field-name to the corresponding key (as used in fields()).
347 * Array(string $name => string $uniqueName).
349 public static function &fieldKeys() {
350 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
351 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
353 return Civi
::$statics[__CLASS__
]['fieldKeys'];
357 * Returns the names of this table
361 public static function getTableName() {
362 return self
::$_tableName;
366 * Returns if this table needs to be logged
370 public function getLog() {
375 * Returns the list of fields that can be imported
377 * @param bool $prefix
381 public static function &import($prefix = FALSE) {
382 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'payment_token', $prefix, []);
387 * Returns the list of fields that can be exported
389 * @param bool $prefix
393 public static function &export($prefix = FALSE) {
394 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'payment_token', $prefix, []);
399 * Returns the list of indices
401 * @param bool $localize
405 public static function indices($localize = TRUE) {
407 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;