Iridiumcorp_Tpg - Version 1.14.0

Version Notes

Additional compatibility support for versions:
- 1.6.0, 1.6.1 and 1.6.2.0
Fixes for the following bugs:
- back button issue causing incorrect statuses and order stock
- special characters bug in checkout address in Direct API method

Download this release

Release Info

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


Code changes from version 1.13.2 to 1.14.0

app/code/local/Iridiumcorp/Checkout/Model/Type/Onepage.php CHANGED
@@ -11,7 +11,101 @@ class Iridiumcorp_Checkout_Model_Type_Onepage extends Mage_Checkout_Model_Type_O
11
  {
12
  $nVersion = Mage::getModel('tpg/direct')->getVersion();
13
 
14
- if($nVersion >= 1410)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  {
16
  // logic for version 1.4.1.0 and above
17
  $this->validate();
@@ -626,10 +720,12 @@ class Iridiumcorp_Checkout_Model_Type_Onepage extends Mage_Checkout_Model_Type_O
626
  public function saveOrderAfter3dSecure($pares, $md)
627
  {
628
  $nVersion = Mage::getModel('tpg/direct')->getVersion();
 
629
 
630
  if($nVersion >= 1410)
631
  {
632
- $_order = Mage::getModel('sales/order')->load(Mage::getSingleton('checkout/session')->getTpgOrderId());
 
633
 
634
  if(!$_order->getId())
635
  {
@@ -831,7 +927,7 @@ class Iridiumcorp_Checkout_Model_Type_Onepage extends Mage_Checkout_Model_Type_O
831
  ->setPreviousstatuscode($szPreviousStatusCode)
832
  ->setPreviousmessage($szPreviousMessage)
833
  ->setOrderid($szOrderID);
834
-
835
  $method = Mage::getSingleton('checkout/session')->getRedirectionmethod();
836
  $_order->getPayment()->getMethodInstance()->{$method}($_order->getPayment(), $boIsHostedPaymentAction, $szStatusCode, $szMessage, $szPreviousStatusCode, $szPreviousMessage, $szOrderID, $szCrossReference);
837
 
@@ -998,4 +1094,4 @@ class Iridiumcorp_Checkout_Model_Type_Onepage extends Mage_Checkout_Model_Type_O
998
 
999
  return $this;
1000
  }
1001
- }
11
  {
12
  $nVersion = Mage::getModel('tpg/direct')->getVersion();
13
 
14
+ if($nVersion >= 1600)
15
+ {
16
+ $this->validate();
17
+ $isNewCustomer = false;
18
+ switch ($this->getCheckoutMethod())
19
+ {
20
+ case self::METHOD_GUEST:
21
+ $this->_prepareGuestQuote();
22
+ break;
23
+ case self::METHOD_REGISTER:
24
+ $this->_prepareNewCustomerQuote();
25
+ $isNewCustomer = true;
26
+ break;
27
+ default:
28
+ $this->_prepareCustomerQuote();
29
+ break;
30
+ }
31
+
32
+ $service = Mage::getModel('sales/service_quote', $this->getQuote());
33
+ $service->submitAll();
34
+
35
+ if ($isNewCustomer)
36
+ {
37
+ try
38
+ {
39
+ $this->_involveNewCustomer();
40
+ }
41
+ catch (Exception $e)
42
+ {
43
+ Mage::logException($e);
44
+ }
45
+ }
46
+
47
+ $this->_checkoutSession->setLastQuoteId($this->getQuote()->getId())
48
+ ->setLastSuccessQuoteId($this->getQuote()->getId())
49
+ ->clearHelperData();
50
+
51
+ $order = $service->getOrder();
52
+ if ($order)
53
+ {
54
+ Mage::dispatchEvent('checkout_type_onepage_save_order_after',
55
+ array('order'=>$order, 'quote'=>$this->getQuote()));
56
+
57
+ /**
58
+ * a flag to set that there will be redirect to third party after confirmation
59
+ * eg: paypal standard ipn
60
+ */
61
+ $redirectUrl = $this->getQuote()->getPayment()->getOrderPlaceRedirectUrl();
62
+ /**
63
+ * we only want to send to customer about new order when there is no redirect to third party
64
+ */
65
+ if (!$redirectUrl && $order->getCanSendNewEmailFlag())
66
+ {
67
+ try
68
+ {
69
+ $order->sendNewOrderEmail();
70
+ }
71
+ catch (Exception $e)
72
+ {
73
+ Mage::logException($e);
74
+ }
75
+ }
76
+
77
+ // add order information to the session
78
+ $this->_checkoutSession->setLastOrderId($order->getId())
79
+ ->setRedirectUrl($redirectUrl)
80
+ ->setLastRealOrderId($order->getIncrementId());
81
+
82
+ // as well a billing agreement can be created
83
+ $agreement = $order->getPayment()->getBillingAgreement();
84
+ if ($agreement)
85
+ {
86
+ $this->_checkoutSession->setLastBillingAgreementId($agreement->getId());
87
+ }
88
+ }
89
+
90
+ // add recurring profiles information to the session
91
+ $profiles = $service->getRecurringPaymentProfiles();
92
+ if ($profiles)
93
+ {
94
+ $ids = array();
95
+ foreach ($profiles as $profile)
96
+ {
97
+ $ids[] = $profile->getId();
98
+ }
99
+ $this->_checkoutSession->setLastRecurringProfileIds($ids);
100
+ // TODO: send recurring profile emails
101
+ }
102
+
103
+ Mage::dispatchEvent(
104
+ 'checkout_submit_all_after',
105
+ array('order' => $order, 'quote' => $this->getQuote(), 'recurring_profiles' => $profiles)
106
+ );
107
+ }
108
+ else if($nVersion >= 1410)
109
  {
110
  // logic for version 1.4.1.0 and above
111
  $this->validate();
720
  public function saveOrderAfter3dSecure($pares, $md)
721
  {
722
  $nVersion = Mage::getModel('tpg/direct')->getVersion();
723
+ $orderId;
724
 
725
  if($nVersion >= 1410)
726
  {
727
+ $orderId = Mage::getSingleton('checkout/session')->getTpgOrderId();
728
+ $_order = Mage::getModel('sales/order')->load($orderId);
729
 
730
  if(!$_order->getId())
731
  {
927
  ->setPreviousstatuscode($szPreviousStatusCode)
928
  ->setPreviousmessage($szPreviousMessage)
929
  ->setOrderid($szOrderID);
930
+
931
  $method = Mage::getSingleton('checkout/session')->getRedirectionmethod();
932
  $_order->getPayment()->getMethodInstance()->{$method}($_order->getPayment(), $boIsHostedPaymentAction, $szStatusCode, $szMessage, $szPreviousStatusCode, $szPreviousMessage, $szOrderID, $szCrossReference);
933
 
1094
 
1095
  return $this;
1096
  }
1097
+ }
app/code/local/Iridiumcorp/Tpg/Model/Common/ThePaymentGateway/PaymentSystem.php CHANGED
@@ -52,7 +52,7 @@
52
 
53
  public function add($EntryPointURL, $nMetric, $nRetryAttempts)
54
  {
55
- return array_push($this->m_lrgepRequestGatewayEntryPoint, new IRC_RequestGatewayEntryPoint($EntryPointURL, $nMetric, $nRetryAttempts));
56
  }
57
 
58
  //constructor
@@ -71,16 +71,24 @@
71
  {
72
  return $this->m_szName;
73
  }
 
 
 
 
74
  public function getValue()
75
  {
76
  return $this->m_szValue;
77
  }
 
 
 
 
78
 
79
  //constructor
80
- public function __construct($szName, $szValue)
81
  {
82
- $this->m_szName = $szName;
83
- $this->m_szValue = $szValue;
84
  }
85
  }
86
 
@@ -137,17 +145,16 @@
137
  return count($this->m_lgvGenericVariableList);
138
  }
139
 
140
- public function add($Name, $szValue)
141
  {
142
- $nReturnValue = -1;
143
-
144
- if ($Name != null &&
145
- $Name != "")
146
  {
147
- $nReturnValue = array_push($this->m_lgvGenericVariableList, new IRC_GenericVariable($Name, $szValue));
 
 
 
148
  }
149
-
150
- return ($nReturnValue);
151
  }
152
 
153
  //constructor
@@ -172,26 +179,38 @@
172
  {
173
  return $this->m_szEmailAddress;
174
  }
 
 
 
 
175
  public function getPhoneNumber()
176
  {
177
  return $this->m_szPhoneNumber;
178
  }
 
 
 
 
179
  public function getCustomerIPAddress()
180
  {
181
  return $this->m_szCustomerIPAddress;
182
  }
 
 
 
 
183
 
184
  //constructor
185
- public function __construct($adBillingAddress = null, $szEmailAddress, $szPhoneNumber, $szCustomerIPAddress)
186
  {
187
- $this->m_adBillingAddress = $adBillingAddress;
188
- $this->m_szEmailAddress = $szEmailAddress;
189
- $this->m_szPhoneNumber = $szPhoneNumber;
190
- $this->m_szCustomerIPAddress = $szCustomerIPAddress;
191
  }
192
  }
193
 
194
- class IRC_AddressDetails
195
  {
196
  private $m_szAddress1;
197
  private $m_szAddress2;
@@ -206,46 +225,74 @@
206
  {
207
  return $this->m_szAddress1;
208
  }
 
 
 
 
209
  public function getAddress2()
210
  {
211
  return $this->m_szAddress2;
212
  }
 
 
 
 
213
  public function getAddress3()
214
  {
215
  return $this->m_szAddress3;
216
  }
 
 
 
 
217
  public function getAddress4()
218
  {
219
  return $this->m_szAddress4;
220
  }
 
 
 
 
221
  public function getCity()
222
  {
223
  return $this->m_szCity;
224
  }
 
 
 
 
225
  public function getState()
226
  {
227
  return $this->m_szState;
228
  }
 
 
 
 
229
  public function getPostCode()
230
  {
231
  return $this->m_szPostCode;
232
  }
 
 
 
 
233
  public function getCountryCode()
234
  {
235
  return $this->m_nCountryCode;
236
  }
237
 
238
  //constructor
239
- public function __construct($szAddress1, $szAddress2, $szAddress3, $szAddress4, $szCity, $szState, $szPostCode, IRC_NullableInt $nCountryCode = null)
240
  {
241
- $this->m_szAddress1 = $szAddress1;
242
- $this->m_szAddress2 = $szAddress2;
243
- $this->m_szAddress3 = $szAddress3;
244
- $this->m_szAddress4 = $szAddress4;
245
- $this->m_szCity = $szCity;
246
- $this->m_szState = $szState;
247
- $this->m_szPostCode = $szPostCode;
248
- $this->m_nCountryCode = $nCountryCode;
249
  }
250
  }
251
 
@@ -264,26 +311,26 @@
264
  }
265
 
266
  //constructor
267
- public function __construct(IRC_NullableInt $nMonth = null, IRC_NullableInt $nYear = null)
268
  {
269
- $this->m_nMonth = $nMonth;
270
- $this->m_nYear = $nYear;
271
  }
272
  }
273
 
274
  class IRC_ExpiryDate extends IRC_CreditCardDate
275
  {
276
- public function __construct(IRC_NullableInt $nMonth = null, IRC_NullableInt $nYear = null)
277
  {
278
- parent::__construct($nMonth, $nYear);
279
  }
280
  }
281
 
282
  class IRC_StartDate extends IRC_CreditCardDate
283
  {
284
- public function __construct(IRC_NullableInt $nMonth = null, IRC_NullableInt $nYear = null)
285
  {
286
- parent::__construct($nMonth, $nYear);
287
  }
288
  }
289
 
@@ -300,48 +347,60 @@
300
  {
301
  return $this->m_szCardName;
302
  }
 
 
 
 
303
  public function getCardNumber()
304
  {
305
  return $this->m_szCardNumber;
306
  }
307
-
 
 
 
308
  public function getExpiryDate()
309
  {
310
  return $this->m_edExpiryDate;
311
  }
312
-
313
  public function getStartDate()
314
  {
315
  return $this->m_sdStartDate;
316
  }
317
-
318
  public function getIssueNumber()
319
  {
320
  return $this->m_szIssueNumber;
321
  }
322
-
 
 
 
323
  public function getCV2()
324
  {
325
  return $this->m_szCV2;
326
  }
 
 
 
 
327
 
328
  //constructor
329
- public function __construct($szCardName, $szCardNumber, IRC_ExpiryDate $edExpiryDate = null, IRC_StartDate $sdStartDate = null, $IssueNumber, $CV2)
330
  {
331
- $this->m_szCardName = $szCardName;
332
- $this->m_szCardNumber = $szCardNumber;
333
- $this->m_edExpiryDate = $edExpiryDate;
334
- $this->m_sdStartDate = $sdStartDate;
335
- $this->m_szIssueNumber = $IssueNumber;
336
- $this->m_szCV2 = $CV2;
337
  }
338
  }
339
 
340
  class IRC_OverrideCardDetails extends IRC_CardDetails
341
  {
342
- public function __construct($szCardName, $szCardNumber, IRC_ExpiryDate $edExpiryDate = null, IRC_StartDate $sdStartDate = null, $IssueNumber, $CV2)
343
  {
344
- parent::__construct($szCardName, $szCardNumber, $edExpiryDate, $sdStartDate, $IssueNumber, $CV2);
345
  }
346
  }
347
 
@@ -354,16 +413,24 @@
354
  {
355
  return $this->m_szMerchantID;
356
  }
 
 
 
 
357
  public function getPassword()
358
  {
359
  return $this->m_szPassword;
360
  }
 
 
 
 
361
 
362
  //constructor
363
- public function __construct($szMerchantID, $szPassword)
364
  {
365
- $this->m_szMerchantID = $szMerchantID;
366
- $this->m_szPassword = $szPassword;
367
  }
368
  }
369
 
@@ -377,6 +444,10 @@
377
  {
378
  return $this->m_szTransactionType;
379
  }
 
 
 
 
380
  public function getNewTransaction()
381
  {
382
  return $this->m_boNewTransaction;
@@ -385,20 +456,17 @@
385
  {
386
  return $this->m_szCrossReference;
387
  }
 
 
 
 
388
 
389
  //constructor
390
- public function __construct($szTransactionType, $szCrossReference = null, IRC_NullableBool $boNewTransaction = null)
391
  {
392
- $this->m_szTransactionType = $szTransactionType;
393
-
394
- if ($szCrossReference != null)
395
- {
396
- $this->m_szCrossReference = $szCrossReference;
397
- }
398
- if ($boNewTransaction != null)
399
- {
400
- $this->m_boNewTransaction = $boNewTransaction;
401
- }
402
  }
403
  }
404
 
@@ -428,10 +496,18 @@
428
  {
429
  return $this->m_szOrderID;
430
  }
 
 
 
 
431
  public function getOrderDescription()
432
  {
433
  return $this->m_szOrderDescription;
434
  }
 
 
 
 
435
  public function getTransactionControl()
436
  {
437
  return $this->m_tcTransactionControl;
@@ -442,22 +518,15 @@
442
  }
443
 
444
  //constructor
445
- public function __construct($TransactionTypeOrMessageDetails, IRC_NullableInt $nAmount = null, IRC_NullableInt $nCurrencyCode = null, $szOrderID, $szOrderDescription, IRC_TransactionControl $tcTransactionControl = null, IRC_ThreeDSecureBrowserDetails $tdsbdThreeDSecureBrowserDetails = null)
446
  {
447
- if ($TransactionTypeOrMessageDetails instanceof IRC_MessageDetails)
448
- {
449
- $this->m_mdMessageDetails = $TransactionTypeOrMessageDetails;
450
- $this->m_nAmount = $nAmount;
451
- $this->m_nCurrencyCode = $nCurrencyCode;
452
- $this->m_szOrderID = $szOrderID;
453
- $this->m_szOrderDescription = $szOrderDescription;
454
- $this->m_tcTransactionControl = $tcTransactionControl;
455
- $this->m_tdsbdThreeDSecureBrowserDetails = $tdsbdThreeDSecureBrowserDetails;
456
- }
457
- else
458
- {
459
- $this->__construct(new IRC_MessageDetails($TransactionTypeOrMessageDetails), $nAmount, $nCurrencyCode, $szOrderID, $szOrderDescription, $tcTransactionControl, $tdsbdThreeDSecureBrowserDetails);
460
- }
461
  }
462
  }
463
 
@@ -471,23 +540,29 @@
471
  {
472
  return $this->m_nDeviceCategory;
473
  }
474
-
475
  public function getAcceptHeaders()
476
  {
477
  return $this->m_szAcceptHeaders;
478
  }
479
-
 
 
 
480
  public function getUserAgent()
481
  {
482
  return $this->m_szUserAgent;
483
  }
 
 
 
 
484
 
485
  //constructor
486
- public function __construct(IRC_NullableInt $nDeviceCategory = null, $szAcceptHeaders, $szUserAgent)
487
  {
488
- $this->m_nDeviceCategory = $nDeviceCategory;
489
- $this->m_szAcceptHeaders = $szAcceptHeaders;
490
- $this->m_szUserAgent = $szUserAgent;
491
  }
492
  }
493
 
@@ -509,71 +584,73 @@
509
  {
510
  return $this->m_boEchoCardType;
511
  }
512
-
513
  public function getEchoAVSCheckResult()
514
  {
515
  return $this->m_boEchoAVSCheckResult;
516
  }
517
-
518
  public function getEchoCV2CheckResult()
519
  {
520
  return $this->m_boEchoCV2CheckResult;
521
  }
522
-
523
  public function getEchoAmountReceived()
524
  {
525
  return $this->m_boEchoAmountReceived;
526
  }
527
-
528
  public function getDuplicateDelay()
529
  {
530
  return $this->m_nDuplicateDelay;
531
  }
532
-
533
  public function getAVSOverridePolicy()
534
  {
535
  return $this->m_szAVSOverridePolicy;
536
  }
537
-
 
 
 
538
  public function getCV2OverridePolicy()
539
  {
540
  return $this->m_szCV2OverridePolicy;
541
  }
542
-
 
 
 
543
  public function getThreeDSecureOverridePolicy()
544
  {
545
  return $this->m_boThreeDSecureOverridePolicy;
546
  }
547
-
548
  public function getAuthCode()
549
  {
550
  return $this->m_szAuthCode;
551
  }
552
-
 
 
 
553
  function getThreeDSecurePassthroughData()
554
  {
555
  return $this->m_tdsptThreeDSecurePassthroughData;
556
  }
557
-
558
  public function getCustomVariables()
559
  {
560
  return $this->m_lgvCustomVariables;
561
  }
562
 
563
  //constructor
564
- public function __construct(IRC_NullableBool $boEchoCardType = null, IRC_NullableBool $boEchoAVSCheckResult = null, IRC_NullableBool $boEchoCV2CheckResult = null, IRC_NullableBool $boEchoAmountReceived = null, IRC_NullableInt $nDuplicateDelay = null, $szAVSOverridePolicy, $szCV2OverridePolicy, IRC_NullableBool $boThreeDSecureOverridePolicy = null, $szAuthCode, IRC_ThreeDSecurePassthroughData $tdsptThreeDSecurePassthroughData = null, IRC_GenericVariableList $lgvCustomVariables = null)
565
- {
566
- $this->m_boEchoCardType = $boEchoCardType;
567
- $this->m_boEchoAVSCheckResult = $boEchoAVSCheckResult;
568
- $this->m_boEchoCV2CheckResult = $boEchoCV2CheckResult;
569
- $this->m_boEchoAmountReceived = $boEchoAmountReceived;
570
- $this->m_nDuplicateDelay = $nDuplicateDelay;
571
- $this->m_szAVSOverridePolicy = $szAVSOverridePolicy;
572
- $this->m_szCV2OverridePolicy = $szCV2OverridePolicy;
573
- $this->m_boThreeDSecureOverridePolicy = $boThreeDSecureOverridePolicy;
574
- $this->m_szAuthCode = $szAuthCode;
575
- $this->m_tdsptThreeDSecurePassthroughData = $tdsptThreeDSecurePassthroughData;
576
- $this->m_lgvCustomVariables = $lgvCustomVariables;
577
  }
578
  }
579
 
