Securetrading_Stpp - Version 3.4.0

Version Notes

The official SecureTrading STPP Magento integration.

Download this release

Release Info

Developer PeteST
Extension Securetrading_Stpp
Version 3.4.0
Comparing to
See all releases


Code changes from version 3.3.0 to 3.4.0

app/code/local/Securetrading/Stpp/Block/Adminhtml/System/Config/Fieldset/Fields.php CHANGED
@@ -112,6 +112,10 @@ class Securetrading_Stpp_Block_Adminhtml_System_Config_Fieldset_Fields
112
  $label = $fields->getLabel(Stpp_Fields_Admin::FIELD_PPG_CHILD_JS);
113
  $tooltip = $fields->getDescription(Stpp_Fields_Admin::FIELD_PPG_CHILD_JS);
114
  break;
 
 
 
 
115
  case 'use_api':
116
  $label = $fields->getLabel(Stpp_Fields_Admin::FIELD_PPG_USE_API);
117
  $tooltip = $fields->getDescription(Stpp_Fields_Admin::FIELD_PPG_USE_API);
112
  $label = $fields->getLabel(Stpp_Fields_Admin::FIELD_PPG_CHILD_JS);
113
  $tooltip = $fields->getDescription(Stpp_Fields_Admin::FIELD_PPG_CHILD_JS);
114
  break;
115
+ case 'sub_site_reference':
116
+ $label = $fields->getLabel(Stpp_Fields_Admin::FIELD_PPG_SUB_SITE_REFERENCE);
117
+ $tooltip = $fields->getDescription(Stpp_Fields_Admin::FIELD_PPG_SUB_SITE_REFERENCE);
118
+ break;
119
  case 'use_api':
120
  $label = $fields->getLabel(Stpp_Fields_Admin::FIELD_PPG_USE_API);
121
  $tooltip = $fields->getDescription(Stpp_Fields_Admin::FIELD_PPG_USE_API);
app/code/local/Securetrading/Stpp/Model/Actions/Abstract.php CHANGED
@@ -1,309 +1,309 @@
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
- if ($transaction && $transaction->getResponseType() === Securetrading_Stpp_Model_Transaction_Types::TYPE_THREEDQUERY) { // api 3d query used - so auth request didn't have settlestatus so need to get 3dq request.
31
- $requestData = $transaction->getRequestData();
32
- $requestedSettleStatus = $requestData['settlestatus'];
33
- }
34
- else {
35
- $requestedSettleStatus = $response->getRequest()->get('settlestatus');
36
- }
37
- return (string) $requestedSettleStatus;
38
- }
39
-
40
- protected function _getRiskdecTransaction($transactionReference) {
41
- if ($transaction = Mage::getModel('securetrading_stpp/transaction')->loadByTransactionReference($transactionReference, true)) {
42
- return $transaction->searchAncestorsForRequestType(Securetrading_Stpp_Model_Transaction_Types::TYPE_RISKDEC);
43
- }
44
- return false;
45
- }
46
-
47
- protected function _riskdecTransactionHasShieldStatusCode($transaction, $shieldStatusCodes) {
48
- if (!is_array($shieldStatusCodes)) {
49
- $shieldStatusCodes = array($shieldStatusCodes);
50
- }
51
- if ($transaction->getRequestType() !== Securetrading_Stpp_Model_Transaction_Types::TYPE_RISKDEC) {
52
- throw new Stpp_Exception(sprintf(Mage::helper('securetrading_stpp')->__('Invalid transaction type: %s.'), $transaction->getRequestType()));
53
- }
54
- if (!in_array($transaction->getResponseData('fraudcontrolshieldstatuscode'), $shieldStatusCodes)) {
55
- return false;
56
- }
57
- return true;
58
- }
59
-
60
- protected function _paymentIsSuccessful(Stpp_Data_Response $response) {
61
- $result = false;
62
- if ($response->get('errorcode') === '0') {
63
- if (in_array($response->get('settlestatus'), array('0', '1', '100'), true)) {
64
- $result = true;
65
- }
66
- else if ($response->get('settlestatus') === '2') {
67
- if ($this->_getRequestedSettleStatus($response) === '2') {
68
- $riskdecTransaction = $this->_getRiskdecTransaction($response->get('parenttransactionreference'));
69
- if (!$riskdecTransaction || $this->_riskdecTransactionHasShieldStatusCode($riskdecTransaction, 'ACCEPT')) {
70
- $result = true;
71
- }
72
- }
73
- }
74
- else {
75
- throw new Exception(sprintf(Mage::helper('securetrading_stpp')->__('Invalid settle status: "%s".'), $response->get('settlestatus')));
76
- }
77
- }
78
- return $result;
79
- }
80
-
81
- protected function _authShouldEnterPaymentReview(Stpp_Data_Response $response) {
82
- $result = false;
83
- if ($response->get('errorcode') === '0' && $response->get('settlestatus') === '2') {
84
- if ($this->_getRequestedSettleStatus($response) === '2') {
85
- $riskdecTransaction = $this->_getRiskdecTransaction($response->get('parenttransactionreference'));
86
- if ($riskdecTransaction && $this->_riskdecTransactionHasShieldStatusCode($riskdecTransaction, array('CHALLENGE', 'DENY'))) {
87
- $result = true;
88
- }
89
- }
90
- else {
91
- $result = true;
92
- }
93
- }
94
- return $result;
95
- }
96
-
97
- protected function _authShouldEnterPaymentReviewAndBeDenied(Stpp_Data_Response $response) {
98
- $result = false;
99
- if ($response->get('errorcode') === '60107') {
100
- $result = true;
101
- }
102
- return $result;
103
- }
104
- //TODO - consistency of auths/captures being open or closed.
105
- protected function _paymentReviewAndDeny(Stpp_Data_Response $response, Mage_Sales_Model_Order $order) {
106
- $payment = $order->getPayment();
107
- $payment->setNotificationResult(true);
108
- $payment->registerPaymentReviewAction(Mage_Sales_Model_Order_Payment::REVIEW_ACTION_DENY, false);
109
- $this->_setCoreTransaction($response, false);
110
- $order->save();
111
  }
112
-
113
- protected function _addGenericErrorToOrderStatusHistory(Stpp_Data_Response $response, Mage_Sales_Model_Order $order) {
114
- $message = sprintf('Payment failed: %s - %s.', $response->get('errorcode'), $response->get('errormessage'));
115
- $order->addStatusHistoryComment($message, false);
116
- $order->save();
 
 
 
 
 
 
 
 
 
 
117
  }
118
-
119
- public function processAuth(Stpp_Data_Response $response) {
120
- $this->_log($response, sprintf('In %s.', __METHOD__));
121
-
122
- $order = $this->_getOrder($response);
123
- $payment = $order->getPayment();
124
-
125
- if ($this->_paymentIsSuccessful($response)) {
126
- $closeCoreTransaction = $response->get('settlestatus') === '0';
127
- $this->_setCoreTransaction($response, $closeCoreTransaction);
128
- }
129
- else if ($this->_authShouldEnterPaymentReview($response)) {
130
- $payment->setIsTransactionPending(true);
131
- $this->_setCoreTransaction($response, false);
132
- }
133
- else if ($this->_authShouldEnterPaymentReviewAndBeDenied($response)) {
134
- $this->_paymentReviewAndDeny($response, $order);
135
- }
136
- else {
137
- $this->_addGenericErrorToOrderStatusHistory($response, $order);
138
- }
139
-
140
- $this->_addTransaction(Securetrading_Stpp_Model_Transaction_Types::TYPE_AUTH, $response);
141
-
142
- $payment
143
- ->setAdditionalInformation('account_type_description', $response->get('accounttypedescription'))
144
- ->setAdditionalInformation('security_address', $response->get('securityresponseaddress'))
145
- ->setAdditionalInformation('security_postcode', $response->get('securityresponsepostcode'))
146
- ->setAdditionalInformation('security_code', $response->get('securityresponsesecuritycode'))
147
- ->setAdditionalInformation('enrolled', $response->get('enrolled'))
148
- ->setAdditionalInformation('status', $response->get('status'))
149
- ->setCcTransId($response->get('transactionreference'))
150
- ->setCcLast($payment->getMethodInstance()->getIntegration()->getCcLast4($response->get('maskedpan')))
151
- ;
152
-
153
- $order->save();
154
- return parent::processAuth($response);
155
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
156
 
157
- public function process3dQuery(Stpp_Data_Response $response) {
158
- $this->_log($response, sprintf('In %s.', __METHOD__));
159
- $this->_addTransaction(Securetrading_Stpp_Model_Transaction_Types::TYPE_THREEDQUERY, $response);
160
- Mage::getSingleton('checkout/session')
161
- ->setAcsUrl($response->get('acsurl'))
162
- ->setPaReq($response->get('pareq'))
163
- ->setTermUrl($response->getRequest()->get('termurl'))
164
- ->setMd($response->get('md'))
165
- ;
166
-
167
- if ($this->_authShouldEnterPaymentReviewAndBeDenied($response)) {
168
- $this->_paymentReviewAndDeny($response, $this->_getOrder($response));
169
- }
170
-
171
- return parent::process3dQuery($response);
172
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
173
 
174
- public function processRiskDecision(Stpp_Data_Response $response) {
175
- $this->_log($response, sprintf('In %s.', __METHOD__));
176
- $this->_addTransaction(Securetrading_Stpp_Model_Transaction_Types::TYPE_RISKDEC, $response);
177
- $this->_getOrder($response)->getPayment()->setAdditionalInformation('shield_status_code', $response->get('fraudcontrolshieldstatuscode'))->save();
178
- return parent::processRiskDecision($response);
 
 
 
 
 
 
 
 
 
 
 
179
  }
 
 
 
 
 
 
 
 
 
 
180
 
181
- public function processTransactionUpdate(Stpp_Data_Response $response) {
182
- $this->_log($response, sprintf('In %s.', __METHOD__));
183
- $this->_addTransaction(Securetrading_Stpp_Model_Transaction_Types::TYPE_TRANSACTIONUPDATE, $response);
184
 
185
- if ($response->get('errorcode') === '0') {
186
- $this->_setCoreTransaction($response, null, $response->getRequest()->get('filter')->get('transactionreference'));
187
- }
188
- elseif($response->get('errorcode') === '60017') { // transaction not updatable
189
- $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);
190
- }
191
- return parent::processTransactionUpdate($response);
192
  }
193
-
194
- public function processRefund(Stpp_Data_Response $response) {
195
- $this->_log($response, sprintf('In %s.', __METHOD__));
196
- if ($response->get('errorcode') === '0') {
197
- $this->_setCoreTransaction($response, null, $response->getRequest()->get('parenttransactionreference'));
198
- }
199
- $this->_addTransaction(Securetrading_Stpp_Model_Transaction_Types::TYPE_REFUND, $response);
200
- return parent::processRefund($response);
201
  }
 
 
202
 
203
- public function processAccountCheck(Stpp_Data_Response $response) {
204
- $this->_log($response, sprintf('In %s.', __METHOD__));
205
- $this->_addTransaction(Securetrading_Stpp_Model_Transaction_Types::TYPE_ACCOUNTCHECK, $response);
206
- return parent::processAccountCheck($response);
207
  }
 
 
 
208
 
209
- protected function _log(Stpp_Data_Response $response, $message) {
210
- $this->_getOrder($response)->getPayment()->getMethodInstance()->log($message);
211
- }
 
 
 
 
 
 
212
 
213
- protected function _addTransaction($responseType, $response) {
214
- $orderId = $this->_getOrder($response)->getId();
215
- $errorCode = $response->get('errorcode');
216
- $transactionReference = $response->get('transactionreference') ? $response->get('transactionreference') : $response->get('responseblockrequestreference');
217
- $parentTransactionReference = $response->get('parenttransactionreference');
218
- $accountTypeDescription = $response->get('accounttypedescription');
219
- $parentTransactionId = null;
220
 
221
- if ($parentTransactionReference) {
222
- $transaction = Mage::getModel('securetrading_stpp/transaction')->loadByTransactionReference($parentTransactionReference, true);
223
- if ($transaction) {
224
- $parentTransactionId = $transaction->getTransactionId();
225
- }
226
- }
227
- $responseData = $response->toArray();
228
- $requestData = $response->getRequest()->toArray();
229
 
230
- $requestTypeDescription = $response->getRequest()->get('requesttypedescription') ?: $response->get('requesttypedescription'); // look in request object for api, response object for ppg.
231
- $requestType = $this->_mapRequestType($requestTypeDescription);
232
 
233
- Mage::getModel('securetrading_stpp/transaction')
234
- ->setTransactionReference($transactionReference)
235
- ->setParentTransactionId($parentTransactionId)
236
- ->setRequestType($requestType)
237
- ->setResponseType($responseType)
238
- ->setRequestData($requestData)
239
- ->setResponseData($responseData)
240
- ->setErrorCode($errorCode)
241
- ->setAccountTypeDescription($accountTypeDescription)
242
- ->setOrderId($orderId)
243
- ->save()
244
- ;
245
- }
246
 
247
- protected function _mapRequestType($requestType) {
248
- switch($requestType) {
249
- case Stpp_Types::API_AUTH:
250
- $return = Securetrading_Stpp_Model_Transaction_Types::TYPE_AUTH;
251
- break;
252
- case Stpp_Types::API_THREEDQUERY:
253
- $return = Securetrading_Stpp_Model_Transaction_Types::TYPE_THREEDQUERY;
254
- break;
255
- case Stpp_Types::API_RISKDEC:
256
- $return = Securetrading_Stpp_Model_Transaction_Types::TYPE_RISKDEC;
257
- break;
258
- case Stpp_Types::API_TRANSACTIONUPDATE:
259
- $return = Securetrading_Stpp_Model_Transaction_Types::TYPE_TRANSACTIONUPDATE;
260
- break;
261
- case Stpp_Types::API_ACCOUNTCHECK:
262
- $return = Securetrading_Stpp_Model_Transaction_Types::TYPE_ACCOUNTCHECK;
263
- break;
264
- case Stpp_Types::API_REFUND:
265
- $return = Securetrading_Stpp_Model_Transaction_Types::TYPE_REFUND;
266
- break;
267
- default:
268
- $return = '';
269
- }
270
- return $return;
271
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
272
 
273
- protected function _setCoreTransaction(Stpp_Data_Response $response, $isClosed = null, $parentTransactionId = null) {
274
- $payment = $this->_getOrder($response)->getPayment();
275
-
276
- $transactionId = $response->get('transactionreference') ? $response->get('transactionreference') : $response->get('responseblockrequestreference');
277
- $parentTransactionId !== null ? $parentTransactionId : null;
278
-
279
- $payment->setTransactionId($transactionId);
280
- $payment->setParentTransactionId($parentTransactionId);
281
- $payment->setTransactionAdditionalInfo(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS,
282
- $this->_flattenArray(
283
- array(
284
- 'Request' => $response->getRequest()->toArray(),
285
- 'Response' => $response->toArray()
286
- )
287
- )
288
- );
289
-
290
- if($isClosed !== null) {
291
- $payment->setIsTransactionClosed($isClosed);
292
- }
293
  }
 
294
 
295
- protected function _flattenArray($input, $separator = ' - ', array $prefix = array()) {
296
- $oneDimensionArray = array();
297
- foreach($input as $k => $v) {
298
- $currentPrefix = array_merge($prefix, array($k));
299
- if (is_array($v)) {
300
- $oneDimensionArray += $this->_flattenArray($v, $separator, $currentPrefix);
301
- }
302
- else {
303
- $key = implode($currentPrefix, $separator);
304
- $oneDimensionArray[$key] = $v;
305
- }
306
- }
307
- return $oneDimensionArray;
308
  }
 
 
309
  }
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
+ if ($transaction && $transaction->getResponseType() === Securetrading_Stpp_Model_Transaction_Types::TYPE_THREEDQUERY) { // api 3d query used - so auth request didn't have settlestatus so need to get 3dq request.
31
+ $requestData = $transaction->getRequestData();
32
+ $requestedSettleStatus = $requestData['settlestatus'];
33
+ }
34
+ else {
35
+ $requestedSettleStatus = $response->getRequest()->get('settlestatus');
36
+ }
37
+ return (string) $requestedSettleStatus;
38
+ }
39
+
40
+ protected function _getRiskdecTransaction($transactionReference) {
41
+ if ($transaction = Mage::getModel('securetrading_stpp/transaction')->loadByTransactionReference($transactionReference, true)) {
42
+ return $transaction->searchAncestorsForRequestType(Securetrading_Stpp_Model_Transaction_Types::TYPE_RISKDEC);
43
+ }
44
+ return false;
45
+ }
46
+
47
+ protected function _riskdecTransactionHasShieldStatusCode($transaction, $shieldStatusCodes) {
48
+ if (!is_array($shieldStatusCodes)) {
49
+ $shieldStatusCodes = array($shieldStatusCodes);
50
+ }
51
+ if ($transaction->getRequestType() !== Securetrading_Stpp_Model_Transaction_Types::TYPE_RISKDEC) {
52
+ throw new Stpp_Exception(sprintf(Mage::helper('securetrading_stpp')->__('Invalid transaction type: %s.'), $transaction->getRequestType()));
53
+ }
54
+ if (!in_array($transaction->getResponseData('fraudcontrolshieldstatuscode'), $shieldStatusCodes)) {
55
+ return false;
56
+ }
57
+ return true;
58
+ }
59
+
60
+ protected function _paymentIsSuccessful(Stpp_Data_Response $response) {
61
+ $result = false;
62
+ if ($response->get('errorcode') === '0') {
63
+ if (in_array($response->get('settlestatus'), array('0', '1', '100'), true)) {
64
+ $result = true;
65
+ }
66
+ else if ($response->get('settlestatus') === '2') {
67
+ if ($this->_getRequestedSettleStatus($response) === '2') {
68
+ $riskdecTransaction = $this->_getRiskdecTransaction($response->get('parenttransactionreference'));
69
+ if (!$riskdecTransaction || $this->_riskdecTransactionHasShieldStatusCode($riskdecTransaction, 'ACCEPT')) {
70
+ $result = true;
71
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
  }
73
+ }
74
+ else {
75
+ throw new Exception(sprintf(Mage::helper('securetrading_stpp')->__('Invalid settle status: "%s".'), $response->get('settlestatus')));
76
+ }
77
+ }
78
+ return $result;
79
+ }
80
+
81
+ protected function _authShouldEnterPaymentReview(Stpp_Data_Response $response) {
82
+ $result = false;
83
+ if ($response->get('errorcode') === '0' && $response->get('settlestatus') === '2') {
84
+ if ($this->_getRequestedSettleStatus($response) === '2') {
85
+ $riskdecTransaction = $this->_getRiskdecTransaction($response->get('parenttransactionreference'));
86
+ if ($riskdecTransaction && $this->_riskdecTransactionHasShieldStatusCode($riskdecTransaction, array('CHALLENGE', 'DENY'))) {
87
+ $result = true;
88
  }
89
+ }
90
+ else {
91
+ $result = true;
92
+ }
93
+ }
94
+ return $result;
95
+ }
96
+
97
+ protected function _authShouldEnterPaymentReviewAndBeDenied(Stpp_Data_Response $response) {
98
+ $result = false;
99
+ if ($response->get('errorcode') === '60107') {
100
+ $result = true;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
101
  }
102
+ return $result;
103
+ }
104
+ //TODO - consistency of auths/captures being open or closed.
105
+ protected function _paymentReviewAndDeny(Stpp_Data_Response $response, Mage_Sales_Model_Order $order) {
106
+ $payment = $order->getPayment();
107
+ $payment->setNotificationResult(true);
108
+ $payment->registerPaymentReviewAction(Mage_Sales_Model_Order_Payment::REVIEW_ACTION_DENY, false);
109
+ $this->_setCoreTransaction($response, false);
110
+ $order->save();
111
+ }
112
+
113
+ protected function _addGenericErrorToOrderStatusHistory(Stpp_Data_Response $response, Mage_Sales_Model_Order $order) {
114
+ $message = sprintf('Payment failed: %s - %s.', $response->get('errorcode'), $response->get('errormessage'));
115
+ $order->addStatusHistoryComment($message, false);
116
+ $order->save();
117
+ }
118
+
119
+ public function processAuth(Stpp_Data_Response $response) {
120
+ $this->_log($response, sprintf('In %s.', __METHOD__));
121
 
122
+ $order = $this->_getOrder($response);
123
+ $payment = $order->getPayment();
124
+
125
+ if ($this->_paymentIsSuccessful($response)) {
126
+ $closeCoreTransaction = $response->get('settlestatus') === '0';
127
+ $this->_setCoreTransaction($response, $closeCoreTransaction);
128
+ }
129
+ else if ($this->_authShouldEnterPaymentReview($response)) {
130
+ $payment->setIsTransactionPending(true);
131
+ $this->_setCoreTransaction($response, false);
132
+ }
133
+ else if ($this->_authShouldEnterPaymentReviewAndBeDenied($response)) {
134
+ $this->_paymentReviewAndDeny($response, $order);
 
 
135
  }
136
+ else {
137
+ $this->_addGenericErrorToOrderStatusHistory($response, $order);
138
+ }
139
+
140
+ $this->_addTransaction(Securetrading_Stpp_Model_Transaction_Types::TYPE_AUTH, $response);
141
+
142
+ $payment
143
+ ->setAdditionalInformation('account_type_description', $response->get('accounttypedescription'))
144
+ ->setAdditionalInformation('security_address', $response->get('securityresponseaddress'))
145
+ ->setAdditionalInformation('security_postcode', $response->get('securityresponsepostcode'))
146
+ ->setAdditionalInformation('security_code', $response->get('securityresponsesecuritycode'))
147
+ ->setAdditionalInformation('enrolled', $response->get('enrolled'))
148
+ ->setAdditionalInformation('status', $response->get('status'))
149
+ ->setCcTransId($response->get('transactionreference'))
150
+ ->setCcLast($payment->getMethodInstance()->getIntegration()->getCcLast4($response->get('maskedpan')))
151
+ ;
152
 
153
+ $order->save();
154
+ return parent::processAuth($response);
155
+ }
156
+
157
+ public function process3dQuery(Stpp_Data_Response $response) {
158
+ $this->_log($response, sprintf('In %s.', __METHOD__));
159
+ $this->_addTransaction(Securetrading_Stpp_Model_Transaction_Types::TYPE_THREEDQUERY, $response);
160
+ Mage::getSingleton('checkout/session')
161
+ ->setAcsUrl($response->get('acsurl'))
162
+ ->setPaReq($response->get('pareq'))
163
+ ->setTermUrl($response->getRequest()->get('termurl'))
164
+ ->setMd($response->get('md'))
165
+ ;
166
+
167
+ if ($this->_authShouldEnterPaymentReviewAndBeDenied($response)) {
168
+ $this->_paymentReviewAndDeny($response, $this->_getOrder($response));
169
  }
170
+
171
+ return parent::process3dQuery($response);
172
+ }
173
+
174
+ public function processRiskDecision(Stpp_Data_Response $response) {
175
+ $this->_log($response, sprintf('In %s.', __METHOD__));
176
+ $this->_addTransaction(Securetrading_Stpp_Model_Transaction_Types::TYPE_RISKDEC, $response);
177
+ $this->_getOrder($response)->getPayment()->setAdditionalInformation('shield_status_code', $response->get('fraudcontrolshieldstatuscode'))->save();
178
+ return parent::processRiskDecision($response);
179
+ }
180
 
181
+ public function processTransactionUpdate(Stpp_Data_Response $response) {
182
+ $this->_log($response, sprintf('In %s.', __METHOD__));
183
+ $this->_addTransaction(Securetrading_Stpp_Model_Transaction_Types::TYPE_TRANSACTIONUPDATE, $response);
184
 
185
+ if ($response->get('errorcode') === '0') {
186
+ $this->_setCoreTransaction($response, null, $response->getRequest()->get('filter')->get('transactionreference'));
 
 
 
 
 
187
  }
188
+ elseif($response->get('errorcode') === '60017') { // transaction not updatable
189
+ $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);
 
 
 
 
 
 
190
  }
191
+ return parent::processTransactionUpdate($response);
192
+ }
193
 
