Version Notes
V 1.0
Download this release
Release Info
Developer | Magento Core Team |
Extension | BluePay_CreditCardz |
Version | 1.05 |
Comparing to | |
See all releases |
Version 1.05
- app/code/local/Bluepay/CreditCard/Helper/Data.php +31 -0
- app/code/local/Bluepay/CreditCard/Model/CCPayment.php +437 -0
- app/code/local/Bluepay/CreditCard/Model/CCPayment/Debug.php +35 -0
- app/code/local/Bluepay/CreditCard/Model/CCPayment/Request.php +32 -0
- app/code/local/Bluepay/CreditCard/Model/CCPayment/Result.php +32 -0
- app/code/local/Bluepay/CreditCard/Model/CCPayment/Source/Cctype.php +34 -0
- app/code/local/Bluepay/CreditCard/Model/CCPayment/Source/PaymentAction.php +43 -0
- app/code/local/Bluepay/CreditCard/Model/Config.php +71 -0
- app/code/local/Bluepay/CreditCard/Model/Mysql4/CCPayment/Debug.php +35 -0
- app/code/local/Bluepay/CreditCard/Model/Mysql4/CCPayment/Debug/Collection.php +35 -0
- app/code/local/Bluepay/CreditCard/etc/config.xml +97 -0
- app/code/local/Bluepay/CreditCard/etc/system.xml +178 -0
- app/code/local/Bluepay/CreditCard/sql/creditcard_setup/mysql4-install-0.7.0.php +49 -0
- package.xml +18 -0
app/code/local/Bluepay/CreditCard/Helper/Data.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
* @category Bluepay
|
23 |
+
* @package Bluepay_CreditCard
|
24 |
+
* @copyright Copyright (c) 2010 BluePay Processing, LLC (http://www.bluepay.com)
|
25 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
+
*/
|
27 |
+
|
28 |
+
class BluePay_CreditCard_Helper_Data extends Mage_Core_Helper_Abstract
|
29 |
+
{
|
30 |
+
|
31 |
+
}
|
app/code/local/Bluepay/CreditCard/Model/CCPayment.php
ADDED
@@ -0,0 +1,437 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
* @category Bluepay
|
23 |
+
* @package Bluepay_CreditCard
|
24 |
+
* @copyright Copyright (c) 2010 BluePay Processing, LLC (http://www.bluepay.com)
|
25 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
+
*/
|
27 |
+
|
28 |
+
|
29 |
+
class BluePay_CreditCard_Model_CCPayment extends Mage_Payment_Model_Method_Cc
|
30 |
+
{
|
31 |
+
const CGI_URL = 'https://secure.bluepay.com/interfaces/bp10emu';
|
32 |
+
|
33 |
+
const REQUEST_METHOD_CC = 'CREDIT';
|
34 |
+
const REQUEST_METHOD_ECHECK = 'ACH';
|
35 |
+
|
36 |
+
const REQUEST_TYPE_AUTH_CAPTURE = 'SALE';
|
37 |
+
const REQUEST_TYPE_AUTH_ONLY = 'AUTH';
|
38 |
+
const REQUEST_TYPE_CAPTURE_ONLY = 'CAPTURE';
|
39 |
+
const REQUEST_TYPE_CREDIT = 'REFUND';
|
40 |
+
const REQUEST_TYPE_VOID = 'VOID';
|
41 |
+
const REQUEST_TYPE_PRIOR_AUTH_CAPTURE = 'PRIOR_AUTH_CAPTURE';
|
42 |
+
|
43 |
+
const ECHECK_ACCT_TYPE_CHECKING = 'CHECKING';
|
44 |
+
const ECHECK_ACCT_TYPE_BUSINESS = 'BUSINESSCHECKING';
|
45 |
+
const ECHECK_ACCT_TYPE_SAVINGS = 'SAVINGS';
|
46 |
+
|
47 |
+
const ECHECK_TRANS_TYPE_CCD = 'CCD';
|
48 |
+
const ECHECK_TRANS_TYPE_PPD = 'PPD';
|
49 |
+
const ECHECK_TRANS_TYPE_TEL = 'TEL';
|
50 |
+
const ECHECK_TRANS_TYPE_WEB = 'WEB';
|
51 |
+
|
52 |
+
const RESPONSE_DELIM_CHAR = ',';
|
53 |
+
|
54 |
+
const RESPONSE_CODE_APPROVED = 'APPROVED';
|
55 |
+
const RESPONSE_CODE_DECLINED = 'DECLINED';
|
56 |
+
const RESPONSE_CODE_ERROR = 'ERROR';
|
57 |
+
const RESPONSE_CODE_HELD = 4;
|
58 |
+
|
59 |
+
const INVOICE_ID = 0;
|
60 |
+
const BANK_NAME = 1;
|
61 |
+
const PAYMENT_ACCOUNT = 2;
|
62 |
+
const AUTH_CODE = 3;
|
63 |
+
const CARD_TYPE = 4;
|
64 |
+
const AMOUNT = 5;
|
65 |
+
const REBID = 6;
|
66 |
+
const AVS = 7;
|
67 |
+
const ORDER_ID = 8;
|
68 |
+
const CARD_EXPIRE = 9;
|
69 |
+
const Result = 10;
|
70 |
+
const RRNO = 11;
|
71 |
+
const CVV2 = 12;
|
72 |
+
const PAYMENT_TYPE = 13;
|
73 |
+
const MESSAGE = 14;
|
74 |
+
|
75 |
+
protected $responseHeaders;
|
76 |
+
|
77 |
+
protected $tempVar;
|
78 |
+
|
79 |
+
protected $_code = 'ccpayment';
|
80 |
+
|
81 |
+
protected static $_underscoreCache = array();
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Availability options
|
85 |
+
*/
|
86 |
+
protected $_isGateway = true;
|
87 |
+
protected $_canAuthorize = true;
|
88 |
+
protected $_canCapture = true;
|
89 |
+
protected $_canCapturePartial = true;
|
90 |
+
protected $_canRefund = true;
|
91 |
+
protected $_canVoid = true;
|
92 |
+
protected $_canUseInternal = true;
|
93 |
+
protected $_canUseCheckout = true;
|
94 |
+
protected $_canUseForMultishipping = true;
|
95 |
+
protected $_canSaveCc = false;
|
96 |
+
|
97 |
+
protected $_allowCurrencyCode = array('USD');
|
98 |
+
|
99 |
+
/**
|
100 |
+
* Fields that should be replaced in debug with '***'
|
101 |
+
*
|
102 |
+
* @var array
|
103 |
+
*/
|
104 |
+
protected $_debugReplacePrivateDataKeys = array('x_login', 'x_tran_key',
|
105 |
+
'x_card_num', 'x_exp_date',
|
106 |
+
'x_card_code', 'x_bank_aba_code',
|
107 |
+
'x_bank_name', 'x_bank_acct_num',
|
108 |
+
'x_bank_acct_type','x_bank_acct_name',
|
109 |
+
'x_echeck_type');
|
110 |
+
|
111 |
+
/**
|
112 |
+
* Check method for processing with base currency
|
113 |
+
*
|
114 |
+
* @param string $currencyCode
|
115 |
+
* @return boolean
|
116 |
+
*/
|
117 |
+
public function canUseForCurrency($currencyCode)
|
118 |
+
{
|
119 |
+
if (!in_array($currencyCode, $this->getAcceptedCurrencyCodes())) {
|
120 |
+
return false;
|
121 |
+
}
|
122 |
+
return true;
|
123 |
+
}
|
124 |
+
|
125 |
+
/**
|
126 |
+
* Return array of currency codes supplied by Payment Gateway
|
127 |
+
*
|
128 |
+
* @return array
|
129 |
+
*/
|
130 |
+
public function getAcceptedCurrencyCodes()
|
131 |
+
{
|
132 |
+
if (!$this->hasData('_accepted_currency')) {
|
133 |
+
$acceptedCurrencyCodes = $this->_allowCurrencyCode;
|
134 |
+
$acceptedCurrencyCodes[] = $this->getConfigData('currency');
|
135 |
+
$this->setData('_accepted_currency', $acceptedCurrencyCodes);
|
136 |
+
}
|
137 |
+
return $this->_getData('_accepted_currency');
|
138 |
+
}
|
139 |
+
|
140 |
+
/**
|
141 |
+
* Send authorize request to gateway
|
142 |
+
*/
|
143 |
+
|
144 |
+
public function authorize(Varien_Object $payment, $amount)
|
145 |
+
{
|
146 |
+
if ($amount <= 0) {
|
147 |
+
Mage::throwException(Mage::helper('paygate')->__('Invalid amount for authorization.'));
|
148 |
+
}
|
149 |
+
$payment->setTransactionType(self::REQUEST_TYPE_AUTH_ONLY);
|
150 |
+
$payment->setAmount($amount);
|
151 |
+
|
152 |
+
$request= $this->_buildRequest($payment);
|
153 |
+
$result = $this->_postRequest($request);
|
154 |
+
|
155 |
+
$payment->setCcApproval($result->getAuthCode())
|
156 |
+
->setLastTransId($result->getRrno())
|
157 |
+
->setTransactionId($result->getRrno())
|
158 |
+
->setIsTransactionClosed(0)
|
159 |
+
->setCcTransId($result->getRrno())
|
160 |
+
->setCcAvsStatus($result->getAvs())
|
161 |
+
->setCcCidStatus($result->getCvv2());
|
162 |
+
|
163 |
+
switch ($result->getResult()) {
|
164 |
+
case self::RESPONSE_CODE_APPROVED:
|
165 |
+
$payment->setStatus(self::STATUS_APPROVED);
|
166 |
+
return $this;
|
167 |
+
case self::RESPONSE_CODE_DECLINED:
|
168 |
+
Mage::throwException(Mage::helper('paygate')->__('The transaction has been declined'));
|
169 |
+
case self::RESPONSE_CODE_ERROR:
|
170 |
+
Mage::throwException(Mage::helper('paygate')->__('Error: ' . $result->getMessage()));
|
171 |
+
default:
|
172 |
+
Mage::throwException(Mage::helper('paygate')->__('Error!'));
|
173 |
+
}
|
174 |
+
}
|
175 |
+
|
176 |
+
/**
|
177 |
+
* Send capture request to gateway
|
178 |
+
*/
|
179 |
+
public function capture(Varien_Object $payment, $amount)
|
180 |
+
{
|
181 |
+
if ($payment->getCcTransId()) {
|
182 |
+
$payment->setTransactionType(self::REQUEST_TYPE_CAPTURE_ONLY);
|
183 |
+
} else {
|
184 |
+
$payment->setTransactionType(self::REQUEST_TYPE_AUTH_CAPTURE);
|
185 |
+
}
|
186 |
+
|
187 |
+
$payment->setAmount($amount);
|
188 |
+
$payment->setRrno($payment->getCcTransId());
|
189 |
+
$request= $this->_buildRequest($payment);
|
190 |
+
$result = $this->_postRequest($request);
|
191 |
+
if ($result->getResult() == self::RESPONSE_CODE_APPROVED) {
|
192 |
+
$payment->setStatus(self::STATUS_APPROVED);
|
193 |
+
//$payment->setCcTransId($result->getTransactionId());
|
194 |
+
$payment->setLastTransId($result->getRrno());
|
195 |
+
if (!$payment->getParentTransactionId() || $result->getRrno() != $payment->getParentTransactionId()) {
|
196 |
+
$payment->setTransactionId($result->getRrno());
|
197 |
+
}
|
198 |
+
return $this;
|
199 |
+
}
|
200 |
+
if ($result->getMessage()) {
|
201 |
+
Mage::throwException($this->_wrapGatewayError($result->getMessage()));
|
202 |
+
}
|
203 |
+
Mage::throwException(Mage::helper('paygate')->__('Error in capturing the payment.'));
|
204 |
+
}
|
205 |
+
|
206 |
+
|
207 |
+
/**
|
208 |
+
* Void the payment through gateway
|
209 |
+
*/
|
210 |
+
public function void(Varien_Object $payment)
|
211 |
+
{
|
212 |
+
if ($payment->getParentTransactionId()) {
|
213 |
+
$order = $payment->getOrder();
|
214 |
+
$payment->setTransactionType(self::REQUEST_TYPE_CREDIT);
|
215 |
+
$payment->setAmount($amount);
|
216 |
+
$payment->setRrno($payment->getParentTransactionId());
|
217 |
+
$request = $this->_buildRequest($payment);
|
218 |
+
$result = $this->_postRequest($request);
|
219 |
+
if ($result->getResult()==self::RESPONSE_CODE_APPROVED) {
|
220 |
+
$payment->setStatus(self::STATUS_APPROVED);
|
221 |
+
$order->setState(Mage_Sales_Model_Order::STATE_CANCELED, true)->save();
|
222 |
+
return $this;
|
223 |
+
}
|
224 |
+
$payment->setStatus(self::STATUS_ERROR);
|
225 |
+
Mage::throwException($this->_wrapGatewayError($result->getMessage()));
|
226 |
+
}
|
227 |
+
$payment->setStatus(self::STATUS_ERROR);
|
228 |
+
Mage::throwException(Mage::helper('paygate')->__('Invalid transaction ID.'));
|
229 |
+
}
|
230 |
+
|
231 |
+
/**
|
232 |
+
* refund the amount with transaction id
|
233 |
+
*/
|
234 |
+
public function refund(Varien_Object $payment, $amount)
|
235 |
+
{
|
236 |
+
if ($payment->getRefundTransactionId() && $amount > 0) {
|
237 |
+
$payment->setTransactionType(self::REQUEST_TYPE_CREDIT);
|
238 |
+
$payment->setRrno($payment->getRefundTransactionId());
|
239 |
+
$payment->setAmount($amount);
|
240 |
+
$request = $this->_buildRequest($payment);
|
241 |
+
$request->setRrno($payment->getRefundTransactionId());
|
242 |
+
$result = $this->_postRequest($request);
|
243 |
+
if ($result->getResult()==self::RESPONSE_CODE_APPROVED) {
|
244 |
+
$payment->setStatus(self::STATUS_SUCCESS);
|
245 |
+
return $this;
|
246 |
+
}
|
247 |
+
if ($result->getResult()==self::RESPONSE_CODE_DECLINED) {
|
248 |
+
Mage::throwException($this->_wrapGatewayError('DECLINED'));
|
249 |
+
}
|
250 |
+
if ($result->getResult()==self::RESPONSE_CODE_ERROR) {
|
251 |
+
Mage::throwException($this->_wrapGatewayError('ERROR'));
|
252 |
+
}
|
253 |
+
Mage::throwException($this->_wrapGatewayError($result->getRrno()));
|
254 |
+
}
|
255 |
+
Mage::throwException(Mage::helper('paygate')->__('Error in refunding the payment.'));
|
256 |
+
}
|
257 |
+
|
258 |
+
/**
|
259 |
+
* Prepare request to gateway
|
260 |
+
*/
|
261 |
+
protected function _buildRequest(Varien_Object $payment)
|
262 |
+
{
|
263 |
+
$order = $payment->getOrder();
|
264 |
+
|
265 |
+
$this->setStore($order->getStoreId());
|
266 |
+
|
267 |
+
if (!$payment->getPaymentType()) {
|
268 |
+
$payment->setPaymentType(self::REQUEST_METHOD_CC);
|
269 |
+
}
|
270 |
+
|
271 |
+
$request = Mage::getModel('creditcard/ccpayment_request');
|
272 |
+
if ($order && $order->getIncrementId()) {
|
273 |
+
$request->setInvoiceID($order->getIncrementId());
|
274 |
+
}
|
275 |
+
$request->setMode($this->getConfigData('test_mode') ? 'TEST' : 'LIVE');
|
276 |
+
$request->setMerchant($this->getConfigData('login'))
|
277 |
+
->setTransactionType($payment->getTransactionType())
|
278 |
+
->setPaymentType($payment->getPaymentType())
|
279 |
+
->setTamperProofSeal($this->calcTPS($payment));
|
280 |
+
if($payment->getAmount()){
|
281 |
+
$request->setAmount($payment->getAmount(),2);
|
282 |
+
}
|
283 |
+
switch ($payment->getTransactionType()) {
|
284 |
+
case self::REQUEST_TYPE_CREDIT:
|
285 |
+
case self::REQUEST_TYPE_VOID:
|
286 |
+
case self::REQUEST_TYPE_CAPTURE_ONLY:
|
287 |
+
$request->setRrno($payment->getCcTransId());
|
288 |
+
break;
|
289 |
+
}
|
290 |
+
$cart = Mage::helper('checkout/cart')->getCart()->getItemsCount();
|
291 |
+
$cartSummary = Mage::helper('checkout/cart')->getCart()->getSummaryQty();
|
292 |
+
Mage::getSingleton('core/session', array('name'=>'frontend'));
|
293 |
+
$session = Mage::getSingleton('checkout/session');
|
294 |
+
|
295 |
+
$comment = "";
|
296 |
+
|
297 |
+
foreach ($session->getQuote()->getAllItems() as $item) {
|
298 |
+
|
299 |
+
$comment .= $item->getQty() . ' ';
|
300 |
+
$comment .= '[' . $item->getSku() . ']' . ' ';
|
301 |
+
$comment .= $item->getName() . ' ';
|
302 |
+
$comment .= $item->getDescription() . ' ';
|
303 |
+
$comment .= $item->getBaseCalculationPrice . ' ';
|
304 |
+
}
|
305 |
+
|
306 |
+
|
307 |
+
if (!empty($order)) {
|
308 |
+
$billing = $order->getBillingAddress();
|
309 |
+
if (!empty($billing)) {
|
310 |
+
$request->setName1($billing->getFirstname())
|
311 |
+
->setName2($billing->getLastname())
|
312 |
+
->setCompany($billing->getCompany())
|
313 |
+
->setAddress1($billing->getStreet(1))
|
314 |
+
->setCity($billing->getCity())
|
315 |
+
->setState($billing->getRegion())
|
316 |
+
->setZip($billing->getPostcode())
|
317 |
+
->setCountry($billing->getCountry())
|
318 |
+
->setPhone($billing->getTelephone())
|
319 |
+
->setFax($billing->getFax())
|
320 |
+
->setCustomID($billing->getCustomerId())
|
321 |
+
->setComment($comment)
|
322 |
+
->setEmail($order->getCustomerEmail());
|
323 |
+
}
|
324 |
+
|
325 |
+
$shipping = $order->getShippingAddress();
|
326 |
+
if (!empty($shipping)) {
|
327 |
+
$request->setXShipToFirstName($shipping->getFirstname())
|
328 |
+
->setXShipToLastName($shipping->getLastname())
|
329 |
+
->setXShipToCompany($shipping->getCompany())
|
330 |
+
->setXShipToAddress($shipping->getStreet(1))
|
331 |
+
->setXShipToCity($shipping->getCity())
|
332 |
+
->setXShipToState($shipping->getRegion())
|
333 |
+
->setXShipToZip($shipping->getPostcode())
|
334 |
+
->setXShipToCountry($shipping->getCountry());
|
335 |
+
}
|
336 |
+
}
|
337 |
+
|
338 |
+
switch ($payment->getPaymentType()) {
|
339 |
+
case self::REQUEST_METHOD_CC:
|
340 |
+
if($payment->getCcNumber()){
|
341 |
+
$temp = $payment->getCcExpYear();
|
342 |
+
$CcExpYear = str_split($temp, 2);
|
343 |
+
$request->setCcNum($payment->getCcNumber())
|
344 |
+
->setCcExpires(sprintf('%02d%02d', $payment->getCcExpMonth(), $CcExpYear[1]))
|
345 |
+
->setCvcvv2($payment->getCcCid());
|
346 |
+
}
|
347 |
+
break;
|
348 |
+
|
349 |
+
case self::REQUEST_METHOD_ECHECK:
|
350 |
+
$request->setAchRouting($payment->getEcheckRoutingNumber())
|
351 |
+
->setAchAccount($payment->getEcheckAccountNumber())
|
352 |
+
->setAchAccountType($payment->getEcheckAccountType())
|
353 |
+
->setName($payment->getEcheckAccountName())
|
354 |
+
->setDocType($payment->getEcheckType());
|
355 |
+
break;
|
356 |
+
}
|
357 |
+
return $request;
|
358 |
+
}
|
359 |
+
|
360 |
+
protected function _postRequest(Varien_Object $request)
|
361 |
+
{
|
362 |
+
$debugData = array('request' => $request->getData());
|
363 |
+
|
364 |
+
$result = Mage::getModel('creditcard/ccpayment_result');
|
365 |
+
|
366 |
+
$client = new Varien_Http_Client();
|
367 |
+
|
368 |
+
$uri = $this->getConfigData('cgi_url');
|
369 |
+
$client->setUri($uri ? $uri : self::CGI_URL);
|
370 |
+
$client->setConfig(array(
|
371 |
+
'maxredirects'=>0,
|
372 |
+
'timeout'=>30,
|
373 |
+
));
|
374 |
+
$client->setParameterPost($request->getData());
|
375 |
+
$client->setMethod(Zend_Http_Client::POST);
|
376 |
+
|
377 |
+
try {
|
378 |
+
$response = $client->request();
|
379 |
+
}
|
380 |
+
catch (Exception $e) {
|
381 |
+
|
382 |
+
$debugData['result'] = $result->getData();
|
383 |
+
$this->_debug($debugData);
|
384 |
+
Mage::throwException($this->_wrapGatewayError($e->getMessage()));
|
385 |
+
}
|
386 |
+
$r = $response->getHeader('location');
|
387 |
+
if ($r) {
|
388 |
+
$result->setResult($this->parseHeader($r, 'value', self::Result))
|
389 |
+
->setInvoiceID($this->parseHeader($r, 'value', self::INVOICE_ID))
|
390 |
+
->setMessage($this->parseHeader($r, 'value', self::MESSAGE))
|
391 |
+
->setAuthCode($this->parseHeader($r, 'value', self::AUTH_CODE))
|
392 |
+
->setAvs($this->parseHeader($r, 'value', self::AVS))
|
393 |
+
->setRrno($this->parseHeader($r, 'value', self::RRNO))
|
394 |
+
->setAmount($this->parseHeader($r, 'value', self::AMOUNT))
|
395 |
+
->setPaymentType($this->parseHeader($r, 'value', self::PAYMENT_TYPE))
|
396 |
+
->setOrderId($this->parseHeader($r, 'value', self::ORDER_ID))
|
397 |
+
->setCvv2($this->parseHeader($r, 'value', self::CVV2));
|
398 |
+
}
|
399 |
+
else {
|
400 |
+
Mage::throwException(
|
401 |
+
Mage::helper('paygate')->__('Error in payment gateway.')
|
402 |
+
);
|
403 |
+
}
|
404 |
+
|
405 |
+
$debugData['result'] = $result->getData();
|
406 |
+
$this->_debug($debugData);
|
407 |
+
return $result;
|
408 |
+
}
|
409 |
+
|
410 |
+
/**
|
411 |
+
* Gateway response wrapper
|
412 |
+
*/
|
413 |
+
protected function _wrapGatewayError($text)
|
414 |
+
{
|
415 |
+
return Mage::helper('paygate')->__('Gateway error: %s', $text);
|
416 |
+
}
|
417 |
+
|
418 |
+
protected final function calcTPS(Varien_Object $payment) {
|
419 |
+
|
420 |
+
$order = $payment->getOrder();
|
421 |
+
$billing = $order->getBillingAddress();
|
422 |
+
|
423 |
+
$hashstr = $this->getConfigData('trans_key') . $this->getConfigData('login') .
|
424 |
+
$payment->getTransactionType() . $payment->getAmount() . $payment->getRrno() .
|
425 |
+
$this->getConfigData('test_mode');
|
426 |
+
return bin2hex( md5($hashstr, true) );
|
427 |
+
}
|
428 |
+
|
429 |
+
protected function parseHeader($header, $nameVal, $pos) {
|
430 |
+
$nameVal = ($nameVal == 'name') ? '0' : '1';
|
431 |
+
$s = explode("?", $header);
|
432 |
+
$t = explode("&", $s[1]);
|
433 |
+
$value = explode("=", $t[$pos]);
|
434 |
+
return $value[$nameVal];
|
435 |
+
}
|
436 |
+
|
437 |
+
}
|
app/code/local/Bluepay/CreditCard/Model/CCPayment/Debug.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
* @category Bluepay
|
23 |
+
* @package Bluepay_CreditCard
|
24 |
+
* @copyright Copyright (c) 2010 BluePay Processing, LLC (http://www.bluepay.com)
|
25 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
+
*/
|
27 |
+
|
28 |
+
|
29 |
+
class BluePay_CreditCard_Model_CCPayment_Debug extends Mage_Core_Model_Abstract
|
30 |
+
{
|
31 |
+
protected function _construct()
|
32 |
+
{
|
33 |
+
$this->_init(creditcard/ccpayment_debug');
|
34 |
+
}
|
35 |
+
}
|
app/code/local/Bluepay/CreditCard/Model/CCPayment/Request.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
* @category Bluepay
|
23 |
+
* @package Bluepay_CreditCard
|
24 |
+
* @copyright Copyright (c) 2010 BluePay Processing, LLC (http://www.bluepay.com)
|
25 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
+
*/
|
27 |
+
|
28 |
+
|
29 |
+
class BluePay_CreditCard_Model_CCPayment_Request extends Varien_Object
|
30 |
+
{
|
31 |
+
|
32 |
+
}
|
app/code/local/Bluepay/CreditCard/Model/CCPayment/Result.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
* @category Bluepay
|
23 |
+
* @package Bluepay_CreditCard
|
24 |
+
* @copyright Copyright (c) 2010 BluePay Processing, LLC (http://www.bluepay.com)
|
25 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
+
*/
|
27 |
+
|
28 |
+
|
29 |
+
class BluePay_CreditCard_Model_CCPayment_Result extends Varien_Object
|
30 |
+
{
|
31 |
+
|
32 |
+
}
|
app/code/local/Bluepay/CreditCard/Model/CCPayment/Source/Cctype.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
* @category Bluepay
|
23 |
+
* @package Bluepay_CreditCard
|
24 |
+
* @copyright Copyright (c) 2010 BluePay Processing, LLC (http://www.bluepay.com)
|
25 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
+
*/
|
27 |
+
|
28 |
+
class BluePay_CreditCard_Model_CCPayment_Source_Cctype extends Mage_Payment_Model_Source_Cctype
|
29 |
+
{
|
30 |
+
public function getAllowedTypes()
|
31 |
+
{
|
32 |
+
return array('VI', 'MC', 'AE', 'DI', 'OT');
|
33 |
+
}
|
34 |
+
}
|
app/code/local/Bluepay/CreditCard/Model/CCPayment/Source/PaymentAction.php
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
* @category Bluepay
|
23 |
+
* @package Bluepay_CreditCard
|
24 |
+
* @copyright Copyright (c) 2010 BluePay Processing, LLC (http://www.bluepay.com)
|
25 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
+
*/
|
27 |
+
|
28 |
+
class BluePay_CreditCard_Model_CCPayment_Source_PaymentAction
|
29 |
+
{
|
30 |
+
public function toOptionArray()
|
31 |
+
{
|
32 |
+
return array(
|
33 |
+
array(
|
34 |
+
'value' => Bluepay_CreditCard_Model_CCPayment::ACTION_AUTHORIZE,
|
35 |
+
'label' => 'AUTH'
|
36 |
+
),
|
37 |
+
array(
|
38 |
+
'value' => Bluepay_CreditCard_Model_CCPayment::ACTION_AUTHORIZE_CAPTURE,
|
39 |
+
'label' => 'SALE'
|
40 |
+
),
|
41 |
+
);
|
42 |
+
}
|
43 |
+
}
|
app/code/local/Bluepay/CreditCard/Model/Config.php
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
* @category Bluepay
|
23 |
+
* @package Bluepay_CreditCard
|
24 |
+
* @copyright Copyright (c) 2010 BluePay Processing, LLC (http://www.bluepay.com)
|
25 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
+
*/
|
27 |
+
|
28 |
+
class BluePay_CreditCard_Model_Config
|
29 |
+
{
|
30 |
+
protected static $_methods;
|
31 |
+
|
32 |
+
public function getActiveMethods($store=null)
|
33 |
+
{
|
34 |
+
$methods = array();
|
35 |
+
$config = Mage::getStoreConfig('creditcard', $store);
|
36 |
+
foreach ($config as $code => $methodConfig) {
|
37 |
+
if (Mage::getStoreConfigFlag('creditcard/'.$code.'/active', $store)) {
|
38 |
+
$methods[$code] = $this->_getMethod($code, $methodConfig);
|
39 |
+
}
|
40 |
+
}
|
41 |
+
return $methods;
|
42 |
+
}
|
43 |
+
|
44 |
+
public function getAllMethods($store=null)
|
45 |
+
{
|
46 |
+
$methods = array();
|
47 |
+
$config = Mage::getStoreConfig('payment', $store);
|
48 |
+
foreach ($config as $code => $methodConfig) {
|
49 |
+
$methods[$code] = $this->_getMethod($code, $methodConfig);
|
50 |
+
}
|
51 |
+
return $methods;
|
52 |
+
}
|
53 |
+
|
54 |
+
protected function _getMethod($code, $config, $store=null)
|
55 |
+
{
|
56 |
+
if (isset(self::$_methods[$code])) {
|
57 |
+
return self::$_methods[$code];
|
58 |
+
}
|
59 |
+
$modelName = $config['model'];
|
60 |
+
$method = Mage::getModel($modelName);
|
61 |
+
$method->setId($code)->setStore($store);
|
62 |
+
self::$_methods[$code] = $method;
|
63 |
+
return self::$_methods[$code];
|
64 |
+
}
|
65 |
+
|
66 |
+
public function getAccountTypes()
|
67 |
+
{
|
68 |
+
$types = array('CHECKING' => 'Checking', 'BUSINESSCHECKING' => 'Business checking', 'SAVINGS' => 'Savings');
|
69 |
+
return $types;
|
70 |
+
}
|
71 |
+
}
|
app/code/local/Bluepay/CreditCard/Model/Mysql4/CCPayment/Debug.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
* @category Bluepay
|
23 |
+
* @package Bluepay_CreditCard
|
24 |
+
* @copyright Copyright (c) 2010 BluePay Processing, LLC (http://www.bluepay.com)
|
25 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
+
*/
|
27 |
+
|
28 |
+
|
29 |
+
class BluePay_CreditCard_Model_Mysql4_CCPayment_Debug extends Mage_Core_Model_Mysql4_Abstract
|
30 |
+
{
|
31 |
+
protected function _construct()
|
32 |
+
{
|
33 |
+
$this->_init('creditcard/ccpayment_debug', 'debug_id');
|
34 |
+
}
|
35 |
+
}
|
app/code/local/Bluepay/CreditCard/Model/Mysql4/CCPayment/Debug/Collection.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
* @category Bluepay
|
23 |
+
* @package Bluepay_CreditCard
|
24 |
+
* @copyright Copyright (c) 2010 BluePay Processing, LLC (http://www.bluepay.com)
|
25 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
+
*/
|
27 |
+
|
28 |
+
|
29 |
+
class BluePay_CreditCard_Model_Mysql4_CCPayment_Debug_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
30 |
+
{
|
31 |
+
protected function _construct()
|
32 |
+
{
|
33 |
+
$this->_init('creditcard/ccpayment_debug');
|
34 |
+
}
|
35 |
+
}
|
app/code/local/Bluepay/CreditCard/etc/config.xml
ADDED
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<BluePay_CreditCard>
|
5 |
+
<version>0.1.0</version>
|
6 |
+
</BluePay_CreditCard>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
<blocks>
|
10 |
+
<creditcard>
|
11 |
+
<class>BluePay_CreditCard_Block</class>
|
12 |
+
</creditcard>
|
13 |
+
</blocks>
|
14 |
+
<helpers>
|
15 |
+
<creditcard>
|
16 |
+
<class>BluePay_CreditCard_Helper</class>
|
17 |
+
</creditcard>
|
18 |
+
</helpers>
|
19 |
+
<models>
|
20 |
+
<creditcard>
|
21 |
+
<class>BluePay_CreditCard_Model</class>
|
22 |
+
<resourceModel>creditcard_mysql4</resourceModel>
|
23 |
+
</creditcard>
|
24 |
+
<creditcard_mysql4>
|
25 |
+
<class>BluePay_CreditCard_Model_Mysql4</class>
|
26 |
+
<entities>
|
27 |
+
<ccpayment_debug><table>creditcard_ccpayment_debug</table></ccpayment_debug>
|
28 |
+
</entities>
|
29 |
+
</creditcard_mysql4>
|
30 |
+
</models>
|
31 |
+
<resources>
|
32 |
+
<creditcard_setup>
|
33 |
+
<setup>
|
34 |
+
<module>BluePay_CreditCard</module>
|
35 |
+
</setup>
|
36 |
+
<connection>
|
37 |
+
<use>core_setup</use>
|
38 |
+
</connection>
|
39 |
+
</creditcard_setup>
|
40 |
+
<creditcard_write>
|
41 |
+
<connection>
|
42 |
+
<use>core_write</use>
|
43 |
+
</connection>
|
44 |
+
</creditcard_write>
|
45 |
+
<creditcard_read>
|
46 |
+
<connection>
|
47 |
+
<use>core_read</use>
|
48 |
+
</connection>
|
49 |
+
</creditcard_read>
|
50 |
+
</resources>
|
51 |
+
</global>
|
52 |
+
|
53 |
+
<adminhtml>
|
54 |
+
<translate>
|
55 |
+
<modules>
|
56 |
+
<BluePay_CreditCard>
|
57 |
+
<files>
|
58 |
+
<default>BluePay_CreditCard.csv</default>
|
59 |
+
</files>
|
60 |
+
</BluePay_CreditCard>
|
61 |
+
</modules>
|
62 |
+
</translate>
|
63 |
+
</adminhtml>
|
64 |
+
|
65 |
+
<frontend>
|
66 |
+
<translate>
|
67 |
+
<modules>
|
68 |
+
<BluePay_CreditCard>
|
69 |
+
<files>
|
70 |
+
<default>BluePay_CreditCard.csv</default>
|
71 |
+
</files>
|
72 |
+
</BluePay_CreditCard>
|
73 |
+
</modules>
|
74 |
+
</translate>
|
75 |
+
</frontend>
|
76 |
+
|
77 |
+
<default>
|
78 |
+
<payment>
|
79 |
+
<ccpayment>
|
80 |
+
<active>1</active>
|
81 |
+
<cctypes>AE,VI,MC,DI</cctypes>
|
82 |
+
<cgi_url>https://secure.bluepay.com/interfaces/bp10emu</cgi_url>
|
83 |
+
<debug>0</debug>
|
84 |
+
<login backend_model="adminhtml/system_config_backend_encrypted"/>
|
85 |
+
<model>creditcard/ccpayment</model>
|
86 |
+
<order_status>1</order_status>
|
87 |
+
<payment_action>AUTH</payment_action>
|
88 |
+
<test>1</test>
|
89 |
+
<title>BluePay (Credit Card)</title>
|
90 |
+
<trans_key backend_model="adminhtml/system_config_backend_encrypted"/>
|
91 |
+
<allowspecific>0</allowspecific>
|
92 |
+
<currency>USD</currency>
|
93 |
+
</ccpayment>
|
94 |
+
</payment>
|
95 |
+
</default>
|
96 |
+
</config>
|
97 |
+
|
app/code/local/Bluepay/CreditCard/etc/system.xml
ADDED
@@ -0,0 +1,178 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/afl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
* @category Bluepay
|
23 |
+
* @package Bluepay_CreditCard
|
24 |
+
* @copyright Copyright (c) 2010 BluePay Processing, LLC. (http://www.bluepay.com)
|
25 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
26 |
+
*/
|
27 |
+
-->
|
28 |
+
<config>
|
29 |
+
<sections>
|
30 |
+
<payment>
|
31 |
+
<groups>
|
32 |
+
<ccpayment translate="label" module="creditcard">
|
33 |
+
<label>BluePay (Credit Card)</label>
|
34 |
+
<frontend_type>text</frontend_type>
|
35 |
+
<sort_order>10</sort_order>
|
36 |
+
<show_in_default>1</show_in_default>
|
37 |
+
<show_in_website>1</show_in_website>
|
38 |
+
<show_in_store>1</show_in_store>
|
39 |
+
<fields>
|
40 |
+
<active translate="label">
|
41 |
+
<label>Enabled</label>
|
42 |
+
<frontend_type>select</frontend_type>
|
43 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
44 |
+
<sort_order>1</sort_order>
|
45 |
+
<show_in_default>1</show_in_default>
|
46 |
+
<show_in_website>1</show_in_website>
|
47 |
+
<show_in_store>0</show_in_store>
|
48 |
+
</active>
|
49 |
+
<cctypes translate="label">
|
50 |
+
<label>Credit Card Types</label>
|
51 |
+
<frontend_type>multiselect</frontend_type>
|
52 |
+
<source_model>creditcard/ccpayment_source_cctype</source_model>
|
53 |
+
<sort_order>15</sort_order>
|
54 |
+
<show_in_default>1</show_in_default>
|
55 |
+
<show_in_website>1</show_in_website>
|
56 |
+
<show_in_store>0</show_in_store>
|
57 |
+
</cctypes>
|
58 |
+
<useccv translate="label">
|
59 |
+
<label>Credit Card Verification</label>
|
60 |
+
<frontend_type>select</frontend_type>
|
61 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
62 |
+
<sort_order>6</sort_order>
|
63 |
+
<show_in_default>1</show_in_default>
|
64 |
+
<show_in_website>1</show_in_website>
|
65 |
+
<show_in_store>0</show_in_store>
|
66 |
+
</useccv>
|
67 |
+
<login translate="label">
|
68 |
+
<label>Account ID</label>
|
69 |
+
<frontend_type>obscure</frontend_type>
|
70 |
+
<backend_model>adminhtml/system_config_backend_encrypted</backend_model>
|
71 |
+
<sort_order>3</sort_order>
|
72 |
+
<show_in_default>1</show_in_default>
|
73 |
+
<show_in_website>1</show_in_website>
|
74 |
+
<show_in_store>0</show_in_store>
|
75 |
+
</login>
|
76 |
+
<sort_order translate="label">
|
77 |
+
<label>Sort Order</label>
|
78 |
+
<frontend_type>text</frontend_type>
|
79 |
+
<sort_order>100</sort_order>
|
80 |
+
<show_in_default>1</show_in_default>
|
81 |
+
<show_in_website>1</show_in_website>
|
82 |
+
<show_in_store>0</show_in_store>
|
83 |
+
</sort_order>
|
84 |
+
<test_mode translate="label">
|
85 |
+
<label>Test Mode</label>
|
86 |
+
<frontend_type>select</frontend_type>
|
87 |
+
<source_model>adminhtml/system_config_source_testmode</source_model>
|
88 |
+
<sort_order>5</sort_order>
|
89 |
+
<show_in_default>1</show_in_default>
|
90 |
+
<show_in_website>1</show_in_website>
|
91 |
+
<show_in_store>0</show_in_store>
|
92 |
+
</test_mode>
|
93 |
+
<debug translate="label">
|
94 |
+
<label>Debug</label>
|
95 |
+
<frontend_type>select</frontend_type>
|
96 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
97 |
+
<sort_order>20</sort_order>
|
98 |
+
<show_in_default>1</show_in_default>
|
99 |
+
<show_in_website>1</show_in_website>
|
100 |
+
<show_in_store>0</show_in_store>
|
101 |
+
</debug>
|
102 |
+
<title translate="label">
|
103 |
+
<label>Title</label>
|
104 |
+
<frontend_type>text</frontend_type>
|
105 |
+
<sort_order>2</sort_order>
|
106 |
+
<show_in_default>1</show_in_default>
|
107 |
+
<show_in_website>1</show_in_website>
|
108 |
+
<show_in_store>1</show_in_store>
|
109 |
+
</title>
|
110 |
+
<trans_key translate="label">
|
111 |
+
<label>Secret Key</label>
|
112 |
+
<frontend_type>obscure</frontend_type>
|
113 |
+
<backend_model>adminhtml/system_config_backend_encrypted</backend_model>
|
114 |
+
<sort_order>4</sort_order>
|
115 |
+
<show_in_default>1</show_in_default>
|
116 |
+
<show_in_website>1</show_in_website>
|
117 |
+
<show_in_store>0</show_in_store>
|
118 |
+
</trans_key>
|
119 |
+
<payment_action translate="label">
|
120 |
+
<label>Transaction Type</label>
|
121 |
+
<frontend_type>select</frontend_type>
|
122 |
+
<source_model>creditcard/ccpayment_source_paymentAction</source_model>
|
123 |
+
<sort_order>5</sort_order>
|
124 |
+
<show_in_default>1</show_in_default>
|
125 |
+
<show_in_website>1</show_in_website>
|
126 |
+
<show_in_store>0</show_in_store>
|
127 |
+
</payment_action>
|
128 |
+
<currency translate="label">
|
129 |
+
<label>Accepted Currency</label>
|
130 |
+
<frontend_type>select</frontend_type>
|
131 |
+
<source_model>adminhtml/system_config_source_currency</source_model>
|
132 |
+
<sort_order>8</sort_order>
|
133 |
+
<show_in_default>1</show_in_default>
|
134 |
+
<show_in_website>1</show_in_website>
|
135 |
+
<show_in_store>0</show_in_store>
|
136 |
+
</currency>
|
137 |
+
<allowspecific translate="label">
|
138 |
+
<label>Payment from Applicable Countries</label>
|
139 |
+
<frontend_type>allowspecific</frontend_type>
|
140 |
+
<sort_order>15</sort_order>
|
141 |
+
<source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
|
142 |
+
<show_in_default>1</show_in_default>
|
143 |
+
<show_in_website>1</show_in_website>
|
144 |
+
<show_in_store>0</show_in_store>
|
145 |
+
</allowspecific>
|
146 |
+
<specificcountry translate="label">
|
147 |
+
<label>Payment from Specific Countries</label>
|
148 |
+
<frontend_type>multiselect</frontend_type>
|
149 |
+
<sort_order>16</sort_order>
|
150 |
+
<source_model>adminhtml/system_config_source_country</source_model>
|
151 |
+
<show_in_default>1</show_in_default>
|
152 |
+
<show_in_website>1</show_in_website>
|
153 |
+
<show_in_store>0</show_in_store>
|
154 |
+
</specificcountry>
|
155 |
+
<min_order_total translate="label">
|
156 |
+
<label>Minimum Order Total</label>
|
157 |
+
<frontend_type>text</frontend_type>
|
158 |
+
<sort_order>17</sort_order>
|
159 |
+
<show_in_default>1</show_in_default>
|
160 |
+
<show_in_website>1</show_in_website>
|
161 |
+
<show_in_store>0</show_in_store>
|
162 |
+
</min_order_total>
|
163 |
+
<max_order_total translate="label">
|
164 |
+
<label>Maximum Order Total</label>
|
165 |
+
<frontend_type>text</frontend_type>
|
166 |
+
<sort_order>18</sort_order>
|
167 |
+
<show_in_default>1</show_in_default>
|
168 |
+
<show_in_website>1</show_in_website>
|
169 |
+
<show_in_store>0</show_in_store>
|
170 |
+
</max_order_total>
|
171 |
+
<model>
|
172 |
+
</model>
|
173 |
+
</fields>
|
174 |
+
</ccpayment>
|
175 |
+
</groups>
|
176 |
+
</payment>
|
177 |
+
</sections>
|
178 |
+
</config>
|
app/code/local/Bluepay/CreditCard/sql/creditcard_setup/mysql4-install-0.7.0.php
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
* @category BluePay
|
23 |
+
* @package BluePay_CreditCard
|
24 |
+
* @copyright Copyright (c) 2010 BluePay Processing, LLC (http://www.bluepay.com)
|
25 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
+
*/
|
27 |
+
|
28 |
+
$installer = $this;
|
29 |
+
/* @var $installer Mage_Core_Model_Resource_Setup */
|
30 |
+
|
31 |
+
$installer->startSetup();
|
32 |
+
|
33 |
+
$installer->run("
|
34 |
+
|
35 |
+
-- DROP TABLE if exists {$this->getTable('creditcard_creditcardpayment_debug')};
|
36 |
+
CREATE TABLE {$this->getTable('creditcard_creditcardpayment_debug')} (
|
37 |
+
`debug_id` int(10) unsigned NOT NULL auto_increment,
|
38 |
+
`request_body` text,
|
39 |
+
`response_body` text,
|
40 |
+
`request_serialized` text,
|
41 |
+
`result_serialized` text,
|
42 |
+
`request_dump` text,
|
43 |
+
`result_dump` text,
|
44 |
+
PRIMARY KEY (`debug_id`)
|
45 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
46 |
+
|
47 |
+
");
|
48 |
+
|
49 |
+
$installer->endSetup();
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>BluePay_CreditCardz</name>
|
4 |
+
<version>1.05</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>This extension contains a credit card payment module to be used with the BluePay gateway</summary>
|
10 |
+
<description>BluePay credit card payment module</description>
|
11 |
+
<notes>V 1.0</notes>
|
12 |
+
<authors><author><name>admin</name><user>auto-converted</user><email>jslingerland@bluepay.com</email></author></authors>
|
13 |
+
<date>2010-09-13</date>
|
14 |
+
<time>21:01:59</time>
|
15 |
+
<contents><target name="magelocal"><dir name="Bluepay"><dir name="CreditCard"><dir name="etc"><file name="config.xml" hash="85133efd66c47ff4792449868ef83052"/><file name="system.xml" hash="1a3456afe333db2281ca589c6a29d2f0"/></dir><dir name="Helper"><file name="Data.php" hash="7caa3c4a531b06073a4204bf970602a1"/></dir><dir name="Model"><file name="CCPayment.php" hash="1e1ac1abf24900ab8ca3c1c66dddd0c3"/><file name="Config.php" hash="13e58dcbe24ef20e69e221f16b161f4f"/><dir name="CCPayment"><file name="Debug.php" hash="910700c38be25e0e046205657b2f0169"/><file name="Request.php" hash="617693397144dbebb1d62864e2c371b0"/><file name="Result.php" hash="68c98936defea4327da8c13c9bd22e14"/><dir name="Source"><file name="Cctype.php" hash="67eb3c7eed32da8e9b2c27555d5b6bd5"/><file name="PaymentAction.php" hash="2ad92f02a33fd99b3582a80b5b9bb9a3"/></dir></dir><dir name="Mysql4"><dir name="CCPayment"><file name="Debug.php" hash="8084b353cf7cb312517ef12a5ee52da5"/><dir name="Debug"><file name="Collection.php" hash="f316e701aa245858c0a2077c15b39bf9"/></dir></dir></dir></dir><dir name="sql"><dir name="creditcard_setup"><file name="mysql4-install-0.7.0.php" hash="c97f60ff629417efef8beebf619caa9a"/></dir></dir></dir></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><package><name></name><channel>community</channel><min></min><max></max></package><package><name></name><channel>community</channel><min></min><max></max></package></required></dependencies>
|
18 |
+
</package>
|