Fix merge head on master.
[civicrm-core.git] / CRM / Financial / DAO / PaymentToken.php
CommitLineData
e501603b
TO
1<?php
2/*
3+--------------------------------------------------------------------+
4| CiviCRM version 4.7 |
5+--------------------------------------------------------------------+
0f03f337 6| Copyright CiviCRM LLC (c) 2004-2017 |
e501603b
TO
7+--------------------------------------------------------------------+
8| This file is a part of CiviCRM. |
9| |
10| CiviCRM is free software; you can copy, modify, and distribute it |
11| under the terms of the GNU Affero General Public License |
12| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13| |
14| CiviCRM is distributed in the hope that it will be useful, but |
15| WITHOUT ANY WARRANTY; without even the implied warranty of |
16| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17| See the GNU Affero General Public License for more details. |
18| |
19| You should have received a copy of the GNU Affero General Public |
20| License and the CiviCRM Licensing Exception along |
21| with this program; if not, contact CiviCRM LLC |
22| at info[AT]civicrm[DOT]org. If you have questions about the |
23| GNU Affero General Public License or the licensing of CiviCRM, |
24| see the CiviCRM license FAQ at http://civicrm.org/licensing |
25+--------------------------------------------------------------------+
26*/
27/**
28 * @package CRM
0f03f337 29 * @copyright CiviCRM LLC (c) 2004-2017
e501603b
TO
30 *
31 * Generated from xml/schema/CRM/Financial/PaymentToken.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
022785d8 33 * (GenCodeChecksum:6b3810f34b7a2c1aacecfb67f1d09b42)
e501603b
TO
34 */
35require_once 'CRM/Core/DAO.php';
36require_once 'CRM/Utils/Type.php';
f41f0342 37/**
38 * CRM_Financial_DAO_PaymentToken constructor.
39 */
e501603b
TO
40class CRM_Financial_DAO_PaymentToken extends CRM_Core_DAO {
41 /**
f41f0342 42 * Static instance to hold the table name.
e501603b
TO
43 *
44 * @var string
45 */
46 static $_tableName = 'civicrm_payment_token';
e501603b 47 /**
f41f0342 48 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b
TO
49 *
50 * @var boolean
51 */
52 static $_log = false;
53 /**
54 * Payment Token ID
55 *
56 * @var int unsigned
57 */
58 public $id;
59 /**
60 * FK to Contact ID for the owner of the token
61 *
62 * @var int unsigned
63 */
64 public $contact_id;
65 /**
66 *
67 * @var int unsigned
68 */
69 public $payment_processor_id;
70 /**
71 * Externally provided token string
72 *
73 * @var string
74 */
75 public $token;
76 /**
77 * Date created
78 *
79 * @var timestamp
80 */
81 public $created_date;
82 /**
83 * Contact ID of token creator
84 *
85 * @var int unsigned
86 */
87 public $created_id;
88 /**
89 * Date this token expires
90 *
91 * @var datetime
92 */
93 public $expiry_date;
94 /**
95 * Email at the time of token creation. Useful for fraud forensics
96 *
97 * @var string
98 */
99 public $email;
100 /**
101 * Billing first name at the time of token creation. Useful for fraud forensics
102 *
103 * @var string
104 */
105 public $billing_first_name;
106 /**
107 * Billing middle name at the time of token creation. Useful for fraud forensics
108 *
109 * @var string
110 */
111 public $billing_middle_name;
112 /**
113 * Billing last name at the time of token creation. Useful for fraud forensics
114 *
115 * @var string
116 */
117 public $billing_last_name;
118 /**
119 * Holds the part of the card number or account details that may be retained or displayed
120 *
121 * @var string
122 */
123 public $masked_account_number;
124 /**
125 * IP used when creating the token. Useful for fraud forensics
126 *
127 * @var string
128 */
129 public $ip_address;
130 /**
f41f0342 131 * Class constructor.
e501603b
TO
132 */
133 function __construct() {
134 $this->__table = 'civicrm_payment_token';
135 parent::__construct();
136 }
137 /**
f41f0342 138 * Returns foreign keys and entity references.
e501603b
TO
139 *
140 * @return array
141 * [CRM_Core_Reference_Interface]
142 */
143 static function getReferenceColumns() {
346aaaba
TO
144 if (!isset(Civi::$statics[__CLASS__]['links'])) {
145 Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__);
146 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id');
147 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'payment_processor_id', 'civicrm_payment_processor', 'id');
148 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'created_id', 'civicrm_contact', 'id');
149 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 150 }
346aaaba 151 return Civi::$statics[__CLASS__]['links'];
e501603b
TO
152 }
153 /**
154 * Returns all the column names of this table
155 *
156 * @return array
157 */
158 static function &fields() {
346aaaba
TO
159 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
160 Civi::$statics[__CLASS__]['fields'] = array(
e501603b
TO
161 'payment_token_id' => array(
162 'name' => 'id',
163 'type' => CRM_Utils_Type::T_INT,
164 'title' => ts('Payment Token ID') ,
165 'description' => 'Payment Token ID',
166 'required' => true,
522a26c9 167 'table_name' => 'civicrm_payment_token',
168 'entity' => 'PaymentToken',
169 'bao' => 'CRM_Financial_DAO_PaymentToken',
e501603b
TO
170 ) ,
171 'contact_id' => array(
172 'name' => 'contact_id',
173 'type' => CRM_Utils_Type::T_INT,
174 'title' => ts('Contact ID') ,
175 'description' => 'FK to Contact ID for the owner of the token',
176 'required' => true,
522a26c9 177 'table_name' => 'civicrm_payment_token',
178 'entity' => 'PaymentToken',
179 'bao' => 'CRM_Financial_DAO_PaymentToken',
e501603b
TO
180 'FKClassName' => 'CRM_Contact_DAO_Contact',
181 ) ,
182 'payment_processor_id' => array(
183 'name' => 'payment_processor_id',
184 'type' => CRM_Utils_Type::T_INT,
185 'title' => ts('Payment Processor ID') ,
186 'required' => true,
522a26c9 187 'table_name' => 'civicrm_payment_token',
188 'entity' => 'PaymentToken',
189 'bao' => 'CRM_Financial_DAO_PaymentToken',
e501603b
TO
190 'FKClassName' => 'CRM_Financial_DAO_PaymentProcessor',
191 ) ,
192 'token' => array(
193 'name' => 'token',
194 'type' => CRM_Utils_Type::T_STRING,
195 'title' => ts('Token') ,
196 'description' => 'Externally provided token string',
197 'required' => true,
198 'maxlength' => 255,
199 'size' => CRM_Utils_Type::HUGE,
522a26c9 200 'table_name' => 'civicrm_payment_token',
201 'entity' => 'PaymentToken',
202 'bao' => 'CRM_Financial_DAO_PaymentToken',
e501603b
TO
203 ) ,
204 'created_date' => array(
205 'name' => 'created_date',
206 'type' => CRM_Utils_Type::T_TIMESTAMP,
207 'title' => ts('Created Date') ,
208 'description' => 'Date created',
209 'default' => 'CURRENT_TIMESTAMP',
522a26c9 210 'table_name' => 'civicrm_payment_token',
211 'entity' => 'PaymentToken',
212 'bao' => 'CRM_Financial_DAO_PaymentToken',
e501603b
TO
213 ) ,
214 'created_id' => array(
215 'name' => 'created_id',
216 'type' => CRM_Utils_Type::T_INT,
217 'title' => ts('Created ID') ,
218 'description' => 'Contact ID of token creator',
522a26c9 219 'table_name' => 'civicrm_payment_token',
220 'entity' => 'PaymentToken',
221 'bao' => 'CRM_Financial_DAO_PaymentToken',
e501603b
TO
222 'FKClassName' => 'CRM_Contact_DAO_Contact',
223 ) ,
224 'expiry_date' => array(
225 'name' => 'expiry_date',
226 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
227 'title' => ts('Expiry Date') ,
228 'description' => 'Date this token expires',
522a26c9 229 'table_name' => 'civicrm_payment_token',
230 'entity' => 'PaymentToken',
231 'bao' => 'CRM_Financial_DAO_PaymentToken',
e501603b
TO
232 ) ,
233 'email' => array(
234 'name' => 'email',
235 'type' => CRM_Utils_Type::T_STRING,
236 'title' => ts('Email') ,
237 'description' => 'Email at the time of token creation. Useful for fraud forensics',
238 'maxlength' => 255,
239 'size' => CRM_Utils_Type::HUGE,
522a26c9 240 'table_name' => 'civicrm_payment_token',
241 'entity' => 'PaymentToken',
242 'bao' => 'CRM_Financial_DAO_PaymentToken',
e501603b
TO
243 ) ,
244 'billing_first_name' => array(
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',
249 'maxlength' => 255,
250 'size' => CRM_Utils_Type::HUGE,
522a26c9 251 'table_name' => 'civicrm_payment_token',
252 'entity' => 'PaymentToken',
253 'bao' => 'CRM_Financial_DAO_PaymentToken',
e501603b
TO
254 ) ,
255 'billing_middle_name' => array(
256 'name' => 'billing_middle_name',
257 'type' => CRM_Utils_Type::T_STRING,
258 'title' => ts('Billing Middle Name') ,
259 'description' => 'Billing middle name at the time of token creation. Useful for fraud forensics',
260 'maxlength' => 255,
261 'size' => CRM_Utils_Type::HUGE,
522a26c9 262 'table_name' => 'civicrm_payment_token',
263 'entity' => 'PaymentToken',
264 'bao' => 'CRM_Financial_DAO_PaymentToken',
e501603b
TO
265 ) ,
266 'billing_last_name' => array(
267 'name' => 'billing_last_name',
268 'type' => CRM_Utils_Type::T_STRING,
269 'title' => ts('Billing Last Name') ,
270 'description' => 'Billing last name at the time of token creation. Useful for fraud forensics',
271 'maxlength' => 255,
272 'size' => CRM_Utils_Type::HUGE,
522a26c9 273 'table_name' => 'civicrm_payment_token',
274 'entity' => 'PaymentToken',
275 'bao' => 'CRM_Financial_DAO_PaymentToken',
e501603b
TO
276 ) ,
277 'masked_account_number' => array(
278 'name' => 'masked_account_number',
279 'type' => CRM_Utils_Type::T_STRING,
280 'title' => ts('Masked Account Number') ,
281 'description' => 'Holds the part of the card number or account details that may be retained or displayed',
282 'maxlength' => 255,
283 'size' => CRM_Utils_Type::HUGE,
522a26c9 284 'table_name' => 'civicrm_payment_token',
285 'entity' => 'PaymentToken',
286 'bao' => 'CRM_Financial_DAO_PaymentToken',
e501603b
TO
287 ) ,
288 'ip_address' => array(
289 'name' => 'ip_address',
290 'type' => CRM_Utils_Type::T_STRING,
291 'title' => ts('IP Address') ,
292 'description' => 'IP used when creating the token. Useful for fraud forensics',
293 'maxlength' => 255,
294 'size' => CRM_Utils_Type::HUGE,
522a26c9 295 'table_name' => 'civicrm_payment_token',
296 'entity' => 'PaymentToken',
297 'bao' => 'CRM_Financial_DAO_PaymentToken',
e501603b
TO
298 ) ,
299 );
346aaaba 300 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 301 }
346aaaba 302 return Civi::$statics[__CLASS__]['fields'];
e501603b
TO
303 }
304 /**
bd8e0b14 305 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
306 *
307 * @return array
bd8e0b14 308 * Array(string $name => string $uniqueName).
e501603b
TO
309 */
310 static function &fieldKeys() {
bd8e0b14
TO
311 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
312 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 313 }
bd8e0b14 314 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b
TO
315 }
316 /**
317 * Returns the names of this table
318 *
319 * @return string
320 */
321 static function getTableName() {
322 return self::$_tableName;
323 }
324 /**
325 * Returns if this table needs to be logged
326 *
327 * @return boolean
328 */
329 function getLog() {
330 return self::$_log;
331 }
332 /**
333 * Returns the list of fields that can be imported
334 *
335 * @param bool $prefix
336 *
337 * @return array
338 */
339 static function &import($prefix = false) {
60808919
TO
340 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'payment_token', $prefix, array());
341 return $r;
e501603b
TO
342 }
343 /**
344 * Returns the list of fields that can be exported
345 *
346 * @param bool $prefix
347 *
348 * @return array
349 */
350 static function &export($prefix = false) {
60808919
TO
351 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'payment_token', $prefix, array());
352 return $r;
e501603b
TO
353 }
354}