194
+ public function processRefund(Stpp_Data_Response $response) {
195
+ $this->_log($response, sprintf('In %s.', __METHOD__));
196
+ if ($response->get('errorcode') === '0') {
197
+ $this->_setCoreTransaction($response, null, $response->getRequest()->get('parenttransactionreference'));
198
  }
199
+ $this->_addTransaction(Securetrading_Stpp_Model_Transaction_Types::TYPE_REFUND, $response);
200
+ return parent::processRefund($response);
201
+ }
202
 
203
+ public function processAccountCheck(Stpp_Data_Response $response) {
204
+ $this->_log($response, sprintf('In %s.', __METHOD__));
205
+ $this->_addTransaction(Securetrading_Stpp_Model_Transaction_Types::TYPE_ACCOUNTCHECK, $response);
206
+ return parent::processAccountCheck($response);
207
+ }
208
+
209
+ protected function _log(Stpp_Data_Response $response, $message) {
210
+ $this->_getOrder($response)->getPayment()->getMethodInstance()->log($message);
211
+ }
212
 
213
+ protected function _addTransaction($responseType, $response) {
214
+ $orderId = $this->_getOrder($response)->getId();
215
+ $errorCode = $response->get('errorcode');
216
+ $transactionReference = $response->get('transactionreference') ? $response->get('transactionreference') : $response->get('responseblockrequestreference');
217
+ $parentTransactionReference = $response->get('parenttransactionreference');
218
+ $accountTypeDescription = $response->get('accounttypedescription');
219
+ $parentTransactionId = null;
220
 
221
+ if ($parentTransactionReference) {
222
+ $transaction = Mage::getModel('securetrading_stpp/transaction')->loadByTransactionReference($parentTransactionReference, true);
223
+ if ($transaction) {
224
+ $parentTransactionId = $transaction->getTransactionId();
225
+ }
226
+ }
227
+ $responseData = $response->toArray();
228
+ $requestData = $response->getRequest()->toArray();
229
 
230
+ $requestTypeDescription = $response->getRequest()->get('requesttypedescription') ?: $response->get('requesttypedescription'); // look in request object for api, response object for ppg.
231
+ $requestType = $this->_mapRequestType($requestTypeDescription);
232
 
233
+ Mage::getModel('securetrading_stpp/transaction')
234
+ ->setTransactionReference($transactionReference)
235
+ ->setParentTransactionId($parentTransactionId)
236
+ ->setRequestType($requestType)
237
+ ->setResponseType($responseType)
238
+ ->setRequestData($requestData)
239
+ ->setResponseData($responseData)
240
+ ->setErrorCode($errorCode)
241
+ ->setAccountTypeDescription($accountTypeDescription)
242
+ ->setOrderId($orderId)
243
+ ->save()
244
+ ;
245
+ }
246
 
247
+ protected function _mapRequestType($requestType) {
248
+ switch($requestType) {
249
+ case Stpp_Types::API_AUTH:
250
+ $return = Securetrading_Stpp_Model_Transaction_Types::TYPE_AUTH;
251
+ break;
252
+ case Stpp_Types::API_THREEDQUERY:
253
+ $return = Securetrading_Stpp_Model_Transaction_Types::TYPE_THREEDQUERY;
254
+ break;
255
+ case Stpp_Types::API_RISKDEC:
256
+ $return = Securetrading_Stpp_Model_Transaction_Types::TYPE_RISKDEC;
257
+ break;
258
+ case Stpp_Types::API_TRANSACTIONUPDATE:
259
+ $return = Securetrading_Stpp_Model_Transaction_Types::TYPE_TRANSACTIONUPDATE;
260
+ break;
261
+ case Stpp_Types::API_ACCOUNTCHECK:
262
+ $return = Securetrading_Stpp_Model_Transaction_Types::TYPE_ACCOUNTCHECK;
263
+ break;
264
+ case Stpp_Types::API_REFUND:
265
+ $return = Securetrading_Stpp_Model_Transaction_Types::TYPE_REFUND;
266
+ break;
267
+ default:
268
+ $return = '';
 
 
269
  }
270
+ return $return;
271
+ }
272
+
273
+ protected function _setCoreTransaction(Stpp_Data_Response $response, $isClosed = null, $parentTransactionId = null) {
274
+ $payment = $this->_getOrder($response)->getPayment();
275
+
276
+ $transactionId = $response->get('transactionreference') ? $response->get('transactionreference') : $response->get('responseblockrequestreference');
277
+ $parentTransactionId !== null ? $parentTransactionId : null;
278
+
279
+ $payment->setTransactionId($transactionId);
280
+ $payment->setParentTransactionId($parentTransactionId);
281
+ $payment->setTransactionAdditionalInfo(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS,
282
+ $this->_flattenArray(
283
+ array(
284
+ 'Request' => $response->getRequest()->toArray(),
285
+ 'Response' => $response->toArray()
286
+ )
287
+ )
288
+ );
289
 
290
+ if($isClosed !== null) {
291
+ $payment->setIsTransactionClosed($isClosed);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
292
  }
293
+ }
294
 
295
+ protected function _flattenArray($input, $separator = ' - ', array $prefix = array()) {
296
+ $oneDimensionArray = array();
297
+ foreach($input as $k => $v) {
298
+ $currentPrefix = array_merge($prefix, array($k));
299
+ if (is_array($v)) {
300
+ $oneDimensionArray += $this->_flattenArray($v, $separator, $currentPrefix);
301
+ }
302
+ else {
303
+ $key = implode($currentPrefix, $separator);
304
+ $oneDimensionArray[$key] = $v;
305
+ }
 
 
306
  }
307
+ return $oneDimensionArray;
308
+ }
309
  }
app/code/local/Securetrading/Stpp/Model/Actions/Direct.php CHANGED
@@ -1,16 +1,83 @@
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
- $order = $this->_getOrder($response);
7
-
8
- if ($this->_paymentIsSuccessful($response) || $this->_authShouldEnterPaymentReview($response)) {
9
- if ($response->getRequest()->has('md')) {//TODO - should we check pending 3ds here too?
10
- Mage::getModel('securetrading_stpp/payment_direct')->registerSuccessfulOrderAfterExternalRedirect($order, $this->_getRequestedSettleStatus($response));
11
- }
12
- $order->getPayment()->getMethodInstance()->handleSuccessfulPayment($order, true);
13
- }
14
- return $this->_isErrorCodeZero($response);
15
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  }
1
  <?php
2
 
3
  class Securetrading_Stpp_Model_Actions_Direct extends Securetrading_Stpp_Model_Actions_Abstract implements Stpp_Api_ActionsInterface {
4
+ const MULTISHIPPING_ORDERS_REGISTRY_KEY = 'securetrading_stpp_actions_direct_multishipping_orders_registry_key';
5
+
6
+ protected function _getOrders(Stpp_Data_Response $response) {
7
+ if (Mage::getModel('checkout/session')->getQuote()->getIsMultiShipping()) {
8
+ $orders = Mage::registry(Securetrading_Stpp_Model_Actions_Direct::MULTISHIPPING_ORDERS_REGISTRY_KEY);
9
+ return $orders;
10
+ }
11
+ else { // onepage
12
+ return array($this->_getOrder($response));
13
+ }
14
+ }
15
+
16
+ public function processAuth(Stpp_Data_Response $response) {
17
+ foreach($this->_getOrders($response) as $order) {
18
+ $this->setOrder($order);
19
+ $this->_processAuth($response);
20
+ }
21
+ $quote = Mage::getModel('sales/quote')->loadByIdWithoutStore($order->getQuoteId());;
22
+ if ($quote->getIsMultiShipping()) { // The multishipping successAction() requires an active quote (the quote was set to inactive in handleSuccessfulPayment() above.
23
+ Mage::getSingleton('checkout/type_multishipping_state')
24
+ ->setActiveStep(Mage_Checkout_Model_Type_Multishipping_State::STEP_SUCCESS)
25
+ ->setCompleteStep(Mage_Checkout_Model_Type_Multishipping_State::STEP_OVERVIEW)
26
+ ;
27
+ $quote->setIsActive(true)->save();
28
+ }
29
+ return $this->_isErrorCodeZero($response);
30
+ }
31
+
32
+ protected function _processAuth(Stpp_Data_Response $response) {
33
+ parent::processAuth($response);
34
+ $order = $this->_getOrder($response);
35
+
36
+ if ($this->_paymentIsSuccessful($response) || $this->_authShouldEnterPaymentReview($response)) {
37
+ if ($response->getRequest()->has('md')) {
38
+ Mage::getModel('securetrading_stpp/payment_direct')->registerSuccessfulOrderAfterExternalRedirect($order, $this->_getRequestedSettleStatus($response));
39
+ }
40
+ $order->getPayment()->getMethodInstance()->handleSuccessfulPayment($order, true);
41
+ }
42
+ }
43
+
44
+ public function process3dQuery(Stpp_Data_Response $response) {
45
+ foreach($this->_getOrders($response) as $order) {
46
+ $this->setOrder($order);
47
+ parent::process3dQuery($response);
48
+ }
49
+ return $this->_isErrorCodeZero($response);
50
+ }
51
+
52
+ public function processRiskDecision(Stpp_Data_Response $response) {
53
+ foreach($this->_getOrders($response) as $order) {
54
+ $this->setOrder($order);
55
+ parent::processRiskDecision($response);
56
+ }
57
+ return $this->_isErrorCodeZero($response);
58
+ }
59
+
60
+ public function processTransactionUpdate(Stpp_Data_Response $response) {
61
+ foreach($this->_getOrders($response) as $order) {
62
+ $this->setOrder($order);
63
+ parent::processTransactionUpdate($response);
64
+ }
65
+ return $this->_isErrorCodeZero($response);
66
+ }
67
+
68
+ public function processRefund(Stpp_Data_Response $response) {
69
+ foreach($this->_getOrders($response) as $order) {
70
+ $this->setOrder($order);
71
+ parent::processRefund($response);
72
+ }
73
+ return $this->_isErrorCodeZero($response);
74
+ }
75
+
76
+ public function processAccountCheck(Stpp_Data_Response $response) {
77
+ foreach($this->_getOrders($response) as $order) {
78
+ $this->setOrder($order);
79
+ parent::processAccountCheck($response);
80
+ }
81
+ return $this->_isErrorCodeZero($response);
82
+ }
83
  }
app/code/local/Securetrading/Stpp/Model/Integration.php CHANGED
@@ -1,315 +1,316 @@
1
  <?php
2
 