@@ -586,17 +663,24 @@
586
  {
587
  return $this->m_szCrossReference;
588
  }
589
-
 
 
 
590
  public function getPaRES()
591
  {
592
  return $this->m_szPaRES;
593
  }
 
 
 
 
594
 
595
  //constructor
596
- public function __construct($szCrossReference, $szPaRES)
597
  {
598
- $this->m_szCrossReference = $szCrossReference;
599
- $this->m_szPaRES = $szPaRES;
600
  }
601
  }
602
 
@@ -612,39 +696,51 @@
612
  {
613
  return $this->m_szEnrolmentStatus;
614
  }
615
-
 
 
 
616
  function getAuthenticationStatus()
617
  {
618
  return $this->m_szAuthenticationStatus;
619
  }
620
-
 
 
 
621
  function getElectronicCommerceIndicator()
622
  {
623
  return $this->m_szElectronicCommerceIndicator;
624
  }
625
-
 
 
 
626
  function getAuthenticationValue()
627
  {
628
  return $this->m_szAuthenticationValue;
629
  }
630
-
 
 
 
631
  function getTransactionIdentifier()
632
  {
633
  return $this->m_szTransactionIdentifier;
634
  }
 
 
 
 
635
 
636
  //constructor
637
- function __construct($szEnrolmentStatus,
638
- $szAuthenticationStatus,
639
- $szElectronicCommerceIndicator,
640
- $szAuthenticationValue,
641
- $szTransactionIdentifier)
642
- {
643
- $this->m_szEnrolmentStatus = $szEnrolmentStatus;
644
- $this->m_szAuthenticationStatus = $szAuthenticationStatus;
645
- $this->m_szElectronicCommerceIndicator = $szElectronicCommerceIndicator;
646
- $this->m_szAuthenticationValue = $szAuthenticationValue;
647
- $this->m_szTransactionIdentifier = $szTransactionIdentifier;
648
  }
649
  }
650
 
@@ -765,7 +861,7 @@
765
 
766
  public function add($GatewayEntrypointOrEntrypointURL, $nMetric)
767
  {
768
- return array_push($this->m_lgepGatewayEntryPoint, new IRC_GatewayEntryPoint($GatewayEntrypointOrEntrypointURL, $nMetric));
769
  }
770
 
771
  //constructor
@@ -802,37 +898,26 @@
802
  {
803
  private $m_nStatusCode;
804
  private $m_szMessage;
805
- private $m_szPassOutData;
806
- //private $m_ptdPreviousTransactionResult;
807
- //private $m_boAuthorisationAttempted;
808
  private $m_lszErrorMessages;
809
 
810
  public function getStatusCode()
811
  {
812
  return $this->m_nStatusCode;
813
- }
814
-
815
  public function getMessage()
816
  {
817
  return $this->m_szMessage;
818
- }
819
-
820
- public function getPassOutData()
821
- {
822
- return $this->m_szPassOutData;
823
- }
824
-
825
  public function getErrorMessages()
826
  {
827
  return $this->m_lszErrorMessages;
828
  }
829
 
830
  //constructor
831
- public function __construct($nStatusCode, $szMessage, $szPassOutData, IRC_StringList $lszErrorMessages = null)
832
  {
833
  $this->m_nStatusCode = $nStatusCode;
834
  $this->m_szMessage = $szMessage;
835
- $this->m_szPassOutData = $szPassOutData;
836
  $this->m_lszErrorMessages = $lszErrorMessages;
837
  }
838
  }
@@ -852,9 +937,9 @@
852
  return $this->m_boAuthorisationAttempted;
853
  }
854
  //constructor
855
- public function __construct($nStatusCode, $szMessage, $szPassOutData, IRC_NullableBool $boAuthorisationAttempted = null, IRC_PreviousTransactionResult $ptdPreviousTransactionResult = null, IRC_StringList $lszErrorMessages = null)
856
  {
857
- parent::__construct($nStatusCode, $szMessage, $szPassOutData, $lszErrorMessages);
858
  $this->m_boAuthorisationAttempted = $boAuthorisationAttempted;
859
  $this->m_ptdPreviousTransactionResult = $ptdPreviousTransactionResult;
860
  }
@@ -862,37 +947,37 @@
862
 
863
  class IRC_CardDetailsTransactionResult extends IRC_PaymentMessageGatewayOutput
864
  {
865
- public function __construct($nStatusCode, $szMessage, $szPassOutData, IRC_NullableBool $boAuthorisationAttempted = null, IRC_PreviousTransactionResult $ptdPreviousTransactionResult = null, IRC_StringList $lszErrorMessages = null)
866
  {
867
- parent::__construct($nStatusCode, $szMessage, $szPassOutData, $boAuthorisationAttempted, $ptdPreviousTransactionResult, $lszErrorMessages);
868
  }
869
  }
870
  class IRC_CrossReferenceTransactionResult extends IRC_PaymentMessageGatewayOutput
871
  {
872
- public function __construct($nStatusCode, $szMessage, $szPassOutData, IRC_NullableBool $boAuthorisationAttempted = null, IRC_PreviousTransactionResult $ptdPreviousTransactionResult = null, IRC_StringList $lszErrorMessages = null)
873
  {
874
- parent::__construct($nStatusCode, $szMessage, $szPassOutData, $boAuthorisationAttempted, $ptdPreviousTransactionResult, $lszErrorMessages);
875
  }
876
  }
877
  class IRC_ThreeDSecureTransactionResult extends IRC_PaymentMessageGatewayOutput
878
  {
879
- public function __construct($nStatusCode, $szMessage, $szPassOutData, IRC_NullableBool $boAuthorisationAttempted = null, IRC_PreviousTransactionResult $ptdPreviousTransactionResult = null, IRC_StringList $lszErrorMessages = null)
880
  {
881
- parent::__construct($nStatusCode, $szMessage, $szPassOutData, $boAuthorisationAttempted, $ptdPreviousTransactionResult, $lszErrorMessages);
882
  }
883
  }
884
  class IRC_GetGatewayEntryPointsResult extends IRC_GatewayOutput
885
  {
886
- public function __construct($nStatusCode, $szMessage, $szPassOutData, IRC_StringList $lszErrorMessages = null)
887
  {
888
- parent::__construct($nStatusCode, $szMessage, $szPassOutData, $lszErrorMessages);
889
  }
890
  }
891
  class IRC_GetCardTypeResult extends IRC_GatewayOutput
892
  {
893
- public function __construct($nStatusCode, $szMessage, $szPassOutData, IRC_StringList $lszErrorMessages = null)
894
  {
895
- parent::__construct($nStatusCode, $szMessage, $szPassOutData, $lszErrorMessages);
896
  }
897
  }
898
 
@@ -922,7 +1007,7 @@
922
  class IRC_GetGatewayEntryPointsOutputData extends IRC_BaseOutputData
923
  {
924
  //constructor
925
- function __construct(IRC_GatewayEntryPointList $lgepGatewayEntryPoints = null)
926
  {
927
  parent::__construct($lgepGatewayEntryPoints);
928
  }
@@ -1086,19 +1171,17 @@
1086
 
1087
  //constructor
1088
  public function __construct(IRC_RequestGatewayEntryPointList $lrgepRequestGatewayEntryPoints = null,
1089
- $nRetryAttempts,
1090
- IRC_NullableInt $nTimeout = null,
1091
- IRC_MerchantAuthentication $maMerchantAuthentication = null,
1092
- $szPassOutData)
1093
  {
1094
  if ($nRetryAttempts == null &&
1095
  $nTimeout == null)
1096
  {
1097
- IRC_GatewayTransaction::__construct($lrgepRequestGatewayEntryPoints, 1, null, $maMerchantAuthentication, $szPassOutData);
1098
  }
1099
  else
1100
  {
1101
- IRC_GatewayTransaction::__construct($lrgepRequestGatewayEntryPoints, $nRetryAttempts, $nTimeout, $maMerchantAuthentication, $szPassOutData);
1102
  }
1103
  }
1104
  }
@@ -1114,15 +1197,13 @@
1114
  {
1115
  return $this->m_tdTransactionDetails;
1116
  }
1117
-
1118
  public function getCardDetails()
1119
  {
1120
  return $this->m_cdCardDetails;
1121
  }
1122
-
1123
  public function getCustomerDetails()
1124
  {
1125
- return $this->m_cdCardDetails;
1126
  }
1127
 
1128
  public function processTransaction(IRC_CardDetailsTransactionResult &$cdtrCardDetailsTransactionResult = null, IRC_TransactionOutputData &$todTransactionOutputData = null)
@@ -1137,7 +1218,7 @@
1137
  $cdtrCardDetailsTransactionResult = null;
1138
 
1139
  $sSOAPClient = new IRC_SOAP('CardDetailsTransaction', parent::getSOAPNamespace());
1140
-
1141
  // transaction details
1142
  if ($this->m_tdTransactionDetails != null)
1143
  {
@@ -1171,7 +1252,10 @@
1171
  }
1172
  if ($this->m_tdTransactionDetails->getTransactionControl()->getThreeDSecureOverridePolicy() != null)
1173
  {
1174
- $sSOAPClient->addParam('PaymentMessage.TransactionDetails.TransactionControl.ThreeDSecureOverridePolicy', IRC_SharedFunctions::boolToString($this->m_tdTransactionDetails->getTransactionControl()->getThreeDSecureOverridePolicy()->getValue()));
 
 
 
1175
  }
1176
  if (!IRC_SharedFunctions::isStringNullOrEmpty($this->m_tdTransactionDetails->getTransactionControl()->getAVSOverridePolicy()))
1177
  {
@@ -1274,7 +1358,6 @@
1274
  $sSOAPClient->addParam('PaymentMessage.TransactionDetails.OrderDescription', $this->m_tdTransactionDetails->getOrderDescription());
1275
  }
1276
  }
1277
-
1278
  // card details
1279
  if ($this->m_cdCardDetails != null)
1280
  {
@@ -1329,7 +1412,6 @@
1329
  $sSOAPClient->addParam('PaymentMessage.CardDetails.IssueNumber', $this->m_cdCardDetails->getIssueNumber());
1330
  }
1331
  }
1332
-
1333
  // customer details
1334
  if ($this->m_cdCustomerDetails != null)
1335
  {
@@ -1384,13 +1466,13 @@
1384
  $sSOAPClient->addParam('PaymentMessage.CustomerDetails.CustomerIPAddress', $this->m_cdCustomerDetails->getCustomerIPAddress());
1385
  }
1386
  }
1387
-
1388
- $boTransactionSubmitted = IRC_GatewayTransaction::processTransactionBase($sSOAPClient, 'PaymentMessage', 'CardDetailsTransactionResult', 'TransactionOutputData', $sxXmlDocument, $goGatewayOutput, $lgepGatewayEntryPoints);
1389
 
 
 
1390
  if ($boTransactionSubmitted)
1391
  {
1392
  $cdtrCardDetailsTransactionResult = IRC_SharedFunctionsPaymentSystemShared::getPaymentMessageGatewayOutput($sxXmlDocument->CardDetailsTransactionResult, $goGatewayOutput);
1393
-
1394
  $todTransactionOutputData = IRC_SharedFunctionsPaymentSystemShared::getTransactionOutputData($sxXmlDocument, $lgepGatewayEntryPoints);
1395
  }
1396
 
@@ -1398,19 +1480,14 @@
1398
  }
1399
 
1400
  public function __construct(IRC_RequestGatewayEntryPointList $lrgepRequestGatewayEntryPoints = null,
1401
- $nRetryAttempts,
1402
- IRC_NullableInt $nTimeout = null,
1403
- IRC_MerchantAuthentication $maMerchantAuthentication = null,
1404
- IRC_TransactionDetails $tdTransactionDetails = null,
1405
- IRC_CardDetails $cdCardDetails = null,
1406
- IRC_CustomerDetails $cdCustomerDetails = null,
1407
- $szPassOutData)
1408
  {
1409
- parent::__construct($lrgepRequestGatewayEntryPoints, $nRetryAttempts, $nTimeout, $maMerchantAuthentication, $szPassOutData);
1410
 
1411
- $this->m_tdTransactionDetails = $tdTransactionDetails;
1412
- $this->m_cdCardDetails = $cdCardDetails;
1413
- $this->m_cdCustomerDetails = $cdCustomerDetails;
1414
  }
1415
 
1416
  }
@@ -1668,19 +1745,14 @@
1668
 
1669
  //constructor
1670
  public function __construct(IRC_RequestGatewayEntryPointList $lrgepRequestGatewayEntryPoints = null,
1671
- $nRetryAttempts,
1672
- IRC_NullableInt $nTimeout = null,
1673
- IRC_MerchantAuthentication $maMerchantAuthentication = null,
1674
- IRC_TransactionDetails $tdTransactionDetails = null,
1675
- IRC_CardDetails $cdOverrideCardDetails = null,
1676
- IRC_CustomerDetails $cdCustomerDetails = null,
1677
- $szPassOutData)
1678
- {
1679
- IRC_GatewayTransaction::__construct($lrgepRequestGatewayEntryPoints, $nRetryAttempts, $nTimeout, $maMerchantAuthentication, $szPassOutData);
1680
 
1681
- $this->m_tdTransactionDetails = $tdTransactionDetails;
1682
- $this->m_ocdOverrideCardDetails = $cdOverrideCardDetails;
1683
- $this->m_cdCustomerDetails = $cdCustomerDetails;
1684
  }
1685
  }
1686
 
@@ -1730,15 +1802,12 @@
1730
 
1731
  //constructor
1732
  public function __construct(IRC_RequestGatewayEntryPointList $lrgepRequestGatewayEntryPoints = null,
1733
- $nRetryAttempts,
1734
- IRC_NullableInt $nTimeout = null,
1735
- IRC_MerchantAuthentication $maMerchantAuthentication = null,
1736
- IRC_ThreeDSecureInputData $tdsidThreeDSecureInputData = null,
1737
- $szPassOutData)
1738
  {
1739
- IRC_GatewayTransaction::__construct($lrgepRequestGatewayEntryPoints, $nRetryAttempts, $nTimeout, $maMerchantAuthentication, $szPassOutData);
1740
 
1741
- $this->m_tdsidThreeDSecureInputData = $tdsidThreeDSecureInputData;
1742
  }
1743
  }
1744
 
@@ -1750,7 +1819,11 @@
1750
  {
1751
  return $this->m_szCardNumber;
1752
  }
1753
-
 
 
 
 
1754
  public function processTransaction(IRC_GetCardTypeResult &$gctrGetCardTypeResult = null, IRC_GetCardTypeOutputData &$gctodGetCardTypeOutputData = null)
1755
  {
1756
  $boTransactionSubmitted = false;
@@ -1793,22 +1866,18 @@
1793
 
1794
  //constructor
1795
  public function __construct(IRC_RequestGatewayEntryPointList $lrgepRequestGatewayEntryPoints = null,
1796
- $nRetryAttempts,
1797
- IRC_NullableInt $nTimeout = null,
1798
- IRC_MerchantAuthentication $maMerchantAuthentication = null,
1799
- $szCardNumber,
1800
- $szPassOutData)
1801
  {
1802
- IRC_GatewayTransaction::__construct($lrgepRequestGatewayEntryPoints, $nRetryAttempts, $nTimeout, $maMerchantAuthentication, $szPassOutData);
1803
 
1804
- $this->m_szCardNumber = $szCardNumber;
1805
  }
1806
  }
1807
 
1808
  abstract class IRC_GatewayTransaction
1809
  {
1810
  private $m_maMerchantAuthentication;
1811
- private $m_szPassOutData;
1812
  private $m_lrgepRequestGatewayEntryPoints;
1813
  private $m_nRetryAttempts;
1814
  private $m_nTimeout;
@@ -1822,27 +1891,18 @@
1822
  {
1823
  return $this->m_maMerchantAuthentication;
1824
  }
1825
-
1826
- public function getPassOutData()
1827
- {
1828
- return $this->m_szPassOutData;
1829
- }
1830
-
1831
  public function getRequestGatewayEntryPoints()
1832
  {
1833
  return $this->m_lrgepRequestGatewayEntryPoints;
1834
  }
1835
-
1836
  public function getRetryAttempts()
1837
  {
1838
  return $this->m_nRetryAttempts;
1839
  }
1840
-
1841
  public function getTimeout()
1842
  {
1843
  return $this->m_nTimeout;
1844
  }
1845
-
1846
  public function getSOAPNamespace()
1847
  {
1848
  return $this->m_szSOAPNamespace;
@@ -1851,17 +1911,14 @@
1851
  {
1852
  $this->m_szSOAPNamespace = $value;
1853
  }
1854
-
1855
  public function getLastRequest()
1856
  {
1857
  return $this->m_szLastRequest;
1858
  }
1859
-
1860
  public function getLastResponse()
1861
  {
1862
  return $this->m_szLastResponse;
1863
  }
1864
-
1865
  public function getLastException()
1866
  {
1867
  return $this->m_eLastException;
@@ -1870,7 +1927,6 @@
1870
  {
1871
  return $this->m_szEntryPointUsed;
1872
  }
1873
-
1874
  public static function compare($x, $y)
1875
  {
1876
  $rgepFirst = null;
@@ -1881,7 +1937,6 @@
1881
 
1882
  return (IRC_GatewayTransaction::compareGatewayEntryPoints($rgepFirst, $rgepSecond));
1883
  }
1884
-
1885
  private static function compareGatewayEntryPoints(IRC_RequestGatewayEntryPoint $rgepFirst, IRC_RequestGatewayEntryPoint $rgepSecond)
1886
  {
1887
  $nReturnValue = 0;
@@ -1922,7 +1977,6 @@
1922
 
1923
  return $nReturnValue;
1924
  }
1925
-
1926
  protected function processTransactionBase(IRC_SOAP $sSOAPClient, $szMessageXMLPath, $szGatewayOutputXMLPath, $szTransactionMessageXMLPath, SimpleXMLElement &$sxXmlDocument = null, IRC_GatewayOutput &$goGatewayOutput = null, IRC_GatewayEntryPointList &$lgepGatewayEntryPoints = null)
1927
  {
1928
  $boTransactionSubmitted = false;
@@ -1941,7 +1995,6 @@
1941
  $szEntryPointURL;
1942
  $nMetric;
1943
  $gepGatewayEntryPoint = null;
1944
- $szPassOutData = null;
1945
  $ResponseDocument = null;
1946
  $ResponseMethod = null;
1947
 
@@ -1967,16 +2020,10 @@
1967
  $sSOAPClient->addParamAttribute($szMessageXMLPath. '.MerchantAuthentication', 'Password', $this->m_maMerchantAuthentication->getPassword());
1968
  }
1969
  }
1970
-
1971
- // populate the passout data
1972
- if (!IRC_SharedFunctions::isStringNullOrEmpty($this->m_szPassOutData))
1973
- {
1974
- $sSOAPClient->addParam($szMessageXMLPath. '.PassOutData', $this->m_szPassOutData, null);
1975
- }
1976
 
1977
  // first need to sort the gateway entry points into the correct usage order
1978
  $number = $this->m_lrgepRequestGatewayEntryPoints->sort('IRC_GatewayTransaction','Compare');
1979
-
1980
  // loop over the overall number of transaction attempts
1981
  while (!$boTransactionSubmitted &&
1982
  $nOverallRetryCount < $this->m_nRetryAttempts)
@@ -1987,7 +2034,7 @@
1987
  while (!$boTransactionSubmitted &&
1988
  $nOverallGatewayEntryPointCount < $this->m_lrgepRequestGatewayEntryPoints->getCount())
1989
  {
1990
-
1991
  $rgepCurrentGatewayEntryPoint = $this->m_lrgepRequestGatewayEntryPoints->getAt($nOverallGatewayEntryPointCount);
1992
 
1993
  // ignore if the metric is "-1" this indicates that the entry point is offline
@@ -2016,7 +2063,7 @@
2016
 
2017
  // the transaction was submitted
2018
  $boTransactionSubmitted = true;
2019
-
2020
  if ($ResponseDocument->$ResponseMethod->$szGatewayOutputXMLPath->Message)
2021
  {
2022
  $szMessage = current($ResponseDocument->$ResponseMethod->$szGatewayOutputXMLPath->Message[0]);
@@ -2028,17 +2075,8 @@
2028
  $lszErrorMessages->add(current($value->Detail));
2029
  }
2030
  }
2031
-
2032
- if ($ResponseDocument->$ResponseMethod->$szGatewayOutputXMLPath->PassOutData)
2033
- {
2034
- $szPassOutData = current($ResponseDocument->$ResponseMethod->$szGatewayOutputXMLPath->PassOutData[0]);
2035
- }
2036
- else
2037
- {
2038
- $szPassOutData = null;
2039
- }
2040
 
2041
- $goGatewayOutput = new IRC_GatewayOutput($nStatusCode, $szMessage, $szPassOutData/*, $boAuthorisationAttempted, $ptdPreviousTransactionResult*/, $lszErrorMessages);
2042
 
2043
  // look to see if there are any gateway entry points
2044
  $nCount = 0;
@@ -2063,7 +2101,7 @@
2063
  }
2064
  }
