CRM-19372 allow payment processors to define an array of accepted credit card types
[civicrm-core.git] / CRM / Financial / DAO / PaymentToken.php
CommitLineData
e501603b
TO
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
437fafcf 33 * (GenCodeChecksum:5eb52139a66fec2b47a6b3f461339599)
e501603b
TO
34 */
35require_once 'CRM/Core/DAO.php';
36require_once 'CRM/Utils/Type.php';
37class 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';
e501603b
TO
44 /**
45 * static value to see if we should log any modifications to
46 * this table in the civicrm_log table
47 *
48 * @var boolean
49 */
50 static $_log = false;
51 /**
52 * Payment Token ID
53 *
54 * @var int unsigned
55 */
56 public $id;
57 /**
58 * FK to Contact ID for the owner of the token
59 *
60 * @var int unsigned
61 */
62 public $contact_id;
63 /**
64 *
65 * @var int unsigned
66 */
67 public $payment_processor_id;
68 /**
69 * Externally provided token string
70 *
71 * @var string
72 */
73 public $token;
74 /**
75 * Date created
76 *
77 * @var timestamp
78 */
79 public $created_date;
80 /**
81 * Contact ID of token creator
82 *
83 * @var int unsigned
84 */
85 public $created_id;
86 /**
87 * Date this token expires
88 *
89 * @var datetime
90 */
91 public $expiry_date;
92 /**
93 * Email at the time of token creation. Useful for fraud forensics
94 *
95 * @var string
96 */
97 public $email;
98 /**
99 * Billing first name at the time of token creation. Useful for fraud forensics
100 *
101 * @var string
102 */
103 public $billing_first_name;
104 /**
105 * Billing middle name at the time of token creation. Useful for fraud forensics
106 *
107 * @var string
108 */
109 public $billing_middle_name;
110 /**
111 * Billing last name at the time of token creation. Useful for fraud forensics
112 *
113 * @var string
114 */
115 public $billing_last_name;
116 /**
117 * Holds the part of the card number or account details that may be retained or displayed
118 *
119 * @var string
120 */
121 public $masked_account_number;
122 /**
123 * IP used when creating the token. Useful for fraud forensics
124 *
125 * @var string
126 */
127 public $ip_address;
128 /**
129 * class constructor
130 *
131 * @return civicrm_payment_token
132 */
133 function __construct() {
134 $this->__table = 'civicrm_payment_token';
135 parent::__construct();
136 }
137 /**
138 * Returns foreign keys and entity references
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,
167 ) ,
168 'contact_id' => array(
169 'name' => 'contact_id',
170 'type' => CRM_Utils_Type::T_INT,
171 'title' => ts('Contact ID') ,
172 'description' => 'FK to Contact ID for the owner of the token',
173 'required' => true,
174 'FKClassName' => 'CRM_Contact_DAO_Contact',
175 ) ,
176 'payment_processor_id' => array(
177 'name' => 'payment_processor_id',
178 'type' => CRM_Utils_Type::T_INT,
179 'title' => ts('Payment Processor ID') ,
180 'required' => true,
181 'FKClassName' => 'CRM_Financial_DAO_PaymentProcessor',
182 ) ,
183 'token' => array(
184 'name' => 'token',
185 'type' => CRM_Utils_Type::T_STRING,
186 'title' => ts('Token') ,
187 'description' => 'Externally provided token string',
188 'required' => true,
189 'maxlength' => 255,
190 'size' => CRM_Utils_Type::HUGE,
191 ) ,
192 'created_date' => array(
193 'name' => 'created_date',
194 'type' => CRM_Utils_Type::T_TIMESTAMP,
195 'title' => ts('Created Date') ,
196 'description' => 'Date created',
197 'default' => 'CURRENT_TIMESTAMP',
198 ) ,
199 'created_id' => array(
200 'name' => 'created_id',
201 'type' => CRM_Utils_Type::T_INT,
202 'title' => ts('Created ID') ,
203 'description' => 'Contact ID of token creator',
204 'FKClassName' => 'CRM_Contact_DAO_Contact',
205 ) ,
206 'expiry_date' => array(
207 'name' => 'expiry_date',
208 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
209 'title' => ts('Expiry Date') ,
210 'description' => 'Date this token expires',
211 ) ,
212 'email' => array(
213 'name' => 'email',
214 'type' => CRM_Utils_Type::T_STRING,
215 'title' => ts('Email') ,
216 'description' => 'Email at the time of token creation. Useful for fraud forensics',
217 'maxlength' => 255,
218 'size' => CRM_Utils_Type::HUGE,
219 ) ,
220 'billing_first_name' => array(
221 'name' => 'billing_first_name',
222 'type' => CRM_Utils_Type::T_STRING,
223 'title' => ts('Billing First Name') ,
224 'description' => 'Billing first name at the time of token creation. Useful for fraud forensics',
225 'maxlength' => 255,
226 'size' => CRM_Utils_Type::HUGE,
227 ) ,
228 'billing_middle_name' => array(
229 'name' => 'billing_middle_name',
230 'type' => CRM_Utils_Type::T_STRING,
231 'title' => ts('Billing Middle Name') ,
232 'description' => 'Billing middle name at the time of token creation. Useful for fraud forensics',
233 'maxlength' => 255,
234 'size' => CRM_Utils_Type::HUGE,
235 ) ,
236 'billing_last_name' => array(
237 'name' => 'billing_last_name',
238 'type' => CRM_Utils_Type::T_STRING,
239 'title' => ts('Billing Last Name') ,
240 'description' => 'Billing last name at the time of token creation. Useful for fraud forensics',
241 'maxlength' => 255,
242 'size' => CRM_Utils_Type::HUGE,
243 ) ,
244 'masked_account_number' => array(
245 'name' => 'masked_account_number',
246 'type' => CRM_Utils_Type::T_STRING,
247 'title' => ts('Masked Account Number') ,
248 'description' => 'Holds the part of the card number or account details that may be retained or displayed',
249 'maxlength' => 255,
250 'size' => CRM_Utils_Type::HUGE,
251 ) ,
252 'ip_address' => array(
253 'name' => 'ip_address',
254 'type' => CRM_Utils_Type::T_STRING,
255 'title' => ts('IP Address') ,
256 'description' => 'IP used when creating the token. Useful for fraud forensics',
257 'maxlength' => 255,
258 'size' => CRM_Utils_Type::HUGE,
259 ) ,
260 );
346aaaba 261 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 262 }
346aaaba 263 return Civi::$statics[__CLASS__]['fields'];
e501603b
TO
264 }
265 /**
bd8e0b14 266 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
267 *
268 * @return array
bd8e0b14 269 * Array(string $name => string $uniqueName).
e501603b
TO
270 */
271 static function &fieldKeys() {
bd8e0b14
TO
272 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
273 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 274 }
bd8e0b14 275 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b
TO
276 }
277 /**
278 * Returns the names of this table
279 *
280 * @return string
281 */
282 static function getTableName() {
283 return self::$_tableName;
284 }
285 /**
286 * Returns if this table needs to be logged
287 *
288 * @return boolean
289 */
290 function getLog() {
291 return self::$_log;
292 }
293 /**
294 * Returns the list of fields that can be imported
295 *
296 * @param bool $prefix
297 *
298 * @return array
299 */
300 static function &import($prefix = false) {
60808919
TO
301 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'payment_token', $prefix, array());
302 return $r;
e501603b
TO
303 }
304 /**
305 * Returns the list of fields that can be exported
306 *
307 * @param bool $prefix
308 *
309 * @return array
310 */
311 static function &export($prefix = false) {
60808919
TO
312 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'payment_token', $prefix, array());
313 return $r;
e501603b
TO
314 }
315}