3
  class Securetrading_Stpp_Model_Integration extends Mage_Core_Model_Abstract {
4
- protected $_facade;
5
 
6
- protected $_ppagesFacade;
7
 
8
- protected $_apiFacade;
9
 
10
- protected $_ppagesActionInstance;
11
 
12
- protected $_apiActionInstance;
13
 
14
- protected $_frontendFields;
15
 
16
- protected $_adminFields;
17
 
18
- protected $_debugLog;
19
 
20
- public function _construct() {
21
- require_once(Mage::getModuleDir('', 'Securetrading_Stpp') . DS . 'lib' . DS . 'Securetrading.php');
22
- Securetrading::init();
23
 
24
- $config = array();
25
- $paymentMethod = $this->getPaymentMethod();
26
 
27
- if ($paymentMethod) {
28
- $this->_ppagesActionInstance = Mage::getModel('securetrading_stpp/actions_redirect');
29
- $this->_apiActionInstance = Mage::getModel('securetrading_stpp/actions_direct');
30
 
31
- $config = array(
32
- 'connections' => array(
33
- 'web_services' => array(
34
- 'username' => $paymentMethod->getConfigData('ws_username'),
35
- 'password' => $paymentMethod->getConfigData('ws_password'),
36
- 'alias' => $paymentMethod->getConfigData('ws_alias'),
37
- 'ssl_verify_peer' => $paymentMethod->getConfigData('ws_verify_ca'),
38
- 'ssl_verify_host' => 2,
39
- 'ssl_cacertfile' => $paymentMethod->getConfigData('ws_ca_file'),
40
- ),
41
- 'api' => array(
42
- 'host' => $paymentMethod->getConfigData('stapi_host'),
43
- 'port' => $paymentMethod->getConfigData('stapi_port'),
44
- 'alias' => $paymentMethod->getConfigData('stapi_alias'),
45
- ),
46
- ),
47
- 'interfaces' => array(
48
- 'ppages' => array(
49
- 'action_instance' => $this->_ppagesActionInstance,
50
- 'notificationhash' => array(
51
- 'password' => $paymentMethod->getConfigData('notification_password'),
52
- 'algorithm' => 'sha256',
53
- 'use' => $paymentMethod->getConfigData('use_notification_password'),
54
- ),
55
- 'sitesecurity' => array(
56
- 'password' => $paymentMethod->getConfigData('site_security_password'),
57
- 'algorithm' => 'sha256',
58
- 'use' => $paymentMethod->getConfigData('use_site_security'),
59
- 'fields' => array('order_increment_ids'),
60
- ),
61
- 'use_authenticated_moto' => false,
62
- 'use_http_post' => true,
63
- ),
64
- 'api' => array(
65
- 'action_instance' => $this->_apiActionInstance,
66
- 'active_connection' => $paymentMethod->getConfigData('connection'),
67
- 'use_3d_secure' => $paymentMethod->getConfigData('use_3d_secure'),
68
- 'use_risk_decision' => $paymentMethod->getConfigData('use_risk_decision'),
69
- 'use_card_store' => $paymentMethod->getConfigData('use_card_store'),
70
- 'use_risk_decision_after_auth' => $paymentMethod->getConfigData('delay_risk_decision'),
71
- 'use_auto_card_store' => $paymentMethod->getConfigData('use_auto_card_store'),
72
- )
73
- ),
74
- 'transactionsearch' => array(
75
- 'username' => $paymentMethod->getConfigData('transactionsearch_username'),
76
- 'password' => $paymentMethod->getConfigData('transactionsearch_password'),
77
- 'ssl_verify_peer' => $paymentMethod->getConfigData('transactionsearch_verify_ca'),
78
- 'ssl_verify_host' => 2,
79
- 'ssl_cacertfile' => $paymentMethod->getConfigData('transactionsearch_ca_file'),
80
-
81
- )
82
- );
83
- }
84
 
85
- $utilityFacade = Magento_Utility_Facade::instance($config); // Must be done before using any other parts of the STPP framework.
86
- $fieldFacade = Stpp_Fields_Facade::instance($config);
87
 
88
- $this->_facade = Stpp_Facade::instance($config);
89
- $this->_ppagesFacade = Stpp_PaymentPages_Facade::instance($config);
90
- $this->_apiFacade = Magento_Api_Facade::instance($config);
91
 
92
- $this->_frontendFields = $fieldFacade->newFrontendFields();
93
- $this->_adminFields = $fieldFacade->newAdminFields();
94
- $this->_debugLog = $utilityFacade->newDebugLog();
95
- }
96
 
97
- public function getPaymentMethod() {
98
- $paymentMethod = $this->getData('payment_method');
99
 
100
- if (!($paymentMethod instanceof Securetrading_Stpp_Model_Payment_Abstract)) {
101
- return false;
102
- }
103
- return $paymentMethod;
104
- }
105
-
106
- protected function _getFrontendFields() {
107
- if ($this->_frontendFields === null) {
108
- throw new Stpp_Exception(Mage::helper('securetrading_stpp')->__('An instance of the frontend fields has not been set.'));
109
- }
110
- return $this->_frontendFields;
111
- }
112
-
113
- public function getDebugLog() {
114
- if ($this->_debugLog === null) {
115
- throw new Stpp_Exception(Mage::helper('securetrading_stpp')->__('An instance of the debug log has not been set.'));
116
- }
117
- return $this->_debugLog;
118
- }
119
-
120
- public function getAdminFields() {
121
- if ($this->_adminFields === null) {
122
- throw new Stpp_Exception(Mage::helper('securetrading_stpp')->__('An instance of the admin fields has not been set.'));
123
- }
124
- return $this->_adminFields;
125
- }
126
-
127
- public function getSettleDueDates() {
128
- return Stpp_Types::getSettleDueDates();
129
- }
130
-
131
- public function getSettleStatuses() {
132
- return Stpp_Types::getSettleStatuses(true);
133
- }
134
-
135
- public function getCardTypes() {
136
- return Stpp_Types::getCardTypes();
137
- }
138
-
139
- public function getConnections() {
140
- $connections = array();
141
- foreach($this->_apiFacade->newApiConnectionStore()->getAll() as $k => $v) {
142
- $connections[$k] = $v::getName();
143
- }
144
- return $connections;
145
- }
146
-
147
- protected function _setOrderToActionInstances(Mage_Sales_Model_Order $order) {
148
- $this->_apiActionInstance->setOrder($order);
149
- $this->_ppagesActionInstance->setOrder($order);
150
- return $this;
151
- }
152
- public function runApiTransactionUpdate(Mage_Sales_Model_Order_Payment $payment, array $data) {
153
- $this->_setOrderToActionInstances($payment->getOrder());
154
- $filter = Stpp_Data_Request::instance()->setMultiple($data['filter']);
155
- $updates = Stpp_Data_Request::instance()->setMultiple($data['updates']);
156
- $request = Stpp_Data_Request::instance()->set('filter', $filter)->set('updates', $updates);
157
- $result = $this->_apiFacade->runApiTransactionUpdate($request);
158
-
159
- if (!$result->getIsTransactionSuccessful()) {
160
- throw new Mage_Core_Exception($result->getErrorMessage());
161
- }
162
- return $this;
163
- }
164
-
165
- public function runApiRefund(Mage_Sales_Model_Order_Payment $payment, array $data) {
166
- $this->_setOrderToActionInstances($payment->getOrder());
167
- $request = Stpp_Data_Request::instance()->setMultiple($data);
168
- $result = $this->_apiFacade->runApiRefund($request);
169
-
170
- if (!$result->getIsTransactionSuccessful()) {
171
- throw new Mage_Core_Exception('The gateway did not process the refund successfully.');
172
- }
173
- return $this;
174
- }
175
-
176
- public function runApiStandard(Mage_Sales_Model_Order_Payment $payment, $isMoto = false) {
177
- $isMoto = $payment->getOrder()->getQuote()->getIsSuperMode();
178
- $this->_setOrderToActionInstances($payment->getOrder());
179
- $data = $this->getPaymentMethod()->prepareOrderData($payment);
180
- $request = Stpp_Data_Request::instance()->setMultiple($data);
181
- return $this->_apiFacade->runApiStandard($request, $isMoto);
182
- }
183
-
184
- public function runApi3dAuth() {
185
- return $this->_apiFacade->runApi3dAuth(new Stpp_Data_Request());
186
- }
187
-
188
- public function runPaymentPages(array $data, $isMoto = false) {
189
- $request = Stpp_Data_Request::instance()->setMultiple($data);
190
- $result = $this->_ppagesFacade->runPaymentPagesStandard($request, $isMoto);
191
- Mage::getModel('securetrading_stpp/payment_redirect_request')->addRequest($this->getPaymentMethod()->getInfoInstance(), $result->getRequest());
 
192
 
193
- $transport = new Varien_Object();
194
- $transport->setRedirectIsPost($result->getRedirectIsPost());
195
- $transport->setRedirectUrl($result->getRedirectUrl());
196
- $transport->setRedirectData($result->getRedirectData());
197
- return $transport;
198
- }
199
-
200
- public function runRedirect() {
201
- $this->_ppagesFacade->newPaymentPages()->validateRedirect();
202
- }
203
-
204
- public function runNotification() {
205
- $this->_ppagesFacade->newPaymentPages()->runNotification();
206
- }
207
-
208
- public function getAcceptedCards($use3dSecure, $acceptedCards = array()) {
209
- if (!is_array($acceptedCards)) {
210
- $acceptedCards = array();
211
- }
212
- $helper = $this->_facade->newHelper();
213
- return $helper->getFilteredCardTypes($use3dSecure, $acceptedCards);
214
- }
215
-
216
- public function getCcLast4($pan) {
217
- $helper = $this->_facade->newHelper();
218
- return $helper->getCcLast4($pan);
219
- }
220
-
221
- public function getCardString($cardKey) {
222
- $cards = Stpp_Types::getCardTypes();
223
- if (array_key_exists($cardKey, $cards)) {
224
- return $cards[$cardKey];
225
- }
226
- else {
227
- return '';
228
- }
229
- }
230
-
231
- public function getAvsString($avsKey) {
232
- $avsCodes = Stpp_Types::getAvsCodes();
233
- if (array_key_exists($avsKey, $avsCodes)) {
234
- return $avsCodes[$avsKey];
235
- }
236
- return $avsKey;
237
- }
238
-
239
- public function getMonths() {
240
- $months = Stpp_Types::getMonths();
241
- $array = array();
242
- foreach($months as $month) {
243
- $array[$month['numeric']] = $month['short'];
244
- }
245
- return $array;
246
- }
247
-
248
- public function getRefundTransactionName() {
249
- return Stpp_Types::API_REFUND;
250
- }
251
-
252
- public function getThreedqueryName() {
253
- return Stpp_Types::API_THREEDQUERY;
254
- }
255
-
256
- public function getStartYears() {
257
- return Stpp_Types::getStartYears();
258
- }
259
-
260
- public function getExpiryYears() {
261
- return Stpp_Types::getExpiryYears();
262
- }
263
-
264
- public function getCardTypeLabel() {
265
- return $this->_getFrontendFields()->getLabel(Stpp_Fields_Frontend::FIELD_PAYMENT_TYPE);
266
- }
267
-
268
- public function getCardTypeDescription() {
269
- return $this->_getFrontendFields()->getDescription(Stpp_Fields_Frontend::FIELD_PAYMENT_TYPE);
270
- }
271
-
272
- public function getCardNumberLabel() {
273
- return $this->_getFrontendFields()->getLabel(Stpp_Fields_Frontend::FIELD_PAN);
274
- }
275
-
276
- public function getCardNumberDescription() {
277
- return $this->_getFrontendFields()->getDescription(Stpp_Fields_Frontend::FIELD_PAN);
278
- }
279
-
280
- public function getCardStartDateLabel() {
281
- return $this->_getFrontendFields()->getLabel(Stpp_Fields_Frontend::FIELD_START_DATE);
282
- }
283
-
284
- public function getCardStartDateDescription() {
285
- return $this->_getFrontendFields()->getDescription(Stpp_Fields_Frontend::FIELD_START_DATE);
286
- }
287
-
288
- public function getCardExpiryDateLabel() {
289
- return $this->_getFrontendFields()->getLabel(Stpp_Fields_Frontend::FIELD_EXPIRY_DATE);
290
- }
291
-
292
- public function getCardExpiryDateDescription() {
293
- return $this->_getFrontendFields()->getDescription(Stpp_Fields_Frontend::FIELD_EXPIRY_DATE);
294
- }
295
-
296
- public function getCardSecurityCodeLabel() {
297
- return $this->_getFrontendFields()->getLabel(Stpp_Fields_Frontend::FIELD_SECURITY_CODE);
298
- }
299
-
300
- public function getCardSecurityCodeDescription() {
301
- return $this->_getFrontendFields()->getDescription(Stpp_Fields_Frontend::FIELD_SECURITY_CODE);
302
- }
303
-
304
- public function getCardIssueNumberLabel() {
305
- return $this->_getFrontendFields()->getLabel(Stpp_Fields_Frontend::FIELD_ISSUE_NUMBER);
306
- }
307
-
308
- public function getCardIssueNumberDescription() {
309
- return $this->_getFrontendFields()->getDescription(Stpp_Fields_Frontend::FIELD_ISSUE_NUMBER);
310
- }
311
-
312
- public function newTransactionSearch() {
313
- return $this->_apiFacade->newTransactionSearch();
314
- }
315
  }
1
  <?php
2
 
3
  class Securetrading_Stpp_Model_Integration extends Mage_Core_Model_Abstract {
4
+ protected $_facade;
5
 
6
+ protected $_ppagesFacade;
7
 
8
+ protected $_apiFacade;
9
 
10
+ protected $_ppagesActionInstance;
11
 
12
+ protected $_apiActionInstance;
13
 
14
+ protected $_frontendFields;
15
 
16
+ protected $_adminFields;
17
 
18
+ protected $_debugLog;
19
 
20
+ public function _construct() {
21
+ require_once(Mage::getModuleDir('', 'Securetrading_Stpp') . DS . 'lib' . DS . 'Securetrading.php');
22
+ Securetrading::init();
23
 
24
+ $config = array();
25
+ $paymentMethod = $this->getPaymentMethod();
26
 
27
+ if ($paymentMethod) {
28
+ $this->_ppagesActionInstance = Mage::getModel('securetrading_stpp/actions_redirect');
29
+ $this->_apiActionInstance = Mage::getModel('securetrading_stpp/actions_direct');
30
 
31
+ $config = array(
32
+ 'connections' => array(
33
+ 'web_services' => array(
34
+ 'username' => $paymentMethod->getConfigData('ws_username'),
35
+ 'password' => $paymentMethod->getConfigData('ws_password'),
36
+ 'alias' => $paymentMethod->getConfigData('ws_alias'),
37
+ 'ssl_verify_peer' => $paymentMethod->getConfigData('ws_verify_ca'),
38
+ 'ssl_verify_host'=> 2,
39
+ 'ssl_cacertfile' => $paymentMethod->getConfigData('ws_ca_file'),
40
+ ),
41
+ 'api' => array(
42
+ 'host' => $paymentMethod->getConfigData('stapi_host'),
43
+ 'port' => $paymentMethod->getConfigData('stapi_port'),
44
+ 'alias'=> $paymentMethod->getConfigData('stapi_alias'),
45
+ ),
46
+ ),
47
+ 'interfaces' => array(
48
+ 'ppages' => array(
49
+ 'action_instance' => $this->_ppagesActionInstance,
50
+ 'notificationhash' => array(
51
+ 'password' => $paymentMethod->getConfigData('notification_password'),
52
+ 'algorithm' => 'sha256',
53
+ 'use' => $paymentMethod->getConfigData('use_notification_password'),
54
+ ),
55
+ 'sitesecurity' => array(
56
+ 'password' => $paymentMethod->getConfigData('site_security_password'),
57
+ 'algorithm' => 'sha256',
58
+ 'use' => $paymentMethod->getConfigData('use_site_security'),
59
+ 'fields'=> array('order_increment_ids'),
60
+ ),
61
+ 'use_authenticated_moto' => false,
62
+ 'use_http_post' => true,
63
+ ),
64
+ 'api' => array(
65
+ 'action_instance' => $this->_apiActionInstance,
66
+ 'active_connection' => $paymentMethod->getConfigData('connection'),
67
+ 'use_3d_secure' => $paymentMethod->getConfigData('use_3d_secure'),
68
+ 'use_risk_decision' => $paymentMethod->getConfigData('use_risk_decision'),
69
+ 'use_card_store' => $paymentMethod->getConfigData('use_card_store'),
70
+ 'use_risk_decision_after_auth' => $paymentMethod->getConfigData('delay_risk_decision'),
71
+ 'use_auto_card_store' => $paymentMethod->getConfigData('use_auto_card_store'),
72
+ )
73
+ ),
74
+ 'transactionsearch' => array(
75
+ 'username'=> $paymentMethod->getConfigData('transactionsearch_username'),
76
+ 'password'=> $paymentMethod->getConfigData('transactionsearch_password'),
77
+ 'ssl_verify_peer'=> $paymentMethod->getConfigData('transactionsearch_verify_ca'),
78
+ 'ssl_verify_host'=> 2,
79
+ 'ssl_cacertfile'=> $paymentMethod->getConfigData('transactionsearch_ca_file'),
80
+
81
+ )
82
+ );
83
+ }
84
 
85
+ $utilityFacade = Magento_Utility_Facade::instance($config); // Must be done before using any other parts of the STPP framework.
86
+ $fieldFacade = Stpp_Fields_Facade::instance($config);
87
 
88
+ $this->_facade = Stpp_Facade::instance($config);
89
+ $this->_ppagesFacade = Stpp_PaymentPages_Facade::instance($config);
90
+ $this->_apiFacade = Magento_Api_Facade::instance($config);
91
 
92
+ $this->_frontendFields = $fieldFacade->newFrontendFields();
93
+ $this->_adminFields = $fieldFacade->newAdminFields();
94
+ $this->_debugLog = $utilityFacade->newDebugLog();
95
+ }
96
 
97
+ public function getPaymentMethod() {
98
+ $paymentMethod = $this->getData('payment_method');
99
 
100
+ if (!($paymentMethod instanceof Securetrading_Stpp_Model_Payment_Abstract)) {
101
+ return false;
102
+ }
103
+ return $paymentMethod;
104
+ }
105
+
106
+ protected function _getFrontendFields() {
107
+ if ($this->_frontendFields === null) {
108
+ throw new Stpp_Exception(Mage::helper('securetrading_stpp')->__('An instance of the frontend fields has not been set.'));
109
+ }
110
+ return $this->_frontendFields;
111
+ }
112
+
113
+ public function getDebugLog() {
114
+ if ($this->_debugLog === null) {
115
+ throw new Stpp_Exception(Mage::helper('securetrading_stpp')->__('An instance of the debug log has not been set.'));
116
+ }
117
+ return $this->_debugLog;
118
+ }
119
+
120
+ public function getAdminFields() {
121
+ if ($this->_adminFields === null) {
122
+ throw new Stpp_Exception(Mage::helper('securetrading_stpp')->__('An instance of the admin fields has not been set.'));
123
+ }
124
+ return $this->_adminFields;
125
+ }
126
+
127
+ public function getSettleDueDates() {
128
+ return Stpp_Types::getSettleDueDates();
129
+ }
130
+
131
+ public function getSettleStatuses() {
132
+ return Stpp_Types::getSettleStatuses(true);
133
+ }
134
+
135
+ public function getCardTypes() {
136
+ return Stpp_Types::getCardTypes();
137
+ }
138
+
139
+ public function getConnections() {
140
+ $connections = array();
141
+ foreach($this->_apiFacade->newApiConnectionStore()->getAll() as $k => $v) {
142
+ $connections[$k] = $v::getName();
143
+ }
144
+ return $connections;
145
+ }
146
+
147
+ protected function _setOrderToActionInstances(Mage_Sales_Model_Order $order) {
148
+ $this->_apiActionInstance->setOrder($order);
149
+ $this->_ppagesActionInstance->setOrder($order);
150
+ return $this;
151
+ }
152
+ public function runApiTransactionUpdate(Mage_Sales_Model_Order_Payment $payment, array $data) {
153
+ $this->_setOrderToActionInstances($payment->getOrder());
154
+ $filter = Stpp_Data_Request::instance()->setMultiple($data['filter']);
155
+ $updates = Stpp_Data_Request::instance()->setMultiple($data['updates']);
156
+ $request = Stpp_Data_Request::instance()->set('filter', $filter)->set('updates', $updates);
157
+ $result = $this->_apiFacade->runApiTransactionUpdate($request);
158
+
159
+ if (!$result->getIsTransactionSuccessful()) {
160
+ throw new Mage_Core_Exception($result->getErrorMessage());
161
+ }
162
+ return $this;
163
+ }
164
+
165
+ public function runApiRefund(Mage_Sales_Model_Order_Payment $payment, array $data) {
166
+ $this->_setOrderToActionInstances($payment->getOrder());
167
+ $request = Stpp_Data_Request::instance()->setMultiple($data);
168
+ $result = $this->_apiFacade->runApiRefund($request);
169
+
170
+ if (!$result->getIsTransactionSuccessful()) {
171
+ throw new Mage_Core_Exception('The gateway did not process the refund successfully.');
172
+ }
173
+ return $this;
174
+ }
175
+
176
+ public function runApiStandard(Mage_Sales_Model_Order_Payment $payment, $isMoto = false) {
177
+ $isMoto = $payment->getOrder()->getQuote()->getIsSuperMode();
178
+ $this->_setOrderToActionInstances($payment->getOrder());
179
+ $orderIncrementIds = Mage::getModel('core/session')->getOrderIds() ? Mage::getModel('core/session')->getOrderIds() : array($payment->getOrder()->getIncrementId()); //multishipping or onepage
180
+ $data = $this->getPaymentMethod()->prepareOrderData($payment, $orderIncrementIds);
181
+ $request = Stpp_Data_Request::instance()->setMultiple($data);
182
+ return $this->_apiFacade->runApiStandard($request, $isMoto);
183
+ }
184
+
185
+ public function runApi3dAuth() {
186
+ return $this->_apiFacade->runApi3dAuth(new Stpp_Data_Request());
187
+ }
188
+
189
+ public function runPaymentPages(array $data, $isMoto = false) {
190
+ $request = Stpp_Data_Request::instance()->setMultiple($data);
191
+ $result = $this->_ppagesFacade->runPaymentPagesStandard($request, $isMoto);
192
+ Mage::getModel('securetrading_stpp/payment_redirect_request')->addRequest($this->getPaymentMethod()->getInfoInstance(), $result->getRequest());
193
 
194
+ $transport = new Varien_Object();
195
+ $transport->setRedirectIsPost($result->getRedirectIsPost());
196
+ $transport->setRedirectUrl($result->getRedirectUrl());
197
+ $transport->setRedirectData($result->getRedirectData());
198
+ return $transport;
199
+ }
200
+
201
+ public function runRedirect() {
202
+ $this->_ppagesFacade->newPaymentPages()->validateRedirect();
203
+ }
204
+
205
+ public function runNotification() {
206
+ $this->_ppagesFacade->newPaymentPages()->runNotification();
207
+ }
208
+
209
+ public function getAcceptedCards($use3dSecure, $acceptedCards = array()) {
210
+ if (!is_array($acceptedCards)) {
211
+ $acceptedCards = array();
212
+ }
213
+ $helper = $this->_facade->newHelper();
214
+ return $helper->getFilteredCardTypes($use3dSecure, $acceptedCards);
215
+ }
216
+
217
+ public function getCcLast4($pan) {
218
+ $helper = $this->_facade->newHelper();
219
+ return $helper->getCcLast4($pan);
220
+ }
221
+
222
+ public function getCardString($cardKey) {
223
+ $cards = Stpp_Types::getCardTypes();
224
+ if (array_key_exists($cardKey, $cards)) {
225
+ return $cards[$cardKey];
226
+ }
227
+ else {
228
+ return '';
229
+ }
230
+ }
231
+
232
+ public function getAvsString($avsKey) {
233
+ $avsCodes = Stpp_Types::getAvsCodes();
234
+ if (array_key_exists($avsKey, $avsCodes)) {
235
+ return $avsCodes[$avsKey];
236
+ }
237
+ return $avsKey;
238
+ }
239
+
240
+ public function getMonths() {
241
+ $months = Stpp_Types::getMonths();
242
+ $array = array();
243
+ foreach($months as $month) {
244
+ $array[$month['numeric']] = $month['short'];
245
+ }
246
+ return $array;
247
+ }
248
+
249
+ public function getRefundTransactionName() {
250
+ return Stpp_Types::API_REFUND;
251
+ }
252
+
253
+ public function getThreedqueryName() {
254
+ return Stpp_Types::API_THREEDQUERY;
255
+ }
256
+
257
+ public function getStartYears() {
258
+ return Stpp_Types::getStartYears();
259
+ }
260
+
261
+ public function getExpiryYears() {
262
+ return Stpp_Types::getExpiryYears();
263
+ }
264
+
265
+ public function getCardTypeLabel() {
266
+ return $this->_getFrontendFields()->getLabel(Stpp_Fields_Frontend::FIELD_PAYMENT_TYPE);
267
+ }
268
+
269
+ public function getCardTypeDescription() {
270
+ return $this->_getFrontendFields()->getDescription(Stpp_Fields_Frontend::FIELD_PAYMENT_TYPE);
271
+ }
272
+
273
+ public function getCardNumberLabel() {
274
+ return $this->_getFrontendFields()->getLabel(Stpp_Fields_Frontend::FIELD_PAN);
275
+ }
276
+
277
+ public function getCardNumberDescription() {
278
+ return $this->_getFrontendFields()->getDescription(Stpp_Fields_Frontend::FIELD_PAN);
279
+ }
280
+
281
+ public function getCardStartDateLabel() {
282
+ return $this->_getFrontendFields()->getLabel(Stpp_Fields_Frontend::FIELD_START_DATE);
283
+ }
284
+
285
+ public function getCardStartDateDescription() {
286
+ return $this->_getFrontendFields()->getDescription(Stpp_Fields_Frontend::FIELD_START_DATE);
287
+ }
288
+
289
+ public function getCardExpiryDateLabel() {
290
+ return $this->_getFrontendFields()->getLabel(Stpp_Fields_Frontend::FIELD_EXPIRY_DATE);
291
+ }
292
+
293
+ public function getCardExpiryDateDescription() {
294
+ return $this->_getFrontendFields()->getDescription(Stpp_Fields_Frontend::FIELD_EXPIRY_DATE);
295
+ }
296
+
297
+ public function getCardSecurityCodeLabel() {
298
+ return $this->_getFrontendFields()->getLabel(Stpp_Fields_Frontend::FIELD_SECURITY_CODE);
299
+ }
300
+
301
+ public function getCardSecurityCodeDescription() {
302
+ return $this->_getFrontendFields()->getDescription(Stpp_Fields_Frontend::FIELD_SECURITY_CODE);
303
+ }
304
+
305
+ public function getCardIssueNumberLabel() {
306
+ return $this->_getFrontendFields()->getLabel(Stpp_Fields_Frontend::FIELD_ISSUE_NUMBER);
307
+ }
308
+
309
+ public function getCardIssueNumberDescription() {
310
+ return $this->_getFrontendFields()->getDescription(Stpp_Fields_Frontend::FIELD_ISSUE_NUMBER);
311
+ }
312
+
313
+ public function newTransactionSearch() {
314
+ return $this->_apiFacade->newTransactionSearch();
315
+ }
316
  }
