Cardsave_Cardsaveonlinepayments - Version 1.11.0

Version Notes

Compatibility support for versions:
- 1.6.0
- 1.6.1
- 1.6.2
- other earlier versions
Fixes for the following bugs:
- back button issue causing incorrect statuses
- special character in address details issue in Direct API method

Download this release

Release Info

Developer Magento Core Team
Extension Cardsave_Cardsaveonlinepayments
Version 1.11.0
Comparing to
See all releases


Code changes from version 1.10.3 to 1.11.0

app/code/local/Cardsave/Cardsaveonlinepayments/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 CSV_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 CSV_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 CSV_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, CSV_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(CSV_NullableInt $nMonth = null, CSV_NullableInt $nYear = null)
268
  {
269
- $this->m_nMonth = $nMonth;
270
- $this->m_nYear = $nYear;
271
  }
272
  }
273
 
274
  class CSV_ExpiryDate extends CSV_CreditCardDate
275
  {
276
- public function __construct(CSV_NullableInt $nMonth = null, CSV_NullableInt $nYear = null)
277
  {
278
- parent::__construct($nMonth, $nYear);
279
  }
280
  }
281
 
282
  class CSV_StartDate extends CSV_CreditCardDate
283
  {
284
- public function __construct(CSV_NullableInt $nMonth = null, CSV_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, CSV_ExpiryDate $edExpiryDate = null, CSV_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 CSV_OverrideCardDetails extends CSV_CardDetails
341
  {
342
- public function __construct($szCardName, $szCardNumber, CSV_ExpiryDate $edExpiryDate = null, CSV_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, CSV_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, CSV_NullableInt $nAmount = null, CSV_NullableInt $nCurrencyCode = null, $szOrderID, $szOrderDescription, CSV_TransactionControl $tcTransactionControl = null, CSV_ThreeDSecureBrowserDetails $tdsbdThreeDSecureBrowserDetails = null)
446
  {
447
- if ($TransactionTypeOrMessageDetails instanceof CSV_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 CSV_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(CSV_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(CSV_NullableBool $boEchoCardType = null, CSV_NullableBool $boEchoAVSCheckResult = null, CSV_NullableBool $boEchoCV2CheckResult = null, CSV_NullableBool $boEchoAmountReceived = null, CSV_NullableInt $nDuplicateDelay = null, $szAVSOverridePolicy, $szCV2OverridePolicy, CSV_NullableBool $boThreeDSecureOverridePolicy = null, $szAuthCode, CSV_ThreeDSecurePassthroughData $tdsptThreeDSecurePassthroughData = null, CSV_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 CSV_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, CSV_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, CSV_NullableBool $boAuthorisationAttempted = null, CSV_PreviousTransactionResult $ptdPreviousTransactionResult = null, CSV_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 CSV_CardDetailsTransactionResult extends CSV_PaymentMessageGatewayOutput
864
  {
865
- public function __construct($nStatusCode, $szMessage, $szPassOutData, CSV_NullableBool $boAuthorisationAttempted = null, CSV_PreviousTransactionResult $ptdPreviousTransactionResult = null, CSV_StringList $lszErrorMessages = null)
866
  {
867
- parent::__construct($nStatusCode, $szMessage, $szPassOutData, $boAuthorisationAttempted, $ptdPreviousTransactionResult, $lszErrorMessages);
868
  }
869
  }
870
  class CSV_CrossReferenceTransactionResult extends CSV_PaymentMessageGatewayOutput
871
  {
872
- public function __construct($nStatusCode, $szMessage, $szPassOutData, CSV_NullableBool $boAuthorisationAttempted = null, CSV_PreviousTransactionResult $ptdPreviousTransactionResult = null, CSV_StringList $lszErrorMessages = null)
873
  {
874
- parent::__construct($nStatusCode, $szMessage, $szPassOutData, $boAuthorisationAttempted, $ptdPreviousTransactionResult, $lszErrorMessages);
875
  }
876
  }
877
  class CSV_ThreeDSecureTransactionResult extends CSV_PaymentMessageGatewayOutput
878
  {
879
- public function __construct($nStatusCode, $szMessage, $szPassOutData, CSV_NullableBool $boAuthorisationAttempted = null, CSV_PreviousTransactionResult $ptdPreviousTransactionResult = null, CSV_StringList $lszErrorMessages = null)
880
  {
881
- parent::__construct($nStatusCode, $szMessage, $szPassOutData, $boAuthorisationAttempted, $ptdPreviousTransactionResult, $lszErrorMessages);
882
  }
883
  }
884
  class CSV_GetGatewayEntryPointsResult extends CSV_GatewayOutput
885
  {
886
- public function __construct($nStatusCode, $szMessage, $szPassOutData, StringList $lszErrorMessages = null)
887
  {
888
- parent::__construct($nStatusCode, $szMessage, $szPassOutData, $lszErrorMessages);
889
  }
890
  }
891
  class CSV_GetCardTypeResult extends CSV_GatewayOutput
892
  {
893
- public function __construct($nStatusCode, $szMessage, $szPassOutData, CSV_StringList $lszErrorMessages = null)
894
  {
895
- parent::__construct($nStatusCode, $szMessage, $szPassOutData, $lszErrorMessages);
896
  }
897
  }
898
 
@@ -922,7 +1007,7 @@
922
  class CSV_GetGatewayEntryPointsOutputData extends CSV_BaseOutputData
923
  {
924
  //constructor
925
- function __construct(CSV_GatewayEntryPointList $lgepGatewayEntryPoints = null)
926
  {
927
  parent::__construct($lgepGatewayEntryPoints);
928
  }
@@ -1086,19 +1171,17 @@
1086
 
1087
  //constructor
1088
  public function __construct(CSV_RequestGatewayEntryPointList $lrgepRequestGatewayEntryPoints = null,
1089
- $nRetryAttempts,
1090
- CSV_NullableInt $nTimeout = null,
1091
- CSV_MerchantAuthentication $maMerchantAuthentication = null,
1092
- $szPassOutData)
1093
  {
1094
  if ($nRetryAttempts == null &&
1095
  $nTimeout == null)
1096
  {
1097
- CSV_GatewayTransaction::__construct($lrgepRequestGatewayEntryPoints, 1, null, $maMerchantAuthentication, $szPassOutData);
1098
  }
1099
  else
1100
  {
1101
- CSV_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(CSV_CardDetailsTransactionResult &$cdtrCardDetailsTransactionResult = null, CSV_TransactionOutputData &$todTransactionOutputData = null)
@@ -1137,7 +1218,7 @@
1137
  $cdtrCardDetailsTransactionResult = null;
1138
 
1139
  $sSOAPClient = new CSV_SOAP('CardDetailsTransaction', parent::getSOAPNamespace());
1140
-
1141
  // transaction details
1142
  if ($this->m_tdTransactionDetails != null)
1143
  {
@@ -1156,7 +1237,6 @@
1156
  $sSOAPClient->addParamAttribute('PaymentMessage.TransactionDetails', 'CurrencyCode', (string)$this->m_tdTransactionDetails->getCurrencyCode()->getValue());
1157
  }
1158
  }
1159
-
1160
  if ($this->m_tdTransactionDetails->getMessageDetails() != null)
1161
  {
1162
  if (!CSV_SharedFunctions::isStringNullOrEmpty($this->m_tdTransactionDetails->getMessageDetails()->getTransactionType()))
@@ -1172,7 +1252,10 @@
1172
  }
1173
  if ($this->m_tdTransactionDetails->getTransactionControl()->getThreeDSecureOverridePolicy() != null)
1174
  {
1175
- $sSOAPClient->addParam('PaymentMessage.TransactionDetails.TransactionControl.ThreeDSecureOverridePolicy', CSV_SharedFunctions::boolToString($this->m_tdTransactionDetails->getTransactionControl()->getThreeDSecureOverridePolicy()->getValue()));
 
 
 
1176
  }
1177
  if (!CSV_SharedFunctions::isStringNullOrEmpty($this->m_tdTransactionDetails->getTransactionControl()->getAVSOverridePolicy()))
1178
  {
@@ -1248,7 +1331,6 @@
1248
  }
1249
  }
1250
  }
1251
-
1252
  if ($this->m_tdTransactionDetails->getThreeDSecureBrowserDetails() != null)
1253
  {
1254
  if (!CSV_SharedFunctions::isStringNullOrEmpty($this->m_tdTransactionDetails->getThreeDSecureBrowserDetails()->getAcceptHeaders()))
@@ -1276,7 +1358,6 @@
1276
  $sSOAPClient->addParam('PaymentMessage.TransactionDetails.OrderDescription', $this->m_tdTransactionDetails->getOrderDescription());
1277
  }
1278
  }
1279
-
1280
  // card details
1281
  if ($this->m_cdCardDetails != null)
1282
  {
@@ -1331,7 +1412,6 @@
1331
  $sSOAPClient->addParam('PaymentMessage.CardDetails.IssueNumber', $this->m_cdCardDetails->getIssueNumber());
1332
  }
1333
  }
1334
-
1335
  // customer details
1336
  if ($this->m_cdCustomerDetails != null)
1337
  {
@@ -1400,19 +1480,14 @@
1400
  }
1401
 
1402
  public function __construct(CSV_RequestGatewayEntryPointList $lrgepRequestGatewayEntryPoints = null,
1403
- $nRetryAttempts,
1404
- CSV_NullableInt $nTimeout = null,
1405
- CSV_MerchantAuthentication $maMerchantAuthentication = null,
1406
- CSV_TransactionDetails $tdTransactionDetails = null,
1407
- CSV_CardDetails $cdCardDetails = null,
1408
- CSV_CustomerDetails $cdCustomerDetails = null,
1409
- $szPassOutData)
1410
  {
1411
- parent::__construct($lrgepRequestGatewayEntryPoints, $nRetryAttempts, $nTimeout, $maMerchantAuthentication, $szPassOutData);
1412
 
1413
- $this->m_tdTransactionDetails = $tdTransactionDetails;
1414
- $this->m_cdCardDetails = $cdCardDetails;
1415
- $this->m_cdCustomerDetails = $cdCustomerDetails;
1416
  }
1417
 
1418
  }
@@ -1670,19 +1745,14 @@
1670
 
1671
  //constructor
1672
  public function __construct(CSV_RequestGatewayEntryPointList $lrgepRequestGatewayEntryPoints = null,
1673
- $nRetryAttempts,
1674
- CSV_NullableInt $nTimeout = null,
1675
- CSV_MerchantAuthentication $maMerchantAuthentication = null,
1676
- CSV_TransactionDetails $tdTransactionDetails = null,
1677
- CSV_CardDetails $cdOverrideCardDetails = null,
1678
- CSV_CustomerDetails $cdCustomerDetails = null,
1679
- $szPassOutData)
1680
- {
1681
- GatewayTransaction::__construct($lrgepRequestGatewayEntryPoints, $nRetryAttempts, $nTimeout, $maMerchantAuthentication, $szPassOutData);
1682
 
1683
- $this->m_tdTransactionDetails = $tdTransactionDetails;
1684
- $this->m_ocdOverrideCardDetails = $cdOverrideCardDetails;
1685
- $this->m_cdCustomerDetails = $cdCustomerDetails;
1686
  }
1687
  }
1688
 
@@ -1732,15 +1802,12 @@
1732
 
1733
  //constructor
1734
  public function __construct(CSV_RequestGatewayEntryPointList $lrgepRequestGatewayEntryPoints = null,
1735
- $nRetryAttempts,
1736
- CSV_NullableInt $nTimeout = null,
1737
- CSV_MerchantAuthentication $maMerchantAuthentication = null,
1738
- CSV_ThreeDSecureInputData $tdsidThreeDSecureInputData = null,
1739
- $szPassOutData)
1740
  {
1741
- CSV_GatewayTransaction::__construct($lrgepRequestGatewayEntryPoints, $nRetryAttempts, $nTimeout, $maMerchantAuthentication, $szPassOutData);
1742
 
1743
- $this->m_tdsidThreeDSecureInputData = $tdsidThreeDSecureInputData;
1744
  }
1745
  }
1746
 
@@ -1752,7 +1819,11 @@
1752
  {
1753
  return $this->m_szCardNumber;
1754
  }
1755
-
 
 
 
 
1756
  public function processTransaction(CSV_GetCardTypeResult &$gctrGetCardTypeResult = null, CSV_GetCardTypeOutputData &$gctodGetCardTypeOutputData = null)
1757
  {
1758
  $boTransactionSubmitted = false;
@@ -1795,22 +1866,18 @@
1795
 
1796
  //constructor
1797
  public function __construct(CSV_RequestGatewayEntryPointList $lrgepRequestGatewayEntryPoints = null,
1798
- $nRetryAttempts,
1799
- CSV_NullableInt $nTimeout = null,
1800
- CSV_MerchantAuthentication $maMerchantAuthentication = null,
1801
- $szCardNumber,
1802
- $szPassOutData)
1803
  {
1804
- CSV_GatewayTransaction::__construct($lrgepRequestGatewayEntryPoints, $nRetryAttempts, $nTimeout, $maMerchantAuthentication, $szPassOutData);
1805
 
1806
- $this->m_szCardNumber = $szCardNumber;
1807
  }
1808
  }
1809
 
1810
  abstract class CSV_GatewayTransaction
1811
  {
1812
  private $m_maMerchantAuthentication;
1813
- private $m_szPassOutData;
1814
  private $m_lrgepRequestGatewayEntryPoints;
1815
  private $m_nRetryAttempts;
1816
  private $m_nTimeout;
@@ -1824,27 +1891,18 @@
1824
  {
1825
  return $this->m_maMerchantAuthentication;
1826
  }
1827
-
1828
- public function getPassOutData()
1829
- {
1830
- return $this->m_szPassOutData;
1831
- }
1832
-
1833
  public function getRequestGatewayEntryPoints()
1834
  {
1835
  return $this->m_lrgepRequestGatewayEntryPoints;
1836
  }
1837
-
1838
  public function getRetryAttempts()
1839
  {
1840
  return $this->m_nRetryAttempts;
1841
  }
1842
-
1843
  public function getTimeout()
1844
  {
1845
  return $this->m_nTimeout;
1846
  }
1847
-
1848
  public function getSOAPNamespace()
1849
  {
1850
  return $this->m_szSOAPNamespace;
@@ -1853,17 +1911,14 @@
1853
  {
1854
  $this->m_szSOAPNamespace = $value;
1855
  }
1856
-
1857
  public function getLastRequest()
1858
  {
1859
  return $this->m_szLastRequest;
1860
  }
1861
-
1862
  public function getLastResponse()
1863
  {
1864
  return $this->m_szLastResponse;
1865
  }
1866
-
1867
  public function getLastException()
1868
  {
1869
  return $this->m_eLastException;
@@ -1872,7 +1927,6 @@
1872
  {
1873
  return $this->m_szEntryPointUsed;
1874
  }
1875
-
1876
  public static function compare($x, $y)
1877
  {
1878
  $rgepFirst = null;
@@ -1883,7 +1937,6 @@
1883
 
1884
  return (CSV_GatewayTransaction::compareGatewayEntryPoints($rgepFirst, $rgepSecond));
1885
  }
1886
-
1887
  private static function compareGatewayEntryPoints(CSV_RequestGatewayEntryPoint $rgepFirst, CSV_RequestGatewayEntryPoint $rgepSecond)
1888
  {
1889
  $nReturnValue = 0;
@@ -1924,7 +1977,6 @@
1924
 
1925
  return $nReturnValue;
1926
  }
1927
-
1928
  protected function processTransactionBase(CSV_SOAP $sSOAPClient, $szMessageXMLPath, $szGatewayOutputXMLPath, $szTransactionMessageXMLPath, SimpleXMLElement &$sxXmlDocument = null, CSV_GatewayOutput &$goGatewayOutput = null, CSV_GatewayEntryPointList &$lgepGatewayEntryPoints = null)
1929
  {
1930
  $boTransactionSubmitted = false;
@@ -1943,7 +1995,6 @@
1943
  $szEntryPointURL;
1944
  $nMetric;
1945
  $gepGatewayEntryPoint = null;
1946
- $szPassOutData = null;
1947
  $ResponseDocument = null;
1948
  $ResponseMethod = null;
1949
 
@@ -1969,16 +2020,10 @@
1969
  $sSOAPClient->addParamAttribute($szMessageXMLPath. '.MerchantAuthentication', 'Password', $this->m_maMerchantAuthentication->getPassword());
1970
  }
1971
  }
1972
-
1973
- // populate the passout data
1974
- if (!CSV_SharedFunctions::isStringNullOrEmpty($this->m_szPassOutData))
1975
- {
1976
- $sSOAPClient->addParam($szMessageXMLPath. '.PassOutData', $this->m_szPassOutData, null);
1977
- }
1978
 
1979
  // first need to sort the gateway entry points into the correct usage order
1980
  $number = $this->m_lrgepRequestGatewayEntryPoints->sort('CSV_GatewayTransaction','Compare');
1981
-
1982
  // loop over the overall number of transaction attempts
1983
  while (!$boTransactionSubmitted &&
1984
  $nOverallRetryCount < $this->m_nRetryAttempts)
@@ -1989,7 +2034,7 @@
1989
  while (!$boTransactionSubmitted &&
1990
  $nOverallGatewayEntryPointCount < $this->m_lrgepRequestGatewayEntryPoints->getCount())
1991
  {
1992
-
1993
  $rgepCurrentGatewayEntryPoint = $this->m_lrgepRequestGatewayEntryPoints->getAt($nOverallGatewayEntryPointCount);
1994
 
1995
  // ignore if the metric is "-1" this indicates that the entry point is offline
@@ -2018,7 +2063,7 @@
2018
 
2019
  // the transaction was submitted
2020
  $boTransactionSubmitted = true;
2021
-
2022
  if ($ResponseDocument->$ResponseMethod->$szGatewayOutputXMLPath->Message)
2023
  {
2024
  $szMessage = current($ResponseDocument->$ResponseMethod->$szGatewayOutputXMLPath->Message[0]);
@@ -2030,17 +2075,8 @@
2030
  $lszErrorMessages->add(current($value->Detail));
2031
  }
2032
  }
2033
-
2034
- if ($ResponseDocument->$ResponseMethod->$szGatewayOutputXMLPath->PassOutData)
2035
- {
2036
- $szPassOutData = current($ResponseDocument->$ResponseMethod->$szGatewayOutputXMLPath->PassOutData[0]);
2037
- }
2038
- else
2039
- {
2040
- $szPassOutData = null;
2041
- }
2042
 
2043
- $goGatewayOutput = new CSV_GatewayOutput($nStatusCode, $szMessage, $szPassOutData/*, $boAuthorisationAttempted, $ptdPreviousTransactionResult*/, $lszErrorMessages);
2044
 
2045
  // look to see if there are any gateway entry points
2046
  $nCount = 0;
@@ -2065,7 +2101,7 @@
2065
  }
2066
  }
2067
 
2068
- //$gepGatewayEntryPoint = new GatewayEntryPoint($szEntryPointURL, $nMetric);
2069
  if ($lgepGatewayEntryPoints == null)
2070
  {
2071
  $lgepGatewayEntryPoints = new CSV_GatewayEntryPointList();
@@ -2092,13 +2128,10 @@
2092
  }
2093
 
2094
  public function __construct(CSV_RequestGatewayEntryPointList $lrgepRequestGatewayEntryPoints = null,
2095
- $nRetryAttempts,
2096
- CSV_NullableInt $nTimeout = null,
2097
- CSV_MerchantAuthentication $maMerchantAuthentication = null,
2098
- $szPassOutData)
2099
  {
2100
- $this->m_maMerchantAuthentication = $maMerchantAuthentication;
2101
- $this->m_szPassOutData = $szPassOutData;
2102
  $this->m_lrgepRequestGatewayEntryPoints = $lrgepRequestGatewayEntryPoints;
2103
  $this->m_nRetryAttempts = $nRetryAttempts;
2104
  $this->m_nTimeout = $nTimeout;
@@ -2205,7 +2238,6 @@
2205
  $szPaREQ = null;
2206
  $szACSURL = null;
2207
  }
2208
-
2209
 
2210
  if (!CSV_SharedFunctions::isStringNullOrEmpty($szACSURL) &&
2211
  !CSV_SharedFunctions::isStringNullOrEmpty($szPaREQ))
@@ -2223,7 +2255,9 @@
2223
  {
2224
  $szName = current($sxXmlDocument->TransactionOutputData->CustomVariables->GenericVariable[$nCount]->Name[0]);
2225
  $szValue = current($sxXmlDocument->TransactionOutputData->CustomVariables->GenericVariable[$nCount]->Value[0]);
2226
- $gvGenericVariable = new CSV_GenericVariable($szName, $szValue);
 
 
2227
  $lgvCustomVariables->add($gvGenericVariable);
2228
  }
2229
  }
@@ -2234,16 +2268,16 @@
2234
 
2235
 
2236
  $todTransactionOutputData = new CSV_TransactionOutputData($szCrossReference,
2237
- $szAuthCode,
2238
- $szAddressNumericCheckResult,
2239
- $szPostCodeCheckResult,
2240
- $szThreeDSecureAuthenticationCheckResult,
2241
- $szCV2CheckResult,
2242
- $ctdCardTypeData,
2243
- $nAmountReceived,
2244
- $tdsodThreeDSecureOutputData,
2245
- $lgvCustomVariables,
2246
- $lgepGatewayEntryPoints);
2247
 
2248
  return $todTransactionOutputData;
2249
  }
