Securetrading_Stpp - Version 3.1.1.13

Version Notes

The official SecureTrading STPP Magento integration.

Download this release

Release Info

Developer PeteST
Extension Securetrading_Stpp
Version 3.1.1.13
Comparing to
See all releases


Code changes from version 3.1.0.8 to 3.1.1.13

Files changed (63) hide show
  1. app/code/local/Securetrading/Stpp/Block/Adminhtml/Sales/Order/View/Tab/Modifier.php +0 -1
  2. app/code/local/Securetrading/Stpp/Block/Adminhtml/Sales/Transactions.php +1 -1
  3. app/code/local/Securetrading/Stpp/Block/Adminhtml/Sales/Transactions/Data/Abstract.php +2 -2
  4. app/code/local/Securetrading/Stpp/Block/Adminhtml/Sales/Transactions/Data/Request.php +1 -1
  5. app/code/local/Securetrading/Stpp/Block/Adminhtml/Sales/Transactions/Data/Response.php +1 -1
  6. app/code/local/Securetrading/Stpp/Block/Adminhtml/Sales/Transactions/Grid.php +5 -1
  7. app/code/local/Securetrading/Stpp/Block/Adminhtml/Sales/Transactions/Single.php +28 -4
  8. app/code/local/Securetrading/Stpp/Block/Adminhtml/Sales/Transactions/Type/Abstract.php +18 -0
  9. app/code/local/Securetrading/Stpp/Block/Adminhtml/Sales/Transactions/Type/Default.php +18 -0
  10. app/code/local/Securetrading/Stpp/Block/Adminhtml/Sales/Transactions/Type/Transactionupdate.php +21 -0
  11. app/code/local/Securetrading/Stpp/Block/Adminhtml/Sales/Transactions/Type/Transactionupdate/Filters.php +8 -0
  12. app/code/local/Securetrading/Stpp/Block/Adminhtml/Sales/Transactions/Type/Transactionupdate/Updates.php +8 -0
  13. app/code/local/Securetrading/Stpp/Block/Adminhtml/System/Config/Fieldset/Fields.php +1 -1
  14. app/code/local/Securetrading/Stpp/Block/Payment/Direct/Post.php +1 -1
  15. app/code/local/Securetrading/Stpp/Block/Payment/Location.php +6 -6
  16. app/code/local/Securetrading/Stpp/Model/Actions/Abstract.php +153 -81
  17. app/code/local/Securetrading/Stpp/Model/Actions/Direct.php +11 -1
  18. app/code/local/Securetrading/Stpp/Model/Actions/Redirect.php +13 -11
  19. app/code/local/Securetrading/Stpp/Model/Integration.php +39 -7
  20. app/code/local/Securetrading/Stpp/Model/Observer.php +15 -42
  21. app/code/local/Securetrading/Stpp/Model/Payment/Abstract.php +22 -26
  22. app/code/local/Securetrading/Stpp/Model/Payment/Direct.php +297 -58
  23. app/code/local/Securetrading/Stpp/Model/Payment/Redirect.php +51 -17
  24. app/code/local/Securetrading/Stpp/Model/Transaction.php +31 -12
  25. app/code/local/Securetrading/Stpp/Model/Transaction/Types.php +1 -0
  26. app/code/local/Securetrading/Stpp/Model/Transport.php +0 -5
  27. app/code/local/Securetrading/Stpp/controllers/PaymentController.php +4 -2
  28. app/code/local/Securetrading/Stpp/controllers/RedirectController.php +22 -26
  29. app/code/local/Securetrading/Stpp/controllers/Sales/Order/Create/SecuretradingController.php +18 -9
  30. app/code/local/Securetrading/Stpp/controllers/Sales/Order/CreateController.php +7 -1
  31. app/code/local/Securetrading/Stpp/controllers/Sales/Order/EditController.php +4 -3
  32. app/code/local/Securetrading/Stpp/etc/config.xml +6 -1
  33. app/code/local/Securetrading/Stpp/etc/system.xml +5 -5
  34. app/code/local/Securetrading/Stpp/lib/Securetrading.php +1 -1
  35. app/code/local/Securetrading/Stpp/lib/code/core/Stpp/Actions/Abstract.php +61 -0
  36. app/code/local/Securetrading/Stpp/lib/code/core/Stpp/Api/Connection/Webservices.php +156 -109
  37. app/code/local/Securetrading/Stpp/lib/code/core/Stpp/Api/Context.php +34 -1
  38. app/code/local/Securetrading/Stpp/lib/code/core/Stpp/Api/Facade.php +24 -4
  39. app/code/local/Securetrading/Stpp/lib/code/core/Stpp/Api/Helper.php +49 -14
  40. app/code/local/Securetrading/Stpp/lib/code/core/Stpp/Api/Process.php +43 -82
  41. app/code/local/Securetrading/Stpp/lib/code/core/Stpp/Api/Process/Calculation/BaseInterface.php +5 -0
  42. app/code/local/Securetrading/Stpp/lib/code/core/Stpp/Api/Process/Calculation/CardstoreNoncardstoreCombined.php +16 -0
  43. app/code/local/Securetrading/Stpp/lib/code/core/Stpp/Api/Process/Calculation/Default.php +7 -0
  44. app/code/local/Securetrading/Stpp/lib/code/core/Stpp/Api/Process/Calculation/RiskdecNonriskdecCombined.php +16 -0
  45. app/code/local/Securetrading/Stpp/lib/code/core/Stpp/Api/Process/Calculation/TuRefundCombined.php +20 -0
  46. app/code/local/Securetrading/Stpp/lib/code/core/Stpp/Api/Result.php +12 -12
  47. app/code/local/Securetrading/Stpp/lib/code/core/Stpp/Api/ResultInterface.php +4 -4
  48. app/code/local/Securetrading/Stpp/lib/code/core/Stpp/Api/Send.php +4 -5
  49. app/code/local/Securetrading/Stpp/lib/code/core/Stpp/Api/Xml/Reader.php +18 -18
  50. app/code/local/Securetrading/Stpp/lib/code/core/Stpp/Api/Xml/Writer.php +33 -20
  51. app/code/local/Securetrading/Stpp/lib/code/core/Stpp/Data/Abstract.php +2 -1
  52. app/code/local/Securetrading/Stpp/lib/code/core/Stpp/Data/Request.php +0 -1
  53. app/code/local/Securetrading/Stpp/lib/code/core/Stpp/Data/Response.php +25 -0
  54. app/code/local/Securetrading/Stpp/lib/code/core/Stpp/Utility/Log/Writer/File.php +2 -1
  55. app/code/local/Securetrading/Stpp/lib/magento_child_css.css +0 -84
  56. app/code/local/Securetrading/Stpp/lib/stpp_logs/debug.txt +0 -0
  57. app/code/local/Securetrading/Stpp/readme.txt +39 -22
  58. app/code/local/Securetrading/Stpp/sql/securetrading_stpp/upgrade-3.1.0-3.2.0.php +27 -0
  59. app/design/adminhtml/default/default/layout/securetrading.xml +5 -0
  60. app/design/adminhtml/default/default/template/securetrading/stpp/payment/location.phtml +12 -0
  61. app/design/adminhtml/default/default/template/securetrading/stpp/sales/transactions/single.phtml +13 -7
  62. app/design/frontend/base/default/layout/securetrading.xml +2 -2
  63. package.xml +4 -4
app/code/local/Securetrading/Stpp/Block/Adminhtml/Sales/Order/View/Tab/Modifier.php CHANGED
@@ -3,7 +3,6 @@
3
  class Securetrading_Stpp_Block_Adminhtml_Sales_Order_View_Tab_Modifier extends Mage_Core_Block_Abstract {
4
  protected function _prepareLayout() {
5
  if ($this->getLayout()->getBlock('sales_order_tabs')->getOrder()->getPayment()->getMethodInstance()->getIsSecuretradingPaymentMethod()) {
6
- $this->getLayout()->getBlock('sales_order_tabs')->removeTab('order_transactions');
7
  $this->getLayout()->getBlock('sales_order_tabs')->addTab('securetrading_order_transactions', 'securetrading_stpp/adminhtml_sales_order_view_tab_transactions');
8
  }
9
  }
3
  class Securetrading_Stpp_Block_Adminhtml_Sales_Order_View_Tab_Modifier extends Mage_Core_Block_Abstract {
4
  protected function _prepareLayout() {
5
  if ($this->getLayout()->getBlock('sales_order_tabs')->getOrder()->getPayment()->getMethodInstance()->getIsSecuretradingPaymentMethod()) {
 
6
  $this->getLayout()->getBlock('sales_order_tabs')->addTab('securetrading_order_transactions', 'securetrading_stpp/adminhtml_sales_order_view_tab_transactions');
7
  }
8
  }
app/code/local/Securetrading/Stpp/Block/Adminhtml/Sales/Transactions.php CHANGED
@@ -4,7 +4,7 @@ class Securetrading_Stpp_Block_Adminhtml_Sales_Transactions extends Mage_Adminht
4
  public function __construct() {
5
  $this->_blockGroup = 'securetrading_stpp';
6
  $this->_controller = 'adminhtml_sales_transactions';
7
- $this->_headerText = Mage::helper('securetrading_stpp')->__('Transactions');
8
  parent::__construct();
9
  $this->_removeButton('add');
10
  }
4
  public function __construct() {
5
  $this->_blockGroup = 'securetrading_stpp';
6
  $this->_controller = 'adminhtml_sales_transactions';
7
+ $this->_headerText = Mage::helper('securetrading_stpp')->__('Secure Trading Transactions');
8
  parent::__construct();
9
  $this->_removeButton('add');
10
  }
app/code/local/Securetrading/Stpp/Block/Adminhtml/Sales/Transactions/Data/Abstract.php CHANGED
@@ -17,7 +17,7 @@ abstract class Securetrading_Stpp_Block_Adminhtml_Sales_Transactions_Data_Abstra
17
 
18
  protected function _prepareCollection() {
19
  $collection = new Varien_Data_Collection();
20
- foreach ($this->getTransactionAdditionalInfo() as $key => $value) {
21
  $data = new Varien_Object(array('key' => $key, 'value' => $value));
22
  $collection->addItem($data);
23
  }
@@ -45,5 +45,5 @@ abstract class Securetrading_Stpp_Block_Adminhtml_Sales_Transactions_Data_Abstra
45
  return parent::_prepareColumns();
46
  }
47
 
48
- abstract public function getTransactionAdditionalInfo();
49
  }
17
 
18
  protected function _prepareCollection() {
19
  $collection = new Varien_Data_Collection();
20
+ foreach ($this->_getGridData() as $key => $value) {
21
  $data = new Varien_Object(array('key' => $key, 'value' => $value));
22
  $collection->addItem($data);
23
  }
45
  return parent::_prepareColumns();
46
  }
47
 
48
+ abstract protected function _getGridData();
49
  }
app/code/local/Securetrading/Stpp/Block/Adminhtml/Sales/Transactions/Data/Request.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
 
3
  class Securetrading_Stpp_Block_Adminhtml_Sales_Transactions_Data_Request extends Securetrading_Stpp_Block_Adminhtml_Sales_Transactions_Data_Abstract {
4
- public function getTransactionAdditionalInfo() {
5
  return $this->_getTransaction()->getRequestData();
6
  }
7
  }
1
  <?php
2
 
3
  class Securetrading_Stpp_Block_Adminhtml_Sales_Transactions_Data_Request extends Securetrading_Stpp_Block_Adminhtml_Sales_Transactions_Data_Abstract {
4
+ protected function _getGridData() {
5
  return $this->_getTransaction()->getRequestData();
6
  }
7
  }
app/code/local/Securetrading/Stpp/Block/Adminhtml/Sales/Transactions/Data/Response.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
 
3
  class Securetrading_Stpp_Block_Adminhtml_Sales_Transactions_Data_Response extends Securetrading_Stpp_Block_Adminhtml_Sales_Transactions_Data_Abstract {
4
- public function getTransactionAdditionalInfo() {
5
  return $this->_getTransaction()->getResponseData();
6
  }
7
  }
1
  <?php
2
 
3
  class Securetrading_Stpp_Block_Adminhtml_Sales_Transactions_Data_Response extends Securetrading_Stpp_Block_Adminhtml_Sales_Transactions_Data_Abstract {
4
+ protected function _getGridData() {
5
  return $this->_getTransaction()->getResponseData();
6
  }
7
  }
app/code/local/Securetrading/Stpp/Block/Adminhtml/Sales/Transactions/Grid.php CHANGED
@@ -24,7 +24,7 @@ class Securetrading_Stpp_Block_Adminhtml_Sales_Transactions_Grid extends Mage_Ad
24
 
