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:720f0e7cb082e98a9ec58b94de532db3)
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',
173 'name' => 'contact_id',
174 'type' => CRM_Utils_Type
::T_INT
,
175 'title' => ts('Contact ID'),
176 'description' => ts('FK to Contact ID for the owner of the token'),
178 'where' => 'civicrm_payment_token.contact_id',
179 'table_name' => 'civicrm_payment_token',
180 'entity' => 'PaymentToken',
181 'bao' => 'CRM_Financial_DAO_PaymentToken',
183 'FKClassName' => 'CRM_Contact_DAO_Contact',
185 'payment_processor_id' => [
186 'name' => 'payment_processor_id',
187 'type' => CRM_Utils_Type
::T_INT
,
188 'title' => ts('Payment Processor ID'),
190 'where' => 'civicrm_payment_token.payment_processor_id',
191 'table_name' => 'civicrm_payment_token',
192 'entity' => 'PaymentToken',
193 'bao' => 'CRM_Financial_DAO_PaymentToken',
195 'FKClassName' => 'CRM_Financial_DAO_PaymentProcessor',
199 'type' => CRM_Utils_Type
::T_STRING
,
200 'title' => ts('Token'),
201 'description' => ts('Externally provided token string'),
204 'size' => CRM_Utils_Type
::HUGE
,
205 'where' => 'civicrm_payment_token.token',
206 'table_name' => 'civicrm_payment_token',
207 'entity' => 'PaymentToken',
208 'bao' => 'CRM_Financial_DAO_PaymentToken',
212 'name' => 'created_date',
213 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
214 'title' => ts('Created Date'),
215 'description' => ts('Date created'),
216 'where' => 'civicrm_payment_token.created_date',
217 'default' => 'CURRENT_TIMESTAMP',
218 'table_name' => 'civicrm_payment_token',
219 'entity' => 'PaymentToken',
220 'bao' => 'CRM_Financial_DAO_PaymentToken',
224 'name' => 'created_id',
225 'type' => CRM_Utils_Type
::T_INT
,
226 'title' => ts('Created ID'),
227 'description' => ts('Contact ID of token creator'),
228 'where' => 'civicrm_payment_token.created_id',
229 'table_name' => 'civicrm_payment_token',
230 'entity' => 'PaymentToken',
231 'bao' => 'CRM_Financial_DAO_PaymentToken',
233 'FKClassName' => 'CRM_Contact_DAO_Contact',
236 'name' => 'expiry_date',
237 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
238 'title' => ts('Expiry Date'),
239 'description' => ts('Date this token expires'),
240 'where' => 'civicrm_payment_token.expiry_date',
241 'table_name' => 'civicrm_payment_token',
242 'entity' => 'PaymentToken',
243 'bao' => 'CRM_Financial_DAO_PaymentToken',
248 'type' => CRM_Utils_Type
::T_STRING
,
249 'title' => ts('Email'),
250 'description' => ts('Email at the time of token creation. Useful for fraud forensics'),
252 'size' => CRM_Utils_Type
::HUGE
,
253 'where' => 'civicrm_payment_token.email',
254 'table_name' => 'civicrm_payment_token',
255 'entity' => 'PaymentToken',
256 'bao' => 'CRM_Financial_DAO_PaymentToken',
259 'billing_first_name' => [
260 'name' => 'billing_first_name',
261 'type' => CRM_Utils_Type
::T_STRING
,
262 'title' => ts('Billing First Name'),
263 'description' => ts('Billing first name at the time of token creation. Useful for fraud forensics'),
265 'size' => CRM_Utils_Type
::HUGE
,
266 'where' => 'civicrm_payment_token.billing_first_name',
267 'table_name' => 'civicrm_payment_token',
268 'entity' => 'PaymentToken',
269 'bao' => 'CRM_Financial_DAO_PaymentToken',
272 'billing_middle_name' => [
273 'name' => 'billing_middle_name',
274 'type' => CRM_Utils_Type
::T_STRING
,
275 'title' => ts('Billing Middle Name'),
276 'description' => ts('Billing middle name at the time of token creation. Useful for fraud forensics'),
278 'size' => CRM_Utils_Type
::HUGE
,
279 'where' => 'civicrm_payment_token.billing_middle_name',
280 'table_name' => 'civicrm_payment_token',
281 'entity' => 'PaymentToken',
282 'bao' => 'CRM_Financial_DAO_PaymentToken',
285 'billing_last_name' => [
286 'name' => 'billing_last_name',
287 'type' => CRM_Utils_Type
::T_STRING
,
288 'title' => ts('Billing Last Name'),
289 'description' => ts('Billing last name at the time of token creation. Useful for fraud forensics'),
291 'size' => CRM_Utils_Type
::HUGE
,
292 'where' => 'civicrm_payment_token.billing_last_name',
293 'table_name' => 'civicrm_payment_token',
294 'entity' => 'PaymentToken',
295 'bao' => 'CRM_Financial_DAO_PaymentToken',
298 'masked_account_number' => [
299 'name' => 'masked_account_number',
300 'type' => CRM_Utils_Type
::T_STRING
,
301 'title' => ts('Masked Account Number'),
302 'description' => ts('Holds the part of the card number or account details that may be retained or displayed'),
304 'size' => CRM_Utils_Type
::HUGE
,
305 'where' => 'civicrm_payment_token.masked_account_number',
306 'table_name' => 'civicrm_payment_token',
307 'entity' => 'PaymentToken',
308 'bao' => 'CRM_Financial_DAO_PaymentToken',
312 'name' => 'ip_address',
313 'type' => CRM_Utils_Type
::T_STRING
,
314 'title' => ts('IP Address'),
315 'description' => ts('IP used when creating the token. Useful for fraud forensics'),
317 'size' => CRM_Utils_Type
::HUGE
,
318 'where' => 'civicrm_payment_token.ip_address',
319 'table_name' => 'civicrm_payment_token',
320 'entity' => 'PaymentToken',
321 'bao' => 'CRM_Financial_DAO_PaymentToken',
325 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
327 return Civi
::$statics[__CLASS__
]['fields'];
331 * Return a mapping from field-name to the corresponding key (as used in fields()).
334 * Array(string $name => string $uniqueName).
336 public static function &fieldKeys() {
337 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
338 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
340 return Civi
::$statics[__CLASS__
]['fieldKeys'];
344 * Returns the names of this table
348 public static function getTableName() {
349 return self
::$_tableName;
353 * Returns if this table needs to be logged
357 public function getLog() {
362 * Returns the list of fields that can be imported
364 * @param bool $prefix
368 public static function &import($prefix = FALSE) {
369 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'payment_token', $prefix, []);
374 * Returns the list of fields that can be exported
376 * @param bool $prefix
380 public static function &export($prefix = FALSE) {
381 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'payment_token', $prefix, []);
386 * Returns the list of indices
388 * @param bool $localize
392 public static function indices($localize = TRUE) {
394 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;