@@ -2336,9 +2370,7 @@
2336
 
2337
  return ($ctdCardTypeData);
2338
  }
2339
-
2340
-
2341
-
2342
  public static function getPaymentMessageGatewayOutput($GatewayOutput, CSV_GatewayOutput $goGatewayOutput = null)
2343
  {
2344
  $nPreviousStatusCode = null;
@@ -2389,12 +2421,12 @@
2389
  }
2390
 
2391
  $pmgoPaymentMessageGatewayOutput = new CSV_PaymentMessageGatewayOutput($goGatewayOutput->getStatusCode(),
2392
- $goGatewayOutput->getMessage(),
2393
- $goGatewayOutput->getPassOutData(),
2394
- $boAuthorisationAttempted,
2395
- $ptdPreviousTransactionResult,
2396
- $goGatewayOutput->getErrorMessages());
2397
 
2398
  return $pmgoPaymentMessageGatewayOutput;
2399
  }
2400
  }
 
52
 
53
  public function add($EntryPointURL, $nMetric, $nRetryAttempts)
54
  {
55
+ array_push($this->m_lrgepRequestGatewayEntryPoint, new CSV_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 CSV_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 CSV_BillingAddress();
207
+ $this->m_szEmailAddress = "";
208
+ $this->m_szPhoneNumber = "";
209
+ $this->m_szCustomerIPAddress = "";
210
  }
211
  }