app/code/local/Securetrading/Stpp/Model/Observer.php CHANGED
@@ -28,6 +28,9 @@ class Securetrading_Stpp_Model_Observer {
28
  return;
29
  }
30
  $observer->getEvent()->getOrder()->setCanSendNewEmailFlag(false)->save();
 
 
 
31
  }
32
 
33
  public function onPaymentInfoBlockPrepareSpecificInformation(Varien_Event_Observer $observer) {
28
  return;
29
  }
30
  $observer->getEvent()->getOrder()->setCanSendNewEmailFlag(false)->save();
31
+
32
+ $order = $observer->getEvent()->getOrder();
33
+ $order->getPayment()->getMethodInstance()->setPaymentPlaceWithoutMakingApiRequest(true);
34
  }
35
 
36
  public function onPaymentInfoBlockPrepareSpecificInformation(Varien_Event_Observer $observer) {
app/code/local/Securetrading/Stpp/Model/Payment/Abstract.php CHANGED
@@ -1,128 +1,128 @@
1
  <?php
2
 
3
  abstract class Securetrading_Stpp_Model_Payment_Abstract extends Mage_Payment_Model_Method_Abstract {
4
- const STATUS_AUTHORIZED = 'authorized';
5
- const STATUS_SUSPENDED = 'suspended';
6
- const STATUS_PENDING_PPAGES = 'pending_ppages';
7
- const STATUS_PENDING_3DSECURE = 'pending_3dsecure';
8
 
9
- final public function getIsSecuretradingPaymentMethod() {
10
- return true;
11
- }
12
 
13
- public function getIntegration() {
14
- return Mage::getModel('securetrading_stpp/integration', array('payment_method' => $this));
15
- }
16
 
17
- public function log($message) {
18
- try {
19
- $order = $this->getInfoInstance()->getOrder();
20
- }
21
- catch (Exception $e) {
22
- // Do nothing here intentionally.
23
- }
24
- $sidToken = md5(Mage::getModel('core/session')->getSessionId());
25
- $orderIncrementId = isset($order) && $order ? $order->getIncrementId() : 'N/A';
26
- $message = $this->_code . ' - ' .$orderIncrementId . ' - ' . $sidToken . ' - ' . $message;
27
- $this->getIntegration()->getDebugLog()->log($message);
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();
35
- $billingTelephoneNumber = $billingAddress->getTelephone();
36
- $billingTelephoneType = !empty($billingTelephoneNumber) ? 'H' : '';
37
- $customerDobFull = $order->getCustomerDob();
38
- $customerDobArray = explode(' ', $customerDobFull);
39
- $customerDob = $customerDobArray[0];
40
 
41
- $baseTotalDue = 0;
42
-
43
- foreach($orderIncrementIds as $orderIncrementId) {
44
- $baseTotalDue += Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId)->getBaseTotalDue();
45
- }
46
 
47
- $data = array(
48
- 'sitereference' => $this->getConfigData("site_reference"),
49
- 'currencyiso3a' => $order->getBaseCurrencyCode(),
50
- 'mainamount' => $baseTotalDue,
51
 
52
- 'billingprefixname' => $billingAddress->getPrefix(),
53
- 'billingfirstname' => $billingAddress->getFirstname(),
54
- 'billingmiddlename' => $billingAddress->getMiddlename(),
55
- 'billinglastname' => $billingAddress->getLastname(),
56
- 'billingsuffixname' => $billingAddress->getSuffix(),
57
- 'billingemail' => $billingAddress->getEmail(),
58
- 'billingtelephone' => $billingTelephoneNumber,
59
- 'billingtelephonetype' => $billingTelephoneType,
60
- 'billingpremise' => $billingAddress->getStreet(1),
61
- 'billingstreet' => $billingAddress->getStreet(2),
62
- 'billingtown' => $billingAddress->getCity(),
63
- 'billingcounty' => $billingCounty,
64
- 'billingpostcode' => $billingAddress->getPostcode(),
65
- 'billingcountryiso2a' => $billingAddress->getCountry(),
66
- 'billingdob' => $customerDob,
67
 
68
- 'settleduedate' => $this->getConfigData('settle_due_date'),
69
- 'settlestatus' => $this->getConfigData('payment_action') === Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE ? 2 : $this->getConfigData('settle_status'),
70
- 'orderreference' => $order->getIncrementId(),
71
- );
72
 
73
- if ($order->getShippingMethod()) {
74
- $customerAddress = $order->getShippingAddress();
75
- $customerCounty = $customerAddress->getCountry() == 'US' ? $customerAddress->getRegionCode() : $customerAddress->getRegion();
76
- $customerTelephoneNumber = $customerAddress->getTelephone();
77
- $customerTelephoneType = !empty($customerTelephoneNumber) ? 'H' : '';
78
 
79
- $data += array(
80
- 'customerprefixname' => $customerAddress->getPrefix(),
81
- 'customerfirstname' => $customerAddress->getFirstname(),
82
- 'customermiddlename' => $customerAddress->getMiddlename(),
83
- 'customerlastname' => $customerAddress->getLastname(),
84
- 'customersuffixname' => $customerAddress->getSuffix(),
85
- 'customeremail' => $customerAddress->getEmail(),
86
- 'customertelephone' => $customerTelephoneNumber,
87
- 'customertelephonetype' => $customerTelephoneType,
88
- 'customerpremise' => $customerAddress->getStreet(1),
89
- 'customerstreet' => $customerAddress->getStreet(2),
90
- 'customertown' => $customerAddress->getCity(),
91
- 'customercounty' => $customerCounty,
92
- 'customerpostcode' => $customerAddress->getPostcode(),
93
- 'customercountryiso2a' => $customerAddress->getCountry(),
94
- );
95
- }
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.
126
- }
127
  }
 
128
  }
1
  <?php
2
 
3
  abstract class Securetrading_Stpp_Model_Payment_Abstract extends Mage_Payment_Model_Method_Abstract {
4
+ const STATUS_AUTHORIZED = 'authorized';
5
+ const STATUS_SUSPENDED = 'suspended';
6
+ const STATUS_PENDING_PPAGES = 'pending_ppages';
7
+ const STATUS_PENDING_3DSECURE = 'pending_3dsecure';
8
 
9
+ final public function getIsSecuretradingPaymentMethod() {
10
+ return true;
11
+ }
12
 
13
+ public function getIntegration() {
14
+ return Mage::getModel('securetrading_stpp/integration', array('payment_method' => $this));
15
+ }
16
 
17
+ public function log($message) {
18
+ try {
19
+ $order = $this->getInfoInstance()->getOrder();
20
+ }
21
+ catch (Exception $e) {
22
+ // Do nothing here intentionally.
 
 
 
 
 
 
23
  }
24
+ $sidToken = md5(Mage::getModel('core/session')->getSessionId());
25
+ $orderIncrementId = isset($order) && $order ? $order->getIncrementId() : 'N/A';
26
+ $message = $this->_code . ' - ' .$orderIncrementId . ' - ' . $sidToken . ' - ' . $message;
27
+ $this->getIntegration()->getDebugLog()->log($message);
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();
35
+ $billingTelephoneNumber = $billingAddress->getTelephone();
36
+ $billingTelephoneType = !empty($billingTelephoneNumber) ? 'H' : '';
37
+ $customerDobFull = $order->getCustomerDob();
38
+ $customerDobArray = explode(' ', $customerDobFull);
39
+ $customerDob = $customerDobArray[0];
40
 
41
+ $baseTotalDue = 0;
42
+
43
+ foreach($orderIncrementIds as $orderIncrementId) {
44
+ $baseTotalDue += Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId)->getBaseTotalDue();
45
+ }
46
 
47
+ $data = array(
48
+ 'sitereference' => $this->getConfigData("site_reference"),
49
+ 'currencyiso3a' => $order->getBaseCurrencyCode(),
50
+ 'mainamount'=> $baseTotalDue,
51
 
52
+ 'billingprefixname' => $billingAddress->getPrefix(),
53
+ 'billingfirstname' => $billingAddress->getFirstname(),
54
+ 'billingmiddlename' => $billingAddress->getMiddlename(),
55
+ 'billinglastname' => $billingAddress->getLastname(),
56
+ 'billingsuffixname' => $billingAddress->getSuffix(),
57
+ 'billingemail' => $billingAddress->getEmail(),
58
+ 'billingtelephone' => $billingTelephoneNumber,
59
+ 'billingtelephonetype' => $billingTelephoneType,
60
+ 'billingpremise' => $billingAddress->getStreet(1),
61
+ 'billingstreet' => $billingAddress->getStreet(2),
62
+ 'billingtown' => $billingAddress->getCity(),
63
+ 'billingcounty' => $billingCounty,
64
+ 'billingpostcode' => $billingAddress->getPostcode(),
65
+ 'billingcountryiso2a' => $billingAddress->getCountry(),
66
+ 'billingdob' => $customerDob,
67
 
68
+ 'settleduedate' => $this->getConfigData('settle_due_date'),
69
+ 'settlestatus' => $this->getConfigData('payment_action') === Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE ? 2 : $this->getConfigData('settle_status'),
70
+ 'orderreference' => $order->getIncrementId(),
71
+ );
72
 
73
+ if ($order->getShippingMethod()) {
74
+ $customerAddress = $order->getShippingAddress();
75
+ $customerCounty = $customerAddress->getCountry() == 'US' ? $customerAddress->getRegionCode() : $customerAddress->getRegion();
76
+ $customerTelephoneNumber = $customerAddress->getTelephone();
77
+ $customerTelephoneType = !empty($customerTelephoneNumber) ? 'H' : '';
78
 
79
+ $data += array(
80
+ 'customerprefixname' => $customerAddress->getPrefix(),
81
+ 'customerfirstname' => $customerAddress->getFirstname(),
82
+ 'customermiddlename' => $customerAddress->getMiddlename(),
83
+ 'customerlastname' => $customerAddress->getLastname(),
84
+ 'customersuffixname' => $customerAddress->getSuffix(),
85
+ 'customeremail' => $customerAddress->getEmail(),
86
+ 'customertelephone' => $customerTelephoneNumber,
87
+ 'customertelephonetype' => $customerTelephoneType,
88
+ 'customerpremise' => $customerAddress->getStreet(1),
89
+ 'customerstreet' => $customerAddress->getStreet(2),
90
+ 'customertown' => $customerAddress->getCity(),
91
+ 'customercounty' => $customerCounty,
92
+ 'customerpostcode' => $customerAddress->getPostcode(),
93
+ 'customercountryiso2a' => $customerAddress->getCountry(),
94
+ );
 
 
95
  }
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.
 
 
 
 
 
 
 
 
 
126
  }
127
+ }
128
  }
app/code/local/Securetrading/Stpp/Model/Payment/Direct.php CHANGED
@@ -1,420 +1,467 @@
1
  <?php
2
 
3
  class Securetrading_Stpp_Model_Payment_Direct extends Securetrading_Stpp_Model_Payment_Abstract {
4
- protected $_code = 'securetrading_stpp_direct';
5
- protected $_formBlockType = 'securetrading_stpp/payment_direct_form';
6
- protected $_infoBlockType = 'securetrading_stpp/payment_direct_info';
7
-
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 = true;
17
- protected $_canUseCheckout = true;
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->setIsPaid(false);
74
- }
 
 
 
 
 
 
 
 
 
75
  }
 
 
 
 
 
 
 
 
 
 
76
 
77
- public function authorize(Varien_Object $payment, $amount) {
78
- $this->log(sprintf('In %s.', __METHOD__));
79
- parent::authorize($payment, $amount);
80
- $result = $this->getIntegration()->runApiStandard($payment);
81
- $this->_handleStandardPaymentResult($result);
82
- return $this;
83
  }
 
 
 
 
 
 
84
 
85
- public function capture(Varien_Object $payment, $amount) {
86
- $this->log(sprintf('In %s.', __METHOD__));
87
- parent::capture($payment, $amount);
 
 
 
88
 
89
- if ($payment->lookupTransaction('', Mage_Sales_Model_Order_Payment_Transaction::TYPE_AUTH)) {
90
- $this->captureAuthorized($payment, $amount);
91
- }
92
- else {
93
- $this->_authAndCapture($payment);
94
- }
95
- return $this;
96
  }
97
-
98
- protected function _paymentHasSuccessfulRefund(Mage_Sales_Model_Order_Payment $payment) {
99
- $refundTransaction = $payment->lookupTransaction('', Mage_Sales_Model_Order_Payment_Transaction::TYPE_REFUND);
100
- if ($refundTransaction) {
101
- $securetradingRefundTransaction = Mage::getModel('securetrading_stpp/transaction')->loadByTransactionReference($refundTransaction->getTxnId(), true);
102
- if ($securetradingRefundTransaction && $securetradingRefundTransaction->getRequestType() === Securetrading_Stpp_Model_Transaction_Types::TYPE_REFUND) {
103
- return true;
104
- }
105
- }
106
- return false;
107
  }
 
 
108
 
109
- public function prepareToRefund(Varien_Object $payment, $amount, $siteReference) {
110
- $transactionReference = $payment->getCcTransId();
111
- $orderIncrementIds = $this->_getOrderIncrementIds($transactionReference);
112
-
113
- if ($orderIncrementIds) {
114
- $partialRefundAlreadyProcessed = null;
115
- $orderBaseGrandTotal = null;
116
- $baseTotalPaid = null;
117
- $baseTotalRefunded = null;
118
-
119
- foreach($orderIncrementIds as $orderIncrementId) {
120
- $tempPayment = Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId)->getPayment();
121
-
122
- if ($partialRefundAlreadyProcessed !== true) {
123
- $partialRefundAlreadyProcessed = $this->_paymentHasSuccessfulRefund($tempPayment);
124
- }
125
-
126
- $orderBaseGrandTotal += $tempPayment->getOrder()->getBaseGrandTotal();
127
- $baseTotalPaid += $tempPayment->getOrder()->getBaseTotalPaid();
128
- $baseTotalRefunded += $tempPayment->getOrder()->getBaseTotalRefunded();
129
- }
130
- }
131
- else {
132
- $partialRefundAlreadyProcessed = $this->_paymentHasSuccessfulRefund($payment);
133
- $orderBaseGrandTotal = $payment->getOrder()->getBaseGrandTotal();
134
- $baseTotalPaid = $payment->getOrder()->getBaseTotalPaid();
135
- $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.
136
- }
137
-
138
- $data = array(
139
- 'original_order_total' => $orderBaseGrandTotal, // Total of original AUTH.
140
- 'order_total_paid' => $baseTotalPaid, // How much has been captured from the AUTH (do not consider how much has been refunded via TU or REFUND).
141
- 'order_total_refunded' => $baseTotalRefunded, // How much has been refunded via TU or REFUND.
142
- 'amount_to_refund' => $amount,
143
- 'partial_refund_already_processed' => $partialRefundAlreadyProcessed,
144
- 'site_reference' => $siteReference,
145
- 'transaction_reference' => $transactionReference,
146
- 'using_main_amount' => true,
147
- 'currency_iso_3a' => $payment->getOrder()->getBaseCurrencyCode(),
148
- 'allow_suspend' => true,
149
- );
150
- $payment->setShouldCloseParentTransaction(false);
151
- return $data;
152
  }
 
 
153
 
154
- public function refund(Varien_Object $payment, $amount) {
155
- $data = $this->prepareToRefund($payment, $amount, $this->getConfigData('site_reference'));
156
- $this->getIntegration()->runApiRefund($payment, $data);
157
- return $this;
158
- }
159
 
160
- public function cancel(Varien_Object $payment) {
161
- return $this; // Do nothing intentionally.
162
- }
 
 
 
 
 
 
 
 
 
163
 
164
- public function denyPaymentAndPrepareApiRequest(Mage_Payment_Model_Info $payment, $siteReference) {
165
- parent::denyPayment($payment);
166
- $data = null;
167
-
168
- if (!empty(self::$_reviewingIncrementIds)) {
169
- $payment->setShouldCloseParentTransaction(true);
170
- $payment->addTransaction(Mage_Sales_Model_Order_Payment_Transaction::TYPE_VOID);
171
- }
172
- else {
173
- if ($payment->getOrder()->getState() !== Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW) {
174
- throw new Mage_Core_Exception('This order is no longer in the payment review state.');
175
- }
176
-
177
- $transactionReference = $payment->getCcTransId();
178
- $orderIncrementIds = $this->_getOrderIncrementIds($transactionReference);
179
-
180
- if ($orderIncrementIds) {
181
- self::$_reviewingIncrementIds = $orderIncrementIds;
182
- foreach($orderIncrementIds as $orderIncrementId) {
183
- $order = Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId);
184
- $order->getPayment()->deny();
185
- $order->save();
186
- }
187
- self::$_reviewingIncrementIds = array();
188
- }
189
- else {
190
- $payment->setShouldCloseParentTransaction(true);
191
- $payment->addTransaction(Mage_Sales_Model_Order_Payment_Transaction::TYPE_VOID);
192
- }
193
- $data = $this->_prepareToUpdateSettleStatus($payment, '3', $siteReference);
194
- }
195
- return $data;
196
  }