2065
 
2066
- //$gepGatewayEntryPoint = new GatewayEntryPoint($szEntryPointURL, $nMetric);
2067
  if ($lgepGatewayEntryPoints == null)
2068
  {
2069
  $lgepGatewayEntryPoints = new IRC_GatewayEntryPointList();
@@ -2090,13 +2128,10 @@
2090
  }
2091
 
2092
  public function __construct(IRC_RequestGatewayEntryPointList $lrgepRequestGatewayEntryPoints = null,
2093
- $nRetryAttempts,
2094
- IRC_NullableInt $nTimeout = null,
2095
- IRC_MerchantAuthentication $maMerchantAuthentication = null,
2096
- $szPassOutData)
2097
  {
2098
- $this->m_maMerchantAuthentication = $maMerchantAuthentication;
2099
- $this->m_szPassOutData = $szPassOutData;
2100
  $this->m_lrgepRequestGatewayEntryPoints = $lrgepRequestGatewayEntryPoints;
2101
  $this->m_nRetryAttempts = $nRetryAttempts;
2102
  $this->m_nTimeout = $nTimeout;
@@ -2192,7 +2227,7 @@
2192
  {
2193
  $nAmountReceived = new IRC_NullableInt(null);
2194
  }
2195
-
2196
  if ($sxXmlDocument->TransactionOutputData->ThreeDSecureOutputData)
2197
  {
2198
  $szPaREQ = current($sxXmlDocument->TransactionOutputData->ThreeDSecureOutputData->PaREQ[0]);
@@ -2203,7 +2238,6 @@
2203
  $szPaREQ = null;
2204
  $szACSURL = null;
2205
  }
2206
-
2207
 
2208
  if (!IRC_SharedFunctions::isStringNullOrEmpty($szACSURL) &&
2209
  !IRC_SharedFunctions::isStringNullOrEmpty($szPaREQ))
@@ -2221,7 +2255,9 @@
2221
  {
2222
  $szName = current($sxXmlDocument->TransactionOutputData->CustomVariables->GenericVariable[$nCount]->Name[0]);
2223
  $szValue = current($sxXmlDocument->TransactionOutputData->CustomVariables->GenericVariable[$nCount]->Value[0]);
2224
- $gvGenericVariable = new IRC_GenericVariable($szName, $szValue);
 
 
2225
  $lgvCustomVariables->add($gvGenericVariable);
2226
  }
2227
  }
@@ -2232,16 +2268,16 @@
2232
 
2233
 
2234
  $todTransactionOutputData = new IRC_TransactionOutputData($szCrossReference,
2235
- $szAuthCode,
2236
- $szAddressNumericCheckResult,
2237
- $szPostCodeCheckResult,
2238
- $szThreeDSecureAuthenticationCheckResult,
2239
- $szCV2CheckResult,
2240
- $ctdCardTypeData,
2241
- $nAmountReceived,
2242
- $tdsodThreeDSecureOutputData,
2243
- $lgvCustomVariables,
2244
- $lgepGatewayEntryPoints);
2245
 
2246
  return $todTransactionOutputData;
2247
  }
@@ -2334,9 +2370,7 @@
2334
 
2335
  return ($ctdCardTypeData);
2336
  }
2337
-
2338
-
2339
-
2340
  public static function getPaymentMessageGatewayOutput($GatewayOutput, IRC_GatewayOutput $goGatewayOutput = null)
2341
  {
2342
  $nPreviousStatusCode = null;
@@ -2387,12 +2421,12 @@
2387
  }
2388
 
2389
  $pmgoPaymentMessageGatewayOutput = new IRC_PaymentMessageGatewayOutput($goGatewayOutput->getStatusCode(),
2390
- $goGatewayOutput->getMessage(),
2391
- $goGatewayOutput->getPassOutData(),
2392
- $boAuthorisationAttempted,
2393
- $ptdPreviousTransactionResult,
2394
- $goGatewayOutput->getErrorMessages());
2395
 
2396
  return $pmgoPaymentMessageGatewayOutput;
2397
  }
2398
  }
 
52
 
53
  public function add($EntryPointURL, $nMetric, $nRetryAttempts)
54
  {
55
+ array_push($this->m_lrgepRequestGatewayEntryPoint, new IRC_RequestGatewayEntryPoint($EntryPointURL, $nMetric, $nRetryAttempts));
56
  }
57
 
58
  //constructor
71
  {
72
  return $this->m_szName;
73
  }
74
+ public function setName($name)
75
+ {
76
+ $this->m_szName = $name;
77
+ }
78
  public function getValue()
79
  {
80
  return $this->m_szValue;
81
  }
82
+ public function setValue($value)
83
+ {
84
+ $this->m_szValue = $value;
85
+ }
86
 
87
  //constructor
88
+ public function __construct()
89
  {
90
+ $this->m_szName = "";
91
+ $this->m_szValue = "";
92
  }
93
  }
94
 
145
  return count($this->m_lgvGenericVariableList);
146
  }
147
 
148
+ public function add($szName, $szValue)
149
  {
150
+ if ($szName != null &&
151
+ $szName != "")
 
 
152
  {
153
+ $genericVariable = new IRC_GenericVariable();
154
+ $genericVariable->setName($szName);
155
+ $genericVariable->setValue($szValue);
156
+ array_push($this->m_lgvGenericVariableList, $genericVariable);
157
  }
 
 
158
  }
159
 
160
  //constructor
179
  {
180
  return $this->m_szEmailAddress;
181
  }
182
+ public function setEmailAddress($emailAddress)
183
+ {
184
+ $this->m_szEmailAddress = $emailAddress;
185
+ }
186
  public function getPhoneNumber()
187
  {
188
  return $this->m_szPhoneNumber;
189
  }
190
+ public function setPhoneNumber($phoneNumber)
191
+ {
192
+ $this->m_szPhoneNumber = $phoneNumber;
193
+ }
194
  public function getCustomerIPAddress()
195
  {
196
  return $this->m_szCustomerIPAddress;
197
  }
198
+ public function setCustomerIPAddress($IPAddress)
199
+ {
200
+ $this->m_szCustomerIPAddress = $IPAddress;
201
+ }
202
 
203
  //constructor
204
+ public function __construct()
205
  {
206
+ $this->m_adBillingAddress = new IRC_BillingAddress();
207
+ $this->m_szEmailAddress = "";
208
+ $this->m_szPhoneNumber = "";
209
+ $this->m_szCustomerIPAddress = "";
210
  }
211
  }
212
 
213
+ class IRC_BillingAddress
214
  {
215
  private $m_szAddress1;
216
  private $m_szAddress2;
225
  {
226
  return $this->m_szAddress1;
227
  }
228
+ public function setAddress1($address1)
229
+ {
230
+ $this->m_szAddress1 = $address1;
231
+ }
232
  public function getAddress2()
233
  {
234
  return $this->m_szAddress2;
235
  }
236
+ public function setAddress2($address2)
237
+ {
238
+ $this->m_szAddress2 = $address2;
239
+ }
240
  public function getAddress3()
241
  {
242
  return $this->m_szAddress3;
243
  }
244
+ public function setAddress3($address3)
245
+ {
246
+ $this->m_szAddress3 = $address3;
247
+ }
248
  public function getAddress4()
249
  {
250
  return $this->m_szAddress4;
251
  }
252
+ public function setAddress4($address4)
253
+ {
254
+ $this->m_szAddress4 = $address4;
255
+ }
256
  public function getCity()
257
  {
258
  return $this->m_szCity;
259
  }
260
+ public function setCity($city)
261
+ {
262
+ $this->m_szCity = $city;
263
+ }
264
  public function getState()
265
  {
266
  return $this->m_szState;
267
  }
268
+ public function setState($state)
269
+ {
270
+ $this->m_szState = $state;
271
+ }
272
  public function getPostCode()
273
  {
274
  return $this->m_szPostCode;
275
  }
276
+ public function setPostCode($postCode)
277
+ {
278
+ $this->m_szPostCode = $postCode;
279
+ }
280
  public function getCountryCode()
281
  {
282
  return $this->m_nCountryCode;
283
  }
284
 
285
  //constructor
286
+ public function __construct()
287
  {
288
+ $this->m_szAddress1 = "";
289
+ $this->m_szAddress2 = "";
290
+ $this->m_szAddress3 = "";
291
+ $this->m_szAddress4 = "";
292
+ $this->m_szCity = "";
293
+ $this->m_szState = "";
294
+ $this->m_szPostCode = "";
295
+ $this->m_nCountryCode = new IRC_NullableInt();
296
  }
297
  }
298
 
311
  }
312
 
313
  //constructor
314
+ public function __construct()
315
  {
316
+ $this->m_nMonth = new IRC_NullableInt();
317
+ $this->m_nYear = new IRC_NullableInt();
318
  }
319
  }
320
 
321
  class IRC_ExpiryDate extends IRC_CreditCardDate
322
  {
323
+ public function __construct()
324
  {
325
+ parent::__construct();
326
  }
327
  }
328
 
329
  class IRC_StartDate extends IRC_CreditCardDate
330
  {
331
+ public function __construct()
332
  {
333
+ parent::__construct();
334
  }
335
  }
336
 
347
  {
348
  return $this->m_szCardName;
349
  }
350
+ public function setCardName($cardName)
351
+ {
352
+ $this->m_szCardName = $cardName;
353
+ }
354
  public function getCardNumber()
355
  {
356
  return $this->m_szCardNumber;
357
  }
358
+ public function setCardNumber($cardNumber)
359
+ {
360
+ $this->m_szCardNumber = $cardNumber;
361
+ }
362
  public function getExpiryDate()
363
  {
364
  return $this->m_edExpiryDate;
365
  }
 
366
  public function getStartDate()
367
  {
368
  return $this->m_sdStartDate;
369
  }
 
370
  public function getIssueNumber()
371
  {
372
  return $this->m_szIssueNumber;
373
  }
374
+ public function setIssueNumber($issueNumber)
375
+ {
376
+ $this->m_szIssueNumber = $issueNumber;
377
+ }
378
  public function getCV2()
379
  {
380
  return $this->m_szCV2;
381
  }
382
+ public function setCV2($cv2)
383
+ {
384
+ $this->m_szCV2 = $cv2;
385
+ }
386
 
387
  //constructor
388
+ public function __construct()
389
  {
390
+ $this->m_szCardName = "";
391
+ $this->m_szCardNumber = "";
392
+ $this->m_edExpiryDate = new IRC_ExpiryDate();
393
+ $this->m_sdStartDate = new IRC_StartDate();
394
+ $this->m_szIssueNumber = "";
395
+ $this->m_szCV2 = "";
396
  }
397
  }
398
 
399
  class IRC_OverrideCardDetails extends IRC_CardDetails
400
  {
401
+ public function __construct()
402
  {
403
+ parent::__construct();
404
  }
405
  }
406
 
413
  {
414
  return $this->m_szMerchantID;
415
  }
416
+ public function setMerchantID($merchantID)
417
+ {
418
+ $this->m_szMerchantID = $merchantID;
419
+ }
420
  public function getPassword()
421
  {
422
  return $this->m_szPassword;
423
  }
424
+ public function setPassword($password)
425
+ {
426
+ $this->m_szPassword = $password;
427
+ }
428
 
429
  //constructor
430
+ public function __construct()
431
  {
432
+ $this->m_szMerchantID = "";
433
+ $this->m_szPassword = "";
434
  }
435
  }
436
 
444
  {
445
  return $this->m_szTransactionType;
446
  }
447
+ public function setTransactionType($transactionType)
448
+ {
449
+ $this->m_szTransactionType = $transactionType;
450
+ }
451
  public function getNewTransaction()
452
  {
453
  return $this->m_boNewTransaction;
456
  {
457
  return $this->m_szCrossReference;
458
  }
459
+ public function setCrossReference($crossReference)
460
+ {
461
+ $this->m_szCrossReference = $crossReference;
462
+ }
463
 
464
  //constructor
465
+ public function __construct()
466
  {
467
+ $this->m_szTransactionType = "";
468
+ $this->m_szCrossReference = "";
469
+ $this->m_boNewTransaction = new IRC_NullableBool();
 
 
 
 
 
 
 
470
  }
471
  }
472
 
496
  {
497
  return $this->m_szOrderID;
498
  }
499
+ public function setOrderID($orderID)
500
+ {
501
+ $this->m_szOrderID = $orderID;
502
+ }
503
  public function getOrderDescription()
504
  {
505
  return $this->m_szOrderDescription;
506
  }
507
+ public function setOrderDescription($orderDescription)
508
+ {
509
+ $this->m_szOrderDescription = $orderDescription;
510
+ }
511
  public function getTransactionControl()
512
  {
513
  return $this->m_tcTransactionControl;
518
  }
519
 
520
  //constructor
521
+ public function __construct()
522
  {
523
+ $this->m_mdMessageDetails = new IRC_MessageDetails();
524
+ $this->m_nAmount = new IRC_NullableInt();
525
+ $this->m_nCurrencyCode = new IRC_NullableInt();
526
+ $this->m_szOrderID = "";
527
+ $this->m_szOrderDescription = "";
528
+ $this->m_tcTransactionControl = new IRC_TransactionControl();
529
+ $this->m_tdsbdThreeDSecureBrowserDetails = new IRC_ThreeDSecureBrowserDetails();
 
 
 
 
 
 
 
530
  }
531
  }
532
 
540
  {
541
  return $this->m_nDeviceCategory;
542
  }
 
543
  public function getAcceptHeaders()
544
  {
545
  return $this->m_szAcceptHeaders;
546
  }
547
+ public function setAcceptHeaders($acceptHeaders)
548
+ {
549
+ $this->m_szAcceptHeaders = $acceptHeaders;
550
+ }
551
  public function getUserAgent()
552
  {
553
  return $this->m_szUserAgent;
554
  }
555
+ public function setUserAgent($userAgent)
556
+ {
557
+ $this->m_szUserAgent = $userAgent;
558
+ }
559
 
560
  //constructor
561
+ public function __construct()
562
  {
563
+ $this->m_nDeviceCategory = new IRC_NullableInt();
564
+ $this->m_szAcceptHeaders = "";
565
+ $this->m_szUserAgent = "";
566
  }
567
  }
568
 
584
  {
585
  return $this->m_boEchoCardType;
586
  }
 
587
  public function getEchoAVSCheckResult()
588
  {
589
  return $this->m_boEchoAVSCheckResult;
590
  }
 
591
  public function getEchoCV2CheckResult()
592
  {
593
  return $this->m_boEchoCV2CheckResult;
594
  }
 
595
  public function getEchoAmountReceived()
596
  {
597
  return $this->m_boEchoAmountReceived;
598
  }
 
599
  public function getDuplicateDelay()
600
  {
601
  return $this->m_nDuplicateDelay;
602
  }
 
603
  public function getAVSOverridePolicy()
604
  {
605
  return $this->m_szAVSOverridePolicy;
606
  }
607
+ public function setAVSOverridePolicy($AVSOverridePolicy)
608
+ {
609
+ $this->m_szAVSOverridePolicy = $AVSOverridePolicy;
610
+ }
611
  public function getCV2OverridePolicy()
612
  {
613
  return $this->m_szCV2OverridePolicy;
614
  }
615
+ public function setCV2OverridePolicy($CV2OverridePolicy)
616
+ {
617
+ $this->m_szCV2OverridePolicy = $CV2OverridePolicy;
618
+ }
619
  public function getThreeDSecureOverridePolicy()
620
  {
621
  return $this->m_boThreeDSecureOverridePolicy;
622
  }
 
623
  public function getAuthCode()
624
  {
625
  return $this->m_szAuthCode;
626
  }
627
+ public function setAuthCode($authCode)
628
+ {
629
+ $this->m_szAuthCode = $authCode;
630
+ }
631
  function getThreeDSecurePassthroughData()
632
  {
633
  return $this->m_tdsptThreeDSecurePassthroughData;
634
  }
 
635
  public function getCustomVariables()
636
  {
637
  return $this->m_lgvCustomVariables;
638
  }
639
 
640
  //constructor
641
+ public function __construct()
642
+ {
643
+ $this->m_boEchoCardType = new IRC_NullableBool();
644
+ $this->m_boEchoAVSCheckResult = new IRC_NullableBool();
645
+ $this->m_boEchoCV2CheckResult = new IRC_NullableBool;
646
+ $this->m_boEchoAmountReceived = new IRC_NullableBool;
647
+ $this->m_nDuplicateDelay = new IRC_NullableInt;
648
+ $this->m_szAVSOverridePolicy = "";
649
+ $this->m_szCV2OverridePolicy = "";
650
+ $this->m_boThreeDSecureOverridePolicy = new IRC_NullableBool();
651
+ $this->m_szAuthCode = "";
652
+ $this->m_tdsptThreeDSecurePassthroughData = new IRC_ThreeDSecurePassthroughData();
653
+ $this->m_lgvCustomVariables = new IRC_GenericVariableList();
654
  }
655
  }
656
 
663
  {
664
  return $this->m_szCrossReference;
665
  }
666
+ public function setCrossReference($crossReference)
667
+ {
668
+ $this->m_szCrossReference = $crossReference;
669
+ }
670
  public function getPaRES()
671
  {
672
  return $this->m_szPaRES;
673
  }
674
+ public function setPaRES($PaRES)
675
+ {
676
+ $this->m_szPaRES = $PaRES;
677
+ }
678
 
679
  //constructor
680
+ public function __construct()
681
  {
682
+ $this->m_szCrossReference = "";
683
+ $this->m_szPaRES = "";
684
  }
685
  }
686
 
696
  {
697
  return $this->m_szEnrolmentStatus;
698
  }
699
+ public function setEnrolmentStatus($enrolmentStatus)
700
+ {
701
+ $this->m_szEnrolmentStatus = $enrolmentStatus;
702
+ }
703
  function getAuthenticationStatus()
704
  {
705
  return $this->m_szAuthenticationStatus;
706
  }
707
+ public function setAuthenticationStatus($authenticationStatus)
708
+ {
709
+ $this->m_szAuthenticationStatus = $authenticationStatus;
710
+ }
711
  function getElectronicCommerceIndicator()
712
  {
713
  return $this->m_szElectronicCommerceIndicator;
714
  }
715
+ public function setElectronicCommerceIndicator($electronicCommerceIndicator)
716
+ {
717
+ $this->m_szElectronicCommerceIndicator = $electronicCommerceIndicator;
718
+ }
719
  function getAuthenticationValue()
720
  {
721
  return $this->m_szAuthenticationValue;
722
  }
723
+ public function setAuthenticationValue($authenticationValue)
724
+ {
725
+ $this->m_szAuthenticationValue = $authenticationValue;
726
+ }
727
  function getTransactionIdentifier()
728
  {
729
  return $this->m_szTransactionIdentifier;
730
  }
731
+ public function setTransactionIdentifier($transactionIdentifier)
732
+ {
733
+ $this->m_szTransactionIdentifier = $transactionIdentifier;
734
+ }
735
 
736
  //constructor
737
+ function __construct()
738
+ {
739
+ $this->m_szEnrolmentStatus = "";
740
+ $this->m_szAuthenticationStatus = "";
741
+ $this->m_szElectronicCommerceIndicator = "";
742
+ $this->m_szAuthenticationValue = "";
743
+ $this->m_szTransactionIdentifier = "";
 
 
 
 
744
  }
745
  }