212
 
213
+ class CSV_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 CSV_NullableInt();
296
  }
297
  }
298
 
311
  }
312
 
313
  //constructor
314
+ public function __construct()
315
  {
316
+ $this->m_nMonth = new CSV_NullableInt();
317
+ $this->m_nYear = new CSV_NullableInt();
318
  }
319
  }
320
 
321
  class CSV_ExpiryDate extends CSV_CreditCardDate
322
  {
323
+ public function __construct()
324
  {
325
+ parent::__construct();
326
  }
327
  }
328
 
329
  class CSV_StartDate extends CSV_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 CSV_ExpiryDate();
393
+ $this->m_sdStartDate = new CSV_StartDate();
394
+ $this->m_szIssueNumber = "";
395
+ $this->m_szCV2 = "";
396
  }
397
  }
398
 
399
  class CSV_OverrideCardDetails extends CSV_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 CSV_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 CSV_MessageDetails();
524
+ $this->m_nAmount = new CSV_NullableInt();
525
+ $this->m_nCurrencyCode = new CSV_NullableInt();
526
+ $this->m_szOrderID = "";
527
+ $this->m_szOrderDescription = "";
528
+ $this->m_tcTransactionControl = new CSV_TransactionControl();
529
+ $this->m_tdsbdThreeDSecureBrowserDetails = new CSV_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 CSV_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 CSV_NullableBool();
644
+ $this->m_boEchoAVSCheckResult = new CSV_NullableBool();
645
+ $this->m_boEchoCV2CheckResult = new CSV_NullableBool;
646
+ $this->m_boEchoAmountReceived = new CSV_NullableBool;
647
+ $this->m_nDuplicateDelay = new CSV_NullableInt;
648
+ $this->m_szAVSOverridePolicy = "";
649
+ $this->m_szCV2OverridePolicy = "";
650
+ $this->m_boThreeDSecureOverridePolicy = new CSV_NullableBool();
651
+ $this->m_szAuthCode = "";
652
+ $this->m_tdsptThreeDSecurePassthroughData = new CSV_ThreeDSecurePassthroughData();
653
+ $this->m_lgvCustomVariables = new CSV_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 CSV_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, CSV_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, CSV_NullableBool $boAuthorisationAttempted = null, CSV_PreviousTransactionResult $ptdPreviousTransactionResult = null, CSV_StringList $lszErrorMessages = null)
941
  {
942
+ parent::__construct($nStatusCode, $szMessage, $lszErrorMessages);
943
  $this->m_boAuthorisationAttempted = $boAuthorisationAttempted;
944
  $this->m_ptdPreviousTransactionResult = $ptdPreviousTransactionResult;
945
  }
947
 
948
  class CSV_CardDetailsTransactionResult extends CSV_PaymentMessageGatewayOutput
949
  {
950
+ public function __construct($nStatusCode, $szMessage, CSV_NullableBool $boAuthorisationAttempted = null, CSV_PreviousTransactionResult $ptdPreviousTransactionResult = null, CSV_StringList $lszErrorMessages = null)
951
  {
952
+ parent::__construct($nStatusCode, $szMessage, $boAuthorisationAttempted, $ptdPreviousTransactionResult, $lszErrorMessages);
953
  }
954
  }
955
  class CSV_CrossReferenceTransactionResult extends CSV_PaymentMessageGatewayOutput
956
  {
957
+ public function __construct($nStatusCode, $szMessage, CSV_NullableBool $boAuthorisationAttempted = null, CSV_PreviousTransactionResult $ptdPreviousTransactionResult = null, CSV_StringList $lszErrorMessages = null)
958
  {
959
+ parent::__construct($nStatusCode, $szMessage, $boAuthorisationAttempted, $ptdPreviousTransactionResult, $lszErrorMessages);
960
  }
961
  }
962
  class CSV_ThreeDSecureTransactionResult extends CSV_PaymentMessageGatewayOutput
963
  {
964
+ public function __construct($nStatusCode, $szMessage, CSV_NullableBool $boAuthorisationAttempted = null, CSV_PreviousTransactionResult $ptdPreviousTransactionResult = null, CSV_StringList $lszErrorMessages = null)
965
  {
966
+ parent::__construct($nStatusCode, $szMessage, $boAuthorisationAttempted, $ptdPreviousTransactionResult, $lszErrorMessages);
967
  }
968
  }
969
  class CSV_GetGatewayEntryPointsResult extends CSV_GatewayOutput
970
  {
971
+ public function __construct($nStatusCode, $szMessage, CSV_StringList $lszErrorMessages = null)
972
  {
973
+ parent::__construct($nStatusCode, $szMessage, $lszErrorMessages);
974
  }
975
  }
976
  class CSV_GetCardTypeResult extends CSV_GatewayOutput
977
  {
978
+ public function __construct($nStatusCode, $szMessage, CSV_StringList $lszErrorMessages = null)
979
  {
980
+ parent::__construct($nStatusCode, $szMessage, $lszErrorMessages);
981
  }
982
  }
983
 
1007
  class CSV_GetGatewayEntryPointsOutputData extends CSV_BaseOutputData