197
-
198
- public function acceptPaymentAndPrepareApiRequest(Mage_Payment_Model_Info $payment, $siteReference) {
199
- parent::acceptPayment($payment);
200
- $data = null;
201
-
202
- if (empty(self::$_reviewingIncrementIds)) {
203
- if ($payment->getOrder()->getState() !== Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW) {
204
- throw new Mage_Core_Exception('This order is no longer in the payment review state.');
205
- }
206
-
207
- $transactionReference = $payment->getCcTransId();
208
- $orderIncrementIds = $this->_getOrderIncrementIds($transactionReference);
209
-
210
- if ($orderIncrementIds) {
211
- self::$_reviewingIncrementIds = $orderIncrementIds;
212
- foreach($orderIncrementIds as $orderIncrementId) {
213
- $order = Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId);
214
- $order->getPayment()->accept();
215
- $order->save();
216
- }
217
- self::$_reviewingIncrementIds = array();
218
- }
219
-
220
- $transaction = Mage::getModel('securetrading_stpp/transaction')->loadByTransactionReference($payment->getCcTransId());
221
- $requestedSettleStatus = $transaction->getRequestData('settlestatus');
222
-
223
- if ($requestedSettleStatus === null) { // Will be null if the $transaction was a 3D AUTH (which has MD/PaRes instead).
224
- if (!$parentTransaction = $transaction->getParentTransaction(true)) {
225
- throw new Exception(sprintf(Mage::helper('securetrading_stpp')->__('Payment "%s" had transaction reference "%s" but had no settle status and no parent transaction reference.'), $payment->getId(), $payment->getCcTransId()));
226
- }
227
- if ($parentTransaction->getRequestData('requesttypedescription') !== $this->getIntegration()->getThreedqueryName()) {
228
- throw new Exception(sprintf(Mage::helper('securetrading_stpp')->__('Payment "%s" had transaction reference "%s" but had no settle status and no parent THREEDQUERY.'), $payment->getId(), $payment->getCcTransId()));
229
- }
230
- if ($parentTransaction->getRequestData('settlestatus') === null) {
231
- throw new Exception(sprintf(Mage::helper('securetrading_stpp')->__('Payment "%s" had transaction reference "%s" but had no settle status and its parent THREEDQUERY had no settle status.'), $payment->getId(), $payment->getCcTransId()));
232
- }
233
- $requestedSettleStatus = $parentTransaction->getRequestData('settlestatus');
234
- }
235
-
236
- 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).
237
- $data = $this->_prepareToUpdateSettleStatus($payment, $requestedSettleStatus, $siteReference);
238
- }
239
- }
240
- return $data;
241
  }
242
 
243
- public function acceptPayment(Mage_Payment_Model_Info $payment) {
244
- $data = $this->acceptPaymentAndPrepareApiRequest($payment, $this->getConfigData('site_reference'));
245
- if ($data) {
246
- $this->getIntegration()->runApiTransactionUpdate($payment, $data);
247
- }
248
- return true;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
249
  }
 
 
 
 
250
 
251
- public function denyPayment(Mage_Payment_Model_Info $payment) {
252
- $data = $this->denyPaymentAndPrepareApiRequest($payment, $this->getConfigData('site_reference'));
253
- if ($data) {
254
- $this->getIntegration()->runApiTransactionUpdate($payment, $data);
255
- }
256
- return true;
 
 
 
 
 
 
 
 
 
 
 
257
  }
 
 
258
 
259
- protected function _getOrderIncrementIds($transactionReference) {
260
- $transaction = Mage::getModel('securetrading_stpp/transaction')->loadByTransactionReference($transactionReference);
261
- $orderIncrementIds = $transaction->getRequestData('order_increment_ids', null);
262
-
263
- if ($orderIncrementIds) {
264
- $orderIncrementIds = unserialize($orderIncrementIds);
265
- }
266
- if ($orderIncrementIds && count($orderIncrementIds) > 1) {
267
- return $orderIncrementIds;
268
- }
269
- return null;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
270
  }
 
 
271
 
272
- public function prepareToCaptureAuthorized(Mage_Sales_Model_Order_Payment $payment, $amount, $siteReference) {
273
- $transactionReference = $payment->getCcTransId();
274
- $orderIncrementIds = $this->_getOrderIncrementIds($transactionReference);
275
-
276
- if ($orderIncrementIds) {
277
- $orderBaseGrandTotal = null;
278
- $baseAmountPaid = null;
279
- $baseAmountRefunded = null;
280
- foreach($orderIncrementIds as $orderIncrementId) {
281
- $order = Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId);
282
- $orderBaseGrandTotal += $order->getBaseGrandTotal();
283
- $baseAmountPaid += $order->getPayment()->getBaseAmountPaid();
284
- $baseAmountRefunded += $order->getPayment()->getBaseAmountRefunded();
285
- }
286
- $orderBaseGrandTotal = (string) Mage::app()->getStore()->roundPrice($orderBaseGrandTotal);
287
- $baseAmountPaid = (string) Mage::app()->getStore()->roundPrice($baseAmountPaid);
288
- $baseAmountRefunded = (string) Mage::app()->getStore()->roundPrice($baseAmountRefunded);
289
- }
290
- else {
291
- $orderBaseGrandTotal = (string) Mage::app()->getStore()->roundPrice($payment->getOrder()->getBaseGrandTotal());
292
- $baseAmountPaid = (string) Mage::app()->getStore()->roundPrice($payment->getBaseAmountPaid());
293
- $baseAmountRefunded = (string) Mage::app()->getStore()->roundPrice($payment->getBaseAmountRefunded());
294
- }
295
- $amountToCapture = (string) $amount;
296
- $updates = array('settlestatus' => '0');
297
-
298
- if ($amountToCapture !== $orderBaseGrandTotal) {
299
- $updates['settlemainamount'] = ($baseAmountPaid + $amountToCapture) - $baseAmountRefunded;
300
- $updates['currencyiso3a'] = $payment->getOrder()->getBaseCurrencyCode();
301
- }
302
-
303
- $data = $this->_prepareTransactionUpdate($payment, $updates, $siteReference);
304
- return $data;
305
  }
 
 
306
 
307
- public function captureAuthorized(Mage_Sales_Model_Order_Payment $payment, $amount) {
308
- $data = $this->prepareToCaptureAuthorized($payment, $amount, $this->getConfigData('site_reference'));
309
- $this->getIntegration()->runApiTransactionUpdate($payment, $data);
310
- return $this;
311
  }
 
 
 
 
 
 
 
312
 
313
- protected function _handleStandardPaymentResult(Stpp_Api_ResultInterface $result) {
314
- $this->log(sprintf('In %s.', __METHOD__));
315
- if ($result->getRedirectRequired()) {
316
- $this->_setReadyForAcsUrlRedirect(true);
317
- $this->_getStateObject()->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT)->setStatus(Securetrading_Stpp_Model_Payment_Abstract::STATUS_PENDING_3DSECURE);
318
-
319
- $redirectPath = $this->getConfigData('api_use_iframe') ? 'securetrading/direct_post/iframe' : 'securetrading/direct_post/container';
320
- $params = new Varien_Object();
321
- $params
322
- ->setOrderPlaceRedirectUrl(Mage::getUrl($redirectPath))
323
- ->setRedirectIsPost($result->getRedirectIsPost())
324
- ->setRedirectUrl($result->getRedirectUrl())
325
- ->setRedirectData($result->getRedirectData())
326
- ;
327
- Mage::getSingleton('securetrading_stpp/payment_direct_session')->setAcsRedirectParams($params);
328
- }
329
- elseif(!$result->getIsTransactionSuccessful()) {
330
- throw new Mage_Payment_Model_Info_Exception($result->getErrorMessage());
331
- }
332
- else {
333
- $this->_getStateObject()->setState(Mage_Sales_Model_Order::STATE_PROCESSING)->setStatus(Mage_Sales_Model_Order::STATE_PROCESSING);
334
- }
335
- return $this;
336
  }
 
 
337
 
338
- protected function _prepareToUpdateSettleStatus(Mage_Payment_Model_Info $payment, $settleStatus, $siteReference) {
339
- $updates = array('settlestatus' => $settleStatus);
340
- $data = $this->_prepareTransactionUpdate($payment, $updates, $siteReference);
341
- return $data;
 
 
 
 
 
 
 
 
 
 
 
 
 
342
  }
343
-
344
- protected function _prepareTransactionUpdate(Mage_Sales_Model_Order_Payment $payment, $updates, $siteReference) {
345
- $data = array(
346
- 'filter' => array(
347
- 'sitereference' => $siteReference,
348
- 'transactionreference' => $payment->getCcTransId(),
349
- ),
350
- 'updates' => $updates
351
- );
352
- return $data;
 
353
  }
354
 
355
- protected function _authAndCapture(Mage_Sales_Model_Order_Payment $payment) {
356
- $result = $this->getIntegration()->runApiStandard($payment);
357
- $this->_handleStandardPaymentResult($result);
358
- return $this;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
359
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
360
 
361
- public function getOrderPlaceRedirectUrl() {
362
- $session = Mage::getSingleton('securetrading_stpp/payment_direct_session');
363
- $acsParamsExist = $session->hasAcsRedirectParams();
 
 
 
 
 
 
364
 
365
- $this->log(sprintf('In %s. ACS Params exist: %s.', __METHOD__, $acsParamsExist));
366
 
367
- if ($acsParamsExist) {
368
- return $session->getAcsRedirectParams()->getOrderPlaceRedirectUrl();
369
- }
370
- return null;
371
  }
 
 
372
 
373
- public function assignData($data) {
374
- $payment = $this->getInfoInstance();
375
- $payment->setCcType($data->getSecuretradingStppPaymentType());
376
- $payment->setCcNumberEnc($payment->encrypt($data->getSecuretradingStppCardNumber()));
377
- $payment->setCcLast4($this->getIntegration()->getCcLast4($data->getSecuretradingStppCardNumber()));
378
- $payment->setCcExpMonth($data->getSecuretradingStppExpiryDateMonth());
379
- $payment->setCcExpYear($data->getSecuretradingStppExpiryDateYear());
380
- $payment->setCcSsStartMonth($data->getSecuretradingStppStartDateMonth());
381
- $payment->setCcSsStartYear($data->getSecuretradingStppStartDateYear());
382
- $payment->setCcSsIssue($data->getSecuretradingStppIssueNumber());
383
- Mage::getModel('securetrading_stpp/payment_direct_session')->setSecurityCode($payment->encrypt($data->getSecuretradingStppSecurityCode())); // Cannot save CC CID due to PCI requirements.
384
- return $this;
385
- }
386
 
387
- public function prepareOrderData(Mage_Sales_Model_Order_Payment $payment, array $orderIncrementIds = array(), $sendEmailConfirmation = true) {
388
- $orderIncrementIds = array($payment->getOrder()->getId() => $payment->getOrder()->getIncrementId());
389
- $data = parent::prepareOrderData($payment, $orderIncrementIds);
390
- $payment = $this->getInfoInstance();
391
 
392
- $data += array(
393
- 'termurl' => Mage::getUrl('securetrading/direct/return'),
394
- 'paymenttype' => $payment->getCcType(),
395
- 'pan' => $payment->decrypt($payment->getCcNumberEnc()),
396
- 'expirydate' => $payment->getCcExpMonth() . '/' . $payment->getCcExpYear(),
397
- 'securitycode' => $payment->decrypt(Mage::getModel('securetrading_stpp/payment_direct_session')->getSecurityCode()),
398
- 'issuenumber' => $payment->getCcSsIssue(),
399
- );
400
 
401
- if ($payment->getCcSsStartMonth() || $payment->getCcSsStartYear()) {
402
- $data['startdate'] = $payment->getCcSsStartMonth() . '/' . $payment->getCcSsStartYear();
403
- }
404
- return $data;
405
  }
 
 
406
 
407
- public function run3dAuth() {
408
- $this->log(sprintf('In %s.', __METHOD__));
409
- $result = $this->getIntegration()->runApi3dAuth();
410
- if ($result->getErrorMessage()) {
411
- Mage::getSingleton('checkout/session')->addError($result->getErrorMessage());
412
- }
413
- return $result->getIsTransactionSuccessful();
 
 
414
  }
415
-
416
- public function handleSuccessfulPayment(Mage_Sales_Model_Order $order, $emailConfirmation = true) {
417
- parent::handleSuccessfulPayment($order, $emailConfirmation);
418
- Mage::getSingleton('securetrading_stpp/payment_direct_session')->clear();
419
  }
 
 
 
 
 
 
 
420
  }
1
  <?php
2
 
3
  class Securetrading_Stpp_Model_Payment_Direct extends Securetrading_Stpp_Model_Payment_Abstract {
4
+ protected $_code = 'securetrading_stpp_direct';
5
+ protected $_formBlockType = 'securetrading_stpp/payment_direct_form';
6
+ protected $_infoBlockType = 'securetrading_stpp/payment_direct_info';
7
+
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 = true;
17
+ protected $_canUseCheckout = true;
18
+ protected $_canUseForMultishipping = true;
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 static $_reviewingIncrementIds = array();
27
+
28
+ const MULTISHIPPING_STATE_OBJECT_REGISTRY_KEY = 'securetrading_stpp_payment_direct_multishipping_state_object_registry_key';
29
+
30
+ public function setStateObject(Varien_Object $stateObject) {
31
+ $this->_stateObject = $stateObject;
32
+ return $this;
33
+ }
34
 
35
+ protected function _getStateObject($graceful = false) {
36
+ if ($this->_stateObject === null) {
37
+ if ($graceful) {
38
+ return false;
39
+ }
40
+ throw new Exception(Mage::helper('securetrading_stpp')->__('The state object has not been set.'));
41
  }
42
+ return $this->_stateObject;
43
+ }
44
 
45
+ protected function _setReadyForAcsUrlRedirect($bool) {
46
+ $this->_getStateObject()->setReadyForAcsRedirect((bool)$bool);
47
+ return $this;
48
+ }
49
+ protected function _getReadyForAcsUrlRedirect() {
50
+ $stateObject = $this->_getStateObject(true); // Because processInvoice() is called when capturing a pending invoice.
51
+ if ($stateObject) {
52
+ return (bool) $stateObject->getReadyForAcsRedirect();
53
  }
54
+ return false;
55
+ }
56
+
57
+ protected function _getFirstMultishippingStateObject() {
58
+ return Mage::registry(Securetrading_Stpp_Model_Payment_Direct::MULTISHIPPING_STATE_OBJECT_REGISTRY_KEY);
59
+ }
60
+
61
+ protected function _setFirstMultishippingStateObject(Varien_Object $stateObject) {
62
+ Mage::register(Securetrading_Stpp_Model_Payment_Direct::MULTISHIPPING_STATE_OBJECT_REGISTRY_KEY, $stateObject);
63
+ return $this;
64
+ }
65
+
66
+ public function initialize($action, $stateObject) {
67
+ if ($this->getPaymentPlaceWithoutMakingApiRequest()) {
68
+ return $this;
69
  }
70
+ else if ($this->getIsMultishipping()) {
71
+ if ($this->getIsFirstMultishipping()) {
72
+ $this->_setFirstMultishippingStateObject($stateObject);
73
+ }
74
+ else {
75
+ $stateObject->setData($this->_getFirstMultishippingStateObject()->getData());
76
+ }
 
 
 
 
 
 
 
 
 
 
 
 
77
  }
78
 
79
+ $this->setStateObject($stateObject);
80
+ $payment = $this->getInfoInstance();
81
+ $order = $payment->getOrder();
82
+
83
+ switch ($action) {
84
+ case Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE:
85
+ $payment->authorize(true, $order->getBaseTotalDue()); // base amount will be set inside
86
+ $payment->setAmountAuthorized($order->getTotalDue());
87
+ break;
88
+ case Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE_CAPTURE:
89
+ $payment->setAmountAuthorized($order->getTotalDue());
90
+ $payment->setBaseAmountAuthorized($order->getBaseTotalDue());
91
+ $payment->capture(null);
92
+ break;
93
+ default:
94
+ throw new Exception(sprintf(Mage::helper('securetrading_stpp')->__('Invalid payment action: "%s".'), $action));
95
  }
96
+ }
97
+
98
+ public function processInvoice($invoice, $payment) {
99
+ if ($this->_getReadyForAcsUrlRedirect()) {
100
+ foreach($this->getInfoInstance()->getOrder()->getStatusHistoryCollection(true) as $c) {
101
+ $c->delete();
102
+ }
103
+ $invoice->setIsPaid(false);
104
+ }
105
+ }
106
 
107
+ public function authorize(Varien_Object $payment, $amount) {
108
+ if ($this->getIsMultishipping() && !$this->getIsFirstMultishipping()) {
109
+ return $this;
 
 
 
110
  }
111
+ $this->log(sprintf('In %s.', __METHOD__));
112
+ parent::authorize($payment, $amount);
113
+ $result = $this->getIntegration()->runApiStandard($payment);
114
+ $this->_handleStandardPaymentResult($result);
115
+ return $this;
116
+ }
117
 
118
+ public function capture(Varien_Object $payment, $amount) {
119
+ if ($this->getIsMultishipping() && !$this->getIsFirstMultishipping()) {
120
+ return $this;
121
+ }
122
+ $this->log(sprintf('In %s.', __METHOD__));
123
+ parent::capture($payment, $amount);
124
 
125
+ if ($payment->lookupTransaction('', Mage_Sales_Model_Order_Payment_Transaction::TYPE_AUTH)) {
126
+ $this->captureAuthorized($payment, $amount);
 
 
 
 
 
127
  }
128
+ else {
129
+ $this->_authAndCapture($payment);
 
 
 
 
 
 
 
 
130
  }
131
+ return $this;
132
+ }
133
 
134
+ protected function _paymentHasSuccessfulRefund(Mage_Sales_Model_Order_Payment $payment) {
135
+ $refundTransaction = $payment->lookupTransaction('', Mage_Sales_Model_Order_Payment_Transaction::TYPE_REFUND);
136
+ if ($refundTransaction) {
137
+ $securetradingRefundTransaction = Mage::getModel('securetrading_stpp/transaction')->loadByTransactionReference($refundTransaction->getTxnId(), true);
138
+ if ($securetradingRefundTransaction && $securetradingRefundTransaction->getRequestType() === Securetrading_Stpp_Model_Transaction_Types::TYPE_REFUND) {
139
+ return true;
140
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
141
  }
142
+ return false;
143
+ }
144
 
145
+ public function prepareToRefund(Varien_Object $payment, $amount, $siteReference) {
146
+ $transactionReference = $payment->getCcTransId();
147
+ $orderIncrementIds = $this->_getOrderIncrementIds($transactionReference);
 
 
148
 
149
+ if ($orderIncrementIds) {
150
+ $partialRefundAlreadyProcessed = null;
151
+ $orderBaseGrandTotal = null;
152
+ $baseTotalPaid = null;
153
+ $baseTotalRefunded = null;
154
+
155
+ foreach($orderIncrementIds as $orderIncrementId) {
156
+ $tempPayment = Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId)->getPayment();
157
+
158
+ if ($partialRefundAlreadyProcessed !== true) {
159
+ $partialRefundAlreadyProcessed = $this->_paymentHasSuccessfulRefund($tempPayment);
160
+ }
161
 
162
+ $orderBaseGrandTotal += $tempPayment->getOrder()->getBaseGrandTotal();
163
+ $baseTotalPaid += $tempPayment->getOrder()->getBaseTotalPaid();
164
+ $baseTotalRefunded += $tempPayment->getOrder()->getBaseTotalRefunded();
165
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
166
  }
167
+ else {
168
+ $partialRefundAlreadyProcessed = $this->_paymentHasSuccessfulRefund($payment);
169
+ $orderBaseGrandTotal = $payment->getOrder()->getBaseGrandTotal();
170
+ $baseTotalPaid = $payment->getOrder()->getBaseTotalPaid();
171
+ $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.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
172
  }
173
 
174
+ $data = array(
175
+ 'original_order_total'=> $orderBaseGrandTotal, // Total of original AUTH.
176
+ 'order_total_paid'=> $baseTotalPaid, // How much has been captured from the AUTH (do not consider how much has been refunded via TU or REFUND).
177
+ 'order_total_refunded'=> $baseTotalRefunded, // How much has been refunded via TU or REFUND.
178
+ 'amount_to_refund'=> $amount,
179
+ 'partial_refund_already_processed' => $partialRefundAlreadyProcessed,
180
+ 'site_reference' => $siteReference,
181
+ 'transaction_reference' => $transactionReference,
182
+ 'using_main_amount'=> true,
183
+ 'currency_iso_3a'=> $payment->getOrder()->getBaseCurrencyCode(),
184
+ 'allow_suspend'=> true,
185
+ );
186
+
187
+ $payment->setShouldCloseParentTransaction(false);
188
+ return $data;
189
+ }
190
+
191
+ public function refund(Varien_Object $payment, $amount) {
192
+ $data = $this->prepareToRefund($payment, $amount, $this->getConfigData('site_reference'));
193
+ $this->getIntegration()->runApiRefund($payment, $data);
194
+ return $this;
195
+ }
196
+
197
+ public function cancel(Varien_Object $payment) {
198
+ return $this; // Do nothing intentionally.
199
+ }
200
+
201
+ public function denyPaymentAndPrepareApiRequest(Mage_Payment_Model_Info $payment, $siteReference) {
202
+ parent::denyPayment($payment);
203
+ $data = null;
204
+
205
+ if (!empty(self::$_reviewingIncrementIds)) {
206
+ $payment->setShouldCloseParentTransaction(true);
207
+ $payment->addTransaction(Mage_Sales_Model_Order_Payment_Transaction::TYPE_VOID);
208
  }
209
+ else {
210
+ if ($payment->getOrder()->getState() !== Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW) {
211
+ throw new Mage_Core_Exception('This order is no longer in the payment review state.');
212
+ }
213
 
214
+ $transactionReference = $payment->getCcTransId();
215
+ $orderIncrementIds = $this->_getOrderIncrementIds($transactionReference);
216
+
217
+ if ($orderIncrementIds) {
218
+ self::$_reviewingIncrementIds = $orderIncrementIds;
219
+ foreach($orderIncrementIds as $orderIncrementId) {
220
+ $order = Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId);
221
+ $order->getPayment()->deny();
222
+ $order->save();
223
+ }
224
+ self::$_reviewingIncrementIds = array();
225
+ }
226
+ else {
227
+ $payment->setShouldCloseParentTransaction(true);
228
+ $payment->addTransaction(Mage_Sales_Model_Order_Payment_Transaction::TYPE_VOID);
229
+ }
230
+ $data = $this->_prepareToUpdateSettleStatus($payment, '3', $siteReference);
231
  }
232
+ return $data;
233
+ }
234
 
235
+ public function acceptPaymentAndPrepareApiRequest(Mage_Payment_Model_Info $payment, $siteReference) {
236
+ parent::acceptPayment($payment);
237
+ $data = null;
238
+
239
+ if (empty(self::$_reviewingIncrementIds)) {
240
+ if ($payment->getOrder()->getState() !== Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW) {
241
+ throw new Mage_Core_Exception('This order is no longer in the payment review state.');
242
+ }
243
+
244
+ $transactionReference = $payment->getCcTransId();
245
+ $orderIncrementIds = $this->_getOrderIncrementIds($transactionReference);
246
+
247
+ if ($orderIncrementIds) {
248
+ self::$_reviewingIncrementIds = $orderIncrementIds;
249
+ foreach($orderIncrementIds as $orderIncrementId) {
250
+ $order = Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId);
251
+ $order->getPayment()->accept();
252
+ $order->save();
253
+ }
254
+ self::$_reviewingIncrementIds = array();
255
+ }
256
+
257
+ $transaction = Mage::getModel('securetrading_stpp/transaction')->loadByTransactionReference($payment->getCcTransId());
258
+ $requestedSettleStatus = $transaction->getRequestData('settlestatus');
259
+
260
+ if ($requestedSettleStatus === null) { // Will be null if the $transaction was a 3D AUTH (which has MD/PaRes instead).
261
+ if (!$parentTransaction = $transaction->getParentTransaction(true)) {
262
+ throw new Exception(sprintf(Mage::helper('securetrading_stpp')->__('Payment "%s" had transaction reference "%s" but had no settle status and no parent transaction reference.'), $payment->getId(), $payment->getCcTransId()));
263
+ }
264
+ if ($parentTransaction->getRequestData('requesttypedescription') !== $this->getIntegration()->getThreedqueryName()) {
265
+ throw new Exception(sprintf(Mage::helper('securetrading_stpp')->__('Payment "%s" had transaction reference "%s" but had no settle status and no parent THREEDQUERY.'), $payment->getId(), $payment->getCcTransId()));
266
+ }
267
+ if ($parentTransaction->getRequestData('settlestatus') === null) {
268
+ throw new Exception(sprintf(Mage::helper('securetrading_stpp')->__('Payment "%s" had transaction reference "%s" but had no settle status and its parent THREEDQUERY had no settle status.'), $payment->getId(), $payment->getCcTransId()));
269
+ }
270
+ $requestedSettleStatus = $parentTransaction->getRequestData('settlestatus');
271
+ }
272
+
273
+ 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).
274
+ $data = $this->_prepareToUpdateSettleStatus($payment, $requestedSettleStatus, $siteReference);
275
+ }
276
  }