746
 
861
 
862
  public function add($GatewayEntrypointOrEntrypointURL, $nMetric)
863
  {
864
+ array_push($this->m_lgepGatewayEntryPoint, new IRC_GatewayEntryPoint($GatewayEntrypointOrEntrypointURL, $nMetric));
865
  }
866
 
867
  //constructor
898
  {
899
  private $m_nStatusCode;
900
  private $m_szMessage;
 
 
 
901
  private $m_lszErrorMessages;
902
 
903
  public function getStatusCode()
904
  {
905
  return $this->m_nStatusCode;
906
+ }
 
907
  public function getMessage()
908
  {
909
  return $this->m_szMessage;
910
+ }
 
 
 
 
 
 
911
  public function getErrorMessages()
912
  {
913
  return $this->m_lszErrorMessages;
914
  }
915
 
916
  //constructor
917
+ public function __construct($nStatusCode, $szMessage, IRC_StringList $lszErrorMessages = null)
918
  {
919
  $this->m_nStatusCode = $nStatusCode;
920
  $this->m_szMessage = $szMessage;
 
921
  $this->m_lszErrorMessages = $lszErrorMessages;
922
  }
923
  }
937
  return $this->m_boAuthorisationAttempted;
938
  }
939
  //constructor
940
+ public function __construct($nStatusCode, $szMessage, IRC_NullableBool $boAuthorisationAttempted = null, IRC_PreviousTransactionResult $ptdPreviousTransactionResult = null, IRC_StringList $lszErrorMessages = null)
941
  {
942
+ parent::__construct($nStatusCode, $szMessage, $lszErrorMessages);
943
  $this->m_boAuthorisationAttempted = $boAuthorisationAttempted;
944
  $this->m_ptdPreviousTransactionResult = $ptdPreviousTransactionResult;
945
  }
947
 
948
  class IRC_CardDetailsTransactionResult extends IRC_PaymentMessageGatewayOutput
949
  {
950
+ public function __construct($nStatusCode, $szMessage, IRC_NullableBool $boAuthorisationAttempted = null, IRC_PreviousTransactionResult $ptdPreviousTransactionResult = null, IRC_StringList $lszErrorMessages = null)
951
  {
952
+ parent::__construct($nStatusCode, $szMessage, $boAuthorisationAttempted, $ptdPreviousTransactionResult, $lszErrorMessages);
953
  }
954
  }
955
  class IRC_CrossReferenceTransactionResult extends IRC_PaymentMessageGatewayOutput
956
  {
957
+ public function __construct($nStatusCode, $szMessage, IRC_NullableBool $boAuthorisationAttempted = null, IRC_PreviousTransactionResult $ptdPreviousTransactionResult = null, IRC_StringList $lszErrorMessages = null)
958
  {
959
+ parent::__construct($nStatusCode, $szMessage, $boAuthorisationAttempted, $ptdPreviousTransactionResult, $lszErrorMessages);
960
  }
961
  }
962
  class IRC_ThreeDSecureTransactionResult extends IRC_PaymentMessageGatewayOutput
963
  {
964
+ public function __construct($nStatusCode, $szMessage, IRC_NullableBool $boAuthorisationAttempted = null, IRC_PreviousTransactionResult $ptdPreviousTransactionResult = null, IRC_StringList $lszErrorMessages = null)
965
  {
966
+ parent::__construct($nStatusCode, $szMessage, $boAuthorisationAttempted, $ptdPreviousTransactionResult, $lszErrorMessages);
967
  }
968
  }
969
  class IRC_GetGatewayEntryPointsResult extends IRC_GatewayOutput
970
  {
971
+ public function __construct($nStatusCode, $szMessage, IRC_StringList $lszErrorMessages = null)
972
  {
973
+ parent::__construct($nStatusCode, $szMessage, $lszErrorMessages);
974
  }
975
  }
976
  class IRC_GetCardTypeResult extends IRC_GatewayOutput
977
  {
978
+ public function __construct($nStatusCode, $szMessage, IRC_StringList $lszErrorMessages = null)
979
  {
980
+ parent::__construct($nStatusCode, $szMessage, $lszErrorMessages);
981
  }
982
  }
983
 
1007
  class IRC_GetGatewayEntryPointsOutputData extends IRC_BaseOutputData
1008
  {
1009
  //constructor
1010
+ function __construct(GatewayEntryPointList $lgepGatewayEntryPoints = null)
1011
  {
1012
  parent::__construct($lgepGatewayEntryPoints);
1013
  }
1171
 
1172
  //constructor
1173
  public function __construct(IRC_RequestGatewayEntryPointList $lrgepRequestGatewayEntryPoints = null,
1174
+ $nRetryAttempts = 1,
1175
+ IRC_NullableInt $nTimeout = null)
 
 
1176
  {
1177
  if ($nRetryAttempts == null &&
1178
  $nTimeout == null)
1179
  {
1180
+ IRC_GatewayTransaction::__construct($lrgepRequestGatewayEntryPoints, 1, null);
1181
  }
1182
  else
1183
  {
1184
+ IRC_GatewayTransaction::__construct($lrgepRequestGatewayEntryPoints, $nRetryAttempts, $nTimeout);
1185
  }
1186
  }
1187
  }
1197
  {
1198
  return $this->m_tdTransactionDetails;
1199
  }
 
1200
  public function getCardDetails()
1201
  {
1202
  return $this->m_cdCardDetails;
1203
  }
 
1204
  public function getCustomerDetails()
1205
  {
1206
+ return $this->m_cdCustomerDetails;
1207
  }
1208
 
1209
  public function processTransaction(IRC_CardDetailsTransactionResult &$cdtrCardDetailsTransactionResult = null, IRC_TransactionOutputData &$todTransactionOutputData = null)
1218
  $cdtrCardDetailsTransactionResult = null;
1219
 
1220
  $sSOAPClient = new IRC_SOAP('CardDetailsTransaction', parent::getSOAPNamespace());
1221
+
1222
  // transaction details
1223
  if ($this->m_tdTransactionDetails != null)
1224
  {
1252
  }
1253
  if ($this->m_tdTransactionDetails->getTransactionControl()->getThreeDSecureOverridePolicy() != null)
1254
  {
1255
+ if ($this->m_tdTransactionDetails->getTransactionControl()->getThreeDSecureOverridePolicy()->getHasValue())
1256
+ {
1257
+ $sSOAPClient->addParam('PaymentMessage.TransactionDetails.TransactionControl.ThreeDSecureOverridePolicy', IRC_SharedFunctions::boolToString($this->m_tdTransactionDetails->getTransactionControl()->getThreeDSecureOverridePolicy()->getValue()));
1258
+ }
1259
  }
1260
  if (!IRC_SharedFunctions::isStringNullOrEmpty($this->m_tdTransactionDetails->getTransactionControl()->getAVSOverridePolicy()))
1261
  {
1358
  $sSOAPClient->addParam('PaymentMessage.TransactionDetails.OrderDescription', $this->m_tdTransactionDetails->getOrderDescription());
1359
  }
1360
  }
 
1361
  // card details
1362
  if ($this->m_cdCardDetails != null)
1363
  {
1412
  $sSOAPClient->addParam('PaymentMessage.CardDetails.IssueNumber', $this->m_cdCardDetails->getIssueNumber());
1413
  }
1414
  }
 
1415
  // customer details
1416
  if ($this->m_cdCustomerDetails != null)
1417
  {
1466
  $sSOAPClient->addParam('PaymentMessage.CustomerDetails.CustomerIPAddress', $this->m_cdCustomerDetails->getCustomerIPAddress());
1467
  }
1468
  }
 
 
1469
 
1470
+ $boTransactionSubmitted = IRC_GatewayTransaction::processTransactionBase($sSOAPClient, 'PaymentMessage', 'CardDetailsTransactionResult', 'TransactionOutputData', $sxXmlDocument, $goGatewayOutput, $lgepGatewayEntryPoints);
1471
+
1472
  if ($boTransactionSubmitted)
1473
  {
1474
  $cdtrCardDetailsTransactionResult = IRC_SharedFunctionsPaymentSystemShared::getPaymentMessageGatewayOutput($sxXmlDocument->CardDetailsTransactionResult, $goGatewayOutput);
1475
+
1476
  $todTransactionOutputData = IRC_SharedFunctionsPaymentSystemShared::getTransactionOutputData($sxXmlDocument, $lgepGatewayEntryPoints);
1477
  }
1478
 
1480
  }
1481
 
1482
  public function __construct(IRC_RequestGatewayEntryPointList $lrgepRequestGatewayEntryPoints = null,
1483
+ $nRetryAttempts = 1,
1484
+ IRC_NullableInt $nTimeout = null)
 
 
 
 
 
1485
  {
1486
+ parent::__construct($lrgepRequestGatewayEntryPoints, $nRetryAttempts, $nTimeout);
1487
 
1488
+ $this->m_tdTransactionDetails = new IRC_TransactionDetails();
1489
+ $this->m_cdCardDetails = new IRC_CardDetails();
1490
+ $this->m_cdCustomerDetails = new IRC_CustomerDetails();
1491
  }
1492
 
1493
  }
1745
 
1746
  //constructor
1747
  public function __construct(IRC_RequestGatewayEntryPointList $lrgepRequestGatewayEntryPoints = null,
1748
+ $nRetryAttempts = 1,
1749
+ IRC_NullableInt $nTimeout = null)
1750
+ {
1751
+ IRC_GatewayTransaction::__construct($lrgepRequestGatewayEntryPoints, $nRetryAttempts, $nTimeout);
 
 
 
 
 
1752
 
1753
+ $this->m_tdTransactionDetails = new IRC_TransactionDetails();
1754
+ $this->m_ocdOverrideCardDetails = new IRC_OverrideCardDetails();
1755
+ $this->m_cdCustomerDetails = new IRC_CustomerDetails();
1756
  }
1757
  }
1758
 
1802
 
1803
  //constructor
1804
  public function __construct(IRC_RequestGatewayEntryPointList $lrgepRequestGatewayEntryPoints = null,
1805
+ $nRetryAttempts = 1,
1806
+ IRC_NullableInt $nTimeout = null)
 
 
 
1807
  {
1808
+ IRC_GatewayTransaction::__construct($lrgepRequestGatewayEntryPoints, $nRetryAttempts, $nTimeout);
1809
 
1810
+ $this->m_tdsidThreeDSecureInputData = new IRC_ThreeDSecureInputData();
1811
  }
1812
  }
1813
 
1819
  {
1820
  return $this->m_szCardNumber;
1821
  }
1822
+ public function setCardNumber($cardNumber)
1823
+ {
1824
+ $this->m_szCardNumber = $cardNumber;
1825
+ }
1826
+
1827
  public function processTransaction(IRC_GetCardTypeResult &$gctrGetCardTypeResult = null, IRC_GetCardTypeOutputData &$gctodGetCardTypeOutputData = null)
1828
  {
1829
  $boTransactionSubmitted = false;
1866
 
1867
  //constructor
1868
  public function __construct(IRC_RequestGatewayEntryPointList $lrgepRequestGatewayEntryPoints = null,
1869
+ $nRetryAttempts = 1,
1870
+ IRC_NullableInt $nTimeout = null)
 
 
 
1871
  {
1872
+ IRC_GatewayTransaction::__construct($lrgepRequestGatewayEntryPoints, $nRetryAttempts, $nTimeout);
1873
 
1874
+ $this->m_szCardNumber = "";
1875
  }
1876
  }
1877
 
1878
  abstract class IRC_GatewayTransaction
1879
  {
1880
  private $m_maMerchantAuthentication;
 
1881
  private $m_lrgepRequestGatewayEntryPoints;
1882
  private $m_nRetryAttempts;
1883
  private $m_nTimeout;
1891
  {
1892
  return $this->m_maMerchantAuthentication;
1893
  }
 
 
 
 
 
 
1894
  public function getRequestGatewayEntryPoints()
1895
  {
1896
  return $this->m_lrgepRequestGatewayEntryPoints;
1897
  }
 
1898
  public function getRetryAttempts()
1899
  {
1900
  return $this->m_nRetryAttempts;
1901
  }
 
1902
  public function getTimeout()
1903
  {
1904
  return $this->m_nTimeout;
1905
  }
 
1906
  public function getSOAPNamespace()
1907
  {
1908
  return $this->m_szSOAPNamespace;
1911
  {
1912
  $this->m_szSOAPNamespace = $value;
1913
  }
 
1914
  public function getLastRequest()
1915
  {
1916
  return $this->m_szLastRequest;
1917
  }
 
1918
  public function getLastResponse()
1919
  {
1920
  return $this->m_szLastResponse;
1921
  }
 
1922
  public function getLastException()
1923
  {
1924
  return $this->m_eLastException;
1927
  {
1928
  return $this->m_szEntryPointUsed;
1929
  }
 
1930
  public static function compare($x, $y)
1931
  {
1932
  $rgepFirst = null;
1937
 
1938
  return (IRC_GatewayTransaction::compareGatewayEntryPoints($rgepFirst, $rgepSecond));
1939
  }
 
1940
  private static function compareGatewayEntryPoints(IRC_RequestGatewayEntryPoint $rgepFirst, IRC_RequestGatewayEntryPoint $rgepSecond)
1941
  {
1942
  $nReturnValue = 0;
1977
 
1978
  return $nReturnValue;
1979
  }
 
1980
  protected function processTransactionBase(IRC_SOAP $sSOAPClient, $szMessageXMLPath, $szGatewayOutputXMLPath, $szTransactionMessageXMLPath, SimpleXMLElement &$sxXmlDocument = null, IRC_GatewayOutput &$goGatewayOutput = null, IRC_GatewayEntryPointList &$lgepGatewayEntryPoints = null)
1981
  {
1982
  $boTransactionSubmitted = false;
1995
  $szEntryPointURL;
1996
  $nMetric;
1997
  $gepGatewayEntryPoint = null;
 
1998
  $ResponseDocument = null;
1999
  $ResponseMethod = null;
2000
 
2020
  $sSOAPClient->addParamAttribute($szMessageXMLPath. '.MerchantAuthentication', 'Password', $this->m_maMerchantAuthentication->getPassword());
2021
  }
2022
  }
 
 
 
 
 
 
2023
 
2024
  // first need to sort the gateway entry points into the correct usage order
2025
  $number = $this->m_lrgepRequestGatewayEntryPoints->sort('IRC_GatewayTransaction','Compare');
2026
+
2027
  // loop over the overall number of transaction attempts
2028
  while (!$boTransactionSubmitted &&
2029
  $nOverallRetryCount < $this->m_nRetryAttempts)
2034
  while (!$boTransactionSubmitted &&
2035
  $nOverallGatewayEntryPointCount < $this->m_lrgepRequestGatewayEntryPoints->getCount())
2036
  {
2037
+
2038
  $rgepCurrentGatewayEntryPoint = $this->m_lrgepRequestGatewayEntryPoints->getAt($nOverallGatewayEntryPointCount);
2039
 
2040
  // ignore if the metric is "-1" this indicates that the entry point is offline
2063
 
2064
  // the transaction was submitted
2065
  $boTransactionSubmitted = true;
2066
+
2067
  if ($ResponseDocument->$ResponseMethod->$szGatewayOutputXMLPath->Message)
2068
  {
2069
  $szMessage = current($ResponseDocument->$ResponseMethod->$szGatewayOutputXMLPath->Message[0]);
2075
  $lszErrorMessages->add(current($value->Detail));
2076
  }
2077
  }
 
 
 
 
 
 
 
 
 
2078
 
2079
+ $goGatewayOutput = new IRC_GatewayOutput($nStatusCode, $szMessage, $lszErrorMessages);
2080
 
2081
  // look to see if there are any gateway entry points
2082
  $nCount = 0;
2101
  }
2102
  }
2103
 
2104
+ //$gepGatewayEntryPoint = new IRC_GatewayEntryPoint($szEntryPointURL, $nMetric);
2105
  if ($lgepGatewayEntryPoints == null)
2106
  {
2107
  $lgepGatewayEntryPoints = new IRC_GatewayEntryPointList();
2128
  }
2129
 
2130
  public function __construct(IRC_RequestGatewayEntryPointList $lrgepRequestGatewayEntryPoints = null,
2131
+ $nRetryAttempts = 1,
2132
+ IRC_NullableInt $nTimeout = null)
 
 
2133
  {
2134
+ $this->m_maMerchantAuthentication = new IRC_MerchantAuthentication();
 
2135
  $this->m_lrgepRequestGatewayEntryPoints = $lrgepRequestGatewayEntryPoints;
2136
  $this->m_nRetryAttempts = $nRetryAttempts;
2137
  $this->m_nTimeout = $nTimeout;
2227
  {
2228
  $nAmountReceived = new IRC_NullableInt(null);
2229
  }
2230
+
2231
  if ($sxXmlDocument->TransactionOutputData->ThreeDSecureOutputData)
2232
  {
2233
  $szPaREQ = current($sxXmlDocument->TransactionOutputData->ThreeDSecureOutputData->PaREQ[0]);
2238
  $szPaREQ = null;
2239
  $szACSURL = null;
2240
  }
 
2241
 
2242
  if (!IRC_SharedFunctions::isStringNullOrEmpty($szACSURL) &&
2243
  !IRC_SharedFunctions::isStringNullOrEmpty($szPaREQ))
2255
  {
2256
  $szName = current($sxXmlDocument->TransactionOutputData->CustomVariables->GenericVariable[$nCount]->Name[0]);
2257
  $szValue = current($sxXmlDocument->TransactionOutputData->CustomVariables->GenericVariable[$nCount]->Value[0]);
2258
+ $gvGenericVariable = new IRC_GenericVariable();
2259
+ $gvGenericVariable->setName($szName);
2260
+ $gvGenericVariable->setValue($szValue);
2261
  $lgvCustomVariables->add($gvGenericVariable);
2262
  }
2263
  }
2268
 
2269
 
2270
  $todTransactionOutputData = new IRC_TransactionOutputData($szCrossReference,
2271
+ $szAuthCode,
2272
+ $szAddressNumericCheckResult,
2273
+ $szPostCodeCheckResult,
2274
+ $szThreeDSecureAuthenticationCheckResult,
2275
+ $szCV2CheckResult,
2276
+ $ctdCardTypeData,
2277
+ $nAmountReceived,
2278
+ $tdsodThreeDSecureOutputData,
2279
+ $lgvCustomVariables,
2280
+ $lgepGatewayEntryPoints);
2281
 
2282
  return $todTransactionOutputData;
2283
  }
2370
 
2371
  return ($ctdCardTypeData);
2372
  }
2373
+
 
 
2374
  public static function getPaymentMessageGatewayOutput($GatewayOutput, IRC_GatewayOutput $goGatewayOutput = null)
2375
  {
2376
  $nPreviousStatusCode = null;
2421
  }
2422
 
2423
  $pmgoPaymentMessageGatewayOutput = new IRC_PaymentMessageGatewayOutput($goGatewayOutput->getStatusCode(),
2424
+ $goGatewayOutput->getMessage(),
2425
+ $boAuthorisationAttempted,
2426
+ $ptdPreviousTransactionResult,
2427
+ $goGatewayOutput->getErrorMessages());
 
2428
 
2429
  return $pmgoPaymentMessageGatewayOutput;
2430
  }
2431
  }
2432
+ ?>
app/code/local/Iridiumcorp/Tpg/Model/Common/ThePaymentGateway/SOAP.php CHANGED
@@ -16,7 +16,7 @@
16
  return $this->m_szPrefix;
17
  }
18
 
19
- public function __construct($szPrefix,$szNamespace)
20
  {
21
  $this->m_szNamespace = $szNamespace;
22
  $this->m_szPrefix = $szPrefix;
@@ -104,7 +104,7 @@
104
  }
105
  public function setValue($szValue)
106
  {
107
- $this->m_szValue = $szValue;
108
  }
109
  public function getSOAPParamAttributeList()
110
  {
@@ -128,7 +128,6 @@
128
  }
129
 
130
  $this->m_szName = $szName;
131
- //$this->m_szValue = SharedFunctions::replaceCharsInStringWithEntities($szValue);
132
  $this->setValue($szValue);
133
 
134
  $this->m_lspSOAPParamList = new IRC_SOAPParamList();