1008
  {
1009
  //constructor
1010
+ function __construct(GatewayEntryPointList $lgepGatewayEntryPoints = null)
1011
  {
1012
  parent::__construct($lgepGatewayEntryPoints);
1013
  }
1171
 
1172
  //constructor
1173
  public function __construct(CSV_RequestGatewayEntryPointList $lrgepRequestGatewayEntryPoints = null,
1174
+ $nRetryAttempts = 1,
1175
+ CSV_NullableInt $nTimeout = null)
 
 
1176
  {
1177
  if ($nRetryAttempts == null &&
1178
  $nTimeout == null)
1179
  {
1180
+ CSV_GatewayTransaction::__construct($lrgepRequestGatewayEntryPoints, 1, null);
1181
  }
1182
  else
1183
  {
1184
+ CSV_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(CSV_CardDetailsTransactionResult &$cdtrCardDetailsTransactionResult = null, CSV_TransactionOutputData &$todTransactionOutputData = null)
1218
  $cdtrCardDetailsTransactionResult = null;
1219
 
1220
  $sSOAPClient = new CSV_SOAP('CardDetailsTransaction', parent::getSOAPNamespace());
1221
+
1222
  // transaction details
1223
  if ($this->m_tdTransactionDetails != null)
1224
  {
1237
  $sSOAPClient->addParamAttribute('PaymentMessage.TransactionDetails', 'CurrencyCode', (string)$this->m_tdTransactionDetails->getCurrencyCode()->getValue());
1238
  }
1239
  }
 
1240
  if ($this->m_tdTransactionDetails->getMessageDetails() != null)
1241
  {
1242
  if (!CSV_SharedFunctions::isStringNullOrEmpty($this->m_tdTransactionDetails->getMessageDetails()->getTransactionType()))
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', CSV_SharedFunctions::boolToString($this->m_tdTransactionDetails->getTransactionControl()->getThreeDSecureOverridePolicy()->getValue()));
1258
+ }
1259
  }
1260
  if (!CSV_SharedFunctions::isStringNullOrEmpty($this->m_tdTransactionDetails->getTransactionControl()->getAVSOverridePolicy()))
1261
  {
1331
  }
1332
  }
1333
  }
 
1334
  if ($this->m_tdTransactionDetails->getThreeDSecureBrowserDetails() != null)
1335
  {
1336
  if (!CSV_SharedFunctions::isStringNullOrEmpty($this->m_tdTransactionDetails->getThreeDSecureBrowserDetails()->getAcceptHeaders()))
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
  {
1480
  }
1481
 
1482
  public function __construct(CSV_RequestGatewayEntryPointList $lrgepRequestGatewayEntryPoints = null,
1483
+ $nRetryAttempts = 1,
1484
+ CSV_NullableInt $nTimeout = null)
 
 
 
 
 
1485
  {
1486
+ parent::__construct($lrgepRequestGatewayEntryPoints, $nRetryAttempts, $nTimeout);
1487
 
1488
+ $this->m_tdTransactionDetails = new CSV_TransactionDetails();
1489
+ $this->m_cdCardDetails = new CSV_CardDetails();
1490
+ $this->m_cdCustomerDetails = new CSV_CustomerDetails();
1491
  }
1492
 
1493
  }
1745
 
1746
  //constructor
1747
  public function __construct(CSV_RequestGatewayEntryPointList $lrgepRequestGatewayEntryPoints = null,
1748
+ $nRetryAttempts = 1,
1749
+ CSV_NullableInt $nTimeout = null)
1750
+ {
1751
+ CSV_GatewayTransaction::__construct($lrgepRequestGatewayEntryPoints, $nRetryAttempts, $nTimeout);
 
 
 
 
 
1752
 
1753
+ $this->m_tdTransactionDetails = new CSV_TransactionDetails();
1754
+ $this->m_ocdOverrideCardDetails = new CSV_OverrideCardDetails();
1755
+ $this->m_cdCustomerDetails = new CSV_CustomerDetails();
1756
  }
1757
  }
1758
 
1802
 
1803
  //constructor
1804
  public function __construct(CSV_RequestGatewayEntryPointList $lrgepRequestGatewayEntryPoints = null,
1805
+ $nRetryAttempts = 1,
1806
+ CSV_NullableInt $nTimeout = null)
 
 
 
1807
  {
1808
+ CSV_GatewayTransaction::__construct($lrgepRequestGatewayEntryPoints, $nRetryAttempts, $nTimeout);
1809
 
1810
+ $this->m_tdsidThreeDSecureInputData = new CSV_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(CSV_GetCardTypeResult &$gctrGetCardTypeResult = null, CSV_GetCardTypeOutputData &$gctodGetCardTypeOutputData = null)
1828
  {
1829
  $boTransactionSubmitted = false;
1866
 
1867
  //constructor
1868
  public function __construct(CSV_RequestGatewayEntryPointList $lrgepRequestGatewayEntryPoints = null,
1869
+ $nRetryAttempts = 1,
1870
+ CSV_NullableInt $nTimeout = null)
 
 
 
1871
  {
1872
+ CSV_GatewayTransaction::__construct($lrgepRequestGatewayEntryPoints, $nRetryAttempts, $nTimeout);
1873
 
1874
+ $this->m_szCardNumber = "";
1875
  }
1876
  }
1877
 
1878
  abstract class CSV_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 (CSV_GatewayTransaction::compareGatewayEntryPoints($rgepFirst, $rgepSecond));
1939
  }
 
1940
  private static function compareGatewayEntryPoints(CSV_RequestGatewayEntryPoint $rgepFirst, CSV_RequestGatewayEntryPoint $rgepSecond)
1941
  {
1942
  $nReturnValue = 0;
1977
 
1978
  return $nReturnValue;
1979
  }
 
1980
  protected function processTransactionBase(CSV_SOAP $sSOAPClient, $szMessageXMLPath, $szGatewayOutputXMLPath, $szTransactionMessageXMLPath, SimpleXMLElement &$sxXmlDocument = null, CSV_GatewayOutput &$goGatewayOutput = null, CSV_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('CSV_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 CSV_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 CSV_GatewayEntryPoint($szEntryPointURL, $nMetric);
2105
  if ($lgepGatewayEntryPoints == null)
2106
  {
2107
  $lgepGatewayEntryPoints = new CSV_GatewayEntryPointList();
2128
  }
2129
 
2130
  public function __construct(CSV_RequestGatewayEntryPointList $lrgepRequestGatewayEntryPoints = null,
2131
+ $nRetryAttempts = 1,
2132
+ CSV_NullableInt $nTimeout = null)
 
 
2133
  {
2134
+ $this->m_maMerchantAuthentication = new CSV_MerchantAuthentication();
 
2135
  $this->m_lrgepRequestGatewayEntryPoints = $lrgepRequestGatewayEntryPoints;
2136
  $this->m_nRetryAttempts = $nRetryAttempts;
2137
  $this->m_nTimeout = $nTimeout;
2238
  $szPaREQ = null;
2239
  $szACSURL = null;
2240
  }
 
2241
 
2242
  if (!CSV_SharedFunctions::isStringNullOrEmpty($szACSURL) &&
2243
  !CSV_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 CSV_GenericVariable();
2259
+ $gvGenericVariable->setName($szName);
2260
+ $gvGenericVariable->setValue($szValue);
2261
  $lgvCustomVariables->add($gvGenericVariable);
2262
  }
2263
  }
2268
 
2269
 
2270
  $todTransactionOutputData = new CSV_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, CSV_GatewayOutput $goGatewayOutput = null)
2375
  {
2376
  $nPreviousStatusCode = null;
2421
  }
2422
 
2423
  $pmgoPaymentMessageGatewayOutput = new CSV_PaymentMessageGatewayOutput($goGatewayOutput->getStatusCode(),
2424
+ $goGatewayOutput->getMessage(),
2425
+ $boAuthorisationAttempted,
2426
+ $ptdPreviousTransactionResult,
2427
+ $goGatewayOutput->getErrorMessages());
 
2428
 
2429
  return $pmgoPaymentMessageGatewayOutput;
2430
  }
2431
  }
2432
+ ?>
app/code/local/Cardsave/Cardsaveonlinepayments/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;
@@ -128,7 +128,7 @@
128
  }
129
 
130
  $this->m_szName = $szName;
131
- //$this->m_szValue = SharedFunctions::replaceCharsInStringWithEntities($szValue);
132
  $this->setValue($szValue);
133
 
134
  $this->m_lspSOAPParamList = new CSV_SOAPParamList();
@@ -441,7 +441,7 @@
441
  }
442
  public function getLastException()
443
  {
444
- return $this->m_eLastException;
445
  }
446
 
447
  public function buildPacket()
@@ -566,7 +566,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 +594,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 +606,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 +782,7 @@
771
  //$this->addParam1($args[0], $args[1], $args[3]);
772
  $this->addParam1($args[0], $args[1], null);
773
  }
774
- elseif ($args[0] instanceof CSV_SOAPParameter &&
775
  is_bool($args[1]))
776
  {
777
  //$this->__call('addParam2', $args);
@@ -966,3 +977,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;
128
  }
129
 
130
  $this->m_szName = $szName;
131
+ //$this->m_szValue = CSV_SharedFunctions::replaceCharsInStringWithEntities($szValue);
132
  $this->setValue($szValue);
133
 
134
  $this->m_lspSOAPParamList = new CSV_SOAPParamList();
441
  }
442
  public function getLastException()
443
  {
444
+ $this->m_eLastException;
445
  }
446
 
447
  public function buildPacket()
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
  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
  $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:Body>", '" "', $szString);
613
+ $szString = str_replace("</soap:Body>", '" "', $szString);
614
+
615
+ if($errorNo != 0)
616
+ {
617
+ throw new Exception($errorMsg);
618
+ }
619
+
620
  $XmlDoc = new SimpleXMLElement($szString);
621
+ $ResponseDocument = $XmlDoc;
622
  $ResponseMethod = $this->getMethod(). 'Response';
623
 
624
+ // try see if the Xml was parsed correctly
625
+ if (!isset($ResponseDocument->$ResponseMethod))
626
+ {
627
+ throw new Exception("Couldn't parse response from server as valid Xml");
628
+ }
629
+
630
  $boReturnValue = true;
