5 * @copyright CiviCRM LLC (c) 2004-2019
7 * Generated from xml/schema/CRM/Financial/PaymentToken.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:13e09ccc4d4ae2dade53c251d4345ed2)
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 foreign keys and entity references.
132 * [CRM_Core_Reference_Interface]
134 public static function getReferenceColumns() {
135 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
136 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
137 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contact_id', 'civicrm_contact', 'id');
138 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'payment_processor_id', 'civicrm_payment_processor', 'id');
139 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'created_id', 'civicrm_contact', 'id');
140 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
142 return Civi
::$statics[__CLASS__
]['links'];
146 * Returns all the column names of this table
150 public static function &fields() {
151 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
152 Civi
::$statics[__CLASS__
]['fields'] = [
153 'payment_token_id' => [
155 'type' => CRM_Utils_Type
::T_INT
,
156 'title' => ts('Payment Token ID'),
157 'description' => ts('Payment Token ID'),
159 'where' => 'civicrm_payment_token.id',
160 'table_name' => 'civicrm_payment_token',
161 'entity' => 'PaymentToken',
162 'bao' => 'CRM_Financial_DAO_PaymentToken',
166 'name' => 'contact_id',
167 'type' => CRM_Utils_Type
::T_INT
,
168 'title' => ts('Contact ID'),
169 'description' => ts('FK to Contact ID for the owner of the token'),
171 'where' => 'civicrm_payment_token.contact_id',
172 'table_name' => 'civicrm_payment_token',
173 'entity' => 'PaymentToken',
174 'bao' => 'CRM_Financial_DAO_PaymentToken',
176 'FKClassName' => 'CRM_Contact_DAO_Contact',
178 'payment_processor_id' => [
179 'name' => 'payment_processor_id',
180 'type' => CRM_Utils_Type
::T_INT
,
181 'title' => ts('Payment Processor ID'),
183 'where' => 'civicrm_payment_token.payment_processor_id',
184 'table_name' => 'civicrm_payment_token',
185 'entity' => 'PaymentToken',
186 'bao' => 'CRM_Financial_DAO_PaymentToken',
188 'FKClassName' => 'CRM_Financial_DAO_PaymentProcessor',
192 'type' => CRM_Utils_Type
::T_STRING
,
193 'title' => ts('Token'),
194 'description' => ts('Externally provided token string'),
197 'size' => CRM_Utils_Type
::HUGE
,
198 'where' => 'civicrm_payment_token.token',
199 'table_name' => 'civicrm_payment_token',
200 'entity' => 'PaymentToken',
201 'bao' => 'CRM_Financial_DAO_PaymentToken',
205 'name' => 'created_date',
206 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
207 'title' => ts('Created Date'),
208 'description' => ts('Date created'),
209 'where' => 'civicrm_payment_token.created_date',
210 'default' => 'CURRENT_TIMESTAMP',
211 'table_name' => 'civicrm_payment_token',
212 'entity' => 'PaymentToken',
213 'bao' => 'CRM_Financial_DAO_PaymentToken',
217 'name' => 'created_id',
218 'type' => CRM_Utils_Type
::T_INT
,
219 'title' => ts('Created ID'),
220 'description' => ts('Contact ID of token creator'),
221 'where' => 'civicrm_payment_token.created_id',
222 'table_name' => 'civicrm_payment_token',
223 'entity' => 'PaymentToken',
224 'bao' => 'CRM_Financial_DAO_PaymentToken',
226 'FKClassName' => 'CRM_Contact_DAO_Contact',
229 'name' => 'expiry_date',
230 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
231 'title' => ts('Expiry Date'),
232 'description' => ts('Date this token expires'),
233 'where' => 'civicrm_payment_token.expiry_date',
234 'table_name' => 'civicrm_payment_token',
235 'entity' => 'PaymentToken',
236 'bao' => 'CRM_Financial_DAO_PaymentToken',
241 'type' => CRM_Utils_Type
::T_STRING
,
242 'title' => ts('Email'),
243 'description' => ts('Email at the time of token creation. Useful for fraud forensics'),
245 'size' => CRM_Utils_Type
::HUGE
,
246 'where' => 'civicrm_payment_token.email',
247 'table_name' => 'civicrm_payment_token',
248 'entity' => 'PaymentToken',
249 'bao' => 'CRM_Financial_DAO_PaymentToken',
252 'billing_first_name' => [
253 'name' => 'billing_first_name',
254 'type' => CRM_Utils_Type
::T_STRING
,
255 'title' => ts('Billing First Name'),
256 'description' => ts('Billing first name at the time of token creation. Useful for fraud forensics'),
258 'size' => CRM_Utils_Type
::HUGE
,
259 'where' => 'civicrm_payment_token.billing_first_name',
260 'table_name' => 'civicrm_payment_token',
261 'entity' => 'PaymentToken',
262 'bao' => 'CRM_Financial_DAO_PaymentToken',
265 'billing_middle_name' => [
266 'name' => 'billing_middle_name',
267 'type' => CRM_Utils_Type
::T_STRING
,
268 'title' => ts('Billing Middle Name'),
269 'description' => ts('Billing middle name at the time of token creation. Useful for fraud forensics'),
271 'size' => CRM_Utils_Type
::HUGE
,
272 'where' => 'civicrm_payment_token.billing_middle_name',
273 'table_name' => 'civicrm_payment_token',
274 'entity' => 'PaymentToken',
275 'bao' => 'CRM_Financial_DAO_PaymentToken',
278 'billing_last_name' => [
279 'name' => 'billing_last_name',
280 'type' => CRM_Utils_Type
::T_STRING
,
281 'title' => ts('Billing Last Name'),
282 'description' => ts('Billing last name at the time of token creation. Useful for fraud forensics'),
284 'size' => CRM_Utils_Type
::HUGE
,
285 'where' => 'civicrm_payment_token.billing_last_name',
286 'table_name' => 'civicrm_payment_token',
287 'entity' => 'PaymentToken',
288 'bao' => 'CRM_Financial_DAO_PaymentToken',
291 'masked_account_number' => [
292 'name' => 'masked_account_number',
293 'type' => CRM_Utils_Type
::T_STRING
,
294 'title' => ts('Masked Account Number'),
295 'description' => ts('Holds the part of the card number or account details that may be retained or displayed'),
297 'size' => CRM_Utils_Type
::HUGE
,
298 'where' => 'civicrm_payment_token.masked_account_number',
299 'table_name' => 'civicrm_payment_token',
300 'entity' => 'PaymentToken',
301 'bao' => 'CRM_Financial_DAO_PaymentToken',
305 'name' => 'ip_address',
306 'type' => CRM_Utils_Type
::T_STRING
,
307 'title' => ts('IP Address'),
308 'description' => ts('IP used when creating the token. Useful for fraud forensics'),
310 'size' => CRM_Utils_Type
::HUGE
,
311 'where' => 'civicrm_payment_token.ip_address',
312 'table_name' => 'civicrm_payment_token',
313 'entity' => 'PaymentToken',
314 'bao' => 'CRM_Financial_DAO_PaymentToken',
318 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
320 return Civi
::$statics[__CLASS__
]['fields'];
324 * Return a mapping from field-name to the corresponding key (as used in fields()).
327 * Array(string $name => string $uniqueName).
329 public static function &fieldKeys() {
330 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
331 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
333 return Civi
::$statics[__CLASS__
]['fieldKeys'];
337 * Returns the names of this table
341 public static function getTableName() {
342 return self
::$_tableName;
346 * Returns if this table needs to be logged
350 public function getLog() {
355 * Returns the list of fields that can be imported
357 * @param bool $prefix
361 public static function &import($prefix = FALSE) {
362 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'payment_token', $prefix, []);
367 * Returns the list of fields that can be exported
369 * @param bool $prefix
373 public static function &export($prefix = FALSE) {
374 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'payment_token', $prefix, []);
379 * Returns the list of indices
381 * @param bool $localize
385 public static function indices($localize = TRUE) {
387 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;