PayVector_Tpg - Version 1.1.0

Version Notes

Update to enable merchants to take payments through the Magento Admin panel including support for MOTO Gateway Accounts

Download this release

Release Info

Developer Iridium Corporation
Extension PayVector_Tpg
Version 1.1.0
Comparing to
See all releases


Code changes from version 1.0.3 to 1.1.0

app/code/local/PayVector/Checkout/Block/Onepage/Payment/Methods.php DELETED
@@ -1,38 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * One page checkout status
5
- *
6
- * @category Mage
7
- * @package Mage_Checkout
8
- * @author Magento Core Team <core@magentocommerce.com>
9
- */
10
- class PayVector_Checkout_Block_Onepage_Payment_Methods extends Mage_Checkout_Block_Onepage_Payment_Methods
11
- {
12
- /**
13
- * Override the base function - by default the PayVector payment option will be selected
14
- *
15
- * @return mixed
16
- */
17
- public function getSelectedMethodCode()
18
- {
19
- $method = false;
20
- $model = Mage::getModel('tpg/direct');
21
-
22
- if($this->getQuote()->getPayment()->getMethod())
23
- {
24
- $method = $this->getQuote()->getPayment()->getMethod();
25
- }
26
-
27
- /*else
28
- {
29
- // force the current payment to be selected
30
- if($model)
31
- {
32
- $method = 'tpg';
33
- }
34
- }*/
35
-
36
- return $method;
37
- }
38
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/PayVector/Checkout/Model/Type/Onepage.php CHANGED
@@ -1,5 +1,4 @@
1
  <?php
2
-
3
  class PayVector_Checkout_Model_Type_Onepage extends Mage_Checkout_Model_Type_Onepage
4
  {
5
  /**
1
  <?php
 
2
  class PayVector_Checkout_Model_Type_Onepage extends Mage_Checkout_Model_Type_Onepage
3
  {
4
  /**
app/code/local/PayVector/Checkout/etc/config.xml CHANGED
@@ -6,19 +6,19 @@
6
  </PayVector_Checkout>
7
  </modules>
8
  <global>
9
- <models>
10
  <checkout>
11
  <rewrite>
12
  <type_onepage>PayVector_Checkout_Model_Type_Onepage</type_onepage>
13
  </rewrite>
14
  </checkout>
15
- </models>
16
- <blocks>
17
  <checkout>
18
  <rewrite>
19
  <onepage_payment_methods>PayVector_Checkout_Block_Onepage_Payment_Methods</onepage_payment_methods>
20
  </rewrite>
21
  </checkout>
22
- </blocks>
23
  </global>
24
  </config>
6
  </PayVector_Checkout>
7
  </modules>
8
  <global>
9
+ <!--<models>
10
  <checkout>
11
  <rewrite>
12
  <type_onepage>PayVector_Checkout_Model_Type_Onepage</type_onepage>
13
  </rewrite>
14
  </checkout>
15
+ </models>-->
16
+ <!--<blocks>
17
  <checkout>
18
  <rewrite>
19
  <onepage_payment_methods>PayVector_Checkout_Block_Onepage_Payment_Methods</onepage_payment_methods>
20
  </rewrite>
21
  </checkout>
22
+ </blocks>-->
23
  </global>
24
  </config>
app/code/local/PayVector/Tpg/Model/Direct (copy).php ADDED
@@ -0,0 +1,1547 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ include("Common/ThePaymentGateway/PaymentSystem.php");
4
+ include_once("Common/PaymentFormHelper.php");
5
+ include("Common/ISOCurrencies.php");
6
+ include("Common/ISOCountries.php");
7
+ include("Source/HashMethod.php");
8
+
9
+ class PayVector_Tpg_Model_Direct extends Mage_Payment_Model_Method_Abstract
10
+ {
11
+ /**
12
+ * unique internal payment method identifier
13
+ *
14
+ * @var string [a-z0-9_]
15
+ */
16
+ protected $_code = 'tpg';
17
+ protected $_formBlockType = 'tpg/form';
18
+ protected $_infoBlockType = 'tpg/info';
19
+
20
+ protected $_isGateway = true;
21
+ protected $_canAuthorize = true;
22
+ protected $_canCapture = true;
23
+ protected $_canCapturePartial = false;
24
+ protected $_canRefund = true;
25
+ protected $_canVoid = true;
26
+ protected $_canUseInternal = true;
27
+ protected $_canUseCheckout = true;
28
+ protected $_canUseForMultishipping = true;
29
+ protected $_canSaveCc = false;
30
+
31
+ /**
32
+ * Assign data to info model instance
33
+ *
34
+ * @param mixed $data
35
+ * @return Mage_Payment_Model_Info
36
+ */
37
+ public function assignData($data)
38
+ {
39
+ if(!($data instanceof Varien_Object))
40
+ {
41
+ $data = new Varien_Object($data);
42
+ }
43
+ $info = $this->getInfoInstance();
44
+ $info->setCcOwner($data->getCcOwner())
45
+ ->setCcLast4(substr($data->getCcNumber(), -4))
46
+ ->setCcNumber($data->getCcNumber())
47
+ ->setCcCid($data->getCcCid())
48
+ ->setCcExpMonth($data->getCcExpMonth())
49
+ ->setCcExpYear($data->getCcExpYear())
50
+ ->setCcSsStartMonth($data->getCcSsStartMonth())
51
+ ->setCcSsStartYear($data->getCcSsStartYear())
52
+ ->setCcSsIssue($data->getCcSsIssue());
53
+
54
+ return $this;
55
+ }
56
+
57
+ /**
58
+ * Validate payment method information object
59
+ *
60
+ * @param Mage_Payment_Model_Info $info
61
+ * @return Mage_Payment_Model_Method_Abstract
62
+ */
63
+ public function validate()
64
+ {
65
+ // NOTE : cancel out the core Magento validator functionality, the payment gateway will overtake this task
66
+ return $this;
67
+ }
68
+
69
+ /**
70
+ * Authorize - core Mage pre-authorization functionality
71
+ *
72
+ * @param Varien_Object $orderPayment
73
+ * @return Mage_Payment_Model_Method_Abstract
74
+ */
75
+ public function authorize(Varien_Object $payment, $amount)
76
+ {
77
+ $error = false;
78
+ //if this is a cross reference transaction then skip mode checking as it must be Direct/API
79
+ if(isset($_POST['payment']['payment_type']) && $_POST['payment']['payment_type'] === "stored_card")
80
+ {
81
+ $paymentAction = $this->getConfigData('payment_action');
82
+ if($paymentAction == Mage_Paygate_Model_Authorizenet::ACTION_AUTHORIZE_CAPTURE)
83
+ {
84
+ $szTransactionType = "SALE";
85
+ }
86
+ else if($paymentAction == Mage_Paygate_Model_Authorizenet::ACTION_AUTHORIZE)
87
+ {
88
+ $szTransactionType = "PREAUTH";
89
+ }
90
+ else
91
+ {
92
+ Mage::throwException('Unknown payment action: ' . $paymentAction);
93
+ }
94
+ $error = $this->_runCrossReferenceTransaction($payment, $szTransactionType, $amount, true);
95
+ }
96
+ else
97
+ {
98
+ $mode = $this->getConfigData('mode');
99
+ // TODO : need to finish for non Direct API methods
100
+ switch($mode)
101
+ {
102
+ case PayVector_Tpg_Model_Source_PaymentMode::PAYMENT_MODE_DIRECT_API:
103
+ $error = $this->_runTransaction($payment, $amount);
104
+ break;
105
+ case PayVector_Tpg_Model_Source_PaymentMode::PAYMENT_MODE_HOSTED_PAYMENT_FORM:
106
+ $error = $this->_runHostedPaymentTransaction($payment, $amount);
107
+ break;
108
+ case PayVector_Tpg_Model_Source_PaymentMode::PAYMENT_MODE_TRANSPARENT_REDIRECT:
109
+ $error = $this->_runTransparentRedirectTransaction($payment, $amount);
110
+ //Mage::throwException('TR not supported');
111
+ break;
112
+ default:
113
+ Mage::throwException('Invalid payment type: ' . $this->getConfigData('mode'));
114
+ break;
115
+ }
116
+ }
117
+ if($error)
118
+ {
119
+ Mage::throwException($error);
120
+ }
121
+
122
+ return $this;
123
+ }
124
+
125
+ /**
126
+ * Capture payment - immediate settlement payments
127
+ *
128
+ * @param Varien_Object $payment
129
+ * @return Mage_Payment_Model_Method_Abstract
130
+ */
131
+ public function capture(Varien_Object $payment, $amount)
132
+ {
133
+ $error = false;
134
+ $session = Mage::getSingleton('checkout/session');
135
+ $mode = $this->getConfigData('mode');
136
+ $nVersion = $this->getVersion();
137
+ if($amount <= 0)
138
+ {
139
+ Mage::throwException(Mage::helper('paygate')->__('Invalid amount for authorization.'));
140
+ }
141
+ else
142
+ {
143
+ if($session->getThreedsecurerequired())
144
+ {
145
+ $md = $session->getMd();
146
+ $pares = $session->getPares();
147
+ $session->setThreedsecurerequired(null);
148
+ $this->_run3DSecureTransaction($payment, $pares, $md);
149
+
150
+ return $this;
151
+ }
152
+ if($session->getRedirectedPayment())
153
+ {
154
+ $szStatusCode = $session->getStatuscode();
155
+ $szMessage = $session->getMessage();
156
+ $szPreviousStatusCode = $session->getPreviousstatuscode();
157
+ $szPreviousMessage = $session->getPreviousmessage();
158
+ $szOrderID = $session->getOrderid();
159
+ $szCrossReference = $session->getCrossReference();
160
+ // check whether it is a hosted payment or a transparent redirect action
161
+ $boIsHostedPaymentAction = $session->getIshostedpayment();
162
+ $session->setRedirectedPayment(null);
163
+ $session->setIshostedpayment(null);
164
+ $this->_runRedirectedPaymentComplete($payment, $boIsHostedPaymentAction, $szStatusCode, $szMessage, $szPreviousStatusCode, $szPreviousMessage, $szOrderID, $szCrossReference);
165
+
166
+ return $this;
167
+ }
168
+ if($session->getIsCollectionCrossReferenceTransaction())
169
+ {
170
+ // do a CrossReference transaction
171
+ $error = $this->_runCrossReferenceTransaction($payment, "COLLECTION", $amount);
172
+ }
173
+ else
174
+ {
175
+ // fresh payment request
176
+ $session->setThreedsecurerequired(null)
177
+ ->setRedirectedPayment(null)
178
+ ->setIshostedpayment(null)
179
+ ->setHostedPayment(null)
180
+ ->setMd(null)
181
+ ->setPareq(null)
182
+ ->setAcsurl(null)
183
+ ->setPaymentprocessorresponse(null);
184
+ $payment->setAmount($amount);
185
+ switch($mode)
186
+ {
187
+ case PayVector_Tpg_Model_Source_PaymentMode::PAYMENT_MODE_DIRECT_API:
188
+ $error = $this->_runTransaction($payment, $amount);
189
+ break;
190
+ case PayVector_Tpg_Model_Source_PaymentMode::PAYMENT_MODE_HOSTED_PAYMENT_FORM:
191
+ $error = $this->_runHostedPaymentTransaction($payment, $amount);
192
+ break;
193
+ case PayVector_Tpg_Model_Source_PaymentMode::PAYMENT_MODE_TRANSPARENT_REDIRECT:
194
+ $error = $this->_runTransparentRedirectTransaction($payment, $amount);
195
+ break;
196
+ default:
197
+ Mage::throwException('Invalid payment type: ' . $this->getConfigData('mode'));
198
+ break;
199
+ }
200
+ }
201
+ }
202
+ if($error)
203
+ {
204
+ Mage::throwException($error);
205
+ }
206
+ else
207
+ {
208
+ if($nVersion == 1324 || $nVersion == 1330)
209
+ {
210
+ $payment->setIsInvoicePaid(true);
211
+ }
212
+ }
213
+
214
+ return $this;
215
+ }
216
+
217
+ /**
218
+ * Processing the transaction using the direct integration
219
+ *
220
+ * @param Varien_Object $orderPayment
221
+ * @param float $amount
222
+ * @return bool
223
+ */
224
+ public function _runTransaction(Varien_Object $payment, $amount)
225
+ {
226
+ $MerchantID = $this->getConfigData('merchantid');
227
+ $Password = $this->getConfigData('password');
228
+ $SecretKey = $this->getConfigData('secretkey');
229
+ // assign payment form field values to variables
230
+ $order = $payment->getOrder();
231
+ $szOrderID = $payment->getOrder()->increment_id;
232
+ $szOrderDescription = '';
233
+ $szCardName = $payment->getCcOwner();
234
+ $szCardNumber = $payment->getCcNumber();
235
+ //save card last four to the session so that it persists through a redirect on 3DS
236
+ Mage::getModel('customer/session')->setData('payvector_card_last_four', substr($payment->getCcNumber(), -4));
237
+ $szIssueNumber = $payment->getCcSsIssue();
238
+ $szCV2 = $payment->getCcCid();
239
+ $szCurrencyShort = $order->getOrderCurrency()->getCurrencyCode();
240
+ // address details
241
+ $billingAddress = $order->getBillingAddress();
242
+ $szAddress1 = $billingAddress->getStreet1();
243
+ $szAddress2 = $billingAddress->getStreet2();
244
+ $szAddress3 = $billingAddress->getStreet3();
245
+ $szAddress4 = $billingAddress->getStreet4();
246
+ $szCity = $billingAddress->getCity();
247
+ $szState = $billingAddress->getRegion();
248
+ $szPostCode = $billingAddress->getPostcode();
249
+ $szISO2CountryCode = $billingAddress->getCountry();
250
+ $szEmailAddress = $billingAddress->getCustomerEmail();
251
+ $szPhoneNumber = $billingAddress->getTelephone();
252
+ $iclISOCurrencyList = ISOCurrencies::getISOCurrencyList();
253
+ $iclISOCountryList = ISOCountries::getISOCountryList();
254
+
255
+ $rgeplRequestGatewayEntryPointList = $this->_getGatewayEntryPointList();
256
+
257
+ $paymentAction = $this->getConfigData('payment_action');
258
+ if($paymentAction == Mage_Paygate_Model_Authorizenet::ACTION_AUTHORIZE_CAPTURE)
259
+ {
260
+ $szTransactionType = "SALE";
261
+ }
262
+ else if($paymentAction == Mage_Paygate_Model_Authorizenet::ACTION_AUTHORIZE)
263
+ {
264
+ $szTransactionType = "PREAUTH";
265
+ }
266
+ else
267
+ {
268
+ Mage::throwException('Unknown payment action: ' . $paymentAction);
269
+ }
270
+ $cdtCardDetailsTransaction = new CardDetailsTransaction($rgeplRequestGatewayEntryPointList);
271
+ $cdtCardDetailsTransaction->getMerchantAuthentication()->setMerchantID($MerchantID);
272
+ $cdtCardDetailsTransaction->getMerchantAuthentication()->setPassword($Password);
273
+ $cdtCardDetailsTransaction->getTransactionDetails()->getMessageDetails()->setTransactionType($szTransactionType);
274
+ if($szCurrencyShort != '' &&
275
+ $iclISOCurrencyList->getISOCurrency($szCurrencyShort, $icISOCurrency)
276
+ )
277
+ {
278
+ $cdtCardDetailsTransaction->getTransactionDetails()->getCurrencyCode()->setValue($icISOCurrency->getISOCode());
279
+ }
280
+ $nDecimalAmount = $this->_getRoundedAmount($amount, $icISOCurrency->getExponent());
281
+ $cdtCardDetailsTransaction->getTransactionDetails()->getAmount()->setValue($nDecimalAmount);
282
+ $cdtCardDetailsTransaction->getTransactionDetails()->setOrderID($szOrderID);
283
+ $cdtCardDetailsTransaction->getTransactionDetails()->setOrderDescription($szOrderDescription);
284
+ $cdtCardDetailsTransaction->getTransactionDetails()->getTransactionControl()->getEchoCardType()->setValue(true);
285
+ $cdtCardDetailsTransaction->getTransactionDetails()->getTransactionControl()->getEchoAmountReceived()->setValue(true);
286
+ $cdtCardDetailsTransaction->getTransactionDetails()->getTransactionControl()->getEchoAVSCheckResult()->setValue(true);
287
+ $cdtCardDetailsTransaction->getTransactionDetails()->getTransactionControl()->getEchoCV2CheckResult()->setValue(true);
288
+ $cdtCardDetailsTransaction->getTransactionDetails()->getTransactionControl()->getThreeDSecureOverridePolicy()->setValue(true);
289
+ $cdtCardDetailsTransaction->getTransactionDetails()->getTransactionControl()->getDuplicateDelay()->setValue(60);
290
+ $cdtCardDetailsTransaction->getTransactionDetails()->getThreeDSecureBrowserDetails()->getDeviceCategory()->setValue(0);
291
+ $cdtCardDetailsTransaction->getTransactionDetails()->getThreeDSecureBrowserDetails()->setAcceptHeaders("*/*");
292
+ $cdtCardDetailsTransaction->getTransactionDetails()->getThreeDSecureBrowserDetails()->setUserAgent($_SERVER["HTTP_USER_AGENT"]);
293
+ $cdtCardDetailsTransaction->getCardDetails()->setCardName($szCardName);
294
+ $cdtCardDetailsTransaction->getCardDetails()->setCardNumber($szCardNumber);
295
+ if($payment->getCcExpMonth() != "")
296
+ {
297
+ $cdtCardDetailsTransaction->getCardDetails()->getExpiryDate()->getMonth()->setValue($payment->getCcExpMonth());
298
+ }
299
+ if($payment->getCcExpYear() != "")
300
+ {
301
+ $cdtCardDetailsTransaction->getCardDetails()->getExpiryDate()->getYear()->setValue($payment->getCcExpYear());
302
+ }
303
+ if($payment->getCcSsStartMonth() != "")
304
+ {
305
+ $cdtCardDetailsTransaction->getCardDetails()->getStartDate()->getMonth()->setValue($payment->getCcSsStartMonth());
306
+ }
307
+ if($payment->getCcSsStartYear() != "")
308
+ {
309
+ $cdtCardDetailsTransaction->getCardDetails()->getStartDate()->getYear()->setValue($payment->getCcSsStartYear());
310
+ }
311
+ $cdtCardDetailsTransaction->getCardDetails()->setIssueNumber($szIssueNumber);
312
+ $cdtCardDetailsTransaction->getCardDetails()->setCV2($szCV2);
313
+ $cdtCardDetailsTransaction->getCustomerDetails()->getBillingAddress()->setAddress1($szAddress1);
314
+ $cdtCardDetailsTransaction->getCustomerDetails()->getBillingAddress()->setAddress2($szAddress2);
315
+ $cdtCardDetailsTransaction->getCustomerDetails()->getBillingAddress()->setAddress3($szAddress3);
316
+ $cdtCardDetailsTransaction->getCustomerDetails()->getBillingAddress()->setAddress4($szAddress4);
317
+ $cdtCardDetailsTransaction->getCustomerDetails()->getBillingAddress()->setCity($szCity);
318
+ $cdtCardDetailsTransaction->getCustomerDetails()->getBillingAddress()->setState($szState);
319
+ $cdtCardDetailsTransaction->getCustomerDetails()->getBillingAddress()->setPostCode($szPostCode);
320
+ $szCountryShort = $this->_getISO3Code($szISO2CountryCode);
321
+ if($iclISOCountryList->getISOCountry($szCountryShort, $icISOCountry))
322
+ {
323
+ $cdtCardDetailsTransaction->getCustomerDetails()->getBillingAddress()->getCountryCode()->setValue($icISOCountry->getISOCode());
324
+ }
325
+ $cdtCardDetailsTransaction->getCustomerDetails()->setEmailAddress($szEmailAddress);
326
+ $cdtCardDetailsTransaction->getCustomerDetails()->setPhoneNumber($szPhoneNumber);
327
+ $boTransactionProcessed = $cdtCardDetailsTransaction->processTransaction($cdtrCardDetailsTransactionResult, $todTransactionOutputData);
328
+ $error = $this->_handleTransactionResults($payment, $boTransactionProcessed, $cdtCardDetailsTransaction, $cdtrCardDetailsTransactionResult, $todTransactionOutputData);
329
+
330
+ return $error;
331
+ }
332
+
333
+ /**
334
+ * Processing the transaction using the hosted payment form integration
335
+ *
336
+ * @param Varien_Object $payment
337
+ * @param float $amount
338
+ */
339
+ public function _runHostedPaymentTransaction(Varien_Object $payment, $amount)
340
+ {
341
+ $session = Mage::getSingleton('checkout/session');
342
+ $nVersion = $this->getVersion();
343
+ $szMerchantID = $this->getConfigData('merchantid');
344
+ $szPassword = $this->getConfigData('password');
345
+ $szPreSharedKey = $this->getConfigData('presharedkey');
346
+ $hmHashMethod = $this->getConfigData('hashmethod');
347
+ $boCV2Mandatory = 'false';
348
+ $boAddress1Mandatory = 'false';
349
+ $boCityMandatory = 'false';
350
+ $boPostCodeMandatory = 'false';
351
+ $boStateMandatory = 'false';
352
+ $boCountryMandatory = 'false';
353
+ $szEchoCardType = 'true';
354
+ $rdmResultDeliveryMethod = $this->getConfigData('resultdeliverymethod');
355
+ $szServerResultURL = '';
356
+ // set to always true to display the result on the Hosted Payment Form
357
+ $boPaymentFormDisplaysResult = '';
358
+
359
+ //Set callback URL
360
+ if($rdmResultDeliveryMethod === PayVector_Tpg_Model_Source_ResultDeliveryMethod::RESULT_DELIVERY_METHOD_SERVER_PULL)
361
+ {
362
+ $szCallbackURL = Mage::getUrl('tpg/payment/serverpullresult', array('_secure' => true));
363
+ }
364
+ else
365
+ {
366
+ $szCallbackURL = Mage::getUrl('tpg/payment/callbackhostedpayment', array('_secure' => true));
367
+ }
368
+
369
+ //For SERVER method then set ServerResultURL
370
+ if($rdmResultDeliveryMethod === PayVector_Tpg_Model_Source_ResultDeliveryMethod::RESULT_DELIVERY_METHOD_SERVER)
371
+ {
372
+ $szServerResultURL = Mage::getUrl('tpg/payment/serverresult', array('_secure' => true));
373
+ $boPaymentFormDisplaysResult = 'true';
374
+ }
375
+
376
+ // switch($rdmResultDeliveryMethod)
377
+ // {
378
+ // case PayVector_Tpg_Model_Source_ResultDeliveryMethod::RESULT_DELIVERY_METHOD_POST:
379
+ // $szCallbackURL = Mage::getUrl('tpg/payment/callbackhostedpayment', array('_secure' => true));
380
+ // break;
381
+ // case PayVector_Tpg_Model_Source_ResultDeliveryMethod::RESULT_DELIVERY_METHOD_SERVER:
382
+ // $szCallbackURL = Mage::getUrl('tpg/payment/callbackhostedpayment', array('_secure' => true));
383
+ // $szServerResultURL = Mage::getUrl('tpg/payment/serverresult', array('_secure' => true));
384
+ // $boPaymentFormDisplaysResult = 'true';
385
+ // break;
386
+ // case PayVector_Tpg_Model_Source_ResultDeliveryMethod::RESULT_DELIVERY_METHOD_SERVER_PULL:
387
+ // $szCallbackURL = Mage::getUrl('tpg/payment/serverpullresult', array('_secure' => true));
388
+ // break;
389
+ // }
390
+
391
+ $order = $payment->getOrder();
392
+ $billingAddress = $order->getBillingAddress();
393
+ $iclISOCurrencyList = ISOCurrencies::getISOCurrencyList();
394
+ $iclISOCountryList = ISOCountries::getISOCountryList();
395
+ $cookie = Mage::getSingleton('core/cookie');
396
+ $arCookieArray = $cookie->get();
397
+ $arCookieKeysArray = array_keys($arCookieArray);
398
+ $nKeysArrayLength = count($arCookieKeysArray);
399
+ $szCookiePath = $cookie->getPath();
400
+ $szCookieDomain = $cookie->getDomain();
401
+ $szServerResultURLCookieVariables = '';
402
+ $szServerResultURLFormVariables = '';
403
+ $szServerResultURLQueryStringVariables = '';
404
+ //ServerResutlURLCookieVariables string format: cookie1=123&path=/&domain=www.domain.com@@cookie2=456&path=/&domain=www.domain.com
405
+ for($nCount = 0; $nCount < $nKeysArrayLength; $nCount++)
406
+ {
407
+ $szEncodedCookieValue = urlencode($arCookieArray[$arCookieKeysArray[$nCount]]);
408
+ $szServerResultURLCookieVariables .= $arCookieKeysArray[$nCount] . "=" . $szEncodedCookieValue . "&path=" . $szCookiePath . "&domain=" . $szCookieDomain;
409
+ if($nCount < $nKeysArrayLength - 1)
410
+ {
411
+ $szServerResultURLCookieVariables .= "@@";
412
+ }
413
+ }
414
+ $szCurrencyShort = $order->getOrderCurrency()->getCurrencyCode();
415
+ if($szCurrencyShort != '' &&
416
+ $iclISOCurrencyList->getISOCurrency($szCurrencyShort, $icISOCurrency)
417
+ )
418
+ {
419
+ $nCurrencyCode = $icISOCurrency->getISOCode();
420
+ }
421
+ $nAmount = $this->_getRoundedAmount($amount, $icISOCurrency->getExponent());
422
+ $szISO2CountryCode = $billingAddress->getCountry();
423
+ $szCountryShort = $this->_getISO3Code($szISO2CountryCode);
424
+ if($iclISOCountryList->getISOCountry($szCountryShort, $icISOCountry))
425
+ {
426
+ $nCountryCode = $icISOCountry->getISOCode();
427
+ }
428
+ $szOrderID = $payment->getOrder()->increment_id;
429
+ //date time with 2008-12-01 14:12:00 +01:00 format
430
+ $szTransactionDateTime = date('Y-m-d H:i:s P');
431
+ $szOrderDescription = '';
432
+ //$szTransactionType = "SALE";
433
+ $paymentAction = $this->getConfigData('payment_action');
434
+ if($paymentAction == Mage_Paygate_Model_Authorizenet::ACTION_AUTHORIZE_CAPTURE)
435
+ {
436
+ $szTransactionType = "SALE";
437
+ }
438
+ else if($paymentAction == Mage_Paygate_Model_Authorizenet::ACTION_AUTHORIZE)
439
+ {
440
+ $szTransactionType = "PREAUTH";
441
+ }
442
+ else
443
+ {
444
+ Mage::throwException('Unknown payment action: ' . $paymentAction);
445
+ }
446
+ $szCustomerName = $billingAddress->getfirstname();
447
+ if($billingAddress->getfirstname())
448
+ {
449
+ $szCustomerName = $szCustomerName . ' ' . $billingAddress->getlastname();
450
+ }
451
+ $szAddress1 = $billingAddress->getStreet1();
452
+ $szAddress2 = $billingAddress->getStreet2();
453
+ $szAddress3 = $billingAddress->getStreet3();
454
+ $szAddress4 = $billingAddress->getStreet4();
455
+ $szCity = $billingAddress->getCity();
456
+ $szState = $billingAddress->getRegion();
457
+ $szPostCode = $billingAddress->getPostcode();
458
+ if($this->getConfigData('cv2mandatory'))
459
+ {
460
+ $boCV2Mandatory = 'true';
461
+ }
462
+ if($this->getConfigData('address1mandatory'))
463
+ {
464
+ $boAddress1Mandatory = 'true';
465
+ }
466
+ if($this->getConfigData('citymandatory'))
467
+ {
468
+ $boCityMandatory = 'true';
469
+ }
470
+ if($this->getConfigData('postcodemandatory'))
471
+ {
472
+ $boPostCodeMandatory = 'true';
473
+ }
474
+ if($this->getConfigData('statemandatory'))
475
+ {
476
+ $boStateMandatory = 'true';
477
+ }
478
+ if($this->getConfigData('countrymandatory'))
479
+ {
480
+ $boCountryMandatory = 'true';
481
+ }
482
+ if($this->getConfigData('paymentformdisplaysresult'))
483
+ {
484
+ $boPaymentFormDisplaysResult = 'true';
485
+ }
486
+ $szHashDigest =
487
+ TPG_PaymentFormHelper::calculateHashDigest(
488
+ $szMerchantID,
489
+ $szPassword,
490
+ $hmHashMethod,
491
+ $szPreSharedKey,
492
+ $nAmount,
493
+ $nCurrencyCode,
494
+ $szEchoCardType,
495
+ $szOrderID,
496
+ $szTransactionType,
497
+ $szTransactionDateTime,
498
+ $szCallbackURL,
499
+ $szOrderDescription,
500
+ $szCustomerName,
501
+ $szAddress1,
502
+ $szAddress2,
503
+ $szAddress3,
504
+ $szAddress4,
505
+ $szCity,
506
+ $szState,
507
+ $szPostCode,
508
+ $nCountryCode,
509
+ $boCV2Mandatory,
510
+ $boAddress1Mandatory,
511
+ $boCityMandatory,
512
+ $boPostCodeMandatory,
513
+ $boStateMandatory,
514
+ $boCountryMandatory,
515
+ $rdmResultDeliveryMethod,
516
+ $szServerResultURL,
517
+ $boPaymentFormDisplaysResult,
518
+ $szServerResultURLCookieVariables,
519
+ $szServerResultURLFormVariables,
520
+ $szServerResultURLQueryStringVariables
521
+ );
522
+ $session->setHashdigest($szHashDigest)
523
+ ->setMerchantid($szMerchantID)
524
+ ->setAmount($nAmount)
525
+ ->setCurrencycode($nCurrencyCode)
526
+ ->setEchoCardType($szEchoCardType)
527
+ ->setOrderid($szOrderID)
528
+ ->setTransactiontype($szTransactionType)
529
+ ->setTransactiondatetime($szTransactionDateTime)
530
+ ->setCallbackurl($szCallbackURL)
531
+ ->setOrderdescription($szOrderDescription)
532
+ ->setCustomername($szCustomerName)
533
+ ->setAddress1($szAddress1)
534
+ ->setAddress2($szAddress2)
535
+ ->setAddress3($szAddress3)
536
+ ->setAddress4($szAddress4)
537
+ ->setCity($szCity)
538
+ ->setState($szState)
539
+ ->setPostcode($szPostCode)
540
+ ->setCountrycode($nCountryCode)
541
+ ->setCv2mandatory($boCV2Mandatory)
542
+ ->setAddress1mandatory($boAddress1Mandatory)
543
+ ->setCitymandatory($boCityMandatory)
544
+ ->setPostcodemandatory($boPostCodeMandatory)
545
+ ->setStatemandatory($boStateMandatory)
546
+ ->setCountrymandatory($boCountryMandatory)
547
+ ->setResultdeliverymethod($rdmResultDeliveryMethod)
548
+ ->setServerresulturl($szServerResultURL)
549
+ ->setPaymentformdisplaysresult($boPaymentFormDisplaysResult)
550
+ ->setServerresulturlcookievariables($szServerResultURLCookieVariables)
551
+ ->setServerresulturlformvariables($szServerResultURLFormVariables)
552
+ ->setServerresulturlquerystringvariables($szServerResultURLQueryStringVariables);
553
+ if($nVersion >= 1410)
554
+ {
555
+ $session->setRedirectionMethod('_runRedirectedPaymentComplete');
556
+ $payment->getOrder()->setIsHostedPaymentPending(true);
557
+ }
558
+ /* serve out a dummy CrossReference as the TransactionId - this need to be done to enable the "Refund" button
559
+ in the Magento CreditMemo internal refund mechanism */
560
+ $payment->setTransactionId($szOrderID . "_" . date('YmdHis'));
561
+ }
562
+
563
+ /**
564
+ * Processing the transaction using the transparent redirect integration
565
+ *
566
+ * @param Varien_Object $payment
567
+ * @param float $amount
568
+ */
569
+ public function _runTransparentRedirectTransaction(Varien_Object $payment, $amount)
570
+ {
571
+ $GLOBALS['m_boPayInvoice'] = false;
572
+ $payment->setIsTransactionPending(true);
573
+ $nVersion = $this->getVersion();
574
+ $szMerchantID = $this->getConfigData('merchantid');
575
+ $szPassword = $this->getConfigData('password');
576
+ $szPreSharedKey = $this->getConfigData('presharedkey');
577
+ $hmHashMethod = $this->getConfigData('hashmethod');
578
+ $szCallbackURL = Mage::getUrl('tpg/payment/callbacktransparentredirect', array('_secure' => true));
579
+ $order = $payment->getOrder();
580
+ $billingAddress = $order->getBillingAddress();
581
+ $iclISOCurrencyList = ISOCurrencies::getISOCurrencyList();
582
+ $iclISOCountryList = ISOCountries::getISOCountryList();
583
+ $szStartDateMonth = '';
584
+ $szStartDateYear = '';
585
+ $szCurrencyShort = $order->getOrderCurrency()->getCurrencyCode();
586
+ if($szCurrencyShort != '' &&
587
+ $iclISOCurrencyList->getISOCurrency($szCurrencyShort, $icISOCurrency)
588
+ )
589
+ {
590
+ $nCurrencyCode = $icISOCurrency->getISOCode();
591
+ }
592
+ $nAmount = $this->_getRoundedAmount($amount, $icISOCurrency->getExponent());
593
+ $szOrderID = $payment->getOrder()->increment_id;
594
+ //date time with 2008-12-01 14:12:00 +01:00 format
595
+ $szTransactionDateTime = date('Y-m-d H:i:s P');
596
+ $szOrderDescription = '';
597
+ //$szTransactionType = 'SALE';
598
+ $paymentAction = $this->getConfigData('payment_action');
599
+ if($paymentAction == Mage_Paygate_Model_Authorizenet::ACTION_AUTHORIZE_CAPTURE)
600
+ {
601
+ $szTransactionType = "SALE";
602
+ }
603
+ else if($paymentAction == Mage_Paygate_Model_Authorizenet::ACTION_AUTHORIZE)
604
+ {
605
+ $szTransactionType = "PREAUTH";
606
+ }
607
+ else
608
+ {
609
+ Mage::throwException('Unknown payment action: ' . $paymentAction);
610
+ }
611
+ $szAddress1 = $billingAddress->getStreet1();
612
+ $szAddress2 = $billingAddress->getStreet2();
613
+ $szAddress3 = $billingAddress->getStreet3();
614
+ $szAddress4 = $billingAddress->getStreet4();
615
+ $szCity = $billingAddress->getCity();
616
+ $szState = $billingAddress->getRegion();
617
+ $szPostCode = $billingAddress->getPostcode();
618
+ $szISO2CountryCode = $billingAddress->getCountry();
619
+ $szCountryShort = $this->_getISO3Code($szISO2CountryCode);
620
+ if($iclISOCountryList->getISOCountry($szCountryShort, $icISOCountry))
621
+ {
622
+ $nCountryCode = $icISOCountry->getISOCode();
623
+ }
624
+ $szCardName = $payment->getCcOwner();
625
+ $szCardNumber = $payment->getCcNumber();
626
+ $szExpiryDateMonth = $payment->getCcExpMonth();
627
+ $szExpiryDateYear = $payment->getCcExpYear();
628
+ if($payment->getCcSsStartMonth() != '')
629
+ {
630
+ $szStartDateMonth = $payment->getCcSsStartMonth();
631
+ }
632
+ if($payment->getCcSsStartYear() != '')
633
+ {
634
+ $szStartDateYear = $payment->getCcSsStartYear();
635
+ }
636
+ $szIssueNumber = $payment->getCcSsIssue();
637
+ $szCV2 = $payment->getCcCid();
638
+ $szHashDigest =
639
+ TPG_PaymentFormHelper::calculateTransparentRedirectHashDigest(
640
+ $szMerchantID,
641
+ $szPassword,
642
+ $hmHashMethod,
643
+ $szPreSharedKey,
644
+ $nAmount,
645
+ $nCurrencyCode,
646
+ $szOrderID,
647
+ $szTransactionType,
648
+ $szTransactionDateTime,
649
+ $szCallbackURL,
650
+ $szOrderDescription
651
+ );
652
+ Mage::getSingleton('checkout/session')->setHashdigest($szHashDigest)
653
+ ->setMerchantid($szMerchantID)
654
+ ->setAmount($nAmount)
655
+ ->setCurrencycode($nCurrencyCode)
656
+ ->setOrderid($szOrderID)
657
+ ->setTransactiontype($szTransactionType)
658
+ ->setTransactiondatetime($szTransactionDateTime)
659
+ ->setCallbackurl($szCallbackURL)
660
+ ->setOrderdescription($szOrderDescription)
661
+ ->setAddress1($szAddress1)
662
+ ->setAddress2($szAddress2)
663
+ ->setAddress3($szAddress3)
664
+ ->setAddress4($szAddress4)
665
+ ->setCity($szCity)
666
+ ->setState($szState)
667
+ ->setPostcode($szPostCode)
668
+ ->setCountrycode($nCountryCode)
669
+ ->setCardname($szCardName)
670
+ ->setCardnumber($szCardNumber)
671
+ ->setExpirydatemonth($szExpiryDateMonth)
672
+ ->setExpirydateyear($szExpiryDateYear)
673
+ ->setStartdatemonth($szStartDateMonth)
674
+ ->setStartdateyear($szStartDateYear)
675
+ ->setIssuenumber($szIssueNumber)
676
+ ->setCv2($szCV2);
677
+ if($nVersion >= 1410)
678
+ {
679
+ Mage::getSingleton('checkout/session')->setRedirectionMethod('_runRedirectedPaymentComplete');
680
+ $payment->getOrder()->setIsHostedPaymentPending(true);
681
+ }
682
+ /* serve out a dummy CrossReference as the TransactionId - this need to be done to enable the "Refund" button
683
+ in the Magento CreditMemo internal refund mechanism */
684
+ $payment->setTransactionId($szOrderID . "_" . date('YmdHis'));
685
+ }
686
+
687
+ /**
688
+ * Processing the 3D Secure transaction
689
+ *
690
+ * @param Varien_Object $payment
691
+ * @param int $amount
692
+ * @param string $szPaRes
693
+ * @param string $szMD
694
+ */
695
+ public function _run3DSecureTransaction(Varien_Object $payment, $szPaRes, $szMD)
696
+ {
697
+ $MerchantID = $this->getConfigData('merchantid');
698
+ $Password = $this->getConfigData('password');
699
+ $SecretKey = $this->getConfigData('secretkey');
700
+ $rgeplRequestGatewayEntryPointList = $this->_getGatewayEntryPointList();
701
+
702
+ $tdsaThreeDSecureAuthentication = new ThreeDSecureAuthentication($rgeplRequestGatewayEntryPointList);
703
+ $tdsaThreeDSecureAuthentication->getMerchantAuthentication()->setMerchantID($MerchantID);
704
+ $tdsaThreeDSecureAuthentication->getMerchantAuthentication()->setPassword($Password);
705
+ $tdsaThreeDSecureAuthentication->getThreeDSecureInputData()->setCrossReference($szMD);
706
+ $tdsaThreeDSecureAuthentication->getThreeDSecureInputData()->setPaRES($szPaRes);
707
+ $boTransactionProcessed = $tdsaThreeDSecureAuthentication->processTransaction($tdsarThreeDSecureAuthenticationResult, $todTransactionOutputData);
708
+ $error = $this->_handleTransactionResults($payment, $boTransactionProcessed, $tdsaThreeDSecureAuthentication, $tdsarThreeDSecureAuthenticationResult, $todTransactionOutputData);
709
+
710
+ if($error)
711
+ {
712
+ Mage::throwException($error);
713
+ }
714
+
715
+ return $this;
716
+ }
717
+
718
+ /**
719
+ * @param Varien_Object $payment
720
+ * @param bool $boIsHostedPaymentAction
721
+ * @param string $szStatusCode
722
+ * @param string $szMessage
723
+ * @param string $szPreviousStatusCode
724
+ * @param string $szPreviousMessage
725
+ * @param string $szOrderID
726
+ * @param string $szCrossReference
727
+ * @param string $szCardType
728
+ * @return PayVector_Tpg_Model_Direct
729
+ * @throws Mage_Core_Exception
730
+ */
731
+ public function _runRedirectedPaymentComplete(
732
+ Varien_Object $payment,
733
+ $boIsHostedPaymentAction,
734
+ $szStatusCode, $szMessage,
735
+ $szPreviousStatusCode,
736
+ $szPreviousMessage,
737
+ $szOrderID,
738
+ $szCrossReference,
739
+ $szCardType
740
+ )
741
+ {
742
+ $error = false;
743
+ $message = null;
744
+ $session = Mage::getSingleton('checkout/session');
745
+ $nVersion = $this->getVersion();
746
+ if($boIsHostedPaymentAction == true)
747
+ {
748
+ $szWording = "Hosted Payment Form ";
749
+ }
750
+ else
751
+ {
752
+ $szWording = "Transparent Redirect ";
753
+ }
754
+ $message = "Payment Processor Response: " . $szMessage;
755
+
756
+ //save cross reference so the user can use saved card functionality for future transactions
757
+ $payment->setTransactionId($szCrossReference);
758
+ $payment->setCcType($szCardType);
759
+
760
+ switch($szStatusCode)
761
+ {
762
+ case "0":
763
+ Mage::log($szWording . "transaction successfully completed. " . $message);
764
+ // need to store the new CrossReference and only store it against the payment object in the payment controller class
765
+ $session->setNewCrossReference($szCrossReference);
766
+ break;
767
+ case "20":
768
+ Mage::log("Duplicate " . $szWording . "transaction. " . $message);
769
+ $message =
770
+ $message .
771
+ ". A duplicate transaction means that a transaction with these details has already been processed by the payment provider. The details of the original transaction - Previous Transaction Response: " .
772
+ $szPreviousMessage;
773
+ if($szPreviousStatusCode != "0")
774
+ {
775
+ $error = true;
776
+ }
777
+ break;
778
+ case "5":
779
+ Mage::log($szWording . "transaction couldn't be completed. " . $message);
780
+ $error = true;
781
+ //$message = PayVector_Tpg_Model_Common_GlobalErrors::ERROR_183 . "<br />" . $message;
782
+ break;
783
+ case "30":
784
+ default:
785
+ Mage::log($szWording . "transaction couldn't be completed. " . $message);
786
+ $error = true;
787
+ break;
788
+ }
789
+ $session->setPaymentprocessorresponse($message);
790
+ // store the CrossReference and other data
791
+ $this->setPaymentAdditionalInformation($payment, $szCrossReference);
792
+ if($error == true)
793
+ {
794
+ $message = Mage::helper('tpg')->__($message);
795
+ Mage::throwException($message);
796
+ }
797
+ else
798
+ {
799
+ $payment->setStatus(self::STATUS_APPROVED);
800
+ if($nVersion == 1324 || $nVersion == 1330)
801
+ {
802
+ $payment->setIsInvoicePaid(true);
803
+ Mage::getSingleton('core/session')->addSuccess($message);
804
+ }
805
+ }
806
+
807
+ return $this;
808
+ }
809
+
810
+ /**
811
+ * Override the core Mage function to get the URL to be redirected from the Onepage
812
+ *
813
+ * @return string
814
+ */
815
+ public function getOrderPlaceRedirectUrl()
816
+ {
817
+ $result = false;
818
+ $session = Mage::getSingleton('checkout/session');
819
+ $nVersion = $this->getVersion();
820
+ $mode = $this->getConfigData('mode');
821
+ if($session->getMd() &&
822
+ $session->getAcsurl() &&
823
+ $session->getPareq()
824
+ )
825
+ {
826
+ // Direct (API) for 3D Secure payments
827
+ if($nVersion >= 1410)
828
+ {
829
+ // need to re-add the ordered item quantity to stock as per not completed 3DS transaction
830
+ if($mode != PayVector_Tpg_Model_Source_PaymentMode::PAYMENT_MODE_TRANSPARENT_REDIRECT)
831
+ {
832
+ $order = Mage::getModel('sales/order')->load(Mage::getSingleton('checkout/session')->getLastOrderId());
833
+ $this->addOrderedItemsToStock($order);
834
+ }
835
+ }
836
+ $result = Mage::getUrl('tpg/payment/threedsecure', array('_secure' => true));
837
+ }
838
+ if($session->getHashdigest())
839
+ {
840
+ // Hosted Payment Form and Transparent Redirect payments
841
+ if($nVersion >= 1410)
842
+ {
843
+ // need to re-add the ordered item quantity to stock as per not completed 3DS transaction
844
+ if(!Mage::getSingleton('checkout/session')->getPares())
845
+ {
846
+ $order = Mage::getModel('sales/order')->load(Mage::getSingleton('checkout/session')->getLastOrderId());
847
+ $this->addOrderedItemsToStock($order);
848
+ }
849
+ }
850
+ $result = Mage::getUrl('tpg/payment/redirect', array('_secure' => true));
851
+ }
852
+
853
+ return $result;
854
+ }
855
+
856
+ /**
857
+ * Get the correct payment processor domain
858
+ *
859
+ * @return string
860
+ */
861
+ private function _getPaymentProcessorFullDomain()
862
+ {
863
+ $szPaymentProcessorFullDomain = null;
864
+ // get the stored config setting
865
+ $szPaymentProcessorDomain = $this->getConfigData('paymentprocessordomain');
866
+ $szPaymentProcessorPort = $this->getConfigData('paymentprocessorport');
867
+ if($szPaymentProcessorPort == '443')
868
+ {
869
+ $szPaymentProcessorFullDomain = $szPaymentProcessorDomain . "/";
870
+ }
871
+ else
872
+ {
873
+ $szPaymentProcessorFullDomain = $szPaymentProcessorDomain . ":" . $szPaymentProcessorPort . "/";
874
+ }
875
+
876
+ return $szPaymentProcessorFullDomain;
877
+ }
878
+
879
+ /**
880
+ * Get the country ISO3 code from the ISO2 code
881
+ *
882
+ * @param ISO2Code
883
+ * @return string|null
884
+ */
885
+ private function _getISO3Code($szISO2Code)
886
+ {
887
+ $szISO3Code = null;
888
+ $collection = null;
889
+ $boFound = false;
890
+ $nCount = 1;
891
+ $collection = Mage::getModel('directory/country_api')->items();
892
+ while($boFound == false &&
893
+ $nCount < count($collection))
894
+ {
895
+ $item = $collection[$nCount];
896
+ if($item['iso2_code'] == $szISO2Code)
897
+ {
898
+ $boFound = true;
899
+ $szISO3Code = $item['iso3_code'];
900
+ }
901
+ $nCount++;
902
+ }
903
+
904
+ return $szISO3Code;
905
+ }
906
+
907
+ /**
908
+ * Transform the string Magento version number into an integer ready for comparison
909
+ *
910
+ * @return int
911
+ */
912
+ public function getVersion()
913
+ {
914
+ $magentoVersion = Mage::getVersion();
915
+ $pattern = '/[^\d]/';
916
+ $magentoVersion = preg_replace($pattern, '', $magentoVersion);
917
+ while(strlen($magentoVersion) < 4)
918
+ {
919
+ $magentoVersion .= '0';
920
+ }
921
+ $magentoVersion = (int) $magentoVersion;
922
+
923
+ return $magentoVersion;
924
+ }
925
+
926
+ /**
927
+ * @param float $amount
928
+ * @param int $nExponent
929
+ * @return float
930
+ */
931
+ private function _getRoundedAmount($amount, $nExponent)
932
+ {
933
+ // round the amount before use
934
+ $amount = round($amount, $nExponent);
935
+ $power = pow(10, $nExponent);
936
+ $nDecimalAmount = $amount * $power;
937
+
938
+ return $nDecimalAmount;
939
+ }
940
+
941
+ /**
942
+ * Depreciated function - sets the additional_information column data in the sales_flat_order_payment table
943
+ *
944
+ * @param Varien_Object $payment
945
+ * @param string $szCrossReference
946
+ * @param string $szTransactionType
947
+ * @param string $szTransactionDate
948
+ */
949
+ public function setPaymentAdditionalInformation($payment, $szCrossReference)
950
+ {
951
+ $arAdditionalInformationArray = array();
952
+ $paymentAction = $this->getConfigData('payment_action');
953
+ if($paymentAction == Mage_Paygate_Model_Authorizenet::ACTION_AUTHORIZE_CAPTURE)
954
+ {
955
+ $szTransactionType = "SALE";
956
+ }
957
+ else if($paymentAction == Mage_Paygate_Model_Authorizenet::ACTION_AUTHORIZE)
958
+ {
959
+ $szTransactionType = "PREAUTH";
960
+ }
961
+ else
962
+ {
963
+ Mage::throwException('Unknown payment action: ' . $paymentAction);
964
+ }
965
+ $szTransactionDate = date("Ymd");
966
+ $arAdditionalInformationArray["CrossReference"] = $szCrossReference;
967
+ $arAdditionalInformationArray["TransactionType"] = $szTransactionType;
968
+ $arAdditionalInformationArray["TransactionDateTime"] = $szTransactionDate;
969
+ $payment->setAdditionalInformation($arAdditionalInformationArray);
970
+ }
971
+
972
+ /**
973
+ * Deduct the order items from the stock
974
+ *
975
+ * @param unknown_type $order
976
+ */
977
+ public function subtractOrderedItemsFromStock($order)
978
+ {
979
+ $nVersion = Mage::getModel('tpg/direct')->getVersion();
980
+ $isCustomStockManagementEnabled = Mage::getModel('tpg/direct')->getConfigData('customstockmanagementenabled');
981
+ if($nVersion >= 1410 &&
982
+ $isCustomStockManagementEnabled
983
+ )
984
+ {
985
+ $items = $order->getAllItems();
986
+ foreach($items as $itemId => $item)
987
+ {
988
+ // ordered quantity of the item from stock
989
+ $quantity = $item->getQtyOrdered();
990
+ $productId = $item->getProductId();
991
+ $stock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($productId);
992
+ $stockManagement = $stock->getManageStock();
993
+ if($stockManagement)
994
+ {
995
+ $stock->setQty($stock->getQty() - $quantity);
996
+ $stock->save();
997
+ }
998
+ }
999
+ }
1000
+ }
1001
+
1002
+ /**
1003
+ * Re-add the order items to the stock to balance the incorrect stock management before a payment is completed
1004
+ *
1005
+ * @param unknown_type $order
1006
+ */
1007
+ public function addOrderedItemsToStock($order)
1008
+ {
1009
+ $nVersion = Mage::getModel('tpg/direct')->getVersion();
1010
+ $isCustomStockManagementEnabled = Mage::getModel('tpg/direct')->getConfigData('customstockmanagementenabled');
1011
+ if($nVersion >= 1410 &&
1012
+ $isCustomStockManagementEnabled
1013
+ )
1014
+ {
1015
+ $items = $order->getAllItems();
1016
+ foreach($items as $itemId => $item)
1017
+ {
1018
+ // ordered quantity of the item from stock
1019
+ $quantity = $item->getQtyOrdered();
1020
+ $productId = $item->getProductId();
1021
+ $stock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($productId);
1022
+ $stockManagement = $stock->getManageStock();
1023
+ if($stockManagement)
1024
+ {
1025
+ $stock->setQty($stock->getQty() + $quantity);
1026
+ $stock->save();
1027
+ }
1028
+ }
1029
+ }
1030
+ }
1031
+
1032
+ /**
1033
+ * Override the refund function to run a CrossReference transaction
1034
+ *
1035
+ * @param Varien_Object $payment
1036
+ * @param int $amount
1037
+ * @return PayVector_Tpg_Model_Direct
1038
+ */
1039
+ public function refund(Varien_Object $payment, $amount)
1040
+ {
1041
+ $error = false;
1042
+ $szTransactionType = "REFUND";
1043
+ $orderStatus = 'TPG_refunded';
1044
+ $szMessage = 'Payment refunded';
1045
+ if($amount > 0)
1046
+ {
1047
+ $error = $this->_runCrossReferenceTransaction($payment, $szTransactionType, $amount);
1048
+ }
1049
+ else
1050
+ {
1051
+ $error = 'Error in refunding the payment';
1052
+ }
1053
+ if($error === false)
1054
+ {
1055
+ $order = $payment->getOrder();
1056
+ $payment = $order->getPayment();
1057
+ $arAdditionalInformationArray = $payment->getAdditionalInformation();
1058
+ $arAdditionalInformationArray["Refunded"] = 1;
1059
+ $payment->setAdditionalInformation($arAdditionalInformationArray);
1060
+ $payment->save();
1061
+ $order->setState('canceled', $orderStatus, $szMessage, false);
1062
+ $order->save();
1063
+ }
1064
+ else
1065
+ {
1066
+ Mage::throwException($error);
1067
+ }
1068
+
1069
+ return $this;
1070
+ }
1071
+
1072
+ /**
1073
+ * PayVector VOID functionality
1074
+ * Note: if a transaction (payment) is once voided (canceled) it isn't possible to redo this action
1075
+ *
1076
+ * @param Varien_Object $payment
1077
+ * @return bool
1078
+ */
1079
+ public function ircVoid(Varien_Object $payment)
1080
+ {
1081
+ $error = false;
1082
+ $szTransactionType = "VOID";
1083
+ $orderStatus = "TPG_voided";
1084
+ // attempt a VOID and accordingly to the last saved transaction id (CrossReference) set the new message
1085
+ $szLastTransId = $payment->getLastTransId();
1086
+ $transaction = $payment->getTransaction($szLastTransId);
1087
+ $szMagentoTxnType = $transaction->getTxnType();
1088
+ $szMessage = "Payment voided";
1089
+ if($szMagentoTxnType == "capture")
1090
+ {
1091
+ $szMessage = "Payment voided";
1092
+ }
1093
+ else if($szMagentoTxnType == "authorization")
1094
+ {
1095
+ $szMessage = "PreAuthorization voided";
1096
+ }
1097
+ else if($szMagentoTxnType == "refund")
1098
+ {
1099
+ $szMessage = "Refund voided";
1100
+ }
1101
+ else
1102
+ {
1103
+ // general message
1104
+ $szMessage = "Payment voided";
1105
+ }
1106
+ $error = $this->_runCrossReferenceTransaction($payment, $szTransactionType);
1107
+ if($error === false)
1108
+ {
1109
+ $order = $payment->getOrder();
1110
+ $invoices = $order->getInvoiceCollection();
1111
+ $payment = $order->getPayment();
1112
+ $arAdditionalInformationArray = $payment->getAdditionalInformation();
1113
+ $arAdditionalInformationArray["Voided"] = 1;
1114
+ $payment->setAdditionalInformation($arAdditionalInformationArray);
1115
+ $payment->save();
1116
+ // cancel the invoices
1117
+ foreach($invoices as $invoice)
1118
+ {
1119
+ $invoice->cancel();
1120
+ $invoice->save();
1121
+ }
1122
+ // update the order
1123
+ $order->setActionBy($payment->getLggdInAdminUname())
1124
+ ->setActionDate(date('Y-m-d H:i:s'))
1125
+ ->setVoided(1)
1126
+ ->setState('canceled', $orderStatus, $szMessage, false);
1127
+ $order->save();
1128
+ $result = "0";
1129
+ }
1130
+ else
1131
+ {
1132
+ $result = $error;
1133
+ }
1134
+
1135
+ return $result;
1136
+ }
1137
+
1138
+ /**
1139
+ * PayVector COLLECTION functionality (capture called in Magento)
1140
+ *
1141
+ * @param Varien_Object $payment
1142
+ * @param string $szOrderID
1143
+ * @param string $szCrossReference
1144
+ * @return bool
1145
+ */
1146
+ public function ircCollection(Varien_Object $payment, $szOrderID, $szCrossReference)
1147
+ {
1148
+ $szTransactionType = "COLLECTION";
1149
+ $orderStatus = 'TPG_collected';
1150
+ $szMessage = 'Preauthorization successfully collected';
1151
+ $state = Mage_Sales_Model_Order::STATE_PROCESSING;
1152
+ $error = $this->_captureAuthorizedPayment($payment);
1153
+ if($error === false)
1154
+ {
1155
+ $order = $payment->getOrder();
1156
+ $invoices = $order->getInvoiceCollection();
1157
+ $payment = $order->getPayment();
1158
+ $arAdditionalInformationArray = $payment->getAdditionalInformation();
1159
+ $arAdditionalInformationArray["Collected"] = 1;
1160
+ $payment->setAdditionalInformation($arAdditionalInformationArray);
1161
+ $payment->save();
1162
+ // update the invoices to paid status
1163
+ foreach($invoices as $invoice)
1164
+ {
1165
+ $invoice->pay()->save();
1166
+ }
1167
+ $order->setActionBy($payment->getLggdInAdminUname())
1168
+ ->setActionDate(date('Y-m-d H:i:s'))
1169
+ ->setState($state, $orderStatus, $szMessage, false);
1170
+ $order->save();
1171
+ $result = "0";
1172
+ }
1173
+ else
1174
+ {
1175
+ $result = $error;
1176
+ }
1177
+
1178
+ return $result;
1179
+ }
1180
+
1181
+ /**
1182
+ * Private capture function for an authorized payment
1183
+ *
1184
+ * @param Varien_Object $payment
1185
+ * @return unknown
1186
+ */
1187
+ private function _captureAuthorizedPayment(Varien_Object $payment)
1188
+ {
1189
+ $error = false;
1190
+ $session = Mage::getSingleton('checkout/session');
1191
+ try
1192
+ {
1193
+ // set the COLLECTION variable to true
1194
+ $session->setIsCollectionCrossReferenceTransaction(true);
1195
+ $invoice = $payment->getOrder()->prepareInvoice();
1196
+ $invoice->register();
1197
+ if($this->_canCapture)
1198
+ {
1199
+ $invoice->capture();
1200
+ }
1201
+ $payment->getOrder()->addRelatedObject($invoice);
1202
+ $payment->setCreatedInvoice($invoice);
1203
+ }
1204
+ catch(Exception $exc)
1205
+ {
1206
+ $error = "Couldn't capture pre-authorized payment. Message: " . $exc->getMessage();
1207
+ Mage::log($exc->getMessage());
1208
+ }
1209
+ // remove the COLLECTION session variable once finished the COLLECTION attempt
1210
+ $session->setIsCollectionCrossReferenceTransaction(null);
1211
+
1212
+ return $error;
1213
+ }
1214
+
1215
+ /**
1216
+ * Internal CrossReference function for all VOID, REFUND, COLLECTION transaction types
1217
+ *
1218
+ * @param Varien_Object $payment
1219
+ * @param string $szTransactionType
1220
+ * @param float $amount
1221
+ * @param bool $threeDSecureOverridePolicy Whether 3DSecure should be run on this transaction
1222
+ * @return string|bool
1223
+ */
1224
+ private function _runCrossReferenceTransaction(Varien_Object $payment, $szTransactionType, $amount = false, $threeDSecureOverridePolicy = null)
1225
+ {
1226
+ $error = false;
1227
+ $boTransactionProcessed = false;
1228
+ $szMerchantID = $this->getConfigData('merchantid');
1229
+ $szPassword = $this->getConfigData('password');
1230
+ $iclISOCurrencyList = ISOCurrencies::getISOCurrencyList();
1231
+ $iclISOCurrencyList;
1232
+ $order = $payment->getOrder();
1233
+ $szOrderID = $order->getRealOrderId();;
1234
+ //$szCrossReference = $payment->getLastTransId();
1235
+ $additionalInformation = $payment->getAdditionalInformation();
1236
+ $szCrossReference = $additionalInformation["CrossReference"];
1237
+ $szCrossReference = $payment->getLastTransId();
1238
+ //if cross reference isn't found then look for the customers last transaction
1239
+ if(!isset($szCrossReference))
1240
+ {
1241
+ if(Mage::getSingleton('customer/session')->isLoggedIn())
1242
+ {
1243
+ $customer = Mage::getSingleton('customer/session')->getCustomer();
1244
+ $customerID = $customer->getId();
1245
+ $orderPaymentTableName = Mage::getSingleton('core/resource')->getTableName('sales/order_payment');
1246
+ $orderCollection = Mage::getModel('sales/order')->getCollection()
1247
+ ->addFilter('customer_id', $customerID);
1248
+ $orderCollection->getSelect()
1249
+ ->join(
1250
+ array("order_payment" => $orderPaymentTableName),
1251
+ "main_table.entity_id=order_payment.entity_id",
1252
+ "order_payment.last_trans_id"
1253
+ );
1254
+ //check if a cross reference was set in any of the previous transactions by this customer
1255
+ foreach($orderCollection as $order)
1256
+ {
1257
+ $szCrossReference = $order->getLastTransId();
1258
+ if(isset($szCrossReference))
1259
+ {
1260
+ break;
1261
+ }
1262
+ }
1263
+ }
1264
+ }
1265
+ // check the CrossReference and TransactionType parameters
1266
+ if(!$szCrossReference)
1267
+ {
1268
+ $error = 'Error occurred for ' . $szTransactionType . ': Missing Cross Reference';
1269
+ }
1270
+ if(!$szTransactionType)
1271
+ {
1272
+ $error = 'Error occurred for ' . $szTransactionType . ': Missing Transaction Type';
1273
+ }
1274
+ if($error === false)
1275
+ {
1276
+ $PaymentProcessorFullDomain = $this->_getPaymentProcessorFullDomain();
1277
+ $rgeplRequestGatewayEntryPointList = new RequestGatewayEntryPointList();
1278
+ $rgeplRequestGatewayEntryPointList->add("https://gw1." . $PaymentProcessorFullDomain, 100, 2);
1279
+ $rgeplRequestGatewayEntryPointList->add("https://gw2." . $PaymentProcessorFullDomain, 200, 2);
1280
+ $rgeplRequestGatewayEntryPointList->add("https://gw3." . $PaymentProcessorFullDomain, 300, 2);
1281
+
1282
+ $rgeplRequestGatewayEntryPointList = $this->_getGatewayEntryPointList();
1283
+
1284
+ $crtCrossReferenceTransaction = new CrossReferenceTransaction($rgeplRequestGatewayEntryPointList);
1285
+ $crtCrossReferenceTransaction->getMerchantAuthentication()->setMerchantID($szMerchantID);
1286
+ $crtCrossReferenceTransaction->getMerchantAuthentication()->setPassword($szPassword);
1287
+ // if no amount is specified get the grand total amount
1288
+ if($amount === false)
1289
+ {
1290
+ $nAmount = $order->getBaseGrandTotal();
1291
+ }
1292
+ else
1293
+ {
1294
+ $nAmount = $amount;
1295
+ }
1296
+ $szCurrencyShort = $order->getOrderCurrency()->getCurrencyCode();
1297
+ if($szCurrencyShort != '' && $iclISOCurrencyList->getISOCurrency($szCurrencyShort, $icISOCurrency))
1298
+ {
1299
+ $nCurrencyCode = new NullableInt($icISOCurrency->getISOCode());
1300
+ $crtCrossReferenceTransaction->getTransactionDetails()->getCurrencyCode()->setValue($icISOCurrency->getISOCode());
1301
+ }
1302
+ // round the amount before use
1303
+ $nAmount = round($nAmount, $icISOCurrency->getExponent());
1304
+ $power = pow(10, $icISOCurrency->getExponent());
1305
+ $nDecimalAmount = $nAmount * $power;
1306
+ $crtCrossReferenceTransaction->getTransactionDetails()->setOrderID($szOrderID);
1307
+ $crtCrossReferenceTransaction->getTransactionDetails()->getAmount()->setValue($nDecimalAmount);
1308
+ $crtCrossReferenceTransaction->getTransactionDetails()->getMessageDetails()->setCrossReference($szCrossReference);
1309
+ $crtCrossReferenceTransaction->getTransactionDetails()->getMessageDetails()->setTransactionType($szTransactionType);
1310
+ if(isset($threeDSecureOverridePolicy))
1311
+ {
1312
+ $crtCrossReferenceTransaction->getTransactionDetails()->getTransactionControl()->getThreeDSecureOverridePolicy()->setValue($threeDSecureOverridePolicy);
1313
+ }
1314
+ $crtCrossReferenceTransaction->getTransactionDetails()->getTransactionControl()->getEchoCardType()->setValue(true);
1315
+ try
1316
+ {
1317
+ $boTransactionProcessed = $crtCrossReferenceTransaction->processTransaction($crtrCrossReferenceTransactionResult, $todTransactionOutputData);
1318
+ }
1319
+ catch(Exception $exc)
1320
+ {
1321
+ Mage::log("exception: " . $exc->getMessage());
1322
+ }
1323
+ $error = $this->_handleTransactionResults($payment, $boTransactionProcessed, $crtCrossReferenceTransaction, $crtrCrossReferenceTransactionResult, $todTransactionOutputData);
1324
+ // if ($boTransactionProcessed == false)
1325
+ // {
1326
+ // // could not communicate with the payment gateway
1327
+ // $error = "Couldn't complete ".$szTransactionType." transaction. Details: ".$crtCrossReferenceTransaction->getLastException();
1328
+ // $szLogMessage = $error;
1329
+ // }
1330
+ // else
1331
+ // {
1332
+ // switch($crtrCrossReferenceTransactionResult->getStatusCode())
1333
+ // {
1334
+ // case 0:
1335
+ // $error = false;
1336
+ // $szNewCrossReference = $todTransactionOutputData->getCrossReference();
1337
+ // $szLogMessage = $szTransactionType . " CrossReference transaction successfully completed. Response object: ";
1338
+ //
1339
+ // $payment->setTransactionId($szNewCrossReference)
1340
+ // ->setParentTransactionId($szCrossReference)
1341
+ // ->setIsTransactionClosed(1);
1342
+ // $payment->save();
1343
+ // break;
1344
+ // default:
1345
+ // $szLogMessage = $crtrCrossReferenceTransactionResult->getMessage();
1346
+ // if ($crtrCrossReferenceTransactionResult->getErrorMessages()->getCount() > 0)
1347
+ // {
1348
+ // $szLogMessage = $szLogMessage.".";
1349
+ //
1350
+ // for ($LoopIndex = 0; $LoopIndex < $crtrCrossReferenceTransactionResult->getErrorMessages()->getCount(); $LoopIndex++)
1351
+ // {
1352
+ // $szLogMessage = $szLogMessage.$crtrCrossReferenceTransactionResult->getErrorMessages()->getAt($LoopIndex).";";
1353
+ // }
1354
+ // $szLogMessage = $szLogMessage." ";
1355
+ // }
1356
+ //
1357
+ // $error = "Couldn't complete ".$szTransactionType." transaction for CrossReference: " . $szCrossReference . ". Payment Response: ".$szLogMessage;
1358
+ // $szLogMessage = $szTransactionType . " CrossReference transaction failed. Response object: ";
1359
+ // break;
1360
+ // }
1361
+ //
1362
+ // $szLogMessage = $szLogMessage.print_r($crtrCrossReferenceTransactionResult, 1);
1363
+ // }
1364
+ //
1365
+ // Mage::log($szLogMessage);
1366
+ }
1367
+
1368
+ return $error;
1369
+ }
1370
+
1371
+ private function _getGatewayEntryPointList()
1372
+ {
1373
+ $rgeplRequestGatewayEntryPointList = new RequestGatewayEntryPointList();
1374
+
1375
+ /* @var PayVector_Tpg_Model_Gatewayentrypoints $gatewayEntryPointsTable */
1376
+ $gatewayEntryPointsTable = Mage::getModel('tpg/gatewayentrypoints');
1377
+ $geplGatewayEntryPointListXML = $gatewayEntryPointsTable->getEntryPoints();
1378
+
1379
+ if($geplGatewayEntryPointListXML !== null && $geplGatewayEntryPointListXML !== false)
1380
+ {
1381
+ $geplGatewayEntryPointList = GatewayEntryPointList::fromXmlString($geplGatewayEntryPointListXML);
1382
+ for($nCount = 0; $nCount < $geplGatewayEntryPointList->getCount(); $nCount++)
1383
+ {
1384
+ $geplGatewayEntryPoint = $geplGatewayEntryPointList->getAt($nCount);
1385
+ $rgeplRequestGatewayEntryPointList->add($geplGatewayEntryPoint->getEntryPointURL(), $geplGatewayEntryPoint->getMetric(), 1);
1386
+ }
1387
+ }
1388
+ else
1389
+ {
1390
+ // if we don't have a recent list in the database then just use blind processing
1391
+ $paymentProcessorFullDomain = $this->_getPaymentProcessorFullDomain();
1392
+ $rgeplRequestGatewayEntryPointList->add("https://gw1." . $paymentProcessorFullDomain, 100, 2);
1393
+ $rgeplRequestGatewayEntryPointList->add("https://gw2." . $paymentProcessorFullDomain, 200, 2);
1394
+ $rgeplRequestGatewayEntryPointList->add("https://gw3." . $paymentProcessorFullDomain, 300, 2);
1395
+ }
1396
+ return $rgeplRequestGatewayEntryPointList;
1397
+ }
1398
+
1399
+ /**
1400
+ * @param PayVector_Sales_Model_Order_Payment $payment
1401
+ * @param bool $boTransactionProcessed
1402
+ * @param GatewayTransaction $toTransactionObject
1403
+ * @param GatewayOutput $troTransactionResultObject
1404
+ * @param TransactionOutputData $todTransactionOutputData
1405
+ * @return string|bool
1406
+ */
1407
+ private function _handleTransactionResults($payment, $boTransactionProcessed, $toTransactionObject, $troTransactionResultObject, $todTransactionOutputData)
1408
+ {
1409
+ $order = $payment->getOrder();
1410
+ $szOrderID = $payment->increment_id;
1411
+ $nVersion = $this->getVersion();
1412
+ if($boTransactionProcessed === false)
1413
+ {
1414
+ // could not communicate with the payment gateway
1415
+ $error = PayVector_Tpg_Model_Common_GlobalErrors::ERROR_261;
1416
+ if($toTransactionObject->getLastException())
1417
+ {
1418
+ $error .= " [ " . $toTransactionObject->getLastException() . " ]";
1419
+ }
1420
+ $szLogMessage =
1421
+ "Couldn't complete transaction. Details: " . print_r($troTransactionResultObject, 1) . " " . print_r($todTransactionOutputData, 1); //Couldn't communicate with payment gateway.
1422
+ Mage::log($szLogMessage);
1423
+ Mage::log("Last exception: " . print_r($toTransactionObject->getLastException(), 1));
1424
+ }
1425
+ else
1426
+ {
1427
+ $currentTimestamp = Mage::getSingleton('core/date')->gmtDate();
1428
+
1429
+ if (!empty($todTransactionOutputData))
1430
+ {
1431
+ $szCrossReference = $todTransactionOutputData->getCrossReference();
1432
+ $payment->setTransactionId($szCrossReference);
1433
+
1434
+ $gatewayEntryPoints = $todTransactionOutputData->getGatewayEntryPoints();
1435
+
1436
+ if (!empty($gatewayEntryPoints))
1437
+ {
1438
+ $gatewayEntryPointsListXML = $todTransactionOutputData->getGatewayEntryPoints()->toXmlString();
1439
+
1440
+ $gatewayEntryPointsTable = Mage::getResourceModel('tpg/gatewayentrypoints');
1441
+ $gatewayEntryPointsTable->saveEntryPoints($gatewayEntryPointsListXML, $currentTimestamp);
1442
+ }
1443
+ }
1444
+
1445
+
1446
+ $szLogMessage = "Transaction could not be completed for OrderID: " . $szOrderID . ". Result details: ";
1447
+ $szNotificationMessage = 'Payment Processor Response: ' . $troTransactionResultObject->getMessage();
1448
+ /* serve out the CrossReference as the TransactionId - this need to be done to enable the "Refund" button
1449
+ in the Magento CreditMemo internal refund mechanism */
1450
+ switch($troTransactionResultObject->getStatusCode())
1451
+ {
1452
+ case 0:
1453
+ // status code of 0 - means transaction successful
1454
+ $szLogMessage = "Transaction successfully completed for OrderID: " . $szOrderID . ". Response object: ";
1455
+ // serve out the CrossReference as a TransactionId in the Magento system
1456
+ $order->setCustomerNote($szNotificationMessage);
1457
+ $this->setPaymentAdditionalInformation($payment, $szCrossReference);
1458
+ $payment->setCcType($todTransactionOutputData->getCardTypeData()->getCardType());
1459
+ $payment->setCcLast4(Mage::getModel('customer/session')->getData('payvector_card_last_four'));
1460
+ // deactivate the current quote - fixing the cart not emptied bug
1461
+ Mage::getSingleton('checkout/session')->getQuote()->setIsActive(false)->save();
1462
+ // add the success message
1463
+ Mage::getSingleton('core/session')->addSuccess($szNotificationMessage);
1464
+ break;
1465
+ case 3:
1466
+ // status code of 3 - means 3D Secure authentication required
1467
+ $szLogMessage = "3D Secure Authentication required for OrderID: " . $szOrderID . ". Response object: ";
1468
+ $szNotificationMessage = '';
1469
+ $szPaReq = $todTransactionOutputData->getThreeDSecureOutputData()->getPaREQ();
1470
+ $szACSURL = $todTransactionOutputData->getThreeDSecureOutputData()->getACSURL();
1471
+ Mage::getSingleton('checkout/session')->setMd($szCrossReference)
1472
+ ->setAcsurl($szACSURL)
1473
+ ->setPareq($szPaReq);
1474
+ if($nVersion >= 1410)
1475
+ {
1476
+ Mage::getSingleton('checkout/session')->setRedirectionMethod('_run3DSecureTransaction');
1477
+ $order->setIsThreeDSecurePending(true);
1478
+ }
1479
+ break;
1480
+ case 5:
1481
+ // status code of 5 - means transaction declined
1482
+ $error = PayVector_Tpg_Model_Common_GlobalErrors::ERROR_182;
1483
+ $error .= $szNotificationMessage;
1484
+ break;
1485
+ case 20:
1486
+ // status code of 20 - means duplicate transaction
1487
+ $szPreviousTransactionMessage = $troTransactionResultObject->getPreviousTransactionResult()->getMessage();
1488
+ $szLogMessage =
1489
+ "Duplicate transaction for OrderID: " .
1490
+ $szOrderID .
1491
+ ". A duplicate transaction means that a transaction with these details has already been processed by the payment provider. The details of the original transaction: " .
1492
+ $szPreviousTransactionMessage .
1493
+ ". Response object: ";
1494
+ $szNotificationMessage =
1495
+ $szNotificationMessage .
1496
+ ". A duplicate transaction means that a transaction with these details has already been processed by the payment provider. The details of the original transaction - Previous Transaction Response: " .
1497
+ $szPreviousTransactionMessage;
1498
+ if($troTransactionResultObject->getPreviousTransactionResult()->getStatusCode()->getValue() != 0)
1499
+ {
1500
+ $error = PayVector_Tpg_Model_Common_GlobalErrors::ERROR_182;
1501
+ $error .= $szNotificationMessage;
1502
+ }
1503
+ else
1504
+ {
1505
+ Mage::getSingleton('core/session')->addSuccess($szNotificationMessage);
1506
+ }
1507
+ break;
1508
+ case 30:
1509
+ // status code of 30 - means an error occurred
1510
+ $error = PayVector_Tpg_Model_Common_GlobalErrors::ERROR_183;
1511
+ $error .= $szNotificationMessage;
1512
+ $szLogMessage = "Transaction could not be completed for OrderID: " . $szOrderID . ". Error message: " . $troTransactionResultObject->getMessage();
1513
+ if($troTransactionResultObject->getErrorMessages()->getCount() > 0)
1514
+ {
1515
+ $szLogMessage = $szLogMessage . ".";
1516
+ for($LoopIndex = 0; $LoopIndex < $troTransactionResultObject->getErrorMessages()->getCount(); $LoopIndex++)
1517
+ {
1518
+ $szLogMessage = $szLogMessage . $troTransactionResultObject->getErrorMessages()->getAt($LoopIndex) . ";";
1519
+ }
1520
+ $szLogMessage = $szLogMessage . " ";
1521
+ }
1522
+ $szLogMessage = $szLogMessage . ' Response object: ';
1523
+ break;
1524
+ default:
1525
+ // unhandled status code
1526
+ $error = $szNotificationMessage;
1527
+ break;
1528
+ }
1529
+ $szLogMessage = $szLogMessage . print_r($troTransactionResultObject, 1);
1530
+ Mage::log($szLogMessage);
1531
+ }
1532
+ if($error)
1533
+ {
1534
+ $payment->setStatus('FAIL')
1535
+ ->setCcApproval('FAIL');
1536
+ }
1537
+ else
1538
+ {
1539
+ if($nVersion == 1324 || $nVersion == 1330)
1540
+ {
1541
+ $payment->setIsInvoicePaid(true);
1542
+ }
1543
+ }
1544
+
1545
+ return $error;
1546
+ }
1547
+ }
app/code/local/PayVector/Tpg/Model/Direct.php CHANGED
@@ -96,6 +96,9 @@ class PayVector_Tpg_Model_Direct extends Mage_Payment_Model_Method_Abstract
96
  else
97
  {
98
  $mode = $this->getConfigData('mode');
 
 
 
99
  // TODO : need to finish for non Direct API methods
100
  switch($mode)
101
  {
@@ -182,6 +185,9 @@ class PayVector_Tpg_Model_Direct extends Mage_Payment_Model_Method_Abstract
182
  ->setAcsurl(null)
183
  ->setPaymentprocessorresponse(null);
184
  $payment->setAmount($amount);
 
 
 
185
  switch($mode)
186
  {
187
  case PayVector_Tpg_Model_Source_PaymentMode::PAYMENT_MODE_DIRECT_API:
@@ -223,8 +229,24 @@ class PayVector_Tpg_Model_Direct extends Mage_Payment_Model_Method_Abstract
223
  */
224
  public function _runTransaction(Varien_Object $payment, $amount)
225
  {
226
- $MerchantID = $this->getConfigData('merchantid');
227
- $Password = $this->getConfigData('password');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
228
  $SecretKey = $this->getConfigData('secretkey');
229
  // assign payment form field values to variables
230
  $order = $payment->getOrder();
@@ -285,7 +307,11 @@ class PayVector_Tpg_Model_Direct extends Mage_Payment_Model_Method_Abstract
285
  $cdtCardDetailsTransaction->getTransactionDetails()->getTransactionControl()->getEchoAmountReceived()->setValue(true);
286
  $cdtCardDetailsTransaction->getTransactionDetails()->getTransactionControl()->getEchoAVSCheckResult()->setValue(true);
287
  $cdtCardDetailsTransaction->getTransactionDetails()->getTransactionControl()->getEchoCV2CheckResult()->setValue(true);
288
- $cdtCardDetailsTransaction->getTransactionDetails()->getTransactionControl()->getThreeDSecureOverridePolicy()->setValue(true);
 
 
 
 
289
  $cdtCardDetailsTransaction->getTransactionDetails()->getTransactionControl()->getDuplicateDelay()->setValue(60);
290
  $cdtCardDetailsTransaction->getTransactionDetails()->getThreeDSecureBrowserDetails()->getDeviceCategory()->setValue(0);
291
  $cdtCardDetailsTransaction->getTransactionDetails()->getThreeDSecureBrowserDetails()->setAcceptHeaders("*/*");
96
  else
97
  {
98
  $mode = $this->getConfigData('mode');
99
+ if (Mage::app()->getStore()->isAdmin()) {
100
+ $mode = PayVector_Tpg_Model_Source_PaymentMode::PAYMENT_MODE_DIRECT_API;
101
+ }
102
  // TODO : need to finish for non Direct API methods
103
  switch($mode)
104
  {
185
  ->setAcsurl(null)
186
  ->setPaymentprocessorresponse(null);
187
  $payment->setAmount($amount);
188
+ if (Mage::app()->getStore()->isAdmin()) {
189
+ $mode = PayVector_Tpg_Model_Source_PaymentMode::PAYMENT_MODE_DIRECT_API;
190
+ }
191
  switch($mode)
192
  {
193
  case PayVector_Tpg_Model_Source_PaymentMode::PAYMENT_MODE_DIRECT_API:
229
  */
230
  public function _runTransaction(Varien_Object $payment, $amount)
231
  {
232
+ if (Mage::app()->getStore()->isAdmin()) {
233
+
234
+ $MotoMerchantID = $this->getConfigData('motomerchantid');
235
+ $MotoPassword = $this->getConfigData('motopassword');
236
+ if($MotoMerchantID!='' && $MotoPassword!=''){
237
+ $MerchantID=$MotoMerchantID;
238
+ $Password=$MotoPassword;
239
+ }else{
240
+ $MerchantID = $this->getConfigData('merchantid');
241
+ $Password = $this->getConfigData('password');
242
+ }
243
+ }else{
244
+
245
+ $MerchantID = $this->getConfigData('merchantid');
246
+ $Password = $this->getConfigData('password');
247
+
248
+ }
249
+
250
  $SecretKey = $this->getConfigData('secretkey');
251
  // assign payment form field values to variables
252
  $order = $payment->getOrder();
307
  $cdtCardDetailsTransaction->getTransactionDetails()->getTransactionControl()->getEchoAmountReceived()->setValue(true);
308
  $cdtCardDetailsTransaction->getTransactionDetails()->getTransactionControl()->getEchoAVSCheckResult()->setValue(true);
309
  $cdtCardDetailsTransaction->getTransactionDetails()->getTransactionControl()->getEchoCV2CheckResult()->setValue(true);
310
+ if (Mage::app()->getStore()->isAdmin()) {
311
+ $cdtCardDetailsTransaction->getTransactionDetails()->getTransactionControl()->getThreeDSecureOverridePolicy()->setValue(false);
312
+ }else{
313
+ $cdtCardDetailsTransaction->getTransactionDetails()->getTransactionControl()->getThreeDSecureOverridePolicy()->setValue(true);
314
+ }
315
  $cdtCardDetailsTransaction->getTransactionDetails()->getTransactionControl()->getDuplicateDelay()->setValue(60);
316
  $cdtCardDetailsTransaction->getTransactionDetails()->getThreeDSecureBrowserDetails()->getDeviceCategory()->setValue(0);
317
  $cdtCardDetailsTransaction->getTransactionDetails()->getThreeDSecureBrowserDetails()->setAcceptHeaders("*/*");
app/code/local/PayVector/Tpg/controllers/PaymentController.php CHANGED
@@ -57,10 +57,10 @@ class PayVector_Tpg_PaymentController extends Mage_Core_Controller_Front_Action
57
  * @return unknown
58
  */
59
  public function callback3dAction()
60
- {
61
  $boError = false;
62
  $szMessage = '';
63
- $checkout = Mage::getSingleton('checkout/type_onepage');
64
  $session = Mage::getSingleton('checkout/session');
65
  $szPaymentProcessorResponse = '';
66
  $nVersion = Mage::getModel('tpg/direct')->getVersion();
57
  * @return unknown
58
  */
59
  public function callback3dAction()
60
+ {
61
  $boError = false;
62
  $szMessage = '';
63
+ $checkout = new PayVector_Checkout_Model_Type_Onepage();//Mage::getSingleton('checkout/type_onepage');
64
  $session = Mage::getSingleton('checkout/session');
65
  $szPaymentProcessorResponse = '';
66
  $nVersion = Mage::getModel('tpg/direct')->getVersion();
app/code/local/PayVector/Tpg/etc/system.xml CHANGED
@@ -69,6 +69,22 @@
69
  <show_in_website>1</show_in_website>
70
  <show_in_store>0</show_in_store>
71
  </password>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
  <presharedkey translate="label">
73
  <label>Pre Shared Key</label>
74
  <frontend_type>text</frontend_type>
69
  <show_in_website>1</show_in_website>
70
  <show_in_store>0</show_in_store>
71
  </password>
72
+ <motomerchantid translate="label">
73
+ <label>MOTO Merchant ID</label>
74
+ <frontend_type>text</frontend_type>
75
+ <sort_order>71</sort_order>
76
+ <show_in_default>1</show_in_default>
77
+ <show_in_website>1</show_in_website>
78
+ <show_in_store>0</show_in_store>
79
+ </motomerchantid>
80
+ <motopassword translate="label">
81
+ <label>MOTO Password</label>
82
+ <frontend_type>password</frontend_type>
83
+ <sort_order>72</sort_order>
84
+ <show_in_default>1</show_in_default>
85
+ <show_in_website>1</show_in_website>
86
+ <show_in_store>0</show_in_store>
87
+ </motopassword>
88
  <presharedkey translate="label">
89
  <label>Pre Shared Key</label>
90
  <frontend_type>text</frontend_type>
app/design/adminhtml/base/default/template/tpg/form.phtml CHANGED
@@ -1,16 +1,6 @@
1
  <?php $direct = Mage::getModel('tpg/direct'); ?>
2
  <?php $_code = $this->getMethodCode() ?>
3
  <?php $route = $this->getRequest()->getRequestedRouteName(); if($route == 'onestepcheckout'){ $fieldCode = '['.$_code.']'; } else { $fieldCode = ''; }?>
4
-
5
- <?php if ($direct->getConfigData('mode') == PayVector_Tpg_Model_Source_PaymentMode::PAYMENT_MODE_HOSTED_PAYMENT_FORM) {?>
6
- <fieldset class="form-list">
7
- <ul id="payment_form_<?php echo $_code ?>" style="display:none">
8
- <li>
9
- <?php echo $this->__('You will be redirected to a secure page where you can complete your payment.') ?>
10
- </li>
11
- </ul>
12
- </fieldset>
13
- <?php } else {?>
14
  <fieldset class="form-list">
15
  <ul id="payment_form_<?php echo $_code; ?>" style="display:none">
16
  <li>
@@ -86,4 +76,3 @@
86
  </li>
87
  </ul>
88
  </fieldset>
89
- <?php }?>
1
  <?php $direct = Mage::getModel('tpg/direct'); ?>
2
  <?php $_code = $this->getMethodCode() ?>
3
  <?php $route = $this->getRequest()->getRequestedRouteName(); if($route == 'onestepcheckout'){ $fieldCode = '['.$_code.']'; } else { $fieldCode = ''; }?>
 
 
 
 
 
 
 
 
 
 
4
  <fieldset class="form-list">
5
  <ul id="payment_form_<?php echo $_code; ?>" style="display:none">
6
  <li>
76
  </li>
77
  </ul>
78
  </fieldset>
 
app/design/adminhtml/default/default/template/payment/info/cc_tpg.phtml DELETED
@@ -1,172 +0,0 @@
1
- <?php
2
- $m_boTransactionAuthorised = false;
3
- $m_boValidCrossReference = false;
4
- $m_boExtensionVersionWithCrossReferenceFeature = true;
5
-
6
- $m_order = $this->getInfo()->getOrder();
7
- $m_payment = $m_order->getPayment();
8
- $m_szOrderID = $m_order->getRealOrderId();
9
- $m_szOrderStatus = $m_order->getStatus();
10
- $m_szAmount = $m_order->getBaseGrandTotal();
11
- $m_nPaymentVoided = 0;//(int)$m_order->getVoided();
12
- $m_nPaymentRefunded = 0;
13
- $m_nPaymentCollected = 0;
14
- $m_boCanVoid = false;
15
- $m_boCanCollect = false;
16
-
17
- // get the additional information column data for a Magento payment
18
- $additional_info = $m_payment->getAdditionalInformation();
19
- $szToday = date("Ymd");
20
-
21
- // for redirected transactions the TransactionId can't be updated with a new CrossReference (ie: 3DS transaction), need to revert back to additional_info
22
- //$szCrossReference = $m_payment->getLastTransId();
23
- $additionalInfo = $m_payment->getAdditionalInformation();
24
- if(!key_exists("CrossReference", $additionalInfo))
25
- {
26
- $szCrossReference = false;
27
- }
28
- else
29
- {
30
- $szCrossReference = $additional_info["CrossReference"];
31
- }
32
-
33
- if(!key_exists("TransactionDateTime", $additionalInfo))
34
- {
35
- $szTransactionDateTime = false;
36
- }
37
- else
38
- {
39
- $szTransactionDateTime = $additional_info["TransactionDateTime"];
40
- }
41
-
42
- if(!key_exists("TransactionType", $additionalInfo))
43
- {
44
- $szTransactionType = false;
45
- }
46
- else
47
- {
48
- $szTransactionType = $additional_info["TransactionType"];
49
- }
50
-
51
- if(key_exists("Voided", $additionalInfo))
52
- {
53
- $m_nPaymentVoided = (int)$additional_info["Voided"];
54
- }
55
- if(key_exists("Refunded", $additionalInfo))
56
- {
57
- $m_nPaymentRefunded = (int)$additional_info["Refunded"];
58
- }
59
- if(key_exists("Collected", $additionalInfo))
60
- {
61
- $m_nPaymentCollected = (int)$additional_info["Collected"];
62
- }
63
-
64
- if(!$szCrossReference ||
65
- !$szTransactionDateTime ||
66
- !$szTransactionType)
67
- {
68
- $m_boExtensionVersionWithCrossReferenceFeature = false;
69
- }
70
- else
71
- {
72
- if($szTransactionType == 'PREAUTH')
73
- {
74
- $m_szTransactionType = "PREAUTH";
75
-
76
- // check if payment can be voided
77
- if (!$m_nPaymentVoided &&
78
- !$m_nPaymentRefunded &&
79
- // payment must be successful
80
- $m_szOrderStatus == "irc_preauth")
81
- {
82
- if (strtotime($szToday) == strtotime($szTransactionDateTime))
83
- {
84
- $m_boCanVoid = true;
85
- }
86
- }
87
-
88
- // check if payment can be collected
89
- if(!$m_nPaymentVoided &&
90
- !$m_nPaymentCollected &&
91
- // payment must be successful
92
- $m_szOrderStatus == "irc_preauth")
93
- {
94
- $m_boCanCollect = true;
95
- }
96
- }
97
- else if($szTransactionType == 'SALE')
98
- {
99
- $m_szTransactionType = "SALE";
100
-
101
- // check if payment can be voided
102
- if(!$m_nPaymentVoided &&
103
- !$m_nPaymentRefunded &&
104
- // payment must be successful
105
- $m_szOrderStatus == "irc_paid")
106
- {
107
- if(strtotime($szToday) == strtotime($szTransactionDateTime) &&
108
- // for the time being only allow to execute a root VOID
109
- $m_szOrderStatus == "irc_paid")
110
- {
111
- $m_boCanVoid = true;
112
- }
113
- }
114
-
115
- // check if it can be collected - only preauth can be collected
116
- $m_nPaymentCollected = 0;
117
- }
118
- else
119
- {
120
- Mage::log('Order info error: transaction type: '.$szTransactionType.' is not supported by the PayVector/Tpg extension');
121
- }
122
- }
123
- ?>
124
-
125
- <div>
126
- CrossReference:
127
- <?php
128
- if(!$m_boExtensionVersionWithCrossReferenceFeature)
129
- {
130
- echo "<span style=\"font-weight:bold;color:Red;\">Missing data*</span>";
131
- }
132
- else
133
- {
134
- echo "<span style=\"font-weight:bold;\">".$szCrossReference."</span>";
135
- }
136
- ?>
137
- </div>
138
- <div>
139
- Transaction Type:
140
- <?php
141
- if(!$m_boExtensionVersionWithCrossReferenceFeature)
142
- {
143
- echo "<span style=\"font-weight:bold;color:Red;\">Missing data*</span>";
144
- }
145
- else
146
- {
147
- echo "<span style=\"font-weight:bold;\">".$m_szTransactionType."</span>";
148
- }
149
- ?>
150
- </div>
151
- <div>
152
- Amount: <?php echo "<span style=\"font-weight:bold\">".$m_szAmount."</span>"; ?>
153
- </div>
154
-
155
- <?php if(!$m_boExtensionVersionWithCrossReferenceFeature): ?>
156
- <div>
157
- <span style="font-weight:bold;color:Red;">* Incomplete orders and orders processed through an older payment extension will not have all the data necessary for CrossReference payments</span>
158
- </div>
159
- <?php else: ?>
160
- <div>
161
- <?php if($m_boCanVoid): ?>
162
- <button type="button" id="voidButton" onclick="IRC_runCrossReferenceTransaction('<?php echo $this->getUrl('tpg/payment/void', array('_secure' => true)); ?>', '<?php echo $m_szOrderID; ?>', '<?php echo $szCrossReference; ?>', 'VOID');">
163
- <span>VOID</span>
164
- </button>
165
- <?php endif; ?>
166
- <?php if($m_boCanCollect): ?>
167
- <button type="button" id="collectionButton" onclick="IRC_runCrossReferenceTransaction('<?php echo $this->getUrl('tpg/payment/collection', array('_secure' => true)); ?>', '<?php echo $m_szOrderID; ?>', '<?php echo $szCrossReference; ?>', 'COLLECTION');">
168
- <span>COLLECT</span>
169
- </button>
170
- <?php endif; ?>
171
- </div>
172
- <?php endif; ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/adminhtml/default/default/template/tpg/form.phtml CHANGED
@@ -2,7 +2,7 @@
2
  <?php $_code = $this->getMethodCode() ?>
3
  <?php $route = $this->getRequest()->getRequestedRouteName(); if($route == 'onestepcheckout'){ $fieldCode = '['.$_code.']'; } else { $fieldCode = ''; }?>
4
 
5
- <?php if ($direct->getConfigData('mode') == PayVector_Tpg_Model_Source_PaymentMode::PAYMENT_MODE_HOSTED_PAYMENT_FORM) {?>
6
  <fieldset class="form-list">
7
  <ul id="payment_form_<?php echo $_code ?>" style="display:none">
8
  <li>
@@ -10,7 +10,7 @@
10
  </li>
11
  </ul>
12
  </fieldset>
13
- <?php } else {?>
14
  <fieldset class="form-list">
15
  <ul id="payment_form_<?php echo $_code; ?>" style="display:none">
16
  <li>
@@ -86,4 +86,4 @@
86
  </li>
87
  </ul>
88
  </fieldset>
89
- <?php }?>
2
  <?php $_code = $this->getMethodCode() ?>
3
  <?php $route = $this->getRequest()->getRequestedRouteName(); if($route == 'onestepcheckout'){ $fieldCode = '['.$_code.']'; } else { $fieldCode = ''; }?>
4
 
5
+ <?php /*if ($direct->getConfigData('mode') == PayVector_Tpg_Model_Source_PaymentMode::PAYMENT_MODE_HOSTED_PAYMENT_FORM) {?>
6
  <fieldset class="form-list">
7
  <ul id="payment_form_<?php echo $_code ?>" style="display:none">
8
  <li>
10
  </li>
11
  </ul>
12
  </fieldset>
13
+ <?php } else {*/?>
14
  <fieldset class="form-list">
15
  <ul id="payment_form_<?php echo $_code; ?>" style="display:none">
16
  <li>
86
  </li>
87
  </ul>
88
  </fieldset>
89
+ <?php //}?>
app/design/frontend/default/default/template/tpg/form.phtml DELETED
@@ -1,95 +0,0 @@
1
- <?php $direct = Mage::getModel('tpg/direct'); ?>
2
- <?php $_code=$this->getMethodCode(); ?>
3
- <?php $route = $this->getRequest()->getRequestedRouteName(); if($route == 'onestepcheckout'){ $fieldCode = '['.$_code.']'; } else { $fieldCode = ''; }?>
4
-
5
- <?php if ($direct->getConfigData('mode') == PayVector_Tpg_Model_Source_PaymentMode::PAYMENT_MODE_HOSTED_PAYMENT_FORM) {?>
6
- <fieldset class="form-list">
7
- <ul id="payment_form_<?php echo $_code ?>" style="display:none">
8
- <li>
9
- <img alt="<?php echo $this->__('PayVector Corporation Logo'); ?>" src="<?php echo $this->getSkinUrl('images/payvector.png'); ?>">
10
- </li>
11
- <li>
12
- <?php echo $this->__('You will be redirected to a secure page where you can complete your payment.') ?>
13
- </li>
14
- <li class='notice-msg'>
15
- <?php echo $this->__('Please do not attempt to click the "BACK" button in your browser once you were redirected to the secure payment page to complete your payment. If you need to change your order you can do it before placing your order.') ?>
16
- </li>
17
- </ul>
18
- </fieldset>
19
- <?php } else {?>
20
- <fieldset class="form-list">
21
- <ul id="payment_form_<?php echo $_code; ?>" style="display:none">
22
- <li>
23
- <div class="input-box">
24
- <label for="<?php echo $_code; ?>_cc_owner"><?php echo $this->__('Name On Card') ?> <span class="required">*</span></label><br/>
25
- <input type="text" title="<?php echo $this->__('Name On Card') ?>" class="input-text required-entry validate-length maximum-length-100" id="<?php echo $_code; ?>_cc_owner" name="payment<?php echo $fieldCode; ?>[cc_owner]" value="<?php echo $this->htmlEscape($this->getInfoData('cc_owner')) ?>"/>
26
- </div>
27
- </li>
28
- <li>
29
- <div class="input-box">
30
- <label for="<?php echo $_code; ?>_cc_number"><?php echo $this->__('Card Number') ?> <span class="required">*</span></label><br/>
31
- <input type="text" id="<?php echo $_code; ?>_cc_number" name="payment<?php echo $fieldCode; ?>[cc_number]" title="<?php echo $this->__('Card Number') ?>" class="input-text required-entry validate-digits validate-length maximum-length-20 validate-cc-number" value=""/>
32
- </div>
33
- </li>
34
- <li>
35
- <label for="<?php echo $_code; ?>_cc_ss_start_month"><?php echo $this->__('Start Date') ?></label><br />
36
- <div class="input-box">
37
- <div class="v-fix">
38
- <select id="<?php echo $_code; ?>_cc_ss_start_month" name="payment<?php echo $fieldCode; ?>[cc_ss_start_month]" class="month">
39
- <option value=""></option>
40
- <?php $_ccStartMonth = $this->getInfoData('cc_ss_start_month') ?>
41
- <?php foreach ($this->getCcStartMonths() as $k=>$v): ?>
42
- <option value="<?php echo $k?$k:'' ?>"<?php if($k==$_ccStartMonth): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
43
- <?php endforeach ?>
44
- </select>
45
- </div>
46
- <div class="v-fix">
47
- <?php $_ccStartYear = $this->getInfoData('cc_ss_start_year') ?>
48
- <select id="<?php echo $_code ?>_cc_ss_start_year" name="payment<?php echo $fieldCode; ?>[cc_ss_start_year]" class="year">
49
- <option value=""></option>
50
- <?php foreach ($this->getCcStartYears() as $k=>$v): ?>
51
- <option value="<?php echo $k?$k:'' ?>"<?php if($k==$_ccStartYear): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
52
- <?php endforeach ?>
53
- </select>
54
- </div>
55
- </div>
56
- </li>
57
- <li>
58
- <label for="<?php echo $_code; ?>_expiration"><?php echo $this->__('Expiry Date') ?> <span class="required">*</span></label><br/>
59
- <div class="input-box">
60
- <div class="v-fix">
61
- <select id="<?php echo $_code; ?>_expiration" name="payment<?php echo $fieldCode; ?>[cc_exp_month]" class="month validate-cc-exp required-entry">
62
- <?php $_ccExpMonth = $this->getInfoData('cc_exp_month') ?>
63
- <?php foreach ($this->getCcMonths() as $k=>$v): ?>
64
- <option value="<?php echo $k?$k:'' ?>" <?php if($k==$_ccExpMonth): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
65
- <?php endforeach ?>
66
- </select>
67
- </div>
68
-
69
- <div class="v-fix">
70
- <?php $_ccExpYear = $this->getInfoData('cc_exp_year') ?>
71
- <select id="<?php echo $_code; ?>_expiration_yr" name="payment<?php echo $fieldCode; ?>[cc_exp_year]" class="year required-entry">
72
- <?php foreach ($this->getCcYears() as $k=>$v): ?>
73
- <option value="<?php echo $k?$k:'' ?>" <?php if($k==$_ccExpYear): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
74
- <?php endforeach ?>
75
- </select>
76
- </div>
77
- </div>
78
- </li>
79
- <li>
80
- <div class="input-box">
81
- <label for="<?php echo $_code; ?>_cc_ss_issue"><?php echo $this->__('Issue Number') ?></label><br />
82
- <div class="v-fix"><input type="text" title="<?php echo $this->__('Issue Number') ?>" class="input-text validate-digits validate-length maximum-length-2" style="width:50px;" id="<?php echo $_code ?>_cc_ss_issue" name="payment<?php echo $fieldCode; ?>[cc_ss_issue]" value="" /></div>
83
- </div>
84
- </li>
85
- <li>
86
- <div class="input-box">
87
- <label for="<?php echo $_code; ?>_cc_cid"><?php echo $this->__('CV2') ?> <span class="required">*</span></label><br/>
88
- <div class="v-fix"><input type="text" title="<?php echo $this->__('CV2') ?>" class="input-text required-entry validate-digits validate-length minimum-length-3 maximum-length-4" style="width:50px;" id="<?php echo $_code; ?>_cc_cid" name="payment<?php echo $fieldCode; ?>[cc_cid]" value=""/></div>
89
- &nbsp;
90
- <a href="#" class="cvv-what-is-this"><?php echo $this->__('What is this?') ?></a>
91
- </div>
92
- </li>
93
- </ul>
94
- </fieldset>
95
- <?php }?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/default/default/template/tpg/info.phtml DELETED
@@ -1,17 +0,0 @@
1
- <?php $direct = Mage::getModel('tpg/direct'); ?>
2
- <?php if ($direct->getConfigData('mode') != PayVector_Tpg_Model_Source_PaymentMode::PAYMENT_MODE_DIRECT_API) {?>
3
- <?php if ($direct->getConfigData('mode') == PayVector_Tpg_Model_Source_PaymentMode::PAYMENT_MODE_HOSTED_PAYMENT_FORM) {?>
4
- <?php echo $this->__('PayVector Hosted Payment'); ?>
5
- <?php } else {?>
6
- <?php echo $this->__('PayVector Transparent Redirect'); ?>
7
- <?php }?>
8
- <?php } else {?>
9
- <?php if($_info = $this->getInfo()): ?>
10
- <?php echo $this->__('Name on the Card: %s', $this->htmlEscape($this->getInfo()->getCcOwner())) ?>
11
- <br/>
12
- <?php echo $this->__('Card Number: xxxx-%s', $this->htmlEscape($this->getInfo()->getCcLast4())) ?>
13
- <br/>
14
- <?php echo $this->__('Expiration Date: %s/%s', $this->htmlEscape($this->getInfo()->getCcExpMonth()), $this->htmlEscape($this->getInfo()->getCcExpYear())) ?>
15
- <?php else: ?>
16
- <?php endif; ?>
17
- <?php }?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/etc/modules/PayVector_All.xml DELETED
@@ -1,19 +0,0 @@
1
- <config>
2
- <modules>
3
- <PayVector_Tpg>
4
- <active>true</active>
5
- <codePool>local</codePool>
6
- <depends>
7
- <Mage_Payment />
8
- </depends>
9
- </PayVector_Tpg>
10
- <PayVector_Checkout>
11
- <active>true</active>
12
- <codePool>local</codePool>
13
- </PayVector_Checkout>
14
- <PayVector_Sales>
15
- <active>true</active>
16
- <codePool>local</codePool>
17
- </PayVector_Sales>
18
- </modules>
19
- </config>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
package.xml CHANGED
@@ -1,18 +1,22 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>PayVector_Tpg</name>
4
- <version>1.0.3</version>
5
  <stability>stable</stability>
6
- <license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
- <summary>PayVector payment extension compatible with Magento v 1.3, 1.4, 1.5, 1.6, 1.7, 1.8 and 1.9</summary>
10
- <description>Fully supports 3D secure and CrossReference transactions. Also supports all of the integration methods provided by PayVector.</description>
11
- <notes>Update to fix issue when the Gateway Password was incorrect</notes>
12
- <authors><author><name>PayVector</name><user>IridiumCorp</user><email>support@iridiumcorp.net</email></author></authors>
13
- <date>2014-11-18</date>
14
- <time>17:51:15</time>
15
- <contents><target name="magelocal"><dir name="PayVector"><dir name="Checkout"><dir name="Block"><dir name="Onepage"><dir name="Payment"><file name="Methods.php" hash="13be37e32795a710327ada3dfc91a22f"/></dir></dir></dir><dir name="Model"><dir name="Type"><file name="Onepage.php" hash="7c7c4a2ec9004b142f7094d93a456ba7"/></dir></dir><dir name="etc"><file name="config.xml" hash="2a388d8d243e5e9ed3954bd268ec084f"/></dir></dir><dir name="Sales"><dir name="Model"><dir name="Order"><file name="Invoice.php" hash="de5bb58bbb153c63cc60169f23461f6b"/><file name="Payment.php" hash="6cee2578e3d43006f8cad756e4ef43ce"/></dir><file name="Order.php" hash="c7d5bc41ac7e9e59d6fdb725acda4f58"/><dir name="Service"><file name="Quote.php" hash="b4a316a007255d8c3a4752daaf38b725"/></dir></dir><dir name="etc"><file name="config.xml" hash="bc7c6ba07a063b64cbc7917d0611b5e0"/></dir></dir><dir name="Tpg"><dir name="Block"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><file name="Payment.php" hash="eaff6b529038745549a714edb92ea1df"/></dir></dir></dir><file name="Error.php" hash="a1e3040eb95d6fcdf3855d77f42fbde6"/><file name="Form.php" hash="4f537f6a45a1a95f7cf27c45739ee9ba"/><file name="Info.php" hash="0eac4e7b36a800224852f2a445ba7ae6"/><file name="Redirect.php" hash="9e1577b80807592f56e62db6f21cfe3f"/><file name="Threedsecure.php" hash="2b25adce59c4ea485caa7b49499bfc32"/></dir><dir name="Helper"><file name="Data.php" hash="bae2102ea62785f6145ecfd00a5f2fb4"/></dir><dir name="Model"><dir name="Common"><file name="GlobalErrors.php" hash="09dd5e1cc01a6e4265d85cc903b91284"/><file name="ISOCountries.php" hash="2b6447781fb33853dd7447916fd98829"/><file name="ISOCurrencies.php" hash="4450b69c528863b95206bbcbd1360ede"/><file name="PaymentFormHelper.php" hash="24048b009ff8ea6382ea2bb12e622867"/><dir name="ThePaymentGateway"><file name="PaymentSystem.php" hash="246422bf2e2e0d20fb0f35532f8896d3"/><file name="SOAP.php" hash="860646be97216087262b11c5818fcec3"/><file name="TPG_Common.php" hash="4ef394ae6384e015e8c197a58106f2c7"/><file name="cacert.pem" hash="36c2e174ffa1e4739e5ce879d660dd6a"/></dir></dir><file name="Direct.php" hash="9c993dd385cd8e1719f88e091d5ec0cd"/><file name="Gatewayentrypoints.php" hash="f32d905a9b6c9ba8b742e340fc86049f"/><file name="Request.php" hash="75a23ed2d447674c823cfd3cc3602f68"/><dir name="Resource"><dir name="Eav"><dir name="Mysql4"><file name="Setup.php" hash="410116bc6a8d327a2232512c13561c8a"/></dir></dir><dir name="Gatewayentrypoints"><file name="Collection.php" hash="79bb8b43312451d7577c58bf60428366"/></dir><file name="Gatewayentrypoints.php" hash="a5033400ece4a661f0416c577df827b9"/><file name="Setup.php" hash="9a8cbc132f29cd61b82c36aac9d51407"/></dir><dir name="Source"><file name="HashMethod.php" hash="3077605f52458e6c6d88dc773a228c38"/><file name="OrderStatus.php" hash="95d343f1c2419edbf63847a357ae4076"/><file name="PaymentAction.php" hash="f3444cbbf95ffbcd5bc845110fd8ac0c"/><file name="PaymentMode.php" hash="671768ed91f1ca1178b67b8afd269ca9"/><file name="ResultDeliveryMethod.php" hash="7b6088293650fcf8bcb9aa23b2be1671"/></dir></dir><dir name="controllers"><file name="PaymentController.php" hash="cd40b0031ab96704f1316637045176e0"/></dir><dir name="etc"><file name="config.xml" hash="e563ec1c6df680deb91e4508e8ffe7cb"/><file name="system.xml" hash="0d1f30630d84daba413e4f2c8dd4edc0"/></dir><dir name="sql"><dir name="tpg_setup"><file name="install-0.1.0.php" hash="767431a50e2a891fe7d4adb930df2953"/><file name="mysql4-install-0.1.0.php" hash="9b478c72f89b327866ec12e7054bcc85"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="images"><file name="payvector.png" hash="e61e1555ca69863a79afb59382e3d16f"/></dir></dir></dir><dir name="default"><dir name="default"><dir name="images"><file name="payvector.png" hash="e61e1555ca69863a79afb59382e3d16f"/></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="tpg.js" hash=""/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="tpg"><file name="form.phtml" hash="78974743b3c46b3c1729897097bcfaf5"/><file name="info.phtml" hash="990a20f78e5085db5fcc792028b75d99"/></dir><dir name="payment"><dir name="info"><file name="cc_tpg.phtml" hash="f0182a45341820f6ce2d1738e67f5399"/></dir></dir></dir><dir name="layout"><file name="tpg.xml" hash="5327d6e72f7bd8aee9bc460cc9550b21"/></dir></dir></dir><dir name="base"><dir name="default"><dir name="template"><dir name="tpg"><file name="form.phtml" hash="884969288a32838cca11eadc08023c84"/><file name="info.phtml" hash="990a20f78e5085db5fcc792028b75d99"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="tpg"><file name="form.phtml" hash="8beb8e973a662968947af96f88f1467f"/><file name="info.phtml" hash="b64d8592a41455f2c5fd011db6d15a21"/></dir></dir></dir></dir><dir name="base"><dir name="default"><dir name="template"><dir name="tpg"><file name="form.phtml" hash="db5c7601edb7035a2fcb4ac7011a6f8e"/><file name="info.phtml" hash="512b9cee213170fb226cd2bf59daa761"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="PayVector_All.xml" hash="a2a4129d302737eaf0dce99ac3dbbedc"/></dir></target></contents>
 
 
 
 
16
  <compatible/>
17
- <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php><extension><name>SimpleXML</name><min></min><max></max></extension><extension><name>curl</name><min></min><max></max></extension></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>PayVector_Tpg</name>
4
+ <version>1.1.0</version>
5
  <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
  <channel>community</channel>
8
  <extends/>
9
+ <summary>Supports 3DSecure transactions through Direct/API and Hosted Payment From integration methods</summary>
10
+ <description>&lt;p&gt;Magento payment extension for the PayVector gateway. This extension fully supports the processing of 3D secure (Verified By Visa and Mastercard SecureCode) transactions. It also supports all of the integration methods provided by Iridium:&lt;/p&gt;&#xD;
11
+ &lt;ul&gt;&#xD;
12
+ &lt;li&gt;&lt;strong&gt;Direct (API) Integration&lt;/strong&gt; - customer never leaves your site during the payment process. Requires an SSL certificate. Card details DO get posted back to your site, which slightly affects your PCI DSS requirements&lt;/li&gt;&#xD;
13
+ &lt;li&gt;&lt;strong&gt;Hosted Payment Form&lt;/strong&gt; - customer jumps across to a payment form hosted on Iridium's systems. Doesn't require an SSL certificate&lt;/li&gt;&#xD;
14
+ &lt;/ul&gt;</description>
15
+ <notes>Update to enable merchants to take payments through the Magento Admin panel including support for MOTO Gateway Accounts</notes>
16
+ <authors><author><name>Iridium Corporation</name><user>iridium_support</user><email>support@iridiumcorp.co.uk</email></author></authors>
17
+ <date>2017-03-14</date>
18
+ <time>11:41:49</time>
19
+ <contents><target name="magelocal"><dir name="PayVector"><dir name="Checkout"><dir name="Model"><dir name="Type"><file name="Onepage.php" hash="2b73bbf03e8eda7221869847f5f06fd8"/></dir></dir><dir name="etc"><file name="config.xml" hash="8037aadd32019e1c8c2a5239e1df4e0d"/></dir></dir><dir name="Sales"><dir name="Model"><dir name="Order"><file name="Invoice.php" hash="de5bb58bbb153c63cc60169f23461f6b"/><file name="Payment.php" hash="6cee2578e3d43006f8cad756e4ef43ce"/></dir><file name="Order.php" hash="c7d5bc41ac7e9e59d6fdb725acda4f58"/><dir name="Service"><file name="Quote.php" hash="b4a316a007255d8c3a4752daaf38b725"/></dir></dir><dir name="etc"><file name="config.xml" hash="bc7c6ba07a063b64cbc7917d0611b5e0"/></dir></dir><dir name="Tpg"><dir name="Block"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><file name="Payment.php" hash="eaff6b529038745549a714edb92ea1df"/></dir></dir></dir><file name="Error.php" hash="a1e3040eb95d6fcdf3855d77f42fbde6"/><file name="Form.php" hash="4f537f6a45a1a95f7cf27c45739ee9ba"/><file name="Info.php" hash="0eac4e7b36a800224852f2a445ba7ae6"/><file name="Redirect.php" hash="9e1577b80807592f56e62db6f21cfe3f"/><file name="Threedsecure.php" hash="2b25adce59c4ea485caa7b49499bfc32"/></dir><dir name="Helper"><file name="Data.php" hash="bae2102ea62785f6145ecfd00a5f2fb4"/></dir><dir name="Model"><dir name="Common"><file name="GlobalErrors.php" hash="09dd5e1cc01a6e4265d85cc903b91284"/><file name="ISOCountries.php" hash="2b6447781fb33853dd7447916fd98829"/><file name="ISOCurrencies.php" hash="4450b69c528863b95206bbcbd1360ede"/><file name="PaymentFormHelper.php" hash="24048b009ff8ea6382ea2bb12e622867"/><dir name="ThePaymentGateway"><file name="PaymentSystem.php" hash="246422bf2e2e0d20fb0f35532f8896d3"/><file name="SOAP.php" hash="860646be97216087262b11c5818fcec3"/><file name="TPG_Common.php" hash="4ef394ae6384e015e8c197a58106f2c7"/><file name="cacert.pem" hash="36c2e174ffa1e4739e5ce879d660dd6a"/></dir></dir><file name="Direct (copy).php" hash="9c993dd385cd8e1719f88e091d5ec0cd"/><file name="Direct.php" hash="c9e83208d04cdb9dc7e11c7b783bd2f0"/><file name="Gatewayentrypoints.php" hash="f32d905a9b6c9ba8b742e340fc86049f"/><file name="Request.php" hash="75a23ed2d447674c823cfd3cc3602f68"/><dir name="Resource"><dir name="Eav"><dir name="Mysql4"><file name="Setup.php" hash="410116bc6a8d327a2232512c13561c8a"/></dir></dir><dir name="Gatewayentrypoints"><file name="Collection.php" hash="79bb8b43312451d7577c58bf60428366"/></dir><file name="Gatewayentrypoints.php" hash="a5033400ece4a661f0416c577df827b9"/><file name="Setup.php" hash="9a8cbc132f29cd61b82c36aac9d51407"/></dir><dir name="Source"><file name="HashMethod.php" hash="3077605f52458e6c6d88dc773a228c38"/><file name="OrderStatus.php" hash="95d343f1c2419edbf63847a357ae4076"/><file name="PaymentAction.php" hash="f3444cbbf95ffbcd5bc845110fd8ac0c"/><file name="PaymentMode.php" hash="671768ed91f1ca1178b67b8afd269ca9"/><file name="ResultDeliveryMethod.php" hash="7b6088293650fcf8bcb9aa23b2be1671"/></dir></dir><dir name="controllers"><file name="PaymentController.php" hash="d13fa26bea000798f30b44c6035d370a"/></dir><dir name="etc"><file name="config.xml" hash="e563ec1c6df680deb91e4508e8ffe7cb"/><file name="system.xml" hash="36ca21aadd44daacb3a82bde3263a626"/></dir><dir name="sql"><dir name="tpg_setup"><file name="install-0.1.0.php" hash="767431a50e2a891fe7d4adb930df2953"/><file name="mysql4-install-0.1.0.php" hash="9b478c72f89b327866ec12e7054bcc85"/></dir></dir></dir></dir></target><target name="magecore"><dir name="modules"><file name="PayVector_All.xml" hash=""/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="tpg"><file name="form.phtml" hash="80afedf407fcebcc3d3fd4c9613ad233"/><file name="info.phtml" hash="990a20f78e5085db5fcc792028b75d99"/></dir></dir><dir name="layout"><file name="tpg.xml" hash="5327d6e72f7bd8aee9bc460cc9550b21"/></dir></dir></dir><dir name="base"><dir name="default"><dir name="template"><dir name="tpg"><file name="form.phtml" hash="ff5f569dff3f4567e661210ba84cdf36"/><file name="info.phtml" hash="990a20f78e5085db5fcc792028b75d99"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="tpg"><file name="form.phtml" hash=""/><file name="info.phtml" hash=""/></dir></dir></dir></dir><dir name="base"><dir name="default"><dir name="template"><dir name="tpg"><file name="form.phtml" hash="db5c7601edb7035a2fcb4ac7011a6f8e"/><file name="info.phtml" hash="512b9cee213170fb226cd2bf59daa761"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="images"><file name="payvector.png" hash="e61e1555ca69863a79afb59382e3d16f"/></dir></dir></dir><dir name="base"><dir name="default"><dir name="images"><file name="payvector.png" hash="e61e1555ca69863a79afb59382e3d16f"/></dir></dir></dir></dir></target></contents>
20
  <compatible/>
21
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php><extension><name>curl</name><min/><max/></extension></required></dependencies>
22
  </package>