@@ -441,7 +440,7 @@
441
  }
442
  public function getLastException()
443
  {
444
- return $this->m_eLastException;
445
  }
446
 
447
  public function buildPacket()
@@ -566,7 +565,7 @@
566
  {
567
  //intialising the curl for XML parsing
568
  $cURL = curl_init();
569
-
570
  //http settings
571
  $HttpHeader[] = 'SOAPAction:'. $this->getActionURI();
572
  $HttpHeader[] = 'Content-Type: text/xml; charset = utf-8';
@@ -594,7 +593,7 @@
594
  curl_setopt($cURL, CURLOPT_RETURNTRANSFER, true);
595
  curl_setopt($cURL, CURLOPT_ENCODING, "UTF-8");
596
  curl_setopt($cURL, CURLOPT_SSL_VERIFYPEER, false);
597
-
598
  if ($this->getTimeout() != null)
599
  {
600
  curl_setopt($cURL, CURLOPT_TIMEOUT, $this->getTimeout());
@@ -606,24 +605,35 @@
606
  $errorMsg = curl_error($cURL);//test
607
  $header = curl_getinfo($cURL);//test
608
  curl_close($cURL);
609
-
610
  $this->m_szLastResponse = $szString;
611
 
612
- $szString = str_replace("<soap:", '<soap', $szString);
613
- $szString = str_replace("</soap:", '</soap', $szString);
614
-
 
 
 
 
 
615
  $XmlDoc = new SimpleXMLElement($szString);
616
- $ResponseDocument = $XmlDoc->soapBody;
617
  $ResponseMethod = $this->getMethod(). 'Response';
618
 
 
 
 
 
 
 
619
  $boReturnValue = true;
620
  }
621
  catch (Exception $exc)
622
  {
623
  $boReturnValue = false;
624
- $m_eLastException = $exc;
625
  }
626
-
627
  return $boReturnValue;
628
  }
629
 
@@ -771,7 +781,7 @@
771
  //$this->addParam1($args[0], $args[1], $args[3]);
772
  $this->addParam1($args[0], $args[1], null);
773
  }
774
- elseif ($args[0] instanceof IRC_SOAPParameter &&
775
  is_bool($args[1]))
776
  {
777
  //$this->__call('addParam2', $args);
@@ -966,3 +976,4 @@
966
  return $spReturnParam;
967
  }
968
  }
 
16
  return $this->m_szPrefix;
17
  }
18
 
19
+ public function __construct($szPrefix, $szNamespace)
20
  {
21
  $this->m_szNamespace = $szNamespace;
22
  $this->m_szPrefix = $szPrefix;
104
  }
105
  public function setValue($szValue)
106
  {
107
+ $this->m_szValue = IRC_SharedFunctions::replaceCharsInStringWithEntities($szValue);
108
  }
109
  public function getSOAPParamAttributeList()
110
  {
128
  }
129
 
130
  $this->m_szName = $szName;
 
131
  $this->setValue($szValue);
132
 
133
  $this->m_lspSOAPParamList = new IRC_SOAPParamList();
440
  }
441
  public function getLastException()
442
  {
443
+ $this->m_eLastException;
444
  }
445
 
446
  public function buildPacket()
565
  {
566
  //intialising the curl for XML parsing
567
  $cURL = curl_init();
568
+
569
  //http settings
570
  $HttpHeader[] = 'SOAPAction:'. $this->getActionURI();
571
  $HttpHeader[] = 'Content-Type: text/xml; charset = utf-8';
593
  curl_setopt($cURL, CURLOPT_RETURNTRANSFER, true);
594
  curl_setopt($cURL, CURLOPT_ENCODING, "UTF-8");
595
  curl_setopt($cURL, CURLOPT_SSL_VERIFYPEER, false);
596
+
597
  if ($this->getTimeout() != null)
598
  {
599
  curl_setopt($cURL, CURLOPT_TIMEOUT, $this->getTimeout());
605
  $errorMsg = curl_error($cURL);//test
606
  $header = curl_getinfo($cURL);//test
607
  curl_close($cURL);
608
+
609
  $this->m_szLastResponse = $szString;
610
 
611
+ $szString = str_replace("<soap:Body>", '" "', $szString);
612
+ $szString = str_replace("</soap:Body>", '" "', $szString);
613
+
614
+ if($errorNo != 0)
615
+ {
616
+ throw new Exception($errorMsg);
617
+ }
618
+
619
  $XmlDoc = new SimpleXMLElement($szString);
620
+ $ResponseDocument = $XmlDoc;
621
  $ResponseMethod = $this->getMethod(). 'Response';
622
 
623
+ // try see if the Xml was parsed correctly
624
+ if (!isset($ResponseDocument->$ResponseMethod))
625
+ {
626
+ throw new Exception("Couldn't parse response from server as valid Xml");
627
+ }
628
+
629
  $boReturnValue = true;
630
  }
631
  catch (Exception $exc)
632
  {
633
  $boReturnValue = false;
634
+ $this->m_eLastException = $exc->getMessage();
635
  }
636
+
637
  return $boReturnValue;
638
  }
639
 
781
  //$this->addParam1($args[0], $args[1], $args[3]);
782
  $this->addParam1($args[0], $args[1], null);
783
  }
784
+ elseif ($args[0] instanceof SOAPParameter &&
785
  is_bool($args[1]))
786
  {
787
  //$this->__call('addParam2', $args);
976
  return $spReturnParam;
977
  }
978
  }
979
+ ?>
app/code/local/Iridiumcorp/Tpg/Model/Common/ThePaymentGateway/TPG_Common.php CHANGED
@@ -35,18 +35,29 @@
35
 
36
  return $this->m_nValue;
37
  }
38
- function setValue($value)
39
  {
40
- $this->m_boHasValue = true;
41
- $this->m_nValue = $value;
 
 
 
 
 
 
 
 
42
  }
43
 
44
  //constructor
45
- public function __construct($nValue)
46
  {
47
  IRC_Nullable::__construct();
48
 
49
- $this->setValue($nValue);
 
 
 
50
  }
51
  }
52
 
@@ -63,18 +74,29 @@
63
 
64
  return ($this->m_boValue);
65
  }
66
- public function setValue($value)
67
  {
68
- $this->m_boHasValue = true;
69
- $this->m_boValue = $value;
 
 
 
 
 
 
 
 
70
  }
71
 
72
  //constructor
73
- public function __construct($boValue)
74
  {
75
  IRC_Nullable::__construct();
76
 
77
- $this->setValue($boValue);
 
 
 
78
  }
79
  }
80
 
@@ -165,7 +187,7 @@
165
  {
166
  private $m_licISOCountries;
167
 
168
- public function getISOCountry($szCountryShort, IRC_ISOCountry &$icISOCountry = null)
169
  {
170
  $boFound = false;
171
  $nCount = 0;
@@ -247,7 +269,6 @@
247
  {
248
  return $this->m_nISOCode;
249
  }
250
-
251
 
252
  public function getAmountCurrencyString($nAmount, $boAppendCurrencyShort = true)
253
  {
@@ -266,7 +287,6 @@
266
 
267
  return ($szReturnString);
268
  }
269
-
270
 
271
  //constructor
272
  public function __construct($nISOCode, $szCurrency, $szCurrencyShort, $nExponent)
@@ -282,12 +302,12 @@
282
  {
283
  private $m_licISOCurrencies;
284
 
285
- public function getISOCurrency($szCurrencyShort, IRC_ISOCurrency &$icISOCurrency = null)
286
  {
287
  $boFound = false;
288
  $nCount = 0;
289
  $icISOCurrency2;
290
-
291
  $icISOCurrency = null;
292
 
293
  while (!$boFound &&
@@ -743,7 +763,7 @@
743
  $boFound;
744
  $nHTMLEntityCount;
745
 
746
- $szReturnString = null;
747
 
748
  for ($nCount = 0; $nCount < strlen($szString); $nCount++)
749
  {
@@ -773,7 +793,8 @@
773
  {
774
  $szReturnString .= $szString[$nCount];
775
  }
776
- }
 
777
 
778
  return $szReturnString;
779
  }
@@ -788,7 +809,7 @@
788
  $szAmpersandBuffer = "";
789
  $nAmpersandBufferCount = 0;
790
 
791
- for ($nCount = 0; $nCount < strlen($szString); $nCount++)
792
  {
793
  $boFound = false;
794
  $nHTMLEntityCount = 0;
@@ -863,7 +884,9 @@
863
  if ($boFoundAmpersand && !$boFound)
864
  {
865
  $szReturnString .= $szAmpersandBuffer;
866
- }
 
 
867
 
868
  return $szReturnString;
869
  }
@@ -880,3 +903,4 @@
880
  }
881
  }
882
  }
 
35
 
36
  return $this->m_nValue;
37
  }
38
+ function setValue($nValue)
39
  {
40
+ if ($nValue == null)
41
+ {
42
+ $this->m_boHasValue = false;
43
+ $this->m_nValue = null;
44
+ }
45
+ else
46
+ {
47
+ $this->m_boHasValue = true;
48
+ $this->m_nValue = $nValue;
49
+ }
50
  }
51
 
52
  //constructor
53
+ public function __construct($nValue = null)
54
  {
55
  IRC_Nullable::__construct();
56
 
57
+ if ($nValue != null)
58
+ {
59
+ $this->setValue($nValue);
60
+ }
61
  }
62
  }
63
 
74
 
75
  return ($this->m_boValue);
76
  }
77
+ public function setValue($boValue)
78
  {
79
+ if ($boValue == null)
80
+ {
81
+ $this->m_boHasValue = false;
82
+ $this->m_boValue = null;
83
+ }
84
+ else
85
+ {
86
+ $this->m_boHasValue = true;
87
+ $this->m_boValue = $boValue;
88
+ }
89
  }
90
 
91
  //constructor
92
+ public function __construct($boValue = null)
93
  {
94
  IRC_Nullable::__construct();
95
 
96
+ if ($boValue != null)
97
+ {
98
+ $this->setValue($boValue);
99
+ }
100
  }
101
  }
102
 
187
  {
188
  private $m_licISOCountries;
189
 
190
+ public function getISOCountry($szCountryShort, &$icISOCountry)
191
  {
192
  $boFound = false;
193
  $nCount = 0;
269
  {
270
  return $this->m_nISOCode;
271
  }
 
272
 
273
  public function getAmountCurrencyString($nAmount, $boAppendCurrencyShort = true)
274
  {
287
 
288
  return ($szReturnString);
289
  }
 
290
 
291
  //constructor
292
  public function __construct($nISOCode, $szCurrency, $szCurrencyShort, $nExponent)
302
  {
303
  private $m_licISOCurrencies;
304
 
305
+ public function getISOCurrency($szCurrencyShort, &$icISOCurrency)
306
  {
307
  $boFound = false;
308
  $nCount = 0;
309
  $icISOCurrency2;
310
+
311
  $icISOCurrency = null;
312
 
313
  while (!$boFound &&
763
  $boFound;
764
  $nHTMLEntityCount;
765
 
766
+ /*$szReturnString = null;
767
 
768
  for ($nCount = 0; $nCount < strlen($szString); $nCount++)
769
  {
793
  {
794
  $szReturnString .= $szString[$nCount];
795
  }
796
+ }*/
797
+ $szReturnString = htmlspecialchars($szString);
798
 
799
  return $szReturnString;
800
  }
809
  $szAmpersandBuffer = "";
810
  $nAmpersandBufferCount = 0;
811
 
812
+ /*for ($nCount = 0; $nCount < strlen($szString); $nCount++)
813
  {
814
  $boFound = false;
815
  $nHTMLEntityCount = 0;
884
  if ($boFoundAmpersand && !$boFound)
885
  {
886
  $szReturnString .= $szAmpersandBuffer;
887
+ }*/
888
+
889
+ $szReturnString = html_entity_decode($szString);
890
 
891
  return $szReturnString;
892
  }
903
  }
904
  }
905
  }
906
+ ?>
app/code/local/Iridiumcorp/Tpg/Model/Direct.php CHANGED
@@ -27,7 +27,7 @@ class Iridiumcorp_Tpg_Model_Direct extends Mage_Payment_Model_Method_Abstract
27
  protected $_canUseForMultishipping = true;
28
  protected $_canSaveCc = false;
29
 
30
- /** OK
31
  * Assign data to info model instance
32
  *
33
  * @param mixed $data
@@ -215,111 +215,107 @@ class Iridiumcorp_Tpg_Model_Direct extends Mage_Payment_Model_Method_Abstract
215
  $nDecimalAmount;
216
 
217
  $PaymentProcessorFullDomain = $this->_getPaymentProcessorFullDomain();
 
 
218
 
219
  $rgeplRequestGatewayEntryPointList = new IRC_RequestGatewayEntryPointList();
220
  $rgeplRequestGatewayEntryPointList->add("https://gw1.".$PaymentProcessorFullDomain, 100, 2);
221
  $rgeplRequestGatewayEntryPointList->add("https://gw2.".$PaymentProcessorFullDomain, 200, 2);
222
  $rgeplRequestGatewayEntryPointList->add("https://gw3.".$PaymentProcessorFullDomain, 300, 2);
223
 
224
- $maMerchantAuthentication = new IRC_MerchantAuthentication($MerchantID, $Password);
225
-
226
- $mdMessageDetails = new IRC_MessageDetails("SALE");
 
 
 
227
 
228
- $boEchoCardType = new IRC_NullableBool(true);
229
- $boEchoAmountReceived = new IRC_NullableBool(true);
230
- $boEchoAVSCheckResult = new IRC_NullableBool(true);
231
- $boEchoCV2CheckResult = new IRC_NullableBool(true);
232
- $boThreeDSecureOverridePolicy = new IRC_NullableBool(true);
233
- $nDuplicateDelay = new IRC_NullableInt(60);
234
- $tcTransactionControl = new IRC_TransactionControl($boEchoCardType, $boEchoAVSCheckResult, $boEchoCV2CheckResult, $boEchoAmountReceived, $nDuplicateDelay, "", "", $boThreeDSecureOverridePolicy, "", null, null);
235
-
236
- $iclISOCurrencyList = IRC_ISOCurrencies::getISOCurrencyList();
237
-
238
  if ($szCurrencyShort != '' &&
239
  $iclISOCurrencyList->getISOCurrency($szCurrencyShort, $icISOCurrency))
240
  {
241
  $nCurrencyCode = new IRC_NullableInt($icISOCurrency->getISOCode());
 
242
  }
243
 
244
  $power = pow(10, $icISOCurrency->getExponent());
245
  $nDecimalAmount = $amount * $power;
246
- $nAmount = new IRC_NullableInt($nDecimalAmount);
247
-
248
- $nDeviceCategory = new IRC_NullableInt(0);
249
- $tdsbdThreeDSecureBrowserDetails = new IRC_ThreeDSecureBrowserDetails($nDeviceCategory, "*/*", $_SERVER["HTTP_USER_AGENT"]);;
250
- $tdTransactionDetails = new IRC_TransactionDetails($mdMessageDetails, $nAmount, $nCurrencyCode, $szOrderID, $szOrderDescription, $tcTransactionControl, $tdsbdThreeDSecureBrowserDetails);
251
-
252
- $nExpiryDateMonth = null;
253
- if($payment->getCcExpMonth() != '')
 
 
 
 
 
 
 
 
 
 
 
 
 
254
  {
255
- $nExpiryDateMonth = new IRC_NullableInt($payment->getCcExpMonth());
256
  }
257
-
258
- $nExpiryDateYear = null;
259
- if($payment->getCcExpYear() != '')
260
  {
261
- $nExpiryDateYear = new IRC_NullableInt($payment->getCcExpYear());
262
  }
263
-
264
- $nStartDateMonth = null;
265
- if($payment->getCcSsStartMonth() != '')
266
  {
267
- $nStartDateMonth = new IRC_NullableInt($payment->getCcSsStartMonth());
268
  }
269
-
270
- $nStartDateYear = null;
271
- if($payment->getCcSsStartYear() != '')
272
  {
273
- $nStartDateYear = new IRC_NullableInt($payment->getCcSsStartYear());
274
  }
275
-
276
- $edExpiryDate = new IRC_ExpiryDate($nExpiryDateMonth, $nExpiryDateYear);
277
- $sdStartDate = new IRC_StartDate($nStartDateMonth, $nStartDateYear);
278
- $cdCardDetails = new IRC_CardDetails($szCardName, $szCardNumber, $edExpiryDate, $sdStartDate, $szIssueNumber, $szCV2);
279
-
280
- $nCountryCode = null;
281
- $iclISOCountryList = IRC_ISOCountries::getISOCountryList();
 
 
 
 
 
282
  $szCountryShort = $this->_getISO3Code($szISO2CountryCode);
283
- if($iclISOCountryList->getISOCountry($szCountryShort, $icISOCountry))
284
  {
285
- $nCountryCode = new IRC_NullableInt($icISOCountry->getISOCode());
286
  }
 
 
 
287
 
288
- if($szAddress1 == null)
289
- {
290
- $szAddress1 = '';
291
- }
292
- if($szAddress2 == null)
293
- {
294
- $szAddress2 = '';
295
- }
296
- if($szAddress2 == null)
297
- {
298
- $szAddress2 = '';
299
- }
300
- if($szAddress2 == null)
301
- {
302
- $szAddress2 = '';
303
- }
304
-
305
- $adBillingAddress = new IRC_AddressDetails($szAddress1, $szAddress2, $szAddress3, $szAddress4, $szCity, $szState, $szPostCode, $nCountryCode);
306
- $cdCustomerDetails = new IRC_CustomerDetails($adBillingAddress, $szEmailAddress, $szPhoneNumber, $_SERVER["REMOTE_ADDR"]);
307
- $cdtCardDetailsTransaction = new IRC_CardDetailsTransaction($rgeplRequestGatewayEntryPointList, 1, null, $maMerchantAuthentication, $tdTransactionDetails, $cdCardDetails, $cdCustomerDetails, "Some data to be passed out");
308
  $boTransactionProcessed = $cdtCardDetailsTransaction->processTransaction($cdtrCardDetailsTransactionResult, $todTransactionOutputData);
309
 
310
  if ($boTransactionProcessed == false)
311
  {
312
  // could not communicate with the payment gateway
313
  $error = Iridiumcorp_Tpg_Model_Common_GlobalErrors::ERROR_261;
 
 
 
 
314
 
315
  $szLogMessage = "Couldn't complete transaction. Details: ".print_r($cdtrCardDetailsTransactionResult, 1)." ".print_r($todTransactionOutputData, 1); //"Couldn't communicate with payment gateway.";
316
  Mage::log($szLogMessage);
 
317
  }
318
  else