25
  protected function _prepareColumns() {
26
  $this->addColumn('transaction_id', array(
27
- 'header' => Mage::helper('securetrading_stpp')->__('Transaction ID'),
28
  'index' => 'transaction_id',
29
  ));
30
  $this->addColumn('transaction_reference', array(
@@ -53,6 +53,10 @@ class Securetrading_Stpp_Block_Adminhtml_Sales_Transactions_Grid extends Mage_Ad
53
  'index' => 'error_code',
54
  'type' => 'number',
55
  ));
 
 
 
 
56
  $this->addColumn('last_updated_at', array(
57
  'header' => Mage::helper('securetrading_stpp')->__('Last Updated At'),
58
  'index' => 'last_updated_at',
24
 
25
  protected function _prepareColumns() {
26
  $this->addColumn('transaction_id', array(
27
+ 'header' => Mage::helper('securetrading_stpp')->__('ID#'),
28
  'index' => 'transaction_id',
29
  ));
30
  $this->addColumn('transaction_reference', array(
53
  'index' => 'error_code',
54
  'type' => 'number',
55
  ));
56
+ $this->addColumn('account_type_description', array(
57
+ 'header' => Mage::helper('securetrading_stpp')->__('Account Type'),
58
+ 'index' => 'account_type_description',
59
+ ));
60
  $this->addColumn('last_updated_at', array(
61
  'header' => Mage::helper('securetrading_stpp')->__('Last Updated At'),
62
  'index' => 'last_updated_at',
app/code/local/Securetrading/Stpp/Block/Adminhtml/Sales/Transactions/Single.php CHANGED
@@ -1,13 +1,13 @@
1
  <?php
2
 
3
- class Securetrading_Stpp_Block_Adminhtml_Sales_Transactions_Single extends Mage_Adminhtml_Block_Widget_Container { //extends Mage_Page_Block_Html {//Mage_Core_Block_Abstract {
4
  protected $_transaction;
5
 
6
  protected function _construct() {
7
  $transaction = Mage::registry('current_transaction');
8
 
9
  if ($transaction === null) {
10
- throw new Stpp_Exception(Mage::helper('securetrading_stpp')->__('A transaction has not been set.'));
11
  }
12
 
13
  $this->setTransaction($transaction);
@@ -21,13 +21,33 @@ class Securetrading_Stpp_Block_Adminhtml_Sales_Transactions_Single extends Mage_
21
  ));
22
  }
23
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  public function getHeaderText() {
25
- return sprintf('Transaction #%s', $this->getTransaction()->getTransactionReference());
26
  }
27
 
28
  public function getTransaction() {
29
  if ($this->_transaction === null) {
30
- throw new Stpp_Exception(Mage::helper('securetrading_stpp')->__('The transaction has not been set.'));
31
  }
32
  return $this->_transaction;
33
  }
@@ -66,6 +86,10 @@ class Securetrading_Stpp_Block_Adminhtml_Sales_Transactions_Single extends Mage_
66
  return $this->getTransaction()->getErrorCode();
67
  }
68
 
 
 
 
 
69
  public function getLastUpdatedAt() {
70
  return $this->getTransaction()->getLastUpdatedAt();
71
  }
1
  <?php
2
 
3
+ class Securetrading_Stpp_Block_Adminhtml_Sales_Transactions_Single extends Mage_Adminhtml_Block_Widget_Container {
4
  protected $_transaction;
5
 
6
  protected function _construct() {
7
  $transaction = Mage::registry('current_transaction');
8
 
9
  if ($transaction === null) {
10
+ throw new Exception(Mage::helper('securetrading_stpp')->__('A transaction has not been set.'));
11
  }
12
 
13
  $this->setTransaction($transaction);
21
  ));
22
  }
23
 
24
+ protected function _prepareLayout() {
25
+ switch($this->getTransaction()->getRequestType()) {
26
+ case Securetrading_stpp_Model_Transaction_Types::TYPE_AUTH:
27
+ case Securetrading_stpp_Model_Transaction_Types::TYPE_THREEDQUERY:
28
+ case Securetrading_stpp_Model_Transaction_Types::TYPE_RISKDEC:
29
+ case Securetrading_stpp_Model_Transaction_Types::TYPE_ACCOUNTCHECK:
30
+ case Securetrading_stpp_Model_Transaction_Types::TYPE_CARDSTORE:
31
+ case Securetrading_stpp_Model_Transaction_Types::TYPE_REFUND:
32
+ $block = $this->getLayout()->createBlock('securetrading_stpp/adminhtml_sales_transactions_type_default', '', array('transaction' => $this->getTransaction()));
33
+ break;
34
+ case Securetrading_Stpp_Model_Transaction_Types::TYPE_TRANSACTIONUPDATE:
35
+ $block = $this->getLayout()->createBlock('securetrading_stpp/adminhtml_sales_transactions_type_transactionupdate', '', array('transaction' => $this->getTransaction()));
36
+ break;
37
+ default:
38
+ throw new Exception(sprintf(Mage::helper('securetrading_stpp')->__('Invalid transaction type: "%s".'), $this->getTransaction()->getRequestType()));
39
+ }
40
+ $block->setTransaction($this->getTransaction());
41
+ $this->setChild('transaction_data', $block);
42
+ }
43
+
44
  public function getHeaderText() {
45
+ return sprintf('Secure Trading Transaction #%s', $this->getTransaction()->getTransactionReference());
46
  }
47
 
48
  public function getTransaction() {
49
  if ($this->_transaction === null) {
50
+ throw new Exception(Mage::helper('securetrading_stpp')->__('The transaction has not been set.'));
51
  }
52
  return $this->_transaction;
53
  }
86
  return $this->getTransaction()->getErrorCode();
87
  }
88
 
89
+ public function getAccountTypeDescription() {
90
+ return $this->getTransaction()->getAccountTypeDescription();
91
+ }
92
+
93
  public function getLastUpdatedAt() {
94
  return $this->getTransaction()->getLastUpdatedAt();
95
  }
app/code/local/Securetrading/Stpp/Block/Adminhtml/Sales/Transactions/Type/Abstract.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Securetrading_Stpp_Block_Adminhtml_Sales_Transactions_Type_Abstract extends Mage_Core_Block_Abstract{
4
+ protected function _addToHtml($title, $child) {
5
+ return '
6
+ <div class="entry-edit">
7
+ <div class="entry-edit">
8
+ <div class="entry-edit-head">
9
+ <h4 class="icon-head head-edit-form fieldset-legend">' . $title . '</h4>
10
+ </div>
11
+ <div class="log-details-grid">'
12
+ . $child . '
13
+ </div>
14
+ </div>
15
+ </div>
16
+ ';
17
+ }
18
+ }
app/code/local/Securetrading/Stpp/Block/Adminhtml/Sales/Transactions/Type/Default.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Securetrading_Stpp_Block_Adminhtml_Sales_Transactions_Type_Default extends Securetrading_Stpp_Block_Adminhtml_Sales_Transactions_Type_Abstract {
4
+ protected function _prepareLayout() {
5
+ $requestBlock = $this->getLayout()->createBlock('securetrading_stpp/adminhtml_sales_transactions_data_request');
6
+ $responseBlock = $this->getLayout()->createBlock('securetrading_stpp/adminhtml_sales_transactions_data_response');
7
+
8
+ $this->setChild('request', $requestBlock);
9
+ $this->setChild('response', $responseBlock);
10
+ }
11
+
12
+ protected function _toHtml() {
13
+ $html = '';
14
+ $html .= $this->_addToHtml($this->__("Request"), $this->getChildHtml('request'));
15
+ $html .= $this->_addToHtml($this->__("Response"), $this->getChildHtml('response'));
16
+ return $html;
17
+ }
18
+ }
app/code/local/Securetrading/Stpp/Block/Adminhtml/Sales/Transactions/Type/Transactionupdate.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Securetrading_Stpp_Block_Adminhtml_Sales_Transactions_Type_Transactionupdate extends Securetrading_Stpp_Block_Adminhtml_Sales_Transactions_Type_Abstract {
4
+ protected function _prepareLayout() {
5
+ $filtersBlock = $this->getLayout()->createBlock('securetrading_stpp/adminhtml_sales_transactions_type_transactionupdate_filters');
6
+ $updatesBlock = $this->getLayout()->createBlock('securetrading_stpp/adminhtml_sales_transactions_type_transactionupdate_updates');
7
+ $responseBlock = $this->getLayout()->createBlock('securetrading_stpp/adminhtml_sales_transactions_data_response');
8
+
9
+ $this->setChild('filters', $filtersBlock);
10
+ $this->setChild('updates', $updatesBlock);
11
+ $this->setChild('response', $responseBlock);
12
+ }
13
+
14
+ protected function _toHtml() {
15
+ $html = '';
16
+ $html .= $this->_addToHtml($this->__("Request - Filters"), $this->getChildHtml('filters'));
17
+ $html .= $this->_addToHtml($this->__("Request - Updates"), $this->getChildHtml('updates'));
18
+ $html .= $this->_addToHtml($this->__("Response"), $this->getChildHtml('response'));
19
+ return $html;
20
+ }
21
+ }
app/code/local/Securetrading/Stpp/Block/Adminhtml/Sales/Transactions/Type/Transactionupdate/Filters.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Securetrading_Stpp_Block_Adminhtml_Sales_Transactions_Type_Transactionupdate_Filters extends Securetrading_Stpp_Block_Adminhtml_Sales_Transactions_Data_Abstract {
4
+ protected function _getGridData() {
5
+ $requestData = $this->_getTransaction()->getRequestData();
6
+ return $requestData['filter'];
7
+ }
8
+ }
app/code/local/Securetrading/Stpp/Block/Adminhtml/Sales/Transactions/Type/Transactionupdate/Updates.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Securetrading_Stpp_Block_Adminhtml_Sales_Transactions_Type_Transactionupdate_Updates extends Securetrading_Stpp_Block_Adminhtml_Sales_Transactions_Data_Abstract {
4
+ protected function _getGridData() {
5
+ $requestData = $this->_getTransaction()->getRequestData();
6
+ return $requestData['updates'];
7
+ }
8
+ }
app/code/local/Securetrading/Stpp/Block/Adminhtml/System/Config/Fieldset/Fields.php CHANGED
@@ -40,7 +40,7 @@ class Securetrading_Stpp_Block_Adminhtml_System_Config_Fieldset_Fields
40
  $fields = Mage::getModel('securetrading_stpp/integration')->getAdminFields();
41
  $matches = null;
42
  foreach($element->getElements() as $e) {
43
- if (preg_match('/^groups\[[^\[\]]+\]\[fields\]\[(.+)\]\[value\]/', $e->getName(), $matches)) {// removed $ in regex for groups[securetrading_stpp][fields][accepted_cards][value][]
44
  $name = $matches[1];
45
  switch($name) {
46
  case 'site_reference':
40
  $fields = Mage::getModel('securetrading_stpp/integration')->getAdminFields();
41
  $matches = null;
42
  foreach($element->getElements() as $e) {
43
+ if (preg_match('/^groups\[[^\[\]]+\]\[fields\]\[(.+)\]\[value\]/', $e->getName(), $matches)) {
44
  $name = $matches[1];
45
  switch($name) {
46
  case 'site_reference':
app/code/local/Securetrading/Stpp/Block/Payment/Direct/Post.php CHANGED
@@ -7,7 +7,7 @@ class Securetrading_Stpp_Block_Payment_Direct_Post extends Mage_Core_Block_Templ
7
  $session = Mage::getSingleton('securetrading_stpp/payment_direct_session');
8
 
9
  if (!$session->hasAcsRedirectParams() || !($session->getAcsRedirectParams() instanceof Varien_Object)) {
10
- throw new Stpp_Exception(Mage::helper('securetrading_stpp')->__('The ACS parameters could not be retrieved correctly.'));
11
  }
12
 
13
  $this->_params = $session->getAcsRedirectParams();
7
  $session = Mage::getSingleton('securetrading_stpp/payment_direct_session');
8
 
9
  if (!$session->hasAcsRedirectParams() || !($session->getAcsRedirectParams() instanceof Varien_Object)) {
10
+ throw new Exception(Mage::helper('securetrading_stpp')->__('The ACS parameters could not be retrieved correctly.'));
11
  }
12
 
13
  $this->_params = $session->getAcsRedirectParams();
app/code/local/Securetrading/Stpp/Block/Payment/Location.php CHANGED
@@ -1,13 +1,13 @@
1
  <?php
2
 
3
  class Securetrading_Stpp_Block_Payment_Location extends Mage_Page_Block_Html {
4
- const URL_REGISTRY_KEY = 'securetrading_stpp_block_payment_location_url';
 
5
 
6
  public function getRedirectUrl() {
7
- $redirectUrl = Mage::registry(self::URL_REGISTRY_KEY);
8
- if (!$redirectUrl) {
9
- $redirectUrl = Mage::getUrl();
10
- }
11
- return $redirectUrl;
12
  }
13
  }
1
  <?php
2
 
3
  class Securetrading_Stpp_Block_Payment_Location extends Mage_Page_Block_Html {
4
+ const PATH_REGISTRY_KEY = 'securetrading_stpp_block_payment_location_path';
5
+ const ARGS_REGISTRY_KEY = 'securetrading_stpp_block_payment_location_args';
6
 
7
  public function getRedirectUrl() {
8
+ $redirectPath = Mage::registry(self::PATH_REGISTRY_KEY);
9
+ $redirectArgs = Mage::registry(self::ARGS_REGISTRY_KEY);
10
+ $redirectUrl = Mage::getUrl($redirectPath, $redirectArgs);
11
+ return $redirectUrl;
 
12
  }
13
  }
app/code/local/Securetrading/Stpp/Model/Actions/Abstract.php CHANGED
@@ -1,83 +1,103 @@
1
  <?php
2
 
3
  abstract class Securetrading_Stpp_Model_Actions_Abstract extends Stpp_Actions_Abstract {
4
- protected $_orderIncrementId = '';
5
-
6
- public function getOrderIncrementId(Stpp_Data_Response $response) {
7
- if ($response->has('orderreference')) {
8
- return $response->get('orderreference');
9
- }
10
- elseif ($response->getRequest()->has('orderreference')) {
11
- return $response->getRequest()->get('orderreference');
12
- }
13
- elseif ($this->_orderIncrementId) {
14
- return $this->_orderIncrementId;
15
- }
16
- else {
17
- throw new Stpp_Exception(Mage::helper('securetrading_stpp')->__('The order increment ID could not be obtained.'));
18
- }
19
- }
20
-
21
- public function setOrderIncrementId($orderIncrementId) {
22
- $this->_orderIncrementId = $orderIncrementId;
23
- return $this;
24
- }
25
-
26
- public function processAuth(Stpp_Data_Response $response) {
27
- $this->_log($response, sprintf('In %s.', __METHOD__));
28
- $errorCode = $response->get('errorcode');
29
-
30
- $state = $status = $message = null;
31
-
32
- if ($errorCode === '0') {
33
- if (in_array($response->get('settlestatus'), array('0', '1', '100'), true)) {
34
- $state = Mage_Sales_Model_Order::STATE_PROCESSING;
35
- $status = Mage::getModel('sales/order')->getConfig()->getStateDefaultStatus($state);
36
- $message = 'Payment captured.';
37
- }
38
- elseif ($response->get('settlestatus') === '2') {
39
- if ($response->getRequest()->get('settlestatus') !== 2) {
40
- $state = Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW;
41
- $status = Securetrading_Stpp_Model_Payment_Abstract::STATUS_SUSPENDED;
42
- $message = 'Payment suspended. Request and response settle status mismatch.';
43
- }
44
- else {
45
- $state = Mage_Sales_Model_Order::STATE_PROCESSING;
46
- $status = Securetrading_Stpp_Model_Payment_Abstract::STATUS_AUTHORIZED;
47
- $message = 'Payment authorized.';
48
- }
49
- }
50
- else {
51
- throw new Stpp_Exception(sprintf(Mage::helper('securetrading_stpp')->__('Unhandled settle status: "%s".'), $response->get('settlestatus')));
52
- }
53
- }
54
- elseif($errorCode === '60107') {
55
- $status = Securetrading_Stpp_Model_Payment_Abstract::STATUS_SUSPENDED;
56
- $state = Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW;
57
- $message = 'Payment suspended by parent Risk Decision.';
58
- }
59
- else {
60
- $message = sprintf('Payment failed: %s - %s.', $response->get('errorcode'), $response->get('errormessage'));
61
- $order = Mage::getModel('sales/order')->loadByIncrementId($response->get('orderreference'));
62
- $order->addStatusHistoryComment($message, false);
63
- $order->save();
64
- }
65
-
66
- $additionalInformation = array(
67
- 'account_type_description' => $response->get('accounttypedescription'),
68
- 'security_address' => $response->get('securityresponseaddress'),
69
- 'security_postcode' => $response->get('securityresponsepostcode'),
70
- 'security_code' => $response->get('securityresponsesecuritycode'),
71
- 'enrolled' => $response->get('enrolled'),
72
- 'status' => $response->get('status'),
73
- );
74
-
75
- $transactionReference = $response->get('transactionreference');
76
- $maskedPan = $response->get('maskedpan');
77
- Mage::getSingleton('securetrading_stpp/transport')->setState($state)->setStatus($status)->setMessage($message)->setOrderReference($response->get("orderreference"))->setAdditionalInformation($additionalInformation)->setTransactionReference($transactionReference)->setMaskedPan($maskedPan);
78
- $this->_addTransaction(Securetrading_Stpp_Model_Transaction_Types::TYPE_AUTH, $response);
79
-
80
- return parent::processAuth($response);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
  }
82
 
83
  public function process3dQuery(Stpp_Data_Response $response) {
@@ -101,11 +121,21 @@ abstract class Securetrading_Stpp_Model_Actions_Abstract extends Stpp_Actions_Ab
101
  public function processTransactionUpdate(Stpp_Data_Response $response) {
102
  $this->_log($response, sprintf('In %s.', __METHOD__));
103
  $this->_addTransaction(Securetrading_Stpp_Model_Transaction_Types::TYPE_TRANSACTIONUPDATE, $response);
 
 
 
 
 
 
 
104
  return parent::processTransactionUpdate($response);
105
  }
106
 
107
  public function processRefund(Stpp_Data_Response $response) {
108
  $this->_log($response, sprintf('In %s.', __METHOD__));
 
 
 
109
  $this->_addTransaction(Securetrading_Stpp_Model_Transaction_Types::TYPE_REFUND, $response);
110
  return parent::processRefund($response);
111
  }
@@ -117,18 +147,19 @@ abstract class Securetrading_Stpp_Model_Actions_Abstract extends Stpp_Actions_Ab
117
  }
118
 
119
  protected function _log(Stpp_Data_Response $response, $message) {
120
- Mage::getModel('sales/order')->loadByIncrementId($this->getOrderIncrementId($response))->getPayment()->getMethodInstance()->log($message);
121
  }
122
 
123
  protected function _addTransaction($responseType, $response) {
124
- $orderId = Mage::getModel('sales/order')->loadByIncrementId($this->getOrderIncrementId($response))->getId();
125
  $errorCode = $response->get('errorcode');
126
- $transactionReference = $response->get('transactionreference');
127
  $parentTransactionReference = $response->get('parenttransactionreference');
 
128
  $parentTransactionId = null;
129
 
130
  if ($parentTransactionReference) {
131
- $transaction = Mage::getModel('securetrading_stpp/transaction')->loadByParentTransactionReference($parentTransactionReference, true);
132
  if ($transaction) {
133
  $parentTransactionId = $transaction->getTransactionId();
134
  }
@@ -147,6 +178,7 @@ abstract class Securetrading_Stpp_Model_Actions_Abstract extends Stpp_Actions_Ab
147
  ->setRequestData($requestData)
148
  ->setResponseData($responseData)
149
  ->setErrorCode($errorCode)
 
150
  ->setOrderId($orderId)
151
  ->save()
152
  ;
@@ -169,9 +201,49 @@ abstract class Securetrading_Stpp_Model_Actions_Abstract extends Stpp_Actions_Ab
169
  case Stpp_Types::API_ACCOUNTCHECK:
170
  $return = Securetrading_Stpp_Model_Transaction_Types::TYPE_ACCOUNTCHECK;
171
  break;
 
 
 
172
  default:
173
  $return = '';
174
  }
175
  return $return;
176
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
177
  }
1
  <?php
2
 
3
  abstract class Securetrading_Stpp_Model_Actions_Abstract extends Stpp_Actions_Abstract {
4
+ protected $_order;
5
+
6
+ public function setOrder(Mage_Sales_Model_Order $order) {
7
+ $this->_order = $order;
8
+ return $this;
9
+ }
10
+
11
+ protected function _getOrder(Stpp_Data_Response $response) {
12
+ if ($this->_order) {
13
+ return $this->_order;
14
+ }
15
+ else if ($response->has('orderreference')) {
16
+ $orderIncrementId = $response->get('orderreference');
17
+ }
18
+ else if ($response->getRequest()->has('orderreference')) {
19
+ $orderIncrementId = $response->getRequest()->get('orderreference');
20
+ }
21
+ else {
22
+ throw new Stpp_Exception(Mage::helper('securetrading_stpp')->__('The order increment ID could not be obtained.'));
23
+ }
24
+ $this->setOrder(Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId));
25
+ return $this->_order;
26
+ }
27
+
28
+ protected function _getRequestedSettleStatus(Stpp_Data_Response $response) {
29
+ $transaction = Mage::getModel('securetrading_stpp/transaction')->loadByTransactionReference($response->get('parenttransactionreference'), true);
30
+
31
+ if ($transaction && $transaction->getResponseType() === Securetrading_Stpp_Model_Transaction_Types::TYPE_THREEDQUERY) {
32
+ $requestData = $transaction->getRequestData();
33
+ $requestedSettleStatus = $requestData['settlestatus'];
34
+ }
35
+ else {
36
+ $requestedSettleStatus = $response->getRequest()->get('settlestatus');
37
+ }
38
+ return (string) $requestedSettleStatus;
39
+ }
40
+
41
+ public function processAuth(Stpp_Data_Response $response) { // note - this method makes capture transactions closed UNLESS response ss == 2 && request ss !== 2, then they are open.
42
+ $this->_log($response, sprintf('In %s.', __METHOD__));
43
+
44
+ $order = $this->_getOrder($response);
45
+ $payment = $order->getPayment();
46
+ $errorCode = $response->get('errorcode');
47
+
48
+ if ($order->getStatus() !== Securetrading_Stpp_Model_Payment_Redirect::STATUS_PENDING_PPAGES) {
49
+ throw new Stpp_Exception(sprintf(Mage::helper('securetrading_stpp')->__('The order status for order "%s" was not pending payment pages.'), $order->getIncrementId()));
50
+ }
51
+
52
+ $addCoreTransaction = true;
53
+ $coreTransactionClosed = false;
54
+
55
+ if ($errorCode === '0') {
56
+ if (in_array($response->get('settlestatus'), array('0', '1', '100'), true)) {
57
+ $coreTransactionClosed = true;
58
+ }
59
+ elseif ($response->get('settlestatus') === '2') {
60
+ if ($this->_getRequestedSettleStatus($response) !== '2') {
61
+ $payment->setIsTransactionPending(true);
62
+ }
63
+ }
64
+ else {
65
+ throw new Stpp_Exception(sprintf(Mage::helper('securetrading_stpp')->__('Unhandled settle status: "%s".'), $response->get('settlestatus')));
66
+ }
67
+ }
68
+ elseif($errorCode === '60107') {
69
+ $payment->setNotificationResult(true);
70
+ $payment->registerPaymentReviewAction(Mage_Sales_Model_Order_Payment::REVIEW_ACTION_DENY, false);
71
+ }
72
+ else {
73
+ $addCoreTransaction = false;
74
+ $message = sprintf('Payment failed: %s - %s.', $response->get('errorcode'), $response->get('errormessage'));
75
+ $order->addStatusHistoryComment($message, false);
76
+ }
77
+
78
+ if ($addCoreTransaction) {
79
+ $this->_setCoreTransaction($response, $coreTransactionClosed);
80
+ }
81
+
82
+ $this->_addTransaction(Securetrading_Stpp_Model_Transaction_Types::TYPE_AUTH, $response);
83
+
84
+ $additionalInformation = array(
85
+ 'account_type_description' => $response->get('accounttypedescription'),
86
+ 'security_address' => $response->get('securityresponseaddress'),
87
+ 'security_postcode' => $response->get('securityresponsepostcode'),
88
+ 'security_code' => $response->get('securityresponsesecuritycode'),
89
+ 'enrolled' => $response->get('enrolled'),
90
+ 'status' => $response->get('status'),
91
+ );
92
+
93
+ $payment
94
+ ->setAdditionalInformation($additionalInformation)
95
+ ->setCcTransId($response->get('transactionreference'))
96
+ ->setCcLast($payment->getMethodInstance()->getIntegration()->getCcLast4($response->get('maskedpan')))
97
+ ;
98
+
99
+ $order->save();
100
+ return parent::processAuth($response);
101
  }
102
 
103
  public function process3dQuery(Stpp_Data_Response $response) {
121
  public function processTransactionUpdate(Stpp_Data_Response $response) {
122
  $this->_log($response, sprintf('In %s.', __METHOD__));
123
  $this->_addTransaction(Securetrading_Stpp_Model_Transaction_Types::TYPE_TRANSACTIONUPDATE, $response);
124
+
125
+ if ($response->get('errorcode') === '0') {
126
+ $this->_setCoreTransaction($response, null, $response->getRequest()->get('filter')->get('transactionreference'));
127
+ }
128
+ elseif($response->get('errorcode') === '60017') { // transaction not updatable
129
+ $response->setMessage(Mage::helper('securetrading_stpp')->__('This transaction cannot be updated: it has already been cancelled or settled. Please re-order and alter a new order.'), true);
130
+ }
131
  return parent::processTransactionUpdate($response);
132
  }
133
 
134
  public function processRefund(Stpp_Data_Response $response) {
135
  $this->_log($response, sprintf('In %s.', __METHOD__));
136
+ if ($response->get('errorcode') === '0') {
137
+ $this->_setCoreTransaction($response, null, $response->getRequest()->get('parenttransactionreference'));
138
+ }
139
  $this->_addTransaction(Securetrading_Stpp_Model_Transaction_Types::TYPE_REFUND, $response);
140
  return parent::processRefund($response);
141
  }
147
  }
148
 
149
  protected function _log(Stpp_Data_Response $response, $message) {
150
+ $this->_getOrder($response)->getPayment()->getMethodInstance()->log($message);
151
  }
152
 
153
  protected function _addTransaction($responseType, $response) {
154
+ $orderId = $this->_getOrder($response)->getId();
155
  $errorCode = $response->get('errorcode');
156
+ $transactionReference = $response->get('transactionreference') ? $response->get('transactionreference') : $response->get('responseblockrequestreference');
157
  $parentTransactionReference = $response->get('parenttransactionreference');
158
+ $accountTypeDescription = $response->get('accounttypedescription');
159
  $parentTransactionId = null;
160
 
161
  if ($parentTransactionReference) {
162
+ $transaction = Mage::getModel('securetrading_stpp/transaction')->loadByTransactionReference($parentTransactionReference, true);
163
  if ($transaction) {
164
  $parentTransactionId = $transaction->getTransactionId();
165
  }
178
  ->setRequestData($requestData)
179
  ->setResponseData($responseData)
180
  ->setErrorCode($errorCode)
181
+ ->setAccountTypeDescription($accountTypeDescription)
182
  ->setOrderId($orderId)
183
  ->save()
184
  ;
201
  case Stpp_Types::API_ACCOUNTCHECK:
202
  $return = Securetrading_Stpp_Model_Transaction_Types::TYPE_ACCOUNTCHECK;
203
  break;
204
+ case Stpp_Types::API_REFUND:
205
+ $return = Securetrading_Stpp_Model_Transaction_Types::TYPE_REFUND;
206
+ break;
207
  default:
208
  $return = '';
209
  }
210
  return $return;
211
  }
212
+
213
+ protected function _setCoreTransaction(Stpp_Data_Response $response, $isClosed = null, $parentTransactionId = null) {
214
+ $payment = $this->_getOrder($response)->getPayment();
215
+
216
+ $transactionId = $response->get('transactionreference') ? $response->get('transactionreference') : $response->get('responseblockrequestreference');
217
+ $parentTransactionId !== null ? $parentTransactionId : null;
218
+
219
+ $payment->setTransactionId($transactionId);
220
+ $payment->setParentTransactionId($parentTransactionId);
221
+ $payment->setTransactionAdditionalInfo(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS,
222
+ $this->_flattenArray(
223
+ array(
224
+ 'Request' => $response->getRequest()->toArray(),
225
+ 'Response' => $response->toArray()
226
+ )
227
+ )
228
+ );
229
+
230
+ if($isClosed !== null) {
231
+ $payment->setIsTransactionClosed($isClosed);
232
+ }
233
+ }
234
+
235
+ protected function _flattenArray($input, $separator = ' - ', array $prefix = array()) {
236
+ $oneDimensionArray = array();
237
+ foreach($input as $k => $v) {
238
+ $currentPrefix = array_merge($prefix, array($k));
239
+ if (is_array($v)) {
240
+ $oneDimensionArray += $this->_flattenArray($v, $separator, $currentPrefix);
241
+ }
242
+ else {
243
+ $key = implode($currentPrefix, $separator);
244
+ $oneDimensionArray[$key] = $v;
245
+ }
246
+ }
247
+ return $oneDimensionArray;
248
+ }
249
  }
app/code/local/Securetrading/Stpp/Model/Actions/Direct.php CHANGED
@@ -1,5 +1,15 @@
1
  <?php
2
 
3
  class Securetrading_Stpp_Model_Actions_Direct extends Securetrading_Stpp_Model_Actions_Abstract implements Stpp_Api_ActionsInterface {
4
-
 
 
 
 
 
 
 
 
 
 
5
  }
1
  <?php
2
 
3
  class Securetrading_Stpp_Model_Actions_Direct extends Securetrading_Stpp_Model_Actions_Abstract implements Stpp_Api_ActionsInterface {
4
+ public function processAuth(Stpp_Data_Response $response) {
5
+ parent::processAuth($response);
6
+ if ($response->get('errorcode') === '0') {
7
+ $order = $this->_getOrder($response);
8
+ if ($response->getRequest()->has('md')) {
9
+ Mage::getModel('securetrading_stpp/payment_direct')->registerSuccessfulOrderAfterExternalRedirect($order, $this->_getRequestedSettleStatus($response));
10
+ }
11
+ $order->getPayment()->getMethodInstance()->handleSuccessfulPayment($order, true);
12
+ }
13
+ return $this->_isErrorCodeZero($response);
14
+ }
15
  }
app/code/local/Securetrading/Stpp/Model/Actions/Redirect.php CHANGED
@@ -21,7 +21,7 @@ class Securetrading_Stpp_Model_Actions_Redirect extends Securetrading_Stpp_Model
21
  public function processAuth(Stpp_Data_Response $response) {
22
  $firstOrder = true;
23
  foreach($this->_getOrderIncrementIds($response) as $orderIncrementId) {
24
- $response->set('orderreference', $orderIncrementId);
25
  $this->_processAuth($response, $firstOrder);
26
  $firstOrder = false;
27
  }
@@ -30,7 +30,7 @@ class Securetrading_Stpp_Model_Actions_Redirect extends Securetrading_Stpp_Model
30
 
31
  public function process3dQuery(Stpp_Data_Response $response) {
32
  foreach($this->_getOrderIncrementIds($response) as $orderIncrementId) {
33
- $response->set('orderreference', $orderIncrementId);
34
  parent::process3dQuery($response);
35
  }
36
  return $this->_isErrorCodeZero($response);
@@ -38,7 +38,7 @@ class Securetrading_Stpp_Model_Actions_Redirect extends Securetrading_Stpp_Model
38
 
39
  public function processRiskDecision(Stpp_Data_Response $response) {
40
  foreach($this->_getOrderIncrementIds($response) as $orderIncrementId) {
41
- $response->set('orderreference', $orderIncrementId);
42
  parent::processRiskDecision($response);
43
  }
44
  return $this->_isErrorCodeZero($response);
@@ -46,7 +46,7 @@ class Securetrading_Stpp_Model_Actions_Redirect extends Securetrading_Stpp_Model
46
 
47
  public function processTransactionUpdate(Stpp_Data_Response $response) {
48
  foreach($this->_getOrderIncrementIds($response) as $orderIncrementId) {
49
- $response->set('orderreference', $orderIncrementId);
50
  parent::processTransactionUpdate($response);
51
  }
52
  return $this->_isErrorCodeZero($response);
@@ -54,7 +54,7 @@ class Securetrading_Stpp_Model_Actions_Redirect extends Securetrading_Stpp_Model
54
 
55
  public function processRefund(Stpp_Data_Response $response) {
56
  foreach($this->_getOrderIncrementIds($response) as $orderIncrementId) {
57
- $response->set('orderreference', $orderIncrementId);
58
  parent::processRefund($response);
59
  }
60
  return $this->_isErrorCodeZero($response);
@@ -62,7 +62,7 @@ class Securetrading_Stpp_Model_Actions_Redirect extends Securetrading_Stpp_Model
62
 
63
  public function processAccountCheck(Stpp_Data_Response $response) {
64
  foreach($this->_getOrderIncrementIds($response) as $orderIncrementId) {
65
- $response->set('orderreference', $orderIncrementId);
66
  parent::processAccountCheck($response);
67
  }
68
  return $this->_isErrorCodeZero($response);
@@ -70,12 +70,8 @@ class Securetrading_Stpp_Model_Actions_Redirect extends Securetrading_Stpp_Model
70
 
71
  public function _processAuth(Stpp_Data_Response $response, $firstOrder) {
72
  parent::processAuth($response);
73
- if ($response->get('errorcode') === '0') {
74
- $emailConfirmation = $response->getRequest()->get('accounttypedescription') === 'MOTO' ? false : true;
75
- Mage::getModel('securetrading_stpp/payment_redirect')->registerSuccessfulOrderAfterExternalRedirect($emailConfirmation);
76
- }
77
 
78
- $order = Mage::getModel('sales/order')->loadByIncrementId($response->get('orderreference'));
79
  $payment = $order->getPayment();
80
 
81
  $payment->setCcType($response->get('paymenttypedescription'));
@@ -83,6 +79,12 @@ class Securetrading_Stpp_Model_Actions_Redirect extends Securetrading_Stpp_Model
83
  $payment->save();
84
 
85
  $this->_updateOrder($response, $order, $firstOrder);
 
 
 
 
 
 
86
  }
87
 
88
  protected function _updateOrder(Stpp_Data_Response $response, Mage_Sales_Model_Order $order, $firstOrder) {
21
  public function processAuth(Stpp_Data_Response $response) {
22
  $firstOrder = true;
23
  foreach($this->_getOrderIncrementIds($response) as $orderIncrementId) {
24
+ $this->setOrder(Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId));
25
  $this->_processAuth($response, $firstOrder);
26
  $firstOrder = false;
27
  }
30
 
31
  public function process3dQuery(Stpp_Data_Response $response) {
32
  foreach($this->_getOrderIncrementIds($response) as $orderIncrementId) {
33
+ $this->setOrder(Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId));
34
  parent::process3dQuery($response);
35
  }
36
  return $this->_isErrorCodeZero($response);
38
 
39
  public function processRiskDecision(Stpp_Data_Response $response) {
40
  foreach($this->_getOrderIncrementIds($response) as $orderIncrementId) {
41
+ $this->setOrder(Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId));
42
  parent::processRiskDecision($response);
43
  }
44
  return $this->_isErrorCodeZero($response);
46
 
47
  public function processTransactionUpdate(Stpp_Data_Response $response) {
48
  foreach($this->_getOrderIncrementIds($response) as $orderIncrementId) {
49
+ $this->setOrder(Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId));
50
  parent::processTransactionUpdate($response);
51
  }
52
  return $this->_isErrorCodeZero($response);
54
 
55
  public function processRefund(Stpp_Data_Response $response) {
56
  foreach($this->_getOrderIncrementIds($response) as $orderIncrementId) {
57
+ $this->setOrder(Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId));
58
  parent::processRefund($response);
59
  }
60
  return $this->_isErrorCodeZero($response);
62
 
63
  public function processAccountCheck(Stpp_Data_Response $response) {
64
  foreach($this->_getOrderIncrementIds($response) as $orderIncrementId) {
65
+ $this->setOrder(Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId));
66
  parent::processAccountCheck($response);
67
  }
68
  return $this->_isErrorCodeZero($response);
70
 
71
  public function _processAuth(Stpp_Data_Response $response, $firstOrder) {
72
  parent::processAuth($response);
 
 
 
 
73
 
74
+ $order = $this->_getOrder($response);
75
  $payment = $order->getPayment();
76
 
77
  $payment->setCcType($response->get('paymenttypedescription'));
79
  $payment->save();
80
 
81
  $this->_updateOrder($response, $order, $firstOrder);
82
+
83
+ if ($response->get('errorcode') === '0') {
84
+ Mage::getModel('securetrading_stpp/payment_redirect')->registerSuccessfulOrderAfterExternalRedirect($order, $this->_getRequestedSettleStatus($response));
85
+ $emailConfirmation = $response->get('accounttypedescription') === 'MOTO' ? (bool) $response->get('send_confirmation') : true;
86
+ $payment->getMethodInstance()->handleSuccessfulPayment($order, $emailConfirmation);
87
+ }
88
  }
89
 
90
  protected function _updateOrder(Stpp_Data_Response $response, Mage_Sales_Model_Order $order, $firstOrder) {
app/code/local/Securetrading/Stpp/Model/Integration.php CHANGED
@@ -37,9 +37,10 @@ class Securetrading_Stpp_Model_Integration extends Mage_Core_Model_Abstract {
37
  'verifyssl' => $paymentMethod->getConfigData('ws_verify_ca'),
38
  'cacertfile' => $paymentMethod->getConfigData('ws_ca_file'),
39
  ),
40
- 'stapi' => array(
41
  'host' => $paymentMethod->getConfigData('stapi_host'),
42
  'port' => $paymentMethod->getConfigData('stapi_port'),
 
43
  ),
44
  ),
45
  'interfaces' => array(
@@ -134,21 +135,45 @@ class Securetrading_Stpp_Model_Integration extends Mage_Core_Model_Abstract {
134
  return $connections;
135
  }
136
 
137
- protected function _setOrderIncrementId($orderIncrementId) {
138
- $this->_ppagesActionInstance->setOrderIncrementId($orderIncrementId);
139
- $this->_apiActionInstance->setOrderIncrementId($orderIncrementId);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
140
  }
141
 
142
  public function runApiStandard(Mage_Sales_Model_Order_Payment $payment, $isMoto = false) {
143
  $isMoto = $payment->getOrder()->getQuote()->getIsSuperMode();
144
- $this->_setOrderIncrementId($payment->getOrder()->getIncrementId());
145
  $data = $this->getPaymentMethod()->prepareOrderData($payment);
146
  $request = Stpp_Data_Request::instance()->setMultiple($data);
147
  return $this->_apiFacade->runApiStandard($request, $isMoto);
148
  }
149
 
150
  public function runApi3dAuth() {
151
- return $this->_apiFacade->runApi3dAuth(new Stpp_Data_Request());
152
  }
153
 
154
  public function runPaymentPages(array $data, $isMoto = false) {
@@ -171,7 +196,10 @@ class Securetrading_Stpp_Model_Integration extends Mage_Core_Model_Abstract {
171
  $this->_ppagesFacade->newPaymentPages()->runNotification();
172
  }
173
 
174
- public function getAcceptedCards($use3dSecure, array $acceptedCards = array()) {
 
 
 
175
  $helper = $this->_facade->newHelper();
176
  return $helper->getFilteredCardTypes($use3dSecure, $acceptedCards);
177
  }
@@ -208,6 +236,10 @@ class Securetrading_Stpp_Model_Integration extends Mage_Core_Model_Abstract {
208
  return $array;
209
  }
210
 
 
 
 
 
211
  public function getStartYears() {
212
  return Stpp_Types::getStartYears();
213
  }
37
  'verifyssl' => $paymentMethod->getConfigData('ws_verify_ca'),
38
  'cacertfile' => $paymentMethod->getConfigData('ws_ca_file'),
39
  ),
40
+ 'api' => array(
41
  'host' => $paymentMethod->getConfigData('stapi_host'),
42
  'port' => $paymentMethod->getConfigData('stapi_port'),
43
+ 'alias' => $paymentMethod->getConfigData('stapi_alias'),
44
  ),
45
  ),
46
  'interfaces' => array(
135
  return $connections;
136
  }
137
 
138
+ protected function _setOrderToActionInstances(Mage_Sales_Model_Order $order) {
139
+ $this->_apiActionInstance->setOrder($order);
140
+ $this->_ppagesActionInstance->setOrder($order);
141
+ return $this;
142
+ }
143
+ public function runApiTransactionUpdate(Mage_Sales_Model_Order_Payment $payment, array $data) {
144
+ $this->_setOrderToActionInstances($payment->getOrder());
145
+ $filter = Stpp_Data_Request::instance()->setMultiple($data['filter']);
146
+ $updates = Stpp_Data_Request::instance()->setMultiple($data['updates']);
147
+ $request = Stpp_Data_Request::instance()->set('filter', $filter)->set('updates', $updates);
148
+ $result = $this->_apiFacade->runApiTransactionUpdate($request);
149
+
150
+ if (!$result->getIsTransactionSuccessful()) {
151
+ throw new Mage_Core_Exception($result->getErrorMessage());
152
+ }
153
+ return $this;
154
+ }
155
+
156
+ public function runApiRefund(Mage_Sales_Model_Order_Payment $payment, array $data) {
157
+ $this->_setOrderToActionInstances($payment->getOrder());
158
+ $request = Stpp_Data_Request::instance()->setMultiple($data);
159
+ $result = $this->_apiFacade->runApiRefund($request);
160
+
161
+ if (!$result->getIsTransactionSuccessful()) {
162
+ throw new Mage_Core_Exception('The gateway did not process the refund successfully.');
163
+ }
164
+ return $this;
165
  }
166
 
167
  public function runApiStandard(Mage_Sales_Model_Order_Payment $payment, $isMoto = false) {
168
  $isMoto = $payment->getOrder()->getQuote()->getIsSuperMode();
169
+ $this->_setOrderToActionInstances($payment->getOrder());
170
  $data = $this->getPaymentMethod()->prepareOrderData($payment);
171
  $request = Stpp_Data_Request::instance()->setMultiple($data);
172
  return $this->_apiFacade->runApiStandard($request, $isMoto);
173
  }
174
 
175
  public function runApi3dAuth() {
176
+ return $this->_apiFacade->runApi3dAuth(new Stpp_Data_Request());
177
  }
178
 
179
  public function runPaymentPages(array $data, $isMoto = false) {
196
  $this->_ppagesFacade->newPaymentPages()->runNotification();
197
  }
198
 
199
+ public function getAcceptedCards($use3dSecure, $acceptedCards = array()) {
200
+ if (!is_array($acceptedCards)) {
201
+ $acceptedCards = array();
202
+ }
203
  $helper = $this->_facade->newHelper();
204
  return $helper->getFilteredCardTypes($use3dSecure, $acceptedCards);
205
  }
236
  return $array;
237
  }
238
 
239
+ public function getRefundTransactionName() {
240
+ return Stpp_Types::API_REFUND;
241
+ }
242
+
243
  public function getStartYears() {
244
  return Stpp_Types::getStartYears();
245
  }
app/code/local/Securetrading/Stpp/Model/Observer.php CHANGED
@@ -7,49 +7,29 @@ class Securetrading_Stpp_Model_Observer {
7
 
8
  if ($methodInstance->getIsSecuretradingPaymentMethod()) {
9
  $methodInstance->log(sprintf('In %s.', __METHOD__));
10
-
11
- $orders = $observer->getEvent()->getOrders();
12
 
13
- if ($orders) {
 
14
  $methodInstance->log('Multishipping checkout.');
15
- $this->_onCheckoutSubmitAllAfter_Multishipping($orders, $quote);
16
  }
17
  else {
18
  $orderIncomplete = (bool) $quote->getPayment()->getOrderPlaceRedirectUrl();
19
- $methodInstance->log(sprintf('One page checkout. Order incomplete: %s.', __METHOD__, $orderIncomplete));
20
- $this->_onCheckoutSubmitAllAfter_Onepage($observer->getEvent()->getOrder(), $quote, $orderIncomplete);
 
 
 
21
  }
22
  }
23
  }
24
-
25
- protected function _onCheckoutSubmitAllAfter_orderLoop(Mage_Sales_Model_Order $order, Mage_Sales_Model_Quote $quote, $orderIncomplete = false) {
26
- $collection = $order->getStatusHistoryCollection(true);
27
- foreach($collection as $c) {
28
- $c->delete();
29
- }
30
-
31
- if ($orderIncomplete) {
32
- $stateObject = Mage::getSingleton('securetrading_stpp/transport');
33
- $order->setState($stateObject->getState(), $stateObject->getStatus(), $stateObject->getMessage());
34
- $order->save();
35
-
36
- $quote->setIsActive(true)->save();
37
- }
38
- else {
39
- Mage::getModel('securetrading_stpp/payment_direct')->handleSuccessfulPayment($order);
40
- }
41
- }
42
-
43
- protected function _onCheckoutSubmitAllAfter_Multishipping($orders, Mage_Sales_Model_Quote $quote) {
44
- foreach($orders as $order) {
45
- $this->_onCheckoutSubmitAllAfter_orderLoop($order, $quote, true);
46
- }
47
- }
48
-
49
- protected function _onCheckoutSubmitAllAfter_Onepage(Mage_Sales_Model_Order $order, Mage_Sales_Model_Quote $quote, $orderIncomplete) {
50
- $this->_onCheckoutSubmitAllAfter_orderLoop($order, $quote, $orderIncomplete);
51
- }
52
-
53
  public function onPaymentInfoBlockPrepareSpecificInformation(Varien_Event_Observer $observer) {
54
  if (!$observer->getEvent()->getPayment()->getMethodInstance()->getIsSecuretradingPaymentMethod()) {
55
  return;
@@ -81,11 +61,4 @@ class Securetrading_Stpp_Model_Observer {
81
  $transport->setData('issue_number', $payment->getCcSsIssue());
82
  $transport->setData('transaction_reference', $payment->getCcTransId());
83
  }
84
-
85
- public function onCheckoutTypeMultishippingCreateOrdersSingle(Varien_Event_Observer $observer) {
86
- if (!$observer->getEvent()->getOrder()->getPayment()->getMethodInstance()->getIsSecuretradingPaymentMethod()) {
87
- return;
88
- }
89
- $observer->getEvent()->getOrder()->setCanSendNewEmailFlag(false)->save();
90
- }
91
  }
7
 
8
  if ($methodInstance->getIsSecuretradingPaymentMethod()) {
9
  $methodInstance->log(sprintf('In %s.', __METHOD__));
 
 
10
 
11
+ if ($observer->getEvent()->getOrders()) { // Multishipping checkout.
12
+ $orderIncomplete = true;
13
  $methodInstance->log('Multishipping checkout.');
 
14
  }
15
  else {
16
  $orderIncomplete = (bool) $quote->getPayment()->getOrderPlaceRedirectUrl();
17
+ $methodInstance->log(sprintf('One page checkout. Order incomplete: %s.', $orderIncomplete));
18
+ }
19
+
20
+ if ($orderIncomplete) {
21
+ $quote->setIsActive(true)->save();
22
  }
23
  }
24
  }
25
+
26
+ public function onCheckoutTypeMultishippingCreateOrdersSingle(Varien_Event_Observer $observer) {
27
+ if (!$observer->getEvent()->getOrder()->getPayment()->getMethodInstance()->getIsSecuretradingPaymentMethod()) {
28
+ return;
29
+ }
30
+ $observer->getEvent()->getOrder()->setCanSendNewEmailFlag(false)->save();
31
+ }
32
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  public function onPaymentInfoBlockPrepareSpecificInformation(Varien_Event_Observer $observer) {
34
  if (!$observer->getEvent()->getPayment()->getMethodInstance()->getIsSecuretradingPaymentMethod()) {
35
  return;
61
  $transport->setData('issue_number', $payment->getCcSsIssue());
62
  $transport->setData('transaction_reference', $payment->getCcTransId());
63
  }
 
 
 
 
 
 
 
64
  }
app/code/local/Securetrading/Stpp/Model/Payment/Abstract.php CHANGED
@@ -28,7 +28,7 @@ abstract class Securetrading_Stpp_Model_Payment_Abstract extends Mage_Payment_Mo
28
  return $this;
29
  }
30
 
31
- public function prepareOrderData(Mage_Sales_Model_Order_Payment $payment, array $orderIncrementIds) {
32
  $order = $payment->getOrder();
33
  $billingAddress = $order->getBillingAddress();
34
  $billingCounty = $billingAddress->getCountry() == 'US' ? $billingAddress->getRegionCode() : $billingAddress->getRegion();
@@ -96,34 +96,30 @@ abstract class Securetrading_Stpp_Model_Payment_Abstract extends Mage_Payment_Mo
96
  return $data;
97
  }
98
 
99
- public function registerSuccessfulOrderAfterExternalRedirect($emailConfirmation = true) {
100
  $this->log(sprintf('In %s.', __METHOD__));
101
- $stateObject = Mage::getSingleton('securetrading_stpp/transport');
102
- $order = Mage::getModel('sales/order')->loadByIncrementId($stateObject->getOrderReference());
103
- $this->handleSuccessfulPayment($order, $emailConfirmation);
104
- }
105
-
106
- public function handleSuccessfulPayment(Mage_Sales_Model_Order $order, $emailConfirmation = true) {
107
- $this->log(sprintf('In %s.', __METHOD__));
108
- $quote = Mage::getModel('sales/quote')->loadByIdWithoutStore($order->getQuoteId());
109
- $stateObject = Mage::getSingleton('securetrading_stpp/transport');
110
- if ($quote->getIsActive()) {
111
- $quote->setIsActive(false)->save();
112
- }
113
- $order->setState($stateObject->getState(), $stateObject->getStatus(), $stateObject->getMessage());
114
- $order->save();
115
 
116
- if ($stateObject->getState() === Mage_Sales_Model_Order::STATE_PROCESSING && $stateObject->getStatus() === Mage::getModel('sales/order')->getConfig()->getStateDefaultStatus($stateObject->getState())) {
117
- $invoice = $order->prepareInvoice()->register()->pay();
118
- $order->addRelatedObject($invoice)->save();
119
  }
120
-
121
- $order->getPayment()
122
- ->setAdditionalInformation($stateObject->getAdditionalInformation())
123
- ->setCcTransId($stateObject->getTransactionReference())
124
- ->setCcLast4($this->getIntegration()->getCcLast4($stateObject->getMaskedPan()))
125
- ->save()
126
- ;
 
 
 
 
 
 
 
 
 
127
 
128
  if ($emailConfirmation) {
129
  $order->sendNewOrderEmail()->save(); // Send last - even if notif times out order status updated etc. and payment information updated.
28
  return $this;
29
  }
30
 
31
+ public function prepareOrderData(Mage_Sales_Model_Order_Payment $payment, array $orderIncrementIds, $sendEmailConfirmation = true) {
32
  $order = $payment->getOrder();
33
  $billingAddress = $order->getBillingAddress();
34
  $billingCounty = $billingAddress->getCountry() == 'US' ? $billingAddress->getRegionCode() : $billingAddress->getRegion();
96
  return $data;
97
  }
98
 
99
+ public function registerSuccessfulOrderAfterExternalRedirect(Mage_Sales_Model_Order $order, $requestedSettleStatus) {
100
  $this->log(sprintf('In %s.', __METHOD__));
101
+
102
+ $amount = $order->getPayment()->getBaseAmountOrdered();
 
 
 
 
 
 
 
 
 
 
 
 
103
 
104
+ if (in_array($requestedSettleStatus, array('0', '1', '100'))) {
105
+ $order->getPayment()->registerCaptureNotification($amount, true);
 
106
  }
107
+ elseif($requestedSettleStatus === '2') {
108
+ $order->getPayment()->registerAuthorizationNotification($amount);
109
+ }
110
+ else {
111
+ throw new Exception(sprintf('Invalid settle status: %s', $requestedSettleStatus));
112
+ }
113
+ $order->save();
114
+ }
115
+
116
+ public function handleSuccessfulPayment(Mage_Sales_Model_Order $order, $emailConfirmation) {
117
+ $this->log(sprintf('In %s.', __METHOD__));
118
+ $quote = Mage::getModel('sales/quote')->loadByIdWithoutStore($order->getQuoteId());
119
+
120
+ if ($quote->getIsActive()) {
121
+ $quote->setIsActive(false)->save();
122
+ }
123
 
124
  if ($emailConfirmation) {
125
  $order->sendNewOrderEmail()->save(); // Send last - even if notif times out order status updated etc. and payment information updated.
app/code/local/Securetrading/Stpp/Model/Payment/Direct.php CHANGED
@@ -8,60 +8,324 @@ class Securetrading_Stpp_Model_Payment_Direct extends Securetrading_Stpp_Model_P
8
  protected $_isGateway = false;
9
  protected $_canOrder = false;
10
  protected $_canAuthorize = true;
11
- protected $_canCapture = false;
12
- protected $_canCapturePartial = false;
13
- protected $_canRefund = false;
14
- protected $_canRefundInvoicePartial = false;
15
  protected $_canVoid = false;
16
- protected $_canUseInternal = true;
17
- protected $_canUseCheckout = true;
18
  protected $_canUseForMultishipping = false;
19
  protected $_isInitializeNeeded = true;
20
  protected $_canFetchTransactionInfo = false;
21
- protected $_canReviewPayment = false;
22
  protected $_canCreateBillingAgreement = false;
23
  protected $_canManageRecurringProfiles = false;
24
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  public function initialize($action, $stateObject) {
26
- $this->log(sprintf('In %s. Action is %s.', __METHOD__, $action));
27
- $payment = $this->getInfoInstance();
28
- $order = $payment->getOrder();
29
-
30
- switch ($action) {
31
- case Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE:
32
- $payment->authorize(true, $order->getBaseTotalDue());
33
- $payment->setAmountAuthorized($order->getTotalDue());
34
- break;
35
- case Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE_CAPTURE:
36
- $payment->setAmountAuthorized($order->getTotalDue());
37
- $payment->setBaseAmountAuthorized($order->getBaseTotalDue());
38
- $payment->capture(null);
39
- break;
40
- default:
41
- break;
42
- }
43
- return $this;
 
 
 
 
 
 
 
 
 
44
  }
45
 
46
  public function authorize(Varien_Object $payment, $amount) {
47
  $this->log(sprintf('In %s.', __METHOD__));
48
  parent::authorize($payment, $amount);
49
  $result = $this->getIntegration()->runApiStandard($payment);
50
- $this->handleStandardPaymentResult($result);
51
  return $this;
52
  }
53
 
54
  public function capture(Varien_Object $payment, $amount) {
55
  $this->log(sprintf('In %s.', __METHOD__));
56
  parent::capture($payment, $amount);
57
- $result = $this->getIntegration()->runApiStandard($payment);
58
- $this->handleStandardPaymentResult($result);
 
 
 
 
 
59
  return $this;
60
  }
61
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
  public function getOrderPlaceRedirectUrl() {
63
  $session = Mage::getSingleton('securetrading_stpp/payment_direct_session');
64
  $acsParamsExist = $session->hasAcsRedirectParams();
 
65
  $this->log(sprintf('In %s. ACS Params exist: %s.', __METHOD__, $acsParamsExist));
66
 
67
  if ($acsParamsExist) {
@@ -84,8 +348,9 @@ class Securetrading_Stpp_Model_Payment_Direct extends Securetrading_Stpp_Model_P
84
  return $this;
85
  }
86
 
87
- public function prepareOrderData(Mage_Sales_Model_Order_Payment $payment, array $orderIncrementIds) {//TODO - the api module must pass this new 2nd param through
88
- $data = parent::prepareOrderData($payment, $orderIncrementIds);
 
89
  $payment = $this->getInfoInstance();
90
 
91
  return $data += array(
@@ -99,35 +364,9 @@ class Securetrading_Stpp_Model_Payment_Direct extends Securetrading_Stpp_Model_P
99
  );
100
  }
101
 
102
- public function handleStandardPaymentResult(Stpp_Api_ResultInterface $result) {
103
- $this->log(sprintf('In %s.', __METHOD__));
104
- if ($result->getRedirectRequired()) {
105
- Mage::getSingleton('securetrading_stpp/transport')->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT)->setStatus(Securetrading_Stpp_Model_Payment_Abstract::STATUS_PENDING_3DSECURE)->setMessage("Customer redirected to the 3D Secure ACS URL.");
106
- $redirectPath = $this->getConfigData('api_use_iframe') ? 'securetrading/direct_post/iframe' : 'securetrading/direct_post/container';
107
- $params = new Varien_Object();
108
- $params
109
- ->setOrderPlaceRedirectUrl(Mage::getUrl($redirectPath))
110
- ->setRedirectIsPost($result->getRedirectIsPost())
111
- ->setRedirectUrl($result->getRedirectUrl())
112
- ->setRedirectData($result->getRedirectData())
113
- ;
114
- Mage::getSingleton('securetrading_stpp/payment_direct_session')->setAcsRedirectParams($params);
115
- }
116
- elseif(!$result->getIsTransactionSuccessful()) {
117
- throw new Mage_Payment_Model_Info_Exception($result->getCustomerErrorMessage());
118
- }
119
- return $this;
120
- }
121
-
122
  public function run3dAuth() {
123
- $this->log(sprintf('In %s.', __METHOD__));
124
- $result = $this->getIntegration()->runApi3dAuth();
125
-
126
- if($result->getIsTransactionSuccessful()) {
127
- $this->registerSuccessfulOrderAfterExternalRedirect();
128
- return true;
129
- }
130
- return false;
131
  }
132
 
133
  public function handleSuccessfulPayment(Mage_Sales_Model_Order $order, $emailConfirmation = true) {
8
  protected $_isGateway = false;
9
  protected $_canOrder = false;
10
  protected $_canAuthorize = true;
11
+ protected $_canCapture = true;
12
+ protected $_canCapturePartial = true;
13
+ protected $_canRefund = true;
14
+ protected $_canRefundInvoicePartial = true;
15
  protected $_canVoid = false;
16
+ protected $_canUseInternal = false;
17
+ protected $_canUseCheckout = false;
18
  protected $_canUseForMultishipping = false;
19
  protected $_isInitializeNeeded = true;
20
  protected $_canFetchTransactionInfo = false;
21
+ protected $_canReviewPayment = true;
22
  protected $_canCreateBillingAgreement = false;
23
  protected $_canManageRecurringProfiles = false;
24
 
25
+ protected $_stateObject;
26
+ protected $_readyforAcsRedirect = false;
27
+ protected static $_reviewingIncrementIds = array();
28
+
29
+ protected function _setStateObject(Varien_Object $stateObject) {
30
+ $this->_stateObject = $stateObject;
31
+ }
32
+
33
+ protected function _getStateObject() {
34
+ if ($this->_stateObject === null) {
35
+ throw new Exception(Mage::helper('securetrading_stpp')->__('The state object has not been set.'));
36
+ }
37
+ return $this->_stateObject;
38
+ }
39
+
40
+ protected function _setReadyForAcsUrlRedirect($bool) {
41
+ $this->_readyforAcsRedirect = (bool) $bool;
42
+ return $this;
43
+ }
44
+ protected function _getReadyForAcsUrlRedirect() {
45
+ return (bool) $this->_readyforAcsRedirect;
46
+ }
47
+
48
  public function initialize($action, $stateObject) {
49
+ $this->_setStateObject($stateObject);
50
+ $payment = $this->getInfoInstance();
51
+ $order = $payment->getOrder();
52
+
53
+ switch ($action) {
54
+ case Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE:
55
+ $payment->_authorize(true, $order->getBaseTotalDue()); // base amount will be set inside
56
+ $payment->setAmountAuthorized($order->getTotalDue());
57
+ break;
58
+ case Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE_CAPTURE:
59
+ $payment->setAmountAuthorized($order->getTotalDue());
60
+ $payment->setBaseAmountAuthorized($order->getBaseTotalDue());
61
+ $payment->capture(null);
62
+ break;
63
+ default:
64
+ throw new Exception(sprintf(Mage::helper('securetrading_stpp')->__('Invalid payment action: "%s".')));
65
+ }
66
+ }
67
+
68
+ public function processInvoice($invoice, $payment) {
69
+ if ($this->_getReadyForAcsUrlRedirect()) {
70
+ foreach($this->getInfoInstance()->getOrder()->getStatusHistoryCollection(true) as $c) {
71
+ $c->delete();
72
+ }
73
+ $invoice->cancel();
74
+ $invoice->setIsPaid(false); // when $invoice->pay() is called after this function this stops it from setting the order to paid.
75
+ }
76
  }
77
 
78
  public function authorize(Varien_Object $payment, $amount) {
79
  $this->log(sprintf('In %s.', __METHOD__));
80
  parent::authorize($payment, $amount);
81
  $result = $this->getIntegration()->runApiStandard($payment);
82
+ $this->_handleStandardPaymentResult($result);
83
  return $this;
84
  }
85
 
86
  public function capture(Varien_Object $payment, $amount) {
87
  $this->log(sprintf('In %s.', __METHOD__));
88
  parent::capture($payment, $amount);
89
+
90
+ if ($payment->lookupTransaction('', Mage_Sales_Model_Order_Payment_Transaction::TYPE_AUTH)) {
91
+ $this->captureAuthorized($payment, $amount);
92
+ }
93
+ else {
94
+ $this->_authAndCapture($payment);
95
+ }
96
  return $this;
97
  }
98
 
99
+ protected function _paymentHasSuccessfulRefund(Mage_Sales_Model_Order_Payment $payment) {
100
+ $refundTransaction = $payment->lookupTransaction('', Mage_Sales_Model_Order_Payment_Transaction::TYPE_REFUND);
101
+ if ($refundTransaction) {
102
+ $securetradingRefundTransaction = Mage::getModel('securetrading_stpp/transaction')->loadByTransactionReference($refundTransaction->getTxnId(), true);
103
+ if ($securetradingRefundTransaction && $securetradingRefundTransaction->getRequestType() === Securetrading_Stpp_Model_Transaction_Types::TYPE_REFUND) {
104
+ return true;
105
+ }
106
+ }
107
+ return false;
108
+ }
109
+
110
+ public function refund(Varien_Object $payment, $amount) {
111
+ $parentTransactionId = $immediateParentTransactionId = $payment->getParentTransactionId();
112
+ if (!$parentTransactionId) {
113
+ throw new Mage_Core_Exception('No parent transaction ID has been set to the payment info instance. This should always be set when a "Capture" transaction exists in the core transaction table.');
114
+ }
115
+
116
+ $transaction = $payment->lookupTransaction($parentTransactionId);
117
+
118
+ if ($authTransactionId = $transaction->getParentTxnId()) { // If transaction (A) has parent (B) then A = TRANSACTIONUPDATE and B = AUTH. Otherwise if transaction (A) has no parent then A = AUTH. This code sets $parentTransactionId to have the transaction reference of the AUTH.
119
+ $parentTransactionId = $authTransactionId;
120
+ }
121
+
122
+ $transactionReference = $payment->getCcTransId();
123
+ $orderIncrementIds = $this->_getOrderIncrementIds($transactionReference);
124
+
125
+ if ($orderIncrementIds) {
126
+ $partialRefundAlreadyProcessed = null;
127
+ $orderBaseGrandTotal = null;
128
+ $baseTotalPaid = null;
129
+ $baseTotalRefunded = null;
130
+
131
+ foreach($orderIncrementIds as $orderIncrementId) {
132
+ $tempPayment = Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId)->getPayment();
133
+
134
+ if ($partialRefundAlreadyProcessed !== true) {
135
+ $partialRefundAlreadyProcessed = $this->_paymentHasSuccessfulRefund($tempPayment);
136
+ }
137
+
138
+ $orderBaseGrandTotal += $tempPayment->getOrder()->getBaseGrandTotal();
139
+ $baseTotalPaid += $tempPayment->getOrder()->getBaseTotalPaid();
140
+ $baseTotalRefunded += $tempPayment->getOrder()->getBaseTotalRefunded();
141
+ }
142
+ }
143
+ else {
144
+ $partialRefundAlreadyProcessed = $this->_paymentHasSuccessfulRefund($payment);
145
+ $orderBaseGrandTotal = $payment->getOrder()->getBaseGrandTotal();
146
+ $baseTotalPaid = $payment->getOrder()->getBaseTotalPaid();
147
+ $baseTotalRefunded = $payment->getOrder()->getBaseTotalRefunded() - $amount; // Before this method is called this happens: $payment->getOrder->setBaseTotalRefunded($payment->getOrder()->getBaseTotalRefunded() - $amount). That's why we subtract the $amount here - but don't for multishipping above (because we load new temporary orders when multishipping is being calculated.
148
+ }
149
+
150
+ $data = array(
151
+ 'original_order_total' => $orderBaseGrandTotal, // Total of original AUTH.
152
+ 'order_total_paid' => $baseTotalPaid, // How much has been captured from the AUTH (do not consider how much has been refunded via TU or REFUND).
153
+ 'order_total_refunded' => $baseTotalRefunded, // How much has been refunded via TU or REFUND.
154
+ 'amount_to_refund' => $amount,
155
+ 'partial_refund_already_processed' => $partialRefundAlreadyProcessed,
156
+ 'site_reference' => $this->getConfigData('site_reference'),
157
+ 'transaction_reference' => $parentTransactionId,
158
+ 'using_main_amount' => true,
159
+ 'currency_iso_3a' => $payment->getOrder()->getBaseCurrencyCode(),
160
+ 'allow_suspend' => true,
161
+ );
162
+
163
+ $this->getIntegration()->runApiRefund($payment, $data);
164
+ $payment->setParentTransactionId($immediateParentTransactionId); // Ensure the parent transaction reference stored in the core transaction is not the core Authorization.
165
+ return $this;
166
+ }
167
+
168
+ public function cancel(Varien_Object $payment) {
169
+ return $this; // Do nothing intentionally.
170
+ }
171
+
172
+ public function denyPayment(Mage_Payment_Model_Info $payment) {
173
+ parent::denyPayment($payment);
174
+
175
+ if (!empty(self::$_reviewingIncrementIds)) {
176
+ $payment->setShouldCloseParentTransaction(true);
177
+ $payment->addTransaction(Mage_Sales_Model_Order_Payment_Transaction::TYPE_VOID);
178
+ }
179
+ else {
180
+ $transactionReference = $payment->getCcTransId();
181
+ $orderIncrementIds = $this->_getOrderIncrementIds($transactionReference);
182
+
183
+ if ($orderIncrementIds) {
184
+ $this->_updateSettleStatus($payment, '3');
185
+ self::$_reviewingIncrementIds = $orderIncrementIds;
186
+ foreach($orderIncrementIds as $orderIncrementId) {
187
+ $order = Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId);
188
+ $order->getPayment()->deny();
189
+ $order->save();
190
+ }
191
+ self::$_reviewingIncrementIds = array();
192
+ }
193
+ else {
194
+ $this->_updateSettleStatus($payment, '3');
195
+ $payment->setShouldCloseParentTransaction(true);
196
+ $payment->addTransaction(Mage_Sales_Model_Order_Payment_Transaction::TYPE_VOID);
197
+ }
198
+ }
199
+ return true;
200
+ }
201
+
202
+ public function acceptPayment(Mage_Payment_Model_Info $payment) {
203
+ parent::acceptPayment($payment);
204
+
205
+ if (!empty(self::$_reviewingIncrementIds)) {
206
+ return true;
207
+ }
208
+
209
+ $transactionReference = $payment->getCcTransId();
210
+ $orderIncrementIds = $this->_getOrderIncrementIds($transactionReference);
211
+
212
+ if ($orderIncrementIds) {
213
+ self::$_reviewingIncrementIds = $orderIncrementIds;
214
+ foreach($orderIncrementIds as $orderIncrementId) {
215
+ $order = Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId);
216
+ $order->getPayment()->accept();
217
+ $order->save();
218
+ }
219
+ self::$_reviewingIncrementIds = array();
220
+ }
221
+
222
+ $transaction = Mage::getModel('securetrading_stpp/transaction')->loadByTransactionReference($payment->getLastTransId());
223
+ $requestedSettleStatus = $transaction->getRequestData('settlestatus');
224
+
225
+ if ($requestedSettleStatus !== '2') { // If the requested settlestatus was 2 there is no need to update the payment (an order should only be put into payment review when the response settlestatus == 2).
226
+ $this->_updateSettleStatus($payment, $requestedSettleStatus);
227
+ }
228
+ return true;
229
+ }
230
+
231
+ protected function _getOrderIncrementIds($transactionReference) {
232
+ $transaction = Mage::getModel('securetrading_stpp/transaction')->loadByTransactionReference($transactionReference);
233
+ $orderIncrementIds = $transaction->getRequestData('order_increment_ids', null);
234
+
235
+ if ($orderIncrementIds) {
236
+ $orderIncrementIds = unserialize($orderIncrementIds);
237
+ }
238
+ if ($orderIncrementIds && count($orderIncrementIds) > 1) {
239
+ return $orderIncrementIds;
240
+ }
241
+ return null;
242
+ }
243
+
244
+ public function captureAuthorized(Mage_Sales_Model_Order_Payment $payment, $amount) {
245
+ $transactionReference = $payment->getCcTransId();
246
+ $orderIncrementIds = $this->_getOrderIncrementIds($transactionReference);
247
+ if ($orderIncrementIds) {
248
+ $orderBaseGrandTotal = null;
249
+ $baseAmountPaid = null;
250
+ $baseAmountRefunded = null;
251
+ foreach($orderIncrementIds as $orderIncrementId) {
252
+ $order = Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId);
253
+ $orderBaseGrandTotal = $order->getBaseGrandTotal();
254
+ $baseAmountPaid += $order->getPayment()->getBaseAmountPaid();
255
+ $baseAmountRefunded += $order->getPayment()->getBaseAmountRefunded();
256
+ }
257
+ $orderBaseGrandTotal = (string) Mage::app()->getStore()->roundPrice($orderBaseGrandTotal);
258
+ $baseAmountPaid = (string) Mage::app()->getStore()->roundPrice($baseAmountPaid);
259
+ $baseAmountRefunded = (string) Mage::app()->getStore()->roundPrice($baseAmountRefunded);
260
+ }
261
+ else {
262
+ $orderBaseGrandTotal = (string) Mage::app()->getStore()->roundPrice($payment->getOrder()->getBaseGrandTotal());
263
+ $baseAmountPaid = (string) Mage::app()->getStore()->roundPrice($payment->getBaseAmountPaid());
264
+ $baseAmountRefunded = (string) Mage::app()->getStore()->roundPrice($payment->getBaseAmountRefunded());
265
+ }
266
+ $amountToCapture = (string) $amount;
267
+ $updates = array('settlestatus' => '0');
268
+
269
+ if ($amountToCapture !== $orderBaseGrandTotal) {
270
+ $updates['settlemainamount'] = ($baseAmountPaid + $amountToCapture) - $baseAmountRefunded;
271
+ $updates['currencyiso3a'] = $payment->getOrder()->getBaseCurrencyCode();
272
+ }
273
+
274
+ $data = $this->_prepareTransactionUpdate($payment, $updates);
275
+ $this->getIntegration()->runApiTransactionUpdate($payment, $data);
276
+ return $this;
277
+ }
278
+
279
+ protected function _handleStandardPaymentResult(Stpp_Api_ResultInterface $result) {
280
+ $this->log(sprintf('In %s.', __METHOD__));
281
+ if ($result->getRedirectRequired()) {
282
+ $this->_setReadyForAcsUrlRedirect(true);
283
+ $this->_getStateObject()->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT)->setStatus(Securetrading_Stpp_Model_Payment_Abstract::STATUS_PENDING_3DSECURE);
284
+
285
+ $redirectPath = $this->getConfigData('api_use_iframe') ? 'securetrading/direct_post/iframe' : 'securetrading/direct_post/container';
286
+ $params = new Varien_Object();
287
+ $params
288
+ ->setOrderPlaceRedirectUrl(Mage::getUrl($redirectPath))
289
+ ->setRedirectIsPost($result->getRedirectIsPost())
290
+ ->setRedirectUrl($result->getRedirectUrl())
291
+ ->setRedirectData($result->getRedirectData())
292
+ ;
293
+ Mage::getSingleton('securetrading_stpp/payment_direct_session')->setAcsRedirectParams($params);
294
+ }
295
+ elseif(!$result->getIsTransactionSuccessful()) {
296
+ throw new Mage_Payment_Model_Info_Exception($result->getErrorMessage());
297
+ }
298
+ return $this;
299
+ }
300
+
301
+ protected function _updateSettleStatus(Mage_Payment_Model_Info $payment, $settleStatus) {
302
+ $updates = array('settlestatus' => $settleStatus);
303
+ $data = $this->_prepareTransactionUpdate($payment, $updates);
304
+ $this->getIntegration()->runApiTransactionUpdate($payment, $data);
305
+ return $this;
306
+ }
307
+
308
+ protected function _prepareTransactionUpdate(Mage_Sales_Model_Order_Payment $payment, $updates) {
309
+ $data = array(
310
+ 'filter' => array(
311
+ 'sitereference' => $this->getConfigData('site_reference'),
312
+ 'transactionreference' => $payment->getCcTransId(),
313
+ ),
314
+ 'updates' => $updates
315
+ );
316
+ return $data;
317
+ }
318
+
319
+ protected function _authAndCapture(Mage_Sales_Model_Order_Payment $payment) {
320
+ $result = $this->getIntegration()->runApiStandard($payment);
321
+ $this->_handleStandardPaymentResult($result);
322
+ return $this;
323
+ }
324
+
325
  public function getOrderPlaceRedirectUrl() {
326
  $session = Mage::getSingleton('securetrading_stpp/payment_direct_session');
327
  $acsParamsExist = $session->hasAcsRedirectParams();
328
+
329
  $this->log(sprintf('In %s. ACS Params exist: %s.', __METHOD__, $acsParamsExist));
330
 
331
  if ($acsParamsExist) {
348
  return $this;
349
  }
350
 
351
+ public function prepareOrderData(Mage_Sales_Model_Order_Payment $payment, array $orderIncrementIds = array(), $sendEmailConfirmation = true) {
352
+ $orderIncrementIds = array($payment->getOrder()->getId() => $payment->getOrder()->getIncrementId());
353
+ $data = parent::prepareOrderData($payment, $orderIncrementIds);
354
  $payment = $this->getInfoInstance();
355
 
356
  return $data += array(
364
  );
365
  }
366
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
367
  public function run3dAuth() {
368
+ $this->log(sprintf('In %s.', __METHOD__));
369
+ return $this->getIntegration()->runApi3dAuth()->getIsTransactionSuccessful();
 
 
 
 
 
 
370
  }
371
 
372
  public function handleSuccessfulPayment(Mage_Sales_Model_Order $order, $emailConfirmation = true) {
app/code/local/Securetrading/Stpp/Model/Payment/Redirect.php CHANGED
@@ -10,7 +10,7 @@ class Securetrading_Stpp_Model_Payment_Redirect extends Securetrading_Stpp_Model
10
  protected $_canAuthorize = false;
11
  protected $_canCapture = true;
12
  protected $_canCapturePartial = false;
13
- protected $_canRefund = false;
14
  protected $_canRefundInvoicePartial = false;
15
  protected $_canVoid = false;
16
  protected $_canUseInternal = true;
@@ -20,26 +20,34 @@ class Securetrading_Stpp_Model_Payment_Redirect extends Securetrading_Stpp_Model
20
  protected $_canFetchTransactionInfo = false;
21
  protected $_canReviewPayment = true;
22
  protected $_canCreateBillingAgreement = false;
23
- protected $_canManageRecurringProfiles = false;
 
 
 
 
 
 
 
 
 
 
24
 
25
  public function initialize($action, $stateObject) {
26
  $this->log(sprintf('In %s.', __METHOD__));
27
  parent::initialize($action, $stateObject);
28
- Mage::getSingleton('securetrading_stpp/transport')->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT)->setStatus(Securetrading_Stpp_Model_Payment_Abstract::STATUS_PENDING_PPAGES)->setMessage("Customer redirect to the SecureTrading Payment Pages.");
29
  }
30
 
31
  public function acceptPayment(Mage_Payment_Model_Info $payment) {
32
  $this->log(sprintf('In %s.', __METHOD__));
33
  parent::acceptPayment($payment);
34
- $invoice = $payment->getOrder()->prepareInvoice()->register()->pay();
35
- $payment->getOrder()->addRelatedObject($invoice)->save();
36
- return true;
37
  }
38
 
39
  public function denyPayment(Mage_Payment_Model_Info $payment) {
40
  $this->log(sprintf('In %s.', __METHOD__));
41
  parent::denyPayment($payment);
42
- return true;
43
  }
44
 
45
  protected function _useFirstPathIfIframe($path1, $path2) {
@@ -53,6 +61,7 @@ class Securetrading_Stpp_Model_Payment_Redirect extends Securetrading_Stpp_Model
53
  $this->log(sprintf('In %s.', __METHOD__));
54
  return Mage::getUrl($this->getOrderPlaceRedirectPath());
55
  }
 
56
  public function getOrderPlaceRedirectPath() {
57
  $this->log(sprintf('In %s.', __METHOD__));
58
  return $this->_useFirstPathIfIframe('securetrading/redirect_post_onepage/iframe', 'securetrading/redirect_post_onepage/container');
@@ -67,24 +76,49 @@ class Securetrading_Stpp_Model_Payment_Redirect extends Securetrading_Stpp_Model
67
  return $this->_useFirstPathIfIframe('*/sales_order_create_securetrading/iframe', '*/sales_order_create_securetrading/post');
68
  }
69
 
70
- public function prepareOrderData(Mage_Sales_Model_Order_Payment $payment, array $orderIncrementIds) {
71
  $this->log(sprintf('In %s.', __METHOD__));
72
  $data = parent::prepareOrderData($payment, $orderIncrementIds);
73
 
74
  return $data += array(
75
- 'storeid' => $payment->getOrder()->getStoreId(),
76
- 'parentcss' => $this->getConfigData('parent_css'),
77
- 'childcss' => $this->getConfigData('child_css'),
78
- 'parentjs' => $this->getConfigData('parent_js'),
79
- 'childjs' => $this->getConfigData('child_js'),
80
- '_charset_' => Mage::getStoreConfig('design/head/default_charset'),
81
- 'order_increment_ids' => serialize($orderIncrementIds),
 
82
  );
83
  }
84
 
85
- public function prepareData($isMoto = false, array $orderIncrementIds) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
  $this->log(sprintf('In %s.', __METHOD__));
87
- $data = $this->prepareOrderData($this->getInfoInstance(), $orderIncrementIds);
88
  $transport = $this->getIntegration()->runPaymentPages($data, $isMoto);
89
  return $transport;
90
  }
10
  protected $_canAuthorize = false;
11
  protected $_canCapture = true;
12
  protected $_canCapturePartial = false;
13
+ protected $_canRefund = false;
14
  protected $_canRefundInvoicePartial = false;
15
  protected $_canVoid = false;
16
  protected $_canUseInternal = true;
20
  protected $_canFetchTransactionInfo = false;
21
  protected $_canReviewPayment = true;
22
  protected $_canCreateBillingAgreement = false;
23
+ protected $_canManageRecurringProfiles = false;
24
+
25
+ public function __construct() {
26
+ if ($this->getConfigData('use_api')) {
27
+ $this->_canCapturePartial = true;
28
+ $this->_canRefund = true;
29
+ $this->_canRefundInvoicePartial = true;
30
+
31
+ $this->_canUseForMultishipping = $this->getConfigData('payment_action') !== Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE; // Disable MultiShipping if Auth Only (3237).
32
+ }
33
+ }
34
 
35
  public function initialize($action, $stateObject) {
36
  $this->log(sprintf('In %s.', __METHOD__));
37
  parent::initialize($action, $stateObject);
38
+ $stateObject->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT)->setStatus(Securetrading_Stpp_Model_Payment_Abstract::STATUS_PENDING_PPAGES);
39
  }
40
 
41
  public function acceptPayment(Mage_Payment_Model_Info $payment) {
42
  $this->log(sprintf('In %s.', __METHOD__));
43
  parent::acceptPayment($payment);
44
+ return $this->_getApi()->acceptPayment($payment);
 
 
45
  }
46
 
47
  public function denyPayment(Mage_Payment_Model_Info $payment) {
48
  $this->log(sprintf('In %s.', __METHOD__));
49
  parent::denyPayment($payment);
50
+ return $this->_getApi()->denyPayment($payment);
51
  }
52
 
53
  protected function _useFirstPathIfIframe($path1, $path2) {
61
  $this->log(sprintf('In %s.', __METHOD__));
62
  return Mage::getUrl($this->getOrderPlaceRedirectPath());
63
  }
64
+
65
  public function getOrderPlaceRedirectPath() {
66
  $this->log(sprintf('In %s.', __METHOD__));
67
  return $this->_useFirstPathIfIframe('securetrading/redirect_post_onepage/iframe', 'securetrading/redirect_post_onepage/container');
76
  return $this->_useFirstPathIfIframe('*/sales_order_create_securetrading/iframe', '*/sales_order_create_securetrading/post');
77
  }
78
 
79
+ public function prepareOrderData(Mage_Sales_Model_Order_Payment $payment, array $orderIncrementIds, $sendEmailConfirmation = true) {
80
  $this->log(sprintf('In %s.', __METHOD__));
81
  $data = parent::prepareOrderData($payment, $orderIncrementIds);
82
 
83
  return $data += array(
84
+ 'customfield1' => $payment->getOrder()->getStoreId(),
85
+ 'parentcss' => $this->getConfigData('parent_css'),
86
+ 'childcss' => $this->getConfigData('child_css'),
87
+ 'parentjs' => $this->getConfigData('parent_js'),
88
+ 'childjs' => $this->getConfigData('child_js'),
89
+ '_charset_' => Mage::getStoreConfig('design/head/default_charset'),
90
+ 'order_increment_ids' => serialize($orderIncrementIds),
91
+ 'send_confirmation' => $sendEmailConfirmation,
92
  );
93
  }
94
 
95
+ protected function _getApi() {
96
+ return Mage::getModel('securetrading_stpp/payment_direct');
97
+ }
98
+
99
+ public function capture(Varien_Object $payment, $amount) {
100
+ $this->log(sprintf('In %s.', __METHOD__));
101
+ parent::capture($payment, $amount);
102
+ $this->_getApi()->captureAuthorized($payment, $amount);
103
+ return $this;
104
+ }
105
+
106
+ public function refund(Varien_Object $payment, $amount) {
107
+ $this->log(sprintf('In %s.', __METHOD__));
108
+ parent::refund($payment, $amount);
109
+ $this->_getApi()->refund($payment, $amount);
110
+ return $this;
111
+ }
112
+
113
+ public function cancel(Varien_Object $payment) {
114
+ $this->log(sprintf('In %s.', __METHOD__));
115
+ $this->_getApi()->cancel($payment);
116
+ return $this;
117
+ }
118
+
119
+ public function prepareData($isMoto = false, array $orderIncrementIds = array(), $sendEmailConfirmation = true) {
120
  $this->log(sprintf('In %s.', __METHOD__));
121
+ $data = $this->prepareOrderData($this->getInfoInstance(), $orderIncrementIds, $sendEmailConfirmation);
122
  $transport = $this->getIntegration()->runPaymentPages($data, $isMoto);
123
  return $transport;
124
  }
app/code/local/Securetrading/Stpp/Model/Transaction.php CHANGED
@@ -21,16 +21,24 @@ class Securetrading_Stpp_Model_Transaction extends Mage_Core_Model_Abstract {
21
  return $return;
22
  }
23
 
24
- public function getRequestData() {
25
- return $this->_getApiData('request_data');
 
 
 
 
 
 
 
26
  }
27
 
28
  public function setRequestData(array $data = array()) {
29
  return $this->_setApiData('request_data', $data);
30
  }
31
 
32
- public function getResponseData() {
33
- return $this->_getApiData('response_data');
 
34
  }
35
 
36
  public function setResponseData(array $data = array()) {
@@ -41,22 +49,33 @@ class Securetrading_Stpp_Model_Transaction extends Mage_Core_Model_Abstract {
41
  }
42
 
43
  public function getParentTransactionReference() {
44
- $transaction = Mage::getModel('securetrading_stpp/transaction')->load($this->getParentTransactionId());
45
-
46
- if ($transaction) {
47
- return $transaction->getTransactionReference();
48
- }
49
  return '';
50
  }
51
 
52
- public function loadByParentTransactionReference($parentTransactionReference, $graceful = false) {
53
- $this->load($parentTransactionReference, 'transaction_reference');
 
 
 
 
 
 
 
 
 
 
 
 
 
54
 
55
  if (!$this->getTransactionId()) {
56
  if ($graceful) {
57
  return false;
58
  }
59
- throw new Stpp_Exception(sprintf(Mage::helper('securetrading_stpp')->__('A transaction with parent transaction reference "%s" cannot be found.'), $parentTransactionReference));
60
  }
61
  return $this;
62
  }
21
  return $return;
22
  }
23
 
24
+ public function getRequestData($key = null, $default = null) {
25
+ $data = $this->_getApiData('request_data');
26
+ if ($key === null) {
27
+ return $data;
28
+ }
29
+ if (array_key_exists($key, $data)) {
30
+ return $data[$key];
31
+ }
32
+ return $default;
33
  }
34
 
35
  public function setRequestData(array $data = array()) {
36
  return $this->_setApiData('request_data', $data);
37
  }
38
 
39
+ public function getResponseData($key = null) {
40
+ $data = $this->_getApiData('response_data');
41
+ return $key === null ? $data : $data[$key];
42
  }
43
 
44
  public function setResponseData(array $data = array()) {
49
  }
50
 
51
  public function getParentTransactionReference() {
52
+ if ($parentTransaction = $this->getParentTransaction(true)) {
53
+ return $parentTransaction->getTransactionReference();
54
+ }
 
 
55
  return '';
56
  }
57
 
58
+ public function getParentTransaction($graceful = false) {
59
+ if ($this->getParentTransactionId()) {
60
+ $parentTransaction = Mage::getModel('securetrading_stpp/transaction')->load($this->getParentTransactionId());
61
+ if ($parentTransaction->getId()) {
62
+ return $parentTransaction;
63
+ }
64
+ }
65
+ if ($graceful) {
66
+ return false;
67
+ }
68
+ throw new Stpp_Exception(Mage::helper('securetrading_stpp')->__('The parent transaction could not be loaded.'));
69
+ }
70
+
71
+ public function loadByTransactionReference($transactionReference, $graceful = false) {
72
+ $this->load($transactionReference, 'transaction_reference');
73
 
74
  if (!$this->getTransactionId()) {
75
  if ($graceful) {
76
  return false;
77
  }
78
+ throw new Stpp_Exception(sprintf(Mage::helper('securetrading_stpp')->__('A transaction with a transaction reference of "%s" cannot be found.'), $parentTransactionReference));
79
  }
80
  return $this;
81
  }
app/code/local/Securetrading/Stpp/Model/Transaction/Types.php CHANGED
@@ -8,6 +8,7 @@ class Securetrading_Stpp_Model_Transaction_Types extends Mage_Core_Model_Abstrac
8
  const TYPE_TRANSACTIONUPDATE ='transactionupdate';
9
  const TYPE_TRANSACTIONQUERY = 'transactionquery';
10
  const TYPE_ACCOUNTCHECK = 'accountcheck';
 
11
  const TYPE_ERROR = 'error';
12
 
13
  function _construct() {
8
  const TYPE_TRANSACTIONUPDATE ='transactionupdate';
9
  const TYPE_TRANSACTIONQUERY = 'transactionquery';
10
  const TYPE_ACCOUNTCHECK = 'accountcheck';
11
+ const TYPE_REFUND = 'refund';
12
  const TYPE_ERROR = 'error';
13
 
14
  function _construct() {
app/code/local/Securetrading/Stpp/Model/Transport.php DELETED
@@ -1,5 +0,0 @@
1
- <?php
2
-
3
- class Securetrading_Stpp_Model_Transport extends Mage_Core_Model_Abstract {
4
-
5
- }
 
 
 
 
 
app/code/local/Securetrading/Stpp/controllers/PaymentController.php CHANGED
@@ -2,8 +2,10 @@
2
 
3
  class Securetrading_Stpp_PaymentController extends Mage_Core_Controller_Front_Action {
4
  public function locationAction() {
5
- $url = $this->getRequest()->getParam('url');
6
- Mage::register(Securetrading_Stpp_Block_Payment_Location::URL_REGISTRY_KEY, $url);
 
 
7
  $this->loadLayout();
8
  $this->renderLayout();
9
  }
2
 
3
  class Securetrading_Stpp_PaymentController extends Mage_Core_Controller_Front_Action {
4
  public function locationAction() {
5
+ $path = $this->getRequest()->getParam('path');
6
+ $args = $this->getRequest()->getParam('args');
7
+ Mage::register(Securetrading_Stpp_Block_Payment_Location::PATH_REGISTRY_KEY, $path);
8
+ Mage::register(Securetrading_Stpp_Block_Payment_Location::ARGS_REGISTRY_KEY, $args);
9
  $this->loadLayout();
10
  $this->renderLayout();
11
  }
app/code/local/Securetrading/Stpp/controllers/RedirectController.php CHANGED
@@ -1,32 +1,28 @@
1
  <?php
2
 
3
  class Securetrading_Stpp_RedirectController extends Mage_Core_Controller_Front_Action {
4
- public function redirectAction() {
5
- Mage::getModel('securetrading_stpp/payment_redirect')
6
- ->log(sprintf('In %s.', __METHOD__))
7
- ->runRedirect();
8
-
9
- if (Mage::getSingleton('checkout/session')->setLoadInactive(true)->getQuote()->getIsMultiShipping()) {
10
- $path = 'checkout/multishipping/success';
11
- $arguments = array('_nosid' => true);
12
-
13
- Mage::getSingleton('checkout/session')->clear();
14
- Mage::getSingleton('checkout/session')->setDisplaySuccess(true);
15
-
16
- Mage::getSingleton('checkout/type_multishipping_state')->setCompleteStep(Mage_Checkout_Model_Type_Multishipping_State::STEP_OVERVIEW);
17
- Mage::getSingleton('checkout/type_multishipping_state')->setActiveStep(Mage_Checkout_Model_Type_Multishipping_State::STEP_SUCCESS);
18
- }
19
- else {
20
- $path = 'checkout/onepage/success';
21
- $arguments = array('_nosid' => true);
22
- }
23
-
24
- $storeId = $this->getRequest()->get('storeid');
25
- $queryArgs = array('url' => Mage::getModel('core/url')->setStore($storeId)->getUrl($path, $arguments));
26
-
27
- $this->_redirect('securetrading/payment/location', array('_query' => $queryArgs));
28
- }
29
-
30
  public function notificationAction() {
31
  $model = Mage::getModel('securetrading_stpp/payment_redirect')
32
  ->log(sprintf('In %s.', __METHOD__))
1
  <?php
2
 
3
  class Securetrading_Stpp_RedirectController extends Mage_Core_Controller_Front_Action {
4
+ public function redirectAction() {
5
+ Mage::getModel('securetrading_stpp/payment_redirect')
6
+ ->log(sprintf('In %s.', __METHOD__))
7
+ ->runRedirect();
8
+
9
+ if (Mage::getSingleton('checkout/session')->setLoadInactive(true)->getQuote()->getIsMultiShipping()) {
10
+ $path = 'checkout/multishipping/success';
11
+
12
+ Mage::getSingleton('checkout/session')->clear();
13
+ Mage::getSingleton('checkout/session')->setDisplaySuccess(true);
14
+
15
+ Mage::getSingleton('checkout/type_multishipping_state')->setCompleteStep(Mage_Checkout_Model_Type_Multishipping_State::STEP_OVERVIEW);
16
+ Mage::getSingleton('checkout/type_multishipping_state')->setActiveStep(Mage_Checkout_Model_Type_Multishipping_State::STEP_SUCCESS);
17
+ }
18
+ else {
19
+ $path = 'checkout/onepage/success';
20
+ }
21
+
22
+ $queryArgs = array('path' => $path);
23
+ $this->_redirect('securetrading/payment/location', array('_query' => $queryArgs));
24
+ }
25
+
 
 
 
 
26
  public function notificationAction() {
27
  $model = Mage::getModel('securetrading_stpp/payment_redirect')
28
  ->log(sprintf('In %s.', __METHOD__))
app/code/local/Securetrading/Stpp/controllers/Sales/Order/Create/SecuretradingController.php CHANGED
@@ -15,15 +15,14 @@ class Securetrading_Stpp_Sales_Order_Create_SecuretradingController extends Mage
15
 
16
  public function preDispatch() {
17
  parent::preDispatch();
18
-
19
- if ($this->getRequest()->getRequestedActionName() !== 'redirect') {
20
  Mage::getModel('securetrading_stpp/payment_redirect')->validateOrders($this->_getOrderIncrementIds());
21
  $this->_methodInstance = Mage::getModel('securetrading_stpp/payment_redirect')->getFirstMethodInstance($this->_getOrderIncrementIds());
22
  }
23
  }
24
 
25
  protected function _prepareResult() {
26
- $transport = $this->_methodInstance->prepareData(true, $this->_getOrderIncrementIds());
27
  Mage::register(Securetrading_Stpp_Block_Payment_Redirect_Post::REGISTRY_TRANSPORT_KEY, $transport);
28
  }
29
 
@@ -42,8 +41,7 @@ class Securetrading_Stpp_Sales_Order_Create_SecuretradingController extends Mage
42
  public function iframeAction() {
43
  Mage::register(Securetrading_Stpp_Block_Payment_Iframe::REGISTRY_IFRAME_HEIGHT_KEY, $this->_methodInstance->getConfigData('ppg_iframe_height'));
44
  Mage::register(Securetrading_Stpp_Block_Payment_Iframe::REGISTRY_IFRAME_WIDTH_KEY, $this->_methodInstance->getConfigData('ppg_iframe_width'));
45
-
46
- $queryArgs = array('order_increment_id' => $this->getRequest()->get('order_increment_id'));
47
  $src = Mage::getModel('adminhtml/url')->getUrl('adminhtml/sales_order_create_securetrading/raw', array('_query' => $queryArgs));
48
 
49
  $this->loadLayout();
@@ -57,12 +55,23 @@ class Securetrading_Stpp_Sales_Order_Create_SecuretradingController extends Mage
57
  $orderIncrementId = Mage::getSingleton('adminhtml/session_quote')->getLastOrderIncrementId();
58
  $order = Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId);
59
 
60
- $path = '*/sales_order/view';
61
- $arguments = array('order_id' => $order->getId());
62
- $queryArgs = array('url' => Mage::getUrl($path, $arguments));
63
- $this->_redirect('securetrading/payment/location', array('_query' => $queryArgs, '_store' => 1)); // So frontend store URL used instead of admin
64
 
65
  Mage::getSingleton('adminhtml/session')->clear();
66
  Mage::getSingleton('adminhtml/session')->addSuccess($this->__('The order has been created.'));
67
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  }
15
 
16
  public function preDispatch() {
17
  parent::preDispatch();
18
+ if (!in_array($this->getRequest()->getRequestedActionName(), array('redirect', 'location'))) {
 
19
  Mage::getModel('securetrading_stpp/payment_redirect')->validateOrders($this->_getOrderIncrementIds());
20
  $this->_methodInstance = Mage::getModel('securetrading_stpp/payment_redirect')->getFirstMethodInstance($this->_getOrderIncrementIds());
21
  }
22
  }
23
 
24
  protected function _prepareResult() {
25
+ $transport = $this->_methodInstance->prepareData(true, $this->_getOrderIncrementIds(), $this->getRequest()->getParam('send_confirmation'));
26
  Mage::register(Securetrading_Stpp_Block_Payment_Redirect_Post::REGISTRY_TRANSPORT_KEY, $transport);
27
  }
28
 
41
  public function iframeAction() {
42
  Mage::register(Securetrading_Stpp_Block_Payment_Iframe::REGISTRY_IFRAME_HEIGHT_KEY, $this->_methodInstance->getConfigData('ppg_iframe_height'));
43
  Mage::register(Securetrading_Stpp_Block_Payment_Iframe::REGISTRY_IFRAME_WIDTH_KEY, $this->_methodInstance->getConfigData('ppg_iframe_width'));
44
+ $queryArgs = array('order_increment_id' => $this->getRequest()->get('order_increment_id'), 'send_confirmation' => $this->getRequest()->get('send_confirmation'));
 
45
  $src = Mage::getModel('adminhtml/url')->getUrl('adminhtml/sales_order_create_securetrading/raw', array('_query' => $queryArgs));
46
 
47
  $this->loadLayout();
55
  $orderIncrementId = Mage::getSingleton('adminhtml/session_quote')->getLastOrderIncrementId();
56
  $order = Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId);
57
 
58
+ $queryArgs = array('path' => '*/sales_order/view', 'args' => array('order_id' => $order->getId()));
59
+ $this->_redirect('*/sales_order_create_securetrading/location', array('_query' => $queryArgs));
 
 
60
 
61
  Mage::getSingleton('adminhtml/session')->clear();
62
  Mage::getSingleton('adminhtml/session')->addSuccess($this->__('The order has been created.'));
63
  }
64
+
65
+ public function locationAction() {
66
+ $path = $this->getRequest()->getParam('path');
67
+ $args = $this->getRequest()->getParam('args');
68
+
69
+ Mage::register(Securetrading_Stpp_Block_Payment_Location::PATH_REGISTRY_KEY, $path);
70
+ Mage::register(Securetrading_Stpp_Block_Payment_Location::ARGS_REGISTRY_KEY, $args);
71
+
72
+ $messages = Mage::getSingleton('adminhtml/session')->getMessages(true);
73
+ $this->loadLayout();
74
+ Mage::getSingleton('adminhtml/session')->setMessages($messages);
75
+ $this->renderLayout();
76
+ }
77
  }
app/code/local/Securetrading/Stpp/controllers/Sales/Order/CreateController.php CHANGED
@@ -21,12 +21,18 @@ class Securetrading_Stpp_Sales_Order_CreateController extends Mage_Adminhtml_Sal
21
  $order = $this->_getOrderCreateModel()
22
  ->setIsValidate(true)
23
  ->importPostData($this->getRequest()->getPost('order'))
 
 
 
24
  ->createOrder();
25
 
26
  // Start ST added.
 
 
 
27
  $this->_getSession()->setLastOrderIncrementId($order->getIncrementId());
28
  $path = Mage::getModel('securetrading_stpp/payment_redirect')->getMotoOrderRedirectPath();
29
- $this->_redirect($path, array('order_increment_id' => $order->getIncrementId()));
30
  return;
31
  // end ST added.
32
  $this->_getSession()->clear();
21
  $order = $this->_getOrderCreateModel()
22
  ->setIsValidate(true)
23
  ->importPostData($this->getRequest()->getPost('order'))
24
+ // Start ST Added
25
+ ->setSendConfirmation(false)
26
+ // End ST Added
27
  ->createOrder();
28
 
29
  // Start ST added.
30
+ $orderInfo = $this->getRequest()->getPost('order');
31
+ $sendConfirmation = isset($orderInfo['send_confirmation']);
32
+
33
  $this->_getSession()->setLastOrderIncrementId($order->getIncrementId());
34
  $path = Mage::getModel('securetrading_stpp/payment_redirect')->getMotoOrderRedirectPath();
35
+ $this->_redirect($path, array('order_increment_id' => $order->getIncrementId(), 'send_confirmation' => $sendConfirmation));
36
  return;
37
  // end ST added.
38
  $this->_getSession()->clear();
app/code/local/Securetrading/Stpp/controllers/Sales/Order/EditController.php CHANGED
@@ -5,10 +5,11 @@ require_once(Mage::getModuleDir('controllers', 'Mage_Adminhtml') . DS . 'Sales'
5
  class Securetrading_Stpp_Sales_Order_EditController extends Mage_Adminhtml_Sales_Order_EditController {
6
  public function saveAction() {
7
  $paymentData = $this->getRequest()->getPost('payment');
8
-
9
  if ($paymentData && $paymentData['method'] === Mage::getModel('securetrading_stpp/payment_redirect')->getCode()) {
10
- return $this->_redirect('*/sales_order_create/save');
 
 
11
  }
12
- return $this->saveAction();
13
  }
14
  }
5
  class Securetrading_Stpp_Sales_Order_EditController extends Mage_Adminhtml_Sales_Order_EditController {
6
  public function saveAction() {
7
  $paymentData = $this->getRequest()->getPost('payment');
 
8
  if ($paymentData && $paymentData['method'] === Mage::getModel('securetrading_stpp/payment_redirect')->getCode()) {
9
+ $route = Mage::app()->getFrontController()->getRouterByRoute('adminhtml');
10
+ $frontName = $route->getFrontNameByRoute('adminhtml');
11
+ return $this->_forward('save', 'sales_order_create', $frontName);
12
  }
13
+ return parent::saveAction();
14
  }
15
  }
app/code/local/Securetrading/Stpp/etc/config.xml CHANGED
@@ -3,7 +3,7 @@
3
  <config>
4
  <modules>
5
  <Securetrading_Stpp>
6
- <version>3.1.0</version>
7
  </Securetrading_Stpp>
8
  </modules>
9
 
@@ -32,6 +32,11 @@
32
  </args>
33
  </checkout>
34
  </routers>
 
 
 
 
 
35
  </frontend>
36
 
37
  <adminhtml>
3
  <config>
4
  <modules>
5
  <Securetrading_Stpp>
6
+ <version>3.2.0</version>
7
  </Securetrading_Stpp>
8
  </modules>
9
 
32
  </args>
33
  </checkout>
34
  </routers>
35
+ <secure_url>
36
+ <securetrading_redirect_post_onepage>/securetrading/redirect_post_onepage</securetrading_redirect_post_onepage>
37
+ <securetrading_redirect_post_multishipping>/securetrading/redirect_post_multishipping</securetrading_redirect_post_multishipping>
38
+ <securetrading_payment_location>/securetrading/payment/location</securetrading_payment_location>
39
+ </secure_url>
40
  </frontend>
41
 
42
  <adminhtml>
app/code/local/Securetrading/Stpp/etc/system.xml CHANGED
@@ -36,7 +36,7 @@
36
  <active>
37
  <config_path>payment/securetrading_stpp_redirect/active</config_path>
38
  <frontend_type>select</frontend_type>
39
- 1 <source_model>adminhtml/system_config_source_yesno</source_model>
40
  <sort_order>0</sort_order>
41
  <show_in_default>1</show_in_default>
42
  <show_in_website>1</show_in_website>
@@ -189,7 +189,6 @@
189
  <show_in_website>1</show_in_website>
190
  <show_in_store>1</show_in_store>
191
  </child_js>
192
- <!--
193
  <use_api>
194
  <config_path>payment/securetrading_stpp_redirect/use_api</config_path>
195
  <frontend_type>select</frontend_type>
@@ -199,7 +198,6 @@
199
  <show_in_website>1</show_in_website>
200
  <show_in_store>1</show_in_store>
201
  </use_api>
202
- -->
203
  <payment_action>
204
  <config_path>payment/securetrading_stpp_redirect/payment_action</config_path>
205
  <frontend_type>select</frontend_type>
@@ -231,7 +229,6 @@
231
  </securetrading_stpp_redirect_config_gateway>
232
  </fields>
233
  </securetrading_stpp_redirect>
234
- <!--
235
  <securetrading_stpp_direct type="group" translate="label comment" module="securetrading_stpp">
236
  <label>SecureTrading API</label>
237
  <comment>Allows your store to capture credit card details. Your store must be PCI compliant to use this payment method.</comment>
@@ -242,6 +239,7 @@
242
  <show_in_website>1</show_in_website>
243
  <show_in_store>1</show_in_store>
244
  <fields>
 
245
  <securetrading_stpp_direct_config_basic type="group" translate="label comment" module="securetrading_stpp">
246
  <label>Basic Configuration</label>
247
  <comment>Affects how Magento works with your payment method.</comment>
@@ -322,6 +320,7 @@
322
  </api_iframe_width>
323
  </fields>
324
  </securetrading_stpp_direct_config_basic>
 
325
  <securetrading_stpp_direct_config_gateway type="group" translate="label comment" module="securetrading_stpp">
326
  <label>Gateway Configuration</label>
327
  <comment>Affect how requests to and responses from the SecureTrading gateway are processed.</comment>
@@ -350,6 +349,7 @@
350
  <show_in_website>1</show_in_website>
351
  <show_in_store>1</show_in_store>
352
  </connection>
 
353
  <use_3d_secure>
354
  <config_path>payment/securetrading_stpp_direct/use_3d_secure</config_path>
355
  <frontend_type>select</frontend_type>
@@ -432,6 +432,7 @@
432
  <show_in_website>1</show_in_website>
433
  <show_in_store>1</show_in_store>
434
  </settle_status>
 
435
  </fields>
436
  </securetrading_stpp_direct_config_gateway>
437
  <securetrading_stpp_direct_config_connections type="group" translate="label comment" module="securetrading_stpp">
@@ -541,7 +542,6 @@
541
  </securetrading_stpp_direct_config_connections>
542
  </fields>
543
  </securetrading_stpp_direct>
544
- -->
545
  </fields>
546
  </securetrading_stpp_group>
547
  </groups>
36
  <active>
37
  <config_path>payment/securetrading_stpp_redirect/active</config_path>
38
  <frontend_type>select</frontend_type>
39
+ <source_model>adminhtml/system_config_source_yesno</source_model>
40
  <sort_order>0</sort_order>
41
  <show_in_default>1</show_in_default>
42
  <show_in_website>1</show_in_website>
189
  <show_in_website>1</show_in_website>
190
  <show_in_store>1</show_in_store>
191
  </child_js>
 
192
  <use_api>
193
  <config_path>payment/securetrading_stpp_redirect/use_api</config_path>
194
  <frontend_type>select</frontend_type>
198
  <show_in_website>1</show_in_website>
199
  <show_in_store>1</show_in_store>
200
  </use_api>
 
201
  <payment_action>
202
  <config_path>payment/securetrading_stpp_redirect/payment_action</config_path>
203
  <frontend_type>select</frontend_type>
229
  </securetrading_stpp_redirect_config_gateway>
230
  </fields>
231
  </securetrading_stpp_redirect>
 
232
  <securetrading_stpp_direct type="group" translate="label comment" module="securetrading_stpp">
233
  <label>SecureTrading API</label>
234
  <comment>Allows your store to capture credit card details. Your store must be PCI compliant to use this payment method.</comment>
239
  <show_in_website>1</show_in_website>
240
  <show_in_store>1</show_in_store>
241
  <fields>
242
+ <!--
243
  <securetrading_stpp_direct_config_basic type="group" translate="label comment" module="securetrading_stpp">
244
  <label>Basic Configuration</label>
245
  <comment>Affects how Magento works with your payment method.</comment>
320
  </api_iframe_width>
321
  </fields>
322
  </securetrading_stpp_direct_config_basic>
323
+ -->
324
  <securetrading_stpp_direct_config_gateway type="group" translate="label comment" module="securetrading_stpp">
325
  <label>Gateway Configuration</label>
326
  <comment>Affect how requests to and responses from the SecureTrading gateway are processed.</comment>
349
  <show_in_website>1</show_in_website>
350
  <show_in_store>1</show_in_store>
351
  </connection>
352
+ <!--
353
  <use_3d_secure>
354
  <config_path>payment/securetrading_stpp_direct/use_3d_secure</config_path>
355
  <frontend_type>select</frontend_type>
432
  <show_in_website>1</show_in_website>
433
  <show_in_store>1</show_in_store>
434
  </settle_status>
435
+ -->
436
  </fields>
437
  </securetrading_stpp_direct_config_gateway>
438
  <securetrading_stpp_direct_config_connections type="group" translate="label comment" module="securetrading_stpp">
542
  </securetrading_stpp_direct_config_connections>
543
  </fields>
544
  </securetrading_stpp_direct>
 
545
  </fields>
546
  </securetrading_stpp_group>
547
  </groups>
app/code/local/Securetrading/Stpp/lib/Securetrading.php CHANGED
@@ -68,7 +68,7 @@ class Securetrading {
68
  }
69
 
70
  protected static function _autoload($class) {
71
- foreach(array(static::$_corePath, static::$_overridesPath) as $folder) {
72
  $filePath = $folder . str_replace('_', DIRECTORY_SEPARATOR, $class) . '.php';
73
  if (file_exists($filePath)) {
74
  require_once($filePath);
68
  }
69
 
70
  protected static function _autoload($class) {
71
+ foreach(array(static::$_overridesPath, static::$_corePath) as $folder) {
72
  $filePath = $folder . str_replace('_', DIRECTORY_SEPARATOR, $class) . '.php';
73
  if (file_exists($filePath)) {
74
  require_once($filePath);
app/code/local/Securetrading/Stpp/lib/code/core/Stpp/Actions/Abstract.php CHANGED
@@ -1,6 +1,67 @@
1
  <?php
2
 
3
  abstract class Stpp_Actions_Abstract implements Stpp_Actions_BaseInterface {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  public function processError(Stpp_Data_Response $response) {
5
  return false;
6
  }
1
  <?php
2
 
3
  abstract class Stpp_Actions_Abstract implements Stpp_Actions_BaseInterface {
4
+ protected $_result;
5
+
6
+ protected $_calculationObjects = array();
7
+
8
+ public function __construct() {
9
+ $this->_initCalculationObjects();
10
+ }
11
+
12
+ protected function _getResult() {
13
+ if ($this->_result === null) {
14
+ throw new Stpp_Exception('The result object is null.');
15
+ }
16
+ return $this->_result;
17
+ }
18
+
19
+ public function setResult(Stpp_Api_ResultInterface $result) {
20
+ $this->_result = $result;
21
+ return $this;
22
+ }
23
+
24
+ public function prepareMessages() {
25
+ $result = $this->_getResult();
26
+ $responses = $result->getContext()->getResponses();
27
+
28
+ foreach($responses as $response) {
29
+ $errorMessages = array();
30
+ $successMessages = array();
31
+
32
+ if ($response->getMessageIsError()) {
33
+ $errorMessages[] = $response->getMessage();
34
+ }
35
+ else {
36
+ $successMessages[] = $response->getMessage();
37
+ }
38
+ }
39
+
40
+ $result->setErrorMessage(implode(' - ', $errorMessages));
41
+ $result->setSuccessMessage(implode(' - ', $successMessages));
42
+ }
43
+
44
+ protected function _initCalculationObjects() {
45
+ $this->_calculationObjects = array(
46
+ 'stpp_actions_abstract_cardstore_with_noncardstore' => new Stpp_Api_Process_Calculation_CardstoreNoncardstoreCombined(),
47
+ 'stpp_actions_abstract_riskdec_with_nonriskdec' => new Stpp_Api_Process_Calculation_RiskdecNonriskdecCombined(),
48
+ 'stpp_actions_abstract_tu_refund_combined' => new Stpp_Api_Process_Calculation_TuRefundCombined(),
49
+ 'stpp_actions_abstract_default' => new Stpp_Api_Process_Calculation_Default(),
50
+ );
51
+ }
52
+
53
+ public function addCalculationObject($code, Stpp_Api_Process_Calculation_BaseInterface $calculationObject) {
54
+ $this->_calculationObjects[$code] = $calculationObject;
55
+ }
56
+
57
+ public function removeCalculationObject($code) {
58
+ unset($this->_calculationObjects);
59
+ }
60
+
61
+ public function getCalculationObjects() {
62
+ return $this->_calculationObjects;
63
+ }
64
+
65
  public function processError(Stpp_Data_Response $response) {
66
  return false;
67
  }
app/code/local/Securetrading/Stpp/lib/code/core/Stpp/Api/Connection/Webservices.php CHANGED
@@ -1,124 +1,171 @@
1
  <?php
2
 
3
-
4
  class Stpp_Api_Connection_Webservices extends Stpp_Component_Abstract implements Stpp_Api_Connection_BaseInterface {
5
- const CONNECTION_KEY = 'Stpp_Connection_Webservices';
6
-
7
- const CONNECTION_NAME = 'Stpp Web Services';
8
 
9
- protected $_actionUrl = 'https://webservices.securetrading.net:443/xml/';
 
 
 
 
10
 
11
- protected $_username;
12
 
13
- protected $_password;
14
 
15
- protected $_alias;
16
 
17
- protected $_verifySsl;
18
 
19
- protected $_caCertFile;
20
 
21
- protected $_rawCustomContextOptions;
22
-
23
- public static function getKey() {
24
- return static::CONNECTION_KEY;
25
- }
26
-
27
- public static function getName() {
28
- return static::CONNECTION_NAME;
29
- }
30
-
31
- public function setAlias($alias) {
32
- $this->_alias = $alias;
33
- }
34
-
35
- public function getAlias() {
36
- return $this->_alias;
37
- }
38
-
39
- public function setUsername($username) {
40
- $this->_username = $username;
41
- }
42
-
43
- public function setPassword($password) {
44
- $this->_password = $password;
45
- }
46
-
47
- public function setVerifySsl($bool) {
48
- $this->_verifySsl = (bool) $bool;
49
- }
50
 
51
- public function setCaCertFile($file) {
52
- $this->_caCertFile = $file;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  }
54
-
55
- public function setRawCustomContextOptions($options) {
56
- $this->_rawCustomContextOptions = $options;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  }
58
-
59
- public function sendAndReceiveData($requestString) {
60
- $requestString = trim(preg_replace('/>[\s]+</', '><', $requestString)); // Remove all whitespace between elements.
61
-
62
- $httpHeaders = array(
63
- 'Host: ' . parse_url($this->_actionUrl, PHP_URL_HOST),
64
- 'Content-type: text/xml;charset=utf-8',
65
- 'Content-Length: ' . strlen($requestString),
66
- 'Authorization: Basic ' . base64_encode($this->_username . ':' . $this->_password),
67
- 'Accept: text/xml',
68
- 'Connection: close',
69
- 'User-Agent: ',
70
- );
71
-
72
- $contextOptions = array(
73
- 'http' => array(
74
- 'protocol_version' => '1.1',
75
- 'method' => 'POST',
76
- 'content' => $requestString,
77
- 'follow_location' => 0,
78
- 'timeout' => 30,
79
- 'ignore_errors' => false,
80
- 'header' => $httpHeaders,
81
- ),
82
- );
83
-
84
- if ($this->_verifySsl) {
85
- $contextOptions['ssl'] = array(
86
- 'cafile' => $this->_caCertFile,
87
- 'CN_match' => 'webservices.securetrading.net', // CN_match will only be checked if 'verify_peer' is set to TRUE. See https://bugs.php.net/bug.php?id=47030.
88
- 'verify_peer' => true,
89
- );
90
- }
91
-
92
- if ($this->_rawCustomContextOptions) {
93
- array_merge_recursive($contextOptions, $this->_rawCustomContextOptions);
94
- }
95
-
96
- $streamContext = stream_context_create($contextOptions);
97
-
98
- if (false === ($socket = fopen($this->_actionUrl, 'rb', false, $streamContext))) {
99
- throw new Stpp_Exception(sprintf($this->__('Could not open socket to "%s".'), $this->_actionUrl));
100
- }
101
-
102
- if (fwrite($socket, $requestString) === false) {
103
- throw new Stpp_Exception($this->__('The write operation failed.'));
104
- }
105
-
106
- $metaData = stream_get_meta_data($socket);
107
- $responseHeaders = $metaData['wrapper_data'];
108
- $responseBody = stream_get_contents($socket);
109
-
110
- $match = null;
111
-
112
- if (!preg_match("!HTTP/1\.. (\d{3})!", $responseHeaders[0], $match)) {
113
- throw new Stpp_Exception($this->__('An HTTP response code could not be found.'));
114
- }
115
-
116
- $httpResponseCode = $match[1];
117
-
118
- if ($httpResponseCode != 200) {
119
- throw new Stpp_Exception(sprintf($this->__('Unexpected HTTP response code %s returned.'), $httpResponseCode));
120
- }
121
-
122
- return $responseBody;
123
  }
 
124
  }
1
  <?php
2
 
 
3
  class Stpp_Api_Connection_Webservices extends Stpp_Component_Abstract implements Stpp_Api_Connection_BaseInterface {
4
+ const CONNECTION_KEY = 'Stpp_Connection_Webservices';
 
 
5
 
6
+ const CONNECTION_NAME = 'Stpp Web Services';
7
+
8
+ protected $_ch;
9
+
10
+ protected $_actionUrl = 'https://webservices.securetrading.net:443/xml/';
11
 
12
+ protected $_username = '';
13
 
14
+ protected $_password = '';
15
 
16
+ protected $_alias = '';
17
 
18
+ protected $_verifySsl = true;
19
 
20
+ protected $_caCertFile = '';
21
 
22
+ protected $_options = array();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
 
24
+ protected $_connectTimeout = 5;
25
+
26
+ protected $_timeout = 60;
27
+
28
+ protected $_connectAttempts = 20;
29
+
30
+ protected $_connectAttemptsTimeout = 40;
31
+
32
+ protected $_sleepUseconds = 1000000;
33
+
34
+ public function __construct() {
35
+ parent::__construct();
36
+ $this->_timeout += $this->_connectTimeout; // Allow 60 seconds to send and receive data and allow time for one connection attempt.
37
+ $this->_ch = curl_init();
38
+ }
39
+
40
+ public static function getKey() {
41
+ return static::CONNECTION_KEY;
42
+ }
43
+
44
+ public static function getName() {
45
+ return static::CONNECTION_NAME;
46
+ }
47
+
48
+ public function setAlias($alias) {
49
+ $this->_alias = $alias;
50
+ return $this;
51
+ }
52
+
53
+ public function getAlias() {
54
+ return $this->_alias;
55
+ }
56
+
57
+ public function setUsername($username) {
58
+ $this->_username = $username;
59
+ return $this;
60
+ }
61
+
62
+ public function setPassword($password) {
63
+ $this->_password = $password;
64
+ return $this;
65
+ }
66
+
67
+ public function setVerifySsl($bool) {
68
+ $this->_verifySsl = (bool) $bool;
69
+ return $this;
70
+ }
71
+
72
+ public function setCaCertFile($file) {
73
+ $this->_caCertFile = $file;
74
+ return $this;
75
+ }
76
+
77
+ public function setConnectTimeout($connectTimeout) {
78
+ $this->_connectTimeout = $connectTimeout;
79
+ return $this;
80
+ }
81
+
82
+ public function setTimeout($connectTimeout) {
83
+ $this->_timeout = $connectTimeout;
84
+ return $this;
85
+ }
86
+
87
+ public function setConnectAttempts($connectAttempts) {
88
+ $this->_connectAttempts = $connectAttempts;
89
+ return $this;
90
+ }
91
+
92
+ public function setConnectRetries($connectRetries) {
93
+ $this->_connectRetries = $connectRetries;
94
+ return $this;
95
+ }
96
+
97
+ public function setSleepUseconds($sleepUseconds) {
98
+ $this->_sleepUseconds = $sleepUseconds;
99
+ return $this;
100
+ }
101
+
102
+ public function setOptions(array $options) {
103
+ $this->_options = $options;
104
+ return $this;
105
+ }
106
+
107
+ public function setOption($option, $value) {
108
+ $this->_options[$option] = $value;
109
+ return $this;
110
+ }
111
+
112
+ public function sendAndReceiveData($requestString) {
113
+ $this->_prepareCurl($requestString);
114
+ $result = $this->_send();
115
+ $this->_checkResult($result);
116
+ return $result;
117
+ }
118
+
119
+ protected function _prepareCurl($postFields) {
120
+ curl_setopt($this->_ch, CURLOPT_POST, 1);
121
+ curl_setopt($this->_ch, CURLOPT_FAILONERROR, true);
122
+ curl_setopt($this->_ch, CURLOPT_FOLLOWLOCATION, true);
123
+ curl_setopt($this->_ch, CURLOPT_RETURNTRANSFER, true);
124
+ curl_setopt($this->_ch, CURLOPT_URL, $this->_actionUrl);
125
+ curl_setopt($this->_ch, CURLOPT_POSTFIELDS, $postFields);
126
+ curl_setopt($this->_ch, CURLOPT_SSL_VERIFYPEER, $this->_verifySsl);
127
+ curl_setopt($this->_ch, CURLOPT_CONNECTTIMEOUT, $this->_connectTimeout);
128
+ curl_setopt($this->_ch, CURLOPT_TIMEOUT, $this->_timeout);
129
+ curl_setopt($this->_ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
130
+ curl_setopt($this->_ch, CURLOPT_USERPWD, $this->_username . ':' . $this->_password);
131
+ curl_setopt($this->_ch, CURLOPT_USERAGENT, '');
132
+ curl_setopt($this->_ch, CURLOPT_HTTPHEADER, array('Content-type: text/xml;charset=utf-8', 'Accept: text/xml', 'Connection: close'));
133
+
134
+ if (!empty($this->_caCertFile)) {
135
+ curl_setopt($this->_ch, CURLOPT_CAINFO, $this->_caCertFile);
136
  }
137
+
138
+ curl_setopt_array($this->_ch, $this->_options);
139
+ }
140
+
141
+ protected function _send() {
142
+ $i = 0;
143
+ $startTime = time();
144
+ $result = null;
145
+
146
+ while (true) {
147
+ $i++;
148
+ $canRetry = false;
149
+ $result = curl_exec($this->_ch);
150
+
151
+ if (curl_errno($this->_ch) === CURLE_COULDNT_CONNECT) {
152
+ $this->getDebugLog()->log(sprintf('Failed to connect to %s on attempt %s of %s. Sleeping for %s second(s).', $this->_actionUrl, $i, $this->_connectAttempts, $this->_sleepUseconds/1000000));
153
+ usleep($this->_sleepUseconds);
154
+
155
+ $timeElapsed = time() - $startTime;
156
+ $canRetry = ($timeElapsed + $this->_connectTimeout + ($this->_sleepUseconds / 100000)) < $this->_connectAttemptsTimeout && $i < $this->_connectAttempts;
157
+ }
158
+
159
+ if (!$canRetry) {
160
+ break;
161
+ }
162
  }
163
+ return $result;
164
+ }
165
+
166
+ protected function _checkResult($result) {
167
+ if ($result === false) {
168
+ throw new Stpp_Exception(sprintf($this->__("cURL Error Code: '%s'. Error Message: '%s'."), curl_errno($this->_ch), curl_error($this->_ch)));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
169
  }
170
+ }
171
  }
app/code/local/Securetrading/Stpp/lib/code/core/Stpp/Api/Context.php CHANGED
@@ -49,5 +49,38 @@ class Stpp_Api_Context extends Stpp_Component_Abstract implements Stpp_Api_Conte
49
  throw new Stpp_Exception($this->__('The array index does not exist.'));
50
  }
51
  return $responses[$index];
52
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  }
49
  throw new Stpp_Exception($this->__('The array index does not exist.'));
50
  }
51
  return $responses[$index];
52
+ }
53
+
54
+ public function getRequestsByRequestType(array $requestTypes, $not = false) {
55
+ $requests = $this->getRequests();
56
+ $filteredRequests = array();
57
+
58
+ foreach($requests as $key => $request) {
59
+ if ($not === false) {
60
+ if (in_array($request->get('requesttypedescription'), $requestTypes)) {
61
+ $filteredRequests[] = $requests[$key];
62
+ }
63
+ }
64
+ else {
65
+ if (!in_array($request->get('requesttypedescription'), $requestTypes)) {
66
+ $filteredRequests[] = $requests[$key];
67
+ }
68
+ }
69
+ }
70
+ return $filteredRequests;
71
+ }
72
+
73
+ public function getAreAllRequestsSuccessful($requests = null) {
74
+ if ($requests === null) {
75
+ $requests = $this->getRequests();
76
+ }
77
+ $result = true;
78
+ foreach($requests as $request) {
79
+ if ($request->getIsSuccessful() !== true) {
80
+ $result = false;
81
+ break;
82
+ }
83
+ }
84
+ return $result;
85
+ }
86
  }
app/code/local/Securetrading/Stpp/lib/code/core/Stpp/Api/Facade.php CHANGED
@@ -12,12 +12,12 @@ class Stpp_Api_Facade extends Stpp_Facade {
12
  $apiSend = new Stpp_Api_Send();
13
  $apiSend->setXmlWriter($this->newApiXmlWriter());
14
  $apiSend->setXmlReader($this->newApiXmlReader());
15
- $apiSend->setContext($this->newApiContext());
16
 
17
  if ($this->_config->has('interfaces/api/active_connection')) {
18
  $connectionStore = $this->newApiConnectionStore();
19
  $activeConnection = $this->_config->get('interfaces/api/active_connection');
20
- $apiSend->setConnection($connectionStore->get($activeConnection));
21
  }
22
  return $apiSend;
23
  }
@@ -112,6 +112,26 @@ class Stpp_Api_Facade extends Stpp_Facade {
112
  $webServicesConnection->setAlias($this->_config->get('connections/web_services/alias'));
113
  }
114
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
115
  if ($this->_config->has('connections/web_services/verifyssl')) {
116
  $webServicesConnection->setVerifySsl($this->_config->get('connections/web_services/verifyssl'));
117
  }
@@ -120,8 +140,8 @@ class Stpp_Api_Facade extends Stpp_Facade {
120
  $webServicesConnection->setCaCertFile($this->_config->get('connections/web_services/cacertfile'));
121
  }
122
 
123
- if ($this->_config->has('connections/web_services/contextoptions')) {
124
- $webServicesConnection->setRawCustomContextOptions($this->_config->get('connections/web_services/contextoptions'));
125
  }
126
  return $webServicesConnection;
127
  }
12
  $apiSend = new Stpp_Api_Send();
13
  $apiSend->setXmlWriter($this->newApiXmlWriter());
14
  $apiSend->setXmlReader($this->newApiXmlReader());
15
+ $apiSend->setContext($this->newApiContext());
16
 
17
  if ($this->_config->has('interfaces/api/active_connection')) {
18
  $connectionStore = $this->newApiConnectionStore();
19
  $activeConnection = $this->_config->get('interfaces/api/active_connection');
20
+ $apiSend->setConnection($connectionStore->get($activeConnection));
21
  }
22
  return $apiSend;
23
  }
112
  $webServicesConnection->setAlias($this->_config->get('connections/web_services/alias'));
113
  }
114
 
115
+ if ($this->_config->has('connections/web_services/connect_timeout')) {
116
+ $webServicesConnection->setConnectTimeout($this->_config->get('connections/web_services/connect_timeout'));
117
+ }
118
+
119
+ if ($this->_config->has('connections/web_services/timeout')) {
120
+ $webServicesConnection->setTimeout($this->_config->get('connections/web_services/timeout'));
121
+ }
122
+
123
+ if ($this->_config->has('connections/web_services/connect_attempts')) {
124
+ $webServicesConnection->setConnectAttempts($this->_config->get('connections/web_services/connect_attempts'));
125
+ }
126
+
127
+ if ($this->_config->has('connections/web_services/connect_retries')) {
128
+ $webServicesConnection->setConnectRetries($this->_config->get('connections/web_services/connect_retries'));
129
+ }
130
+
131
+ if ($this->_config->has('connections/web_services/sleep_useconds')) {
132
+ $webServicesConnection->setSleepUseconds($this->_config->get('connections/web_services/sleep_useconds'));
133
+ }
134
+
135
  if ($this->_config->has('connections/web_services/verifyssl')) {
136
  $webServicesConnection->setVerifySsl($this->_config->get('connections/web_services/verifyssl'));
137
  }
140
  $webServicesConnection->setCaCertFile($this->_config->get('connections/web_services/cacertfile'));
141
  }
142
 
143
+ if ($this->_config->has('connections/web_services/options')) {
144
+ $webServicesConnection->setOptions($this->_config->get('connections/web_services/options'));
145
  }
146
  return $webServicesConnection;
147
  }
app/code/local/Securetrading/Stpp/lib/code/core/Stpp/Api/Helper.php CHANGED
@@ -92,48 +92,83 @@ class Stpp_Api_Helper extends Stpp_Component_Abstract implements Stpp_Api_Helper
92
 
93
  public function prepareRefund(Stpp_Data_Request $originalRequest) {
94
  $originalOrderTotal = $originalRequest->get('original_order_total', null);
95
- $currentOrderTotal = $originalRequest->get('current_order_total', null);
 
96
  $amountToRefund = $originalRequest->get('amount_to_refund', null);
97
  $transactionReference = $originalRequest->get('transaction_reference', null);
98
  $partialRefundAlreadyProcessed = $originalRequest->get('partial_refund_already_processed', null);
 
 
 
 
99
 
100
- if (in_array(null, array($originalOrderTotal, $currentOrderTotal, $amountToRefund, $transactionReference, $partialRefundAlreadyProcessed), true)) {
 
 
101
  throw new Stpp_Exception($this->__('Not all parameters were passed to the refund function.'));
102
  }
103
 
104
  $partialRefund = $originalOrderTotal - $amountToRefund > 0;
105
- $settleBaseAmount = $currentOrderTotal - $amountToRefund;
106
 
107
  if (!$partialRefundAlreadyProcessed) {
108
- $filter = Stpp_Data_Request::instance()->set('transactionreference', $transactionReference);
109
-
110
  $updates = Stpp_Data_Request::instance();
111
 
112
- if ($settleBaseAmount > 0) {
113
- $updates->set('settlebaseamount', $settleBaseAmount);
114
  }
115
  else {
116
- $updates->set('settlestatus', 3);
 
 
 
 
 
 
 
 
 
 
 
 
 
117
  }
118
 
119
  $transactionUpdate = Stpp_Data_Request::instance()
120
  ->set('requesttypedescription', Stpp_Types::API_TRANSACTIONUPDATE)
121
  ->set('filter', $filter)
122
  ->set('updates', $updates);
 
 
123
  }
124
 
125
  $refund = Stpp_Data_Request::instance()
126
  ->set('requesttypedescription', Stpp_Types::API_REFUND)
127
- ->set('parenttransactionreference', $transactionReference);
 
128
 
129
  if ($partialRefund) {
130
- $refund->set('baseamount', $amountToRefund);
 
 
 
 
 
131
  }
132
 
133
- return array(
134
- $transactionUpdate,
135
- $refund,
136
- );
 
 
 
 
 
 
 
 
137
  }
138
 
139
  public function prepareTransactionUpdate(Stpp_Data_Request $request) {
92
 
93
  public function prepareRefund(Stpp_Data_Request $originalRequest) {
94
  $originalOrderTotal = $originalRequest->get('original_order_total', null);
95
+ $orderTotalPaid = $originalRequest->get('order_total_paid', null);
96
+ $orderTotalRefunded = $originalRequest->get('order_total_refunded', null);
97
  $amountToRefund = $originalRequest->get('amount_to_refund', null);
98
  $transactionReference = $originalRequest->get('transaction_reference', null);
99
  $partialRefundAlreadyProcessed = $originalRequest->get('partial_refund_already_processed', null);
100
+ $usingMainAmount = $originalRequest->get('using_main_amount', null);
101
+ $currencyIso3a = $originalRequest->get('currency_iso_3a', null);
102
+ $allowSuspend = $originalRequest->get('allow_suspend', null);
103
+ $siteReference = $originalRequest->get('site_reference');
104
 
105
+ $requests = array();
106
+
107
+ if (in_array(null, array($originalOrderTotal, $orderTotalPaid, $orderTotalRefunded, $amountToRefund, $transactionReference, $partialRefundAlreadyProcessed, $usingMainAmount, $currencyIso3a, $allowSuspend), true)) {
108
  throw new Stpp_Exception($this->__('Not all parameters were passed to the refund function.'));
109
  }
110
 
111
  $partialRefund = $originalOrderTotal - $amountToRefund > 0;
112
+ $settleAmount = $orderTotalPaid - $orderTotalRefunded - $amountToRefund;
113
 
114
  if (!$partialRefundAlreadyProcessed) {
115
+ $filter = Stpp_Data_Request::instance()->set('transactionreference', $transactionReference)->set('sitereference', $siteReference);
 
116
  $updates = Stpp_Data_Request::instance();
117
 
118
+ if ($settleAmount > 0) {
119
+ $this->_setAmount($updates, $usingMainAmount, $settleAmount, $currencyIso3a);
120
  }
121
  else {
122
+ if ($allowSuspend) {
123
+ $settleAmount = $originalOrderTotal - $orderTotalPaid;
124
+ if ($settleAmount > 0) {
125
+ $this->_setAmount($updates, $usingMainAmount, $settleAmount, $currencyIso3a);
126
+ $settleStatus = 2;
127
+ }
128
+ else {
129
+ $settleStatus = 3;
130
+ }
131
+ }
132
+ else {
133
+ $settleStatus = 3;
134
+ }
135
+ $updates->set('settlestatus', $settleStatus);
136
  }
137
 
138
  $transactionUpdate = Stpp_Data_Request::instance()
139
  ->set('requesttypedescription', Stpp_Types::API_TRANSACTIONUPDATE)
140
  ->set('filter', $filter)
141
  ->set('updates', $updates);
142
+
143
+ $requests[] = $transactionUpdate;
144
  }
145
 
146
  $refund = Stpp_Data_Request::instance()
147
  ->set('requesttypedescription', Stpp_Types::API_REFUND)
148
+ ->set('parenttransactionreference', $transactionReference)
149
+ ->set('sitereference', $siteReference);
150
 
151
  if ($partialRefund) {
152
+ if ($usingMainAmount) {
153
+ $refund->set('mainamount', $amountToRefund);
154
+ }
155
+ else {
156
+ $refund->set('baseamount', $amountToRefund);
157
+ }
158
  }
159
 
160
+ $requests[] = $refund;
161
+ return $requests;
162
+ }
163
+
164
+ protected function _setAmount(Stpp_Data_Request $updates, $usingMainAmount, $settleAmount, $currencyIso3a) {
165
+ if ($usingMainAmount) {
166
+ $updates->set('settlemainamount', $settleAmount);
167
+ $updates->set('currencyiso3a', $currencyIso3a);
168
+ }
169
+ else {
170
+ $updates->set('settlebaseamount', $settleAmount);
171
+ }
172
  }
173
 
174
  public function prepareTransactionUpdate(Stpp_Data_Request $request) {
app/code/local/Securetrading/Stpp/lib/code/core/Stpp/Api/Process.php CHANGED
@@ -21,8 +21,9 @@ class Stpp_Api_Process extends Stpp_Component_Abstract implements Stpp_Api_Proce
21
  return $this->_actionInstance;
22
  }
23
 
24
- public function _setContext(Stpp_Api_ContextInterface $context) {
25
  $this->_context = $context;
 
26
  }
27
 
28
  protected function _getContext() {
@@ -34,6 +35,7 @@ class Stpp_Api_Process extends Stpp_Component_Abstract implements Stpp_Api_Proce
34
 
35
  public function setResult(Stpp_Api_ResultInterface $result) {
36
  $this->_result = $result;
 
37
  }
38
 
39
  protected function _getResult() {
@@ -55,18 +57,25 @@ class Stpp_Api_Process extends Stpp_Component_Abstract implements Stpp_Api_Proce
55
  return $this->_apiLog;
56
  }
57
 
 
 
 
 
 
 
 
58
  public function run(Stpp_Api_ContextInterface $context) {
59
- $this->_setContext($context);
60
  $this->_handleResponses();
61
  $this->_calculateIsTransactionSuccessful();
62
- $this->_getResult()->setContext($this->_getContext());
63
  return $this->_getResult();
64
  }
65
 
66
  protected function _handleResponses() {
67
  $responses = $this->_getContext()->getResponses();
68
 
69
- $this->_runStandardRoutines($responses);
70
 
71
  $lastResponseResponseType = $responses[count($responses)-1]->get('responsetype');
72
 
@@ -105,41 +114,52 @@ class Stpp_Api_Process extends Stpp_Component_Abstract implements Stpp_Api_Proce
105
  return $this;
106
  }
107
 
108
- protected function _runStandardRoutines($responses) {
109
  foreach($responses as $response) {
110
  $this->getApiLog()->log($response);
111
-
112
- $this->_formatErrorMessages(
113
- $response->get('errorcode'),
114
- $response->get('errormessage'),
115
- $response->get('errordata')
116
- );
117
  }
118
  return $this;
119
  }
120
 
121
- protected function _formatErrorMessages($errorCode, $errorMessage, $errorData) {
122
- $errorCode = (string) $errorCode;
123
- $errorMessage = (string) $errorMessage;
124
- $errorData = (string) $errorData;
125
 
126
  switch($errorCode) {
127
  case "0":
128
- $customerMessage = $merchantMessage = $this->__('Transaction successful.');
129
  break;
130
  case "30000":
131
- $errorData = $errorData === 'pan' ? $this->__('credit/debit card number') : $errorData; // Replace 'pan' with 'card number'.
132
- $customerMessage = $merchantMessage = sprintf($this->__('The %s was not provided or was incorrect.'), $errorData);
133
  break;
134
  case "70000":
135
- $customerMessage = $this->__('Your credit/debit card was declined. Please try again using a different card.');
136
- $merchantMessage = $this->__('The customer\'s credit/debit card was declined.');
137
  break;
138
  default:
139
- $customerMessage = $this->__('An unexpected error occurred. Please try again.');
140
- $merchantMessage = $errorMessage;
141
  }
142
- $this->_getResult()->setCustomerErrorMessage($customerMessage)->setMerchantErrorMessage($merchantMessage);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
143
  }
144
 
145
  protected function _handleError(Stpp_Data_Response $response) {
@@ -188,63 +208,4 @@ class Stpp_Api_Process extends Stpp_Component_Abstract implements Stpp_Api_Proce
188
  protected function _handleRefund(Stpp_Data_Response $response) {
189
  return $this->_getActionInstance()->processRefund($response);
190
  }
191
-
192
- protected function _calculateIsTransactionSuccessful() {
193
- $requests = $this->_getContext()->getRequests();
194
- $transactionSuccessful = false;
195
-
196
- $cardStore = $this->_findRequests(array(Stpp_Types::API_CARDSTORE));
197
- $nonCardStore = $this->_findRequests(array(Stpp_Types::API_CARDSTORE), true);
198
-
199
- $riskDecision = $this->_findRequests(array(Stpp_Types::API_RISKDEC));
200
- $nonRiskDecision = $this->_findRequests(array(Stpp_Types::API_RISKDEC), true);
201
-
202
- if ($cardStore && !$this->_validateAllRequestsAreSuccessful($cardStore)) {
203
- if ($nonCardStore && $this->_validateAllRequestsAreSuccessful($nonCardStore)) {
204
- $transactionSuccessful = true; // If one or more CARDSTORE requests failed but other request types exist and are all successful.
205
- }
206
- }
207
- elseif ($riskDecision && !$this->_validateAllRequestsAreSuccessful($riskDecision)) {
208
- if ($nonRiskDecision && $this->_validateAllRequestsAreSuccessful($nonRiskDecision)) {
209
- $transactionSuccessful = true; // If one or more RISKDEC requests failed but other request types exist and are all successful.
210
- }
211
- }
212
- else {
213
- $transactionSuccessful = $this->_validateAllRequestsAreSuccessful($requests);
214
- }
215
-
216
- $isTransactionSuccessful = $this->_getActionInstance()->calculateIsTransactionSuccessful($requests, $transactionSuccessful);
217
- $this->_getResult()->setIsTransactionSuccessful($isTransactionSuccessful);
218
- return $this;
219
- }
220
-
221
- protected function _validateAllRequestsAreSuccessful(array $requests) {
222
- $result = true;
223
- foreach($requests as $request) {
224
- if ($request->getIsSuccessful() !== true) {
225
- $result = false;
226
- break;
227
- }
228
- }
229
- return $result;
230
- }
231
-
232
- protected function _findRequests(array $requestTypes, $not = false) {
233
- $requests = $this->_getContext()->getRequests();
234
- $filteredRequests = array();
235
-
236
- foreach($requests as $key => $request) {
237
- if ($not === false) {
238
- if (in_array($request->get('requesttypedescription'), $requestTypes)) {
239
- $filteredRequests[] = $requests[$key];
240
- }
241
- }
242
- else {
243
- if (!in_array($request->get('requesttypedescription'), $requestTypes)) {
244
- $filteredRequests[] = $requests[$key];
245
- }
246
- }
247
- }
248
- return $filteredRequests;
249
- }
250
  }
21
  return $this->_actionInstance;
22
  }
23
 
24
+ protected function _setContext(Stpp_Api_ContextInterface $context) {
25
  $this->_context = $context;
26
+ return $this;
27
  }
28
 
29
  protected function _getContext() {
35
 
36
  public function setResult(Stpp_Api_ResultInterface $result) {
37
  $this->_result = $result;
38
+ return $this;
39
  }
40
 
41
  protected function _getResult() {
57
  return $this->_apiLog;
58
  }
59
 
60
+ protected function _init(Stpp_Api_ContextInterface $context) {
61
+ $result = $this->_getResult();
62
+ $result->setContext($context);
63
+ $this->_setContext($context);
64
+ $this->_getActionInstance()->setResult($result);
65
+ }
66
+
67
  public function run(Stpp_Api_ContextInterface $context) {
68
+ $this->_init($context);
69
  $this->_handleResponses();
70
  $this->_calculateIsTransactionSuccessful();
71
+ $this->_calculateMessages();
72
  return $this->_getResult();
73
  }
74
 
75
  protected function _handleResponses() {
76
  $responses = $this->_getContext()->getResponses();
77
 
78
+ $this->_runCommonRoutines($responses);
79
 
80
  $lastResponseResponseType = $responses[count($responses)-1]->get('responsetype');
81
 
114
  return $this;
115
  }
116
 
117
+ protected function _runCommonRoutines($responses) {
118
  foreach($responses as $response) {
119
  $this->getApiLog()->log($response);
120
+ $this->_formatErrorMessages($response);
 
 
 
 
 
121
  }
122
  return $this;
123
  }
124
 
125
+ protected function _formatErrorMessages(Stpp_Data_Response $response) {
126
+ $errorCode = (string) $response->get('errorcode');
127
+ $errorMessage = (string) $response->get('errormessage');
128
+ $errorData = (string) $response->get('errordata');
129
 
130
  switch($errorCode) {
131
  case "0":
132
+ $response->setMessage($this->__('Transaction successful.'))->setMessageIsError(false);
133
  break;
134
  case "30000":
135
+ $errorData = $errorData === 'pan' ? $this->__('credit/debit card number') : $errorData;
136
+ $response->setMessage(sprintf($this->__('The %s was not provided or was incorrect.'), $errorData))->setMessageIsError(true);
137
  break;
138
  case "70000":
139
+ $response->setMessage($this->__('Your credit/debit card was declined. Please try again using a different card.'))->setMessageIsError(true);
 
140
  break;
141
  default:
142
+ $response->setMessage($this->__('An unexpected error occurred. Please try again.'))->setMessageIsError(true);
 
143
  }
144
+ return $this;
145
+ }
146
+
147
+ protected function _calculateIsTransactionSuccessful() {
148
+ $result = null;
149
+ $calculationObjects = $this->_getActionInstance()->getCalculationObjects();
150
+
151
+ while ($object = array_shift($calculationObjects)) {
152
+ if (($result = $object->calculate($this->_getContext())) !== null) {
153
+ $result = (bool) $result;
154
+ $this->_getResult()->setIsTransactionSuccessful($result);
155
+ return;
156
+ }
157
+ }
158
+ throw new Stpp_Exception($this->__('No calculation objects matched the gateway response.'));
159
+ }
160
+
161
+ protected function _calculateMessages() {
162
+ $this->_getActionInstance()->prepareMessages();
163
  }
164
 
165
  protected function _handleError(Stpp_Data_Response $response) {
208
  protected function _handleRefund(Stpp_Data_Response $response) {
209
  return $this->_getActionInstance()->processRefund($response);
210
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
211
  }
app/code/local/Securetrading/Stpp/lib/code/core/Stpp/Api/Process/Calculation/BaseInterface.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+
3
+ interface Stpp_Api_Process_Calculation_BaseInterface {
4
+ public function calculate(Stpp_Api_Context $context);
5
+ }
app/code/local/Securetrading/Stpp/lib/code/core/Stpp/Api/Process/Calculation/CardstoreNoncardstoreCombined.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Stpp_Api_Process_Calculation_CardstoreNoncardstoreCombined implements Stpp_Api_Process_Calculation_BaseInterface {
4
+ public function calculate(Stpp_Api_Context $context) {
5
+ $cardStore = $context->getRequestsByRequestType(array(Stpp_Types::API_CARDSTORE));
6
+ $nonCardStore = $context->getRequestsByRequestType(array(Stpp_Types::API_CARDSTORE), true);
7
+
8
+ if ($cardStore && $nonCardStore && !$context->getAreAllRequestsSuccessful($cardStore)) {
9
+ if ($context->getAreAllRequestsSuccessful($nonCardStore)) {
10
+ return true; // If one or more CARDSTORE requests failed but other request types exist and are all successful.
11
+ }
12
+ return false;
13
+ }
14
+ return null;
15
+ }
16
+ }
app/code/local/Securetrading/Stpp/lib/code/core/Stpp/Api/Process/Calculation/Default.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Stpp_Api_Process_Calculation_Default implements Stpp_Api_Process_Calculation_BaseInterface {
4
+ public function calculate(Stpp_Api_Context $context) {
5
+ return $context->getAreAllRequestsSuccessful();
6
+ }
7
+ }
app/code/local/Securetrading/Stpp/lib/code/core/Stpp/Api/Process/Calculation/RiskdecNonriskdecCombined.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Stpp_Api_Process_Calculation_RiskdecNonriskdecCombined implements Stpp_Api_Process_Calculation_BaseInterface {
4
+ public function calculate(Stpp_Api_Context $context) {
5
+ $riskDecision = $context->getRequestsByRequestType(array(Stpp_Types::API_RISKDEC));
6
+ $nonRiskDecision = $context->getRequestsByRequestType(array(Stpp_Types::API_RISKDEC), true);
7
+
8
+ if ($riskDecision && $nonRiskDecision && !$context->getAreAllRequestsSuccessful($riskDecision)) {
9
+ if ($context->getAreAllRequestsSuccessful($nonRiskDecision)) {
10
+ return true;
11
+ }
12
+ return false;
13
+ }
14
+ return null;
15
+ }
16
+ }
app/code/local/Securetrading/Stpp/lib/code/core/Stpp/Api/Process/Calculation/TuRefundCombined.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Stpp_Api_Process_Calculation_TuRefundCombined implements Stpp_Api_Process_Calculation_BaseInterface {
4
+ public function calculate(Stpp_Api_Context $context) {
5
+ $requests = $context->getRequests();
6
+
7
+ if (count($requests) == 2) {
8
+ $request1 = $requests[0];
9
+ $request2 = $requests[1];
10
+
11
+ if ($request1->get('requesttypedescription') === Stpp_Types::API_TRANSACTIONUPDATE && $request2->get('requesttypedescription') === Stpp_Types::API_REFUND) {
12
+ if ($request1->getIsSuccessful() || $request2->getIsSuccessful()) {
13
+ return true;
14
+ }
15
+ return false;
16
+ }
17
+ }
18
+ return null;
19
+ }
20
+ }
app/code/local/Securetrading/Stpp/lib/code/core/Stpp/Api/Result.php CHANGED
@@ -7,9 +7,9 @@ class Stpp_Api_Result extends Stpp_Result_Abstract implements Stpp_Api_ResultInt
7
 
8
  protected $_isTransactionSuccessful = false;
9
 
10
- protected $_customerErrorMessage = '';
11
 
12
- protected $_merchantErrorMessage = '';
13
 
14
  public function getContext() {
15
  if ($this->_context === null) {
@@ -40,21 +40,21 @@ class Stpp_Api_Result extends Stpp_Result_Abstract implements Stpp_Api_ResultInt
40
  return $this;
41
  }
42
 
43
- public function getCustomerErrorMessage() {
44
- return $this->_customerMessage;
45
  }
46
 
47
- public function setCustomerErrorMessage($message) {
48
- $this->_customerMessage = $message;
49
- return $this;
50
  }
51
 
52
- public function getMerchantErrorMessage() {
53
- return $this->_merchantMessage;
54
  }
55
 
56
- public function setMerchantErrorMessage($message) {
57
- $this->_merchantMessage = $message;
58
- return $this;
59
  }
60
  }
7
 
8
  protected $_isTransactionSuccessful = false;
9
 
10
+ protected $_successMessage = '';
11
 
12
+ protected $_errorMessage = '';
13
 
14
  public function getContext() {
15
  if ($this->_context === null) {
40
  return $this;
41
  }
42
 
43
+ public function getSuccessMessage() {
44
+ return $this->_successMessage;
45
  }
46
 
47
+ public function setSuccessMessage($message) {
48
+ $this->_successMessage = $message;
49
+ return $this;
50
  }
51
 
52
+ public function getErrorMessage() {
53
+ return $this->_errorMessage;
54
  }
55
 
56
+ public function setErrorMessage($message) {
57
+ $this->_errorMessage = $message;
58
+ return $this;
59
  }
60
  }
app/code/local/Securetrading/Stpp/lib/code/core/Stpp/Api/ResultInterface.php CHANGED
@@ -7,8 +7,8 @@ interface Stpp_Api_ResultInterface extends Stpp_Result_AbstractInterface {
7
  function setRedirectRequired($bool);
8
  function getIsTransactionSuccessful();
9
  function setIsTransactionSuccessful($bool);
10
- function getCustomerErrorMessage();
11
- function setCustomerErrorMessage($message);
12
- function getMerchantErrorMessage();
13
- function setMerchantErrorMessage($message);
14
  }
7
  function setRedirectRequired($bool);
8
  function getIsTransactionSuccessful();
9
  function setIsTransactionSuccessful($bool);
10
+ function getErrorMessage();
11
+ function setErrorMessage($message);
12
+ function getSuccessMessage();
13
+ function setSuccessMessage($message);
14
  }
app/code/local/Securetrading/Stpp/lib/code/core/Stpp/Api/Send.php CHANGED
@@ -61,17 +61,16 @@ class Stpp_Api_Send extends Stpp_Component_Abstract implements Stpp_Api_SendInte
61
  $xmlRequestString = $this->_formXmlRequests($requestArray);
62
  $xmlResponseString = $this->getConnection()->sendAndReceiveData($xmlRequestString);
63
  $responseArray = $this->_getXmlReader()->parseResponses($xmlResponseString);
64
- $this->_mapRequestsToResponses($requestArray, $responseArray);
65
- $this->_getContext()->setRequests($requestArray)->setResponses($responseArray);
66
- return $this->_getContext();
67
  }
68
 
69
  protected function _formXmlRequests(array $requests) {
70
  $xmlWriter = $this->_getXmlWriter();
71
-
72
  $xmlWriter->startRequestBlock(static::API_VERSION, $this->getConnection()->getAlias());
73
 
74
- foreach($requests as $request) {
75
  $xmlWriter->startRequest($request);
76
 
77
  $requestType = $request->get('requesttypedescription');
61
  $xmlRequestString = $this->_formXmlRequests($requestArray);
62
  $xmlResponseString = $this->getConnection()->sendAndReceiveData($xmlRequestString);
63
  $responseArray = $this->_getXmlReader()->parseResponses($xmlResponseString);
64
+ $this->_mapRequestsToResponses($requestArray, $responseArray);
65
+ $this->_getContext()->setRequests($requestArray)->setResponses($responseArray);
66
+ return $this->_getContext();
67
  }
68
 
69
  protected function _formXmlRequests(array $requests) {
70
  $xmlWriter = $this->_getXmlWriter();
 
71
  $xmlWriter->startRequestBlock(static::API_VERSION, $this->getConnection()->getAlias());
72
 
73
+ foreach($requests as $request) {
74
  $xmlWriter->startRequest($request);
75
 
76
  $requestType = $request->get('requesttypedescription');
app/code/local/Securetrading/Stpp/lib/code/core/Stpp/Api/Xml/Reader.php CHANGED
@@ -160,23 +160,23 @@ class Stpp_Api_Xml_Reader extends Stpp_Component_Abstract implements Stpp_Api_Xm
160
  }
161
 
162
  protected function _parseRefundResponse($xmlResponse, &$response) {
163
- $response->set('merchantname', (string) $xmlResponse->response->merchant->merchantname);
164
- $response->set('orderreference', (string) $xmlResponse->response->merchant->orderreference);
165
- $response->set('tid', (string) $xmlResponse->response->merchant->tid);
166
- $response->set('merchantnumber', (string) $xmlResponse->response->merchant->merchantnumber);
167
- $response->set('merchantcountryiso2a', (string) $xmlResponse->response->merchant->merchantcountryiso2a);
168
- $response->set('transactionreference', (string) $xmlResponse->response->transactionreference);
169
- $response->set('baseamount', (string) $xmlResponse->response->billing->amount);
170
- $response->set('currencyiso3a', (string) $xmlResponse->response->billing->amount->attributes()->currencycode);
171
- $response->set('paymenttype', (string) $xmlResponse->response->billing->payment->attributes()->type);
172
- $response->set('maskedpan', (string) $xmlResponse->response->billing->payment->pan);
173
- $response->set('authcode', (string) $xmlResponse->response->authcode);
174
- $response->set('securityresponsecode', (string) $xmlResponse->response->security->securitycode);
175
- $response->set('securityresponsepostcode', (string) $xmlResponse->response->security->postcode);
176
- $response->set('securityresponseaddress', (string) $xmlResponse->response->security->address);
177
- $response->set('parenttransactionreference', (string) $xmlResponse->response->operation->parenttransactionreference);
178
- $response->set('accounttypedescription', (string) $xmlResponse->response->operation->accounttypedescription);
179
- $response->set('settleduedate', (string) $xmlResponse->response->settlement->settleduedate);
180
- $response->set('settlestatus', (string) $xmlResponse->response->settlement->settlestatus);
181
  }
182
  }
160
  }
161
 
162
  protected function _parseRefundResponse($xmlResponse, &$response) {
163
+ $response->set('merchantname', (string) $xmlResponse->merchant->merchantname);
164
+ $response->set('orderreference', (string) $xmlResponse->merchant->orderreference);
165
+ $response->set('tid', (string) $xmlResponse->merchant->tid);
166
+ $response->set('merchantnumber', (string) $xmlResponse->merchant->merchantnumber);
167
+ $response->set('merchantcountryiso2a', (string) $xmlResponse->merchant->merchantcountryiso2a);
168
+ $response->set('transactionreference', (string) $xmlResponse->transactionreference);
169
+ $response->set('baseamount', (string) $xmlResponse->billing->amount);
170
+ $response->set('currencyiso3a', (string) $xmlResponse->billing->amount->attributes()->currencycode);
171
+ $response->set('paymenttype', (string) $xmlResponse->billing->payment->attributes()->type);
172
+ $response->set('maskedpan', (string) $xmlResponse->billing->payment->pan);
173
+ $response->set('authcode', (string) $xmlResponse->authcode);
174
+ $response->set('securityresponsecode', (string) $xmlResponse->security->securitycode);
175
+ $response->set('securityresponsepostcode', (string) $xmlResponse->security->postcode);
176
+ $response->set('securityresponseaddress', (string) $xmlResponse->security->address);
177
+ $response->set('parenttransactionreference', (string) $xmlResponse->operation->parenttransactionreference);
178
+ $response->set('accounttypedescription', (string) $xmlResponse->operation->accounttypedescription);
179
+ $response->set('settleduedate', (string) $xmlResponse->settlement->settleduedate);
180
+ $response->set('settlestatus', (string) $xmlResponse->settlement->settlestatus);
181
  }
182
  }
app/code/local/Securetrading/Stpp/lib/code/core/Stpp/Api/Xml/Writer.php CHANGED
@@ -46,7 +46,8 @@ class Stpp_Api_Xml_Writer extends Stpp_Component_Abstract implements Stpp_Api_Xm
46
  public function endRequestBlock() {
47
  $this->_writer->endElement(); // </requestblock>
48
  $this->_writer->endDocument();
49
- return $this->_writer->flush();
 
50
  }
51
 
52
  public function startRequest(Stpp_Data_Request $request) {
@@ -295,10 +296,19 @@ class Stpp_Api_Xml_Writer extends Stpp_Component_Abstract implements Stpp_Api_Xm
295
 
296
  // <settlement>
297
  $xmlWriter->startElement('settlement');
298
-
299
- // <settlebaseamount></settlebaseamount>
300
- $xmlWriter->writeElement('settlebaseamount', $request->get('updates')->get('settlebaseamount'));
301
-
 
 
 
 
 
 
 
 
 
302
  // <settleduedate></settleduedate>
303
  $xmlWriter->writeElement('settleduedate', $request->get('updates')->get('settleduedate'));
304
 
@@ -332,9 +342,12 @@ class Stpp_Api_Xml_Writer extends Stpp_Component_Abstract implements Stpp_Api_Xm
332
  // <billing>
333
  $xmlWriter->startElement('billing');
334
 
335
- // <amount></amount>
336
- $xmlWriter->writeElement('amount', $request->get('baseamount'));
337
-
 
 
 
338
  // </billing>
339
  $xmlWriter->endElement();
340
 
@@ -484,18 +497,18 @@ class Stpp_Api_Xml_Writer extends Stpp_Component_Abstract implements Stpp_Api_Xm
484
 
485
  // </name>
486
  $xmlWriter->endElement();
487
-
488
- // <amount currencycode=''></amount>
489
- $xmlWriter->startElement('amount');
490
- $xmlWriter->writeAttribute('currencycode', $request->get('currencyiso3a'));
491
- $xmlWriter->text($request->get('baseamount'));
492
- $xmlWriter->endElement();
493
-
494
- // <mainamount></mainamount>
495
- $xmlWriter->startElement('mainamount');
496
- $xmlWriter->writeAttribute('currencycode', $request->get('currencyiso3a'));
497
- $xmlWriter->text($request->get('mainamount'));
498
- $xmlWriter->endElement();
499
 
500
  // <email></email>
501
  $xmlWriter->writeElement('email', $request->get('billingemail'));
46
  public function endRequestBlock() {
47
  $this->_writer->endElement(); // </requestblock>
48
  $this->_writer->endDocument();
49
+ $requestString = $this->_writer->flush();
50
+ return $requestString;
51
  }
52
 
53
  public function startRequest(Stpp_Data_Request $request) {
296
 
297
  // <settlement>
298
  $xmlWriter->startElement('settlement');
299
+
300
+ if ($request->get('updates')->has('settlebaseamount')) {
301
+ // <settlebaseamount></settlebaseamount>
302
+ $xmlWriter->writeElement('settlebaseamount', $request->get('updates')->get('settlebaseamount'));
303
+ }
304
+ else if ($request->get('updates')->has('settlemainamount')) {
305
+ // <settlemainamount currencycode=''></settlemainamount>
306
+ $xmlWriter->startElement('settlemainamount');
307
+ $xmlWriter->writeAttribute('currencycode', $request->get('updates')->get('currencyiso3a'));
308
+ $xmlWriter->text($request->get('updates')->get('settlemainamount'));
309
+ $xmlWriter->endElement();
310
+ }
311
+
312
  // <settleduedate></settleduedate>
313
  $xmlWriter->writeElement('settleduedate', $request->get('updates')->get('settleduedate'));
314
 
342
  // <billing>
343
  $xmlWriter->startElement('billing');
344
 
345
+ // <amount></amount>
346
+ $xmlWriter->writeElement('amount', $request->get('baseamount'));
347
+
348
+ // <mainamount></mainamount>
349
+ $xmlWriter->writeElement('mainamount', $request->get('mainamount'));
350
+
351
  // </billing>
352
  $xmlWriter->endElement();
353
 
497
 
498
  // </name>
499
  $xmlWriter->endElement();
500
+
501
+ if ($request->has('baseamount')) {
502
+ // <amount currencycode=''></amount>
503
+ $xmlWriter->writeElement('baseamount', $request->get('baseamount'));
504
+ }
505
+ elseif($request->has('mainamount')) {
506
+ // <mainamount></mainamount>
507
+ $xmlWriter->startElement('mainamount');
508
+ $xmlWriter->writeAttribute('currencycode', $request->get('currencyiso3a'));
509
+ $xmlWriter->text($request->get('mainamount'));
510
+ $xmlWriter->endElement();
511
+ }
512
 
513
  // <email></email>
514
  $xmlWriter->writeElement('email', $request->get('billingemail'));
app/code/local/Securetrading/Stpp/lib/code/core/Stpp/Data/Abstract.php CHANGED
@@ -75,8 +75,9 @@ abstract class Stpp_Data_Abstract extends Stpp_Component_Abstract implements Stp
75
 
76
  public function toArray() {
77
  $array = array();
 
78
  foreach($this->_data as $k => $v) {
79
- if ($v instanceof A_Stpp_Data) {
80
  $array[$k] = $this->_data[$k]->toArray();
81
  }
82
  else {
75
 
76
  public function toArray() {
77
  $array = array();
78
+ $class = __CLASS__;
79
  foreach($this->_data as $k => $v) {
80
+ if ($v instanceof $class) {
81
  $array[$k] = $this->_data[$k]->toArray();
82
  }
83
  else {
app/code/local/Securetrading/Stpp/lib/code/core/Stpp/Data/Request.php CHANGED
@@ -84,7 +84,6 @@ class Stpp_Data_Request extends Stpp_Data_Abstract {
84
 
85
  protected function _setSettlestatus($settleStatus) {
86
  $settleStatusArray = Stpp_Types::getSettleStatuses();
87
- unset($settleStatusArray['3']);
88
  if (!array_key_exists($settleStatus, $settleStatusArray)) {
89
  throw new Stpp_Exception(sprintf($this->__('An invalid settle status ("%s") has been provided.'), $settleStatus));
90
  }
84
 
85
  protected function _setSettlestatus($settleStatus) {
86
  $settleStatusArray = Stpp_Types::getSettleStatuses();
 
87
  if (!array_key_exists($settleStatus, $settleStatusArray)) {
88
  throw new Stpp_Exception(sprintf($this->__('An invalid settle status ("%s") has been provided.'), $settleStatus));
89
  }
app/code/local/Securetrading/Stpp/lib/code/core/Stpp/Data/Response.php CHANGED
@@ -3,6 +3,10 @@
3
  class Stpp_Data_Response extends Stpp_Data_Abstract {
4
  protected $_request;
5
 
 
 
 
 
6
  public function setRequest(Stpp_Data_Request $request) {
7
  $this->_request = $request;
8
  return $this;
@@ -21,4 +25,25 @@ class Stpp_Data_Response extends Stpp_Data_Abstract {
21
  public function hasRequest() {
22
  return $this->_request !== null;
23
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  }
3
  class Stpp_Data_Response extends Stpp_Data_Abstract {
4
  protected $_request;
5
 
6
+ protected $_message = '';
7
+
8
+ protected $_messageIsError = true;
9
+
10
  public function setRequest(Stpp_Data_Request $request) {
11
  $this->_request = $request;
12
  return $this;
25
  public function hasRequest() {
26
  return $this->_request !== null;
27
  }
28
+
29
+ public function setMessage($message, $isError = null) {
30
+ $this->_message = $message;
31
+ if ($isError !== null) {
32
+ $this->setMessageIsError($isError);
33
+ }
34
+ return $this;
35
+ }
36
+
37
+ public function getMessage() {
38
+ return $this->_message;
39
+ }
40
+
41
+ public function setMessageIsError($bool) {
42
+ $this->_messageIsError = (bool) $bool;
43
+ return $this;
44
+ }
45
+
46
+ public function getMessageIsError() {
47
+ return $this->_messageIsError;
48
+ }
49
  }
app/code/local/Securetrading/Stpp/lib/code/core/Stpp/Utility/Log/Writer/File.php CHANGED
@@ -39,7 +39,8 @@ class Stpp_Utility_Log_Writer_File implements Stpp_Utility_Log_WriterInterface {
39
 
40
  protected function _moveToArchive($filePath) {
41
  // Get the filename (the text between the last DIRECTORY_SEPARATOR and the first '.').
42
- $fileNameWithExtension = array_pop(explode(DIRECTORY_SEPARATOR, $filePath));
 
43
  $fileName = substr($fileNameWithExtension, 0, strrpos($fileNameWithExtension, '.'));
44
 
45
  // Calculate the full filepath to the log file:
39
 
40
  protected function _moveToArchive($filePath) {
41
  // Get the filename (the text between the last DIRECTORY_SEPARATOR and the first '.').
42
+ $temp = explode(DIRECTORY_SEPARATOR, $filePath);
43
+ $fileNameWithExtension = array_pop($temp);
44
  $fileName = substr($fileNameWithExtension, 0, strrpos($fileNameWithExtension, '.'));
45
 
46
  // Calculate the full filepath to the log file:
app/code/local/Securetrading/Stpp/lib/magento_child_css.css DELETED
@@ -1,84 +0,0 @@
1
- #head,
2
- #block-billing-details,
3
- #block-delivery-details,
4
- #block-order-details,
5
- #block-choice-order-details,
6
- #payment-logo,
7
- #threed-logo {
8
- display: none;
9
- }
10
-
11
- * {
12
- font-family: Arial,Helvetica,sans-serif;
13
- }
14
-
15
- body,
16
- #content,
17
- fieldset {
18
- background: transparent;
19
- }
20
-
21
- fieldset {
22
- margin-top: 0px;
23
- }
24
-
25
- #content {
26
- min-height: 0px;
27
- padding-bottom: 0px;
28
- }
29
-
30
- #content-internal {
31
- width: 100%;
32
- padding-top: 0px;
33
- }
34
-
35
- #block-message {
36
- width: 100%;
37
- }
38
-
39
- li.message-changepaymentmethod {
40
- background-color: #F5F4C6;
41
- border-color: #DDDDDD;
42
- }
43
-
44
- fieldset {
45
- border-width: 0px;/*: 0px solid #000;*/
46
- }
47
-
48
- #block-payment-details {
49
- /*width: 100%;*/
50
- }
51
-
52
- #footer {
53
- border-top-width: 0px;
54
- text-align: center;
55
- }
56
-
57
- input.form-submit {
58
- background-color: #FFAC47;
59
- background-image: none;
60
- }
61
-
62
- #footer-internal {
63
- width: 100%;
64
- }
65
-
66
- .submit-button {
67
- padding-top: 10px;
68
- clear: both;
69
- display: inline;
70
- float: left;
71
- }
72
-
73
- #submit {
74
- position: static;
75
-
76
- }
77
-
78
- .form-input {
79
- margin: 0.4em 0;
80
- }
81
-
82
- .fieldlabel {
83
- margin-bottom: 5px;
84
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Securetrading/Stpp/lib/stpp_logs/debug.txt ADDED
File without changes
app/code/local/Securetrading/Stpp/readme.txt CHANGED
@@ -161,6 +161,7 @@ DESTINATIONS
161
  errordata
162
  errormessage
163
  order_increment_ids
 
164
 
165
  5 - Click 'Save'.
166
  6 - Back on the main Notifications screen, in the first row of the existing notifications table select the newly created filter and destination from the two blank drop-down boxes.
@@ -174,14 +175,27 @@ The notification is now enabled.
174
 
175
  Once a customer has successfully processed their transaction using the Secure Trading payment pages they can be redirected back to your Magento store.
176
 
177
- Two redirects must be created by completing the redirect request form and emailing it to the Secure Trading Support team (support@securetrading.com).
178
 
179
- The Redirect form can be downloaded here: http://www.securetrading.com/support/download/redirect-request-form
 
 
180
 
181
- The following information should be included in the redirect form:
182
 
183
- Redirect Form 1:
184
- ----------------
 
 
 
 
 
 
 
 
 
 
 
185
  Redirect URL:
186
  <your_root_magento_install_here>/index.php/securetrading/redirect/redirect
187
 
@@ -189,35 +203,38 @@ Redirect Form 1:
189
  orderreference
190
 
191
  Custom Fields:
192
- storeid
193
  order_increment_ids
 
 
 
194
 
195
- Accounttypedescription:
196
- ECOM
 
 
 
 
 
197
 
198
- Errorcode:
 
 
 
 
 
199
  0
200
 
201
- Requesttypedescription:
202
  AUTH
203
-
204
- Redirect Form 2:
205
- ----------------
206
  Redirect URL:
207
  <your_root_magento_install_here>/index.php/admin/sales_order_create_securetrading/redirect
208
 
209
  Fields:
210
  None
211
 
212
- Accounttypedescription:
213
- MOTO
214
-
215
- Errorcode:
216
- 0
217
-
218
- Requesttypedescription:
219
- AUTH
220
-
221
  ------------------
222
  2.4. Site Security - (We strongly recommend enabling this feature).
223
  ------------------
161
  errordata
162
  errormessage
163
  order_increment_ids
164
+ send_confirmation
165
 
166
  5 - Click 'Save'.
167
  6 - Back on the main Notifications screen, in the first row of the existing notifications table select the newly created filter and destination from the two blank drop-down boxes.
175
 
176
  Once a customer has successfully processed their transaction using the Secure Trading payment pages they can be redirected back to your Magento store.
177
 
178
+ You can setup a redirect within MyST provided you have a MyST account with one of the following Roles associated with it:
179
 
180
+ 1 - Site Admin
181
+ 2 - Developer 1
182
+ 3 - Developer 2
183
 
184
+ Further information on setting up Redirects using MyST can be found within section 11 of the MyST User Guide (titled 'Payment Pages Redirects') which can be found at the following URL : http://www.securetrading.com/wp-content/uploads/2013/07/STPP-My-ST-User-Guide.pdf
185
 
186
+ Redirect 1 Condition:
187
+ ---------------------
188
+ Accounts:
189
+ ECOM
190
+
191
+ Error codes:
192
+ 0
193
+
194
+ Requests:
195
+ AUTH
196
+
197
+ Redirect 1 Action:
198
+ ------------------
199
  Redirect URL:
200
  <your_root_magento_install_here>/index.php/securetrading/redirect/redirect
201
 
203
  orderreference
204
 
205
  Custom Fields:
 
206
  order_increment_ids
207
+
208
+ Redirect 1 - Further Information
209
+ --------------------------------
210
 
211
+ If your Magento installation supports multiple websites then you will need to create this redirect for each store that uses the Payment Pages. Use the following configuration:
212
+
213
+ Advanced Settings: (for multiple websites only)
214
+ 'Custom field 1 is [your store ID here]'.
215
+
216
+ Redirect URL: (for multiple websites only)
217
+ <your_root_store_url_here>/index.php/securetrading/redirect/redirect
218
 
219
+ Redirect 2 Condition:
220
+ ---------------------
221
+ Accounts:
222
+ MOTO
223
+
224
+ Error codes:
225
  0
226
 
227
+ Requests:
228
  AUTH
229
+
230
+ Redirect 2 Action:
231
+ ------------------
232
  Redirect URL:
233
  <your_root_magento_install_here>/index.php/admin/sales_order_create_securetrading/redirect
234
 
235
  Fields:
236
  None
237
 
 
 
 
 
 
 
 
 
 
238
  ------------------
239
  2.4. Site Security - (We strongly recommend enabling this feature).
240
  ------------------
app/code/local/Securetrading/Stpp/sql/securetrading_stpp/upgrade-3.1.0-3.2.0.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ $this->startSetup();
5
+
6
+ $data = array(
7
+ array(
8
+ 'type_id' => 'refund',
9
+ 'type_name' => 'Refund',
10
+ ),
11
+ );
12
+
13
+ $transactionTypesTable = $installer->getTable('securetrading_stpp/transaction_types');
14
+ $installer->getConnection()->insertArray($transactionTypesTable, array('type_id', 'type_name'), $data);
15
+
16
+ $installer->getConnection()->addColumn(
17
+ $installer->getTable('securetrading_stpp/transactions'),
18
+ 'account_type_description',
19
+ array(
20
+ 'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
21
+ 'length' => 30,
22
+ 'nullable' => true,
23
+ 'comment' => 'Account Type Description',
24
+ )
25
+ );
26
+
27
+ $installer->endSetup();
app/design/adminhtml/default/default/layout/securetrading.xml CHANGED
@@ -43,4 +43,9 @@
43
  <block type="securetrading_stpp/payment_iframe" name="securetrading_stpp.payment.iframe" as="iframe" template="securetrading/stpp/payment/iframe.phtml" />
44
  </reference>
45
  </adminhtml_sales_order_create_securetrading_iframe>
 
 
 
 
 
46
  </layout>
43
  <block type="securetrading_stpp/payment_iframe" name="securetrading_stpp.payment.iframe" as="iframe" template="securetrading/stpp/payment/iframe.phtml" />
44
  </reference>
45
  </adminhtml_sales_order_create_securetrading_iframe>
46
+
47
+ <adminhtml_sales_order_create_securetrading_location>
48
+ <remove name="root" />
49
+ <block type="securetrading_stpp/payment_location" name="securetrading_stpp.payment.location" as="location" template="securetrading/stpp/payment/location.phtml" output="toHtml" />
50
+ </adminhtml_sales_order_create_securetrading_location>
51
  </layout>
app/design/adminhtml/default/default/template/securetrading/stpp/payment/location.phtml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <html>
2
+ <head>
3
+ <title><?php print $this->__('Redirecting...'); ?></title>
4
+ </head>
5
+ <body>
6
+ <script type="text/javascript">
7
+ //<![CDATA[
8
+ window.top.location.href='<?php print $this->getRedirectUrl() ?>';
9
+ //]]>
10
+ </script>
11
+ </body>
12
+ </html>
app/design/adminhtml/default/default/template/securetrading/stpp/sales/transactions/single.phtml CHANGED
@@ -45,6 +45,10 @@
45
  <th><?php echo $this->__('Error Code'); ?></th>
46
  <td><?php echo $this->getErrorCode() ?></td>
47
  </tr>
 
 
 
 
48
  <tr>
49
  <th><?php echo $this->__('Last Updated At'); ?></th>
50
  <td><?php echo $this->getLastUpdatedAt() ?></td>
@@ -53,7 +57,7 @@
53
  <th><?php echo $this->__('Order ID'); ?></th>
54
  <td>
55
  <a href="<?php print $this->getOrderUrl(); ?>">
56
- <?php echo $this->getOrderId() ?>
57
  </a>
58
  </td>
59
  </tr>
@@ -77,14 +81,14 @@
77
  </div>
78
  </div>
79
  </div>
80
-
81
  <div class="entry-edit">
82
  <div class="entry-edit">
83
  <div class="entry-edit-head">
84
- <h4 class="icon-head head-edit-form fieldset-legend"><?php echo $this->__('Request Data'); ?></h4>
85
  </div>
86
  <div class="log-details-grid">
87
- <?php print $this->getChildHtml('request_data'); ?>
88
  </div>
89
  </div>
90
  </div>
@@ -93,10 +97,12 @@
93
  <div class="entry-edit">
94
  <div class="entry-edit">
95
  <div class="entry-edit-head">
96
- <h4 class="icon-head head-edit-form fieldset-legend"><?php echo $this->__('Response Data'); ?></h4>
97
  </div>
98
  <div class="log-details-grid">
99
- <?php print $this->getChildHtml('response_data'); ?>
100
  </div>
101
  </div>
102
- </div>
 
 
45
  <th><?php echo $this->__('Error Code'); ?></th>
46
  <td><?php echo $this->getErrorCode() ?></td>
47
  </tr>
48
+ <tr>
49
+ <th><?php echo $this->__('Account Type'); ?></th>
50
+ <td><?php echo $this->getAccountTypeDescription() ?></td>
51
+ </tr>
52
  <tr>
53
  <th><?php echo $this->__('Last Updated At'); ?></th>
54
  <td><?php echo $this->getLastUpdatedAt() ?></td>
57
  <th><?php echo $this->__('Order ID'); ?></th>
58
  <td>
59
  <a href="<?php print $this->getOrderUrl(); ?>">
60
+ <?php echo $this->getOrderIncrementId() ?>
61
  </a>
62
  </td>
63
  </tr>
81
  </div>
82
  </div>
83
  </div>
84
+ <!--
85
  <div class="entry-edit">
86
  <div class="entry-edit">
87
  <div class="entry-edit-head">
88
+ <h4 class="icon-head head-edit-form fieldset-legend"><?php //echo $this->__('Request Data'); ?></h4>
89
  </div>
90
  <div class="log-details-grid">
91
+ <?php //print $this->getChildHtml('request_data'); ?>
92
  </div>
93
  </div>
94
  </div>
97
  <div class="entry-edit">
98
  <div class="entry-edit">
99
  <div class="entry-edit-head">
100
+ <h4 class="icon-head head-edit-form fieldset-legend"><?php //echo $this->__('Response Data'); ?></h4>
101
  </div>
102
  <div class="log-details-grid">
103
+ <?php //print $this->getChildHtml('response_data'); ?>
104
  </div>
105
  </div>
106
+ </div>
107
+ -->
108
+ <?php print $this->getChildHtml('transaction_data'); ?>
app/design/frontend/base/default/layout/securetrading.xml CHANGED
@@ -73,8 +73,8 @@
73
 
74
  <securetrading_stpp_direct_post_container>
75
  <update handle="securetrading_stpp_payment" />
76
- <reference name="content"><!--TODO - does below block exist!? -->
77
- <block type="securetrading_stpp/payment_direct_acs" name="securetrading_stpp.payment.direct.acs" template="securetrading/stpp/payment/direct/acs.phtml" />
78
  </reference>
79
  </securetrading_stpp_direct_post_container>
80
 
73
 
74
  <securetrading_stpp_direct_post_container>
75
  <update handle="securetrading_stpp_payment" />
76
+ <reference name="content">
77
+ <block type="securetrading_stpp/payment_direct_post" name="securetrading_stpp.payment.direct.post" template="securetrading/stpp/payment/direct/post.phtml" />
78
  </reference>
79
  </securetrading_stpp_direct_post_container>
80
 
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Securetrading_Stpp</name>
4
- <version>3.1.0.8</version>
5
  <stability>stable</stability>
6
  <license>GPL</license>
7
  <channel>community</channel>
@@ -10,9 +10,9 @@
10
  <description>Integrates Magento with the SecureTrading STPP payment gateway.</description>
11
  <notes>The official SecureTrading STPP Magento integration.</notes>
12
  <authors><author><name>PeteST</name><user>PeteST</user><email>peter.barrow@securetrading.com</email></author></authors>
13
- <date>2014-03-10</date>
14
- <time>17:07:12</time>
15
- <contents><target name="magelocal"><dir name="Securetrading"><dir name="Stpp"><dir name="Block"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><dir name="View"><dir name="Tab"><file name="Modifier.php" hash="23617edc4641c7e3525faae08e11e818"/><file name="Transactions.php" hash="fe4007125601a39b75047f974d25b58e"/></dir></dir></dir><dir name="Transactions"><file name="Children.php" hash="0b35ac5e3a5640ef299797f2cc2928cb"/><dir name="Data"><file name="Abstract.php" hash="d742570fd2d000e7ea5ef57471e194db"/><file name="Request.php" hash="277498a5a058aec448bd32b9433fc5b8"/><file name="Response.php" hash="50afef623df120b8895769528b0174d9"/></dir><file name="Grid.php" hash="733fd8f8c7c6a9d7e78549946929d751"/><file name="Single.php" hash="579c91c55d0bda1a557d30eb6c03eb9c"/></dir><file name="Transactions.php" hash="ef8d946452081c50ea50a2f56d9ff168"/></dir><dir name="System"><dir name="Config"><dir name="Fieldset"><file name="Fields.php" hash="0310bae31c21c3d4df46107fbce3cdfa"/></dir><file name="Group.php" hash="7f36f8de6918d4d75a1ba059194a31df"/></dir></dir><dir name="Widget"><dir name="Grid"><dir name="Column"><dir name="Renderer"><file name="Parenttransactionreference.php" hash="2d1ef69a9554457d150e0064f24a02b2"/></dir></dir></dir></dir></dir><dir name="Payment"><dir name="Direct"><file name="Form.php" hash="7ac72932a0af03d8ee0f039238325e1e"/><file name="Info.php" hash="96b45fd3a2530d32ad5b762d30adb349"/><file name="Post.php" hash="5e76814c5156accd9fc45c6f8925e553"/></dir><file name="Iframe.php" hash="1bf66cdd951253928cce893d7235ccf2"/><dir name="Info"><file name="Abstract.php" hash="d3b57a1f6bb7353aa066ea669c5179c7"/></dir><file name="Location.php" hash="95461da6e144559bb26b56fcb5733c29"/><dir name="Redirect"><file name="Form.php" hash="4a5c80135121a495a94e193b0d7f1982"/><file name="Info.php" hash="5172a488856a167205abab64819062d5"/><file name="Post.php" hash="00d05d0064ecbc5bdc75b615bdfc4894"/></dir></dir></dir><dir name="Controller"><dir name="Redirect"><dir name="Post"><file name="Abstract.php" hash="f26396762758c1fe090460751d7c50e8"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="7a5e840b55cd85810bbb5670d884913d"/></dir><dir name="Model"><dir name="Actions"><file name="Abstract.php" hash="800051473f2baac8a390d10e094c8127"/><file name="Direct.php" hash="1806c9720199162fb939c7e2f4260074"/><file name="Redirect.php" hash="58f970dc6f7cf3fc18b93b9e7776d74a"/></dir><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Backend"><file name="Multiselect.php" hash="65ca6dd7b6b597aada4978b7c6e803c2"/></dir></dir></dir></dir><file name="Cron.php" hash="57c166a645f9b0309c9be7c9e0e2ecb0"/><file name="Integration.php" hash="e005353995be9cf79a7e5251c6193491"/><file name="Observer.php" hash="650fec98e19d9bb448e7953397c12499"/><dir name="Payment"><file name="Abstract.php" hash="9db804ea16f016c48a6be9d4205e97c5"/><dir name="Direct"><file name="Session.php" hash="981654031f061f1e04efc80b4a57b428"/></dir><file name="Direct.php" hash="09d2607b2447d16d6a53fe3c532f4556"/><dir name="Redirect"><file name="Notification.php" hash="22e2a3366aa294f83aabe94decdbc47f"/><file name="Request.php" hash="cb3b90d9bb7a31bec42ae94ae83770cb"/></dir><file name="Redirect.php" hash="bac0262e0d2b5dba5d78834d769f3bc8"/></dir><dir name="Resource"><dir name="Payment"><dir name="Redirect"><file name="Notification.php" hash="251daf3860785e6aab8b5a6594bf397a"/><dir name="Request"><file name="Collection.php" hash="ce960dbcdf4c40f08782750b3e7ec4d4"/></dir><file name="Request.php" hash="9a51ce8b5aa2bf188e39afcd099225d1"/></dir></dir><dir name="Transaction"><file name="Collection.php" hash="c48174c935a30b1df2e545ff3ad71adc"/><dir name="Types"><file name="Collection.php" hash="efc344d22f5b19ad8a239ec3acb20e77"/></dir><file name="Types.php" hash="abbde61e4d29e19bb3a67ad1959b388f"/></dir><file name="Transaction.php" hash="a864a129f03751920262b847a1711f4d"/></dir><dir name="Source"><file name="Cardtypes.php" hash="bdac2842ee54f15d4deab2cd1e0caea6"/><file name="Connection.php" hash="b281807c740f8a79f591789a3d8792d7"/><file name="Paymentaction.php" hash="0f05df5d7e5248808c96700e102a2b11"/><file name="Settleduedate.php" hash="b5acc4d4eae0a22d4bf25e5fd5f2cda0"/><file name="Settlestatus.php" hash="c65d0810ffa5e4cfe7d086a489303eda"/></dir><dir name="Transaction"><file name="Types.php" hash="d704d79ee9cf90d6c678fdbbb5d66b6d"/></dir><file name="Transaction.php" hash="4d0ef347983194e026b5746f7a6ddd41"/><file name="Transport.php" hash="c0694f56126c89de202c6adb0108082c"/></dir><dir name="controllers"><dir name="Direct"><file name="PostController.php" hash="8961fb743e3fd0124c0e642ff74a6810"/></dir><file name="DirectController.php" hash="b10baf3ed1a40d6f80e2f639370d8be3"/><file name="MultishippingController.php" hash="29eba3273479799bca3ec36c32d0f86a"/><file name="PaymentController.php" hash="a1fb4d11fa71c75180af3ca6bea99f25"/><dir name="Redirect"><dir name="Post"><file name="MultishippingController.php" hash="77bad529935b43b48e16269572498b8d"/><file name="OnepageController.php" hash="0d9a9aa74f70f2995eb417123ed5242d"/></dir></dir><file name="RedirectController.php" hash="0913375e46743bca606c222409875440"/><dir name="Sales"><dir name="Order"><dir name="Create"><file name="SecuretradingController.php" hash="9865f9994c16f24353b39526d4b02a3c"/></dir><file name="CreateController.php" hash="0e61ccd7c3e08971db36b1f2e04af9ce"/><file name="EditController.php" hash="8d516942c3c10e3f4120e7a10e98c81d"/></dir></dir><dir name="Securetrading"><file name="TransactionsController.php" hash="f99b8dd9081ab99f00b8fc083d9d9ae3"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="4893ab9fecad1a67037bdabd7bb5aa96"/><file name="config.xml" hash="98241aaaf4af2732c41c47d461dc06cc"/><file name="system.xml" hash="87f5905707756d1f875567ead9728054"/></dir><dir name="lib"><file name="Securetrading.php" hash="740260870e77fd6fffa597ec11fbd540"/><dir name="code"><dir name="core"><dir name="Stpp"><dir name="Actions"><file name="Abstract.php" hash="fce4b439f195bb866983180fe57e3bf7"/><file name="BaseInterface.php" hash="cd3004a4734c99499b41f9442d8406f4"/></dir><dir name="Api"><file name="ActionsInterface.php" hash="20feaa9eaefa912efb02d3cd33212fa2"/><file name="Base.php" hash="4d21e40c7af399c15521ff122c7b0d67"/><file name="BaseInterface.php" hash="252e16b85c0e7e230934b02c3e16728d"/><dir name="Connection"><file name="BaseInterface.php" hash="8638cb072cf263abd8687e87cdc81fb5"/><file name="Stapi.php" hash="107a6a41d31b021ddbd84739499b1830"/><file name="Store.php" hash="3909b4aa2b618816c4380d4b41d2d375"/><file name="StoreInterface.php" hash="6e8bfff449b86b145ae5b138dde91d50"/><file name="Webservices.php" hash="6eb6f7d1a29de997b957eb72ba5de59c"/></dir><file name="Context.php" hash="4b4471af376dbb0023f9836a9e8557fc"/><file name="ContextInterface.php" hash="b3e9edfa4fe8776140eafce41da98709"/><file name="Facade.php" hash="d5b1f579af75a6ad07dbae25e0f23dd2"/><file name="Helper.php" hash="1fa61f567d149594e02bb4e5ee9c23ed"/><file name="HelperInterface.php" hash="aa6f9747d5c2f242455d5c11be51b66b"/><file name="Log.php" hash="8f9df624ea7e440f7d074be07a98e511"/><file name="LogInterface.php" hash="fce5c3d966eaf5885f3575bd800c6d46"/><file name="Process.php" hash="7db529c5ebb80b21ad6e2b8fe07b8089"/><file name="ProcessInterface.php" hash="76117fc893006c7a927eda90596261f3"/><file name="Result.php" hash="8146ff3cd41bc1c23eb9cad8192d8cec"/><file name="ResultInterface.php" hash="eb062e7e941172e6258eb3fe6eb25c71"/><file name="Send.php" hash="ec79e21c81a6521a7813267cad1d9103"/><file name="SendInterface.php" hash="0a13ea22e3d2f556be7f02d5b8568e43"/><dir name="Xml"><file name="Reader.php" hash="36baf335da8050798ccf3eda63b78606"/><file name="ReaderInterface.php" hash="3a148a5b88af125d766877f33dd882b7"/><file name="Writer.php" hash="3832c9b19967873aa7683bc86e0595dd"/><file name="WriterInterface.php" hash="1700903ae09c5dec1a8b6c215a6f0a97"/></dir></dir><dir name="Component"><file name="Abstract.php" hash="ab8f75478d9b11383d2e4cf39f99f92d"/><file name="BaseInterface.php" hash="a7a21448d576cba4921a17e3c4c63e26"/><file name="Store.php" hash="8afe5baa023a117085dfca51d8d6d0c4"/></dir><file name="Config.php" hash="e62fcc26e717a67051abd0873998c3d7"/><dir name="Data"><file name="Abstract.php" hash="20a4f4c90e1b0536a53bb47dd02f7013"/><file name="AbstractInterface.php" hash="511f49db6045b20b299ac27a123b0ee1"/><file name="Request.php" hash="e7b17b29918177be85c1b2ec29c02a2c"/><file name="Response.php" hash="61ad719240e67b23e5cec2083c83d4ae"/></dir><file name="Exception.php" hash="ddef67bc724764d3fa455b3f246e670d"/><file name="Facade.php" hash="b044ddd9a1c2e0097bea099efa1f6bd5"/><dir name="Fields"><file name="Admin.php" hash="dad214c2f8b8c9300316abe10073dc3d"/><file name="AdminInterface.php" hash="d60603c6fe6ac4393edc3e699d11cfa2"/><file name="Facade.php" hash="4f00cf6fb606175bb8c1a98988504cb7"/><file name="Frontend.php" hash="e558224f8c3adf54733c1df71e14a8f1"/><file name="FrontendInterface.php" hash="9e7e760b58d9b1aea5169199f85055b8"/></dir><file name="Helper.php" hash="1b9e5cda59cab32904f41a1137732889"/><file name="HelperInterface.php" hash="e74c27a61169ac2dbad549178635b652"/><dir name="PaymentPages"><file name="ActionsInterface.php" hash="477836396b30505fd77e2edab9228eb9"/><file name="Base.php" hash="86e1829a428e28334f5a280636066216"/><file name="BaseInterface.php" hash="8e88b88ea80bbc678275b545f5a0ca0e"/><file name="Facade.php" hash="6592fe506f9b11f2bc5d59290c2089ac"/><file name="Helper.php" hash="0f299510045851097ddb2f5e5999130b"/><file name="HelperInterface.php" hash="92cb7856303a054852856f84fce59ab8"/><file name="Result.php" hash="516d99ad6325d3688cb6cf9d96611bad"/><file name="ResultInterface.php" hash="6331633ee01a8f801e6aa92bc4b21a79"/></dir><dir name="Result"><file name="Abstract.php" hash="e101a37e53b02217d9f71896724fc464"/><file name="AbstractInterface.php" hash="67f281eeb616125a6730c9d0bdcdefbf"/></dir><file name="Types.php" hash="f6623d4ecc2cf85f1e9b90bdcded3bbe"/><file name="TypesInterface.php" hash="01535df4e4e7bb7075a06050841594f0"/><dir name="Utility"><file name="Facade.php" hash="a87ccac18a334e151e109cf07b5338f0"/><dir name="Log"><file name="Base.php" hash="6d4a4ac38eeb8747199ae932caab713b"/><file name="BaseInterface.php" hash="8df2532e217b93725ab15e5a76dfd6e7"/><dir name="User"><file name="Abstract.php" hash="622318fca2ae84a50f50f65153036528"/></dir><file name="UserInterface.php" hash="f88f34cb0338ab4d98c3f5ebcbb22f7d"/><dir name="Writer"><file name="File.php" hash="ac8301a7c10222459cdd0f789783a2bc"/></dir><file name="WriterInterface.php" hash="0e4e743dd4c8da74fea389c8f728b0b4"/></dir><dir name="Translator"><file name="Base.php" hash="4ff1233235a2b58886da2a3b07247d9a"/><file name="BaseInterface.php" hash="f76d5808b75e190bb6499da9608c9efb"/></dir></dir><dir name="Xml"><file name="Writer.php" hash="97a246a7642179bd346cfce33f523c87"/></dir></dir><file name="Stpp.php" hash="2b593e5ee83d4272bb4efac0fb09c88b"/></dir><dir name="overrides"><dir name="Magento"><dir name="Utility"><file name="Facade.php" hash="efbd45016fa27108d3b8dbeb4f085b25"/><dir name="Log"><file name="Writer.php" hash="ac55bea5883c26734f7fcd71d0a63445"/></dir></dir></dir></dir></dir><file name="magento_child_css.css" hash="e9b6ad79401514f21b6497a9ea14f1b3"/><dir name="stpp_logs"><file name="api.txt" hash="d41d8cd98f00b204e9800998ecf8427e"/><file name="exception.txt" hash="d41d8cd98f00b204e9800998ecf8427e"/></dir><dir name="stpp_translations"><file name="core.php" hash="8de46a7cce58eadbff4ae9b294e20aec"/></dir></dir><file name="readme.txt" hash="386fbb213e971a81846ced3d0cb16aaa"/><dir name="sql"><dir name="securetrading_stpp"><file name="install-3.0.0.php" hash="c5e0924c2e113343856d35c25d85fa26"/><file name="upgrade-3.0.0-3.1.0.php" hash="779de6f21f30913707d67573434c5827"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="securetrading"><dir><dir name="stpp"><dir name="payment"><dir name="direct"><file name="form.phtml" hash="1ebafc1b8fe9b5534c79e838187ca93a"/><file name="info.phtml" hash="e6537fa0b3ff758b694f40d5f6437da8"/></dir><file name="iframe.phtml" hash="550f6904467d71a368b03b2ba6852841"/><dir name="redirect"><file name="form.phtml" hash="d41d8cd98f00b204e9800998ecf8427e"/><file name="info.phtml" hash="e6537fa0b3ff758b694f40d5f6437da8"/><file name="post.phtml" hash="8b0b70df44ce27b54c57c7369dd59655"/></dir></dir><dir name="sales"><dir name="transactions"><file name="single.phtml" hash="42f46e7ce305f376b38a33374088f62e"/></dir></dir><dir name="system"><dir name="config"><dir name="fieldset"><file name="fields.phtml" hash="0c0aff08f256a5cfd2c644e7f629c9d7"/></dir></dir></dir></dir></dir></dir></dir><dir name="layout"><file name="securetrading.xml" hash="702c1f0992e6bd9404839e328f656788"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="securetrading"><dir><dir name="stpp"><dir name="payment"><dir name="direct"><file name="form.phtml" hash="84793faa4856fa0a5f1d31777507f257"/><file name="info.phtml" hash="990e48a8f00f86691a64f5f9cf371b05"/><file name="post.phtml" hash="d8643b7e67de32c311c30b531b0c6392"/></dir><file name="iframe.phtml" hash="550f6904467d71a368b03b2ba6852841"/><file name="location.phtml" hash="e790bf7d7f7c453f98cd9e03e0b74ab1"/><dir name="redirect"><file name="form.phtml" hash="7590b97c94ac8a7058606c82a2bd3766"/><file name="info.phtml" hash="4eaf8674c2de27618920fdcd65d61ade"/><file name="post.phtml" hash="c4edc4e15986cfc9dd010fe4eb915ccc"/></dir></dir></dir></dir></dir></dir><dir name="layout"><file name="securetrading.xml" hash="c5071fac015dbd017e0e8dde65ecf5d5"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="SecureTrading_Stpp.xml" hash="92a8948ac28f1ca221b1743e710a97d1"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="images"><dir name="securetrading"><dir name="stpp"><file name="st_logo_strapline_200_63.png" hash="bca24f2696fca0d2bca54681a635e8e3"/></dir></dir></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.3.0</min><max>5.5.8</max></php></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Securetrading_Stpp</name>
4
+ <version>3.1.1.13</version>
5
  <stability>stable</stability>
6
  <license>GPL</license>
7
  <channel>community</channel>
10
  <description>Integrates Magento with the SecureTrading STPP payment gateway.</description>
11
  <notes>The official SecureTrading STPP Magento integration.</notes>
12
  <authors><author><name>PeteST</name><user>PeteST</user><email>peter.barrow@securetrading.com</email></author></authors>
13
+ <date>2014-04-09</date>
14
+ <time>08:28:15</time>
15
+ <contents><target name="magelocal"><dir name="Securetrading"><dir name="Stpp"><dir name="Block"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><dir name="View"><dir name="Tab"><file name="Modifier.php" hash="0bd4d015736253fdb49a71761e0ce167"/><file name="Transactions.php" hash="fe4007125601a39b75047f974d25b58e"/></dir></dir></dir><dir name="Transactions"><file name="Children.php" hash="0b35ac5e3a5640ef299797f2cc2928cb"/><dir name="Data"><file name="Abstract.php" hash="b959d39031f05c4c4cdc9c86d949d2fb"/><file name="Request.php" hash="974c787900f673b88789e077bbb1cdee"/><file name="Response.php" hash="cde9edd437f258f3790d48d4801d1d14"/></dir><file name="Grid.php" hash="3dadcca29051df9ef955fb3f779bc77e"/><file name="Single.php" hash="e0f722dd28882d3f60f73c11a70da963"/><dir name="Type"><file name="Abstract.php" hash="d6fc7cebd2fabb908e56e1b31430606a"/><file name="Default.php" hash="3b079c4dc23ae7ca0dde58d90d76ce1b"/><dir name="Transactionupdate"><file name="Filters.php" hash="fb57db23243321b2e3adbe8d4d6b6b00"/><file name="Updates.php" hash="97cf9ab359d5832eef6e994c76f10229"/></dir><file name="Transactionupdate.php" hash="054a96bd931424b9b8e3123252d815a7"/></dir></dir><file name="Transactions.php" hash="d7a848751b019beed67af4af8d82f19e"/></dir><dir name="System"><dir name="Config"><dir name="Fieldset"><file name="Fields.php" hash="6a4b315ba3d3d9eabe627f04ed36af51"/></dir><file name="Group.php" hash="7f36f8de6918d4d75a1ba059194a31df"/></dir></dir><dir name="Widget"><dir name="Grid"><dir name="Column"><dir name="Renderer"><file name="Parenttransactionreference.php" hash="2d1ef69a9554457d150e0064f24a02b2"/></dir></dir></dir></dir></dir><dir name="Payment"><dir name="Direct"><file name="Form.php" hash="7ac72932a0af03d8ee0f039238325e1e"/><file name="Info.php" hash="96b45fd3a2530d32ad5b762d30adb349"/><file name="Post.php" hash="dc9037dbae9b10ccf088b24fc08e7dd2"/></dir><file name="Iframe.php" hash="1bf66cdd951253928cce893d7235ccf2"/><dir name="Info"><file name="Abstract.php" hash="d3b57a1f6bb7353aa066ea669c5179c7"/></dir><file name="Location.php" hash="2ffcd84c447b187ffa6dc0e45b6393ac"/><dir name="Redirect"><file name="Form.php" hash="4a5c80135121a495a94e193b0d7f1982"/><file name="Info.php" hash="5172a488856a167205abab64819062d5"/><file name="Post.php" hash="00d05d0064ecbc5bdc75b615bdfc4894"/></dir></dir></dir><dir name="Controller"><dir name="Redirect"><dir name="Post"><file name="Abstract.php" hash="f26396762758c1fe090460751d7c50e8"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="7a5e840b55cd85810bbb5670d884913d"/></dir><dir name="Model"><dir name="Actions"><file name="Abstract.php" hash="0d3f5c0f5b3db287e750e5ea2519c805"/><file name="Direct.php" hash="04adfd2beab16e9348c94b0c36163f53"/><file name="Redirect.php" hash="0c477c21df66309dd95dd1cec4c86e9e"/></dir><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Backend"><file name="Multiselect.php" hash="65ca6dd7b6b597aada4978b7c6e803c2"/></dir></dir></dir></dir><file name="Cron.php" hash="57c166a645f9b0309c9be7c9e0e2ecb0"/><file name="Integration.php" hash="916d31052581fca3513dfef1d2b869af"/><file name="Observer.php" hash="389dd2e397316d34e6134bafddb74819"/><dir name="Payment"><file name="Abstract.php" hash="8d7c6f8b69864495798cd38bf8cf4508"/><dir name="Direct"><file name="Session.php" hash="981654031f061f1e04efc80b4a57b428"/></dir><file name="Direct.php" hash="0a0818c2f6d6c3efc044053037aa25c2"/><dir name="Redirect"><file name="Notification.php" hash="22e2a3366aa294f83aabe94decdbc47f"/><file name="Request.php" hash="cb3b90d9bb7a31bec42ae94ae83770cb"/></dir><file name="Redirect.php" hash="2ca42d783848851c55d77d4f1603baca"/></dir><dir name="Resource"><dir name="Payment"><dir name="Redirect"><file name="Notification.php" hash="251daf3860785e6aab8b5a6594bf397a"/><dir name="Request"><file name="Collection.php" hash="ce960dbcdf4c40f08782750b3e7ec4d4"/></dir><file name="Request.php" hash="9a51ce8b5aa2bf188e39afcd099225d1"/></dir></dir><dir name="Transaction"><file name="Collection.php" hash="c48174c935a30b1df2e545ff3ad71adc"/><dir name="Types"><file name="Collection.php" hash="efc344d22f5b19ad8a239ec3acb20e77"/></dir><file name="Types.php" hash="abbde61e4d29e19bb3a67ad1959b388f"/></dir><file name="Transaction.php" hash="a864a129f03751920262b847a1711f4d"/></dir><dir name="Source"><file name="Cardtypes.php" hash="bdac2842ee54f15d4deab2cd1e0caea6"/><file name="Connection.php" hash="b281807c740f8a79f591789a3d8792d7"/><file name="Paymentaction.php" hash="0f05df5d7e5248808c96700e102a2b11"/><file name="Settleduedate.php" hash="b5acc4d4eae0a22d4bf25e5fd5f2cda0"/><file name="Settlestatus.php" hash="c65d0810ffa5e4cfe7d086a489303eda"/></dir><dir name="Transaction"><file name="Types.php" hash="1c3712f053e0dadd4edc34ec115effff"/></dir><file name="Transaction.php" hash="7e2ee1468535006435d186ddd651d861"/></dir><dir name="controllers"><dir name="Direct"><file name="PostController.php" hash="8961fb743e3fd0124c0e642ff74a6810"/></dir><file name="DirectController.php" hash="b10baf3ed1a40d6f80e2f639370d8be3"/><file name="MultishippingController.php" hash="29eba3273479799bca3ec36c32d0f86a"/><file name="PaymentController.php" hash="5babd6cb7602948f8a2a2cce169b829c"/><dir name="Redirect"><dir name="Post"><file name="MultishippingController.php" hash="77bad529935b43b48e16269572498b8d"/><file name="OnepageController.php" hash="0d9a9aa74f70f2995eb417123ed5242d"/></dir></dir><file name="RedirectController.php" hash="9bdfa028b78c80b28526d4c7b8342deb"/><dir name="Sales"><dir name="Order"><dir name="Create"><file name="SecuretradingController.php" hash="f4ffe353922e6063f7c734806b16c224"/></dir><file name="CreateController.php" hash="7964d98f1574c0f93dbb43e87161f1f8"/><file name="EditController.php" hash="a12e458fac106c021367426031356f58"/></dir></dir><dir name="Securetrading"><file name="TransactionsController.php" hash="f99b8dd9081ab99f00b8fc083d9d9ae3"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="4893ab9fecad1a67037bdabd7bb5aa96"/><file name="config.xml" hash="3ac86186ead527918235f3b91f28b494"/><file name="system.xml" hash="7e8cda4186496dbdd62e29c86a8d6515"/></dir><dir name="lib"><file name="Securetrading.php" hash="5c22e508ffd059847ffb882aba923b2b"/><dir name="code"><dir name="core"><dir name="Stpp"><dir name="Actions"><file name="Abstract.php" hash="462542d98f325cc497d6ff21b76714fc"/><file name="BaseInterface.php" hash="cd3004a4734c99499b41f9442d8406f4"/></dir><dir name="Api"><file name="ActionsInterface.php" hash="20feaa9eaefa912efb02d3cd33212fa2"/><file name="Base.php" hash="4d21e40c7af399c15521ff122c7b0d67"/><file name="BaseInterface.php" hash="252e16b85c0e7e230934b02c3e16728d"/><dir name="Connection"><file name="BaseInterface.php" hash="8638cb072cf263abd8687e87cdc81fb5"/><file name="Stapi.php" hash="107a6a41d31b021ddbd84739499b1830"/><file name="Store.php" hash="3909b4aa2b618816c4380d4b41d2d375"/><file name="StoreInterface.php" hash="6e8bfff449b86b145ae5b138dde91d50"/><file name="Webservices.php" hash="fc1ab0625bdecb34662793d76a55b57b"/></dir><file name="Context.php" hash="0ca6f4a61de6113b124795ed8fe83cab"/><file name="ContextInterface.php" hash="b3e9edfa4fe8776140eafce41da98709"/><file name="Facade.php" hash="18a61ca48dbab4a429a7db49bd753ae6"/><file name="Helper.php" hash="1a744bee30eecf5d13cddc29d02049eb"/><file name="HelperInterface.php" hash="aa6f9747d5c2f242455d5c11be51b66b"/><file name="Log.php" hash="8f9df624ea7e440f7d074be07a98e511"/><file name="LogInterface.php" hash="fce5c3d966eaf5885f3575bd800c6d46"/><dir name="Process"><dir name="Calculation"><file name="BaseInterface.php" hash="385960d9d3cd780d194716300a8fc1fa"/><file name="CardstoreNoncardstoreCombined.php" hash="5390f91635fac340ada1bc9d9116a85c"/><file name="Default.php" hash="fc6fbc1b5ad9b405eab5ccfba644fab5"/><file name="RiskdecNonriskdecCombined.php" hash="f72e84f24e5bc57842d15c556e6b275e"/><file name="TuRefundCombined.php" hash="9de65bce6f7d6e49574f4aafb8075ffb"/></dir></dir><file name="Process.php" hash="1809c3052c3fa9147e806493742ce3e5"/><file name="ProcessInterface.php" hash="76117fc893006c7a927eda90596261f3"/><file name="Result.php" hash="d9da44e9241b8b9d7577de8e7e5d6ef0"/><file name="ResultInterface.php" hash="345346e779a4644c8f29d847100ae779"/><file name="Send.php" hash="353c400fe8a72db44a514df07074b6a3"/><file name="SendInterface.php" hash="0a13ea22e3d2f556be7f02d5b8568e43"/><dir name="Xml"><file name="Reader.php" hash="4791b2c4ef0d0997bb063a8c08ceaedf"/><file name="ReaderInterface.php" hash="3a148a5b88af125d766877f33dd882b7"/><file name="Writer.php" hash="2ec6b1e68bd1ca54bcb548db8779b8f3"/><file name="WriterInterface.php" hash="1700903ae09c5dec1a8b6c215a6f0a97"/></dir></dir><dir name="Component"><file name="Abstract.php" hash="ab8f75478d9b11383d2e4cf39f99f92d"/><file name="BaseInterface.php" hash="a7a21448d576cba4921a17e3c4c63e26"/><file name="Store.php" hash="8afe5baa023a117085dfca51d8d6d0c4"/></dir><file name="Config.php" hash="e62fcc26e717a67051abd0873998c3d7"/><dir name="Data"><file name="Abstract.php" hash="9186ff9e00d3446e85dbf19ea1216e6a"/><file name="AbstractInterface.php" hash="511f49db6045b20b299ac27a123b0ee1"/><file name="Request.php" hash="a4206b389b91b3506b66b9942d922976"/><file name="Response.php" hash="41bce777ce4baf6d33f5efe1a754e1f1"/></dir><file name="Exception.php" hash="ddef67bc724764d3fa455b3f246e670d"/><file name="Facade.php" hash="b044ddd9a1c2e0097bea099efa1f6bd5"/><dir name="Fields"><file name="Admin.php" hash="dad214c2f8b8c9300316abe10073dc3d"/><file name="AdminInterface.php" hash="d60603c6fe6ac4393edc3e699d11cfa2"/><file name="Facade.php" hash="4f00cf6fb606175bb8c1a98988504cb7"/><file name="Frontend.php" hash="e558224f8c3adf54733c1df71e14a8f1"/><file name="FrontendInterface.php" hash="9e7e760b58d9b1aea5169199f85055b8"/></dir><file name="Helper.php" hash="1b9e5cda59cab32904f41a1137732889"/><file name="HelperInterface.php" hash="e74c27a61169ac2dbad549178635b652"/><dir name="PaymentPages"><file name="ActionsInterface.php" hash="477836396b30505fd77e2edab9228eb9"/><file name="Base.php" hash="86e1829a428e28334f5a280636066216"/><file name="BaseInterface.php" hash="8e88b88ea80bbc678275b545f5a0ca0e"/><file name="Facade.php" hash="6592fe506f9b11f2bc5d59290c2089ac"/><file name="Helper.php" hash="0f299510045851097ddb2f5e5999130b"/><file name="HelperInterface.php" hash="92cb7856303a054852856f84fce59ab8"/><file name="Result.php" hash="516d99ad6325d3688cb6cf9d96611bad"/><file name="ResultInterface.php" hash="6331633ee01a8f801e6aa92bc4b21a79"/></dir><dir name="Result"><file name="Abstract.php" hash="e101a37e53b02217d9f71896724fc464"/><file name="AbstractInterface.php" hash="67f281eeb616125a6730c9d0bdcdefbf"/></dir><file name="Types.php" hash="f6623d4ecc2cf85f1e9b90bdcded3bbe"/><file name="TypesInterface.php" hash="01535df4e4e7bb7075a06050841594f0"/><dir name="Utility"><file name="Facade.php" hash="a87ccac18a334e151e109cf07b5338f0"/><dir name="Log"><file name="Base.php" hash="6d4a4ac38eeb8747199ae932caab713b"/><file name="BaseInterface.php" hash="8df2532e217b93725ab15e5a76dfd6e7"/><dir name="User"><file name="Abstract.php" hash="622318fca2ae84a50f50f65153036528"/></dir><file name="UserInterface.php" hash="f88f34cb0338ab4d98c3f5ebcbb22f7d"/><dir name="Writer"><file name="File.php" hash="5eada117593cf8c9bb27a6060f6c3714"/></dir><file name="WriterInterface.php" hash="0e4e743dd4c8da74fea389c8f728b0b4"/></dir><dir name="Translator"><file name="Base.php" hash="4ff1233235a2b58886da2a3b07247d9a"/><file name="BaseInterface.php" hash="f76d5808b75e190bb6499da9608c9efb"/></dir></dir><dir name="Xml"><file name="Writer.php" hash="97a246a7642179bd346cfce33f523c87"/></dir></dir><file name="Stpp.php" hash="2b593e5ee83d4272bb4efac0fb09c88b"/></dir><dir name="overrides"><dir name="Magento"><dir name="Utility"><file name="Facade.php" hash="efbd45016fa27108d3b8dbeb4f085b25"/><dir name="Log"><file name="Writer.php" hash="ac55bea5883c26734f7fcd71d0a63445"/></dir></dir></dir></dir></dir><dir name="stpp_logs"><file name="api.txt" hash="d41d8cd98f00b204e9800998ecf8427e"/><file name="debug.txt" hash="d41d8cd98f00b204e9800998ecf8427e"/><file name="exception.txt" hash="d41d8cd98f00b204e9800998ecf8427e"/></dir><dir name="stpp_translations"><file name="core.php" hash="8de46a7cce58eadbff4ae9b294e20aec"/></dir></dir><file name="readme.txt" hash="a4ae94ed11f53075b6a5513bd7082da6"/><dir name="sql"><dir name="securetrading_stpp"><file name="install-3.0.0.php" hash="c5e0924c2e113343856d35c25d85fa26"/><file name="upgrade-3.0.0-3.1.0.php" hash="779de6f21f30913707d67573434c5827"/><file name="upgrade-3.1.0-3.2.0.php" hash="6f9e0b4cb006faede031f5a170af8798"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="securetrading"><dir><dir name="stpp"><dir name="payment"><dir name="direct"><file name="form.phtml" hash="1ebafc1b8fe9b5534c79e838187ca93a"/><file name="info.phtml" hash="e6537fa0b3ff758b694f40d5f6437da8"/></dir><file name="iframe.phtml" hash="550f6904467d71a368b03b2ba6852841"/><file name="location.phtml" hash="e790bf7d7f7c453f98cd9e03e0b74ab1"/><dir name="redirect"><file name="form.phtml" hash="d41d8cd98f00b204e9800998ecf8427e"/><file name="info.phtml" hash="e6537fa0b3ff758b694f40d5f6437da8"/><file name="post.phtml" hash="8b0b70df44ce27b54c57c7369dd59655"/></dir></dir><dir name="sales"><dir name="transactions"><file name="single.phtml" hash="062fb0afe59e07f89828b4c162de2773"/></dir></dir><dir name="system"><dir name="config"><dir name="fieldset"><file name="fields.phtml" hash="0c0aff08f256a5cfd2c644e7f629c9d7"/></dir></dir></dir></dir></dir></dir></dir><dir name="layout"><file name="securetrading.xml" hash="c9253b162d0b6ea0fb8297b70606711e"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="securetrading"><dir><dir name="stpp"><dir name="payment"><dir name="direct"><file name="form.phtml" hash="84793faa4856fa0a5f1d31777507f257"/><file name="info.phtml" hash="990e48a8f00f86691a64f5f9cf371b05"/><file name="post.phtml" hash="d8643b7e67de32c311c30b531b0c6392"/></dir><file name="iframe.phtml" hash="550f6904467d71a368b03b2ba6852841"/><file name="location.phtml" hash="e790bf7d7f7c453f98cd9e03e0b74ab1"/><dir name="redirect"><file name="form.phtml" hash="7590b97c94ac8a7058606c82a2bd3766"/><file name="info.phtml" hash="4eaf8674c2de27618920fdcd65d61ade"/><file name="post.phtml" hash="c4edc4e15986cfc9dd010fe4eb915ccc"/></dir></dir></dir></dir></dir></dir><dir name="layout"><file name="securetrading.xml" hash="906aacd5e1f49d2d1b8b710d4b50a26d"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="SecureTrading_Stpp.xml" hash="92a8948ac28f1ca221b1743e710a97d1"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="images"><dir name="securetrading"><dir name="stpp"><file name="st_logo_strapline_200_63.png" hash="bca24f2696fca0d2bca54681a635e8e3"/></dir></dir></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.3.0</min><max>5.5.8</max></php></required></dependencies>
18
  </package>