631
  }
632
  catch (Exception $exc)
633
  {
634
  $boReturnValue = false;
635
+ $this->m_eLastException = $exc->getMessage();
636
  }
637
+
638
  return $boReturnValue;
639
  }
640
 
782
  //$this->addParam1($args[0], $args[1], $args[3]);
783
  $this->addParam1($args[0], $args[1], null);
784
  }
785
+ elseif ($args[0] instanceof SOAPParameter &&
786
  is_bool($args[1]))
787
  {
788
  //$this->__call('addParam2', $args);
977
  return $spReturnParam;
978
  }
979
  }
980
+ ?>
app/code/local/Cardsave/Cardsaveonlinepayments/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
  CSV_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
  CSV_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, CSV_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, CSV_ISOCurrency &$icISOCurrency = null)
286
  {
287
  $boFound = false;
288
  $nCount = 0;
289
  $icISOCurrency2;
290
-
291
  $icISOCurrency = null;
292
 
293
  while (!$boFound &&
@@ -880,3 +900,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
  CSV_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
  CSV_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 &&
900
  }
901
  }
902
  }
903
+ ?>
app/code/local/Cardsave/Cardsaveonlinepayments/Model/Direct.php CHANGED
@@ -191,9 +191,10 @@ class Cardsave_Cardsaveonlinepayments_Model_Direct extends Mage_Payment_Model_Me
191
  $SecretKey = $this->getConfigData('secretkey');
192
  // assign payment form field values to variables
193
  $order = $payment->getOrder();
194
- $szOrderID = $payment->getOrder()->increment_id;
 
195
  $szOrderDescription = '';
196
- $szCardName = $payment->getCcOwner();
197
  $szCardNumber = $payment->getCcNumber();
198
  $szIssueNumber = $payment->getCcSsIssue();
199
  $szCV2 = $payment->getCcCid();
@@ -201,110 +202,101 @@ class Cardsave_Cardsaveonlinepayments_Model_Direct extends Mage_Payment_Model_Me
201
  $szCurrencyShort = $order->getOrderCurrency()->getCurrencyCode();
202
  // address details
203
  $billingAddress = $order->getBillingAddress();
204
- $szAddress1 = $billingAddress->getStreet1();
205
- $szAddress2 = $billingAddress->getStreet2();
206
- $szAddress3 = $billingAddress->getStreet3();
207
- $szAddress4 = $billingAddress->getStreet4();
208
- $szCity = $billingAddress->getCity();
209
- $szState = $billingAddress->getRegion();
210
- $szPostCode = $billingAddress->getPostcode();
211
  $szISO2CountryCode = $billingAddress->getCountry();
212
  $nCountryCode;
213
  $szEmailAddress = $billingAddress->getCustomerEmail();
214
- $szPhoneNumber = $billingAddress->getTelephone();
215
  $nDecimalAmount;
216
 
217
  $PaymentProcessorFullDomain = $this->_getPaymentProcessorFullDomain();
 
 
218
 
219
  $rgeplRequestGatewayEntryPointList = new CSV_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 CSV_MerchantAuthentication($MerchantID, $Password);
225
-
226
- $mdMessageDetails = new CSV_MessageDetails("SALE");
 
 
 
227
 
228
- $boEchoCardType = new CSV_NullableBool(true);
229
- $boEchoAmountReceived = new CSV_NullableBool(true);
230
- $boEchoAVSCheckResult = new CSV_NullableBool(true);
231
- $boEchoCV2CheckResult = new CSV_NullableBool(true);
232
- $boThreeDSecureOverridePolicy = new CSV_NullableBool(true);
233
- $nDuplicateDelay = new CSV_NullableInt(60);
234
- $tcTransactionControl = new CSV_TransactionControl($boEchoCardType, $boEchoAVSCheckResult, $boEchoCV2CheckResult, $boEchoAmountReceived, $nDuplicateDelay, "", "", $boThreeDSecureOverridePolicy, "", null, null);
235
-
236
- $iclISOCurrencyList = CSV_ISOCurrencies::getISOCurrencyList();
237
-
238
  if ($szCurrencyShort != '' &&
239
  $iclISOCurrencyList->getISOCurrency($szCurrencyShort, $icISOCurrency))
240
  {
241
  $nCurrencyCode = new CSV_NullableInt($icISOCurrency->getISOCode());
 
242
  }
243
 
244
  $power = pow(10, $icISOCurrency->getExponent());
245
  $nDecimalAmount = $amount * $power;
246
- $nAmount = new CSV_NullableInt($nDecimalAmount);
247
-
248
- $nDeviceCategory = new CSV_NullableInt(0);
249
- $tdsbdThreeDSecureBrowserDetails = new CSV_ThreeDSecureBrowserDetails($nDeviceCategory, "*/*", $_SERVER["HTTP_USER_AGENT"]);;
250
- $tdTransactionDetails = new CSV_TransactionDetails($mdMessageDetails, $nAmount, $nCurrencyCode, $szOrderID, $szOrderDescription, $tcTransactionControl, $tdsbdThreeDSecureBrowserDetails);
251
-
252
- $nExpiryDateMonth = null;
253
- if($payment->getCcExpMonth() != '')
 
 
 
 
 
 
 
 
 
 
 
 
 
254
  {
255
- $nExpiryDateMonth = new CSV_NullableInt($payment->getCcExpMonth());
256
  }
257
-
258
- $nExpiryDateYear = null;
259
- if($payment->getCcExpYear() != '')
260
  {
261
- $nExpiryDateYear = new CSV_NullableInt($payment->getCcExpYear());
262
  }
263
-
264
- $nStartDateMonth = null;
265
- if($payment->getCcSsStartMonth() != '')
266
  {
267
- $nStartDateMonth = new CSV_NullableInt($payment->getCcSsStartMonth());
268
  }
269
-
270
- $nStartDateYear = null;
271
- if($payment->getCcSsStartYear() != '')
272
  {
273
- $nStartDateYear = new CSV_NullableInt($payment->getCcSsStartYear());
274
  }
275
-
276
- $edExpiryDate = new CSV_ExpiryDate($nExpiryDateMonth, $nExpiryDateYear);
277
- $sdStartDate = new CSV_StartDate($nStartDateMonth, $nStartDateYear);
278
- $cdCardDetails = new CSV_CardDetails($szCardName, $szCardNumber, $edExpiryDate, $sdStartDate, $szIssueNumber, $szCV2);
279
-
280
- $nCountryCode = null;
281
- $iclISOCountryList = CSV_ISOCountries::getISOCountryList();
 
 
 
 
 
282
  $szCountryShort = $this->_getISO3Code($szISO2CountryCode);
283
- if($iclISOCountryList->getISOCountry($szCountryShort, $icISOCountry))
284
  {
285
- $nCountryCode = new CSV_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 CSV_AddressDetails($szAddress1, $szAddress2, $szAddress3, $szAddress4, $szCity, $szState, $szPostCode, $nCountryCode);
306
- $cdCustomerDetails = new CSV_CustomerDetails($adBillingAddress, $szEmailAddress, $szPhoneNumber, $_SERVER["REMOTE_ADDR"]);
307
- $cdtCardDetailsTransaction = new CSV_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)
@@ -332,6 +324,7 @@ class Cardsave_Cardsaveonlinepayments_Model_Direct extends Mage_Payment_Model_Me
332
  // status code of 0 - means transaction successful
333
  $szLogMessage = "Transaction successfully completed for OrderID: ".$szOrderID.". Result object details: ";
334
  Mage::getSingleton('core/session')->addSuccess($szNotificationMessage);
 
335
  break;
336
  case 3:
337
  // status code of 3 - means 3D Secure authentication required
@@ -715,15 +708,19 @@ class Cardsave_Cardsaveonlinepayments_Model_Direct extends Mage_Payment_Model_Me
715
  $SecretKey = $this->getConfigData('secretkey');
716
 
717
  $PaymentProcessorFullDomain = $this->_getPaymentProcessorFullDomain();
 
718
  $rgeplRequestGatewayEntryPointList = new CSV_RequestGatewayEntryPointList();
719
  $rgeplRequestGatewayEntryPointList->add("https://gw1.".$PaymentProcessorFullDomain, 100, 2);
720
  $rgeplRequestGatewayEntryPointList->add("https://gw2.".$PaymentProcessorFullDomain, 200, 2);
721
  $rgeplRequestGatewayEntryPointList->add("https://gw3.".$PaymentProcessorFullDomain, 300, 2);
722
-
723
- $maMerchantAuthentication = new CSV_MerchantAuthentication($MerchantID, $Password);
724
- $tdsidThreeDSecureInputData = new CSV_ThreeDSecureInputData($szMD, $szPaRes);
725
 
726
- $tdsaThreeDSecureAuthentication = new CSV_ThreeDSecureAuthentication($rgeplRequestGatewayEntryPointList, 1, null, $maMerchantAuthentication, $tdsidThreeDSecureInputData, "Some data to be passed out");
 
 
 
 
 
 
727
  $boTransactionProcessed = $tdsaThreeDSecureAuthentication->processTransaction($tdsarThreeDSecureAuthenticationResult, $todTransactionOutputData);
728
 
729
  if ($boTransactionProcessed == false)
191
  $SecretKey = $this->getConfigData('secretkey');
192
  // assign payment form field values to variables
193
  $order = $payment->getOrder();
194
+ // escape the special characters as the PHP integration doesn't do it (ie: & ampersand)
195
+ $szOrderID = htmlentities($payment->getOrder()->increment_id);
196
  $szOrderDescription = '';
197
+ $szCardName = htmlentities($payment->getCcOwner());
198
  $szCardNumber = $payment->getCcNumber();