277
+ return $data;
278
+ }
279
 
280
+ public function acceptPayment(Mage_Payment_Model_Info $payment) {
281
+ $data = $this->acceptPaymentAndPrepareApiRequest($payment, $this->getConfigData('site_reference'));
282
+ if ($data) {
283
+ $this->getIntegration()->runApiTransactionUpdate($payment, $data);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
284
  }
285
+ return true;
286
+ }
287
 
288
+ public function denyPayment(Mage_Payment_Model_Info $payment) {
289
+ $data = $this->denyPaymentAndPrepareApiRequest($payment, $this->getConfigData('site_reference'));
290
+ if ($data) {
291
+ $this->getIntegration()->runApiTransactionUpdate($payment, $data);
292
  }
293
+ return true;
294
+ }
295
+
296
+ protected function _getOrderIncrementIds($transactionReference) {
297
+ $transaction = Mage::getModel('securetrading_stpp/transaction')->loadByTransactionReference($transactionReference);
298
+ $orderId = $transaction->getOrderId();
299
+ $factory = Mage::getModel('securetrading_multishipping/order_set_factory');
300
 
301
+ if ($factory->orderBelongsToAnySet($orderId)) {
302
+ $orderIds = $factory->getOrderIdsInSameSet($orderId, false);
303
+ $orderIncrementIds = array();
304
+ foreach($orderIds as $orderId) {
305
+ $orderIncrementIds[] = Mage::getModel('sales/order')->load($orderId)->getIncrementId();
306
+ }
307
+ return $orderIncrementIds;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
308
  }
309
+ return null;
310
+ }
311
 
312
+ public function prepareToCaptureAuthorized(Mage_Sales_Model_Order_Payment $payment, $amount, $siteReference) {
313
+ $transactionReference = $payment->getCcTransId();
314
+ $orderIncrementIds = $this->_getOrderIncrementIds($transactionReference);
315
+
316
+ if ($orderIncrementIds) {
317
+ $orderBaseGrandTotal = null;
318
+ $baseAmountPaid = null;
319
+ $baseAmountRefunded = null;
320
+ foreach($orderIncrementIds as $orderIncrementId) {
321
+ $order = Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId);
322
+ $orderBaseGrandTotal += $order->getBaseGrandTotal();
323
+ $baseAmountPaid += $order->getPayment()->getBaseAmountPaid();
324
+ $baseAmountRefunded += $order->getPayment()->getBaseAmountRefunded();
325
+ }
326
+ $orderBaseGrandTotal = (string) Mage::app()->getStore()->roundPrice($orderBaseGrandTotal);
327
+ $baseAmountPaid = (string) Mage::app()->getStore()->roundPrice($baseAmountPaid);
328
+ $baseAmountRefunded = (string) Mage::app()->getStore()->roundPrice($baseAmountRefunded);
329
  }
330
+ else {
331
+ $orderBaseGrandTotal = (string) Mage::app()->getStore()->roundPrice($payment->getOrder()->getBaseGrandTotal());
332
+ $baseAmountPaid = (string) Mage::app()->getStore()->roundPrice($payment->getBaseAmountPaid());
333
+ $baseAmountRefunded = (string) Mage::app()->getStore()->roundPrice($payment->getBaseAmountRefunded());
334
+ }
335
+ $amountToCapture = (string) $amount;
336
+ $updates = array('settlestatus' => '0');
337
+
338
+ if ($amountToCapture !== $orderBaseGrandTotal) {
339
+ $updates['settlemainamount'] = ($baseAmountPaid + $amountToCapture) - $baseAmountRefunded;
340
+ $updates['currencyiso3a'] = $payment->getOrder()->getBaseCurrencyCode();
341
  }
342
 
343
+ $data = $this->_prepareTransactionUpdate($payment, $updates, $siteReference);
344
+ return $data;
345
+ }
346
+
347
+ public function captureAuthorized(Mage_Sales_Model_Order_Payment $payment, $amount) {
348
+ $data = $this->prepareToCaptureAuthorized($payment, $amount, $this->getConfigData('site_reference'));
349
+ $this->getIntegration()->runApiTransactionUpdate($payment, $data);
350
+ return $this;
351
+ }
352
+
353
+ protected function _handleStandardPaymentResult(Stpp_Api_ResultInterface $result) {
354
+ $this->log(sprintf('In %s.', __METHOD__));
355
+ if ($result->getRedirectRequired()) {
356
+ $this->_setReadyForAcsUrlRedirect(true);
357
+ $this->_getStateObject()->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT)->setStatus(Securetrading_Stpp_Model_Payment_Abstract::STATUS_PENDING_3DSECURE);
358
+
359
+ $redirectPath = $this->getConfigData('api_use_iframe') ? 'securetrading/direct_post/iframe' : 'securetrading/direct_post/container';
360
+ $params = new Varien_Object();
361
+ $params
362
+ ->setOrderPlaceRedirectUrl(Mage::getUrl($redirectPath))
363
+ ->setRedirectIsPost($result->getRedirectIsPost())
364
+ ->setRedirectUrl($result->getRedirectUrl())
365
+ ->setRedirectData($result->getRedirectData())
366
+ ;
367
+ Mage::getSingleton('securetrading_stpp/payment_direct_session')->setAcsRedirectParams($params);
368
+ }
369
+ elseif(!$result->getIsTransactionSuccessful()) {
370
+ throw new Mage_Payment_Model_Info_Exception($result->getErrorMessage());
371
  }
372
+ else {
373
+ $this->_getStateObject()->setState(Mage_Sales_Model_Order::STATE_PROCESSING)->setStatus(Mage_Sales_Model_Order::STATE_PROCESSING);
374
+ }
375
+ return $this;
376
+ }
377
+
378
+ protected function _prepareToUpdateSettleStatus(Mage_Payment_Model_Info $payment, $settleStatus, $siteReference) {
379
+ $updates = array('settlestatus' => $settleStatus);
380
+ $data = $this->_prepareTransactionUpdate($payment, $updates, $siteReference);
381
+ return $data;
382
+ }
383
+
384
+ protected function _prepareTransactionUpdate(Mage_Sales_Model_Order_Payment $payment, $updates, $siteReference) {
385
+ $data = array(
386
+ 'filter' => array(
387
+ 'sitereference' => $siteReference,
388
+ 'transactionreference' => $payment->getCcTransId(),
389
+ ),
390
+ 'updates' => $updates
391
+ );
392
+ return $data;
393
+ }
394
 
395
+ protected function _authAndCapture(Mage_Sales_Model_Order_Payment $payment) {
396
+ $result = $this->getIntegration()->runApiStandard($payment);
397
+ $this->_handleStandardPaymentResult($result);
398
+ return $this;
399
+ }
400
+
401
+ public function getOrderPlaceRedirectUrl() {
402
+ $session = Mage::getSingleton('securetrading_stpp/payment_direct_session');
403
+ $acsParamsExist = $session->hasAcsRedirectParams();
404
 
405
+ $this->log(sprintf('In %s. ACS Params exist: %s.', __METHOD__, $acsParamsExist));
406
 
407
+ if ($acsParamsExist) {
408
+ return $session->getAcsRedirectParams()->getOrderPlaceRedirectUrl();
 
 
409
  }
410
+ return null;
411
+ }
412
 
413
+ public function assignData($data) {
414
+ $payment = $this->getInfoInstance();
415
+ $payment->setCcType($data->getSecuretradingStppPaymentType());
416
+ $payment->setCcNumberEnc($payment->encrypt($data->getSecuretradingStppCardNumber()));
417
+ $payment->setCcLast4($this->getIntegration()->getCcLast4($data->getSecuretradingStppCardNumber()));
418
+ $payment->setCcExpMonth($data->getSecuretradingStppExpiryDateMonth());
419
+ $payment->setCcExpYear($data->getSecuretradingStppExpiryDateYear());
420
+ $payment->setCcSsStartMonth($data->getSecuretradingStppStartDateMonth());
421
+ $payment->setCcSsStartYear($data->getSecuretradingStppStartDateYear());
422
+ $payment->setCcSsIssue($data->getSecuretradingStppIssueNumber());
423
+ Mage::getModel('securetrading_stpp/payment_direct_session')->setSecurityCode($payment->encrypt($data->getSecuretradingStppSecurityCode())); // Cannot save CC CID due to PCI requirements.
424
+ return $this;
425
+ }
426
 
427
+ public function prepareOrderData(Mage_Sales_Model_Order_Payment $payment, array $orderIncrementIds = array(), $sendEmailConfirmation = true) {
428
+ $data = parent::prepareOrderData($payment, $orderIncrementIds);
429
+ $payment = $this->getInfoInstance();
 
430
 
431
+ $data += array(
432
+ 'termurl' => Mage::getUrl('securetrading/direct/return'),
433
+ 'paymenttype' => $payment->getCcType(),
434
+ 'pan' => $payment->decrypt($payment->getCcNumberEnc()),
435
+ 'expirydate' => sprintf('%02s', $payment->getCcExpMonth()) . '/' . $payment->getCcExpYear(),
436
+ 'securitycode' => $payment->decrypt(Mage::getModel('securetrading_stpp/payment_direct_session')->getSecurityCode()),
437
+ 'issuenumber' => $payment->getCcSsIssue(),
438
+ );
439
 
440
+ if ($payment->getCcSsStartMonth() && $payment->getCcSsStartYear()) {
441
+ $data['startdate'] = $payment->getCcSsStartMonth() . '/' . $payment->getCcSsStartYear();
 
 
442
  }
443
+ return $data;
444
+ }
445
 
446
+ public function run3dAuth() {
447
+ $this->log(sprintf('In %s.', __METHOD__));
448
+ if (Mage::getModel('checkout/session')->getQuote()->getIsMultiShipping()) {
449
+ $orderIncrementIds = Mage::getModel('core/session')->getOrderIds();
450
+ $orders = array();
451
+ foreach($orderIncrementIds as $orderId => $orderIncrementId) {
452
+ $orders[] = Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId);
453
+ }
454
+ Mage::register(Securetrading_Stpp_Model_Actions_Direct::MULTISHIPPING_ORDERS_REGISTRY_KEY, $orders);
455
  }
456
+ $result = $this->getIntegration()->runApi3dAuth();
457
+ if ($result->getErrorMessage()) {
458
+ Mage::getSingleton('checkout/session')->addError($result->getErrorMessage());
 
459
  }
460
+ return $result->getIsTransactionSuccessful();
461
+ }
462
+
463
+ public function handleSuccessfulPayment(Mage_Sales_Model_Order $order, $emailConfirmation = true) {
464
+ parent::handleSuccessfulPayment($order, $emailConfirmation);
465
+ Mage::getSingleton('securetrading_stpp/payment_direct_session')->clear();
466
+ }
467
  }
app/code/local/Securetrading/Stpp/Model/Payment/Redirect.php CHANGED
@@ -38,7 +38,7 @@ class Securetrading_Stpp_Model_Payment_Redirect extends Securetrading_Stpp_Model
38
 
