CRM-14885 - Import DAO's
[civicrm-core.git] / CRM / Financial / DAO / PaymentToken.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2016 |
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
29 * @copyright CiviCRM LLC (c) 2004-2016
30 *
31 * Generated from xml/schema/CRM/Financial/PaymentToken.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:c605ea3935d538529bef1182880026ff)
34 */
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 class CRM_Financial_DAO_PaymentToken extends CRM_Core_DAO {
38 /**
39 * static instance to hold the table name
40 *
41 * @var string
42 */
43 static $_tableName = 'civicrm_payment_token';
44 /**
45 * static instance to hold the field values
46 *
47 * @var array
48 */
49 static $_fields = null;
50 /**
51 * static instance to hold the keys used in $_fields for each field.
52 *
53 * @var array
54 */
55 static $_fieldKeys = null;
56 /**
57 * static instance to hold the FK relationships
58 *
59 * @var string
60 */
61 static $_links = null;
62 /**
63 * static instance to hold the values that can
64 * be imported
65 *
66 * @var array
67 */
68 static $_import = null;
69 /**
70 * static instance to hold the values that can
71 * be exported
72 *
73 * @var array
74 */
75 static $_export = null;
76 /**
77 * static value to see if we should log any modifications to
78 * this table in the civicrm_log table
79 *
80 * @var boolean
81 */
82 static $_log = false;
83 /**
84 * Payment Token ID
85 *
86 * @var int unsigned
87 */
88 public $id;
89 /**
90 * FK to Contact ID for the owner of the token
91 *
92 * @var int unsigned
93 */
94 public $contact_id;
95 /**
96 *
97 * @var int unsigned
98 */
99 public $payment_processor_id;
100 /**
101 * Externally provided token string
102 *
103 * @var string
104 */
105 public $token;
106 /**
107 * Date created
108 *
109 * @var timestamp
110 */
111 public $created_date;
112 /**
113 * Contact ID of token creator
114 *
115 * @var int unsigned
116 */
117 public $created_id;
118 /**
119 * Date this token expires
120 *
121 * @var datetime
122 */
123 public $expiry_date;
124 /**
125 * Email at the time of token creation. Useful for fraud forensics
126 *
127 * @var string
128 */
129 public $email;
130 /**
131 * Billing first name at the time of token creation. Useful for fraud forensics
132 *
133 * @var string
134 */
135 public $billing_first_name;
136 /**
137 * Billing middle name at the time of token creation. Useful for fraud forensics
138 *
139 * @var string
140 */
141 public $billing_middle_name;
142 /**
143 * Billing last name at the time of token creation. Useful for fraud forensics
144 *
145 * @var string
146 */
147 public $billing_last_name;
148 /**
149 * Holds the part of the card number or account details that may be retained or displayed
150 *
151 * @var string
152 */
153 public $masked_account_number;
154 /**
155 * IP used when creating the token. Useful for fraud forensics
156 *
157 * @var string
158 */
159 public $ip_address;
160 /**
161 * class constructor
162 *
163 * @return civicrm_payment_token
164 */
165 function __construct() {
166 $this->__table = 'civicrm_payment_token';
167 parent::__construct();
168 }
169 /**
170 * Returns foreign keys and entity references
171 *
172 * @return array
173 * [CRM_Core_Reference_Interface]
174 */
175 static function getReferenceColumns() {
176 if (!self::$_links) {
177 self::$_links = static ::createReferenceColumns(__CLASS__);
178 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id');
179 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'payment_processor_id', 'civicrm_payment_processor', 'id');
180 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'created_id', 'civicrm_contact', 'id');
181 }
182 return self::$_links;
183 }
184 /**
185 * Returns all the column names of this table
186 *
187 * @return array
188 */
189 static function &fields() {
190 if (!(self::$_fields)) {
191 self::$_fields = array(
192 'payment_token_id' => array(
193 'name' => 'id',
194 'type' => CRM_Utils_Type::T_INT,
195 'title' => ts('Payment Token ID') ,
196 'description' => 'Payment Token ID',
197 'required' => true,
198 ) ,
199 'contact_id' => array(
200 'name' => 'contact_id',
201 'type' => CRM_Utils_Type::T_INT,
202 'title' => ts('Contact ID') ,
203 'description' => 'FK to Contact ID for the owner of the token',
204 'required' => true,
205 'FKClassName' => 'CRM_Contact_DAO_Contact',
206 ) ,
207 'payment_processor_id' => array(
208 'name' => 'payment_processor_id',
209 'type' => CRM_Utils_Type::T_INT,
210 'title' => ts('Payment Processor ID') ,
211 'required' => true,
212 'FKClassName' => 'CRM_Financial_DAO_PaymentProcessor',
213 ) ,
214 'token' => array(
215 'name' => 'token',
216 'type' => CRM_Utils_Type::T_STRING,
217 'title' => ts('Token') ,
218 'description' => 'Externally provided token string',
219 'required' => true,
220 'maxlength' => 255,
221 'size' => CRM_Utils_Type::HUGE,
222 ) ,
223 'created_date' => array(
224 'name' => 'created_date',
225 'type' => CRM_Utils_Type::T_TIMESTAMP,
226 'title' => ts('Created Date') ,
227 'description' => 'Date created',
228 'default' => 'CURRENT_TIMESTAMP',
229 ) ,
230 'created_id' => array(
231 'name' => 'created_id',
232 'type' => CRM_Utils_Type::T_INT,
233 'title' => ts('Created ID') ,
234 'description' => 'Contact ID of token creator',
235 'FKClassName' => 'CRM_Contact_DAO_Contact',
236 ) ,
237 'expiry_date' => array(
238 'name' => 'expiry_date',
239 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
240 'title' => ts('Expiry Date') ,
241 'description' => 'Date this token expires',
242 ) ,
243 'email' => array(
244 'name' => 'email',
245 'type' => CRM_Utils_Type::T_STRING,
246 'title' => ts('Email') ,
247 'description' => 'Email at the time of token creation. Useful for fraud forensics',
248 'maxlength' => 255,
249 'size' => CRM_Utils_Type::HUGE,
250 ) ,
251 'billing_first_name' => array(
252 'name' => 'billing_first_name',
253 'type' => CRM_Utils_Type::T_STRING,
254 'title' => ts('Billing First Name') ,
255 'description' => 'Billing first name at the time of token creation. Useful for fraud forensics',
256 'maxlength' => 255,
257 'size' => CRM_Utils_Type::HUGE,
258 ) ,
259 'billing_middle_name' => array(
260 'name' => 'billing_middle_name',
261 'type' => CRM_Utils_Type::T_STRING,
262 'title' => ts('Billing Middle Name') ,
263 'description' => 'Billing middle name at the time of token creation. Useful for fraud forensics',
264 'maxlength' => 255,
265 'size' => CRM_Utils_Type::HUGE,
266 ) ,
267 'billing_last_name' => array(
268 'name' => 'billing_last_name',
269 'type' => CRM_Utils_Type::T_STRING,
270 'title' => ts('Billing Last Name') ,
271 'description' => 'Billing last name at the time of token creation. Useful for fraud forensics',
272 'maxlength' => 255,
273 'size' => CRM_Utils_Type::HUGE,
274 ) ,
275 'masked_account_number' => array(
276 'name' => 'masked_account_number',
277 'type' => CRM_Utils_Type::T_STRING,
278 'title' => ts('Masked Account Number') ,
279 'description' => 'Holds the part of the card number or account details that may be retained or displayed',
280 'maxlength' => 255,
281 'size' => CRM_Utils_Type::HUGE,
282 ) ,
283 'ip_address' => array(
284 'name' => 'ip_address',
285 'type' => CRM_Utils_Type::T_STRING,
286 'title' => ts('IP Address') ,
287 'description' => 'IP used when creating the token. Useful for fraud forensics',
288 'maxlength' => 255,
289 'size' => CRM_Utils_Type::HUGE,
290 ) ,
291 );
292 }
293 return self::$_fields;
294 }
295 /**
296 * Returns an array containing, for each field, the arary key used for that
297 * field in self::$_fields.
298 *
299 * @return array
300 */
301 static function &fieldKeys() {
302 if (!(self::$_fieldKeys)) {
303 self::$_fieldKeys = array(
304 'id' => 'payment_token_id',
305 'contact_id' => 'contact_id',
306 'payment_processor_id' => 'payment_processor_id',
307 'token' => 'token',
308 'created_date' => 'created_date',
309 'created_id' => 'created_id',
310 'expiry_date' => 'expiry_date',
311 'email' => 'email',
312 'billing_first_name' => 'billing_first_name',
313 'billing_middle_name' => 'billing_middle_name',
314 'billing_last_name' => 'billing_last_name',
315 'masked_account_number' => 'masked_account_number',
316 'ip_address' => 'ip_address',
317 );
318 }
319 return self::$_fieldKeys;
320 }
321 /**
322 * Returns the names of this table
323 *
324 * @return string
325 */
326 static function getTableName() {
327 return self::$_tableName;
328 }
329 /**
330 * Returns if this table needs to be logged
331 *
332 * @return boolean
333 */
334 function getLog() {
335 return self::$_log;
336 }
337 /**
338 * Returns the list of fields that can be imported
339 *
340 * @param bool $prefix
341 *
342 * @return array
343 */
344 static function &import($prefix = false) {
345 if (!(self::$_import)) {
346 self::$_import = array();
347 $fields = self::fields();
348 foreach($fields as $name => $field) {
349 if (CRM_Utils_Array::value('import', $field)) {
350 if ($prefix) {
351 self::$_import['payment_token'] = & $fields[$name];
352 } else {
353 self::$_import[$name] = & $fields[$name];
354 }
355 }
356 }
357 }
358 return self::$_import;
359 }
360 /**
361 * Returns the list of fields that can be exported
362 *
363 * @param bool $prefix
364 *
365 * @return array
366 */
367 static function &export($prefix = false) {
368 if (!(self::$_export)) {
369 self::$_export = array();
370 $fields = self::fields();
371 foreach($fields as $name => $field) {
372 if (CRM_Utils_Array::value('export', $field)) {
373 if ($prefix) {
374 self::$_export['payment_token'] = & $fields[$name];
375 } else {
376 self::$_export[$name] = & $fields[$name];
377 }
378 }
379 }
380 }
381 return self::$_export;
382 }
383 }