199
  $szIssueNumber = $payment->getCcSsIssue();
200
  $szCV2 = $payment->getCcCid();
202
  $szCurrencyShort = $order->getOrderCurrency()->getCurrencyCode();
203
  // address details
204
  $billingAddress = $order->getBillingAddress();
205
+ $szAddress1 = htmlentities($billingAddress->getStreet1());
206
+ $szAddress2 = htmlentities($billingAddress->getStreet2());
207
+ $szAddress3 = htmlentities($billingAddress->getStreet3());
208
+ $szAddress4 = htmlentities($billingAddress->getStreet4());
209
+ $szCity = htmlentities($billingAddress->getCity());
210
+ $szState = htmlentities($billingAddress->getRegion());
211
+ $szPostCode = htmlentities($billingAddress->getPostcode());
212
  $szISO2CountryCode = $billingAddress->getCountry();
213
  $nCountryCode;
214
  $szEmailAddress = $billingAddress->getCustomerEmail();
215
+ $szPhoneNumber = htmlentities($billingAddress->getTelephone());
216
  $nDecimalAmount;
217
 
218
  $PaymentProcessorFullDomain = $this->_getPaymentProcessorFullDomain();
219
+ $iclISOCurrencyList = CSV_ISOCurrencies::getISOCurrencyList();
220
+ $iclISOCountryList = CSV_ISOCountries::getISOCountryList();
221
 
222
  $rgeplRequestGatewayEntryPointList = new CSV_RequestGatewayEntryPointList();
223
  $rgeplRequestGatewayEntryPointList->add("https://gw1.".$PaymentProcessorFullDomain, 100, 2);
224
  $rgeplRequestGatewayEntryPointList->add("https://gw2.".$PaymentProcessorFullDomain, 200, 2);
225
  $rgeplRequestGatewayEntryPointList->add("https://gw3.".$PaymentProcessorFullDomain, 300, 2);
226
 
227
+ $cdtCardDetailsTransaction = new CSV_CardDetailsTransaction($rgeplRequestGatewayEntryPointList);
228
+
229
+ $cdtCardDetailsTransaction->getMerchantAuthentication()->setMerchantID($MerchantID);
230
+ $cdtCardDetailsTransaction->getMerchantAuthentication()->setPassword($Password);
231
+
232
+ $cdtCardDetailsTransaction->getTransactionDetails()->getMessageDetails()->setTransactionType("SALE");
233
 
 
 
 
 
 
 
 
 
 
 
234
  if ($szCurrencyShort != '' &&
235
  $iclISOCurrencyList->getISOCurrency($szCurrencyShort, $icISOCurrency))
236
  {
237
  $nCurrencyCode = new CSV_NullableInt($icISOCurrency->getISOCode());
238
+ $cdtCardDetailsTransaction->getTransactionDetails()->getCurrencyCode()->setValue($icISOCurrency->getISOCode());
239
  }
240
 
241
  $power = pow(10, $icISOCurrency->getExponent());
242
  $nDecimalAmount = $amount * $power;
243
+ //$nAmount = new CSV_NullableInt($nDecimalAmount);
244
+ $cdtCardDetailsTransaction->getTransactionDetails()->getAmount()->setValue($nDecimalAmount);
245
+
246
+ $cdtCardDetailsTransaction->getTransactionDetails()->setOrderID($szOrderID);
247
+ $cdtCardDetailsTransaction->getTransactionDetails()->setOrderDescription($szOrderDescription);
248
+
249
+ $cdtCardDetailsTransaction->getTransactionDetails()->getTransactionControl()->getEchoCardType()->setValue(true);
250
+ $cdtCardDetailsTransaction->getTransactionDetails()->getTransactionControl()->getEchoAmountReceived()->setValue(true);
251
+ $cdtCardDetailsTransaction->getTransactionDetails()->getTransactionControl()->getEchoAVSCheckResult()->setValue(true);
252
+ $cdtCardDetailsTransaction->getTransactionDetails()->getTransactionControl()->getEchoCV2CheckResult()->setValue(true);
253
+ $cdtCardDetailsTransaction->getTransactionDetails()->getTransactionControl()->getThreeDSecureOverridePolicy()->setValue(true);
254
+ $cdtCardDetailsTransaction->getTransactionDetails()->getTransactionControl()->getDuplicateDelay()->setValue(60);
255
+
256
+ $cdtCardDetailsTransaction->getTransactionDetails()->getThreeDSecureBrowserDetails()->getDeviceCategory()->setValue(0);
257
+ $cdtCardDetailsTransaction->getTransactionDetails()->getThreeDSecureBrowserDetails()->setAcceptHeaders("*/*");
258
+ $cdtCardDetailsTransaction->getTransactionDetails()->getThreeDSecureBrowserDetails()->setUserAgent($_SERVER["HTTP_USER_AGENT"]);
259
+
260
+ $cdtCardDetailsTransaction->getCardDetails()->setCardName($szCardName);
261
+ $cdtCardDetailsTransaction->getCardDetails()->setCardNumber($szCardNumber);
262
+
263
+ if ($payment->getCcExpMonth() != "")
264
  {
265
+ $cdtCardDetailsTransaction->getCardDetails()->getExpiryDate()->getMonth()->setValue($payment->getCcExpMonth());
266
  }
267
+ if ($payment->getCcExpYear() != "")
 
 
268
  {
269
+ $cdtCardDetailsTransaction->getCardDetails()->getExpiryDate()->getYear()->setValue($payment->getCcExpYear());
270
  }
271
+ if ($payment->getCcSsStartMonth() != "")
 
 
272
  {
273
+ $cdtCardDetailsTransaction->getCardDetails()->getStartDate()->getMonth()->setValue($payment->getCcSsStartMonth());
274
  }
275
+ if ($payment->getCcSsStartYear() != "")
 
 
276
  {
277
+ $cdtCardDetailsTransaction->getCardDetails()->getStartDate()->getYear()->setValue($payment->getCcSsStartYear());
278
  }
279
+
280
+ $cdtCardDetailsTransaction->getCardDetails()->setIssueNumber($szIssueNumber);
281
+ $cdtCardDetailsTransaction->getCardDetails()->setCV2($szCV2);
282
+
283
+ $cdtCardDetailsTransaction->getCustomerDetails()->getBillingAddress()->setAddress1($szAddress1);
284
+ $cdtCardDetailsTransaction->getCustomerDetails()->getBillingAddress()->setAddress2($szAddress2);
285
+ $cdtCardDetailsTransaction->getCustomerDetails()->getBillingAddress()->setAddress3($szAddress3);
286
+ $cdtCardDetailsTransaction->getCustomerDetails()->getBillingAddress()->setAddress4($szAddress4);
287
+ $cdtCardDetailsTransaction->getCustomerDetails()->getBillingAddress()->setCity($szCity);
288
+ $cdtCardDetailsTransaction->getCustomerDetails()->getBillingAddress()->setState($szState);
289
+ $cdtCardDetailsTransaction->getCustomerDetails()->getBillingAddress()->setPostCode($szPostCode);
290
+
291
  $szCountryShort = $this->_getISO3Code($szISO2CountryCode);
292
+ if ($iclISOCountryList->getISOCountry($szCountryShort, $icISOCountry))
293
  {
294
+ $cdtCardDetailsTransaction->getCustomerDetails()->getBillingAddress()->getCountryCode()->setValue($icISOCountry->getISOCode());
295
  }
296
+
297
+ $cdtCardDetailsTransaction->getCustomerDetails()->setEmailAddress($szEmailAddress);
298
+ $cdtCardDetailsTransaction->getCustomerDetails()->setPhoneNumber($szPhoneNumber);
299
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
300
  $boTransactionProcessed = $cdtCardDetailsTransaction->processTransaction($cdtrCardDetailsTransactionResult, $todTransactionOutputData);
301
 
302
  if ($boTransactionProcessed == false)
324
  // status code of 0 - means transaction successful
325
  $szLogMessage = "Transaction successfully completed for OrderID: ".$szOrderID.". Result object details: ";
326
  Mage::getSingleton('core/session')->addSuccess($szNotificationMessage);
327
+ Mage::getSingleton('checkout/session')->addSuccess($szNotificationMessage);
328
  break;
329
  case 3:
330
  // status code of 3 - means 3D Secure authentication required
708
  $SecretKey = $this->getConfigData('secretkey');
709
 
710
  $PaymentProcessorFullDomain = $this->_getPaymentProcessorFullDomain();
711
+
712
  $rgeplRequestGatewayEntryPointList = new CSV_RequestGatewayEntryPointList();
713
  $rgeplRequestGatewayEntryPointList->add("https://gw1.".$PaymentProcessorFullDomain, 100, 2);
714
  $rgeplRequestGatewayEntryPointList->add("https://gw2.".$PaymentProcessorFullDomain, 200, 2);
715
  $rgeplRequestGatewayEntryPointList->add("https://gw3.".$PaymentProcessorFullDomain, 300, 2);
 
 
 
716
 
717
+ $tdsaThreeDSecureAuthentication = new CSV_ThreeDSecureAuthentication($rgeplRequestGatewayEntryPointList);
718
+ $tdsaThreeDSecureAuthentication->getMerchantAuthentication()->setMerchantID($MerchantID);
719
+ $tdsaThreeDSecureAuthentication->getMerchantAuthentication()->setPassword($Password);
720
+
721
+ $tdsaThreeDSecureAuthentication->getThreeDSecureInputData()->setCrossReference($szMD);
722
+ $tdsaThreeDSecureAuthentication->getThreeDSecureInputData()->setPaRES($szPaRes);
723
+
724
  $boTransactionProcessed = $tdsaThreeDSecureAuthentication->processTransaction($tdsarThreeDSecureAuthenticationResult, $todTransactionOutputData);