39
  public function acceptPayment(Mage_Payment_Model_Info $payment) {
40
  $this->log(sprintf('In %s.', __METHOD__));
41
- $data = $this->_getApi()->acceptPaymentAndPrepareApiRequest($payment, $this->getConfigData('site_reference'));
42
  if ($data) {
43
  $this->getIntegration()->runApiTransactionUpdate($payment, $data);
44
  }
@@ -47,7 +47,7 @@ class Securetrading_Stpp_Model_Payment_Redirect extends Securetrading_Stpp_Model
47
 
48
  public function denyPayment(Mage_Payment_Model_Info $payment) {
49
  $this->log(sprintf('In %s.', __METHOD__));
50
- $data = $this->_getApi()->denyPaymentAndPrepareApiRequest($payment, $this->getConfigData('site_reference'));
51
  if ($data) {
52
  $this->getIntegration()->runApiTransactionUpdate($payment, $data);
53
  }
@@ -85,14 +85,15 @@ class Securetrading_Stpp_Model_Payment_Redirect extends Securetrading_Stpp_Model
85
  $data = parent::prepareOrderData($payment, $orderIncrementIds);
86
 
87
  return $data += array(
88
- 'customfield1' => $payment->getOrder()->getStoreId(),
89
  'parentcss' => $this->getConfigData('parent_css'),
90
  'childcss' => $this->getConfigData('child_css'),
91
  'parentjs' => $this->getConfigData('parent_js'),
92
  'childjs' => $this->getConfigData('child_js'),
 
93
  '_charset_' => Mage::getStoreConfig('design/head/default_charset'),
94
- 'order_increment_ids' => serialize($orderIncrementIds),
95
- 'send_confirmation' => $sendEmailConfirmation,
96
  );
97
  }
98
 
@@ -103,7 +104,7 @@ class Securetrading_Stpp_Model_Payment_Redirect extends Securetrading_Stpp_Model
103
  public function capture(Varien_Object $payment, $amount) {
104
  $this->log(sprintf('In %s.', __METHOD__));
105
  parent::capture($payment, $amount);
106
- $data = $this->_getApi()->prepareToCaptureAuthorized($payment, $amount, $this->getConfigData('site_reference'));
107
  $this->getIntegration()->runApiTransactionUpdate($payment, $data);
108
  return $this;
109
  }
@@ -111,7 +112,7 @@ class Securetrading_Stpp_Model_Payment_Redirect extends Securetrading_Stpp_Model
111
  public function refund(Varien_Object $payment, $amount) {
112
  $this->log(sprintf('In %s.', __METHOD__));
113
  parent::refund($payment, $amount);
114
- $data = $this->_getApi()->prepareToRefund($payment, $amount, $this->getConfigData('site_reference'));
115
  $this->getIntegration()->runApiRefund($payment, $data);
116
  return $this;
117
  }
38
 
39
  public function acceptPayment(Mage_Payment_Model_Info $payment) {
40
  $this->log(sprintf('In %s.', __METHOD__));
41
+ $data = $this->_getApi()->acceptPaymentAndPrepareApiRequest($payment, $this->getConfigData('site_reference'));
42
  if ($data) {
43
  $this->getIntegration()->runApiTransactionUpdate($payment, $data);
44
  }
47
 
48
  public function denyPayment(Mage_Payment_Model_Info $payment) {
49
  $this->log(sprintf('In %s.', __METHOD__));
50
+ $data = $this->_getApi()->denyPaymentAndPrepareApiRequest($payment, $this->getConfigData('site_reference'));
51
  if ($data) {
52
  $this->getIntegration()->runApiTransactionUpdate($payment, $data);
53
  }
85
  $data = parent::prepareOrderData($payment, $orderIncrementIds);
86
 
87
  return $data += array(
88
+ 'customfield1' => $payment->getOrder()->getStoreId(),
89
  'parentcss' => $this->getConfigData('parent_css'),
90
  'childcss' => $this->getConfigData('child_css'),
91
  'parentjs' => $this->getConfigData('parent_js'),
92
  'childjs' => $this->getConfigData('child_js'),
93
+ //'subsitereference' => $this->getConfigData('sub_site_reference'),
94
  '_charset_' => Mage::getStoreConfig('design/head/default_charset'),
95
+ 'order_increment_ids' => serialize($orderIncrementIds),
96
+ 'send_confirmation' => $sendEmailConfirmation,
97
  );
98
  }
99
 
104
  public function capture(Varien_Object $payment, $amount) {
105
  $this->log(sprintf('In %s.', __METHOD__));
106
  parent::capture($payment, $amount);
107
+ $data = $this->_getApi()->prepareToCaptureAuthorized($payment, $amount, $this->getConfigData('site_reference'));
108
  $this->getIntegration()->runApiTransactionUpdate($payment, $data);
109
  return $this;
110
  }
112
  public function refund(Varien_Object $payment, $amount) {
113
  $this->log(sprintf('In %s.', __METHOD__));
114
  parent::refund($payment, $amount);
115
+ $data = $this->_getApi()->prepareToRefund($payment, $amount, $this->getConfigData('site_reference'));
116
  $this->getIntegration()->runApiRefund($payment, $data);
117
  return $this;
118
  }
app/code/local/Securetrading/Stpp/controllers/Direct/PostController.php CHANGED
@@ -6,9 +6,15 @@ class Securetrading_Stpp_Direct_PostController extends Mage_Core_Controller_Fron
6
  public function preDispatch() {
7
  parent::preDispatch();
8
 
9
- $orderIncrementId = Mage::getModel('checkout/session')->getLastRealOrderId();
 
 
 
 
 
 
10
  $this->_methodInstance = Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId)->getPayment()->getMethodInstance();
11
-
12
  if ($this->_methodInstance->getCode() !== Mage::getModel('securetrading_stpp/payment_direct')->getCode()) {
13
  throw new Exception(Mage::helper('securetrading_stpp')->__('Cannot access payment method.'));
14
  }
6
  public function preDispatch() {
7
  parent::preDispatch();
8
 
9
+ if (Mage::getSingleton('checkout/session')->getQuote()->getIsMultiShipping()) {
10
+ $orderIncrementId = array_shift(Mage::getModel('core/session')->getOrderIds());
11
+ }
12
+ else {
13
+ $orderIncrementId = Mage::getModel('checkout/session')->getLastRealOrderId(); //onepage checkout
14
+ }
15
+
16
  $this->_methodInstance = Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId)->getPayment()->getMethodInstance();
17
+
18
  if ($this->_methodInstance->getCode() !== Mage::getModel('securetrading_stpp/payment_direct')->getCode()) {
19
  throw new Exception(Mage::helper('securetrading_stpp')->__('Cannot access payment method.'));
20
  }
app/code/local/Securetrading/Stpp/controllers/DirectController.php CHANGED
@@ -1,16 +1,24 @@
1
  <?php
2
 
3
  class Securetrading_Stpp_DirectController extends Mage_Core_Controller_Front_Action {
4
- public function returnAction() {
5
  $result = Mage::getModel('securetrading_stpp/payment_direct')->run3dAuth();
6
-
7
- if ($result) {
 
 
 
8
  $path = 'checkout/onepage/success';
 
9
  }
10
  else {
11
- $path = 'checkout/cart';
12
- }
13
-
 
 
 
 
14
  $queryArgs = array('path' => $path);
15
  $this->_redirect('securetrading/payment/location', array('_query' => $queryArgs));
16
  }
1
  <?php
2
 
3
  class Securetrading_Stpp_DirectController extends Mage_Core_Controller_Front_Action {
4
+ public function returnAction() {
5
  $result = Mage::getModel('securetrading_stpp/payment_direct')->run3dAuth();
6
+ if ($result) {
7
+ if (Mage::getModel('core/session')->getOrderIds()) {
8
+ $path = 'checkout/multishipping/success';
9
+ }
10
+ else {
11
  $path = 'checkout/onepage/success';
12
+ }
13
  }
14
  else {
15
+ if (Mage::getModel('core/session')->getOrderIds()) {
16
+ $path = 'checkout/multishipping/billing';
17
+ }
18
+ else {
19
+ $path = 'checkout/cart';
20
+ }
21
+ }
22
  $queryArgs = array('path' => $path);
23
  $this->_redirect('securetrading/payment/location', array('_query' => $queryArgs));
24
  }
app/code/local/Securetrading/Stpp/controllers/MultishippingController.php CHANGED
@@ -3,86 +3,145 @@
3
  require_once(Mage::getModuleDir('controllers', 'Mage_Checkout') . DS . 'MultishippingController.php');
4
 
5
  class Securetrading_Stpp_MultishippingController extends Mage_Checkout_MultishippingController {
6
- public function overviewPostAction()
7
- {
8
- // start st added
9
- if ($this->_getCheckout()->getQuote()->getPayment()->getMethodInstance()->getCode() !== 'securetrading_stpp_redirect') {
10
- return parent::overviewPostAction();
11
- }
12
-
13
- $versionInfo = Mage::getVersionInfo();
14
- $validateFormKey = false;
15
-
16
- if ($versionInfo['minor'] == 8 && $versionInfo['revision'] >= 1) {
17
- $validateFormKey = true;
18
- }
19
- elseif($versionInfo['minor'] > 8) {
20
- $validateFormKey = true;
21
- }
22
- // end st added
23
-
24
- if ($validateFormKey) { // conditional st added
25
- if (!$this->_validateFormKey()) {
26
- $this->_forward('backToAddresses');
27
- return;
28
- }
29
- } // conditional st added
30
-
31
- if (!$this->_validateMinimumAmount()) {
32
- return;
33
- }
34
-
35
- try {
36
- if ($requiredAgreements = Mage::helper('checkout')->getRequiredAgreementIds()) {
37
- $postedAgreements = array_keys($this->getRequest()->getPost('agreement', array()));
38
- if ($diff = array_diff($requiredAgreements, $postedAgreements)) {
39
- $this->_getCheckoutSession()->addError($this->__('Please agree to all Terms and Conditions before placing the order.'));
40
- $this->_redirect('*/*/billing');
41
- return;
42
- }
43
- }
44
-
45
- $payment = $this->getRequest()->getPost('payment');
46
- $paymentInstance = $this->_getCheckout()->getQuote()->getPayment();
47
- if (isset($payment['cc_number'])) {
48
- $paymentInstance->setCcNumber($payment['cc_number']);
49
- }
50
- if (isset($payment['cc_cid'])) {
51
- $paymentInstance->setCcCid($payment['cc_cid']);
52
- }
53
- $this->_getCheckout()->createOrders();
54
-
55
- // start st added
56
- $this->_getCheckout()->getQuote()
57
- ->setIsActive(true)
58
- ->save();
59
- $path = Mage::getModel('securetrading_stpp/payment_redirect')->getMultishippingRedirectPath();
60
- $this->_redirect($path);
61
- // end st added
62
- } catch (Mage_Payment_Model_Info_Exception $e) {
63
- $message = $e->getMessage();
64
- if ( !empty($message) ) {
65
- $this->_getCheckoutSession()->addError($message);
66
- }
67
- $this->_redirect('*/*/billing');
68
- } catch (Mage_Checkout_Exception $e) {
69
- Mage::helper('checkout')
70
- ->sendPaymentFailedEmail($this->_getCheckout()->getQuote(), $e->getMessage(), 'multi-shipping');
71
- $this->_getCheckout()->getCheckoutSession()->clear();
72
- $this->_getCheckoutSession()->addError($e->getMessage());
73
- $this->_redirect('*/cart');
74
- }
75
- catch (Mage_Core_Exception $e) {
76
- Mage::helper('checkout')
77
- ->sendPaymentFailedEmail($this->_getCheckout()->getQuote(), $e->getMessage(), 'multi-shipping');
78
- $this->_getCheckoutSession()->addError($e->getMessage());
79
- $this->_redirect('*/*/billing');
80
- } catch (Exception $e) {
81
- Mage::logException($e);
82
- Mage::helper('checkout')
83
- ->sendPaymentFailedEmail($this->_getCheckout()->getQuote(), $e->getMessage(), 'multi-shipping');
84
- $this->_getCheckoutSession()->addError($this->__('Order place error.'));
85
- $this->_redirect('*/*/billing');
86
- }
87
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88
  }
3
  require_once(Mage::getModuleDir('controllers', 'Mage_Checkout') . DS . 'MultishippingController.php');
4
 
5
  class Securetrading_Stpp_MultishippingController extends Mage_Checkout_MultishippingController {
6
+ protected function _getMultishippingOrders() {
7
+ $orders = array();
8
+ foreach(Mage::getModel('core/session')->getOrderIds() as $orderId => $orderIncrementId) {
9
+ $orders[] = Mage::getModel('sales/order')->load($orderId);
10
+ }
11
+ return $orders;
12
+ }
13
+
14
+ protected function _doApiMultishippingPayment() {
15
+ $orders = $this->_getMultishippingOrders();
16
+ Mage::register(Securetrading_Stpp_Model_Actions_Direct::MULTISHIPPING_ORDERS_REGISTRY_KEY, $orders);
17
+ try {
18
+ for ($i = 0; $i < count($orders); $i++) {
19
+ $order = $orders[$i];
20
+ $order->getPayment()->getMethodInstance()->setIsMultishipping(true);
21
+ if ($i === 0) {
22
+ $order->getPayment()->getMethodInstance()->setIsFirstMultishipping(true);
23
+ }
24
+ $order->setQuote(Mage::getModel('sales/quote')->load($order->getQuoteId()));
25
+ $order->getPayment()->place();
26
+ $order->save();
27
+ }
28
+ }
29
+ catch (Exception $e) {
30
+ foreach($orders as $order) {
31
+ $order->setState(Mage_Sales_Model_Order::STATE_CANCELED, true)->save();
32
+ }
33
+ throw $e;
34
+ }
35
+ }
36
+
37
+ public function overviewPostAction()
38
+ {
39
+ // start st added
40
+ if (!in_array($this->_getCheckout()->getQuote()->getPayment()->getMethodInstance()->getCode(), array('securetrading_stpp_direct', 'securetrading_stpp_redirect'))) {
41
+ return parent::overviewPostAction();
42
+ }
43
+
44
+ $versionInfo = Mage::getVersionInfo();
45
+ $validateFormKey = false;
46
+
47
+ if ($versionInfo['minor'] == 8 && $versionInfo['revision'] >= 1) {
48
+ $validateFormKey = true;
49
+ }
50
+ elseif($versionInfo['minor'] > 8) {
51
+ $validateFormKey = true;
52
+ }
53
+ // end st added
54
+
55
+ if ($validateFormKey) { // conditional st added
56
+ if (!$this->_validateFormKey()) {
57
+ $this->_forward('backToAddresses');
58
+ return;
59
+ }
60
+ } // conditional st added
61
+
62
+ if (!$this->_validateMinimumAmount()) {
63
+ return;
64
+ }
65
+
66
+ try {
67
+ if ($requiredAgreements = Mage::helper('checkout')->getRequiredAgreementIds()) {
68
+ $postedAgreements = array_keys($this->getRequest()->getPost('agreement', array()));
69
+ if ($diff = array_diff($requiredAgreements, $postedAgreements)) {
70
+ $this->_getCheckoutSession()->addError($this->__('Please agree to all Terms and Conditions before placing the order.'));
71
+ $this->_redirect('*/*/billing');
72
+ return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  }
74
+ }
75
+
76
+ $payment = $this->getRequest()->getPost('payment');
77
+ $paymentInstance = $this->_getCheckout()->getQuote()->getPayment();
78
+ if (isset($payment['cc_number'])) {
79
+ $paymentInstance->setCcNumber($payment['cc_number']);
80
+ }
81
+ if (isset($payment['cc_cid'])) {
82
+ $paymentInstance->setCcCid($payment['cc_cid']);
83
+ }
84
+
85
+ $this->_getCheckout()->createOrders();
86
+
87
+ // start st added
88
+ if ($this->_getCheckout()->getQuote()->getPayment()->getMethodInstance()->getCode() === Mage::getModel('securetrading_stpp/payment_direct')->getCode()) {
89
+ $this->_doApiMultishippingPayment();
90
+
91
+ }
92
+
93
+ $this->_getCheckout()->getQuote()
94
+ ->setIsActive(true)
95
+ ->save();
96
+
97
+ if ($this->_getCheckout()->getQuote()->getPayment()->getMethodInstance()->getCode() === Mage::getModel('securetrading_stpp/payment_redirect')->getCode()) {
98
+ $path = Mage::getModel('securetrading_stpp/payment_redirect')->getMultishippingRedirectPath();
99
+ $this->_redirect($path);
100
+ }
101
+ else { // direct
102
+ $orderPlaceRedirectUrl = $this->_getCheckout()->getQuote()->getPayment()->getMethodInstance()->getOrderPlaceRedirectUrl();
103
+ if ($orderPlaceRedirectUrl) {
104
+ $this->getResponse()->setRedirect($orderPlaceRedirectUrl);
105
+ }
106
+ else {
107
+ $this->_getState()->setActiveStep(Mage_Checkout_Model_Type_Multishipping_State::STEP_SUCCESS);
108
+ $this->_getState()->setCompleteStep(Mage_Checkout_Model_Type_Multishipping_State::STEP_OVERVIEW);
109
+ $this->_getCheckout()->getCheckoutSession()->clear();
110
+ $this->_getCheckout()->getCheckoutSession()->setDisplaySuccess(true);
111
+ $this->_redirect('*/*/success');
112
+ }
113
+ }
114
+ // end st added
115
+ } catch (Mage_Payment_Model_Info_Exception $e) {
116
+ $message = $e->getMessage();
117
+ if ( !empty($message) ) {
118
+ $this->_getCheckoutSession()->addError($message);
119
+ }
120
+ $this->_redirect('*/*/billing');
121
+ } catch (Mage_Checkout_Exception $e) {
122
+ Mage::helper('checkout')
123
+ ->sendPaymentFailedEmail($this->_getCheckout()->getQuote(), $e->getMessage(), 'multi-shipping');
124
+ $this->_getCheckout()->getCheckoutSession()->clear();
125
+ $this->_getCheckoutSession()->addError($e->getMessage());
126
+ $this->_redirect('*/cart');
127
+ }
128
+ catch (Mage_Core_Exception $e) {
129
+ Mage::helper('checkout')
130
+ ->sendPaymentFailedEmail($this->_getCheckout()->getQuote(), $e->getMessage(), 'multi-shipping');
131
+ $this->_getCheckoutSession()->addError($e->getMessage());
132
+ $this->_redirect('*/*/billing');
133
+ } catch (Exception $e) {
134
+ Mage::logException($e);
135
+ Mage::helper('checkout')
136
+ ->sendPaymentFailedEmail($this->_getCheckout()->getQuote(), $e->getMessage(), 'multi-shipping');
137
+ $this->_getCheckoutSession()->addError($this->__('Order place error.'));
138
+ $this->_redirect('*/*/billing');
139
+ }
140
+ }
141
+
142
+ public function successAction() {
143
+ Mage::getSingleton('checkout/session')->getQuote()->setIsActive(false)->save();
144
+ Mage::getSingleton('checkout/session')->clear();
145
+ parent::successAction();
146
+ }
147
  }
app/code/local/Securetrading/Stpp/etc/config.xml CHANGED
@@ -3,7 +3,7 @@
3
  <config>
4
  <modules>
5
  <Securetrading_Stpp>
6
- <version>3.3.0</version>
7
  </Securetrading_Stpp>
8
  </modules>
9
 
3
  <config>
4
  <modules>
5
  <Securetrading_Stpp>
6
+ <version>3.4.0</version>
7
  </Securetrading_Stpp>
8
  </modules>
9
 
app/code/local/Securetrading/Stpp/etc/system.xml CHANGED
@@ -190,11 +190,21 @@
190
  <show_in_website>1</show_in_website>
191
  <show_in_store>1</show_in_store>
192
  </child_js>
 
 
 
 
 
 
 
 
 
 
193
  <use_api>
194
  <config_path>payment/securetrading_stpp_redirect/use_api</config_path>
195
  <frontend_type>select</frontend_type>
196
  <source_model>adminhtml/system_config_source_yesno</source_model>
197
- <sort_order>9</sort_order>
198
  <show_in_default>1</show_in_default>
199
  <show_in_website>1</show_in_website>
200
  <show_in_store>1</show_in_store>
@@ -203,7 +213,7 @@
203
  <config_path>payment/securetrading_stpp_redirect/payment_action</config_path>
204
  <frontend_type>select</frontend_type>
205
  <source_model>securetrading_stpp/source_paymentaction</source_model>
206
- <sort_order>10</sort_order>
207
  <show_in_default>1</show_in_default>
208
  <show_in_website>1</show_in_website>
209
  <show_in_store>1</show_in_store>
@@ -212,7 +222,7 @@
212
  <config_path>payment/securetrading_stpp_redirect/settle_due_date</config_path>
213
  <frontend_type>select</frontend_type>
214
  <source_model>securetrading_stpp/source_settleduedate</source_model>
215
- <sort_order>11</sort_order>
216
  <show_in_default>1</show_in_default>
217
  <show_in_website>1</show_in_website>
218
  <show_in_store>1</show_in_store>
@@ -221,7 +231,7 @@
221
  <config_path>payment/securetrading_stpp_redirect/settle_status</config_path>
222
  <frontend_type>select</frontend_type>
223
  <source_model>securetrading_stpp/source_settlestatus</source_model>
224
- <sort_order>12</sort_order>
225
  <show_in_default>1</show_in_default>
226
  <show_in_website>1</show_in_website>
227
  <show_in_store>1</show_in_store>
190
  <show_in_website>1</show_in_website>
191
  <show_in_store>1</show_in_store>
192
  </child_js>
193
+ <!--
194
+ <sub_site_reference>
195
+ <config_path>payment/securetrading_stpp_redirect/sub_site_reference</config_path>
196
+ <frontend_type>text</frontend_type>
197
+ <sort_order>9</sort_order>
198
+ <show_in_default>1</show_in_default>
199
+ <show_in_website>1</show_in_website>
200
+ <show_in_store>1</show_in_store>
201
+ </sub_site_reference>
202
+ -->
203
  <use_api>
204
  <config_path>payment/securetrading_stpp_redirect/use_api</config_path>
205
  <frontend_type>select</frontend_type>
206
  <source_model>adminhtml/system_config_source_yesno</source_model>
207
+ <sort_order>10</sort_order>
208
  <show_in_default>1</show_in_default>
209
  <show_in_website>1</show_in_website>
210
  <show_in_store>1</show_in_store>
213
  <config_path>payment/securetrading_stpp_redirect/payment_action</config_path>
214
  <frontend_type>select</frontend_type>
215
  <source_model>securetrading_stpp/source_paymentaction</source_model>
216
+ <sort_order>11</sort_order>
217
  <show_in_default>1</show_in_default>
218
  <show_in_website>1</show_in_website>
219
  <show_in_store>1</show_in_store>
222
  <config_path>payment/securetrading_stpp_redirect/settle_due_date</config_path>
223
  <frontend_type>select</frontend_type>
224
  <source_model>securetrading_stpp/source_settleduedate</source_model>
225
+ <sort_order>12</sort_order>
226
  <show_in_default>1</show_in_default>
227
  <show_in_website>1</show_in_website>
228
  <show_in_store>1</show_in_store>
231
  <config_path>payment/securetrading_stpp_redirect/settle_status</config_path>
232
  <frontend_type>select</frontend_type>
233
  <source_model>securetrading_stpp/source_settlestatus</source_model>
234
+ <sort_order>13</sort_order>
235
  <show_in_default>1</show_in_default>
236
  <show_in_website>1</show_in_website>
237
  <show_in_store>1</show_in_store>
app/code/local/Securetrading/Stpp/lib/code/core/Stpp/Api/Helper.php CHANGED
@@ -71,7 +71,12 @@ class Stpp_Api_Helper extends Stpp_Component_Abstract implements Stpp_Api_Helper
71
  $requestTypes[] = Stpp_Types::API_RISKDEC;
72
  }
73
 
74
- return $this->generateRequests($originalRequest, $requestTypes);
 
 
 
 
 
75
  }
76
 
77
  public function prepare3dAuth(Stpp_Data_Request $request) {
71
  $requestTypes[] = Stpp_Types::API_RISKDEC;
72
  }
73
 
74
+ $requests = $this->generateRequests($originalRequest, $requestTypes);
75
+
76
+ if ($requestTypes == array(Stpp_Types::API_RISKDEC, Stpp_Types::API_THREEDQUERY, Stpp_Types::API_AUTH)) { // Fix for STPP gateway bug.
77
+ $requests[2]->uns('settlestatus');
78
+ }
79
+ return $requests;
80
  }
81
 
82
  public function prepare3dAuth(Stpp_Data_Request $request) {
app/code/local/Securetrading/Stpp/lib/code/core/Stpp/Fields/Admin.php CHANGED
@@ -16,6 +16,8 @@ class Stpp_Fields_Admin extends Stpp_Component_Abstract implements Stpp_Fields_A
16
  const FIELD_PPG_CHILD_CSS = 'f_ppg_ccss';
17
  const FIELD_PPG_PARENT_JS = 'f_ppg_pjs';
18
  const FIELD_PPG_CHILD_JS = 'f_ppg_cjs';
 
 
19
  const FIELD_PPG_USE_IFRAME = 'f_ppg_iframe';
20
  const FIELD_PPG_USE_API = 'f_ppg_useapi';
21
 
@@ -107,6 +109,10 @@ class Stpp_Fields_Admin extends Stpp_Component_Abstract implements Stpp_Fields_A
107
  self::FIELD_TYPE_NAME => $this->__('Child JS'),
108
  self::FIELD_TYPE_DESCRIPTION => $this->__('The child JS file is loaded after the default Payment Pages Javascript file has been loaded. You can use a child JS file to make small alterations to the default Payment Pages behaviour. Upload this file to the MyST File Manager and then enter the filename of the file you uploaded to the File Manager here, without the file path or the extension.'),
109
  ),
 
 
 
 
110
  self::FIELD_PPG_USE_IFRAME => array(
111
  self::FIELD_TYPE_NAME => $this->__('Use Iframe'),
112
  self::FIELD_TYPE_DESCRIPTION => $this->__('Enabling this option will make the Payment Pages load in an HTML iframe element. Using an iframe in combination with parent/child CSS allows you to make it appear as if the Payment Pages are part of your own website.'),
16
  const FIELD_PPG_CHILD_CSS = 'f_ppg_ccss';
17
  const FIELD_PPG_PARENT_JS = 'f_ppg_pjs';
18
  const FIELD_PPG_CHILD_JS = 'f_ppg_cjs';
19
+ const FIELD_PPG_SUB_SITE_REFERENCE = 'f_ppg_ssref';
20
+
21
  const FIELD_PPG_USE_IFRAME = 'f_ppg_iframe';
22
  const FIELD_PPG_USE_API = 'f_ppg_useapi';
23
 
109
  self::FIELD_TYPE_NAME => $this->__('Child JS'),
110
  self::FIELD_TYPE_DESCRIPTION => $this->__('The child JS file is loaded after the default Payment Pages Javascript file has been loaded. You can use a child JS file to make small alterations to the default Payment Pages behaviour. Upload this file to the MyST File Manager and then enter the filename of the file you uploaded to the File Manager here, without the file path or the extension.'),
111
  ),
112
+ self::FIELD_PPG_SUB_SITE_REFERENCE => array(
113
+ self::FIELD_TYPE_NAME => $this->__('Sub Site Reference'),
114
+ self::FIELD_TYPE_DESCRIPTION => $this->__('The sub site reference, if specified, refers to a set of custom HTML files that will be loaded by the Payment Pages instead of the default HTML files used by Secure Trading. These HTML file must be uploaded to the MyST File Manager. The naming convention of the HTML files is [subsitereference][page type].html. This field should only contain the sub site reference: the [page type] will be determined by the Payment Pages.'),
115
+ ),
116
  self::FIELD_PPG_USE_IFRAME => array(
117
  self::FIELD_TYPE_NAME => $this->__('Use Iframe'),
118
  self::FIELD_TYPE_DESCRIPTION => $this->__('Enabling this option will make the Payment Pages load in an HTML iframe element. Using an iframe in combination with parent/child CSS allows you to make it appear as if the Payment Pages are part of your own website.'),
app/etc/modules/{SecureTrading_Stpp.xml → Securetrading_Stpp.xml} RENAMED
File without changes
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Securetrading_Stpp</name>
4
- <version>3.3.0</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-07-18</date>
14
- <time>15:59:26</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="a6aa9a1fe720256b57de515eb2fb70f6"/></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="42a106af65c7c18b91abfa609b67f73f"/></dir><file name="Group.php" hash="fb37a1754315559cb708dc03a5b61219"/></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="f2aceb73c95cae73aa21d02de0431b80"/><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="83a78172f8dc75490c820b4d88ff4f49"/></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="43c563ba6a207520f9a4ce3a38ee9138"/></dir><dir name="Model"><dir name="Actions"><file name="Abstract.php" hash="f81b7d408bc5555476a28ccc4f1b31fd"/><file name="Direct.php" hash="9e9eda8f3d445ffc5244bd5f98fc2e35"/><file name="Redirect.php" hash="31aedee830305a443608d3dc0b337eb2"/></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="34f1a9e397aeb1ecfc8cee8a53dde103"/><file name="Integration.php" hash="afed9c50a42394b69066b34805101642"/><file name="Observer.php" hash="e652c01780693ec452f97447a509e61d"/><dir name="Payment"><file name="Abstract.php" hash="0939204996591fe0fbcf79e93b3a987e"/><dir name="Direct"><file name="Session.php" hash="981654031f061f1e04efc80b4a57b428"/></dir><file name="Direct.php" hash="804669d96551f43860c2ef8714d82048"/><dir name="Redirect"><file name="Notification.php" hash="22e2a3366aa294f83aabe94decdbc47f"/><file name="Request.php" hash="cb3b90d9bb7a31bec42ae94ae83770cb"/></dir><file name="Redirect.php" hash="13d1b169ff183b417b9b2d8b082b1a2e"/></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="dc304f8a01d89fa8af5c14c7166d9571"/></dir><dir name="Transaction"><file name="Types.php" hash="1c3712f053e0dadd4edc34ec115effff"/></dir><file name="Transaction.php" hash="543277351dad9217f2bd8284e26531b1"/></dir><dir name="controllers"><dir name="Direct"><file name="PostController.php" hash="8961fb743e3fd0124c0e642ff74a6810"/></dir><file name="DirectController.php" hash="45e17654696f0bff3c7f5992a2297d1c"/><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="7a3929672dd1e4a665f3af544bfd8d49"/><dir name="Sales"><dir name="Order"><dir name="Create"><file name="SecuretradingController.php" hash="e3c89bb8942d8676b0f043adcc226dfe"/></dir><file name="CreateController.php" hash="7964d98f1574c0f93dbb43e87161f1f8"/><file name="EditController.php" hash="a12e458fac106c021367426031356f58"/></dir></dir><dir name="Securetrading"><file name="TransactionsController.php" hash="ca39e6bb66bfd59cf6bf0176144bd256"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="edf6376a0d883ae4fedc024d346364b3"/><file name="config.xml" hash="8c72e5fed3edeb3f20971ebf2aafc1c2"/><file name="system.xml" hash="1e4613ebf143ea2171e412bb3ad0b5fa"/></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="fce4b439f195bb866983180fe57e3bf7"/><file name="BaseInterface.php" hash="cd3004a4734c99499b41f9442d8406f4"/></dir><dir name="Api"><file name="ActionsInterface.php" hash="20feaa9eaefa912efb02d3cd33212fa2"/><file name="Base.php" hash="68a5b1eff62192578a122f327d32f59a"/><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="bb81a31ffc9a8ba20fbe393fdb04cac7"/></dir><file name="Context.php" hash="0ca6f4a61de6113b124795ed8fe83cab"/><file name="ContextInterface.php" hash="b3e9edfa4fe8776140eafce41da98709"/><file name="Facade.php" hash="a1d4eae820c686ab8cfa1ab0ee3b5d1f"/><file name="Helper.php" hash="e0496608a3ff3b7d61e82e06d62e61e8"/><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="fb37ea94d51524af9505667ca33161db"/><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="6c2ffe5d46d5828d695feae5b5c2b969"/><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="d679a67d53fee2ad8a38d8e9175707f6"/><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="9bd92eb9fc82ee7ddd2b42fb43ddb23b"/><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="Http"><file name="Base.php" hash="0af2b3e2ba1be476a8c828b01502d906"/><file name="BaseInterface.php" hash="ec910ae696a968ba91991d4e9593bc5a"/><file name="Helper.php" hash="0854cc287d4fe2e8db833730db86b3b1"/><file name="HelperInterface.php" hash="f70f0aac9734f70f62483362ec111470"/></dir><dir name="PaymentPages"><file name="ActionsInterface.php" hash="477836396b30505fd77e2edab9228eb9"/><file name="Base.php" hash="644dabfcc9439009a093cbae56f5b51c"/><file name="BaseInterface.php" hash="8e88b88ea80bbc678275b545f5a0ca0e"/><file name="Facade.php" hash="0cb8b0a018774a8d00474857ca048286"/><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><dir name="Transactionsearch"><file name="Base.php" hash="76e61d0f724035f816c399e89d6e6884"/><file name="BaseInterface.php" hash="fbd240c914a21eb174bf7c52fff645fe"/></dir><file name="Types.php" hash="116bf208c9d6e76763f9e8a36e68e1e9"/><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="Api"><file name="Facade.php" hash="0cd067db115b4f5ed00abc434db2245f"/></dir><dir name="Log"><file name="Writer.php" hash="b27229288c0eda838b9a2113c788344c"/></dir><dir name="Utility"><file name="Facade.php" hash="9b6c7e6955acce41cad9121c8028ae09"/></dir></dir></dir></dir><dir name="stpp_translations"><file name="core.php" hash="8de46a7cce58eadbff4ae9b294e20aec"/></dir></dir><file name="readme.txt" hash="fb7d4f0b1527e6574cbe96073aac6eda"/><dir name="sql"><dir name="securetrading_stpp"><file name="install-3.0.0.php" hash="923d824b156fb74eeb195ee57723e26b"/><file name="upgrade-3.0.0-3.1.0.php" hash="779de6f21f30913707d67573434c5827"/><file name="upgrade-3.1.0-3.2.0.php" hash="6f9e0b4cb006faede031f5a170af8798"/><file name="upgrade-3.2.0-3.2.1.php" hash="fc652e065a2375fa7a61679a5553c7d6"/><file name="upgrade-3.2.1-3.3.0.php" hash="d3ca3b1936b10f8254c676e1fd7392fe"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="securetrading"><dir name="stpp"><dir><dir name="payment"><dir name="direct"><file name="form.phtml" hash="5b41701f83182d12d530a78fc3c24d77"/><file name="info.phtml" hash="0573ae000e6b1df77c89c71b108cfa10"/></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="0573ae000e6b1df77c89c71b108cfa10"/><file name="post.phtml" hash="8b0b70df44ce27b54c57c7369dd59655"/></dir></dir><dir name="sales"><dir name="transactions"><file name="single.phtml" hash="a3dbbda792cb4d806e6283ed7f964634"/></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 name="stpp"><dir><dir name="payment"><dir name="direct"><file name="form.phtml" hash="3068d1391e1bbe6bb957b6cafc912651"/><file name="info.phtml" hash="a81bbf7d28e9f1c3e9e837f6542c3a58"/><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="eb2a4153d2e9feed7913b46666fb585c"/></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_100_32.png" hash="002186134f7898800305489774711fb7"/><file name="st_logo_strapline_200_63.png" hash="bca24f2696fca0d2bca54681a635e8e3"/><file name="success_16_16.png" hash="5fa7c06b312cbea3675e844686e434af"/></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><package><name>Securetrading_Multishipping</name><channel>community</channel><min/><max/></package></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Securetrading_Stpp</name>
4
+ <version>3.4.0</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-08-26</date>
14
+ <time>08:52:59</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="a6aa9a1fe720256b57de515eb2fb70f6"/></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="f7c19c4ccf6d2182c7afd6060bc23ef9"/></dir><file name="Group.php" hash="fb37a1754315559cb708dc03a5b61219"/></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="f2aceb73c95cae73aa21d02de0431b80"/><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="83a78172f8dc75490c820b4d88ff4f49"/></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="43c563ba6a207520f9a4ce3a38ee9138"/></dir><dir name="Model"><dir name="Actions"><file name="Abstract.php" hash="c4f1bc7dc4c5cda23b15ace3c70691d9"/><file name="Direct.php" hash="61b40b715fab6224a8fff4f37c02bc7b"/><file name="Redirect.php" hash="31aedee830305a443608d3dc0b337eb2"/></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="34f1a9e397aeb1ecfc8cee8a53dde103"/><file name="Integration.php" hash="25c7bb1309fd54f67d8e02011d28ee8f"/><file name="Observer.php" hash="fd8cdcf9d6688c33db8bd5d1813db36b"/><dir name="Payment"><file name="Abstract.php" hash="b8a340a2c4cd0b1f3d84f3043564bb3e"/><dir name="Direct"><file name="Session.php" hash="981654031f061f1e04efc80b4a57b428"/></dir><file name="Direct.php" hash="a7b2087c6c42996bf53403a8051a4961"/><dir name="Redirect"><file name="Notification.php" hash="22e2a3366aa294f83aabe94decdbc47f"/><file name="Request.php" hash="cb3b90d9bb7a31bec42ae94ae83770cb"/></dir><file name="Redirect.php" hash="afcfdb9e7e66dc4ec4fe3105bb0318a1"/></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="dc304f8a01d89fa8af5c14c7166d9571"/></dir><dir name="Transaction"><file name="Types.php" hash="1c3712f053e0dadd4edc34ec115effff"/></dir><file name="Transaction.php" hash="543277351dad9217f2bd8284e26531b1"/></dir><dir name="controllers"><dir name="Direct"><file name="PostController.php" hash="785f79108093ba54af1029eb667a9015"/></dir><file name="DirectController.php" hash="c9d24ad2bc1f30faba8c33377e2bb27c"/><file name="MultishippingController.php" hash="13baa2b4936070577228b2bbbd14a46c"/><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="7a3929672dd1e4a665f3af544bfd8d49"/><dir name="Sales"><dir name="Order"><dir name="Create"><file name="SecuretradingController.php" hash="e3c89bb8942d8676b0f043adcc226dfe"/></dir><file name="CreateController.php" hash="7964d98f1574c0f93dbb43e87161f1f8"/><file name="EditController.php" hash="a12e458fac106c021367426031356f58"/></dir></dir><dir name="Securetrading"><file name="TransactionsController.php" hash="ca39e6bb66bfd59cf6bf0176144bd256"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="edf6376a0d883ae4fedc024d346364b3"/><file name="config.xml" hash="80c3769bea8aa84164896119de5166b4"/><file name="system.xml" hash="30fd19155bc95a3505d5dce4874d2098"/></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="fce4b439f195bb866983180fe57e3bf7"/><file name="BaseInterface.php" hash="cd3004a4734c99499b41f9442d8406f4"/></dir><dir name="Api"><file name="ActionsInterface.php" hash="20feaa9eaefa912efb02d3cd33212fa2"/><file name="Base.php" hash="68a5b1eff62192578a122f327d32f59a"/><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="bb81a31ffc9a8ba20fbe393fdb04cac7"/></dir><file name="Context.php" hash="0ca6f4a61de6113b124795ed8fe83cab"/><file name="ContextInterface.php" hash="b3e9edfa4fe8776140eafce41da98709"/><file name="Facade.php" hash="a1d4eae820c686ab8cfa1ab0ee3b5d1f"/><file name="Helper.php" hash="1dea4cafc21348fb814b62f45172d598"/><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="fb37ea94d51524af9505667ca33161db"/><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="6c2ffe5d46d5828d695feae5b5c2b969"/><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="d679a67d53fee2ad8a38d8e9175707f6"/><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="5a58bb5684eafc588b3769cca73ea980"/><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="Http"><file name="Base.php" hash="0af2b3e2ba1be476a8c828b01502d906"/><file name="BaseInterface.php" hash="ec910ae696a968ba91991d4e9593bc5a"/><file name="Helper.php" hash="0854cc287d4fe2e8db833730db86b3b1"/><file name="HelperInterface.php" hash="f70f0aac9734f70f62483362ec111470"/></dir><dir name="PaymentPages"><file name="ActionsInterface.php" hash="477836396b30505fd77e2edab9228eb9"/><file name="Base.php" hash="644dabfcc9439009a093cbae56f5b51c"/><file name="BaseInterface.php" hash="8e88b88ea80bbc678275b545f5a0ca0e"/><file name="Facade.php" hash="0cb8b0a018774a8d00474857ca048286"/><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><dir name="Transactionsearch"><file name="Base.php" hash="76e61d0f724035f816c399e89d6e6884"/><file name="BaseInterface.php" hash="fbd240c914a21eb174bf7c52fff645fe"/></dir><file name="Types.php" hash="116bf208c9d6e76763f9e8a36e68e1e9"/><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="Api"><file name="Facade.php" hash="0cd067db115b4f5ed00abc434db2245f"/></dir><dir name="Log"><file name="Writer.php" hash="b27229288c0eda838b9a2113c788344c"/></dir><dir name="Utility"><file name="Facade.php" hash="9b6c7e6955acce41cad9121c8028ae09"/></dir></dir></dir></dir><dir name="stpp_translations"><file name="core.php" hash="8de46a7cce58eadbff4ae9b294e20aec"/></dir></dir><file name="readme.txt" hash="fb7d4f0b1527e6574cbe96073aac6eda"/><dir name="sql"><dir name="securetrading_stpp"><file name="install-3.0.0.php" hash="923d824b156fb74eeb195ee57723e26b"/><file name="upgrade-3.0.0-3.1.0.php" hash="779de6f21f30913707d67573434c5827"/><file name="upgrade-3.1.0-3.2.0.php" hash="6f9e0b4cb006faede031f5a170af8798"/><file name="upgrade-3.2.0-3.2.1.php" hash="fc652e065a2375fa7a61679a5553c7d6"/><file name="upgrade-3.2.1-3.3.0.php" hash="d3ca3b1936b10f8254c676e1fd7392fe"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="securetrading"><dir name="stpp"><dir><dir name="payment"><dir name="direct"><file name="form.phtml" hash="5b41701f83182d12d530a78fc3c24d77"/><file name="info.phtml" hash="0573ae000e6b1df77c89c71b108cfa10"/></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="0573ae000e6b1df77c89c71b108cfa10"/><file name="post.phtml" hash="8b0b70df44ce27b54c57c7369dd59655"/></dir></dir><dir name="sales"><dir name="transactions"><file name="single.phtml" hash="a3dbbda792cb4d806e6283ed7f964634"/></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 name="stpp"><dir><dir name="payment"><dir name="direct"><file name="form.phtml" hash="3068d1391e1bbe6bb957b6cafc912651"/><file name="info.phtml" hash="a81bbf7d28e9f1c3e9e837f6542c3a58"/><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="eb2a4153d2e9feed7913b46666fb585c"/></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_100_32.png" hash="002186134f7898800305489774711fb7"/><file name="st_logo_strapline_200_63.png" hash="bca24f2696fca0d2bca54681a635e8e3"/><file name="success_16_16.png" hash="5fa7c06b312cbea3675e844686e434af"/></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><package><name>Securetrading_Multishipping</name><channel>community</channel><min></min><max></max></package></required></dependencies>
18
  </package>