Iridiumcorp_Tpg - Version 1.8.1

Version Notes

Cookie values URL encoded in the ServerResultURLCookieVariables stirng

Download this release

Release Info

Developer Magento Core Team
Extension Iridiumcorp_Tpg
Version 1.8.1
Comparing to
See all releases


Code changes from version 1.6.1 to 1.8.1

app/code/local/Iridiumcorp/Checkout/Block/Onepage/Payment/Methods.php CHANGED
@@ -17,6 +17,8 @@ class Iridiumcorp_Checkout_Block_Onepage_Payment_Methods extends Mage_Checkout_B
17
  */
18
  public function getSelectedMethodCode()
19
  {
 
 
20
  if ($this->getQuote()->getPayment()->getMethod())
21
  {
22
  $method = $this->getQuote()->getPayment()->getMethod();
@@ -24,7 +26,10 @@ class Iridiumcorp_Checkout_Block_Onepage_Payment_Methods extends Mage_Checkout_B
24
  else
25
  {
26
  // force the current payment to be selected
27
- $method = 'tpg';
 
 
 
28
  }
29
 
30
  return $method;
17
  */
18
  public function getSelectedMethodCode()
19
  {
20
+ $model = Mage::getModel('tpg/direct');
21
+
22
  if ($this->getQuote()->getPayment()->getMethod())
23
  {
24
  $method = $this->getQuote()->getPayment()->getMethod();
26
  else
27
  {
28
  // force the current payment to be selected
29
+ if($model)
30
+ {
31
+ $method = 'tpg';
32
+ }
33
  }
34
 
35
  return $method;
app/code/local/Iridiumcorp/Checkout/Model/Type/Onepage.php CHANGED
@@ -3,72 +3,561 @@
3
  class Iridiumcorp_Checkout_Model_Type_Onepage extends Mage_Checkout_Model_Type_Onepage
4
  {
5
  /**
6
- * Create order based on checkout type. Create customer if necessary. Overrided for necessary redirection
7
  *
8
  * @return Mage_Checkout_Model_Type_Onepage
9
  */
10
  public function saveOrder()
11
  {
12
- $this->validate();
13
- $isNewCustomer = false;
14
 
15
- switch ($this->getCheckoutMehod())
16
  {
17
- case self::METHOD_GUEST:
18
- $this->_prepareGuestQuote();
19
- break;
20
- case self::METHOD_REGISTER:
21
- $this->_prepareNewCustomerQuote();
22
- $isNewCustomer = true;
23
- break;
24
- default:
25
- $this->_prepareCustomerQuote();
26
- break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  }
28
 
29
- $service = Mage::getModel('sales/service_quote', $this->getQuote());
30
- $order = $service->submit();
31
 
32
- if ($isNewCustomer)
33
  {
34
- try
 
35
  {
36
- $this->_involveNewCustomer();
37
  }
38
- catch (Exception $e)
 
 
 
 
 
 
 
 
39
  {
40
- Mage::logException($e);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  }
42
  }
43
- Mage::dispatchEvent('checkout_type_onepage_save_order_after', array('order'=>$order, 'quote'=>$this->getQuote()));
44
 
45
  /**
46
- * a flag to set for redirecting to a third party URL (ie: for 3D Secure authorization)
47
- *
48
  */
49
  $redirectUrl = $this->getQuote()->getPayment()->getOrderPlaceRedirectUrl();
50
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  /**
52
- * we only want to send email to customer about new order when there is no redirect to third party
53
  */
54
  if(!$redirectUrl)
55
  {
56
- try
 
 
 
 
 
 
 
 
 
 
 
 
57
  {
58
- $order->sendNewOrderEmail();
 
 
59
  }
60
- catch (Exception $exc)
61
  {
62
- Mage::logException($exc);
63
  }
64
  }
65
 
66
- $this->getCheckout()->setLastQuoteId($this->getQuote()->getId())
67
- ->setLastOrderId($order->getId())
68
- ->setLastRealOrderId($order->getIncrementId())
69
- ->setRedirectUrl($redirectUrl)
70
- ->setLastSuccessQuoteId($this->getQuote()->getId());
71
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
  return $this;
73
  }
74
  }
3
  class Iridiumcorp_Checkout_Model_Type_Onepage extends Mage_Checkout_Model_Type_Onepage
4
  {
5
  /**
6
+ * Create an order
7
  *
8
  * @return Mage_Checkout_Model_Type_Onepage
9
  */
10
  public function saveOrder()
11
  {
12
+ $this->validateOrder();
13
+ $billing = $this->getQuote()->getBillingAddress();
14
 
15
+ if (!$this->getQuote()->isVirtual())
16
  {
17
+ $shipping = $this->getQuote()->getShippingAddress();
18
+ }
19
+
20
+ switch ($this->getQuote()->getCheckoutMethod())
21
+ {
22
+ case Mage_Sales_Model_Quote::CHECKOUT_METHOD_GUEST:
23
+ if (!$this->getQuote()->isAllowedGuestCheckout())
24
+ {
25
+ Mage::throwException(Mage::helper('checkout')->__('Sorry, guest checkout is not enabled. Please try again or contact store owner.'));
26
+ }
27
+ $this->getQuote()->setCustomerId(null)
28
+ ->setCustomerEmail($billing->getEmail())
29
+ ->setCustomerIsGuest(true)
30
+ ->setCustomerGroupId(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID);
31
+ break;
32
+
33
+ case Mage_Sales_Model_Quote::CHECKOUT_METHOD_REGISTER:
34
+ $customer = Mage::getModel('customer/customer');
35
+
36
+ $customerBilling = $billing->exportCustomerAddress();
37
+ $customer->addAddress($customerBilling);
38
+
39
+ if (!$this->getQuote()->isVirtual() &&
40
+ !$shipping->getSameAsBilling())
41
+ {
42
+ $customerShipping = $shipping->exportCustomerAddress();
43
+ $customer->addAddress($customerShipping);
44
+ }
45
+
46
+ if ($this->getQuote()->getCustomerDob() &&
47
+ !$billing->getCustomerDob())
48
+ {
49
+ $billing->setCustomerDob($this->getQuote()->getCustomerDob());
50
+ }
51
+
52
+ Mage::helper('core')->copyFieldset('checkout_onepage_billing', 'to_customer', $billing, $customer);
53
+
54
+ $customer->setPassword($customer->decryptPassword($this->getQuote()->getPasswordHash()));
55
+ $customer->setPasswordHash($customer->hashPassword($customer->getPassword()));
56
+
57
+ $this->getQuote()->setCustomer($customer);
58
+ Mage::log(time());
59
+ break;
60
+
61
+ default:
62
+ $customer = Mage::getSingleton('customer/session')->getCustomer();
63
+
64
+ if (!$billing->getCustomerId() ||
65
+ $billing->getSaveInAddressBook())
66
+ {
67
+ $customerBilling = $billing->exportCustomerAddress();
68
+ $customer->addAddress($customerBilling);
69
+ }
70
+ if (!$this->getQuote()->isVirtual() &&
71
+ ((!$shipping->getCustomerId() && !$shipping->getSameAsBilling()) ||
72
+ (!$shipping->getSameAsBilling() && $shipping->getSaveInAddressBook())))
73
+ {
74
+ $customerShipping = $shipping->exportCustomerAddress();
75
+ $customer->addAddress($customerShipping);
76
+ }
77
+ $customer->setSavedFromQuote(true);
78
+ $customer->save();
79
+
80
+ $changed = false;
81
+ if (isset($customerBilling) &&
82
+ !$customer->getDefaultBilling())
83
+ {
84
+ $customer->setDefaultBilling($customerBilling->getId());
85
+ $changed = true;
86
+ }
87
+ if (!$this->getQuote()->isVirtual() &&
88
+ isset($customerBilling) &&
89
+ !$customer->getDefaultShipping() &&
90
+ $shipping->getSameAsBilling())
91
+ {
92
+ $customer->setDefaultShipping($customerBilling->getId());
93
+ $changed = true;
94
+ }
95
+ elseif (!$this->getQuote()->isVirtual() &&
96
+ isset($customerShipping) &&
97
+ !$customer->getDefaultShipping())
98
+ {
99
+ $customer->setDefaultShipping($customerShipping->getId());
100
+ $changed = true;
101
+ }
102
+
103
+ if ($changed)
104
+ {
105
+ $customer->save();
106
+ }
107
+ }
108
+
109
+ $this->getQuote()->reserveOrderId();
110
+ $convertQuote = Mage::getModel('sales/convert_quote');
111
+ // @var $convertQuote Mage_Sales_Model_Convert_Quote
112
+ if ($this->getQuote()->isVirtual())
113
+ {
114
+ $order = $convertQuote->addressToOrder($billing);
115
+ }
116
+ else
117
+ {
118
+ $order = $convertQuote->addressToOrder($shipping);
119
+ }
120
+ // @var $order Mage_Sales_Model_Order
121
+ $order->setBillingAddress($convertQuote->addressToOrderAddress($billing));
122
+
123
+ if (!$this->getQuote()->isVirtual())
124
+ {
125
+ $order->setShippingAddress($convertQuote->addressToOrderAddress($shipping));
126
  }
127
 
128
+ $order->setPayment($convertQuote->paymentToOrderPayment($this->getQuote()->getPayment()));
 
129
 
130
+ foreach ($this->getQuote()->getAllItems() as $item)
131
  {
132
+ $orderItem = $convertQuote->itemToOrderItem($item);
133
+ if ($item->getParentItem())
134
  {
135
+ $orderItem->setParentItem($order->getItemByQuoteItemId($item->getParentItem()->getId()));
136
  }
137
+ $order->addItem($orderItem);
138
+ }
139
+
140
+ // We can use configuration data for declare new order status
141
+ Mage::dispatchEvent('checkout_type_onepage_save_order', array('order'=>$order, 'quote'=>$this->getQuote()));
142
+ // check again, if customer exists
143
+ if ($this->getQuote()->getCheckoutMethod() == Mage_Sales_Model_Quote::CHECKOUT_METHOD_REGISTER)
144
+ {
145
+ if ($this->_customerEmailExists($customer->getEmail(), Mage::app()->getWebsite()->getId()))
146
  {
147
+ Mage::throwException(Mage::helper('checkout')->__('There is already a customer registered using this email address'));
148
+ }
149
+ }
150
+
151
+ // clear 3dSecure session variables
152
+ Mage::getSingleton('checkout/session')->setThreedsecurerequired(null);
153
+ Mage::getSingleton('checkout/session')->setMd(null);
154
+ Mage::getSingleton('checkout/session')->setPares(null);
155
+ Mage::getSingleton('checkout/session')->setAcsurl(null);
156
+
157
+ $order->place();
158
+
159
+ if ($this->getQuote()->getCheckoutMethod()==Mage_Sales_Model_Quote::CHECKOUT_METHOD_REGISTER)
160
+ {
161
+ $customer->save();
162
+ $customerBillingId = $customerBilling->getId();
163
+ if (!$this->getQuote()->isVirtual())
164
+ {
165
+ $customerShippingId = isset($customerShipping) ? $customerShipping->getId() : $customerBillingId;
166
+ $customer->setDefaultShipping($customerShippingId);
167
+ }
168
+ $customer->setDefaultBilling($customerBillingId);
169
+ $customer->save();
170
+
171
+ $this->getQuote()->setCustomerId($customer->getId());
172
+
173
+ $order->setCustomerId($customer->getId());
174
+ Mage::helper('core')->copyFieldset('customer_account', 'to_order', $customer, $order);
175
+
176
+ $billing->setCustomerId($customer->getId())->setCustomerAddressId($customerBillingId);
177
+ if (!$this->getQuote()->isVirtual())
178
+ {
179
+ $shipping->setCustomerId($customer->getId())->setCustomerAddressId($customerShippingId);
180
+ }
181
+
182
+ if ($customer->isConfirmationRequired())
183
+ {
184
+ $customer->sendNewAccountEmail('confirmation');
185
+ }
186
+ else
187
+ {
188
+ $customer->sendNewAccountEmail();
189
  }
190
  }
 
191
 
192
  /**
193
+ * a flag to set that there will be redirect to third party after confirmation
194
+ * eg: paypal standard ipn
195
  */
196
  $redirectUrl = $this->getQuote()->getPayment()->getOrderPlaceRedirectUrl();
197
+ if(!$redirectUrl)
198
+ {
199
+ $order->setEmailSent(true);
200
+ }
201
+
202
+ if(!$redirectUrl ||
203
+ $this->getQuote()->getPayment()->getMethodInstance()->getCode() != 'tpg')
204
+ {
205
+ $order->save();
206
+ }
207
+
208
+ Mage::dispatchEvent('checkout_type_onepage_save_order_after', array('order'=>$order, 'quote'=>$this->getQuote()));
209
+
210
+
211
+ /**
212
+ * need to have somelogic to set order as new status to make sure order is not finished yet
213
+ * quote will be still active when we send the customer to paypal
214
+ */
215
+
216
+ $orderId = $order->getIncrementId();
217
+ $this->getCheckout()->setLastQuoteId($this->getQuote()->getId());
218
+ $this->getCheckout()->setLastOrderId($order->getId());
219
+ $this->getCheckout()->setLastRealOrderId($order->getIncrementId());
220
+ $this->getCheckout()->setRedirectUrl($redirectUrl);
221
+
222
  /**
223
+ * we only want to send to customer about new order when there is no redirect to third party
224
  */
225
  if(!$redirectUrl)
226
  {
227
+ $order->sendNewOrderEmail();
228
+ }
229
+
230
+ if ($this->getQuote()->getCheckoutMethod(true) == Mage_Sales_Model_Quote::CHECKOUT_METHOD_REGISTER &&
231
+ !Mage::getSingleton('customer/session')->isLoggedIn())
232
+ {
233
+ /**
234
+ * we need to save quote here to have it saved with Customer Id.
235
+ * so when loginById() executes checkout/session method loadCustomerQuote
236
+ * it would not create new quotes and merge it with old one.
237
+ */
238
+ $this->getQuote()->save();
239
+ if ($customer->isConfirmationRequired())
240
  {
241
+ Mage::getSingleton('checkout/session')->addSuccess(Mage::helper('customer')->__('Account confirmation is required. Please, check your e-mail for confirmation link. To resend confirmation email please <a href="%s">click here</a>.',
242
+ Mage::helper('customer')->getEmailConfirmationUrl($customer->getEmail())
243
+ ));
244
  }
245
+ else
246
  {
247
+ Mage::getSingleton('customer/session')->loginById($customer->getId());
248
  }
249
  }
250
 
251
+ //Setting this one more time like control flag that we haves saved order
252
+ //Must be checkout on success page to show it or not.
253
+ $this->getCheckout()->setLastSuccessQuoteId($this->getQuote()->getId());
254
+
255
+ $this->getQuote()->setIsActive(false);
256
+ $this->getQuote()->save();
257
+
258
+ return $this;
259
+ }
260
+
261
+ /**
262
+ * Create an order for a Direct (API) 3D Secure enabled payment on the callback
263
+ *
264
+ * @param unknown_type $pares
265
+ * @param unknown_type $md
266
+ * @return unknown
267
+ */
268
+ public function saveOrderAfter3dSecure($pares, $md)
269
+ {
270
+ $this->validateOrder();
271
+ $billing = $this->getQuote()->getBillingAddress();
272
+ if (!$this->getQuote()->isVirtual())
273
+ {
274
+ $shipping = $this->getQuote()->getShippingAddress();
275
+ }
276
+
277
+ switch ($this->getQuote()->getCheckoutMethod())
278
+ {
279
+ case 'guest':
280
+ $this->getQuote()->setCustomerEmail($billing->getEmail())
281
+ ->setCustomerIsGuest(true)
282
+ ->setCustomerGroupId(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID);
283
+ break;
284
+
285
+ default:
286
+ $customer = Mage::getSingleton('customer/session')->getCustomer();
287
+
288
+ if (!$billing->getCustomerId() ||
289
+ $billing->getSaveInAddressBook())
290
+ {
291
+ $customerBilling = $billing->exportCustomerAddress();
292
+ $customer->addAddress($customerBilling);
293
+ }
294
+ if (!$this->getQuote()->isVirtual() &&
295
+ ((!$shipping->getCustomerId() && !$shipping->getSameAsBilling()) ||
296
+ (!$shipping->getSameAsBilling() && $shipping->getSaveInAddressBook())))
297
+ {
298
+ $customerShipping = $shipping->exportCustomerAddress();
299
+ $customer->addAddress($customerShipping);
300
+ }
301
+ $customer->setSavedFromQuote(true);
302
+ $customer->save();
303
+
304
+ $changed = false;
305
+ if (isset($customerBilling) &&
306
+ !$customer->getDefaultBilling())
307
+ {
308
+ $customer->setDefaultBilling($customerBilling->getId());
309
+ $changed = true;
310
+ }
311
+ if (!$this->getQuote()->isVirtual() &&
312
+ isset($customerBilling) &&
313
+ !$customer->getDefaultShipping() &&
314
+ $shipping->getSameAsBilling())
315
+ {
316
+ $customer->setDefaultShipping($customerBilling->getId());
317
+ $changed = true;
318
+ }
319
+ elseif (!$this->getQuote()->isVirtual() &&
320
+ isset($customerShipping) &&
321
+ !$customer->getDefaultShipping())
322
+ {
323
+ $customer->setDefaultShipping($customerShipping->getId());
324
+ $changed = true;
325
+ }
326
+
327
+ if ($changed)
328
+ {
329
+ $customer->save();
330
+ }
331
+ }
332
+
333
+ $this->getQuote()->reserveOrderId();
334
+ $convertQuote = Mage::getModel('sales/convert_quote');
335
+ // @var $convertQuote Mage_Sales_Model_Convert_Quote
336
+ if ($this->getQuote()->isVirtual())
337
+ {
338
+ $order = $convertQuote->addressToOrder($billing);
339
+ }
340
+ else
341
+ {
342
+ $order = $convertQuote->addressToOrder($shipping);
343
+ }
344
+ /* @var $order Mage_Sales_Model_Order */
345
+ $order->setBillingAddress($convertQuote->addressToOrderAddress($billing));
346
+
347
+ if (!$this->getQuote()->isVirtual())
348
+ {
349
+ $order->setShippingAddress($convertQuote->addressToOrderAddress($shipping));
350
+ }
351
+
352
+ $order->setPayment($convertQuote->paymentToOrderPayment($this->getQuote()->getPayment()));
353
+
354
+ foreach ($this->getQuote()->getAllItems() as $item)
355
+ {
356
+ $order->addItem($convertQuote->itemToOrderItem($item));
357
+ }
358
+
359
+ /**
360
+ * We can use configuration data for declare new order status
361
+ */
362
+ Mage::dispatchEvent('checkout_type_onepage_save_order', array('order'=>$order, 'quote'=>$this->getQuote()));
363
+
364
+ Mage::getSingleton('checkout/session')->setThreedsecurerequired(true);
365
+ Mage::getSingleton('checkout/session')->setMd($md);
366
+ Mage::getSingleton('checkout/session')->setPares($pares);
367
+
368
+ $order->place();
369
+
370
+ if ( $order->getPayment()->getMethodInstance()->getCode() == 'tpg' &&
371
+ $order->getStatus() != 'pending' )
372
+ {
373
+ $order_status = Mage::getStoreConfig('payment/tpg/order_status', Mage::app()->getStore()->getId());
374
+
375
+ $order->addStatusToHistory($order_status);
376
+ $order->setStatus($order_status);
377
+ }
378
+
379
+ $order->save();
380
+
381
+
382
+
383
+ Mage::dispatchEvent('checkout_type_onepage_save_order_after', array('order'=>$order, 'quote'=>$this->getQuote()));
384
+
385
+
386
+ $this->getQuote()->setIsActive(false);
387
+ $this->getQuote()->save();
388
+
389
+ $orderId = $order->getIncrementId();
390
+ $this->getCheckout()->setLastQuoteId($this->getQuote()->getId());
391
+ $this->getCheckout()->setLastOrderId($order->getId());
392
+ $this->getCheckout()->setLastRealOrderId($order->getIncrementId());
393
+ // $this->getCheckout()->setRedirectUrl($redirectUrl);
394
+
395
+ /**
396
+ * we only want to send to customer about new order when there is no redirect to third party
397
+ */
398
+ /*if(!$redirectUrl){
399
+ $order->sendNewOrderEmail();
400
+ }*/
401
+
402
+ if ($this->getQuote()->getCheckoutMethod() == 'register')
403
+ {
404
+ Mage::getSingleton('customer/session')->loginById($customer->getId());
405
+ }
406
+
407
+ return $this;
408
+ }
409
+
410
+ /**
411
+ * Create an order for a Hosted Payment Form/Transparent Redirect payment on the callback
412
+ *
413
+ * @param unknown_type $boIsHostedPaymentAction
414
+ * @param unknown_type $szStatusCode
415
+ * @param unknown_type $szMessage
416
+ * @param unknown_type $szPreviousStatusCode
417
+ * @param unknown_type $szPreviousMessage
418
+ * @param unknown_type $szOrderID
419
+ * @return unknown
420
+ */
421
+ public function saveOrderAfterRedirectedPaymentAction($boIsHostedPaymentAction, $szStatusCode, $szMessage, $szPreviousStatusCode, $szPreviousMessage, $szOrderID)
422
+ {
423
+ $this->validateOrder();
424
+ $billing = $this->getQuote()->getBillingAddress();
425
+
426
+ if (!$this->getQuote()->isVirtual())
427
+ {
428
+ $shipping = $this->getQuote()->getShippingAddress();
429
+ }
430
+
431
+ switch ($this->getQuote()->getCheckoutMethod())
432
+ {
433
+ case 'guest':
434
+ $this->getQuote()->setCustomerEmail($billing->getEmail())
435
+ ->setCustomerIsGuest(true)
436
+ ->setCustomerGroupId(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID);
437
+ break;
438
+
439
+ default:
440
+ $customer = Mage::getSingleton('customer/session')->getCustomer();
441
+
442
+ if (!$billing->getCustomerId() ||
443
+ $billing->getSaveInAddressBook())
444
+ {
445
+ $customerBilling = $billing->exportCustomerAddress();
446
+ $customer->addAddress($customerBilling);
447
+ }
448
+ if (!$this->getQuote()->isVirtual() &&
449
+ ((!$shipping->getCustomerId() && !$shipping->getSameAsBilling()) ||
450
+ (!$shipping->getSameAsBilling() && $shipping->getSaveInAddressBook())))
451
+ {
452
+ $customerShipping = $shipping->exportCustomerAddress();
453
+ $customer->addAddress($customerShipping);
454
+ }
455
+ $customer->setSavedFromQuote(true);
456
+ $customer->save();
457
+
458
+ $changed = false;
459
+ if (isset($customerBilling) &&
460
+ !$customer->getDefaultBilling())
461
+ {
462
+ $customer->setDefaultBilling($customerBilling->getId());
463
+ $changed = true;
464
+ }
465
+ if (!$this->getQuote()->isVirtual() &&
466
+ isset($customerBilling) &&
467
+ !$customer->getDefaultShipping() &&
468
+ $shipping->getSameAsBilling())
469
+ {
470
+ $customer->setDefaultShipping($customerBilling->getId());
471
+ $changed = true;
472
+ }
473
+ elseif (!$this->getQuote()->isVirtual() &&
474
+ isset($customerShipping) &&
475
+ !$customer->getDefaultShipping())
476
+ {
477
+ $customer->setDefaultShipping($customerShipping->getId());
478
+ $changed = true;
479
+ }
480
+
481
+ if ($changed)
482
+ {
483
+ $customer->save();
484
+ }
485
+ }
486
+
487
+ $this->getQuote()->reserveOrderId();
488
+ $convertQuote = Mage::getModel('sales/convert_quote');
489
+ // @var $convertQuote Mage_Sales_Model_Convert_Quote
490
+ if ($this->getQuote()->isVirtual())
491
+ {
492
+ $order = $convertQuote->addressToOrder($billing);
493
+ }
494
+ else
495
+ {
496
+ $order = $convertQuote->addressToOrder($shipping);
497
+ }
498
+ /* @var $order Mage_Sales_Model_Order */
499
+ $order->setBillingAddress($convertQuote->addressToOrderAddress($billing));
500
+
501
+ if (!$this->getQuote()->isVirtual())
502
+ {
503
+ $order->setShippingAddress($convertQuote->addressToOrderAddress($shipping));
504
+ }
505
+
506
+ $order->setPayment($convertQuote->paymentToOrderPayment($this->getQuote()->getPayment()));
507
+
508
+ foreach ($this->getQuote()->getAllItems() as $item)
509
+ {
510
+ $order->addItem($convertQuote->itemToOrderItem($item));
511
+ }
512
+
513
+ /**
514
+ * We can use configuration data for declare new order status
515
+ */
516
+ Mage::dispatchEvent('checkout_type_onepage_save_order', array('order'=>$order, 'quote'=>$this->getQuote()));
517
+
518
+ Mage::getSingleton('checkout/session')->setRedirectedpayment(true)
519
+ ->setIshostedpayment($boIsHostedPaymentAction)
520
+ ->setStatuscode($szStatusCode)
521
+ ->setMessage($szMessage)
522
+ ->setPreviousstatuscode($szPreviousStatusCode)
523
+ ->setPreviousmessage($szPreviousMessage)
524
+ ->setOrderid($szOrderID);
525
+
526
+ $order->place();
527
+
528
+ if ( $order->getPayment()->getMethodInstance()->getCode() == 'tpg' &&
529
+ $order->getStatus() != 'pending' )
530
+ {
531
+ $order_status = Mage::getStoreConfig('payment/tpg/order_status', Mage::app()->getStore()->getId());
532
+
533
+ $order->addStatusToHistory($order_status);
534
+ $order->setStatus($order_status);
535
+ }
536
+
537
+ $order->save();
538
+
539
+ Mage::dispatchEvent('checkout_type_onepage_save_order_after', array('order'=>$order, 'quote'=>$this->getQuote()));
540
+
541
+ $this->getQuote()->setIsActive(false);
542
+ $this->getQuote()->save();
543
+
544
+ $orderId = $order->getIncrementId();
545
+ $this->getCheckout()->setLastQuoteId($this->getQuote()->getId());
546
+ $this->getCheckout()->setLastOrderId($order->getId());
547
+ $this->getCheckout()->setLastRealOrderId($order->getIncrementId());
548
+
549
+ /**
550
+ * we only want to send to customer about new order when there is no redirect to third party
551
+ */
552
+ /*if(!$redirectUrl){
553
+ $order->sendNewOrderEmail();
554
+ }*/
555
+
556
+ if ($this->getQuote()->getCheckoutMethod()=='register')
557
+ {
558
+ Mage::getSingleton('customer/session')->loginById($customer->getId());
559
+ }
560
+
561
  return $this;
562
  }
563
  }
app/code/local/Iridiumcorp/Sales/Model/Order.php CHANGED
@@ -4,15 +4,13 @@ class Iridiumcorp_Sales_Model_Order extends Mage_Sales_Model_Order
4
  {
5
  protected function _setState($state, $status = false, $comment = '', $isCustomerNotified = null, $shouldProtectState = false)
6
  {
7
- // comment out the below section to enable manual override of the status
8
- /*
9
  // attempt to set the specified state
10
  if ($shouldProtectState) {
11
  if ($this->isStateProtected($state)) {
12
  Mage::throwException(Mage::helper('sales')->__('The Order State "%s" must not be set manually.', $state));
13
  }
14
  }
15
- */
16
  $this->setData('state', $state);
17
 
18
  // add status history
4
  {
5
  protected function _setState($state, $status = false, $comment = '', $isCustomerNotified = null, $shouldProtectState = false)
6
  {
 
 
7
  // attempt to set the specified state
8
  if ($shouldProtectState) {
9
  if ($this->isStateProtected($state)) {
10
  Mage::throwException(Mage::helper('sales')->__('The Order State "%s" must not be set manually.', $state));
11
  }
12
  }
13
+
14
  $this->setData('state', $state);
15
 
16
  // add status history
app/code/local/Iridiumcorp/Sales/Model/Order/Invoice.php CHANGED
@@ -11,14 +11,10 @@ class Iridiumcorp_Sales_Model_Order_Invoice extends Mage_Sales_Model_Order_Invoi
11
  {
12
  $this->getOrder()->getPayment()->capture($this);
13
 
14
- // decide whether to pay the invoice
15
- if($GLOBALS['m_boPayInvoice'])
16
- {
17
- if ($this->getIsPaid())
18
- {
19
- $this->pay();
20
- }
21
- }
22
  return $this;
23
  }
24
  }
11
  {
12
  $this->getOrder()->getPayment()->capture($this);
13
 
14
+ if ($this->getIsPaid())
15
+ {
16
+ $this->pay();
17
+ }
 
 
 
 
18
  return $this;
19
  }
20
  }
app/code/local/Iridiumcorp/Tpg/Block/Redirect.php CHANGED
@@ -24,11 +24,20 @@ class Iridiumcorp_Tpg_Block_Redirect extends Mage_Core_Block_Abstract
24
  return $html;
25
  }
26
 
 
 
 
 
 
27
  private function _redirectToHostedPaymentForm()
28
  {
29
  $html = '';
30
  $model = Mage::getModel('tpg/direct');
31
  $szActionURL = $model->getConfigData('hostedpaymentactionurl');
 
 
 
 
32
 
33
  // create a Magento form
34
  $form = new Varien_Data_Form();
@@ -65,6 +74,9 @@ class Iridiumcorp_Tpg_Block_Redirect extends Mage_Core_Block_Abstract
65
  $form->addField("ResultDeliveryMethod", 'hidden', array('name'=>"ResultDeliveryMethod", 'value'=>Mage::getSingleton('checkout/session')->getResultdeliverymethod()));
66
  $form->addField("ServerResultURL", 'hidden', array('name'=>"ServerResultURL", 'value'=>Mage::getSingleton('checkout/session')->getServerresulturl()));
67
  $form->addField("PaymentFormDisplaysResult", 'hidden', array('name'=>"PaymentFormDisplaysResult", 'value'=>Mage::getSingleton('checkout/session')->getPaymentformdisplaysresult()));
 
 
 
68
 
69
  // reset the session items
70
  Mage::getSingleton('checkout/session')->setHashdigest(null)
@@ -93,7 +105,10 @@ class Iridiumcorp_Tpg_Block_Redirect extends Mage_Core_Block_Abstract
93
  ->setCountrymandatory(null)
94
  ->setResultdeliverymethod(null)
95
  ->setServerresulturl(null)
96
- ->setPaymentformdisplaysresult(null);
 
 
 
97
 
98
  $html = '<html><body>';
99
  $html.= $this->__('You will be redirected to a secure payment page in a few seconds.');
@@ -104,6 +119,11 @@ class Iridiumcorp_Tpg_Block_Redirect extends Mage_Core_Block_Abstract
104
  return $html;
105
  }
106
 
 
 
 
 
 
107
  private function _redirectToTransparentRedirect()
108
  {
109
  $html;
@@ -123,6 +143,12 @@ class Iridiumcorp_Tpg_Block_Redirect extends Mage_Core_Block_Abstract
123
  return $html;
124
  }
125
 
 
 
 
 
 
 
126
  private function _submitTransaction($szActionURL)
127
  {
128
  $html = '';
@@ -197,6 +223,12 @@ class Iridiumcorp_Tpg_Block_Redirect extends Mage_Core_Block_Abstract
197
  return $html;
198
  }
199
 
 
 
 
 
 
 
200
  private function _submitPaRes($szActionURL)
201
  {
202
  $html = '';
24
  return $html;
25
  }
26
 
27
+ /**
28
+ * Build the redirect form for the Hosted Payment Form payment type
29
+ *
30
+ * @return unknown
31
+ */
32
  private function _redirectToHostedPaymentForm()
33
  {
34
  $html = '';
35
  $model = Mage::getModel('tpg/direct');
36
  $szActionURL = $model->getConfigData('hostedpaymentactionurl');
37
+ $cookies = Mage::getSingleton('core/cookie')->get();
38
+ $szServerResultURLCookieVariables;
39
+ $szServerResultURLFormVariables = '';
40
+ $szServerResultURLQueryStringVariables = '';
41
 
42
  // create a Magento form
43
  $form = new Varien_Data_Form();
74
  $form->addField("ResultDeliveryMethod", 'hidden', array('name'=>"ResultDeliveryMethod", 'value'=>Mage::getSingleton('checkout/session')->getResultdeliverymethod()));
75
  $form->addField("ServerResultURL", 'hidden', array('name'=>"ServerResultURL", 'value'=>Mage::getSingleton('checkout/session')->getServerresulturl()));
76
  $form->addField("PaymentFormDisplaysResult", 'hidden', array('name'=>"PaymentFormDisplaysResult", 'value'=>Mage::getSingleton('checkout/session')->getPaymentformdisplaysresult()));
77
+ $form->addField("ServerResultURLCookieVariables", 'hidden', array('name'=>"ServerResultURLCookieVariables", 'value'=>Mage::getSingleton('checkout/session')->getServerresulturlcookievariables()));
78
+ $form->addField("ServerResultURLFormVariables", 'hidden', array('name'=>"ServerResultURLFormVariables", 'value'=>Mage::getSingleton('checkout/session')->getServerresulturlformvariables()));
79
+ $form->addField("ServerResultURLQueryStringVariables", 'hidden', array('name'=>"ServerResultURLQueryStringVariables", 'value'=>Mage::getSingleton('checkout/session')->getServerresulturlquerystringvariables()));
80
 
81
  // reset the session items
82
  Mage::getSingleton('checkout/session')->setHashdigest(null)
105
  ->setCountrymandatory(null)
106
  ->setResultdeliverymethod(null)
107
  ->setServerresulturl(null)
108
+ ->setPaymentformdisplaysresult(null)
109
+ ->setServerresulturlcookievariables(null)
110
+ ->setServerresulturlformvariables(null)
111
+ ->setServerresulturlquerystringvariables(null);
112
 
113
  $html = '<html><body>';
114
  $html.= $this->__('You will be redirected to a secure payment page in a few seconds.');
119
  return $html;
120
  }
121
 
122
+ /**
123
+ * Build the redirect form for the Transparent Redirect payment type
124
+ *
125
+ * @return unknown
126
+ */
127
  private function _redirectToTransparentRedirect()
128
  {
129
  $html;
143
  return $html;
144
  }
145
 
146
+ /**
147
+ * Build the submit
148
+ *
149
+ * @param unknown_type $szActionURL
150
+ * @return unknown
151
+ */
152
  private function _submitTransaction($szActionURL)
153
  {
154
  $html = '';
223
  return $html;
224
  }
225
 
226
+ /**
227
+ * Build the form for the Transparent Redirect 3DSecure authentication payment
228
+ *
229
+ * @param unknown_type $szActionURL
230
+ * @return unknown
231
+ */
232
  private function _submitPaRes($szActionURL)
233
  {
234
  $html = '';
app/code/local/Iridiumcorp/Tpg/Block/Threedsecure.php CHANGED
@@ -8,7 +8,7 @@ class Iridiumcorp_Tpg_Block_Threedsecure extends Mage_Core_Block_Abstract
8
  */
9
  protected function _toHtml()
10
  {
11
- $szTermURL = Mage::getSingleton('checkout/session')->getTermurl();
12
 
13
  $form = new Varien_Data_Form();
14
  $form->setAction(Mage::getSingleton('checkout/session')->getAcsurl())
@@ -30,8 +30,7 @@ class Iridiumcorp_Tpg_Block_Threedsecure extends Mage_Core_Block_Abstract
30
  // reset the 3DS session values
31
  Mage::getSingleton('checkout/session')->setMd(null)
32
  ->setAcsurl(null)
33
- ->setPareq(null)
34
- ->setTermurl(null);
35
 
36
  return $html;
37
  }
8
  */
9
  protected function _toHtml()
10
  {
11
+ $szTermURL = 'tpg/payment/callback3d';
12
 
13
  $form = new Varien_Data_Form();
14
  $form->setAction(Mage::getSingleton('checkout/session')->getAcsurl())
30
  // reset the 3DS session values
31
  Mage::getSingleton('checkout/session')->setMd(null)
32
  ->setAcsurl(null)
33
+ ->setPareq(null);
 
34
 
35
  return $html;
36
  }
app/code/local/Iridiumcorp/Tpg/Model/Direct.php CHANGED
@@ -5,11 +5,6 @@ include_once ("Tpg/PaymentFormHelper.php");
5
  include ("Tpg/ISOCurrencies.php");
6
  include ("Tpg/ISOCountries.php");
7
 
8
- // GLOBAL 3D Secure authorization result variables:
9
- $m_sz3DSecureMessage;
10
- $m_bo3DSecureError;
11
- $m_boPayInvoice;
12
-
13
  class Iridiumcorp_Tpg_Model_Direct extends Mage_Payment_Model_Method_Abstract
14
  {
15
  /**
@@ -22,7 +17,7 @@ class Iridiumcorp_Tpg_Model_Direct extends Mage_Payment_Model_Method_Abstract
22
  protected $_infoBlockType = 'tpg/info';
23
 
24
  protected $_isGateway = true;
25
- protected $_canAuthorize = false;
26
  protected $_canCapture = true;
27
  protected $_canCapturePartial = true;
28
  protected $_canRefund = false;
@@ -32,7 +27,7 @@ class Iridiumcorp_Tpg_Model_Direct extends Mage_Payment_Model_Method_Abstract
32
  protected $_canUseForMultishipping = true;
33
  protected $_canSaveCc = false;
34
 
35
- /**
36
  * Assign data to info model instance
37
  *
38
  * @param mixed $data
@@ -97,35 +92,64 @@ class Iridiumcorp_Tpg_Model_Direct extends Mage_Payment_Model_Method_Abstract
97
  public function capture(Varien_Object $payment, $amount)
98
  {
99
  $error = false;
 
 
100
 
101
- // reset the global 3D Secure variables
102
- $GLOBALS['m_bo3DSecureError'] = true;
103
- $GLOBALS['m_sz3DSecureMessage'] = false;
104
-
105
  if($amount <= 0)
106
  {
107
  Mage::throwException(Mage::helper('paygate')->__('Invalid amount for authorization.'));
108
  }
109
  else
110
  {
111
- // reset the 3DS properties for a fresh payment request
112
- Mage::getSingleton('checkout/session')
113
- ->setMd(null)
114
- ->setAcsurl(null)
115
- ->setPareq(null)
116
- ->setTermurl(null);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
117
 
118
- // run a fresh payment request
119
- switch ($this->getConfigData('mode'))
 
 
 
 
 
 
 
 
 
 
 
120
  {
121
  case Iridiumcorp_Tpg_Model_Source_PaymentMode::PAYMENT_MODE_DIRECT_API:
122
- $this->_runTransaction($payment, $amount);
123
  break;
124
  case Iridiumcorp_Tpg_Model_Source_PaymentMode::PAYMENT_MODE_HOSTED_PAYMENT_FORM:
125
- $this->_redirectTransaction($payment, $amount);
126
  break;
127
  case Iridiumcorp_Tpg_Model_Source_PaymentMode::PAYMENT_MODE_TRANSPARENT_REDIRECT:
128
- $this->_transparentRedirectTransaction($payment, $amount);
129
  break;
130
  default:
131
  Mage::throwException('Invalid payment type: '.$this->getConfigData('mode'));
@@ -133,6 +157,11 @@ class Iridiumcorp_Tpg_Model_Direct extends Mage_Payment_Model_Method_Abstract
133
  }
134
  }
135
 
 
 
 
 
 
136
  return $this;
137
  }
138
 
@@ -145,8 +174,8 @@ class Iridiumcorp_Tpg_Model_Direct extends Mage_Payment_Model_Method_Abstract
145
  */
146
  public function _runTransaction(Varien_Object $payment, $amount)
147
  {
148
- $GLOBALS['m_boPayInvoice'] = false;
149
- $payment->setIsTransactionPending(true);
150
 
151
  $MerchantID = $this->getConfigData('merchantid');
152
  $Password = $this->getConfigData('password');
@@ -179,7 +208,6 @@ class Iridiumcorp_Tpg_Model_Direct extends Mage_Payment_Model_Method_Abstract
179
  $PaymentProcessorFullDomain = $this->_getPaymentProcessorFullDomain();
180
 
181
  $rgeplRequestGatewayEntryPointList = new IRC_RequestGatewayEntryPointList();
182
-
183
  $rgeplRequestGatewayEntryPointList->add("https://gw1.".$PaymentProcessorFullDomain, 100, 2);
184
  $rgeplRequestGatewayEntryPointList->add("https://gw2.".$PaymentProcessorFullDomain, 200, 2);
185
  $rgeplRequestGatewayEntryPointList->add("https://gw3.".$PaymentProcessorFullDomain, 300, 2);
@@ -273,13 +301,13 @@ class Iridiumcorp_Tpg_Model_Direct extends Mage_Payment_Model_Method_Abstract
273
  if ($boTransactionProcessed == false)
274
  {
275
  // could not communicate with the payment gateway
 
 
276
  $szLogMessage = "Couldn't complete transaction. Details: ".print_r($cdtrCardDetailsTransactionResult, 1)." ".print_r($todTransactionOutputData, 1); //"Couldn't communicate with payment gateway.";
277
  Mage::log($szLogMessage);
278
- Mage::throwException(Iridiumcorp_Tpg_Model_Tpg_GlobalErrors::ERROR_261);
279
  }
280
  else
281
  {
282
- $boError = true;
283
  $szLogMessage = "Transaction could not be completed for OrderID: ".$szOrderID.". Result details: ";
284
  $szNotificationMessage = 'Payment Processor Response: '.$cdtrCardDetailsTransactionResult->getMessage();
285
 
@@ -287,21 +315,13 @@ class Iridiumcorp_Tpg_Model_Direct extends Mage_Payment_Model_Method_Abstract
287
  {
288
  case 0:
289
  // status code of 0 - means transaction successful
290
- $boError = false;
291
- $GLOBALS['m_boPayInvoice'] = true;
292
- $payment->setIsTransactionPending(false);
293
-
294
- $this->updateOrderState($order, 'processing', $szNotificationMessage);
295
-
296
  $szLogMessage = "Transaction successfully completed for OrderID: ".$szOrderID.". Result object details: ";
297
  Mage::getSingleton('core/session')->addSuccess($szNotificationMessage);
298
  break;
299
  case 3:
300
  // status code of 3 - means 3D Secure authentication required
301
- $boError = false;
302
  $szLogMessage = "3D Secure Authentication required for OrderID: ".$szOrderID.". Result object details: ";
303
- $order->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, true, '3D Secure authentication required');
304
- $GLOBALS['m_boPayInvoice'] = false;
305
 
306
  $szPaReq = $todTransactionOutputData->getThreeDSecureOutputData()->getPaREQ();
307
  $szCrossReference = $todTransactionOutputData->getCrossReference();
@@ -309,11 +329,11 @@ class Iridiumcorp_Tpg_Model_Direct extends Mage_Payment_Model_Method_Abstract
309
 
310
  Mage::getSingleton('checkout/session')->setMd($szCrossReference)
311
  ->setAcsurl($szACSURL)
312
- ->setPareq($szPaReq)
313
- ->setTermurl('tpg/payment/callback3d');
314
  break;
315
  case 5:
316
  // status code of 5 - means transaction declined
 
317
  break;
318
  case 20:
319
  // status code of 20 - means duplicate transaction
@@ -321,14 +341,18 @@ class Iridiumcorp_Tpg_Model_Direct extends Mage_Payment_Model_Method_Abstract
321
  $szLogMessage = "Duplicate transaction for OrderID: ".$szOrderID.". A duplicate transaction means that a transaction with these details has already been processed by the payment provider. The details of the original transaction: ".$szPreviousTransactionMessage.". Result object details: ";
322
  $szNotificationMessage = $szNotificationMessage.". 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: ".$szPreviousTransactionMessage;
323
 
324
- if ($cdtrCardDetailsTransactionResult->getPreviousTransactionResult()->getStatusCode()->getValue() == 0)
 
 
 
 
325
  {
326
- $boError = false;
327
  Mage::getSingleton('core/session')->addSuccess($szNotificationMessage);
328
  }
329
  break;
330
  case 30:
331
- // status code of 30 - means an error occurred
 
332
  $szLogMessage = "Transaction could not be completed for OrderID: ".$szOrderID.". Error message: ".$cdtrCardDetailsTransactionResult->getMessage();
333
  if ($cdtrCardDetailsTransactionResult->getErrorMessages()->getCount() > 0)
334
  {
@@ -344,18 +368,22 @@ class Iridiumcorp_Tpg_Model_Direct extends Mage_Payment_Model_Method_Abstract
344
  break;
345
  default:
346
  // unhandled status code
 
347
  break;
348
  }
349
 
350
  $szLogMessage = $szLogMessage.print_r($cdtrCardDetailsTransactionResult, 1);
351
  Mage::log($szLogMessage);
352
-
353
- // if the payment was not sucessful notify the customer with a message
354
- if($boError == true)
355
- {
356
- Mage::throwException($szNotificationMessage);
357
- }
358
  }
 
 
 
 
 
 
 
 
 
359
  }
360
 
361
  /**
@@ -364,10 +392,9 @@ class Iridiumcorp_Tpg_Model_Direct extends Mage_Payment_Model_Method_Abstract
364
  * @param Varien_Object $payment
365
  * @param unknown_type $amount
366
  */
367
- public function _redirectTransaction(Varien_Object $payment, $amount)
368
  {
369
- $GLOBALS['m_boPayInvoice'] = false;
370
- $payment->setIsTransactionPending(true);
371
 
372
  $szMerchantID = $this->getConfigData('merchantid');
373
  $szPassword = $this->getConfigData('password');
@@ -381,13 +408,34 @@ class Iridiumcorp_Tpg_Model_Direct extends Mage_Payment_Model_Method_Abstract
381
  $boStateMandatory = 'false';
382
  $boCountryMandatory = 'false';
383
  $rdmResultdeliveryMethod = $this->getConfigData('resultdeliverymethod');
384
- $szServerResultURL = $this->getConfigData('serverresulturl');
385
- $boPaymentFormDisplaysResult = 'false';
386
-
 
387
  $order = $payment->getOrder();
388
  $billingAddress = $order->getBillingAddress();
389
  $iclISOCurrencyList = IRC_ISOCurrencies::getISOCurrencyList();
390
  $iclISOCountryList = IRC_ISOCountries::getISOCountryList();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
391
 
392
  $szCurrencyShort = $order->getOrderCurrency()->getCurrencyCode();
393
  if ($szCurrencyShort != '' &&
@@ -454,35 +502,38 @@ class Iridiumcorp_Tpg_Model_Direct extends Mage_Payment_Model_Method_Abstract
454
  $boPaymentFormDisplaysResult = 'true';
455
  }
456
 
457
- $szHashDigest = IRC_PaymentFormHelper::calculateHashDigest($szMerchantID, $szPassword, $hmHashMethod, $szPreSharedKey, $nAmount, $nCurrencyCode, $szOrderID, $szTransactionType, $szTransactionDateTime, $szCallbackURL, $szOrderDescription, $szCustomerName, $szAddress1, $szAddress2, $szAddress3, $szAddress4, $szCity, $szState, $szPostCode, $nCountryCode, $boCV2Mandatory, $boAddress1Mandatory, $boCityMandatory, $boPostCodeMandatory, $boStateMandatory, $boCountryMandatory, $rdmResultdeliveryMethod, $szServerResultURL, $boPaymentFormDisplaysResult);
458
 
459
- Mage::getSingleton('checkout/session')->setHashdigest($szHashDigest)
460
- ->setMerchantid($szMerchantID)
461
- ->setAmount($nAmount)
462
- ->setCurrencycode($nCurrencyCode)
463
- ->setOrderid($szOrderID)
464
- ->setTransactiontype($szTransactionType)
465
- ->setTransactiondatetime($szTransactionDateTime)
466
- ->setCallbackurl($szCallbackURL)
467
- ->setOrderdescription($szOrderDescription)
468
- ->setCustomername($szCustomerName)
469
- ->setAddress1($szAddress1)
470
- ->setAddress2($szAddress2)
471
- ->setAddress3($szAddress3)
472
- ->setAddress4($szAddress4)
473
- ->setCity($szCity)
474
- ->setState($szState)
475
- ->setPostcode($szPostCode)
476
- ->setCountrycode($nCountryCode)
477
- ->setCv2mandatory($boCV2Mandatory)
478
- ->setAddress1mandatory($boAddress1Mandatory)
479
- ->setCitymandatory($boCityMandatory)
480
- ->setPostcodemandatory($boPostCodeMandatory)
481
- ->setStatemandatory($boStateMandatory)
482
- ->setCountrymandatory($boCountryMandatory)
483
- ->setResultdeliverymethod($rdmResultdeliveryMethod)
484
- ->setServerresulturl($szServerResultURL)
485
- ->setPaymentformdisplaysresult($boPaymentFormDisplaysResult);
 
 
 
486
  }
487
 
488
  /**
@@ -491,7 +542,7 @@ class Iridiumcorp_Tpg_Model_Direct extends Mage_Payment_Model_Method_Abstract
491
  * @param Varien_Object $payment
492
  * @param unknown_type $amount
493
  */
494
- public function _transparentRedirectTransaction(Varien_Object $payment, $amount)
495
  {
496
  $GLOBALS['m_boPayInvoice'] = false;
497
  $payment->setIsTransactionPending(true);
@@ -590,12 +641,13 @@ class Iridiumcorp_Tpg_Model_Direct extends Mage_Payment_Model_Method_Abstract
590
  * @param string $szPaRes
591
  * @param string $szMD
592
  */
593
- public function _run3DSecureTransaction($szPaRes, $szMD)
594
  {
595
- $szStatus = 'canceled';
596
- $szOrderID = Mage::getSingleton('checkout/session')->getLastRealOrderId();
597
- $order = Mage::getModel('sales/order');
598
- $order->loadByIncrementId($szOrderID);
 
599
 
600
  $MerchantID = $this->getConfigData('merchantid');
601
  $Password = $this->getConfigData('password');
@@ -616,29 +668,24 @@ class Iridiumcorp_Tpg_Model_Direct extends Mage_Payment_Model_Method_Abstract
616
  if ($boTransactionProcessed == false)
617
  {
618
  // could not communicate with the payment gateway
619
- //PaymentFormHelper::reportTransactionResults($CrossReference, 30, $Message, null);
620
  $szLogMessage = Iridiumcorp_Tpg_Model_Tpg_GlobalErrors::ERROR_431;
 
621
  Mage::log($szLogMessage);
622
-
623
- $GLOBALS['m_bo3DSecureError'] = true;
624
- $GLOBALS['m_sz3DSecureMessage'] = Iridiumcorp_Tpg_Model_Tpg_GlobalErrors::ERROR_431;
625
  }
626
  else
627
  {
 
628
  $szLogMessage = "3D Secure transaction could not be completed for OrderID: ".$szOrderID.". Result object details: ";
629
- $GLOBALS['m_bo3DSecureError'] = true;
630
- $GLOBALS['m_sz3DSecureMessage'] = "Payment Processor Response: ".$tdsarThreeDSecureAuthenticationResult->getMessage();
631
 
632
  switch ($tdsarThreeDSecureAuthenticationResult->getStatusCode())
633
  {
634
  case 0:
635
  // status code of 0 - means transaction successful
636
- $GLOBALS['m_bo3DSecureError'] = false;
637
  $szLogMessage = "3D Secure transaction successfully completed for OrderID: ".$szOrderID.". Result object details: ";
638
- $szStatus = 'processing';
639
  break;
640
  case 5:
641
  // status code of 5 - means transaction declined
 
642
  break;
643
  case 20:
644
  // status code of 20 - means duplicate transaction
@@ -647,51 +694,107 @@ class Iridiumcorp_Tpg_Model_Direct extends Mage_Payment_Model_Method_Abstract
647
 
648
  if ($tdsarThreeDSecureAuthenticationResult->getPreviousTransactionResult()->getStatusCode()->getValue() == 0)
649
  {
650
- $GLOBALS['m_bo3DSecureError'] = false;
651
- $GLOBALS['m_sz3DSecureMessage'] = $GLOBALS['m_sz3DSecureMessage'].". A duplicate transaction means that a transaction with these details has already been processed by the payment provider. The details of the original transaction are - ".$szPreviousTransactionMessage;
 
 
 
652
  }
653
  break;
654
  case 30:
 
655
  // status code of 30 - means an error occurred
656
  $szLogMessage = "3D Secure transaction could not be completed for OrderID: ".$szOrderID.". Error message: ".$tdsarThreeDSecureAuthenticationResult->getMessage();
657
  if ($tdsarThreeDSecureAuthenticationResult->getErrorMessages()->getCount() > 0)
658
  {
659
  $szLogMessage = $szLogMessage.".";
 
660
 
661
  for ($LoopIndex = 0; $LoopIndex < $tdsarThreeDSecureAuthenticationResult->getErrorMessages()->getCount(); $LoopIndex++)
662
  {
663
  $szLogMessage = $szLogMessage.$tdsarThreeDSecureAuthenticationResult->getErrorMessages()->getAt($LoopIndex).";";
 
664
  }
665
  $szLogMessage = $szLogMessage." ";
 
666
  }
667
  break;
668
  default:
669
- // unhandled status code
 
670
  break;
671
  }
672
 
673
  // log 3DS payment result
674
  $szLogMessage = $szLogMessage.print_r($tdsarThreeDSecureAuthenticationResult, 1);
675
  Mage::log($szLogMessage);
676
-
677
- $this->updateOrderState($order, $szStatus, $GLOBALS['m_sz3DSecureMessage']);
678
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
679
  }
680
 
681
- /**
682
- * Building the request object for 3D Secure payment
683
- *
684
- * @param string $PaRes
685
- * @param string $MD
686
- * @return Iridiumcorp_Tpg_Model_Request
687
- */
688
- public function _build3DSecureRequest($PaRes, $MD)
689
  {
690
- $request = Mage::getModel('tpg/request')
691
- ->setPares($PaRes)
692
- ->setMd($MD);
693
 
694
- return $request;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
695
  }
696
 
697
  /**
@@ -703,18 +806,19 @@ class Iridiumcorp_Tpg_Model_Direct extends Mage_Payment_Model_Method_Abstract
703
  {
704
  $result = false;
705
  $session = Mage::getSingleton('checkout/session');
706
-
707
- // get the correct url for redirection
708
- if ($session->getAcsurl() &&
709
- $session->getMd() &&
710
- $session->getPareq())
711
- {
712
- $result = Mage::getUrl('tpg/payment/threedsecure');
713
- }
714
- else if ($session->getHashdigest())
715
- {
716
- $result = Mage::getUrl('tpg/payment/redirect');
717
- }
 
718
 
719
  return $result;
720
  }
@@ -774,29 +878,4 @@ class Iridiumcorp_Tpg_Model_Direct extends Mage_Payment_Model_Method_Abstract
774
 
775
  return $szISO3Code;
776
  }
777
-
778
- public function updateOrderState($order, $szStatus, $szMessage)
779
- {
780
- if($order)
781
- {
782
- if($szStatus == 'processing')
783
- {
784
- $order->addStatusToHistory($szStatus, $szMessage, false);
785
- //$order->sendNewOrderEmail();
786
- //$order->setEmailSent(true);
787
- $order->save();
788
- }
789
- else if($szStatus == 'canceled')
790
- {
791
- $order->addStatusToHistory($szStatus, $szMessage, false);
792
- $order->cancel();
793
- $order->save();
794
- }
795
- else
796
- {
797
- $order->addStatusToHistory($szStatus, $szMessage, false);
798
- $order->save();
799
- }
800
- }
801
- }
802
- }
5
  include ("Tpg/ISOCurrencies.php");
6
  include ("Tpg/ISOCountries.php");
7
 
 
 
 
 
 
8
  class Iridiumcorp_Tpg_Model_Direct extends Mage_Payment_Model_Method_Abstract
9
  {
10
  /**
17
  protected $_infoBlockType = 'tpg/info';
18
 
19
  protected $_isGateway = true;
20
+ protected $_canAuthorize = true;
21
  protected $_canCapture = true;
22
  protected $_canCapturePartial = true;
23
  protected $_canRefund = false;
27
  protected $_canUseForMultishipping = true;
28
  protected $_canSaveCc = false;
29
 
30
+ /** OK
31
  * Assign data to info model instance
32
  *
33
  * @param mixed $data
92
  public function capture(Varien_Object $payment, $amount)
93
  {
94
  $error = false;
95
+ $session = Mage::getSingleton('checkout/session');
96
+ $mode = $this->getConfigData('mode');
97
 
 
 
 
 
98
  if($amount <= 0)
99
  {
100
  Mage::throwException(Mage::helper('paygate')->__('Invalid amount for authorization.'));
101
  }
102
  else
103
  {
104
+ if($session->getThreedsecurerequired())
105
+ {
106
+ $md = $session->getMd();
107
+ $pares = $session->getPares();
108
+
109
+ $session->setThreedsecurerequired(null);
110
+ $this->_run3DSecureTransaction($payment, $pares, $md);
111
+
112
+ return $this;
113
+ }
114
+ if($session->getRedirectedpayment())
115
+ {
116
+ $szStatusCode = $session->getStatuscode();
117
+ $szMessage = $session->getMessage();
118
+ $szPreviousStatusCode = $session->getPreviousstatuscode();
119
+ $szPreviousMessage = $session->getPreviousmessage();
120
+ $szOrderID = $session->getOrderid();
121
+ // check whether it is a hosted payment or a transparent redirect action
122
+ $boIsHostedPaymentAction = $session->getIshostedpayment();
123
+
124
+ $session->setRedirectedpayment(null);
125
+ $session->setIshostedpayment(null);
126
+ $this->_runRedirectedPaymentComplete($payment, $boIsHostedPaymentAction, $szStatusCode, $szMessage, $szPreviousStatusCode, $szPreviousMessage, $szOrderID);
127
+
128
+ return $this;
129
+ }
130
 
131
+ // fresh payment request
132
+ $session->setThreedsecurerequired(null)
133
+ ->setRedirectedpayment(null)
134
+ ->setIshostedpayment(null)
135
+ ->setHostedPayment(null)
136
+ ->setMd(null)
137
+ ->setPareq(null)
138
+ ->setAcsurl(null)
139
+ ->setPaymentprocessorresponse(null);
140
+
141
+ $payment->setAmount($amount);
142
+
143
+ switch ($mode)
144
  {
145
  case Iridiumcorp_Tpg_Model_Source_PaymentMode::PAYMENT_MODE_DIRECT_API:
146
+ $error = $this->_runTransaction($payment, $amount);
147
  break;
148
  case Iridiumcorp_Tpg_Model_Source_PaymentMode::PAYMENT_MODE_HOSTED_PAYMENT_FORM:
149
+ $error = $this->_runHostedPaymentTransaction($payment, $amount);
150
  break;
151
  case Iridiumcorp_Tpg_Model_Source_PaymentMode::PAYMENT_MODE_TRANSPARENT_REDIRECT:
152
+ $error = $this->_runTransparentRedirectTransaction($payment, $amount);
153
  break;
154
  default:
155
  Mage::throwException('Invalid payment type: '.$this->getConfigData('mode'));
157
  }
158
  }
159
 
160
+ if($error)
161
+ {
162
+ Mage::throwException($error);
163
+ }
164
+
165
  return $this;
166
  }
167
 
174
  */
175
  public function _runTransaction(Varien_Object $payment, $amount)
176
  {
177
+ $error = '';
178
+ $session = Mage::getSingleton('checkout/session');
179
 
180
  $MerchantID = $this->getConfigData('merchantid');
181
  $Password = $this->getConfigData('password');
208
  $PaymentProcessorFullDomain = $this->_getPaymentProcessorFullDomain();
209
 
210
  $rgeplRequestGatewayEntryPointList = new IRC_RequestGatewayEntryPointList();
 
211
  $rgeplRequestGatewayEntryPointList->add("https://gw1.".$PaymentProcessorFullDomain, 100, 2);
212
  $rgeplRequestGatewayEntryPointList->add("https://gw2.".$PaymentProcessorFullDomain, 200, 2);
213
  $rgeplRequestGatewayEntryPointList->add("https://gw3.".$PaymentProcessorFullDomain, 300, 2);
301
  if ($boTransactionProcessed == false)
302
  {
303
  // could not communicate with the payment gateway
304
+ $error = Iridiumcorp_Tpg_Model_Tpg_GlobalErrors::ERROR_261;
305
+
306
  $szLogMessage = "Couldn't complete transaction. Details: ".print_r($cdtrCardDetailsTransactionResult, 1)." ".print_r($todTransactionOutputData, 1); //"Couldn't communicate with payment gateway.";
307
  Mage::log($szLogMessage);
 
308
  }
309
  else
310
  {
 
311
  $szLogMessage = "Transaction could not be completed for OrderID: ".$szOrderID.". Result details: ";
312
  $szNotificationMessage = 'Payment Processor Response: '.$cdtrCardDetailsTransactionResult->getMessage();
313
 
315
  {
316
  case 0:
317
  // status code of 0 - means transaction successful
 
 
 
 
 
 
318
  $szLogMessage = "Transaction successfully completed for OrderID: ".$szOrderID.". Result object details: ";
319
  Mage::getSingleton('core/session')->addSuccess($szNotificationMessage);
320
  break;
321
  case 3:
322
  // status code of 3 - means 3D Secure authentication required
 
323
  $szLogMessage = "3D Secure Authentication required for OrderID: ".$szOrderID.". Result object details: ";
324
+ $szNotificationMessage = '';
 
325
 
326
  $szPaReq = $todTransactionOutputData->getThreeDSecureOutputData()->getPaREQ();
327
  $szCrossReference = $todTransactionOutputData->getCrossReference();
329
 
330
  Mage::getSingleton('checkout/session')->setMd($szCrossReference)
331
  ->setAcsurl($szACSURL)
332
+ ->setPareq($szPaReq);
 
333
  break;
334
  case 5:
335
  // status code of 5 - means transaction declined
336
+ $error = $szNotificationMessage;
337
  break;
338
  case 20:
339
  // status code of 20 - means duplicate transaction
341
  $szLogMessage = "Duplicate transaction for OrderID: ".$szOrderID.". A duplicate transaction means that a transaction with these details has already been processed by the payment provider. The details of the original transaction: ".$szPreviousTransactionMessage.". Result object details: ";
342
  $szNotificationMessage = $szNotificationMessage.". 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: ".$szPreviousTransactionMessage;
343
 
344
+ if ($cdtrCardDetailsTransactionResult->getPreviousTransactionResult()->getStatusCode()->getValue() != 0)
345
+ {
346
+ $error = $szNotificationMessage;
347
+ }
348
+ else
349
  {
 
350
  Mage::getSingleton('core/session')->addSuccess($szNotificationMessage);
351
  }
352
  break;
353
  case 30:
354
+ // status code of 30 - means an error occurred
355
+ $error = $szNotificationMessage;
356
  $szLogMessage = "Transaction could not be completed for OrderID: ".$szOrderID.". Error message: ".$cdtrCardDetailsTransactionResult->getMessage();
357
  if ($cdtrCardDetailsTransactionResult->getErrorMessages()->getCount() > 0)
358
  {
368
  break;
369
  default:
370
  // unhandled status code
371
+ $error = $szNotificationMessage;
372
  break;
373
  }
374
 
375
  $szLogMessage = $szLogMessage.print_r($cdtrCardDetailsTransactionResult, 1);
376
  Mage::log($szLogMessage);
 
 
 
 
 
 
377
  }
378
+
379
+ if($error)
380
+ {
381
+ $payment->setStatus('FAIL')
382
+ ->setCcApproval('FAIL')
383
+ ->setAdditionalData($cdtrCardDetailsTransactionResult->getMessage());
384
+ }
385
+
386
+ return $error;
387
  }
388
 
389
  /**
392
  * @param Varien_Object $payment
393
  * @param unknown_type $amount
394
  */
395
+ public function _runHostedPaymentTransaction(Varien_Object $payment, $amount)
396
  {
397
+ $session = Mage::getSingleton('checkout/session');
 
398
 
399
  $szMerchantID = $this->getConfigData('merchantid');
400
  $szPassword = $this->getConfigData('password');
408
  $boStateMandatory = 'false';
409
  $boCountryMandatory = 'false';
410
  $rdmResultdeliveryMethod = $this->getConfigData('resultdeliverymethod');
411
+ $szServerResultURL = Mage::getUrl('tpg/payment/serverresult');
412
+ // set to always true to display the result on the Hosted Payment Form
413
+ $boPaymentFormDisplaysResult = 'true';
414
+
415
  $order = $payment->getOrder();
416
  $billingAddress = $order->getBillingAddress();
417
  $iclISOCurrencyList = IRC_ISOCurrencies::getISOCurrencyList();
418
  $iclISOCountryList = IRC_ISOCountries::getISOCountryList();
419
+ $cookie = Mage::getSingleton('core/cookie');
420
+ $arCookieArray = $cookie->get();
421
+ $arCookieKeysArray = array_keys($arCookieArray);
422
+ $nKeysArrayLength = count($arCookieKeysArray);
423
+ $szCookiePath = $cookie->getPath();
424
+ $szCookieDomain = $cookie->getDomain();
425
+ $szServerResultURLCookieVariables = '';
426
+ $szServerResultURLFormVariables = '';
427
+ $szServerResultURLQueryStringVariables = '';
428
+ //ServerResutlURLCookieVariables string format: cookie1=123&path=/&domain=www.domain.com@@cookie2=456&path=/&domain=www.domain.com
429
+
430
+ for($nCount = 0; $nCount < $nKeysArrayLength; $nCount++)
431
+ {
432
+ $szEncodedCookieValue = urlencode($arCookieArray[$arCookieKeysArray[$nCount]]);
433
+ $szServerResultURLCookieVariables .= $arCookieKeysArray[$nCount]."=".$szEncodedCookieValue."&path=".$szCookiePath."&domain=".$szCookieDomain;
434
+ if($nCount < $nKeysArrayLength - 1)
435
+ {
436
+ $szServerResultURLCookieVariables .= "@@";
437
+ }
438
+ }
439
 
440
  $szCurrencyShort = $order->getOrderCurrency()->getCurrencyCode();
441
  if ($szCurrencyShort != '' &&
502
  $boPaymentFormDisplaysResult = 'true';
503
  }
504
 
505
+ $szHashDigest = IRC_PaymentFormHelper::calculateHashDigest($szMerchantID, $szPassword, $hmHashMethod, $szPreSharedKey, $nAmount, $nCurrencyCode, $szOrderID, $szTransactionType, $szTransactionDateTime, $szCallbackURL, $szOrderDescription, $szCustomerName, $szAddress1, $szAddress2, $szAddress3, $szAddress4, $szCity, $szState, $szPostCode, $nCountryCode, $boCV2Mandatory, $boAddress1Mandatory, $boCityMandatory, $boPostCodeMandatory, $boStateMandatory, $boCountryMandatory, $rdmResultdeliveryMethod, $szServerResultURL, $boPaymentFormDisplaysResult, $szServerResultURLCookieVariables, $szServerResultURLFormVariables, $szServerResultURLQueryStringVariables);
506
 
507
+ $session->setHashdigest($szHashDigest)
508
+ ->setMerchantid($szMerchantID)
509
+ ->setAmount($nAmount)
510
+ ->setCurrencycode($nCurrencyCode)
511
+ ->setOrderid($szOrderID)
512
+ ->setTransactiontype($szTransactionType)
513
+ ->setTransactiondatetime($szTransactionDateTime)
514
+ ->setCallbackurl($szCallbackURL)
515
+ ->setOrderdescription($szOrderDescription)
516
+ ->setCustomername($szCustomerName)
517
+ ->setAddress1($szAddress1)
518
+ ->setAddress2($szAddress2)
519
+ ->setAddress3($szAddress3)
520
+ ->setAddress4($szAddress4)
521
+ ->setCity($szCity)
522
+ ->setState($szState)
523
+ ->setPostcode($szPostCode)
524
+ ->setCountrycode($nCountryCode)
525
+ ->setCv2mandatory($boCV2Mandatory)
526
+ ->setAddress1mandatory($boAddress1Mandatory)
527
+ ->setCitymandatory($boCityMandatory)
528
+ ->setPostcodemandatory($boPostCodeMandatory)
529
+ ->setStatemandatory($boStateMandatory)
530
+ ->setCountrymandatory($boCountryMandatory)
531
+ ->setResultdeliverymethod($rdmResultdeliveryMethod)
532
+ ->setServerresulturl($szServerResultURL)
533
+ ->setPaymentformdisplaysresult($boPaymentFormDisplaysResult)
534
+ ->setServerresulturlcookievariables($szServerResultURLCookieVariables)
535
+ ->setServerresulturlformvariables($szServerResultURLFormVariables)
536
+ ->setServerresulturlquerystringvariables($szServerResultURLQueryStringVariables);
537
  }
538
 
539
  /**
542
  * @param Varien_Object $payment
543
  * @param unknown_type $amount
544
  */
545
+ public function _runTransparentRedirectTransaction(Varien_Object $payment, $amount)
546
  {
547
  $GLOBALS['m_boPayInvoice'] = false;
548
  $payment->setIsTransactionPending(true);
641
  * @param string $szPaRes
642
  * @param string $szMD
643
  */
644
+ public function _run3DSecureTransaction(Varien_Object $payment, $szPaRes, $szMD)
645
  {
646
+ $error = false;
647
+ $message = '';
648
+ $order = $payment->getOrder();
649
+ $szOrderID = $payment->getOrder()->increment_id;
650
+ $session = Mage::getSingleton('checkout/session');
651
 
652
  $MerchantID = $this->getConfigData('merchantid');
653
  $Password = $this->getConfigData('password');
668
  if ($boTransactionProcessed == false)
669
  {
670
  // could not communicate with the payment gateway
 
671
  $szLogMessage = Iridiumcorp_Tpg_Model_Tpg_GlobalErrors::ERROR_431;
672
+ $message = Iridiumcorp_Tpg_Model_Tpg_GlobalErrors::ERROR_431;
673
  Mage::log($szLogMessage);
 
 
 
674
  }
675
  else
676
  {
677
+ $message = "Payment Processor Response: ".$tdsarThreeDSecureAuthenticationResult->getMessage();
678
  $szLogMessage = "3D Secure transaction could not be completed for OrderID: ".$szOrderID.". Result object details: ";
 
 
679
 
680
  switch ($tdsarThreeDSecureAuthenticationResult->getStatusCode())
681
  {
682
  case 0:
683
  // status code of 0 - means transaction successful
 
684
  $szLogMessage = "3D Secure transaction successfully completed for OrderID: ".$szOrderID.". Result object details: ";
 
685
  break;
686
  case 5:
687
  // status code of 5 - means transaction declined
688
+ $error = true;
689
  break;
690
  case 20:
691
  // status code of 20 - means duplicate transaction
694
 
695
  if ($tdsarThreeDSecureAuthenticationResult->getPreviousTransactionResult()->getStatusCode()->getValue() == 0)
696
  {
697
+ $message = $message.". A duplicate transaction means that a transaction with these details has already been processed by the payment provider. The details of the original transaction are - ".$szPreviousTransactionMessage;
698
+ }
699
+ else
700
+ {
701
+ $error = true;
702
  }
703
  break;
704
  case 30:
705
+ $error = true;
706
  // status code of 30 - means an error occurred
707
  $szLogMessage = "3D Secure transaction could not be completed for OrderID: ".$szOrderID.". Error message: ".$tdsarThreeDSecureAuthenticationResult->getMessage();
708
  if ($tdsarThreeDSecureAuthenticationResult->getErrorMessages()->getCount() > 0)
709
  {
710
  $szLogMessage = $szLogMessage.".";
711
+ $message =$message.".";
712
 
713
  for ($LoopIndex = 0; $LoopIndex < $tdsarThreeDSecureAuthenticationResult->getErrorMessages()->getCount(); $LoopIndex++)
714
  {
715
  $szLogMessage = $szLogMessage.$tdsarThreeDSecureAuthenticationResult->getErrorMessages()->getAt($LoopIndex).";";
716
+ $message = $message.$tdsarThreeDSecureAuthenticationResult->getErrorMessages()->getAt($LoopIndex).";";
717
  }
718
  $szLogMessage = $szLogMessage." ";
719
+ $message = $message." ";
720
  }
721
  break;
722
  default:
723
+ // unhandled status code
724
+ $error = true;
725
  break;
726
  }
727
 
728
  // log 3DS payment result
729
  $szLogMessage = $szLogMessage.print_r($tdsarThreeDSecureAuthenticationResult, 1);
730
  Mage::log($szLogMessage);
 
 
731
  }
732
+
733
+ $session->setPaymentprocessorresponse($message);
734
+ if($error == true)
735
+ {
736
+ $message = Mage::helper('tpg')->__($message);
737
+ Mage::throwException($message);
738
+ }
739
+ else
740
+ {
741
+ $payment->setStatus(self::STATUS_APPROVED)
742
+ ->setAdditionalData($message);
743
+ }
744
+
745
+ return $this;
746
  }
747
 
748
+ public function _runRedirectedPaymentComplete(Varien_Object $payment, $boIsHostedPaymentAction, $szStatusCode, $szMessage, $szPreviousStatusCode, $szPreviousMessage, $szOrderID)
 
 
 
 
 
 
 
749
  {
750
+ $error = false;
751
+ $message;
752
+ $session = Mage::getSingleton('checkout/session');
753
 
754
+ if($boIsHostedPaymentAction == true)
755
+ {
756
+ $szWording = "Hosted Payment Form ";
757
+ }
758
+ else
759
+ {
760
+ $szWording = "Transparent Redirect ";
761
+ }
762
+
763
+ $message = "Payment Processor Response: ".$szMessage;
764
+ switch ($szStatusCode)
765
+ {
766
+ case "0":
767
+ Mage::log($szWording."transaction successfully completed. ".$message);
768
+ break;
769
+ case "20":
770
+ Mage::log("Duplicate ".$szWording."transaction. ".$message);
771
+ $message = $message.". 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: ".szPreviousMessage;
772
+ if($szPreviousStatusCode != "0")
773
+ {
774
+ $error = true;
775
+ }
776
+ break;
777
+ case "5":
778
+ case "30":
779
+ default:
780
+ Mage::log($szWording."transaction couldn't be completed. ".$message);
781
+ $error = true;
782
+ break;
783
+ }
784
+
785
+ $session->setPaymentprocessorresponse($message);
786
+ if($error == true)
787
+ {
788
+ $message = Mage::helper('tpg')->__($message);
789
+ Mage::throwException($message);
790
+ }
791
+ else
792
+ {
793
+ $payment->setStatus(self::STATUS_APPROVED)
794
+ ->setAdditionalData($message);
795
+ }
796
+
797
+ return $this;
798
  }
799
 
800
  /**
806
  {
807
  $result = false;
808
  $session = Mage::getSingleton('checkout/session');
809
+
810
+ if($session->getMd() &&
811
+ $session->getAcsurl() &&
812
+ $session->getPareq())
813
+ {
814
+ // Direct (API) for 3D Secure payments
815
+ $result = Mage::getUrl('tpg/payment/threedsecure');
816
+ }
817
+ if($session->getHashdigest())
818
+ {
819
+ // Hosted Payment Form and Transparent Redirect payments
820
+ $result = Mage::getUrl('tpg/payment/redirect');
821
+ }
822
 
823
  return $result;
824
  }
878
 
879
  return $szISO3Code;
880
  }
881
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Iridiumcorp/Tpg/Model/Tpg/GlobalErrors.php CHANGED
@@ -2,19 +2,23 @@
2
 
3
  class Iridiumcorp_Tpg_Model_Tpg_GlobalErrors
4
  {
5
- // error occurred in the processing of the callback from the hosted payment form
6
- const ERROR_183 = "ERROR 183: The payment result couldn't be verified.";
 
 
 
 
7
 
8
- // error occurred during the processing of the callback from the transparent redirect page
9
  const ERROR_260 = "ERROR 260: The payment result couldn't be verified.";
10
 
11
- // direct integration transaction cannot be completed - problem in the communication with the payment gateway
12
  const ERROR_261 = "ERROR 261: Couldn't communicate with payment gateway.";
13
 
14
- // direct integration 3D Secure transaction couldn't be processed - problem in the communication with the paymwent gateway
15
- const ERROR_431 = "ERROR 431: Couldn't communicate with payment gateway for 3D Secure transaction.";
16
 
17
- // error occurred during the processing of the data in the callback from the 3D Secure Authentication page
18
- const ERROR_7655 = "ERROR 7655: 3D Secure Validation was not successfull and checkout was cancelled.<br/>Please check your credit card details and try again.";
19
  }
20
  ?>
2
 
3
  class Iridiumcorp_Tpg_Model_Tpg_GlobalErrors
4
  {
5
+ /*
6
+ * failure - probably a wrong card details entered in
7
+ * error - payment gateway communication and hashing related issues
8
+ */
9
+ // failure - occurred in the processing of the final callback from the hosted payment form/transparent redirect
10
+ const ERROR_183 = "The payment was not successful and checkout was cancelled.<br/>Please check your credit card details and try again.";
11
 
12
+ // error - occurred during the partial processing of the callback from the transparent redirect page
13
  const ERROR_260 = "ERROR 260: The payment result couldn't be verified.";
14
 
15
+ // error - direct integration transaction cannot be completed - problem in the communication with the payment gateway
16
  const ERROR_261 = "ERROR 261: Couldn't communicate with payment gateway.";
17
 
18
+ // error - direct integration 3D Secure transaction couldn't be processed - problem in the communication with the paymwent gateway
19
+ const ERROR_431 = "ERROR 431: Couldn't communicate with payment gateway to complete the 3D Secure authentication.";
20
 
21
+ // failure - occurred during the processing of the data in the callback from the 3D Secure Authentication page
22
+ const ERROR_7655 = "3D Secure payment was not successfull and checkout was cancelled.<br/>Please check your credit card details and try again.";
23
  }
24
  ?>
app/code/local/Iridiumcorp/Tpg/Model/Tpg/PaymentFormHelper.php CHANGED
@@ -130,7 +130,7 @@
130
  * @param unknown_type $boPaymentFormDisplaysResult
131
  * @return unknown
132
  */
133
- public static function calculateHashDigest($szMerchantID, $szPassword, $hmHashMethod, $szPreSharedKey, $nAmount, $nCurrencyCode, $szOrderID, $szTransactionType, $szTransactionDateTime, $szCallbackURL, $szOrderDescription, $szCustomerName, $szAddress1, $szAddress2, $szAddress3, $szAddress4, $szCity, $szState, $szPostCode, $nCountryCode, $boCV2Mandatory, $boAddress1Mandatory, $boCityMandatory, $boPostCodeMandatory, $boStateMandatory, $boCountryMandatory, $rdmResultdeliveryMethod, $szServerResultURL, $boPaymentFormDisplaysResult)
134
  {
135
  $szHashDigest = '';
136
  $szStringBeforeHash;
@@ -161,7 +161,10 @@
161
  'CountryMandatory='.$boCountryMandatory.'&'.
162
  'ResultDeliveryMethod='.$rdmResultdeliveryMethod.'&'.
163
  'ServerResultURL='.$szServerResultURL.'&'.
164
- 'PaymentFormDisplaysResult='.$boPaymentFormDisplaysResult;
 
 
 
165
 
166
  if ($hmHashMethod == Iridiumcorp_Tpg_Model_Source_HashMethod::HASH_METHOD_MD5 ||
167
  $hmHashMethod == Iridiumcorp_Tpg_Model_Source_HashMethod::HASH_METHOD_SHA1)
130
  * @param unknown_type $boPaymentFormDisplaysResult
131
  * @return unknown
132
  */
133
+ public static function calculateHashDigest($szMerchantID, $szPassword, $hmHashMethod, $szPreSharedKey, $nAmount, $nCurrencyCode, $szOrderID, $szTransactionType, $szTransactionDateTime, $szCallbackURL, $szOrderDescription, $szCustomerName, $szAddress1, $szAddress2, $szAddress3, $szAddress4, $szCity, $szState, $szPostCode, $nCountryCode, $boCV2Mandatory, $boAddress1Mandatory, $boCityMandatory, $boPostCodeMandatory, $boStateMandatory, $boCountryMandatory, $rdmResultdeliveryMethod, $szServerResultURL, $boPaymentFormDisplaysResult, $szServerResultURLCookieVariables, $szServerResultURLFormVariables, $szServerResultURLQueryStringVariables)
134
  {
135
  $szHashDigest = '';
136
  $szStringBeforeHash;
161
  'CountryMandatory='.$boCountryMandatory.'&'.
162
  'ResultDeliveryMethod='.$rdmResultdeliveryMethod.'&'.
163
  'ServerResultURL='.$szServerResultURL.'&'.
164
+ 'PaymentFormDisplaysResult='.$boPaymentFormDisplaysResult.'&'.
165
+ 'ServerResultURLCookieVariables='.$szServerResultURLCookieVariables.'&'.
166
+ 'ServerResultURLFormVariables='.$szServerResultURLFormVariables.'&'.
167
+ 'ServerResultURLQueryStringVariables='.$szServerResultURLQueryStringVariables;
168
 
169
  if ($hmHashMethod == Iridiumcorp_Tpg_Model_Source_HashMethod::HASH_METHOD_MD5 ||
170
  $hmHashMethod == Iridiumcorp_Tpg_Model_Source_HashMethod::HASH_METHOD_SHA1)
app/code/local/Iridiumcorp/Tpg/controllers/PaymentController.php CHANGED
@@ -19,7 +19,6 @@ class Iridiumcorp_Tpg_PaymentController extends Mage_Core_Controller_Front_Actio
19
 
20
  public function errorAction()
21
  {
22
- Mage::log('error navigation.');
23
  //$this->_redirect('checkout/cart');
24
  $this->_redirect('checkout/onepage/failure');
25
  #$this->loadLayout();
@@ -43,7 +42,7 @@ class Iridiumcorp_Tpg_PaymentController extends Mage_Core_Controller_Front_Actio
43
  */
44
  public function redirectAction()
45
  {
46
- $this->getResponse()->setBody($this->getLayout()->createBlock('tpg/redirect')->toHtml());
47
  }
48
 
49
  /**
@@ -56,7 +55,7 @@ class Iridiumcorp_Tpg_PaymentController extends Mage_Core_Controller_Front_Actio
56
  }
57
 
58
  /**
59
- * Action for handling the reception of the 3D Secure authentication result (PaRes)
60
  *
61
  * @return unknown
62
  */
@@ -64,20 +63,21 @@ class Iridiumcorp_Tpg_PaymentController extends Mage_Core_Controller_Front_Actio
64
  {
65
  $boError = false;
66
  $szMessage = '';
 
 
 
67
 
68
  try
69
  {
70
- // get the PaRes and MD from the post
71
  $szPaRes = $this->getRequest()->getPost('PaRes');
72
  $szMD = $this->getRequest()->getPost('MD');
73
 
74
  // complete the 3D Secure transaction with the 3D Authorization result
75
- Mage::getSingleton('tpg/direct')->_run3DSecureTransaction($szPaRes, $szMD);
76
  }
77
  catch (Exception $exc)
78
  {
79
  $boError = true;
80
- Mage::log('Callback 3DSecure action failed, exception details: '.$exc);
81
 
82
  if( isset($_SESSION['tpg_message']) )
83
  {
@@ -88,54 +88,45 @@ class Iridiumcorp_Tpg_PaymentController extends Mage_Core_Controller_Front_Actio
88
  {
89
  $szMessage = Iridiumcorp_Tpg_Model_Tpg_GlobalErrors::ERROR_7655;
90
  }
 
91
 
 
 
 
 
 
 
 
 
 
92
  // report out an fatal error
93
  Mage::getSingleton('core/session')->addError($szMessage);
94
  $this->_redirect('checkout/onepage/failure');
95
  }
96
-
97
- if (!$boError)
98
  {
99
- // report out an payment result
100
- if($GLOBALS['m_bo3DSecureError'] == 1)
101
- {
102
- // if the global message is empty report out a general error message
103
- if(!$GLOBALS['m_sz3DSecureMessage'])
104
- {
105
- Mage::getSingleton('core/session')->addError("3DSecure Validation was not successfull, please try again.");
106
- }
107
- else
108
- {
109
- Mage::getSingleton('core/session')->addError($GLOBALS['m_sz3DSecureMessage']);
110
- }
111
- $this->_redirect('checkout/onepage/failure');
112
- }
113
- else
114
- {
115
- // set the quote as inactive after back from 3DS Authorization page
116
- Mage::getSingleton('checkout/session')->getQuote()->setIsActive(false)->save();
117
-
118
- // send confirmation email to customer
119
- $order = Mage::getModel('sales/order');
120
 
121
- $order->load(Mage::getSingleton('checkout/session')->getLastOrderId());
122
- if($order->getId())
123
- {
124
- $order->sendNewOrderEmail();
125
- }
126
 
127
- //Mage::getSingleton('checkout/session')->unsQuoteId();
128
- if($GLOBALS['m_sz3DSecureMessage'])
129
- {
130
- Mage::getSingleton('core/session')->addSuccess($GLOBALS['m_sz3DSecureMessage']);
131
- }
132
- $this->_redirect('checkout/onepage/success');
133
- }
 
 
 
 
134
  }
135
  }
136
 
137
  /**
138
- * Action for handling the result from the Hosted Payment page
139
  *
140
  */
141
  public function callbackhostedpaymentAction()
@@ -144,10 +135,10 @@ class Iridiumcorp_Tpg_PaymentController extends Mage_Core_Controller_Front_Actio
144
  $formVariables = array();
145
  $model = Mage::getModel('tpg/direct');
146
  $szOrderID = $this->getRequest()->getPost('OrderID');
147
- $order = Mage::getModel('sales/order');
148
- $order->loadByIncrementId($szOrderID);
149
- $szStatus = 'canceled';
150
-
151
  try
152
  {
153
  $hmHashMethod = $model->getConfigData('hashmethod');
@@ -181,7 +172,17 @@ class Iridiumcorp_Tpg_PaymentController extends Mage_Core_Controller_Front_Actio
181
  {
182
  $boError = true;
183
  $szNotificationMessage = "The payment was rejected for a SECURITY reason: the incoming payment data was tampered with.";
184
- Mage::log("The Hosted Payment Form transaction couldn't be completed for the following reason: ".$error. " Form variables: ".$formVariables);
 
 
 
 
 
 
 
 
 
 
185
  }
186
  }
187
  catch (Exception $exc)
@@ -189,60 +190,106 @@ class Iridiumcorp_Tpg_PaymentController extends Mage_Core_Controller_Front_Actio
189
  $boError = true;
190
  $szNotificationMessage = Iridiumcorp_Tpg_Model_Tpg_GlobalErrors::ERROR_183;
191
  Mage::logException($exc);
192
- Mage::log($error." Order ID: ".$formVariables['OrderID'].". Exception details: ".$exc);
193
  }
194
 
195
- // check the incoming hash digest
196
  if($boError)
197
  {
198
- // do nothing
 
 
 
 
 
 
 
199
  }
200
  else
201
  {
202
- $szNotificationMessage = "Payment Processor Response: ".$formVariables['Message'];
203
- switch ($formVariables['StatusCode'])
204
- {
205
- case "0":
206
- // TODO : maybe to update the order processing status in the Magento backend
207
- Mage::log("Hosted Payment Form transaction successfully completed. Transaction details: ".print_r($formVariables, 1));
208
- $szStatus = 'processing';
209
- $boError = false;
210
- break;
211
- case "20":
212
- Mage::log("Duplicate Hosted Payment Form transaction. Transaction details: ".print_r($formVariables, 1));
213
- $szNotificationMessage = "Payment Processor Response: ".$szMessage.". 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: ".$formVariables['PreviousMessage'];
214
- if($formVariables['PreviousStatusCode'] == "0")
215
- {
216
- $boError = false;
217
- }
218
- else
219
- {
220
- $boError = true;
221
- }
222
- break;
223
- case "5":
224
- case "30":
225
- default:
226
- Mage::log("Hosted Payment Form transaction couldn't be completed. Transaction details: ".print_r($formVariables, 1));
227
- $boError = true;
228
- break;
229
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
230
  }
231
 
232
- $model->updateOrderState($order, $szStatus, $szNotificationMessage);
233
-
234
- if($boError)
235
  {
236
- Mage::getSingleton('core/session')->addError($szNotificationMessage);
237
- $this->_redirect('checkout/onepage/failure');
238
  }
239
  else
240
  {
241
- Mage::getSingleton('core/session')->addSuccess($szNotificationMessage);
242
- $this->_redirect('checkout/onepage/success');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
243
  }
 
 
 
244
  }
245
 
 
 
 
 
246
  public function callbacktransparentredirectAction()
247
  {
248
  $model = Mage::getModel('tpg/direct');
@@ -278,7 +325,6 @@ class Iridiumcorp_Tpg_PaymentController extends Mage_Core_Controller_Front_Actio
278
  {
279
  $error = Iridiumcorp_Tpg_Model_Tpg_GlobalErrors::ERROR_260;
280
  Mage::logException($exc);
281
- Mage::log($error." Exception details: ".$exc);
282
 
283
  Mage::getSingleton('core/session')->addError($error);
284
  $this->_redirect('checkout/onepage/failure');
@@ -355,87 +401,89 @@ class Iridiumcorp_Tpg_PaymentController extends Mage_Core_Controller_Front_Actio
355
  $formVariables = array();
356
  $model = Mage::getModel('tpg/direct');
357
  $szOrderID = $this->getRequest()->getPost('OrderID');
358
- $order = Mage::getModel('sales/order');
359
- $order->loadByIncrementId($szOrderID);
360
- $szStatus = 'canceled';
361
 
362
- $formVariables['HashDigest'] = $this->getRequest()->getPost('HashDigest');
363
- $formVariables['MerchantID'] = $this->getRequest()->getPost('MerchantID');
364
- $formVariables['StatusCode'] = $this->getRequest()->getPost('StatusCode');
365
- $formVariables['Message'] = $this->getRequest()->getPost('Message');
366
- $formVariables['PreviousStatusCode'] = $this->getRequest()->getPost('PreviousStatusCode');
367
- $formVariables['PreviousMessage'] = $this->getRequest()->getPost('PreviousMessage');
368
- $formVariables['CrossReference'] = $this->getRequest()->getPost('CrossReference');
369
- $formVariables['Amount'] = $this->getRequest()->getPost('Amount');
370
- $formVariables['CurrencyCode'] = $this->getRequest()->getPost('CurrencyCode');
371
- $formVariables['OrderID'] = $this->getRequest()->getPost('OrderID');
372
- $formVariables['TransactionType'] = $this->getRequest()->getPost('TransactionType');
373
- $formVariables['TransactionDateTime'] = $this->getRequest()->getPost('TransactionDateTime');
374
- $formVariables['OrderDescription'] = $this->getRequest()->getPost('OrderDescription');
375
- $formVariables['Address1'] = $this->getRequest()->getPost('Address1');
376
- $formVariables['Address2'] = $this->getRequest()->getPost('Address2');
377
- $formVariables['Address3'] = $this->getRequest()->getPost('Address3');
378
- $formVariables['Address4'] = $this->getRequest()->getPost('Address4');
379
- $formVariables['City'] = $this->getRequest()->getPost('City');
380
- $formVariables['State'] = $this->getRequest()->getPost('State');
381
- $formVariables['PostCode'] = $this->getRequest()->getPost('PostCode');
382
- $formVariables['CountryCode'] = $this->getRequest()->getPost('CountryCode');
383
-
384
- if(!IRC_PaymentFormHelper::comparePaymentCompleteHashDigest($formVariables, $szPassword, $hmHashMethod, $szPreSharedKey))
385
  {
386
- $boError = true;
387
- $szNotificationMessage = "The payment was rejected for a SECURITY reason: the incoming payment data was tampered with.";
388
- Mage::log("The Transparent Redirect transaction couldn't be completed for the following reason: ".$error." Form variables: ".print_r($formVariables, 1));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
389
  }
390
-
391
- if($boError)
392
  {
393
- // do nothing
 
 
394
  }
395
- else
 
 
396
  {
397
- $szNotificationMessage = "Payment Processor Response: ".$formVariables['Message'];
398
-
399
- switch ($formVariables['StatusCode'])
400
  {
401
- case "0":
402
- Mage::log("Transparent Redirect transaction successfully completed. Transaction details: ".print_r($formVariables, 1));
403
- $boError = false;
404
- $szStatus = 'processing';
405
- break;
406
- case "20":
407
- Mage::log("Duplicate Transparent Redirect transaction. Transaction details: ".print_r($formVariables, 1));
408
- $szNotificationMessage = "Payment Processor Response: ".$formVariables['Message'].". 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: ".$formVariables['PreviousMessage'];
409
- if($formVariables['PreviousStatusCode'] == "0")
410
- {
411
- $boError = false;
412
- $szStatus = 'processing';
413
- }
414
- else
415
- {
416
- $boError = true;
417
- }
418
- break;
419
- case "5":
420
- case "30":
421
- default:
422
- Mage::log("Transparent Redirect transaction couldn't be completed. Transaction details: ".print_r($formVariables, 1));
423
- $boError = true;
424
- break;
425
  }
426
- }
427
-
428
- $model->updateOrderState($order, $szStatus, $szNotificationMessage);
429
-
430
- if($boError)
431
- {
432
  Mage::getSingleton('core/session')->addError($szNotificationMessage);
433
  $this->_redirect('checkout/onepage/failure');
434
  }
435
  else
436
  {
437
- Mage::getSingleton('core/session')->addSuccess($szNotificationMessage);
438
- $this->_redirect('checkout/onepage/success');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
439
  }
440
  }
441
- }
19
 
20
  public function errorAction()
21
  {
 
22
  //$this->_redirect('checkout/cart');
23
  $this->_redirect('checkout/onepage/failure');
24
  #$this->loadLayout();
42
  */
43
  public function redirectAction()
44
  {
45
+ $this->getResponse()->setBody($this->getLayout()->createBlock('tpg/redirect')->toHtml());
46
  }
47
 
48
  /**
55
  }
56
 
57
  /**
58
+ * Action logic for handling the reception of the 3D Secure authentication result (PaRes)
59
  *
60
  * @return unknown
61
  */
63
  {
64
  $boError = false;
65
  $szMessage = '';
66
+ $checkout = Mage::getSingleton('checkout/type_onepage');
67
+ $session = Mage::getSingleton('checkout/session');
68
+ $szPaymentProcessorResponse = '';
69
 
70
  try
71
  {
 
72
  $szPaRes = $this->getRequest()->getPost('PaRes');
73
  $szMD = $this->getRequest()->getPost('MD');
74
 
75
  // complete the 3D Secure transaction with the 3D Authorization result
76
+ $checkout->saveOrderAfter3dSecure($szPaRes, $szMD);
77
  }
78
  catch (Exception $exc)
79
  {
80
  $boError = true;
 
81
 
82
  if( isset($_SESSION['tpg_message']) )
83
  {
88
  {
89
  $szMessage = Iridiumcorp_Tpg_Model_Tpg_GlobalErrors::ERROR_7655;
90
  }
91
+ }
92
 
93
+ $szPaymentProcessorResponse = $session->getPaymentprocessorresponse();
94
+
95
+ if ($boError)
96
+ {
97
+ if($szPaymentProcessorResponse != null &&
98
+ $szPaymentProcessorResponse != '')
99
+ {
100
+ $szMessage = $szMessage.'<br/>'.$szPaymentProcessorResponse;
101
+ }
102
  // report out an fatal error
103
  Mage::getSingleton('core/session')->addError($szMessage);
104
  $this->_redirect('checkout/onepage/failure');
105
  }
106
+ else
 
107
  {
108
+ // set the quote as inactive after back from paypal
109
+ Mage::getSingleton('checkout/session')->getQuote()->setIsActive(false)->save();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110
 
111
+ // send confirmation email to customer
112
+ $order = Mage::getModel('sales/order');
 
 
 
113
 
114
+ $order->load(Mage::getSingleton('checkout/session')->getLastOrderId());
115
+ if($order->getId())
116
+ {
117
+ $order->sendNewOrderEmail();
118
+ }
119
+
120
+ if($szPaymentProcessorResponse != '')
121
+ {
122
+ Mage::getSingleton('core/session')->addSuccess($szPaymentProcessorResponse);
123
+ }
124
+ $this->_redirect('checkout/onepage/success', array('_secure' => true));
125
  }
126
  }
127
 
128
  /**
129
+ * Action logic for handling the result from the Hosted Payment page
130
  *
131
  */
132
  public function callbackhostedpaymentAction()
135
  $formVariables = array();
136
  $model = Mage::getModel('tpg/direct');
137
  $szOrderID = $this->getRequest()->getPost('OrderID');
138
+ $checkout = Mage::getSingleton('checkout/type_onepage');
139
+ $session = Mage::getSingleton('checkout/session');
140
+ $szPaymentProcessorResponse = '';
141
+
142
  try
143
  {
144
  $hmHashMethod = $model->getConfigData('hashmethod');
172
  {
173
  $boError = true;
174
  $szNotificationMessage = "The payment was rejected for a SECURITY reason: the incoming payment data was tampered with.";
175
+ Mage::log("The Hosted Payment Form transaction couldn't be completed for the following reason: [".$szNotificationMessage. "]. Form variables: ".print_r($formVariables, 1));
176
+ }
177
+ else
178
+ {
179
+ // need to finish off the transaction
180
+ $checkout->saveOrderAfterRedirectedPaymentAction(true,
181
+ $this->getRequest()->getPost('StatusCode'),
182
+ $this->getRequest()->getPost('Message'),
183
+ $this->getRequest()->getPost('PreviousStatusCode'),
184
+ $this->getRequest()->getPost('PreviousMessage'),
185
+ $this->getRequest()->getPost('OrderID'));
186
  }
187
  }
188
  catch (Exception $exc)
190
  $boError = true;
191
  $szNotificationMessage = Iridiumcorp_Tpg_Model_Tpg_GlobalErrors::ERROR_183;
192
  Mage::logException($exc);
 
193
  }
194
 
195
+ $szPaymentProcessorResponse = $session->getPaymentprocessorresponse();
196
  if($boError)
197
  {
198
+ if($szPaymentProcessorResponse != null &&
199
+ $szPaymentProcessorResponse != '')
200
+ {
201
+ $szNotificationMessage = $szNotificationMessage.'<br/>'.$szPaymentProcessorResponse;
202
+ }
203
+
204
+ Mage::getSingleton('core/session')->addError($szNotificationMessage);
205
+ $this->_redirect('checkout/onepage/failure');
206
  }
207
  else
208
  {
209
+ $order = Mage::getModel('sales/order');
210
+
211
+ // set the quote as inactive after back from paypal
212
+ Mage::getSingleton('checkout/session')->getQuote()->setIsActive(false)->save();
213
+
214
+ // send confirmation email to customer
215
+ $order->load(Mage::getSingleton('checkout/session')->getLastOrderId());
216
+
217
+ if($order->getId())
218
+ {
219
+ $order->sendNewOrderEmail();
220
+ }
221
+
222
+ if($szPaymentProcessorResponse != '')
223
+ {
224
+ Mage::getSingleton('core/session')->addSuccess($szPaymentProcessorResponse);
225
+ }
226
+ $this->_redirect('checkout/onepage/success', array('_secure' => true));
227
+ }
228
+ }
229
+
230
+ /**
231
+ * Action logic for handling the server to server communication in case of Result Delivery Method = SERVER
232
+ *
233
+ */
234
+ public function serverresultAction()
235
+ {
236
+ $boError = false;
237
+ $model = Mage::getModel('tpg/direct');
238
+ $checkout = Mage::getSingleton('checkout/type_onepage');
239
+ $szOrderID = $this->getRequest()->getPost('OrderID');
240
+
241
+ try
242
+ {
243
+ // need to finish off the transaction - if StatusCode = 0 create an order otherwise do nothing
244
+ $checkout->saveOrderAfterRedirectedPaymentAction(true,
245
+ $this->getRequest()->getPost('StatusCode'),
246
+ $this->getRequest()->getPost('Message'),
247
+ $this->getRequest()->getPost('PreviousStatusCode'),
248
+ $this->getRequest()->getPost('PreviousMessage'),
249
+ $this->getRequest()->getPost('OrderID'));
250
+ }
251
+ catch (Exception $exc)
252
+ {
253
+ $boError = true;
254
+ $szNotificationMessage = Iridiumcorp_Tpg_Model_Tpg_GlobalErrors::ERROR_183;
255
+ Mage::logException($exc);
256
  }
257
 
258
+ if($boError == true)
 
 
259
  {
260
+ // do nothing - the result message will be displayed on the Payment Form
 
261
  }
262
  else
263
  {
264
+ $order = Mage::getModel('sales/order');
265
+
266
+ // set the quote as inactive after back from paypal
267
+ Mage::getSingleton('checkout/session')->getQuote()->setIsActive(false)->save();
268
+
269
+ // send confirmation email to customer
270
+ $order->load(Mage::getSingleton('checkout/session')->getLastOrderId());
271
+
272
+ if($order->getId())
273
+ {
274
+ $order->sendNewOrderEmail();
275
+ }
276
+
277
+ // if the payment was successful clear the session so that if the customer navigates back to the Magento store
278
+ // the shopping cart will be emptied rather than 'uncomplete'
279
+ if($this->getRequest()->getPost('StatusCode') == '0')
280
+ {
281
+ Mage::getSingleton('checkout/session')->clear();
282
+ }
283
  }
284
+
285
+ // set the response with StatusCode=30 so that the PaymentForm always displays the result
286
+ $this->getResponse()->setBody('StatusCode=30');
287
  }
288
 
289
+ /**
290
+ * Action logic for handling the result set from the Transparent Redirect page
291
+ *
292
+ */
293
  public function callbacktransparentredirectAction()
294
  {
295
  $model = Mage::getModel('tpg/direct');
325
  {
326
  $error = Iridiumcorp_Tpg_Model_Tpg_GlobalErrors::ERROR_260;
327
  Mage::logException($exc);
 
328
 
329
  Mage::getSingleton('core/session')->addError($error);
330
  $this->_redirect('checkout/onepage/failure');
401
  $formVariables = array();
402
  $model = Mage::getModel('tpg/direct');
403
  $szOrderID = $this->getRequest()->getPost('OrderID');
404
+ $checkout = Mage::getSingleton('checkout/type_onepage');
405
+ $session = Mage::getSingleton('checkout/session');
406
+ $szPaymentProcessorResponse = '';
407
 
408
+ try
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
409
  {
410
+ $formVariables['HashDigest'] = $this->getRequest()->getPost('HashDigest');
411
+ $formVariables['MerchantID'] = $this->getRequest()->getPost('MerchantID');
412
+ $formVariables['StatusCode'] = $this->getRequest()->getPost('StatusCode');
413
+ $formVariables['Message'] = $this->getRequest()->getPost('Message');
414
+ $formVariables['PreviousStatusCode'] = $this->getRequest()->getPost('PreviousStatusCode');
415
+ $formVariables['PreviousMessage'] = $this->getRequest()->getPost('PreviousMessage');
416
+ $formVariables['CrossReference'] = $this->getRequest()->getPost('CrossReference');
417
+ $formVariables['Amount'] = $this->getRequest()->getPost('Amount');
418
+ $formVariables['CurrencyCode'] = $this->getRequest()->getPost('CurrencyCode');
419
+ $formVariables['OrderID'] = $this->getRequest()->getPost('OrderID');
420
+ $formVariables['TransactionType'] = $this->getRequest()->getPost('TransactionType');
421
+ $formVariables['TransactionDateTime'] = $this->getRequest()->getPost('TransactionDateTime');
422
+ $formVariables['OrderDescription'] = $this->getRequest()->getPost('OrderDescription');
423
+ $formVariables['Address1'] = $this->getRequest()->getPost('Address1');
424
+ $formVariables['Address2'] = $this->getRequest()->getPost('Address2');
425
+ $formVariables['Address3'] = $this->getRequest()->getPost('Address3');
426
+ $formVariables['Address4'] = $this->getRequest()->getPost('Address4');
427
+ $formVariables['City'] = $this->getRequest()->getPost('City');
428
+ $formVariables['State'] = $this->getRequest()->getPost('State');
429
+ $formVariables['PostCode'] = $this->getRequest()->getPost('PostCode');
430
+ $formVariables['CountryCode'] = $this->getRequest()->getPost('CountryCode');
431
+
432
+ if(!IRC_PaymentFormHelper::comparePaymentCompleteHashDigest($formVariables, $szPassword, $hmHashMethod, $szPreSharedKey))
433
+ {
434
+ $boError = true;
435
+ $szNotificationMessage = "The payment was rejected for a SECURITY reason: the incoming payment data was tampered with.";
436
+ Mage::log("The Transparent Redirect transaction couldn't be completed for the following reason: [".$szNotificationMessage."] Form variables: ".print_r($formVariables, 1));
437
+ }
438
+ else
439
+ {
440
+ // need to finish off the transaction
441
+ $checkout->saveOrderAfterRedirectedPaymentAction(false,
442
+ $this->getRequest()->getPost('StatusCode'),
443
+ $this->getRequest()->getPost('Message'),
444
+ $this->getRequest()->getPost('PreviousStatusCode'),
445
+ $this->getRequest()->getPost('PreviousMessage'),
446
+ $this->getRequest()->getPost('OrderID'));
447
+ }
448
  }
449
+ catch(Exception $exc)
 
450
  {
451
+ $boError = true;
452
+ $szNotificationMessage = Iridiumcorp_Tpg_Model_Tpg_GlobalErrors::ERROR_183;
453
+ Mage::logException($exc);
454
  }
455
+
456
+ $szPaymentProcessorResponse = $session->getPaymentprocessorresponse();
457
+ if($boError == true)
458
  {
459
+ if($szPaymentProcessorResponse != null &&
460
+ $szPaymentProcessorResponse != '')
 
461
  {
462
+ $szNotificationMessage = $szNotificationMessage.'<br/>'.$szPaymentProcessorResponse;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
463
  }
 
 
 
 
 
 
464
  Mage::getSingleton('core/session')->addError($szNotificationMessage);
465
  $this->_redirect('checkout/onepage/failure');
466
  }
467
  else
468
  {
469
+ $order = Mage::getModel('sales/order');
470
+
471
+ // set the quote as inactive after back from paypal
472
+ Mage::getSingleton('checkout/session')->getQuote()->setIsActive(false)->save();
473
+
474
+ // send confirmation email to customer
475
+ $order->load(Mage::getSingleton('checkout/session')->getLastOrderId());
476
+
477
+ if($order->getId())
478
+ {
479
+ $order->sendNewOrderEmail();
480
+ }
481
+
482
+ if($szPaymentProcessorResponse != '')
483
+ {
484
+ Mage::getSingleton('core/session')->addSuccess($szPaymentProcessorResponse);
485
+ }
486
+ $this->_redirect('checkout/onepage/success', array('_secure' => true));
487
  }
488
  }
489
+ }
app/code/local/Iridiumcorp/Tpg/etc/config.xml CHANGED
@@ -95,8 +95,6 @@
95
  <postcodemandatory>1</postcodemandatory>
96
  <countrymandatory>1</countrymandatory>
97
  <resultdeliverymethod>POST</resultdeliverymethod>
98
- <serverresulturl></serverresulturl>
99
- <paymentformdisplaysresult>0</paymentformdisplaysresult>
100
  <allowspecific>0</allowspecific>
101
  </tpg>
102
  </payment>
95
  <postcodemandatory>1</postcodemandatory>
96
  <countrymandatory>1</countrymandatory>
97
  <resultdeliverymethod>POST</resultdeliverymethod>
 
 
98
  <allowspecific>0</allowspecific>
99
  </tpg>
100
  </payment>
app/code/local/Iridiumcorp/Tpg/etc/system.xml CHANGED
@@ -218,29 +218,6 @@
218
  <![CDATA[<strong>Please note</strong>: The above value is only applicable to Hosted Payment Form payment mode]]>
219
  </comment>
220
  </resultdeliverymethod>
221
- <serverresulturl>
222
- <label>Server Result URL</label>
223
- <sort_order>210</sort_order>
224
- <frontend_type>text</frontend_type>
225
- <show_in_default>1</show_in_default>
226
- <show_in_website>1</show_in_website>
227
- <show_in_store>0</show_in_store>
228
- <comment>
229
- <![CDATA[<strong>Please note</strong>: The above value is only applicable to Hosted Payment Form payment mode]]>
230
- </comment>
231
- </serverresulturl>
232
- <paymentformdisplaysresult>
233
- <label>Payment Form Displays Result</label>
234
- <sort_order>220</sort_order>
235
- <frontend_type>select</frontend_type>
236
- <source_model>adminhtml/system_config_source_yesno</source_model>
237
- <show_in_default>1</show_in_default>
238
- <show_in_website>1</show_in_website>
239
- <show_in_store>0</show_in_store>
240
- <comment>
241
- <![CDATA[<strong>Please note</strong>: The above value is only applicable to Hosted Payment Form payment mode]]>
242
- </comment>
243
- </paymentformdisplaysresult>
244
  </fields>
245
  </tpg>
246
  </groups>
218
  <![CDATA[<strong>Please note</strong>: The above value is only applicable to Hosted Payment Form payment mode]]>
219
  </comment>
220
  </resultdeliverymethod>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
221
  </fields>
222
  </tpg>
223
  </groups>
package.xml CHANGED
@@ -1,18 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Iridiumcorp_Tpg</name>
4
- <version>1.6.1</version>
5
  <stability>stable</stability>
6
  <license>OSL v3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Iridium Payment Extension</summary>
10
  <description>Magento payment extension for the Iridium payment 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.</description>
11
- <notes>3D Secure transactions redirected to an outer ACS page rather than using iframe. System log file contains transaction specific result details.</notes>
12
  <authors><author><name>Iridium Support</name><user>auto-converted</user><email>support@iridiumcorp.co.uk</email></author><author><name>Benjamin Kovac</name><user>auto-converted</user><email>ben.kovac@iridiumcorp.co.uk</email></author></authors>
13
- <date>2010-07-07</date>
14
- <time>11:25:59</time>
15
- <contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="tpg"><file name="form.phtml" hash="9b2afd627d6e9e4f9ad43b0a7153962b"/><file name="info.phtml" hash="3164afadd87c4811b5f7d0879537f10e"/></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="231e39bb2821718eeaec4c1d0ee3233d"/><file name="info.phtml" hash="7d72d07f3afa018d0402219e50573439"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="images"><file name="iridium_corporation.jpg" hash="589faaa1b7e80b32a425175ecfc3b455"/></dir></dir></dir></dir></target><target name="magelocal"><dir name="Iridiumcorp"><dir name="Checkout"><dir name="Block"><dir name="Onepage"><dir name="Payment"><file name="Methods.php" hash="14f3b6021a6ba4af74e2868746e8fc74"/></dir></dir></dir><dir name="etc"><file name="config.xml" hash="aaa95b6e1d6e145940bf9ba9bbe1dc0f"/></dir><dir name="Model"><dir name="Type"><file name="Onepage.php" hash="fd34804edc71d403ab5a132d835d1641"/></dir></dir></dir><dir name="Sales"><dir name="etc"><file name="config.xml" hash="5def01c2198f4033cd647dc40fb8e297"/></dir><dir name="Model"><file name="Order.php" hash="dc17a304f7963aed4b469086c82bc478"/><dir name="Order"><file name="Invoice.php" hash="3bc77aa877a16a6d96474bb15f8f15ea"/></dir></dir></dir><dir name="Tpg"><dir name="Block"><file name="Error.php" hash="905367210beb53a0bc68dc6033e24127"/><file name="Form.php" hash="4b1d51aa84982486f3139510c41a221a"/><file name="Info.php" hash="f88445c4880bfe14914252bc76b6fc28"/><file name="Redirect.php" hash="121b7025034eff6316a0205b41ec2a0b"/><file name="Threedsecure.php" hash="43c2c7197a8b25eed6c2cf88d5ee0df4"/></dir><dir name="controllers"><file name="PaymentController.php" hash="1c684cffaf157db2488542910191e37d"/></dir><dir name="etc"><file name="config.xml" hash="2894d79c8fd69c96685c8d2d62c13aa4"/><file name="system.xml" hash="930cfa7d7f50fdcdaa777a7fa1a343f9"/></dir><dir name="Helper"><file name="Data.php" hash="a72fba87e718c94d993a57199e20ca96"/></dir><dir name="Model"><file name="Direct.php" hash="feac9c6b5f366bbe65ed0813add3899c"/><file name="Request.php" hash="a96e462ed3c1882048ea45f2c3a6662c"/><dir name="Source"><file name="HashMethod.php" hash="36d7fb4fc762feae459f0e67d51006f4"/><file name="OrderStatus.php" hash="95eb926db39d4afeb26784a9396f7b18"/><file name="PaymentAction.php" hash="bd8dc40852b9ff8c80c08fc01f35a988"/><file name="PaymentMode.php" hash="6849defade8a7da4cfaeff3227ae5b83"/><file name="ResultDeliveryMethod.php" hash="b79d6fc714a25aba26cdb0ab572ae06f"/></dir><dir name="Tpg"><file name="GlobalErrors.php" hash="06beaf8042e351b95259d0e8e4cb1142"/><file name="ISOCountries.php" hash="fc63d76fbe25458ba351f114782074cb"/><file name="ISOCurrencies.php" hash="89ac1e124e89c0713ef43a0cf6dd0e2b"/><file name="PaymentFormHelper.php" hash="f5c28f79cc818ff8693d4348e475bf36"/><dir name="ThePaymentGateway"><file name="PaymentSystem.php" hash="4ad38bdb85f865e967153d9f253390cd"/><file name="SOAP.php" hash="504dcb0cb7c60c134b25652881349cc3"/><file name="TPG_Common.php" hash="df1033ef855c7e0e715076a105acb84a"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Iridiumcorp_All.xml" hash="f1a85eaa7631af1906f461b662519732"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies/>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Iridiumcorp_Tpg</name>
4
+ <version>1.8.1</version>
5
  <stability>stable</stability>
6
  <license>OSL v3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Iridium Payment Extension</summary>
10
  <description>Magento payment extension for the Iridium payment 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.</description>
11
+ <notes>Cookie values URL encoded in the ServerResultURLCookieVariables stirng</notes>
12
  <authors><author><name>Iridium Support</name><user>auto-converted</user><email>support@iridiumcorp.co.uk</email></author><author><name>Benjamin Kovac</name><user>auto-converted</user><email>ben.kovac@iridiumcorp.co.uk</email></author></authors>
13
+ <date>2010-08-02</date>
14
+ <time>12:14:12</time>
15
+ <contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="tpg"><file name="form.phtml" hash="9b2afd627d6e9e4f9ad43b0a7153962b"/><file name="info.phtml" hash="3164afadd87c4811b5f7d0879537f10e"/></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="231e39bb2821718eeaec4c1d0ee3233d"/><file name="info.phtml" hash="7d72d07f3afa018d0402219e50573439"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="images"><file name="iridium_corporation.jpg" hash="589faaa1b7e80b32a425175ecfc3b455"/></dir></dir></dir></dir></target><target name="magelocal"><dir name="Iridiumcorp"><dir name="Checkout"><dir name="Block"><dir name="Onepage"><dir name="Payment"><file name="Methods.php" hash="a10e1c19ad7bb8718dcb3adf9d3e4de0"/></dir></dir></dir><dir name="etc"><file name="config.xml" hash="aaa95b6e1d6e145940bf9ba9bbe1dc0f"/></dir><dir name="Model"><dir name="Type"><file name="Onepage.php" hash="913717a50f7cf02f5668f698d39add35"/></dir></dir></dir><dir name="Sales"><dir name="etc"><file name="config.xml" hash="5def01c2198f4033cd647dc40fb8e297"/></dir><dir name="Model"><file name="Order.php" hash="f4040067afcda49f8a6d747a434786be"/><dir name="Order"><file name="Invoice.php" hash="0da517143d8c83606fb51721043e7be1"/></dir></dir></dir><dir name="Tpg"><dir name="Block"><file name="Error.php" hash="905367210beb53a0bc68dc6033e24127"/><file name="Form.php" hash="4b1d51aa84982486f3139510c41a221a"/><file name="Info.php" hash="f88445c4880bfe14914252bc76b6fc28"/><file name="Redirect.php" hash="a91a8a8f8b5ad887ed2cdd8d52732b8b"/><file name="Threedsecure.php" hash="6143c058d311287ff189cd149062e73b"/></dir><dir name="controllers"><file name="PaymentController.php" hash="ade62b175a49875e3797da499150b70c"/></dir><dir name="etc"><file name="config.xml" hash="a0314d2981c25496ed0621db3e6090c9"/><file name="system.xml" hash="ab9ecc936a422ddb4ea5c6551655f217"/></dir><dir name="Helper"><file name="Data.php" hash="a72fba87e718c94d993a57199e20ca96"/></dir><dir name="Model"><file name="Direct.php" hash="e685f376832e618fc5e3e2ce2be5181f"/><file name="Request.php" hash="a96e462ed3c1882048ea45f2c3a6662c"/><dir name="Source"><file name="HashMethod.php" hash="36d7fb4fc762feae459f0e67d51006f4"/><file name="OrderStatus.php" hash="95eb926db39d4afeb26784a9396f7b18"/><file name="PaymentAction.php" hash="bd8dc40852b9ff8c80c08fc01f35a988"/><file name="PaymentMode.php" hash="6849defade8a7da4cfaeff3227ae5b83"/><file name="ResultDeliveryMethod.php" hash="b79d6fc714a25aba26cdb0ab572ae06f"/></dir><dir name="Tpg"><file name="GlobalErrors.php" hash="b85f17ff01e26bf89c04c1d60ed52f2f"/><file name="ISOCountries.php" hash="fc63d76fbe25458ba351f114782074cb"/><file name="ISOCurrencies.php" hash="89ac1e124e89c0713ef43a0cf6dd0e2b"/><file name="PaymentFormHelper.php" hash="0011b3f7693bbbe9b1bd965a2245e1e8"/><dir name="ThePaymentGateway"><file name="PaymentSystem.php" hash="4ad38bdb85f865e967153d9f253390cd"/><file name="SOAP.php" hash="504dcb0cb7c60c134b25652881349cc3"/><file name="TPG_Common.php" hash="df1033ef855c7e0e715076a105acb84a"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Iridiumcorp_All.xml" hash="f1a85eaa7631af1906f461b662519732"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies/>
18
  </package>