725
 
726
  if ($boTransactionProcessed == false)
app/code/local/Cardsave/Cardsaveonlinepayments/controllers/PaymentController.php CHANGED
@@ -92,14 +92,34 @@ class Cardsave_Cardsaveonlinepayments_PaymentController extends Mage_Core_Contro
92
  $session = Mage::getSingleton('checkout/session');
93
  $szPaymentProcessorResponse = '';
94
  $nVersion = Mage::getModel('cardsaveonlinepayments/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 Cardsave_Cardsaveonlinepayments_PaymentController extends Mage_Core_Contro
116
  $szMessage = Cardsave_Cardsaveonlinepayments_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 Cardsave_Cardsaveonlinepayments_PaymentController extends Mage_Core_Contro
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
  }
@@ -198,6 +218,7 @@ class Cardsave_Cardsaveonlinepayments_PaymentController extends Mage_Core_Contro
198
  $order = Mage::getModel('sales/order');
199
  $order->load(Mage::getSingleton('checkout/session')->getLastOrderId());
200
  $nVersion = Mage::getModel('cardsaveonlinepayments/direct')->getVersion();
 
201
 
202
  try
203
  {
@@ -236,13 +257,35 @@ class Cardsave_Cardsaveonlinepayments_PaymentController extends Mage_Core_Contro
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)
@@ -292,25 +335,29 @@ class Cardsave_Cardsaveonlinepayments_PaymentController extends Mage_Core_Contro
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
  }
@@ -696,6 +743,7 @@ class Cardsave_Cardsaveonlinepayments_PaymentController extends Mage_Core_Contro
696
  $order = Mage::getModel('sales/order');
697
  $order->load(Mage::getSingleton('checkout/session')->getLastOrderId());
698
  $nVersion = Mage::getModel('cardsaveonlinepayments/direct')->getVersion();
 
699
 
700
  try
701
  {
@@ -729,13 +777,35 @@ class Cardsave_Cardsaveonlinepayments_PaymentController extends Mage_Core_Contro
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 Cardsave_Cardsaveonlinepayments_PaymentController extends Mage_Core_Contro
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,17 +835,19 @@ class Cardsave_Cardsaveonlinepayments_PaymentController extends Mage_Core_Contro
765
  $order->setCustomerNote(Mage::helper('cardsaveonlinepayments')->__('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
  }
@@ -783,25 +855,30 @@ class Cardsave_Cardsaveonlinepayments_PaymentController extends Mage_Core_Contro
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
  }
@@ -891,8 +968,9 @@ class Cardsave_Cardsaveonlinepayments_PaymentController extends Mage_Core_Contro
891
  ->setPreviousstatuscode(null)
892
  ->setPreviousmessage(null)
893
  ->setOrderid(null)
894
- ->setRedirectedpayment(null)
895
- ->setCardsaveonlinepaymentsOrderId(null);
 
896
  }
897
 
