5 * @copyright CiviCRM LLC (c) 2004-2018
7 * Generated from xml/schema/CRM/Financial/PaymentToken.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:6b3810f34b7a2c1aacecfb67f1d09b42)
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 static $_tableName = 'civicrm_payment_token';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
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' => 'Payment Token ID',
159 'table_name' => 'civicrm_payment_token',
160 'entity' => 'PaymentToken',
161 'bao' => 'CRM_Financial_DAO_PaymentToken',
165 'name' => 'contact_id',
166 'type' => CRM_Utils_Type
::T_INT
,
167 'title' => ts('Contact ID'),
168 'description' => 'FK to Contact ID for the owner of the token',
170 'table_name' => 'civicrm_payment_token',
171 'entity' => 'PaymentToken',
172 'bao' => 'CRM_Financial_DAO_PaymentToken',
174 'FKClassName' => 'CRM_Contact_DAO_Contact',
176 'payment_processor_id' => [
177 'name' => 'payment_processor_id',
178 'type' => CRM_Utils_Type
::T_INT
,
179 'title' => ts('Payment Processor ID'),
181 'table_name' => 'civicrm_payment_token',
182 'entity' => 'PaymentToken',
183 'bao' => 'CRM_Financial_DAO_PaymentToken',
185 'FKClassName' => 'CRM_Financial_DAO_PaymentProcessor',
189 'type' => CRM_Utils_Type
::T_STRING
,
190 'title' => ts('Token'),
191 'description' => 'Externally provided token string',
194 'size' => CRM_Utils_Type
::HUGE
,
195 'table_name' => 'civicrm_payment_token',
196 'entity' => 'PaymentToken',
197 'bao' => 'CRM_Financial_DAO_PaymentToken',
201 'name' => 'created_date',
202 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
203 'title' => ts('Created Date'),
204 'description' => 'Date created',
205 'default' => 'CURRENT_TIMESTAMP',
206 'table_name' => 'civicrm_payment_token',
207 'entity' => 'PaymentToken',
208 'bao' => 'CRM_Financial_DAO_PaymentToken',
212 'name' => 'created_id',
213 'type' => CRM_Utils_Type
::T_INT
,
214 'title' => ts('Created ID'),
215 'description' => 'Contact ID of token creator',
216 'table_name' => 'civicrm_payment_token',
217 'entity' => 'PaymentToken',
218 'bao' => 'CRM_Financial_DAO_PaymentToken',
220 'FKClassName' => 'CRM_Contact_DAO_Contact',
223 'name' => 'expiry_date',
224 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
225 'title' => ts('Expiry Date'),
226 'description' => 'Date this token expires',
227 'table_name' => 'civicrm_payment_token',
228 'entity' => 'PaymentToken',
229 'bao' => 'CRM_Financial_DAO_PaymentToken',
234 'type' => CRM_Utils_Type
::T_STRING
,
235 'title' => ts('Email'),
236 'description' => 'Email at the time of token creation. Useful for fraud forensics',
238 'size' => CRM_Utils_Type
::HUGE
,
239 'table_name' => 'civicrm_payment_token',
240 'entity' => 'PaymentToken',
241 'bao' => 'CRM_Financial_DAO_PaymentToken',
244 'billing_first_name' => [
245 'name' => 'billing_first_name',
246 'type' => CRM_Utils_Type
::T_STRING
,
247 'title' => ts('Billing First Name'),
248 'description' => 'Billing first name at the time of token creation. Useful for fraud forensics',
250 'size' => CRM_Utils_Type
::HUGE
,
251 'table_name' => 'civicrm_payment_token',
252 'entity' => 'PaymentToken',
253 'bao' => 'CRM_Financial_DAO_PaymentToken',
256 'billing_middle_name' => [
257 'name' => 'billing_middle_name',
258 'type' => CRM_Utils_Type
::T_STRING
,
259 'title' => ts('Billing Middle Name'),
260 'description' => 'Billing middle name at the time of token creation. Useful for fraud forensics',
262 'size' => CRM_Utils_Type
::HUGE
,
263 'table_name' => 'civicrm_payment_token',
264 'entity' => 'PaymentToken',
265 'bao' => 'CRM_Financial_DAO_PaymentToken',
268 'billing_last_name' => [
269 'name' => 'billing_last_name',
270 'type' => CRM_Utils_Type
::T_STRING
,
271 'title' => ts('Billing Last Name'),
272 'description' => 'Billing last name at the time of token creation. Useful for fraud forensics',
274 'size' => CRM_Utils_Type
::HUGE
,
275 'table_name' => 'civicrm_payment_token',
276 'entity' => 'PaymentToken',
277 'bao' => 'CRM_Financial_DAO_PaymentToken',
280 'masked_account_number' => [
281 'name' => 'masked_account_number',
282 'type' => CRM_Utils_Type
::T_STRING
,
283 'title' => ts('Masked Account Number'),
284 'description' => 'Holds the part of the card number or account details that may be retained or displayed',
286 'size' => CRM_Utils_Type
::HUGE
,
287 'table_name' => 'civicrm_payment_token',
288 'entity' => 'PaymentToken',
289 'bao' => 'CRM_Financial_DAO_PaymentToken',
293 'name' => 'ip_address',
294 'type' => CRM_Utils_Type
::T_STRING
,
295 'title' => ts('IP Address'),
296 'description' => 'IP used when creating the token. Useful for fraud forensics',
298 'size' => CRM_Utils_Type
::HUGE
,
299 'table_name' => 'civicrm_payment_token',
300 'entity' => 'PaymentToken',
301 'bao' => 'CRM_Financial_DAO_PaymentToken',
305 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
307 return Civi
::$statics[__CLASS__
]['fields'];
311 * Return a mapping from field-name to the corresponding key (as used in fields()).
314 * Array(string $name => string $uniqueName).
316 public static function &fieldKeys() {
317 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
318 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
320 return Civi
::$statics[__CLASS__
]['fieldKeys'];
324 * Returns the names of this table
328 public static function getTableName() {
329 return self
::$_tableName;
333 * Returns if this table needs to be logged
337 public function getLog() {
342 * Returns the list of fields that can be imported
344 * @param bool $prefix
348 public static function &import($prefix = FALSE) {
349 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'payment_token', $prefix, []);
354 * Returns the list of fields that can be exported
356 * @param bool $prefix
360 public static function &export($prefix = FALSE) {
361 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'payment_token', $prefix, []);
366 * Returns the list of indices
368 * @param bool $localize
372 public static function indices($localize = TRUE) {
374 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;