319
  {
320
  $szLogMessage = "Transaction could not be completed for OrderID: ".$szOrderID.". Result details: ";
321
  $szNotificationMessage = 'Payment Processor Response: '.$cdtrCardDetailsTransactionResult->getMessage();
322
- $szCrossReference = $todTransactionOutputData->getCrossReference();
323
 
324
  switch ($cdtrCardDetailsTransactionResult->getStatusCode())
325
  {
@@ -339,11 +335,11 @@ class Iridiumcorp_Tpg_Model_Direct extends Mage_Payment_Model_Method_Abstract
339
  Mage::getSingleton('checkout/session')->setMd($szCrossReference)
340
  ->setAcsurl($szACSURL)
341
  ->setPareq($szPaReq);
342
-
343
  if($nVersion >= 1410)
344
  {
345
  Mage::getSingleton('checkout/session')->setRedirectionmethod('_run3DSecureTransaction');
346
- $order->setIsThreeDSecurePending(true);
347
  }
348
  break;
349
  case 5:
@@ -453,7 +449,7 @@ class Iridiumcorp_Tpg_Model_Direct extends Mage_Payment_Model_Method_Abstract
453
  $szCallbackURL = Mage::getUrl('tpg/payment/serverpullresult', array('_secure' => true));
454
  break;
455
  }
456
-
457
  $order = $payment->getOrder();
458
  $billingAddress = $order->getBillingAddress();
459
  $iclISOCurrencyList = IRC_ISOCurrencies::getISOCurrencyList();
@@ -576,7 +572,7 @@ class Iridiumcorp_Tpg_Model_Direct extends Mage_Payment_Model_Method_Abstract
576
  ->setServerresulturlcookievariables($szServerResultURLCookieVariables)
577
  ->setServerresulturlformvariables($szServerResultURLFormVariables)
578
  ->setServerresulturlquerystringvariables($szServerResultURLQueryStringVariables);
579
-
580
  if($nVersion >= 1410)
581
  {
582
  $session->setRedirectionmethod('_runRedirectedPaymentComplete');
@@ -680,7 +676,7 @@ class Iridiumcorp_Tpg_Model_Direct extends Mage_Payment_Model_Method_Abstract
680
  ->setStartdateyear($szStartDateYear)
681
  ->setIssuenumber($szIssueNumber)
682
  ->setCv2($szCV2);
683
-
684
  if($nVersion >= 1410)
685
  {
686
  Mage::getSingleton('checkout/session')->setRedirectionmethod('_runRedirectedPaymentComplete');
@@ -710,15 +706,19 @@ class Iridiumcorp_Tpg_Model_Direct extends Mage_Payment_Model_Method_Abstract
710
  $SecretKey = $this->getConfigData('secretkey');
711
 
712
  $PaymentProcessorFullDomain = $this->_getPaymentProcessorFullDomain();
 
713
  $rgeplRequestGatewayEntryPointList = new IRC_RequestGatewayEntryPointList();
714
  $rgeplRequestGatewayEntryPointList->add("https://gw1.".$PaymentProcessorFullDomain, 100, 2);
715
  $rgeplRequestGatewayEntryPointList->add("https://gw2.".$PaymentProcessorFullDomain, 200, 2);
716
  $rgeplRequestGatewayEntryPointList->add("https://gw3.".$PaymentProcessorFullDomain, 300, 2);
717
-
718
- $maMerchantAuthentication = new IRC_MerchantAuthentication($MerchantID, $Password);
719
- $tdsidThreeDSecureInputData = new IRC_ThreeDSecureInputData($szMD, $szPaRes);
720
 
721
- $tdsaThreeDSecureAuthentication = new IRC_ThreeDSecureAuthentication($rgeplRequestGatewayEntryPointList, 1, null, $maMerchantAuthentication, $tdsidThreeDSecureInputData, "Some data to be passed out");
 
 
 
 
 
 
722
  $boTransactionProcessed = $tdsaThreeDSecureAuthentication->processTransaction($tdsarThreeDSecureAuthenticationResult, $todTransactionOutputData);
723
 
724
  if ($boTransactionProcessed == false)
@@ -823,8 +823,8 @@ class Iridiumcorp_Tpg_Model_Direct extends Mage_Payment_Model_Method_Abstract
823
  }
824
 
825
  $message = "Payment Processor Response: ".$szMessage;
826
-
827
- switch ($szStatusCode)
828
  {
829
  case "0":
830
  Mage::log($szWording."transaction successfully completed. ".$message);
27
  protected $_canUseForMultishipping = true;
28
  protected $_canSaveCc = false;
29
 
30
+ /**
31
  * Assign data to info model instance
32
  *
33
  * @param mixed $data
215
  $nDecimalAmount;
216
 
217
  $PaymentProcessorFullDomain = $this->_getPaymentProcessorFullDomain();
218
+ $iclISOCurrencyList = IRC_ISOCurrencies::getISOCurrencyList();
219
+ $iclISOCountryList = IRC_ISOCountries::getISOCountryList();
220
 
221
  $rgeplRequestGatewayEntryPointList = new IRC_RequestGatewayEntryPointList();
222
  $rgeplRequestGatewayEntryPointList->add("https://gw1.".$PaymentProcessorFullDomain, 100, 2);
223
  $rgeplRequestGatewayEntryPointList->add("https://gw2.".$PaymentProcessorFullDomain, 200, 2);
224
  $rgeplRequestGatewayEntryPointList->add("https://gw3.".$PaymentProcessorFullDomain, 300, 2);
225
 
226
+ $cdtCardDetailsTransaction = new IRC_CardDetailsTransaction($rgeplRequestGatewayEntryPointList);
227
+
228
+ $cdtCardDetailsTransaction->getMerchantAuthentication()->setMerchantID($MerchantID);
229
+ $cdtCardDetailsTransaction->getMerchantAuthentication()->setPassword($Password);
230
+
231
+ $cdtCardDetailsTransaction->getTransactionDetails()->getMessageDetails()->setTransactionType("SALE");
232
 
 
 
 
 
 
 
 
 
 
 
233
  if ($szCurrencyShort != '' &&
234
  $iclISOCurrencyList->getISOCurrency($szCurrencyShort, $icISOCurrency))
235
  {
236
  $nCurrencyCode = new IRC_NullableInt($icISOCurrency->getISOCode());
237
+ $cdtCardDetailsTransaction->getTransactionDetails()->getCurrencyCode()->setValue($icISOCurrency->getISOCode());
238
  }
239
 
240
  $power = pow(10, $icISOCurrency->getExponent());
241
  $nDecimalAmount = $amount * $power;
242
+ //$nAmount = new IRC_NullableInt($nDecimalAmount);
243
+ $cdtCardDetailsTransaction->getTransactionDetails()->getAmount()->setValue($nDecimalAmount);
244
+
245
+ $cdtCardDetailsTransaction->getTransactionDetails()->setOrderID($szOrderID);
246
+ $cdtCardDetailsTransaction->getTransactionDetails()->setOrderDescription($szOrderDescription);
247
+
248
+ $cdtCardDetailsTransaction->getTransactionDetails()->getTransactionControl()->getEchoCardType()->setValue(true);
249
+ $cdtCardDetailsTransaction->getTransactionDetails()->getTransactionControl()->getEchoAmountReceived()->setValue(true);
250
+ $cdtCardDetailsTransaction->getTransactionDetails()->getTransactionControl()->getEchoAVSCheckResult()->setValue(true);
251
+ $cdtCardDetailsTransaction->getTransactionDetails()->getTransactionControl()->getEchoCV2CheckResult()->setValue(true);
252
+ $cdtCardDetailsTransaction->getTransactionDetails()->getTransactionControl()->getThreeDSecureOverridePolicy()->setValue(true);
253
+ $cdtCardDetailsTransaction->getTransactionDetails()->getTransactionControl()->getDuplicateDelay()->setValue(60);
254
+
255
+ $cdtCardDetailsTransaction->getTransactionDetails()->getThreeDSecureBrowserDetails()->getDeviceCategory()->setValue(0);
256
+ $cdtCardDetailsTransaction->getTransactionDetails()->getThreeDSecureBrowserDetails()->setAcceptHeaders("*/*");
257
+ $cdtCardDetailsTransaction->getTransactionDetails()->getThreeDSecureBrowserDetails()->setUserAgent($_SERVER["HTTP_USER_AGENT"]);
258
+
259
+ $cdtCardDetailsTransaction->getCardDetails()->setCardName($szCardName);
260
+ $cdtCardDetailsTransaction->getCardDetails()->setCardNumber($szCardNumber);
261
+
262
+ if ($payment->getCcExpMonth() != "")
263
  {
264
+ $cdtCardDetailsTransaction->getCardDetails()->getExpiryDate()->getMonth()->setValue($payment->getCcExpMonth());
265
  }
266
+ if ($payment->getCcExpYear() != "")
 
 
267
  {
268
+ $cdtCardDetailsTransaction->getCardDetails()->getExpiryDate()->getYear()->setValue($payment->getCcExpYear());
269
  }
270
+ if ($payment->getCcSsStartMonth() != "")
 
 
271
  {
272
+ $cdtCardDetailsTransaction->getCardDetails()->getStartDate()->getMonth()->setValue($payment->getCcSsStartMonth());
273
  }
274
+ if ($payment->getCcSsStartYear() != "")
 
 
275
  {
276
+ $cdtCardDetailsTransaction->getCardDetails()->getStartDate()->getYear()->setValue($payment->getCcSsStartYear());
277
  }
278
+
279
+ $cdtCardDetailsTransaction->getCardDetails()->setIssueNumber($szIssueNumber);
280
+ $cdtCardDetailsTransaction->getCardDetails()->setCV2($szCV2);
281
+
282
+ $cdtCardDetailsTransaction->getCustomerDetails()->getBillingAddress()->setAddress1($szAddress1);
283
+ $cdtCardDetailsTransaction->getCustomerDetails()->getBillingAddress()->setAddress2($szAddress2);
284
+ $cdtCardDetailsTransaction->getCustomerDetails()->getBillingAddress()->setAddress3($szAddress3);
285
+ $cdtCardDetailsTransaction->getCustomerDetails()->getBillingAddress()->setAddress4($szAddress4);
286
+ $cdtCardDetailsTransaction->getCustomerDetails()->getBillingAddress()->setCity($szCity);
287
+ $cdtCardDetailsTransaction->getCustomerDetails()->getBillingAddress()->setState($szState);
288
+ $cdtCardDetailsTransaction->getCustomerDetails()->getBillingAddress()->setPostCode($szPostCode);
289
+
290
  $szCountryShort = $this->_getISO3Code($szISO2CountryCode);
291
+ if ($iclISOCountryList->getISOCountry($szCountryShort, $icISOCountry))
292
  {
293
+ $cdtCardDetailsTransaction->getCustomerDetails()->getBillingAddress()->getCountryCode()->setValue($icISOCountry->getISOCode());
294
  }
295
+
296
+ $cdtCardDetailsTransaction->getCustomerDetails()->setEmailAddress($szEmailAddress);
297
+ $cdtCardDetailsTransaction->getCustomerDetails()->setPhoneNumber($szPhoneNumber);
298
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
299
  $boTransactionProcessed = $cdtCardDetailsTransaction->processTransaction($cdtrCardDetailsTransactionResult, $todTransactionOutputData);
300
 
301
  if ($boTransactionProcessed == false)
302
  {
303
  // could not communicate with the payment gateway
304
  $error = Iridiumcorp_Tpg_Model_Common_GlobalErrors::ERROR_261;
305
+ if($cdtCardDetailsTransaction->getLastException())
306
+ {
307
+ $error.= " [ ". $cdtCardDetailsTransaction->getLastException() . " ]";
308
+ }
309
 
310
  $szLogMessage = "Couldn't complete transaction. Details: ".print_r($cdtrCardDetailsTransactionResult, 1)." ".print_r($todTransactionOutputData, 1); //"Couldn't communicate with payment gateway.";
311
  Mage::log($szLogMessage);
312
+ Mage::log("Last exception: ".print_r($cdtCardDetailsTransaction->getLastException(), 1));
313
  }
314
  else
315
  {
316
  $szLogMessage = "Transaction could not be completed for OrderID: ".$szOrderID.". Result details: ";
317
  $szNotificationMessage = 'Payment Processor Response: '.$cdtrCardDetailsTransactionResult->getMessage();
318
+ $szCrossReference = $todTransactionOutputData->getCrossReference();
319
 
320
  switch ($cdtrCardDetailsTransactionResult->getStatusCode())
321
  {
335
  Mage::getSingleton('checkout/session')->setMd($szCrossReference)
336
  ->setAcsurl($szACSURL)
337
  ->setPareq($szPaReq);
338
+
339
  if($nVersion >= 1410)
340
  {
341
  Mage::getSingleton('checkout/session')->setRedirectionmethod('_run3DSecureTransaction');
342
+ $order->setIsThreeDSecurePending(true);
343
  }
344
  break;
345
  case 5:
449
  $szCallbackURL = Mage::getUrl('tpg/payment/serverpullresult', array('_secure' => true));
450
  break;
451
  }
452
+
453
  $order = $payment->getOrder();
454
  $billingAddress = $order->getBillingAddress();
455
  $iclISOCurrencyList = IRC_ISOCurrencies::getISOCurrencyList();
572
  ->setServerresulturlcookievariables($szServerResultURLCookieVariables)
573
  ->setServerresulturlformvariables($szServerResultURLFormVariables)
574
  ->setServerresulturlquerystringvariables($szServerResultURLQueryStringVariables);
575
+
576
  if($nVersion >= 1410)
577
  {
578
  $session->setRedirectionmethod('_runRedirectedPaymentComplete');
676
  ->setStartdateyear($szStartDateYear)
677
  ->setIssuenumber($szIssueNumber)
678
  ->setCv2($szCV2);
679
+
680
  if($nVersion >= 1410)
681
  {
682
  Mage::getSingleton('checkout/session')->setRedirectionmethod('_runRedirectedPaymentComplete');
706
  $SecretKey = $this->getConfigData('secretkey');
707
 
708
  $PaymentProcessorFullDomain = $this->_getPaymentProcessorFullDomain();
709
+
710
  $rgeplRequestGatewayEntryPointList = new IRC_RequestGatewayEntryPointList();
711
  $rgeplRequestGatewayEntryPointList->add("https://gw1.".$PaymentProcessorFullDomain, 100, 2);
712
  $rgeplRequestGatewayEntryPointList->add("https://gw2.".$PaymentProcessorFullDomain, 200, 2);
713
  $rgeplRequestGatewayEntryPointList->add("https://gw3.".$PaymentProcessorFullDomain, 300, 2);
 
 
 
714
 
715
+ $tdsaThreeDSecureAuthentication = new IRC_ThreeDSecureAuthentication($rgeplRequestGatewayEntryPointList);
716
+ $tdsaThreeDSecureAuthentication->getMerchantAuthentication()->setMerchantID($MerchantID);
717
+ $tdsaThreeDSecureAuthentication->getMerchantAuthentication()->setPassword($Password);
718
+
719
+ $tdsaThreeDSecureAuthentication->getThreeDSecureInputData()->setCrossReference($szMD);
720
+ $tdsaThreeDSecureAuthentication->getThreeDSecureInputData()->setPaRES($szPaRes);
721
+
722
  $boTransactionProcessed = $tdsaThreeDSecureAuthentication->processTransaction($tdsarThreeDSecureAuthenticationResult, $todTransactionOutputData);
723
 
724
  if ($boTransactionProcessed == false)
823
  }
824
 
825
  $message = "Payment Processor Response: ".$szMessage;
826
+
827
+ switch ($szStatusCode)
828
  {
829
  case "0":
830
  Mage::log($szWording."transaction successfully completed. ".$message);
app/code/local/Iridiumcorp/Tpg/controllers/PaymentController.php CHANGED
@@ -8,7 +8,7 @@ require_once "app/code/local/Iridiumcorp/Tpg/Model/Common/PaymentFormHelper.php"
8
  */
9
  class Iridiumcorp_Tpg_PaymentController extends Mage_Core_Controller_Front_Action
10
  {
11
- protected function _expireAjax()
12
  {
13
  if (!Mage::getSingleton('checkout/session')->getQuote()->hasItems())
14
  {
@@ -92,14 +92,34 @@ class Iridiumcorp_Tpg_PaymentController extends Mage_Core_Controller_Front_Actio
92
  $session = Mage::getSingleton('checkout/session');
93
  $szPaymentProcessorResponse = '';
94
  $nVersion = Mage::getModel('tpg/direct')->getVersion();
 
 
 
95
 
96
  try
97
  {
98
  $szPaRes = $this->getRequest()->getPost('PaRes');
99
  $szMD = $this->getRequest()->getPost('MD');
100
 
101
- // complete the 3D Secure transaction with the 3D Authorization result
102
- $checkout->saveOrderAfter3dSecure($szPaRes, $szMD);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
  }
104
  catch (Exception $exc)
105
  {
@@ -116,10 +136,6 @@ class Iridiumcorp_Tpg_PaymentController extends Mage_Core_Controller_Front_Actio
116
  $szMessage = Iridiumcorp_Tpg_Model_Common_GlobalErrors::ERROR_7655;
117
  }
118
  }
119
-
120
- $szPaymentProcessorResponse = $session->getPaymentprocessorresponse();
121
- $order = Mage::getModel('sales/order');
122
- $order->load(Mage::getSingleton('checkout/session')->getLastOrderId());
123
 
124
  if ($boError)
125
  {
@@ -158,25 +174,29 @@ class Iridiumcorp_Tpg_PaymentController extends Mage_Core_Controller_Front_Actio
158
  // set the quote as inactive after back from paypal
159
  Mage::getSingleton('checkout/session')->getQuote()->setIsActive(false)->save();
160
 
161
- // send confirmation email to customer
162
- if($order->getId())
163
- {
164
- $order->sendNewOrderEmail();
165
- }
166
-
167
- if($nVersion >= 1410)
168
- {
169
- $this->_subtractOrderedItemsFromStock($order);
170
- $this->_updateInvoices($order, $szPaymentProcessorResponse);
171
- }
172
-
173
- if($nVersion != 1324 && $nVersion != 1330)
174
- {
175
- if($szPaymentProcessorResponse != '')
176
- {
177
- Mage::getSingleton('core/session')->addSuccess($szPaymentProcessorResponse);
178
- }
179
- }
 
 
 
 
180
 
181
  $this->_redirect('checkout/onepage/success', array('_secure' => true));
182
  }
@@ -193,11 +213,12 @@ class Iridiumcorp_Tpg_PaymentController extends Mage_Core_Controller_Front_Actio
193
  $model = Mage::getModel('tpg/direct');
194
  $szOrderID = $this->getRequest()->getPost('OrderID');
195
  $checkout = Mage::getSingleton('checkout/type_onepage');
196
- $session = Mage::getSingleton('checkout/session');
197
  $szPaymentProcessorResponse = '';
198
  $order = Mage::getModel('sales/order');
199
  $order->load(Mage::getSingleton('checkout/session')->getLastOrderId());
200
  $nVersion = Mage::getModel('tpg/direct')->getVersion();
 
201
 
202
  try
203
  {
@@ -236,13 +257,35 @@ class Iridiumcorp_Tpg_PaymentController extends Mage_Core_Controller_Front_Actio
236
  }
237
  else
238
  {
239
- $checkout->saveOrderAfterRedirectedPaymentAction(true,
 
 
 
 
 
 
 
 
 
 
 
240
  $this->getRequest()->getPost('StatusCode'),
241
  $this->getRequest()->getPost('Message'),
242
  $this->getRequest()->getPost('PreviousStatusCode'),
243
  $this->getRequest()->getPost('PreviousMessage'),
244
  $this->getRequest()->getPost('OrderID'),
245
  $this->getRequest()->getPost('CrossReference'));
 
 
 
 
 
 
 
 
 
 
 
246
  }
247
  }
248
  catch (Exception $exc)
@@ -251,7 +294,7 @@ class Iridiumcorp_Tpg_PaymentController extends Mage_Core_Controller_Front_Actio
251
  $szNotificationMessage = Iridiumcorp_Tpg_Model_Common_GlobalErrors::ERROR_183;
252
  Mage::logException($exc);
253
  }
254
-
255
  $szPaymentProcessorResponse = $session->getPaymentprocessorresponse();
256
  if($boError)
257
  {
@@ -265,7 +308,7 @@ class Iridiumcorp_Tpg_PaymentController extends Mage_Core_Controller_Front_Actio
265
 
266
  if($nVersion >= 1410)
267
  {
268
- if($order)
269
  {
270
  $orderState = 'pending_payment';
271
  $orderStatus = 'irc_failed_hosted_payment';
@@ -282,9 +325,9 @@ class Iridiumcorp_Tpg_PaymentController extends Mage_Core_Controller_Front_Actio
282
  {
283
  Mage::getSingleton('core/session')->addError($szNotificationMessage);
284
  }
285
- $order->save();
286
-
287
- $this->_clearSessionVariables();
288
  $this->_redirect('checkout/onepage/failure');
289
  }
290
  else
@@ -292,25 +335,29 @@ class Iridiumcorp_Tpg_PaymentController extends Mage_Core_Controller_Front_Actio
292
  // set the quote as inactive after back from paypal
293
  Mage::getSingleton('checkout/session')->getQuote()->setIsActive(false)->save();
294
 
295
- // send confirmation email to customer
296
- if($order->getId())
297
- {
298
- $order->sendNewOrderEmail();
299
- }
300
-
301
- if($nVersion >= 1410)
302
- {
303
- $this->_subtractOrderedItemsFromStock($order);
304
- $this->_updateInvoices($order, $szPaymentProcessorResponse);
305
- }
306
-
307
- if($nVersion != 1324 && $nVersion != 1330)
308
  {
309
- if($szPaymentProcessorResponse != '')
 
 
 
 
 
 
 
 
 
 
 
 
310
  {
311
- Mage::getSingleton('core/session')->addSuccess($szPaymentProcessorResponse);
 
 
 
312
  }
313
  }
 
314
  $this->_redirect('checkout/onepage/success', array('_secure' => true));
315
  }
316
  }
@@ -325,8 +372,8 @@ class Iridiumcorp_Tpg_PaymentController extends Mage_Core_Controller_Front_Actio
325
  $model = Mage::getModel('tpg/direct');
326
  $checkout = Mage::getSingleton('checkout/type_onepage');
327
  $szOrderID = $this->getRequest()->getPost('OrderID');
328
- $szMessage = $this->getRequest()->getPost('Message');
329
- $nVersion = Mage::getModel('tpg/direct')->getVersion();
330
 
331
  try
332
  {
@@ -369,11 +416,11 @@ class Iridiumcorp_Tpg_PaymentController extends Mage_Core_Controller_Front_Actio
369
  if($this->getRequest()->getPost('StatusCode') == '0')
370
  {
371
  Mage::getSingleton('checkout/session')->clear();
372
-
373
  if($nVersion >= 1410)
374
  {
375
- $this->_subtractOrderedItemsFromStock($order);
376
- $this->_updateInvoices($order, $szMessage);
377
  }
378
  }
379
 
@@ -390,7 +437,7 @@ class Iridiumcorp_Tpg_PaymentController extends Mage_Core_Controller_Front_Actio
390
  $nStartIndex = false;
391
  //
392
  $szHashDigest = false;
393
- $szMerchantID = false;// password, presharedkey, hashmethod
394
  $szCrossReference = false;
395
  $szOrderID = false;
396
  //
@@ -405,10 +452,10 @@ class Iridiumcorp_Tpg_PaymentController extends Mage_Core_Controller_Front_Actio
405
  $szPreSharedKey = $model->getConfigData('presharedkey');
406
  $szURLVariableString = $this->getRequest()->getRequestUri();
407
  $nStartIndex = strpos($szURLVariableString, "?");
408
- $order = Mage::getModel('sales/order');
409
  $order->load(Mage::getSingleton('checkout/session')->getLastOrderId());
410
- $nVersion = Mage::getModel('tpg/direct')->getVersion();
411
-
412
  if(!is_int($nStartIndex))
413
  {
414
  $szErrorMessage = Iridiumcorp_Tpg_Model_Common_GlobalErrors::ERROR_309;
@@ -478,7 +525,7 @@ class Iridiumcorp_Tpg_PaymentController extends Mage_Core_Controller_Front_Actio
478
  $szMessage = isset($transactionResult["Message"]) ? $transactionResult["Message"] : false;
479
  $szPreviousStatusCode = $szStatusCode;
480
  $szPreviousMessage = $szMessage;
481
-
482
  $checkout->saveOrderAfterRedirectedPaymentAction(true,
483
  $szStatusCode,
484
  $szMessage,
@@ -527,7 +574,7 @@ class Iridiumcorp_Tpg_PaymentController extends Mage_Core_Controller_Front_Actio
527
  $this->_redirect('checkout/onepage/failure');
528
  }
529
  else
530
- {
531
  // set the quote as inactive after back from paypal
532
  Mage::getSingleton('checkout/session')->getQuote()->setIsActive(false)->save();
533
 
@@ -542,7 +589,7 @@ class Iridiumcorp_Tpg_PaymentController extends Mage_Core_Controller_Front_Actio
542
  $this->_subtractOrderedItemsFromStock($order);
543
  $this->_updateInvoices($order, $szMessage);
544
  }
545
-
546
  if($nVersion != 1324 && $nVersion != 1330)
547
  {
548
  Mage::getSingleton('core/session')->addSuccess('Payment Processor Response: '.$szMessage);
@@ -558,10 +605,10 @@ class Iridiumcorp_Tpg_PaymentController extends Mage_Core_Controller_Front_Actio
558
  public function callbacktransparentredirectAction()
559
  {
560
  $model = Mage::getModel('tpg/direct');
561
- $order = Mage::getModel('sales/order');
562
  $order->load(Mage::getSingleton('checkout/session')->getLastOrderId());
563
  $nVersion = Mage::getModel('tpg/direct')->getVersion();
564
-
565
  try
566
  {
567
  $hmHashMethod = $model->getConfigData('hashmethod');
@@ -593,10 +640,10 @@ class Iridiumcorp_Tpg_PaymentController extends Mage_Core_Controller_Front_Actio
593
  {
594
  $error = Iridiumcorp_Tpg_Model_Common_GlobalErrors::ERROR_260;
595
  Mage::logException($exc);
596
-
597
  if($nVersion >= 1410)
598
  {
599
- if($order)
600
  {
601
  $orderState = 'pending_payment';
602
  $orderStatus = 'irc_failed_hosted_payment';
@@ -613,8 +660,8 @@ class Iridiumcorp_Tpg_PaymentController extends Mage_Core_Controller_Front_Actio
613
  {
614
  Mage::getSingleton('core/session')->addError($error);
615
  }
616
-
617
- $this->_clearSessionVariables();
618
  $this->_redirect('checkout/onepage/failure');
619
  }
620
  }
@@ -642,7 +689,7 @@ class Iridiumcorp_Tpg_PaymentController extends Mage_Core_Controller_Front_Actio
642
 
643
  if($error)
644
  {
645
- $this->_clearSessionVariables();
646
  //Mage::getSingleton('core/session')->addError($error);
647
  //$this->_redirect('checkout/onepage/failure');
648
  Mage::throwException($error);
@@ -691,12 +738,13 @@ class Iridiumcorp_Tpg_PaymentController extends Mage_Core_Controller_Front_Actio
691
  $model = Mage::getModel('tpg/direct');
692
  $szOrderID = $this->getRequest()->getPost('OrderID');
693
  $checkout = Mage::getSingleton('checkout/type_onepage');
694
- $session = Mage::getSingleton('checkout/session');
695
  $szPaymentProcessorResponse = '';
696
  $order = Mage::getModel('sales/order');
697
  $order->load(Mage::getSingleton('checkout/session')->getLastOrderId());
698
- $nVersion = Mage::getModel('tpg/direct')->getVersion();
699
-
 
700
  try
701
  {
702
  $formVariables['HashDigest'] = $this->getRequest()->getPost('HashDigest');
@@ -729,13 +777,35 @@ class Iridiumcorp_Tpg_PaymentController extends Mage_Core_Controller_Front_Actio
729
  }
730
  else
731
  {
732
- $checkout->saveOrderAfterRedirectedPaymentAction(false,
733
- $this->getRequest()->getPost('StatusCode'),
734
- $this->getRequest()->getPost('Message'),
735
- $this->getRequest()->getPost('PreviousStatusCode'),
736
- $this->getRequest()->getPost('PreviousMessage'),
737
- $this->getRequest()->getPost('OrderID'),
738
- $this->getRequest()->getPost('CrossReference'));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
739
  }
740
  }
741
  catch(Exception $exc)
@@ -749,15 +819,15 @@ class Iridiumcorp_Tpg_PaymentController extends Mage_Core_Controller_Front_Actio
749
  if($boError == true)
750
  {
751
  if($szPaymentProcessorResponse != null &&
752
- $szPaymentProcessorResponse != '')
753
- {
754
- $szNotificationMessage = $szNotificationMessage.'<br/>'.$szPaymentProcessorResponse;
755
- }
756
-
757
- $order->getPayment()->setAdditionalData("CrossReference=".$this->getRequest()->getPost('CrossReference'));
758
-
759
- if($nVersion >= 1410)
760
- {
761
  if($order)
762
  {
763
  $orderState = 'pending_payment';
@@ -765,48 +835,55 @@ class Iridiumcorp_Tpg_PaymentController extends Mage_Core_Controller_Front_Actio
765
  $order->setCustomerNote(Mage::helper('tpg')->__('Transparent Redirect Payment Failed'));
766
  $order->setState($orderState, $orderStatus, $szPaymentProcessorResponse, false);
767
  }
768
- }
769
- if($nVersion == 1324 || $nVersion == 1330)
770
- {
771
- Mage::getSingleton('checkout/session')->addError($szNotificationMessage);
772
- }
773
- else
774
- {
775
- Mage::getSingleton('core/session')->addError($szNotificationMessage);
776
- }
777
  $order->save();
778
 
779
- $this->_clearSessionVariables();
 
 
 
 
 
 
 
 
 
780
  $this->_redirect('checkout/onepage/failure');
781
  }
782
  else
783
  {
784
- // set the quote as inactive after back from paypal
785
  Mage::getSingleton('checkout/session')->getQuote()->setIsActive(false)->save();
786
- // send confirmation email to customer
787
- if($order->getId())
788
- {
789
- $order->sendNewOrderEmail();
790
- }
791
-
792
- if($nVersion >= 1410)
793
- {
794
- $this->_subtractOrderedItemsFromStock($order);
795
- $this->_updateInvoices($order, $szPaymentProcessorResponse);
796
- }
797
-
798
- if($nVersion != 1324 && $nVersion != 1330)
799
  {
800
- if($szPaymentProcessorResponse != '')
 
 
 
 
 
 
 
 
 
 
 
 
801
  {
802
- Mage::getSingleton('core/session')->addSuccess($szPaymentProcessorResponse);
 
 
 
803
  }
804
  }
 
805
  $this->_redirect('checkout/onepage/success', array('_secure' => true));
806
  }
807
  }
808
-
809
- /**
810
  * Deduct the order items from the stock
811
  *
812
  * @param unknown_type $order
@@ -847,7 +924,7 @@ class Iridiumcorp_Tpg_PaymentController extends Mage_Core_Controller_Front_Actio
847
  {
848
  $nVersion = Mage::getModel('tpg/direct')->getVersion();
849
  $isCustomStockManagementEnabled = Mage::getModel('tpg/direct')->getConfigData('customstockmanagementenabled');
850
-
851
  if($nVersion >= 1410 &&
852
  $isCustomStockManagementEnabled)
853
  {
@@ -891,8 +968,9 @@ class Iridiumcorp_Tpg_PaymentController extends Mage_Core_Controller_Front_Actio
891
  ->setPreviousstatuscode(null)
892
  ->setPreviousmessage(null)
893
  ->setOrderid(null)
894
- ->setRedirectedpayment(null)
895
- ->setTpgOrderId(null);
 
896
  }
897
 
898
  /**
@@ -900,19 +978,52 @@ class Iridiumcorp_Tpg_PaymentController extends Mage_Core_Controller_Front_Actio
900
  *
901
  * @param unknown_type $order
902
  */
903
- private function _updateInvoices($order, $message)
904
  {
905
  $invoices = $order->getInvoiceCollection();
906
  $status = Mage_Sales_Model_Order::STATE_PROCESSING;
907
-
908
  foreach ($invoices as $invoice)
909
  {
910
- // set the invoice state to be "Paid"
911
  $invoice->pay()->save();
912
  }
913
- // add a comment to the order comments
914
  //$order->addStatusToHistory($status, $message, false);
915
  $order->setState($status, 'irc_paid', $message, false);
916
  $order->save();
917
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
918
  }
8
  */
9
  class Iridiumcorp_Tpg_PaymentController extends Mage_Core_Controller_Front_Action
10
  {
11
+ protected function _expireAjax()
12
  {
13
  if (!Mage::getSingleton('checkout/session')->getQuote()->hasItems())
14
  {
92
  $session = Mage::getSingleton('checkout/session');
93
  $szPaymentProcessorResponse = '';
94
  $nVersion = Mage::getModel('tpg/direct')->getVersion();
95
+ $order = Mage::getModel('sales/order');
96
+ $order->load(Mage::getSingleton('checkout/session')->getLastOrderId());
97
+ $boCartIsEmpty = false;
98
 
99
  try
100
  {
101
  $szPaRes = $this->getRequest()->getPost('PaRes');
102
  $szMD = $this->getRequest()->getPost('MD');
103
 
104
+ // check if the cart is not empty, ie: after successful completion back button clicked in the browser
105
+ $iridiumcorpOrderId = Mage::getSingleton('checkout/session')->getTpgOrderId();
106
+ $szOrderStatus = $order->getStatus();
107
+
108
+ if($szOrderStatus != 'irc_paid')
109
+ //if($iridiumcorpOrderId)
110
+ {
111
+ // cart is not empty
112
+ // complete the 3D Secure transaction with the 3D Authorization result
113
+ $checkout->saveOrderAfter3dSecure($szPaRes, $szMD);
114
+
115
+ $szPaymentProcessorResponse = $session->getPaymentprocessorresponse();
116
+ }
117
+ else
118
+ {
119
+ // cart is empty
120
+ $boCartIsEmpty = true;
121
+ $szPaymentProcessorResponse = null;
122
+ }
123
  }
124
  catch (Exception $exc)
125
  {
136
  $szMessage = Iridiumcorp_Tpg_Model_Common_GlobalErrors::ERROR_7655;
137
  }
138
  }
 
 
 
 
139
 
140
  if ($boError)
141
  {
174
  // set the quote as inactive after back from paypal
175
  Mage::getSingleton('checkout/session')->getQuote()->setIsActive(false)->save();
176
 
177
+ // if the cart is empty do not attempt to update the invoices
178
+ if($boCartIsEmpty == false)
179
+ {
180
+ // send confirmation email to customer
181
+ if($order->getId())
182
+ {
183
+ $order->sendNewOrderEmail();
184
+ }
185
+
186
+ if($nVersion >= 1410)
187
+ {
188
+ $this->_subtractOrderedItemsFromStock($order);
189
+ $this->_updateInvoices($order, $szPaymentProcessorResponse);
190
+ }
191
+
192
+ if($nVersion != 1324 && $nVersion != 1330)
193
+ {
194
+ if($szPaymentProcessorResponse != '')
195
+ {
196
+ Mage::getSingleton('core/session')->addSuccess($szPaymentProcessorResponse);
197
+ }
198
+ }
199
+ }
200
 
201
  $this->_redirect('checkout/onepage/success', array('_secure' => true));
202
  }
213
  $model = Mage::getModel('tpg/direct');
214
  $szOrderID = $this->getRequest()->getPost('OrderID');
215
  $checkout = Mage::getSingleton('checkout/type_onepage');
216
+ $session = Mage::getSingleton('checkout/session');
217
  $szPaymentProcessorResponse = '';
218
  $order = Mage::getModel('sales/order');
219
  $order->load(Mage::getSingleton('checkout/session')->getLastOrderId());
220
  $nVersion = Mage::getModel('tpg/direct')->getVersion();
221
+ $boCartIsEmpty = false;
222
 
223
  try
224
  {
257
  }
258
  else
259
  {
260
+ $iridiumcorpOrderId = Mage::getSingleton('checkout/session')->getTpgOrderId();
261
+ $szOrderStatus = $order->getStatus();
262
+ $szStatusCode = $this->getRequest()->getPost('StatusCode');
263
+ $szMessage = $this->getRequest()->getPost('Message');
264
+ $szPreviousStatusCode = $this->getRequest()->getPost('PreviousStatusCode');
265
+ $szPreviousMessage = $this->getRequest()->getPost('PreviousMessage');
266
+ $szOrderID = $this->getRequest()->getPost('OrderID');
267
+
268
+ if($szOrderStatus != 'irc_paid')
269
+ //if($iridiumcorpOrderId)
270
+ {
271
+ $checkout->saveOrderAfterRedirectedPaymentAction(true,
272
  $this->getRequest()->getPost('StatusCode'),
273
  $this->getRequest()->getPost('Message'),
274
  $this->getRequest()->getPost('PreviousStatusCode'),
275
  $this->getRequest()->getPost('PreviousMessage'),
276
  $this->getRequest()->getPost('OrderID'),
277
  $this->getRequest()->getPost('CrossReference'));
278
+ }
279
+ else
280
+ {
281
+ // cart is empty
282
+ $boCartIsEmpty = true;
283
+ $szPaymentProcessorResponse = null;
284
+
285
+ // chek the StatusCode as the customer might have just clicked the BACK button and re-submitted the card details
286
+ // which can cause a charge back to the merchant
287
+ $this->_fixBackButtonBug($szOrderID, $szStatusCode, $szMessage, $szPreviousStatusCode, $szPreviousMessage);
288
+ }
289
  }
290
  }
291
  catch (Exception $exc)
294
  $szNotificationMessage = Iridiumcorp_Tpg_Model_Common_GlobalErrors::ERROR_183;
295
  Mage::logException($exc);
296
  }
297
+
298
  $szPaymentProcessorResponse = $session->getPaymentprocessorresponse();
299
  if($boError)
300
  {
308
 
309
  if($nVersion >= 1410)
310
  {
311
+ if($order)
312
  {
313
  $orderState = 'pending_payment';
314
  $orderStatus = 'irc_failed_hosted_payment';
325
  {
326
  Mage::getSingleton('core/session')->addError($szNotificationMessage);
327
  }
328
+ $order->save();
329
+
330
+ $this->_clearSessionVariables();
331
  $this->_redirect('checkout/onepage/failure');
332
  }
333
  else
335
  // set the quote as inactive after back from paypal
336
  Mage::getSingleton('checkout/session')->getQuote()->setIsActive(false)->save();
337
 
338
+ if($boCartIsEmpty == false)
 
 
 
 
 
 
 
 
 
 
 
 
339
  {
340
+ // send confirmation email to customer
341
+ if($order->getId())
342
+ {
343
+ $order->sendNewOrderEmail();
344
+ }
345
+
346
+ if($nVersion >= 1410)
347
+ {
348
+ $this->_subtractOrderedItemsFromStock($order);
349
+ $this->_updateInvoices($order, $szPaymentProcessorResponse);
350
+ }
351
+
352
+ if($nVersion != 1324 && $nVersion != 1330)
353
  {
354
+ if($szPaymentProcessorResponse != '')
355
+ {
356
+ Mage::getSingleton('core/session')->addSuccess($szPaymentProcessorResponse);
357
+ }
358
  }
359
  }
360
+
361
  $this->_redirect('checkout/onepage/success', array('_secure' => true));
362
  }
363
  }
372
  $model = Mage::getModel('tpg/direct');
373
  $checkout = Mage::getSingleton('checkout/type_onepage');
374
  $szOrderID = $this->getRequest()->getPost('OrderID');
375
+ $szMessage = $this->getRequest()->getPost('Message');
376
+ $nVersion = Mage::getModel('tpg/direct')->getVersion();
377
 
378
  try
379
  {
416
  if($this->getRequest()->getPost('StatusCode') == '0')
417
  {
418
  Mage::getSingleton('checkout/session')->clear();
419
+
420
  if($nVersion >= 1410)
421
  {
422
+ $this->_subtractOrderedItemsFromStock($order);
423
+ $this->_updateInvoices($order, $szMessage);
424
  }
425
  }
426
 
437
  $nStartIndex = false;
438
  //
439
  $szHashDigest = false;
440
+ $szMerchantID = false;
441
  $szCrossReference = false;
442
  $szOrderID = false;
443
  //
452
  $szPreSharedKey = $model->getConfigData('presharedkey');
453
  $szURLVariableString = $this->getRequest()->getRequestUri();
454
  $nStartIndex = strpos($szURLVariableString, "?");
455
+ $order = Mage::getModel('sales/order');
456
  $order->load(Mage::getSingleton('checkout/session')->getLastOrderId());
457
+ $nVersion = Mage::getModel('tpg/direct')->getVersion();
458
+
459
  if(!is_int($nStartIndex))
460
  {
461
  $szErrorMessage = Iridiumcorp_Tpg_Model_Common_GlobalErrors::ERROR_309;
525
  $szMessage = isset($transactionResult["Message"]) ? $transactionResult["Message"] : false;
526
  $szPreviousStatusCode = $szStatusCode;
527
  $szPreviousMessage = $szMessage;
528
+
529
  $checkout->saveOrderAfterRedirectedPaymentAction(true,
530
  $szStatusCode,
531
  $szMessage,
574
  $this->_redirect('checkout/onepage/failure');
575
  }
576
  else
577
+ {
578
  // set the quote as inactive after back from paypal
579
  Mage::getSingleton('checkout/session')->getQuote()->setIsActive(false)->save();
580
 
589
  $this->_subtractOrderedItemsFromStock($order);
590
  $this->_updateInvoices($order, $szMessage);
591
  }
592
+
593
  if($nVersion != 1324 && $nVersion != 1330)
594
  {
595
  Mage::getSingleton('core/session')->addSuccess('Payment Processor Response: '.$szMessage);
605
  public function callbacktransparentredirectAction()
606
  {
607
  $model = Mage::getModel('tpg/direct');
608
+ $order = Mage::getModel('sales/order');
609
  $order->load(Mage::getSingleton('checkout/session')->getLastOrderId());
610
  $nVersion = Mage::getModel('tpg/direct')->getVersion();
611
+
612
  try
613
  {
614
  $hmHashMethod = $model->getConfigData('hashmethod');
640
  {
641
  $error = Iridiumcorp_Tpg_Model_Common_GlobalErrors::ERROR_260;
642
  Mage::logException($exc);
643
+
644
  if($nVersion >= 1410)
645
  {
646
+ if($order)
647
  {
648
  $orderState = 'pending_payment';
649
  $orderStatus = 'irc_failed_hosted_payment';
660
  {
661
  Mage::getSingleton('core/session')->addError($error);
662
  }
663
+
664
+ $this->_clearSessionVariables();
665
  $this->_redirect('checkout/onepage/failure');
666
  }
667
  }
689
 
690
  if($error)
691
  {
692
+ $this->_clearSessionVariables();
693
  //Mage::getSingleton('core/session')->addError($error);
694
  //$this->_redirect('checkout/onepage/failure');
695
  Mage::throwException($error);
738
  $model = Mage::getModel('tpg/direct');
739
  $szOrderID = $this->getRequest()->getPost('OrderID');
740
  $checkout = Mage::getSingleton('checkout/type_onepage');
741
+ $session = Mage::getSingleton('checkout/session');
742
  $szPaymentProcessorResponse = '';
743
  $order = Mage::getModel('sales/order');
744
  $order->load(Mage::getSingleton('checkout/session')->getLastOrderId());
745
+ $nVersion = Mage::getModel('tpg/direct')->getVersion();
746
+ $boCartIsEmpty = false;
747
+
748
  try
749
  {
750
  $formVariables['HashDigest'] = $this->getRequest()->getPost('HashDigest');
777
  }
778
  else
779
  {
780
+ $iridiumcorpOrderId = Mage::getSingleton('checkout/session')->getTpgOrderId();
781
+ $szOrderStatus = $order->getStatus();
782
+
783
+ if($szOrderStatus != 'irc_paid')
784
+ //if($iridiumcorpOrderId)
785
+ {
786
+ $checkout->saveOrderAfterRedirectedPaymentAction(false,
787
+ $this->getRequest()->getPost('StatusCode'),
788
+ $this->getRequest()->getPost('Message'),
789
+ $this->getRequest()->getPost('PreviousStatusCode'),
790
+ $this->getRequest()->getPost('PreviousMessage'),
791
+ $this->getRequest()->getPost('OrderID'),
792
+ $this->getRequest()->getPost('CrossReference'));
793
+ }
794
+ else
795
+ {
796
+ $boCartIsEmpty = true;
797
+ $szPaymentProcessorResponse = null;
798
+
799
+ // chek the StatusCode as the customer might have just clicked the BACK button and re-submitted the card details
800
+ // which can cause a charge back to the merchant
801
+ $szStatusCode = $this->getRequest()->getPost('StatusCode');
802
+ $szMessage = $this->getRequest()->getPost('Message');
803
+ $szPreviousStatusCode = $this->getRequest()->getPost('PreviousStatusCode');
804
+ $szPreviousMessage = $this->getRequest()->getPost('PreviousMessage');
805
+ $szOrderID = $this->getRequest()->getPost('OrderID');
806
+
807
+ $this->_fixBackButtonBug($szOrderID, $szStatusCode, $szMessage, $szPreviousStatusCode, $szPreviousMessage);
808
+ }
809
  }
810
  }
811
  catch(Exception $exc)
819
  if($boError == true)
820
  {
821
  if($szPaymentProcessorResponse != null &&
822
+ $szPaymentProcessorResponse != '')
823
+ {
824
+ $szNotificationMessage = $szNotificationMessage.'<br/>'.$szPaymentProcessorResponse;
825
+ }
826
+
827
+ $order->getPayment()->setAdditionalData("CrossReference=".$this->getRequest()->getPost('CrossReference'));
828
+
829
+ if($nVersion >= 1410)
830
+ {
831
  if($order)
832
  {
833
  $orderState = 'pending_payment';
835
  $order->setCustomerNote(Mage::helper('tpg')->__('Transparent Redirect Payment Failed'));
836
  $order->setState($orderState, $orderStatus, $szPaymentProcessorResponse, false);
837
  }
838
+ }
839
+
 
 
 
 
 
 
 
840
  $order->save();
841
 
842
+ if($nVersion == 1324 || $nVersion == 1330)
843
+ {
844
+ Mage::getSingleton('checkout/session')->addError($szNotificationMessage);
845
+ }
846
+ else
847
+ {
848
+ Mage::getSingleton('core/session')->addError($szNotificationMessage);
849
+ }
850
+
851
+ $this->_clearSessionVariables();
852
  $this->_redirect('checkout/onepage/failure');
853
  }
854
  else
855
  {
856
+ // set the quote as inactive after back from paypal
857
  Mage::getSingleton('checkout/session')->getQuote()->setIsActive(false)->save();
858
+
859
+ if($boCartIsEmpty == false)
 
 
 
 
 
 
 
 
 
 
 
860
  {
861
+ // send confirmation email to customer
862
+ if($order->getId())
863
+ {
864
+ $order->sendNewOrderEmail();
865
+ }
866
+
867
+ if($nVersion >= 1410)
868
+ {
869
+ $this->_subtractOrderedItemsFromStock($order);
870
+ $this->_updateInvoices($order, $szPaymentProcessorResponse);
871
+ }
872
+
873
+ if($nVersion != 1324 && $nVersion != 1330)
874
  {
875
+ if($szPaymentProcessorResponse != '')
876
+ {
877
+ Mage::getSingleton('core/session')->addSuccess($szPaymentProcessorResponse);
878
+ }
879
  }
880
  }
881
+
882
  $this->_redirect('checkout/onepage/success', array('_secure' => true));
883
  }
884
  }
885
+
886
+ /**
887
  * Deduct the order items from the stock
888
  *
889
  * @param unknown_type $order
924
  {
925
  $nVersion = Mage::getModel('tpg/direct')->getVersion();
926
  $isCustomStockManagementEnabled = Mage::getModel('tpg/direct')->getConfigData('customstockmanagementenabled');
927
+
928
  if($nVersion >= 1410 &&
929
  $isCustomStockManagementEnabled)
930
  {
968
  ->setPreviousstatuscode(null)
969
  ->setPreviousmessage(null)
970
  ->setOrderid(null)
971
+ ->setRedirectedpayment(null);
972
+ // do not clear the order id as after the a failed payment the customer still might want to repeat the payment attempt
973
+ //->setTpgOrderId(null);
974
  }
975
 
976
  /**
978
  *
979
  * @param unknown_type $order
980
  */
981
+ private function _updateInvoices($order, $message)
982
  {
983
  $invoices = $order->getInvoiceCollection();
984
  $status = Mage_Sales_Model_Order::STATE_PROCESSING;
985
+
986
  foreach ($invoices as $invoice)
987
  {
988
+ // set the invoice state to be "Paid"
989
  $invoice->pay()->save();
990
  }
991
+ // add a comment to the order comments
992
  //$order->addStatusToHistory($status, $message, false);
993
  $order->setState($status, 'irc_paid', $message, false);
994
  $order->save();
995
  }
996
+
997
+ private function _fixBackButtonBug($szOrderID, $szStatusCode, $szMessage, $szPreviousStatusCode, $szPreviousMessage)
998
+ {
999
+ // check the payment type as hitting the BACK button in the browser for Transparent Redirect payment method only redirects back the client side result and
1000
+ // not letting the customer to change the card details or re-submitting the payment
1001
+ $mode = Mage::getModel('tpg/direct')->getConfigData('mode');
1002
+ $boIgnoreDuplicateMessage = false;
1003
+
1004
+ if($mode == Iridiumcorp_Tpg_Model_Source_PaymentMode::PAYMENT_MODE_TRANSPARENT_REDIRECT)
1005
+ {
1006
+ $boIgnoreDuplicateMessage = true;
1007
+ }
1008
+
1009
+ if($boIgnoreDuplicateMessage)
1010
+ {
1011
+ Mage::getSingleton('core/session')->addError('ERROR - Order ID: '.$szOrderID.' has already been successfully paid and processed. Payment Processor Response: '.$szMessage.'. <br/> IMPORTANT: please do not attempt to click the back button in your browser as it could cause duplicate charges to your bank account.');
1012
+ }
1013
+ else
1014
+ {
1015
+ if($szStatusCode == '0')
1016
+ {
1017
+ Mage::getSingleton('core/session')->addError('ERROR - Duplicate payment for Order ID: '.$szOrderID.' with Payment Processor Response: '.$szMessage.'. This order has already been successfully paid and processed. Please contact us immediately to avoid duplicate charges to your bank account.');
1018
+ }
1019
+ else if($szStatusCode == '20')
1020
+ {
1021
+ Mage::getSingleton('core/session')->addError('Duplicate payment attempted for Order ID: '.$szOrderID.'. Previous Payment Processor Response: '.$szPreviousMessage.'. This order has already been successfully paid and processed. </br/>IMPORTANT: please do not attempt to click the back button in your browser and re-submit the payment for this order as it could cause duplicate charges to your bank account.');
1022
+ }
1023
+ else
1024
+ {
1025
+ Mage::getSingleton('core/session')->addError('ERROR: Order ID: '.$szOrderID.' has already been successfully paid and processed. Payment Processor Response: '.$szMessage.'. Please contact us immediately to avoid duplicate charges to your bank account.');
1026
+ }
1027
+ }
1028
+ }
1029
  }
package.xml CHANGED
@@ -1,19 +1,22 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Iridiumcorp_Tpg</name>
4
- <version>1.13.2</version>
5
  <stability>stable</stability>
6
  <license>OSL v3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
- <summary>Iridiumcorp payment extension compatible with Magento v 1.3, 1.4 and 1.5</summary>
10
  <description>Fully supports 3D secure transactions. Also supports all of the integration methods provided by Iridiumcorp.</description>
11
- <notes>Fixed SQL script error in pre 1.5.x.x installations.
12
- Fixed LastException public getter.</notes>
 
 
 
13
  <authors><author><name>Iridiumcorp</name><user>auto-converted</user><email>support@iridiumcorp.net</email></author></authors>
14
- <date>2011-07-05</date>
15
- <time>11:06:39</time>
16
- <contents><target name="magedesign"><dir name="adminhtml"><dir name="base"><dir name="default"><dir name="template"><dir name="tpg"><file name="form.phtml" hash="8b0d05b93432af9f2ea43bb1796e30de"/><file name="info.phtml" hash="38bfb7011b9cb1b3f48fa1ed3ea8b1e7"/></dir></dir></dir></dir><dir name="default"><dir name="default"><dir name="template"><dir name="tpg"><file name="form.phtml" hash="b0838917ecb3a7d1167dd94c10981c9f"/><file name="info.phtml" hash="38bfb7011b9cb1b3f48fa1ed3ea8b1e7"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="tpg"><file name="form.phtml" hash="67bafa692aaf8f50ea441c239ea9cbdc"/><file name="info.phtml" hash="e9011580324f811d71aeb8c0b0f64734"/></dir></dir></dir></dir><dir name="default"><dir name="default"><dir name="template"><dir name="tpg"><file name="form.phtml" hash="1a31dba428e0952e8827918962805e4b"/><file name="info.phtml" hash="e9011580324f811d71aeb8c0b0f64734"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="images"><file name="iridium_corporation.jpg" hash="589faaa1b7e80b32a425175ecfc3b455"/></dir></dir></dir><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="47de7ef027476c184a01f6c249a56065"/></dir></dir></dir><dir name="etc"><file name="config.xml" hash="aaa95b6e1d6e145940bf9ba9bbe1dc0f"/></dir><dir name="Model"><dir name="Type"><file name="Onepage.php" hash="8d4eba732d98062a7a326cc2b0102b9b"/></dir></dir></dir><dir name="Sales"><dir name="etc"><file name="config.xml" hash="6e5a6db08b9bbaf959ec31a20ec5ffc2"/></dir><dir name="Model"><dir name="Order"><file name="Invoice.php" hash="1d4318c7b307f40b4a208dcb116fa14b"/><file name="Payment.php" hash="cd56b85013bbae52bb9bfe1984721045"/></dir><dir name="Service"><file name="Quote.php" hash="fbeac3e28f152fe6ee0419620188bab1"/></dir><file name="Order.php" hash="a57c4bd661dbc322d5bd18aa2f51dd67"/></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="5e753e1e1bbf0ada18f7292d4031da97"/></dir><dir name="controllers"><file name="PaymentController.php" hash="397c199299971205fca325a4607920ac"/></dir><dir name="etc"><file name="config.xml" hash="a22141f14f4b641de6088d0ead20ba49"/><file name="system.xml" hash="95ae76c5feb8dda560bca6a576e36c3c"/></dir><dir name="Helper"><file name="Data.php" hash="a72fba87e718c94d993a57199e20ca96"/></dir><dir name="Model"><dir name="Common"><dir name="ThePaymentGateway"><file name="PaymentSystem.php" hash="4ad38bdb85f865e967153d9f253390cd"/><file name="SOAP.php" hash="8d2f9a556e585a37a0219ae4ad5361ee"/><file name="TPG_Common.php" hash="df1033ef855c7e0e715076a105acb84a"/></dir><file name="GlobalErrors.php" hash="a9c7bab60ebfe87967c794194e1e7208"/><file name="ISOCountries.php" hash="fc63d76fbe25458ba351f114782074cb"/><file name="ISOCurrencies.php" hash="89ac1e124e89c0713ef43a0cf6dd0e2b"/><file name="PaymentFormHelper.php" hash="f75b9bcc9c09bd359a24f8e8b2702a07"/></dir><dir name="Resource"><dir name="Eav"><dir name="Mysql4"><file name="Setup.php" hash="d75ce704c7f0161f0bea4aa780679af8"/></dir></dir></dir><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="05f3806f2ff4bd5b1568bfb1681b2242"/></dir><file name="Direct.php" hash="1df0ae084d98406931c2f2f78c80154c"/><file name="Request.php" hash="a96e462ed3c1882048ea45f2c3a6662c"/></dir><dir name="sql"><dir name="tpg_setup"><file name="mysql4-install-0.1.0.php" hash="ef633b313caa213b729fe4b11860795e"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Iridiumcorp_All.xml" hash="f1a85eaa7631af1906f461b662519732"/></dir></target></contents>
17
  <compatible/>
18
  <dependencies/>
19
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Iridiumcorp_Tpg</name>
4
+ <version>1.14.0</version>
5
  <stability>stable</stability>
6
  <license>OSL v3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
+ <summary>Iridiumcorp payment extension compatible with Magento v 1.3, 1.4, 1.5 and 1.6</summary>
10
  <description>Fully supports 3D secure transactions. Also supports all of the integration methods provided by Iridiumcorp.</description>
11
+ <notes>Additional compatibility support for versions:&#xD;
12
+ - 1.6.0, 1.6.1 and 1.6.2.0&#xD;
13
+ Fixes for the following bugs:&#xD;
14
+ - back button issue causing incorrect statuses and order stock&#xD;
15
+ - special characters bug in checkout address in Direct API method</notes>
16
  <authors><author><name>Iridiumcorp</name><user>auto-converted</user><email>support@iridiumcorp.net</email></author></authors>
17
+ <date>2012-01-25</date>
18
+ <time>15:04:28</time>
19
+ <contents><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 name="base"><dir name="default"><dir name="images"><file name="iridium_corporation.jpg" hash="589faaa1b7e80b32a425175ecfc3b455"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="tpg"><file name="form.phtml" hash="b0838917ecb3a7d1167dd94c10981c9f"/><file name="info.phtml" hash="38bfb7011b9cb1b3f48fa1ed3ea8b1e7"/></dir></dir></dir></dir><dir name="base"><dir name="default"><dir name="template"><dir name="tpg"><file name="form.phtml" hash="8b0d05b93432af9f2ea43bb1796e30de"/><file name="info.phtml" hash="38bfb7011b9cb1b3f48fa1ed3ea8b1e7"/></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="1a31dba428e0952e8827918962805e4b"/><file name="info.phtml" hash="e9011580324f811d71aeb8c0b0f64734"/></dir></dir></dir></dir><dir name="base"><dir name="default"><dir name="template"><dir name="tpg"><file name="form.phtml" hash="67bafa692aaf8f50ea441c239ea9cbdc"/><file name="info.phtml" hash="e9011580324f811d71aeb8c0b0f64734"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Iridiumcorp_All.xml" hash="f1a85eaa7631af1906f461b662519732"/></dir></target><target name="magelocal"><dir name="Iridiumcorp"><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="5e753e1e1bbf0ada18f7292d4031da97"/></dir><dir name="controllers"><file name="PaymentController.php" hash="68d3636ed06255730f7fcb816c3289ba"/></dir><dir name="etc"><file name="config.xml" hash="a22141f14f4b641de6088d0ead20ba49"/><file name="system.xml" hash="95ae76c5feb8dda560bca6a576e36c3c"/></dir><dir name="Helper"><file name="Data.php" hash="a72fba87e718c94d993a57199e20ca96"/></dir><dir name="Model"><dir name="Common"><dir name="ThePaymentGateway"><file name="PaymentSystem.php" hash="74698dc7049a4ffa890481d29a1c620c"/><file name="SOAP.php" hash="9be2001c48e0c4919a915f6db1509cdd"/><file name="TPG_Common.php" hash="655bdcebcea8ffa3a2d8fa275bd2b80b"/></dir><file name="GlobalErrors.php" hash="a9c7bab60ebfe87967c794194e1e7208"/><file name="ISOCountries.php" hash="fc63d76fbe25458ba351f114782074cb"/><file name="ISOCurrencies.php" hash="89ac1e124e89c0713ef43a0cf6dd0e2b"/><file name="PaymentFormHelper.php" hash="f75b9bcc9c09bd359a24f8e8b2702a07"/></dir><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="05f3806f2ff4bd5b1568bfb1681b2242"/></dir><dir name="Resource"><dir name="Eav"><dir name="Mysql4"><file name="Setup.php" hash="d75ce704c7f0161f0bea4aa780679af8"/></dir></dir></dir><file name="Direct.php" hash="93379d38de07b6fab21fb63ed602879e"/><file name="Request.php" hash="a96e462ed3c1882048ea45f2c3a6662c"/></dir><dir name="sql"><dir name="tpg_setup"><file name="mysql4-install-0.1.0.php" hash="ef633b313caa213b729fe4b11860795e"/></dir></dir></dir><dir name="Checkout"><dir name="Block"><dir name="Onepage"><dir name="Payment"><file name="Methods.php" hash="47de7ef027476c184a01f6c249a56065"/></dir></dir></dir><dir name="etc"><file name="config.xml" hash="aaa95b6e1d6e145940bf9ba9bbe1dc0f"/></dir><dir name="Model"><dir name="Type"><file name="Onepage.php" hash="21ae90067e90c3b092014191adf01475"/></dir></dir></dir><dir name="Sales"><dir name="etc"><file name="config.xml" hash="6e5a6db08b9bbaf959ec31a20ec5ffc2"/></dir><dir name="Model"><dir name="Order"><file name="Invoice.php" hash="1d4318c7b307f40b4a208dcb116fa14b"/><file name="Payment.php" hash="cd56b85013bbae52bb9bfe1984721045"/></dir><dir name="Service"><file name="Quote.php" hash="fbeac3e28f152fe6ee0419620188bab1"/></dir><file name="Order.php" hash="a57c4bd661dbc322d5bd18aa2f51dd67"/></dir></dir></dir></target></contents>
20
  <compatible/>
21
  <dependencies/>
22
  </package>