898
  /**
@@ -915,4 +993,37 @@ class Cardsave_Cardsaveonlinepayments_PaymentController extends Mage_Core_Contro
915
  $order->setState($status, 'csv_paid', $message, false);
916
  $order->save();
917
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
918
  }
92
  $session = Mage::getSingleton('checkout/session');
93
  $szPaymentProcessorResponse = '';
94
  $nVersion = Mage::getModel('cardsaveonlinepayments/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
+ $cardsaveOrderId = Mage::getSingleton('checkout/session')->getCardsaveonlinepaymentsOrderId();
106
+ $szOrderStatus = $order->getStatus();
107
+
108
+ if($szOrderStatus != 'csv_paid')
109
+ //if($cardsaveOrderId)
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 = Cardsave_Cardsaveonlinepayments_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
  }
218
  $order = Mage::getModel('sales/order');
219
  $order->load(Mage::getSingleton('checkout/session')->getLastOrderId());
220
  $nVersion = Mage::getModel('cardsaveonlinepayments/direct')->getVersion();
221
+ $boCartIsEmpty = false;
222
 
223
  try
224
  {
257
  }
258
  else
259
  {
260
+ $cardsaveOrderId = Mage::getSingleton('checkout/session')->getCardsaveonlinepaymentsOrderId();
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 != 'csv_paid')
269
+ //if($cardsaveOrderId)
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)
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
  }
743
  $order = Mage::getModel('sales/order');
744
  $order->load(Mage::getSingleton('checkout/session')->getLastOrderId());
745
  $nVersion = Mage::getModel('cardsaveonlinepayments/direct')->getVersion();
746
+ $boCartIsEmpty = false;
747
 
748
  try
749
  {
777
  }
778
  else
779
  {
780
+ $cardsaveOrderId = Mage::getSingleton('checkout/session')->getCardsaveonlinepaymentsOrderId();
781
+ $szOrderStatus = $order->getStatus();
782
+
783
+ if($szOrderStatus != 'csv_paid')
784
+ //if($cardsaveOrderId)
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('cardsaveonlinepayments')->__('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
  }
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
  }
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
+ //->setCardsaveonlinepaymentsOrderId(null);
974
  }
975
 
976
  /**
993
  $order->setState($status, 'csv_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('cardsaveonlinepayments/direct')->getConfigData('mode');
1002
+ $boIgnoreDuplicateMessage = false;
1003
+
1004
+ if($mode == Cardsave_Cardsaveonlinepayments_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 message: '.$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
  }
app/code/local/Cardsave/Checkout/Model/Type/Onepage.php CHANGED
@@ -11,7 +11,101 @@ class Cardsave_Checkout_Model_Type_Onepage extends Mage_Checkout_Model_Type_Onep
11
  {
12
  $nVersion = Mage::getModel('cardsaveonlinepayments/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 Cardsave_Checkout_Model_Type_Onepage extends Mage_Checkout_Model_Type_Onep
626
  public function saveOrderAfter3dSecure($pares, $md)
627
  {
628
  $nVersion = Mage::getModel('cardsaveonlinepayments/direct')->getVersion();
 
629
 
630
  if($nVersion >= 1410)
631
  {
632
- $_order = Mage::getModel('sales/order')->load(Mage::getSingleton('checkout/session')->getCardsaveonlinepaymentsOrderId());
 
633
 
634
  if(!$_order->getId())
635
  {
11
  {
12
  $nVersion = Mage::getModel('cardsaveonlinepayments/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('cardsaveonlinepayments/direct')->getVersion();
723
+ $orderId;
724
 
725
  if($nVersion >= 1410)
726
  {
727
+ $orderId = Mage::getSingleton('checkout/session')->getCardsaveonlinepaymentsOrderId();
728
+ $_order = Mage::getModel('sales/order')->load($orderId);
729
 
730
  if(!$_order->getId())
731
  {
package.xml CHANGED
@@ -1,18 +1,25 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Cardsave_Cardsaveonlinepayments</name>
4
- <version>1.10.3</version>
5
  <stability>stable</stability>
6
  <license>OSL v3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
- <summary>Cardsave 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 CardSave.</description>
11
- <notes>Fixed SQL installation script error for pre 1.5 Magento versions.</notes>
 
 
 
 
 
 
 
12
  <authors><author><name>Cardsave</name><user>auto-converted</user><email>integrationsupport@cardsaveonlinepayments.com</email></author></authors>
13
- <date>2011-07-01</date>
14
- <time>10:47:12</time>
15
- <contents><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="images"><file name="cardsave_online.jpg" hash="abb239c81edb9ae8df8cf891e914e2aa"/></dir></dir></dir><dir name="base"><dir name="default"><dir name="images"><file name="cardsave_online.jpg" hash="abb239c81edb9ae8df8cf891e914e2aa"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="cardsaveonlinepayments"><file name="form.phtml" hash="bf8cf94001d912f6d1e77b1d2b03cf6e"/><file name="info.phtml" hash="9765a5eae50cb6fa21dcec22e7767e79"/></dir></dir></dir></dir><dir name="base"><dir name="default"><dir name="template"><dir name="cardsaveonlinepayments"><file name="form.phtml" hash="ad3f2b6304ce7e83e82195aa16fdb43a"/><file name="info.phtml" hash="9765a5eae50cb6fa21dcec22e7767e79"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="cardsaveonlinepayments"><file name="form.phtml" hash="7f67d94e80b469997a5c1ca2f61a4e47"/><file name="info.phtml" hash="c378bb59f085df95a4a6a5d866fc512d"/></dir></dir></dir></dir><dir name="base"><dir name="default"><dir name="template"><dir name="cardsaveonlinepayments"><file name="form.phtml" hash="34e9854beb8479eef68f452efa803ec1"/><file name="info.phtml" hash="c378bb59f085df95a4a6a5d866fc512d"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Cardsave_All.xml" hash="e1d59fd8c4d4b5d87607f43fecf47e59"/></dir></target><target name="magelocal"><dir name="Cardsave"><dir name="Cardsaveonlinepayments"><dir name="Block"><file name="Error.php" hash="660d3cbde48910ef271df9e05130a6d7"/><file name="Form.php" hash="ea5b3817c9607a94f4685d53d0b18569"/><file name="Info.php" hash="57a4bfec1a1c769de063be2b922f4a97"/><file name="Redirect.php" hash="b5a1f7af807dc9a41ec5b9db5c74e87e"/><file name="Threedsecure.php" hash="9d75776f34c5acaf6ea265f35f302c69"/></dir><dir name="controllers"><file name="PaymentController.php" hash="8bfece31f856e90f0cdadf3bca067ccf"/></dir><dir name="etc"><file name="config.xml" hash="d42560b62660323b2139db8201c3205f"/><file name="system.xml" hash="946f07b53a3e5e321cdacb1bad97a469"/></dir><dir name="Helper"><file name="Data.php" hash="e024ec0479d1e8e7efcf4751b05194d6"/></dir><dir name="Model"><dir name="Common"><dir name="ThePaymentGateway"><file name="PaymentSystem.php" hash="e4d4df170c21b7e3571b3ba1205ca979"/><file name="SOAP.php" hash="cd2c165c0290f828a3be81765c737a85"/><file name="TPG_Common.php" hash="d86997c977cfd55b8ab577a514ab149c"/></dir><file name="GlobalErrors.php" hash="04d277d4a763efa508bf36d29c7dc8c4"/><file name="ISOCountries.php" hash="78dc558da68ca9a6ef44898a3980ecf2"/><file name="ISOCurrencies.php" hash="a32bc47b2d9896c293ecdcbf847144f9"/><file name="PaymentFormHelper.php" hash="41e22f61e8b71b8e8b6ca78b90da44e5"/></dir><dir name="Source"><file name="HashMethod.php" hash="997928579b69d21ae9eebec698c715c6"/><file name="OrderStatus.php" hash="4c44f8ba1652f20d934aa200ed4c8d00"/><file name="PaymentAction.php" hash="fa94be37c18bbb2f6301bdad1db3698d"/><file name="PaymentMode.php" hash="ea8af602bd09d54a123af64bc4b680d0"/><file name="ResultDeliveryMethod.php" hash="afb838319df715e604173d6aa143feab"/></dir><dir name="Resource"><dir name="Eav"><dir name="Mysql4"><file name="Setup.php" hash="b2a7e887464ff91517dbb4fd62f13c66"/></dir></dir></dir><file name="Direct.php" hash="454fc94ea5dc5780cef62fd4d1a2cb44"/><file name="Request.php" hash="370f028086d13ae1df470e93a67dea66"/></dir><dir name="sql"><dir name="cardsaveonlinepayments_setup"><file name="mysql4-install-0.1.0.php" hash="f8d74ffd9920f7d3d6d63e5062204c61"/></dir></dir></dir><dir name="Checkout"><dir name="Block"><dir name="Onepage"><dir name="Payment"><file name="Methods.php" hash="695d628564f6e1e0c85e3821699e6b45"/></dir></dir></dir><dir name="etc"><file name="config.xml" hash="9dbd58b6b32491d65e5c7d5850aa3420"/></dir><dir name="Model"><dir name="Type"><file name="Onepage.php" hash="7d1b93be12eebd5e317d72655ba1d8e1"/></dir></dir></dir><dir name="Sales"><dir name="etc"><file name="config.xml" hash="9c884b19d80ee19e12bed268bb15e4ab"/></dir><dir name="Model"><dir name="Order"><file name="Invoice.php" hash="9be99f3fbe1c4fe98fb110d3daa8afe6"/><file name="Payment.php" hash="14f5fc7b55d07707e252f031f64cf18c"/></dir><dir name="Service"><file name="Quote.php" hash="a514922157b5690772d716c29f4a653e"/></dir><file name="Order.php" hash="9ffa9e06b0d5d8d2d810ab50017e81fa"/></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies/>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Cardsave_Cardsaveonlinepayments</name>
4
+ <version>1.11.0</version>
5
  <stability>stable</stability>
6
  <license>OSL v3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
+ <summary>Cardsave 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 CardSave.</description>
11
+ <notes>Compatibility support for versions:&#xD;
12
+ - 1.6.0&#xD;
13
+ - 1.6.1&#xD;
14
+ - 1.6.2&#xD;
15
+ - other earlier versions&#xD;
16
+ Fixes for the following bugs:&#xD;
17
+ - back button issue causing incorrect statuses&#xD;
18
+ - special character in address details issue in Direct API method</notes>
19
  <authors><author><name>Cardsave</name><user>auto-converted</user><email>integrationsupport@cardsaveonlinepayments.com</email></author></authors>
20
+ <date>2012-01-24</date>
21
+ <time>13:54:54</time>
22
+ <contents><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="images"><file name="cardsave_online.jpg" hash="abb239c81edb9ae8df8cf891e914e2aa"/></dir></dir></dir><dir name="base"><dir name="default"><dir name="images"><file name="cardsave_online.jpg" hash="abb239c81edb9ae8df8cf891e914e2aa"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="cardsaveonlinepayments"><file name="form.phtml" hash="bf8cf94001d912f6d1e77b1d2b03cf6e"/><file name="info.phtml" hash="9765a5eae50cb6fa21dcec22e7767e79"/></dir></dir></dir></dir><dir name="base"><dir name="default"><dir name="template"><dir name="cardsaveonlinepayments"><file name="form.phtml" hash="ad3f2b6304ce7e83e82195aa16fdb43a"/><file name="info.phtml" hash="9765a5eae50cb6fa21dcec22e7767e79"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="cardsaveonlinepayments"><file name="form.phtml" hash="7f67d94e80b469997a5c1ca2f61a4e47"/><file name="info.phtml" hash="c378bb59f085df95a4a6a5d866fc512d"/></dir></dir></dir></dir><dir name="base"><dir name="default"><dir name="template"><dir name="cardsaveonlinepayments"><file name="form.phtml" hash="34e9854beb8479eef68f452efa803ec1"/><file name="info.phtml" hash="c378bb59f085df95a4a6a5d866fc512d"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Cardsave_All.xml" hash="e1d59fd8c4d4b5d87607f43fecf47e59"/></dir></target><target name="magelocal"><dir name="Cardsave"><dir name="Cardsaveonlinepayments"><dir name="Block"><file name="Error.php" hash="660d3cbde48910ef271df9e05130a6d7"/><file name="Form.php" hash="ea5b3817c9607a94f4685d53d0b18569"/><file name="Info.php" hash="57a4bfec1a1c769de063be2b922f4a97"/><file name="Redirect.php" hash="b5a1f7af807dc9a41ec5b9db5c74e87e"/><file name="Threedsecure.php" hash="9d75776f34c5acaf6ea265f35f302c69"/></dir><dir name="controllers"><file name="PaymentController.php" hash="a296c18e805d796f1408ba73a28dcf2b"/></dir><dir name="etc"><file name="config.xml" hash="d42560b62660323b2139db8201c3205f"/><file name="system.xml" hash="946f07b53a3e5e321cdacb1bad97a469"/></dir><dir name="Helper"><file name="Data.php" hash="e024ec0479d1e8e7efcf4751b05194d6"/></dir><dir name="Model"><dir name="Common"><dir name="ThePaymentGateway"><file name="PaymentSystem.php" hash="e6d7c921f7bc404da6600e27289ca96b"/><file name="SOAP.php" hash="a1587be0f51088e96bc0a4c99055315f"/><file name="TPG_Common.php" hash="74aabb82f296cbb4ce7609b2515b49bf"/></dir><file name="GlobalErrors.php" hash="04d277d4a763efa508bf36d29c7dc8c4"/><file name="ISOCountries.php" hash="78dc558da68ca9a6ef44898a3980ecf2"/><file name="ISOCurrencies.php" hash="a32bc47b2d9896c293ecdcbf847144f9"/><file name="PaymentFormHelper.php" hash="41e22f61e8b71b8e8b6ca78b90da44e5"/></dir><dir name="Source"><file name="HashMethod.php" hash="997928579b69d21ae9eebec698c715c6"/><file name="OrderStatus.php" hash="4c44f8ba1652f20d934aa200ed4c8d00"/><file name="PaymentAction.php" hash="fa94be37c18bbb2f6301bdad1db3698d"/><file name="PaymentMode.php" hash="ea8af602bd09d54a123af64bc4b680d0"/><file name="ResultDeliveryMethod.php" hash="afb838319df715e604173d6aa143feab"/></dir><dir name="Resource"><dir name="Eav"><dir name="Mysql4"><file name="Setup.php" hash="b2a7e887464ff91517dbb4fd62f13c66"/></dir></dir></dir><file name="Direct.php" hash="4ac698daaba8debb2667bf58fd58752c"/><file name="Request.php" hash="370f028086d13ae1df470e93a67dea66"/></dir><dir name="sql"><dir name="cardsaveonlinepayments_setup"><file name="mysql4-install-0.1.0.php" hash="f8d74ffd9920f7d3d6d63e5062204c61"/></dir></dir></dir><dir name="Checkout"><dir name="Block"><dir name="Onepage"><dir name="Payment"><file name="Methods.php" hash="695d628564f6e1e0c85e3821699e6b45"/></dir></dir></dir><dir name="etc"><file name="config.xml" hash="9dbd58b6b32491d65e5c7d5850aa3420"/></dir><dir name="Model"><dir name="Type"><file name="Onepage.php" hash="8122652860c5f9ac512b25e2088d1099"/></dir></dir></dir><dir name="Sales"><dir name="etc"><file name="config.xml" hash="9c884b19d80ee19e12bed268bb15e4ab"/></dir><dir name="Model"><dir name="Order"><file name="Invoice.php" hash="9be99f3fbe1c4fe98fb110d3daa8afe6"/><file name="Payment.php" hash="14f5fc7b55d07707e252f031f64cf18c"/></dir><dir name="Service"><file name="Quote.php" hash="a514922157b5690772d716c29f4a653e"/></dir><file name="Order.php" hash="9ffa9e06b0d5d8d2d810ab50017e81fa"/></dir></dir></dir></target></contents>
23
  <compatible/>
24
  <dependencies/>
25
  </package>