Ampersand_PaymentGateway - Version 0.1.11

Version Notes

Ampersand_PaymentGateway v0.1.11

Download this release

Release Info

Developer Magento Core Team
Extension Ampersand_PaymentGateway
Version 0.1.11
Comparing to
See all releases


Code changes from version 0.1.5 to 0.1.11

Files changed (40) hide show
  1. app/code/core/Ampersand/PaymentGateway/Block/Redirect/Form.php +77 -4
  2. app/code/core/Ampersand/PaymentGateway/Helper/Data.php +30 -4
  3. app/code/core/Ampersand/PaymentGateway/Model/Adapter/Abstract.php +43 -22
  4. app/code/core/Ampersand/PaymentGateway/Model/Adapter/{Redirect/Agreement/ManageInterface.php → Agreement/CreateInterface.php} +1 -1
  5. app/code/core/Ampersand/PaymentGateway/Model/Adapter/Agreement/ManageInterface.php +6 -0
  6. app/code/core/Ampersand/PaymentGateway/Model/Adapter/Direct/Agreement/ManageInterface.php +0 -13
  7. app/code/core/Ampersand/PaymentGateway/Model/Adapter/Direct/AuthCaptureInterface.php +27 -0
  8. app/code/core/Ampersand/PaymentGateway/Model/Adapter/Direct/PartialInterface.php +9 -0
  9. app/code/core/Ampersand/PaymentGateway/Model/Adapter/Direct/RefundInterface.php +9 -0
  10. app/code/core/Ampersand/PaymentGateway/Model/Adapter/Redirect/AuthCaptureInterface.php +27 -0
  11. app/code/core/Ampersand/PaymentGateway/Model/Adapter/Redirect/PartialInterface.php +9 -0
  12. app/code/core/Ampersand/PaymentGateway/Model/Adapter/Redirect/RefundInterface.php +9 -0
  13. app/code/core/Ampersand/PaymentGateway/Model/Config/Abstract.php +1 -4
  14. app/code/core/Ampersand/PaymentGateway/Model/Cron.php +12 -1
  15. app/code/core/Ampersand/PaymentGateway/Model/Encryptor.php +177 -0
  16. app/code/core/Ampersand/PaymentGateway/Model/Observer.php +32 -0
  17. app/code/core/Ampersand/PaymentGateway/Model/PaymentInfo.php +103 -0
  18. app/code/core/Ampersand/PaymentGateway/Model/Resource/Agreement/Collection.php +6 -4
  19. app/code/core/Ampersand/PaymentGateway/Model/Resource/Encryptor.php +28 -0
  20. app/code/core/Ampersand/PaymentGateway/Model/Resource/Encryptor/Collection.php +14 -0
  21. app/code/core/Ampersand/PaymentGateway/Model/Resource/PaymentInfo.php +29 -0
  22. app/code/core/Ampersand/PaymentGateway/Model/Resource/PaymentInfo/Collection.php +14 -0
  23. app/code/core/Ampersand/PaymentGateway/Model/Service/Abstract.php +139 -18
  24. app/code/core/Ampersand/PaymentGateway/Model/Service/{Direct/AgreementAbstract.php → AgreementAbstract.php} +52 -43
  25. app/code/core/Ampersand/PaymentGateway/Model/Service/DirectAbstract.php +11 -0
  26. app/code/core/Ampersand/PaymentGateway/Model/Service/Redirect/AgreementAbstract.php +0 -174
  27. app/code/core/Ampersand/PaymentGateway/Model/Service/RedirectAbstract.php +11 -0
  28. app/code/core/Ampersand/PaymentGateway/Model/Source/CardType.php +37 -2
  29. app/code/core/Ampersand/PaymentGateway/Model/Source/EncryptorStorageType.php +44 -0
  30. app/code/core/Ampersand/PaymentGateway/Model/Utility/Encryptor.php +38 -0
  31. app/code/core/Ampersand/PaymentGateway/Model/Utility/{Cleanup.php → Order.php} +2 -2
  32. app/code/core/Ampersand/PaymentGateway/changelog.txt +25 -9
  33. app/code/core/Ampersand/PaymentGateway/etc/config.xml +27 -1
  34. app/code/core/Ampersand/PaymentGateway/etc/system.xml +42 -7
  35. app/code/core/Ampersand/PaymentGateway/sql/ampersand_paymentgateway_setup/mysql4-upgrade-0.1.5-0.1.6.php +17 -0
  36. app/code/core/Ampersand/PaymentGateway/sql/ampersand_paymentgateway_setup/mysql4-upgrade-0.1.9-0.1.10.php +13 -0
  37. app/design/adminhtml/base/default/template/ampersand_paymentgateway/payment/info/payment-info.phtml +34 -0
  38. app/design/frontend/base/default/template/ampersand_paymentgateway/redirect/form.phtml +4 -2
  39. package.xml +5 -5
  40. skin/adminhtml/base/default/ampersand_paymentgateway/css/styles.css +14 -0
app/code/core/Ampersand/PaymentGateway/Block/Redirect/Form.php CHANGED
@@ -5,7 +5,23 @@ class Ampersand_PaymentGateway_Block_Redirect_Form extends Mage_Core_Block_Templ
5
  * Session keys for redirect information.
6
  */
7
  const SESSION_KEY_REDIRECT_URL = 'ampersand_paymentgateway_redirect_form_url';
8
- const SESSION_KEY_REDIRECT_DATA = 'ampersand_paymentgateway_redirect_form_data';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
 
10
  /**
11
  * Set the default template for the redirect form.
@@ -45,15 +61,72 @@ class Ampersand_PaymentGateway_Block_Redirect_Form extends Mage_Core_Block_Templ
45
  return $this->_getHelper()->getAndClearSessionKey(self::SESSION_KEY_REDIRECT_URL);
46
  }
47
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  /**
49
  * Set any hidden fields to be posted in the redirect POST.
50
- *
51
- * @return array
 
 
 
 
52
  * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
 
53
  */
54
  public function getHiddenFields()
55
  {
56
- return $this->_getHelper()->getAndClearSessionKey(self::SESSION_KEY_REDIRECT_DATA);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  }
58
 
59
  /**
5
  * Session keys for redirect information.
6
  */
7
  const SESSION_KEY_REDIRECT_URL = 'ampersand_paymentgateway_redirect_form_url';
8
+ const SESSION_KEY_REDIRECT_DATA_STORAGE_TYPE = 'ampersand_paymentgateway_redirect_form_data_storage_type';
9
+ const SESSION_KEY_REDIRECT_DATA_REFERENCE_ID = 'ampersand_paymentgateway_redirect_form_data_reference_id';
10
+
11
+ /**
12
+ * Field name for the key used to encrypt sensitive data.
13
+ * The field name is purposely vague. It stands for Ampersand Magento Transaction Payment.
14
+ * Note: This could be stored in various places depending on configuration, eg. cookie, session.
15
+ */
16
+ const ENCRYPTION_KEY_FIELD_NAME = 'amtp_information';
17
+
18
+ /**
19
+ * Flag to determine whether all of the form data has been succesfully processed.
20
+ * Note: Suggest using exceptions during processing to change this to false on error.
21
+ *
22
+ * @var bool $_isHiddenDataProcessed
23
+ */
24
+ protected $_formDataProcessed = true;
25
 
26
  /**
27
  * Set the default template for the redirect form.
61
  return $this->_getHelper()->getAndClearSessionKey(self::SESSION_KEY_REDIRECT_URL);
62
  }
63
 
64
+ /**
65
+ * Determine whether all form data has been correctly processed.
66
+ *
67
+ * @return bool
68
+ * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
69
+ * Josh Di Fabio <josh.difabio@ampersandcommerce.com>
70
+ */
71
+ public function isFormDataProcessed()
72
+ {
73
+ return $this->_formDataProcessed;
74
+ }
75
+
76
  /**
77
  * Set any hidden fields to be posted in the redirect POST.
78
+ *
79
+ * In 3D Secure cases, the hidden fields can contain sensitive information,
80
+ * so additional steps are required to restrict the access to this data.
81
+ * Note: The exception messages relating to this functionality are intentionally vague.
82
+ *
83
+ * @return Ampersand_PaymentGateway_Model_Service_Abstract
84
  * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
85
+ * Josh Di Fabio <josh.difabio@ampersandcommerce.com>
86
  */
87
  public function getHiddenFields()
88
  {
89
+ $data = array();
90
+
91
+ $encryptor = Mage::getModel('ampersand_paymentgateway/encryptor');
92
+
93
+ // retrieve the encrypted data item by reference id
94
+ $item = $encryptor->load(
95
+ $this->_getHelper()->getAndClearSessionKey(self::SESSION_KEY_REDIRECT_DATA_REFERENCE_ID)
96
+ );
97
+ if ($item->getId() < 1) {
98
+ $this->_formDataProcessed = false;
99
+ return $data;
100
+ }
101
+
102
+ try {
103
+ // determine the storage type used in the encryption
104
+ $storageType = $this->_getHelper()
105
+ ->getAndClearSessionKey(self::SESSION_KEY_REDIRECT_DATA_STORAGE_TYPE);
106
+
107
+ // retrieve the key depending on the storage type used
108
+ if ($storageType == Ampersand_PaymentGateway_Model_Source_EncryptorStorageType::TYPE_COOKIE) {
109
+ $cookie = Mage::getModel('core/cookie');
110
+ $encodedKey = $cookie->get(self::ENCRYPTION_KEY_FIELD_NAME);
111
+ } else {
112
+ $encodedKey = $this->_getHelper()
113
+ ->getAndClearSessionKey(self::ENCRYPTION_KEY_FIELD_NAME);
114
+ }
115
+
116
+ // decrypt the information using the single-use key
117
+ $key = base64_decode($encodedKey);
118
+ $data = $item->getInformation($key);
119
+
120
+ // if we had no exceptions up to this point, we can clear the saved data
121
+ $item->delete();
122
+ if ($storageType == Ampersand_PaymentGateway_Model_Source_EncryptorStorageType::TYPE_COOKIE) {
123
+ $cookie->delete(self::ENCRYPTION_KEY_FIELD_NAME);
124
+ }
125
+ } catch (Exception $e) {
126
+ $this->_formDataProcessed = false;
127
+ }
128
+
129
+ return $data;
130
  }
131
 
132
  /**
app/code/core/Ampersand/PaymentGateway/Helper/Data.php CHANGED
@@ -113,7 +113,7 @@ class Ampersand_PaymentGateway_Helper_Data extends Mage_Core_Helper_Abstract
113
  */
114
  public function getDecimalPlaces()
115
  {
116
- $localeCode = Mage::app()->getLocale()->getLocaleCode();
117
  $currencyCode = Mage::app()->getStore()->getCurrentCurrencyCode();
118
 
119
  // we need access to external entities to get this locale data
@@ -134,6 +134,17 @@ class Ampersand_PaymentGateway_Helper_Data extends Mage_Core_Helper_Abstract
134
  return $decimalPlaces;
135
  }
136
 
 
 
 
 
 
 
 
 
 
 
 
137
  /**
138
  * Retrieve the region code if available for the provided address country.
139
  *
@@ -160,10 +171,14 @@ class Ampersand_PaymentGateway_Helper_Data extends Mage_Core_Helper_Abstract
160
  */
161
  public function getRegionName(Varien_Object $address = null)
162
  {
163
- if (!is_object($address) || !$address->getCountryId() || !$address->getRegionCode()) {
164
  return null;
165
  }
166
 
 
 
 
 
167
  $region = $this->_getRegion($address->getCountryId(), $address->getRegionCode());
168
  return ($region instanceof Mage_Directory_Model_Region) ? $region->getName() : null;
169
  }
@@ -259,7 +274,7 @@ class Ampersand_PaymentGateway_Helper_Data extends Mage_Core_Helper_Abstract
259
  */
260
  public function setBillingAgreementSelection($selection)
261
  {
262
- $selection = $selection == '1' ? true : false;
263
  $this->addSessionData(self::SESSION_KEY_BILLING_AGREEMENT_SELECTION, $selection);
264
 
265
  return $this;
@@ -474,7 +489,18 @@ class Ampersand_PaymentGateway_Helper_Data extends Mage_Core_Helper_Abstract
474
  */
475
  public function resetPaymentGateway()
476
  {
477
- Mage::unregister(self::REGISTRY_KEY_UNIQUE_TRANSACTION_REFERENCE);
 
 
 
 
 
 
 
 
 
 
 
478
 
479
  return $this;
480
  }
113
  */
114
  public function getDecimalPlaces()
115
  {
116
+ $localeCode = $this->getLocaleCode();
117
  $currencyCode = Mage::app()->getStore()->getCurrentCurrencyCode();
118
 
119
  // we need access to external entities to get this locale data
134
  return $decimalPlaces;
135
  }
136
 
137
+ /**
138
+ * Retrieve the current locale code.
139
+ *
140
+ * @return string
141
+ * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
142
+ */
143
+ public function getLocaleCode()
144
+ {
145
+ return Mage::app()->getLocale()->getLocaleCode();
146
+ }
147
+
148
  /**
149
  * Retrieve the region code if available for the provided address country.
150
  *
171
  */
172
  public function getRegionName(Varien_Object $address = null)
173
  {
174
+ if (!is_object($address)) {
175
  return null;
176
  }
177
 
178
+ if (!$address->getCountryId() || !$address->getRegionCode()) {
179
+ return $address->getRegion();
180
+ }
181
+
182
  $region = $this->_getRegion($address->getCountryId(), $address->getRegionCode());
183
  return ($region instanceof Mage_Directory_Model_Region) ? $region->getName() : null;
184
  }
274
  */
275
  public function setBillingAgreementSelection($selection)
276
  {
277
+ $selection = ($selection == '1') ? true : false;
278
  $this->addSessionData(self::SESSION_KEY_BILLING_AGREEMENT_SELECTION, $selection);
279
 
280
  return $this;
489
  */
490
  public function resetPaymentGateway()
491
  {
492
+ $keys = array(
493
+ self::REGISTRY_KEY_UNIQUE_TRANSACTION_REFERENCE,
494
+ self::REGISTRY_KEY_BILLING_AGREEMENT_CV2,
495
+ self::REGISTRY_KEY_REDIRECT_URL,
496
+ Ampersand_PaymentGateway_Block_Redirect_Location::REGISTRY_KEY_REDIRECT_URL,
497
+ );
498
+ foreach ($keys as $_key) {
499
+ Mage::unregister($_key);
500
+ }
501
+
502
+ // provide opportunity for third party applications to reset
503
+ Mage::dispatchEvent('ampersand_paymentgateway_reset');
504
 
505
  return $this;
506
  }
app/code/core/Ampersand/PaymentGateway/Model/Adapter/Abstract.php CHANGED
@@ -38,6 +38,13 @@ abstract class Ampersand_PaymentGateway_Model_Adapter_Abstract
38
  */
39
  protected $_debug;
40
 
 
 
 
 
 
 
 
41
  /**
42
  * Queue of service messages defined by the Payment Gateway adapter.
43
  *
@@ -199,6 +206,42 @@ abstract class Ampersand_PaymentGateway_Model_Adapter_Abstract
199
  return $this->_debug;
200
  }
201
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
202
  /**
203
  * Add a new service message to be called, including the name, the adapter method to retrieve
204
  * the data from and the adapter method to callback to with the message response.
@@ -239,26 +282,4 @@ abstract class Ampersand_PaymentGateway_Model_Adapter_Abstract
239
  $message = array_shift($this->_serviceMessages);
240
  return !empty($message) ? $message : false;
241
  }
242
-
243
- /**
244
- * Retrieve the method code for the associated billing agreement payment method.
245
- *
246
- * @return string
247
- * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
248
- */
249
- public function getBillingAgreementMethodCode()
250
- {
251
- return false;
252
- }
253
-
254
- /**
255
- * Retrieve whether any redirects should use an iframe.
256
- *
257
- * @return bool
258
- * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
259
- */
260
- public function getIsUseIframe()
261
- {
262
- return true;
263
- }
264
  }
38
  */
39
  protected $_debug;
40
 
41
+ /**
42
+ * Payment information for display in the Magento admin panel order view.
43
+ *
44
+ * @var array $_paymentInfo
45
+ */
46
+ protected $_paymentInfo = array();
47
+
48
  /**
49
  * Queue of service messages defined by the Payment Gateway adapter.
50
  *
206
  return $this->_debug;
207
  }
208
 
209
+ /**
210
+ * Add payment information for display in the Magento admin panel order view.
211
+ *
212
+ * @param string|array $key
213
+ * @param string $value
214
+ * @return Ampersand_PaymentGateway_Model_Adapter_Abstract
215
+ */
216
+ public function addPaymentInfo($key, $value = '')
217
+ {
218
+ if (is_array($key)) {
219
+ $this->_paymentInfo = array_merge($this->_paymentInfo, $key);
220
+ } else {
221
+ $this->_paymentInfo[$key] = $value;
222
+ }
223
+
224
+ return $this;
225
+ }
226
+
227
+ /**
228
+ * Retrieve the payment info for display in the Magento admin panel order view.
229
+ *
230
+ * @param bool $clear
231
+ * @return array
232
+ * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
233
+ */
234
+ public function getPaymentInfo($clear = true)
235
+ {
236
+ $paymentInfo = $this->_paymentInfo;
237
+
238
+ if ($clear == true) {
239
+ $this->_paymentInfo = array();
240
+ }
241
+
242
+ return $paymentInfo;
243
+ }
244
+
245
  /**
246
  * Add a new service message to be called, including the name, the adapter method to retrieve
247
  * the data from and the adapter method to callback to with the message response.
282
  $message = array_shift($this->_serviceMessages);
283
  return !empty($message) ? $message : false;
284
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
285
  }
app/code/core/Ampersand/PaymentGateway/Model/Adapter/{Redirect/Agreement/ManageInterface.php → Agreement/CreateInterface.php} RENAMED
@@ -1,5 +1,5 @@
1
  <?php
2
- interface Ampersand_PaymentGateway_Model_Adapter_Redirect_Agreement_ManageInterface
3
  extends Ampersand_PaymentGateway_Model_Adapter_Interface
4
  {
5
  public function prepareBillingAgreementRequest();
1
  <?php
2
+ interface Ampersand_PaymentGateway_Model_Adapter_Agreement_CreateInterface
3
  extends Ampersand_PaymentGateway_Model_Adapter_Interface
4
  {
5
  public function prepareBillingAgreementRequest();
app/code/core/Ampersand/PaymentGateway/Model/Adapter/Agreement/ManageInterface.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+ interface Ampersand_PaymentGateway_Model_Adapter_Agreement_ManageInterface
3
+ extends Ampersand_PaymentGateway_Model_Adapter_Interface
4
+ {
5
+ public function prepareBillingAgreementCancel();
6
+ }
app/code/core/Ampersand/PaymentGateway/Model/Adapter/Direct/Agreement/ManageInterface.php DELETED
@@ -1,13 +0,0 @@
1
- <?php
2
- interface Ampersand_PaymentGateway_Model_Adapter_Direct_Agreement_ManageInterface
3
- extends Ampersand_PaymentGateway_Model_Adapter_Interface
4
- {
5
- public function prepareBillingAgreementRequest();
6
-
7
- public function getBillingAgreementCredentials();
8
-
9
- /**
10
- * @todo this should really be here, but is an optional feature...
11
- */
12
- // public function prepareBillingAgreementCancel();
13
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/core/Ampersand/PaymentGateway/Model/Adapter/Direct/AuthCaptureInterface.php CHANGED
@@ -31,6 +31,15 @@ interface Ampersand_PaymentGateway_Model_Adapter_Direct_AuthCaptureInterface
31
  */
32
  public function getTransactionDataFromRegister();
33
 
 
 
 
 
 
 
 
 
 
34
  /**
35
  * Based on the register response from the Payment Gateway,
36
  * determine whether 3D Secure authentication is required for this transaction.
@@ -105,4 +114,22 @@ interface Ampersand_PaymentGateway_Model_Adapter_Direct_AuthCaptureInterface
105
  * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
106
  */
107
  public function getTransactionDataFromCallback();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
108
  }
31
  */
32
  public function getTransactionDataFromRegister();
33
 
34
+ /**
35
+ * Retrieve whether the information required to create a billing agreement
36
+ * has been returned by the register response from the payment gateway.
37
+ *
38
+ * @return bool
39
+ * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
40
+ */
41
+ public function getIsAgreementDataInRegister();
42
+
43
  /**
44
  * Based on the register response from the Payment Gateway,
45
  * determine whether 3D Secure authentication is required for this transaction.
114
  * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
115
  */
116
  public function getTransactionDataFromCallback();
117
+
118
+ /**
119
+ * Retrieve whether the information required to create a billing agreement
120
+ * has been returned by the callback response from the payment gateway.
121
+ *
122
+ * @return bool
123
+ * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
124
+ */
125
+ public function getIsAgreementDataInCallback();
126
+
127
+ /**
128
+ * Retrieve any additional information contained in the Payment Gateway response that
129
+ * you would like to be displayed when viewing an order in the Magento admin panel.
130
+ *
131
+ * @return array
132
+ * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
133
+ */
134
+ public function getPaymentInfo();
135
  }
app/code/core/Ampersand/PaymentGateway/Model/Adapter/Direct/PartialInterface.php CHANGED
@@ -30,4 +30,13 @@ interface Ampersand_PaymentGateway_Model_Adapter_Direct_PartialInterface
30
  * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
31
  */
32
  public function getTransactionDataFromRegister();
 
 
 
 
 
 
 
 
 
33
  }
30
  * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
31
  */
32
  public function getTransactionDataFromRegister();
33
+
34
+ /**
35
+ * Retrieve any additional information contained in the Payment Gateway response that
36
+ * you would like to be displayed when viewing an order in the Magento admin panel.
37
+ *
38
+ * @return array
39
+ * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
40
+ */
41
+ public function getPaymentInfo();
42
  }
app/code/core/Ampersand/PaymentGateway/Model/Adapter/Direct/RefundInterface.php CHANGED
@@ -30,4 +30,13 @@ interface Ampersand_PaymentGateway_Model_Adapter_Direct_RefundInterface
30
  * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
31
  */
32
  public function getTransactionDataFromRegister();
 
 
 
 
 
 
 
 
 
33
  }
30
  * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
31
  */
32
  public function getTransactionDataFromRegister();
33
+
34
+ /**
35
+ * Retrieve any additional information contained in the Payment Gateway response that
36
+ * you would like to be displayed when viewing an order in the Magento admin panel.
37
+ *
38
+ * @return array
39
+ * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
40
+ */
41
+ public function getPaymentInfo();
42
  }
app/code/core/Ampersand/PaymentGateway/Model/Adapter/Redirect/AuthCaptureInterface.php CHANGED
@@ -31,6 +31,15 @@ interface Ampersand_PaymentGateway_Model_Adapter_Redirect_AuthCaptureInterface
31
  */
32
  public function getTransactionDataFromRegister();
33
 
 
 
 
 
 
 
 
 
 
34
  /**
35
  * Retrieve the method code for the associated billing agreement payment method.
36
  *
@@ -65,4 +74,22 @@ interface Ampersand_PaymentGateway_Model_Adapter_Redirect_AuthCaptureInterface
65
  * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
66
  */
67
  public function getTransactionDataFromCallback();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  }
31
  */
32
  public function getTransactionDataFromRegister();
33
 
34
+ /**
35
+ * Retrieve whether the information required to create a billing agreement
36
+ * has been returned by the register response from the payment gateway.
37
+ *
38
+ * @return bool
39
+ * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
40
+ */
41
+ public function getIsAgreementDataInRegister();
42
+
43
  /**
44
  * Retrieve the method code for the associated billing agreement payment method.
45
  *
74
  * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
75
  */
76
  public function getTransactionDataFromCallback();
77
+
78
+ /**
79
+ * Retrieve whether the information required to create a billing agreement
80
+ * has been returned by the callback response from the payment gateway.
81
+ *
82
+ * @return bool
83
+ * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
84
+ */
85
+ public function getIsAgreementDataInCallback();
86
+
87
+ /**
88
+ * Retrieve any additional information contained in the Payment Gateway response that
89
+ * you would like to be displayed when viewing an order in the Magento admin panel.
90
+ *
91
+ * @return array
92
+ * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
93
+ */
94
+ public function getPaymentInfo();
95
  }
app/code/core/Ampersand/PaymentGateway/Model/Adapter/Redirect/PartialInterface.php CHANGED
@@ -30,4 +30,13 @@ interface Ampersand_PaymentGateway_Model_Adapter_Redirect_PartialInterface
30
  * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
31
  */
32
  public function getTransactionDataFromRegister();
 
 
 
 
 
 
 
 
 
33
  }
30
  * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
31
  */
32
  public function getTransactionDataFromRegister();
33
+
34
+ /**
35
+ * Retrieve any additional information contained in the Payment Gateway response that
36
+ * you would like to be displayed when viewing an order in the Magento admin panel.
37
+ *
38
+ * @return array
39
+ * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
40
+ */
41
+ public function getPaymentInfo();
42
  }
app/code/core/Ampersand/PaymentGateway/Model/Adapter/Redirect/RefundInterface.php CHANGED
@@ -30,4 +30,13 @@ interface Ampersand_PaymentGateway_Model_Adapter_Redirect_RefundInterface
30
  * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
31
  */
32
  public function getTransactionDataFromRegister();
 
 
 
 
 
 
 
 
 
33
  }
30
  * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
31
  */
32
  public function getTransactionDataFromRegister();
33
+
34
+ /**
35
+ * Retrieve any additional information contained in the Payment Gateway response that
36
+ * you would like to be displayed when viewing an order in the Magento admin panel.
37
+ *
38
+ * @return array
39
+ * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
40
+ */
41
+ public function getPaymentInfo();
42
  }
app/code/core/Ampersand/PaymentGateway/Model/Config/Abstract.php CHANGED
@@ -41,10 +41,7 @@ abstract class Ampersand_PaymentGateway_Model_Config_Abstract
41
  * @return string
42
  * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
43
  */
44
- public function getMode()
45
- {
46
- return $this->_getStoreConfig('mode');
47
- }
48
 
49
  /**
50
  * Set the appropriate config against the service object for easy access in message XML files.
41
  * @return string
42
  * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
43
  */
44
+ abstract public function getMode();
 
 
 
45
 
46
  /**
47
  * Set the appropriate config against the service object for easy access in message XML files.
app/code/core/Ampersand/PaymentGateway/Model/Cron.php CHANGED
@@ -13,7 +13,7 @@ class Ampersand_PaymentGateway_Model_Cron
13
  }
14
 
15
  $hours = Mage::getStoreConfig('ampersand_paymentgateway/cleanup/order_timeframe');
16
- Mage::getModel('ampersand_paymentgateway/utility_cleanup')->cancelPaymentReviewOrders($hours);
17
  }
18
 
19
  /**
@@ -43,4 +43,15 @@ class Ampersand_PaymentGateway_Model_Cron
43
 
44
  Mage::getModel('ampersand_paymentgateway/utility_subscription')->process();
45
  }
 
 
 
 
 
 
 
 
 
 
 
46
  }
13
  }
14
 
15
  $hours = Mage::getStoreConfig('ampersand_paymentgateway/cleanup/order_timeframe');
16
+ Mage::getModel('ampersand_paymentgateway/utility_order')->cancelPaymentReviewOrders($hours);
17
  }
18
 
19
  /**
43
 
44
  Mage::getModel('ampersand_paymentgateway/utility_subscription')->process();
45
  }
46
+
47
+ /**
48
+ * Delete any items that remain in the DB for longer than a defined period of time.
49
+ *
50
+ * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
51
+ */
52
+ public function encryptorCleanup()
53
+ {
54
+ $seconds = Mage::getModel('ampersand_paymentgateway/encryptor')->getLifetime();
55
+ Mage::getModel('ampersand_paymentgateway/utility_encryptor')->deleteExpiredItems($seconds);
56
+ }
57
  }
app/code/core/Ampersand/PaymentGateway/Model/Encryptor.php ADDED
@@ -0,0 +1,177 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Ampersand_PaymentGateway_Model_Encryptor extends Mage_Core_Model_Abstract
3
+ {
4
+ /**
5
+ * Data lifetime restrictions.
6
+ */
7
+ const LIFETIME_MIN = 60;
8
+ const LIFETIME_MAX = 600;
9
+
10
+ /**
11
+ * Crypt configuration.
12
+ */
13
+ const CRYPT_CIPHER = MCRYPT_RIJNDAEL_256;
14
+ const CRYPT_MODE = MCRYPT_MODE_ECB;
15
+
16
+ /**
17
+ * Initialise model.
18
+ *
19
+ * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
20
+ */
21
+ protected function _construct()
22
+ {
23
+ $this->_init('ampersand_paymentgateway/encryptor');
24
+ }
25
+
26
+ /**
27
+ * Retrieve the lifetime of cookies and sensitive data in the database.
28
+ *
29
+ * @return int
30
+ * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
31
+ */
32
+ public function getLifetime()
33
+ {
34
+ $lifetime = Mage::getStoreConfig('ampersand_paymentgateway/encryptor/lifetime');
35
+
36
+ if (!Mage::helper('ampersand_core/validate')->isInt($lifetime)) {
37
+ $lifetime = self::LIFETIME_MIN;
38
+ }
39
+
40
+ if ($lifetime < self::LIFETIME_MIN) {
41
+ $lifetime = self::LIFETIME_MIN;
42
+ }
43
+
44
+ if ($lifetime > self::LIFETIME_MAX) {
45
+ $lifetime = self::LIFETIME_MAX;
46
+ }
47
+
48
+ return $lifetime;
49
+ }
50
+
51
+ /**
52
+ * Retrieve the storage type of the encryption key.
53
+ *
54
+ * @return string
55
+ * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
56
+ */
57
+ public function getStorageType()
58
+ {
59
+ $storageType = Mage::getStoreConfig('ampersand_paymentgateway/encryptor/storage_type');
60
+ if ($storageType == '') {
61
+ $storageType = Ampersand_PaymentGateway_Model_Source_EncryptorStorageType::TYPE_DEFAULT;
62
+ }
63
+
64
+ return $storageType;
65
+ }
66
+
67
+ /**
68
+ * Encrypt data using the provided key and store against the object.
69
+ * Note: The exception messages relating to this functionality are intentionally vague.
70
+ *
71
+ * @param array $data
72
+ * @param string $key
73
+ * @return Ampersand_PaymentGateway_Model_Encryptor
74
+ * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
75
+ * Josh Di Fabio <josh.difabio@ampersandcommerce.com>
76
+ */
77
+ public function setInformation(array $data, $key)
78
+ {
79
+ if (!is_array($data)) {
80
+ throw new Exception('Provided data must be an array.');
81
+ }
82
+
83
+ $serializedData = serialize($data);
84
+ $encryptedString = $this->_encrypt($serializedData, $key);
85
+ $encodedString = base64_encode($encryptedString);
86
+ $this->setData('information', $encodedString);
87
+
88
+ return $this;
89
+ }
90
+
91
+ /**
92
+ * Decrypt data stored against this object using the provided key and return it.
93
+ * Note: The exception messages relating to this functionality are intentionally vague.
94
+ *
95
+ * @param string $key
96
+ * @return array
97
+ * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
98
+ * Josh Di Fabio <josh.difabio@ampersandcommerce.com>
99
+ */
100
+ public function getInformation($key)
101
+ {
102
+ $encodedString = $this->getData('information');
103
+ $encryptedString = base64_decode($encodedString);
104
+ $serializedData = $this->_decrypt($encryptedString, $key);
105
+ $data = unserialize($serializedData);
106
+
107
+ if (!is_array($data)) {
108
+ throw new Exception('Unable to process information.');
109
+ }
110
+
111
+ return $data;
112
+ }
113
+
114
+ /**
115
+ * Generate a single-use unique key.
116
+ *
117
+ * @return string
118
+ * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
119
+ * Josh Di Fabio <josh.difabio@ampersandcommerce.com>
120
+ */
121
+ public function generateKey()
122
+ {
123
+ $handler = mcrypt_module_open(self::CRYPT_CIPHER, '', self::CRYPT_MODE, '');
124
+ $maxKeySize = mcrypt_enc_get_key_size($handler);
125
+
126
+ $key = '';
127
+ while (strlen($key) < $maxKeySize) {
128
+ $key .= chr(mt_rand(0, 255));
129
+ }
130
+
131
+ return $key;
132
+ }
133
+
134
+ /**
135
+ * Encrypt the data using the provided key.
136
+ *
137
+ * @param string $string
138
+ * @param string $key
139
+ * @return string
140
+ * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
141
+ * Josh Di Fabio <josh.difabio@ampersandcommerce.com>
142
+ */
143
+ protected function _encrypt($string, $key)
144
+ {
145
+ return $this->_getCrypt($key)->encrypt($string);
146
+ }
147
+
148
+ /**
149
+ * Decrypt the data using the provided key.
150
+ *
151
+ * @param string $string
152
+ * @param string $key
153
+ * @return string
154
+ * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
155
+ * Josh Di Fabio <josh.difabio@ampersandcommerce.com>
156
+ */
157
+ protected function _decrypt($string, $key)
158
+ {
159
+ return $this->_getCrypt($key)->decrypt($string);
160
+ }
161
+
162
+ /**
163
+ * Retrieve the encryption model.
164
+ *
165
+ * @param string $key
166
+ * @return Varien_Crypt_Mcrypt
167
+ * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
168
+ * Josh Di Fabio <josh.difabio@ampersandcommerce.com>
169
+ */
170
+ protected function _getCrypt($key)
171
+ {
172
+ return Varien_Crypt::factory('mcrypt')
173
+ ->setCipher(self::CRYPT_CIPHER)
174
+ ->setMode(self::CRYPT_MODE)
175
+ ->init($key);
176
+ }
177
+ }
app/code/core/Ampersand/PaymentGateway/Model/Observer.php CHANGED
@@ -120,6 +120,38 @@ class Ampersand_PaymentGateway_Model_Observer
120
  $block->setMethods($methods);
121
  }
122
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123
  /**
124
  * Determine whether a customer is currently logged in.
125
  *
120
  $block->setMethods($methods);
121
  }
122
 
123
+ /**
124
+ * Append a block for displaying additional payment gateway information on order view screen.
125
+ *
126
+ * @param Varien_Event_Observer $observer
127
+ * @return Ampersand_PaymentGateway_Model_Observer
128
+ * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
129
+ */
130
+ public function appendPaymentInfoBlock(Varien_Event_Observer $observer)
131
+ {
132
+ $block = $observer->getEvent()->getBlock();
133
+ $payment = $observer->getEvent()->getPayment();
134
+
135
+ $blockType = 'core/template';
136
+ if ($layout = Mage::helper('payment')->getLayout()) {
137
+ $paymentInfoBlock = $layout->createBlock($blockType);
138
+ }
139
+ else {
140
+ $className = Mage::getConfig()->getBlockClassName($blockType);
141
+ $paymentInfoBlock = new $className;
142
+ }
143
+
144
+ $paymentData = Mage::getModel('ampersand_paymentgateway/paymentInfo')
145
+ ->getDataPairs($payment->getId());
146
+
147
+ $paymentInfoBlock
148
+ ->setPayment($payment)
149
+ ->setPaymentInfo($paymentData)
150
+ ->setTemplate('ampersand_paymentgateway/payment/info/payment-info.phtml');
151
+
152
+ $block->append($paymentInfoBlock);
153
+ }
154
+
155
  /**
156
  * Determine whether a customer is currently logged in.
157
  *
app/code/core/Ampersand/PaymentGateway/Model/PaymentInfo.php ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Ampersand_PaymentGateway_Model_PaymentInfo extends Mage_Core_Model_Abstract
3
+ {
4
+ /**
5
+ * Initialise model.
6
+ *
7
+ * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
8
+ */
9
+ protected function _construct()
10
+ {
11
+ $this->_init('ampersand_paymentgateway/paymentInfo');
12
+ }
13
+
14
+ /**
15
+ * Save payment gateway information for display on the Magento admin panel order view page.
16
+ * The provided $data can be an array of key:value pairs, plain text or HTML.
17
+ *
18
+ * @param int $paymentId
19
+ * @param string $identifier
20
+ * @param string|array $data
21
+ * @return Ampersand_PaymentGateway_Model_PaymentInfo
22
+ * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
23
+ */
24
+ public function saveSectionData($paymentId, $identifier, $data)
25
+ {
26
+ if (is_null($paymentId) || $identifier == '') {
27
+ return $this;
28
+ }
29
+
30
+ // remove any empty or non-string values
31
+ if (is_array($data)) {
32
+ foreach ($data as $_key => $_value) {
33
+ if (is_null($_value) || !is_string($_value) || $_value == '') {
34
+ unset($data[$_key]);
35
+ }
36
+ }
37
+ if (count($data) < 1) {
38
+ return $this;
39
+ }
40
+ } elseif (trim($data) == '') {
41
+ return $this;
42
+ }
43
+
44
+ // prepare data for saving
45
+ if (is_array($data)) {
46
+ $data = @serialize($data);
47
+ } else {
48
+ $data = trim($data);
49
+ }
50
+
51
+ // save the entry
52
+ $this->_getInstance()
53
+ ->addData(array(
54
+ 'payment_id' => $paymentId,
55
+ 'field' => $identifier,
56
+ 'value' => $data,
57
+ ))
58
+ ->save();
59
+
60
+ return $this;
61
+ }
62
+
63
+ /**
64
+ * Retrieve payment gateway information for display under specific information.
65
+ *
66
+ * @param int $paymentId
67
+ * @return array
68
+ * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
69
+ */
70
+ public function getDataPairs($paymentId)
71
+ {
72
+ $data = array();
73
+
74
+ if (is_null($paymentId)) {
75
+ return $data;
76
+ }
77
+
78
+ $collection = $this->getCollection()
79
+ ->addFieldToFilter('payment_id', $paymentId);
80
+
81
+ foreach ($collection as $_paymentInfo) {
82
+ $arrayData = @unserialize($_paymentInfo->getValue());
83
+ if (is_array($arrayData)) {
84
+ $data[$_paymentInfo->getField()] = $arrayData;
85
+ } else {
86
+ $data[$_paymentInfo->getField()] = $_paymentInfo->getValue();
87
+ }
88
+ }
89
+
90
+ return $data;
91
+ }
92
+
93
+ /**
94
+ * Retrieve a new instance of this class.
95
+ *
96
+ * @return Ampersand_PaymentGateway_Model_PaymentInfo
97
+ * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
98
+ */
99
+ protected function _getInstance()
100
+ {
101
+ return Mage::getModel('ampersand_paymentgateway/paymentInfo');
102
+ }
103
+ }
app/code/core/Ampersand/PaymentGateway/Model/Resource/Agreement/Collection.php CHANGED
@@ -23,12 +23,14 @@ class Ampersand_PaymentGateway_Model_Resource_Agreement_Collection
23
  foreach ($this->_items as $_item) {
24
  $_additionalInformation = $_item->getData('additional_information');
25
  if ($_additionalInformation != '') {
26
- $_item->setData('additional_information', unserialize($_additionalInformation));
 
 
 
 
27
  }
28
  }
29
 
30
- parent::_afterLoad();
31
-
32
- return $this;
33
  }
34
  }
23
  foreach ($this->_items as $_item) {
24
  $_additionalInformation = $_item->getData('additional_information');
25
  if ($_additionalInformation != '') {
26
+ $_additionalInformationData = unserialize($_additionalInformation);
27
+ foreach ($_additionalInformationData as &$__data) {
28
+ $__data = Mage::helper('core')->decrypt($__data);
29
+ }
30
+ $_item->setData('additional_information', $_additionalInformationData);
31
  }
32
  }
33
 
34
+ return parent::_afterLoad();
 
 
35
  }
36
  }
app/code/core/Ampersand/PaymentGateway/Model/Resource/Encryptor.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Ampersand_PaymentGateway_Model_Resource_Encryptor extends Mage_Core_Model_Mysql4_Abstract
3
+ {
4
+ /**
5
+ * Initialise resource model.
6
+ *
7
+ * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
8
+ */
9
+ protected function _construct()
10
+ {
11
+ $this->_init('ampersand_paymentgateway/encryptor', 'entity_id');
12
+ }
13
+
14
+ /**
15
+ * Automatically set the created time.
16
+ *
17
+ * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
18
+ */
19
+ protected function _prepareDataForSave(Mage_Core_Model_Abstract $object)
20
+ {
21
+ $now = now();
22
+ if (!$object->getId() || $object->isObjectNew()) {
23
+ $object->setCreatedAt($now);
24
+ }
25
+
26
+ return parent::_prepareDataForSave($object);
27
+ }
28
+ }
app/code/core/Ampersand/PaymentGateway/Model/Resource/Encryptor/Collection.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Ampersand_PaymentGateway_Model_Resource_Encryptor_Collection
3
+ extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+ /**
6
+ * Initialise collection.
7
+ *
8
+ * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
9
+ */
10
+ protected function _construct()
11
+ {
12
+ $this->_init('ampersand_paymentgateway/encryptor');
13
+ }
14
+ }
app/code/core/Ampersand/PaymentGateway/Model/Resource/PaymentInfo.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Ampersand_PaymentGateway_Model_Resource_PaymentInfo extends Mage_Core_Model_Mysql4_Abstract
3
+ {
4
+ /**
5
+ * Initialise resource model.
6
+ *
7
+ * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
8
+ */
9
+ protected function _construct()
10
+ {
11
+ $this->_init('ampersand_paymentgateway/paymentInfo', 'entity_id');
12
+ }
13
+
14
+ /**
15
+ * Automatically set the created and updated times.
16
+ *
17
+ * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
18
+ */
19
+ protected function _prepareDataForSave(Mage_Core_Model_Abstract $object)
20
+ {
21
+ $now = now();
22
+ if (!$object->getId() || $object->isObjectNew()) {
23
+ $object->setCreatedAt($now);
24
+ }
25
+ $object->setUpdatedAt($now);
26
+
27
+ return parent::_prepareDataForSave($object);
28
+ }
29
+ }
app/code/core/Ampersand/PaymentGateway/Model/Resource/PaymentInfo/Collection.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Ampersand_PaymentGateway_Model_Resource_PaymentInfo_Collection
3
+ extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+ /**
6
+ * Initialise collection.
7
+ *
8
+ * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
9
+ */
10
+ protected function _construct()
11
+ {
12
+ $this->_init('ampersand_paymentgateway/paymentInfo');
13
+ }
14
+ }
app/code/core/Ampersand/PaymentGateway/Model/Service/Abstract.php CHANGED
@@ -6,14 +6,16 @@ abstract class Ampersand_PaymentGateway_Model_Service_Abstract
6
  * Additional transaction type definitions.
7
  * Where possible these should match Mage_Sales_Model_Order_Payment_Transaction constants.
8
  */
9
- const TRANSACTION_TYPE_AUTH = 'authorization';
10
- const TRANSACTION_TYPE_CAPTURE = 'capture';
11
- const TRANSACTION_TYPE_PARTIAL = 'partial';
12
- const TRANSACTION_TYPE_AGREEMENT_MANAGE = 'manage';
13
- const TRANSACTION_TYPE_REFUND = 'refund';
14
- const TRANSACTION_TYPE_SUBSCRIPTION_AUTH = 'subscription_authorization';
15
- const TRANSACTION_TYPE_SUBSCRIPTION_CAPTURE = 'subscription_capture';
16
- const TRANSACTION_TYPE_SUBSCRIPTION_PARTIAL = 'subscription_partial';
 
 
17
 
18
  /**
19
  * Constants for validating Payment accept or deny requests.
@@ -112,6 +114,8 @@ abstract class Ampersand_PaymentGateway_Model_Service_Abstract
112
  self::TRANSACTION_TYPE_CAPTURE,
113
  self::TRANSACTION_TYPE_REFUND,
114
  self::TRANSACTION_TYPE_PARTIAL,
 
 
115
  self::TRANSACTION_TYPE_AGREEMENT_MANAGE,
116
  self::TRANSACTION_TYPE_SUBSCRIPTION_AUTH,
117
  self::TRANSACTION_TYPE_SUBSCRIPTION_CAPTURE,
@@ -179,8 +183,14 @@ abstract class Ampersand_PaymentGateway_Model_Service_Abstract
179
  $this->getAdapter()->getTransactionDataFromRegister()
180
  );
181
 
 
 
 
 
 
 
182
  if ($this->_redirectRequired == false) {
183
- $this->_processBillingAgreement();
184
  $this->_addBillingAgreementToOrder();
185
  $this->_createSubscription();
186
  }
@@ -261,8 +271,14 @@ abstract class Ampersand_PaymentGateway_Model_Service_Abstract
261
  $this->getAdapter()->getTransactionDataFromRegister()
262
  );
263
 
 
 
 
 
 
 
264
  if ($this->_redirectRequired == false) {
265
- $this->_processBillingAgreement();
266
  $this->_addBillingAgreementToOrder();
267
  $this->_createSubscription();
268
  }
@@ -320,6 +336,12 @@ abstract class Ampersand_PaymentGateway_Model_Service_Abstract
320
  $this->getAdapter()->getTransactionDataFromRegister()
321
  );
322
 
 
 
 
 
 
 
323
  return $this;
324
  }
325
 
@@ -414,6 +436,12 @@ abstract class Ampersand_PaymentGateway_Model_Service_Abstract
414
  $this->getAdapter()->getTransactionDataFromRegister()
415
  );
416
 
 
 
 
 
 
 
417
  $this->_addBillingAgreementToOrder();
418
 
419
  return $this;
@@ -472,6 +500,12 @@ abstract class Ampersand_PaymentGateway_Model_Service_Abstract
472
  $this->getAdapter()->getTransactionDataFromRegister()
473
  );
474
 
 
 
 
 
 
 
475
  return $this;
476
  }
477
 
@@ -732,9 +766,13 @@ abstract class Ampersand_PaymentGateway_Model_Service_Abstract
732
 
733
  protected function _processRedirect($url, $data)
734
  {
 
 
 
 
735
  $this->_getSession()->addData(array(
736
  Ampersand_PaymentGateway_Block_Redirect_Form::SESSION_KEY_REDIRECT_URL => $url,
737
- Ampersand_PaymentGateway_Block_Redirect_Form::SESSION_KEY_REDIRECT_DATA => $data,
738
  ));
739
 
740
  if ($this->getAdapter()->getIsUseIframe()) {
@@ -752,6 +790,55 @@ abstract class Ampersand_PaymentGateway_Model_Service_Abstract
752
  return $this;
753
  }
754
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
755
  /**
756
  * Link the billing agreement to the current order.
757
  *
@@ -854,8 +941,17 @@ abstract class Ampersand_PaymentGateway_Model_Service_Abstract
854
  $this->getAdapter()->processCallbackResponse();
855
  $this->_processServiceMessages();
856
 
857
- // update the transaction data and accept the payment
858
  $this->_updateTransactionAfterCallback();
 
 
 
 
 
 
 
 
 
859
  $this->_acceptPayment();
860
 
861
  // update the redirect url from failure page to success page
@@ -865,7 +961,7 @@ abstract class Ampersand_PaymentGateway_Model_Service_Abstract
865
  $debug->setState(Ampersand_Integration_Flag_FlagInterface::TYPE_SUCCESS);
866
 
867
  // create a new billing agreement with the credentials used for this transaction
868
- $this->_processBillingAgreement();
869
 
870
  // create a subscription if a valid billing agreement is related to this order
871
  $this->_createSubscription();
@@ -876,8 +972,17 @@ abstract class Ampersand_PaymentGateway_Model_Service_Abstract
876
  // process the failure redirect URL and error messages
877
  $this->_processCallbackFailure($e, self::FAILURE_TYPE_DENIED, $debug);
878
 
879
- // update the transaction data and deny the payment
880
  $this->_updateTransactionAfterCallback();
 
 
 
 
 
 
 
 
 
881
  $this->_denyPayment();
882
 
883
  // re-populate the customers basket
@@ -1127,22 +1232,25 @@ abstract class Ampersand_PaymentGateway_Model_Service_Abstract
1127
  * Create or update a billing agreement if applicable.
1128
  * @todo Need to also save this against transaction reference in case we dont have session.
1129
  *
 
1130
  * @return Ampersand_PaymentGateway_Model_Service_Abstract
1131
  * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
1132
  */
1133
- protected function _processBillingAgreement()
1134
  {
1135
  if (!Mage::getModel('ampersand_paymentgateway/versioning')->isBillingAgreementAvailable()) {
1136
  return $this;
1137
  }
1138
 
1139
  try {
1140
- if ($this->_getHelper()->getBillingAgreementSelection() !== true) {
 
 
1141
  return $this;
1142
  }
1143
 
1144
  $customer = $this->_getCustomer();
1145
- if (!$customer->getId()) {
1146
  return $this;
1147
  }
1148
 
@@ -1155,8 +1263,11 @@ abstract class Ampersand_PaymentGateway_Model_Service_Abstract
1155
  * Mage_Sales_Model_Order_Payment::_createBillingAgreement()
1156
  */
1157
  $salesBillingAgreement = Mage::getModel('sales/billing_agreement')
 
 
1158
  ->setMethodCode($methodCode)
1159
  ->setPayment($this->_getPayment())
 
1160
  ->setCustomer($customer)
1161
  ->setStoreId($this->_getOrder()->getStoreId())
1162
  ->place();
@@ -1700,7 +1811,17 @@ abstract class Ampersand_PaymentGateway_Model_Service_Abstract
1700
  */
1701
  protected function _getCustomer()
1702
  {
1703
- return Mage::getSingleton('customer/session')->getCustomer();
 
 
 
 
 
 
 
 
 
 
1704
  }
1705
 
1706
  /**
6
  * Additional transaction type definitions.
7
  * Where possible these should match Mage_Sales_Model_Order_Payment_Transaction constants.
8
  */
9
+ const TRANSACTION_TYPE_AUTH = 'authorization';
10
+ const TRANSACTION_TYPE_CAPTURE = 'capture';
11
+ const TRANSACTION_TYPE_PARTIAL = 'partial';
12
+ const TRANSACTION_TYPE_AGREEMENT_CREATE_DIRECT = 'create_direct';
13
+ const TRANSACTION_TYPE_AGREEMENT_CREATE_REDIRECT = 'create_redirect';
14
+ const TRANSACTION_TYPE_AGREEMENT_MANAGE = 'manage';
15
+ const TRANSACTION_TYPE_REFUND = 'refund';
16
+ const TRANSACTION_TYPE_SUBSCRIPTION_AUTH = 'subscription_authorization';
17
+ const TRANSACTION_TYPE_SUBSCRIPTION_CAPTURE = 'subscription_capture';
18
+ const TRANSACTION_TYPE_SUBSCRIPTION_PARTIAL = 'subscription_partial';
19
 
20
  /**
21
  * Constants for validating Payment accept or deny requests.
114
  self::TRANSACTION_TYPE_CAPTURE,
115
  self::TRANSACTION_TYPE_REFUND,
116
  self::TRANSACTION_TYPE_PARTIAL,
117
+ self::TRANSACTION_TYPE_AGREEMENT_CREATE_DIRECT,
118
+ self::TRANSACTION_TYPE_AGREEMENT_CREATE_REDIRECT,
119
  self::TRANSACTION_TYPE_AGREEMENT_MANAGE,
120
  self::TRANSACTION_TYPE_SUBSCRIPTION_AUTH,
121
  self::TRANSACTION_TYPE_SUBSCRIPTION_CAPTURE,
183
  $this->getAdapter()->getTransactionDataFromRegister()
184
  );
185
 
186
+ Mage::getModel('ampersand_paymentgateway/paymentInfo')->saveSectionData(
187
+ $this->_getPayment()->getId(),
188
+ 'Register',
189
+ $this->getAdapter()->getPaymentInfo()
190
+ );
191
+
192
  if ($this->_redirectRequired == false) {
193
+ $this->_processBillingAgreement($this->getAdapter()->getIsAgreementDataInRegister());
194
  $this->_addBillingAgreementToOrder();
195
  $this->_createSubscription();
196
  }
271
  $this->getAdapter()->getTransactionDataFromRegister()
272
  );
273
 
274
+ Mage::getModel('ampersand_paymentgateway/paymentInfo')->saveSectionData(
275
+ $this->_getPayment()->getId(),
276
+ 'Register',
277
+ $this->getAdapter()->getPaymentInfo()
278
+ );
279
+
280
  if ($this->_redirectRequired == false) {
281
+ $this->_processBillingAgreement($this->getAdapter()->getIsAgreementDataInRegister());
282
  $this->_addBillingAgreementToOrder();
283
  $this->_createSubscription();
284
  }
336
  $this->getAdapter()->getTransactionDataFromRegister()
337
  );
338
 
339
+ Mage::getModel('ampersand_paymentgateway/paymentInfo')->saveSectionData(
340
+ $this->_getPayment()->getId(),
341
+ 'Partial Capture',
342
+ $this->getAdapter()->getPaymentInfo()
343
+ );
344
+
345
  return $this;
346
  }
347
 
436
  $this->getAdapter()->getTransactionDataFromRegister()
437
  );
438
 
439
+ Mage::getModel('ampersand_paymentgateway/paymentInfo')->saveSectionData(
440
+ $this->_getPayment()->getId(),
441
+ 'Register',
442
+ $this->getAdapter()->getPaymentInfo()
443
+ );
444
+
445
  $this->_addBillingAgreementToOrder();
446
 
447
  return $this;
500
  $this->getAdapter()->getTransactionDataFromRegister()
501
  );
502
 
503
+ Mage::getModel('ampersand_paymentgateway/paymentInfo')->saveSectionData(
504
+ $this->_getPayment()->getId(),
505
+ 'Refund',
506
+ $this->getAdapter()->getPaymentInfo()
507
+ );
508
+
509
  return $this;
510
  }
511
 
766
 
767
  protected function _processRedirect($url, $data)
768
  {
769
+ // process potentially sensitive information
770
+ $dataReferenceId = $this->_processSensitiveData($data);
771
+
772
+ // add the non-sensitive data to the session
773
  $this->_getSession()->addData(array(
774
  Ampersand_PaymentGateway_Block_Redirect_Form::SESSION_KEY_REDIRECT_URL => $url,
775
+ Ampersand_PaymentGateway_Block_Redirect_Form::SESSION_KEY_REDIRECT_DATA_REFERENCE_ID => $dataReferenceId,
776
  ));
777
 
778
  if ($this->getAdapter()->getIsUseIframe()) {
790
  return $this;
791
  }
792
 
793
+ /**
794
+ * In 3D Secure cases, the $data param can contain sensitive information,
795
+ * so additional steps are required to restrict the access to this data.
796
+ * Note: The exception messages relating to this functionality are intentionally vague.
797
+ *
798
+ * @param array $data
799
+ * @return Ampersand_PaymentGateway_Model_Service_Abstract
800
+ * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
801
+ * Josh Di Fabio <josh.difabio@ampersandcommerce.com>
802
+ */
803
+ protected function _processSensitiveData($data)
804
+ {
805
+ $encryptor = Mage::getModel('ampersand_paymentgateway/encryptor');
806
+
807
+ // generate a unique single-use key
808
+ $key = $encryptor->generateKey();
809
+
810
+ // encrypt the data using this single-use key and save in the database
811
+ $encryptor->setInformation($data, $key)->save();
812
+ if ($encryptor->getId() < 1) {
813
+ throw new Exception('Unable to create information item.');
814
+ }
815
+
816
+ // determine the type of storage for the single-use key to decrypt the sensitive data
817
+ $storageType = $encryptor->getStorageType();
818
+ $this->_getSession()->setData(
819
+ Ampersand_PaymentGateway_Block_Redirect_Form::SESSION_KEY_REDIRECT_DATA_STORAGE_TYPE,
820
+ $storageType
821
+ );
822
+
823
+ // encode to ensure character encoding does not affect the storage
824
+ $encodedKey = base64_encode($key);
825
+
826
+ if ($storageType == Ampersand_PaymentGateway_Model_Source_EncryptorStorageType::TYPE_COOKIE) {
827
+ Mage::getModel('core/cookie')->set(
828
+ Ampersand_PaymentGateway_Block_Redirect_Form::ENCRYPTION_KEY_FIELD_NAME,
829
+ $encodedKey,
830
+ $encryptor->getLifetime()
831
+ );
832
+ } else {
833
+ $this->_getSession()->setData(
834
+ Ampersand_PaymentGateway_Block_Redirect_Form::ENCRYPTION_KEY_FIELD_NAME,
835
+ $encodedKey
836
+ );
837
+ }
838
+
839
+ return $encryptor->getId();
840
+ }
841
+
842
  /**
843
  * Link the billing agreement to the current order.
844
  *
941
  $this->getAdapter()->processCallbackResponse();
942
  $this->_processServiceMessages();
943
 
944
+ // update the transaction data
945
  $this->_updateTransactionAfterCallback();
946
+
947
+ // update the payment information
948
+ Mage::getModel('ampersand_paymentgateway/paymentInfo')->saveSectionData(
949
+ $this->_getPayment()->getId(),
950
+ 'Callback',
951
+ $this->getAdapter()->getPaymentInfo()
952
+ );
953
+
954
+ // accept the payment
955
  $this->_acceptPayment();
956
 
957
  // update the redirect url from failure page to success page
961
  $debug->setState(Ampersand_Integration_Flag_FlagInterface::TYPE_SUCCESS);
962
 
963
  // create a new billing agreement with the credentials used for this transaction
964
+ $this->_processBillingAgreement($this->getAdapter()->getIsAgreementDataInCallback());
965
 
966
  // create a subscription if a valid billing agreement is related to this order
967
  $this->_createSubscription();
972
  // process the failure redirect URL and error messages
973
  $this->_processCallbackFailure($e, self::FAILURE_TYPE_DENIED, $debug);
974
 
975
+ // update the transaction data
976
  $this->_updateTransactionAfterCallback();
977
+
978
+ // update the payment information
979
+ Mage::getModel('ampersand_paymentgateway/paymentInfo')->saveSectionData(
980
+ $this->_getPayment()->getId(),
981
+ 'Callback',
982
+ $this->getAdapter()->getPaymentInfo()
983
+ );
984
+
985
+ // deny the payment
986
  $this->_denyPayment();
987
 
988
  // re-populate the customers basket
1232
  * Create or update a billing agreement if applicable.
1233
  * @todo Need to also save this against transaction reference in case we dont have session.
1234
  *
1235
+ * @param bool $agreementCredentialsInResponse
1236
  * @return Ampersand_PaymentGateway_Model_Service_Abstract
1237
  * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
1238
  */
1239
+ protected function _processBillingAgreement($agreementCredentialsInResponse = false)
1240
  {
1241
  if (!Mage::getModel('ampersand_paymentgateway/versioning')->isBillingAgreementAvailable()) {
1242
  return $this;
1243
  }
1244
 
1245
  try {
1246
+ if ($agreementCredentialsInResponse !== true
1247
+ && $this->_getHelper()->getBillingAgreementSelection() !== true
1248
+ ) {
1249
  return $this;
1250
  }
1251
 
1252
  $customer = $this->_getCustomer();
1253
+ if (!$customer || !$customer->getId()) {
1254
  return $this;
1255
  }
1256
 
1263
  * Mage_Sales_Model_Order_Payment::_createBillingAgreement()
1264
  */
1265
  $salesBillingAgreement = Mage::getModel('sales/billing_agreement')
1266
+ ->setTransactionType($this->_getCreateAgreementTransactionType())
1267
+ ->setResponse($this->_getResponse())
1268
  ->setMethodCode($methodCode)
1269
  ->setPayment($this->_getPayment())
1270
+ ->setOrder($this->_getOrder())
1271
  ->setCustomer($customer)
1272
  ->setStoreId($this->_getOrder()->getStoreId())
1273
  ->place();
1811
  */
1812
  protected function _getCustomer()
1813
  {
1814
+ $order = $this->_getOrder();
1815
+ if (!$order instanceof Mage_Sales_Model_Order) {
1816
+ return false;
1817
+ }
1818
+
1819
+ $customerId = $order->getCustomerId();
1820
+ if ((int)$customerId <= 0) {
1821
+ return false;
1822
+ }
1823
+
1824
+ return Mage::getModel('customer/customer')->load($customerId);
1825
  }
1826
 
1827
  /**
app/code/core/Ampersand/PaymentGateway/Model/Service/{Direct/AgreementAbstract.php → AgreementAbstract.php} RENAMED
@@ -1,5 +1,5 @@
1
  <?php
2
- abstract class Ampersand_PaymentGateway_Model_Service_Direct_AgreementAbstract
3
  extends Ampersand_PaymentGateway_Model_Service_DirectAbstract
4
  {
5
  /**
@@ -16,7 +16,7 @@ abstract class Ampersand_PaymentGateway_Model_Service_Direct_AgreementAbstract
16
  * Mage_Sales_Billing_AgreementController::returnWizardAction
17
  *
18
  * @param Mage_Payment_Model_Billing_AgreementAbstract $agreement
19
- * @return Ampersand_PaymentGateway_Model_Service_Direct_AgreementAbstract
20
  * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
21
  */
22
  public function initBillingAgreementToken(Mage_Payment_Model_Billing_AgreementAbstract $agreement)
@@ -40,7 +40,7 @@ abstract class Ampersand_PaymentGateway_Model_Service_Direct_AgreementAbstract
40
  * called immediately afterwards, we might as well put all of our logic in there...
41
  *
42
  * @param Mage_Payment_Model_Billing_AgreementAbstract $agreement
43
- * @return Ampersand_PaymentGateway_Model_Service_Direct_AgreementAbstract
44
  * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
45
  */
46
  public function getBillingAgreementTokenInfo(Mage_Payment_Model_Billing_AgreementAbstract $agreement)
@@ -52,13 +52,17 @@ abstract class Ampersand_PaymentGateway_Model_Service_Direct_AgreementAbstract
52
  * Create a billing agreement with the payment gateway.
53
  *
54
  * @param Mage_Payment_Model_Billing_AgreementAbstract $agreement
55
- * @return Ampersand_PaymentGateway_Model_Service_Direct_AgreementAbstract
56
  * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
57
  */
58
  public function placeBillingAgreement(Mage_Payment_Model_Billing_AgreementAbstract $agreement)
59
  {
60
- $this->_setTransactionType();
61
- $this->getAdapter()->setPayment($agreement->getPayment());
 
 
 
 
62
 
63
  try {
64
  $this->getAdapter()->prepareBillingAgreementRequest();
@@ -84,12 +88,14 @@ abstract class Ampersand_PaymentGateway_Model_Service_Direct_AgreementAbstract
84
  * Cancel a billing agreement.
85
  *
86
  * @param Mage_Payment_Model_Billing_AgreementAbstract $agreement
87
- * @return Ampersand_PaymentGateway_Model_Service_Direct_AgreementAbstract
88
  * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
89
  */
90
  public function cancelBillingAgreement(Mage_Payment_Model_Billing_AgreementAbstract $agreement)
91
  {
92
- $this->_setTransactionType();
 
 
93
 
94
  // retrieve the additional information for this agreement
95
  $ampersandAgreement = Mage::getModel('ampersand_paymentgateway/agreement')
@@ -120,25 +126,51 @@ abstract class Ampersand_PaymentGateway_Model_Service_Direct_AgreementAbstract
120
  * linked to the Magento billing agreement by a unique reference ID.
121
  *
122
  * @param Mage_Payment_Model_Billing_AgreementAbstract $agreement
123
- * @return Ampersand_PaymentGateway_Model_Service_Direct_AgreementAbstract
124
  * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
125
  */
126
  protected function _saveBillingAgreement(Mage_Payment_Model_Billing_AgreementAbstract $agreement)
127
  {
128
- $this->_setTransactionType();
129
-
130
  $agreement->setBillingAgreementId($this->_generateBillingAgreementId($agreement));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
131
 
132
  Mage::getModel('ampersand_paymentgateway/agreement')
133
  ->setServiceCode($agreement->getMethodCode())
134
  ->setReferenceId($agreement->getBillingAgreementId())
135
  ->setCustomerId($agreement->getCustomer()->getId())
136
  ->setStoreId($agreement->getStoreId())
137
- ->setAdditionalInformation($this->getAdapter()->getBillingAgreementCredentials())
138
- ->setCardType($agreement->getPayment()->getCcType())
139
- ->setCardLastFour($agreement->getPayment()->getCcLast4())
140
- ->setCardExpiryMonth(str_pad($agreement->getPayment()->getCcExpMonth(), 2, 0, STR_PAD_LEFT))
141
- ->setCardExpiryYear($agreement->getPayment()->getCcExpYear())
142
  ->save();
143
 
144
  return $this;
@@ -154,34 +186,11 @@ abstract class Ampersand_PaymentGateway_Model_Service_Direct_AgreementAbstract
154
  */
155
  protected function _generateBillingAgreementId(Mage_Payment_Model_Billing_AgreementAbstract $agreement)
156
  {
157
- /**
158
- * @todo
159
- * - remove the stars as they are irrelevant
160
- * - crossover here between direct and redirect.
161
- * - this should also be available to be used as externally (eg. for Realex) ?
162
- */
163
- $payment = $agreement->getPayment();
164
-
165
- $billingAgreementId = time() . '-';
166
- $billingAgreementId .= '****' . $payment->getCcLast4() . '-';
167
- $billingAgreementId .= str_pad($payment->getCcExpMonth(), 2, '0', STR_PAD_LEFT) . '-';
168
- $billingAgreementId .= $payment->getCcExpYear();
169
 
170
  return $billingAgreementId;
171
  }
172
-
173
- /**
174
- * Set the current transaction type for creating a new agreement.
175
- *
176
- * @return Ampersand_PaymentGateway_Model_Service_Direct_AgreementAbstract
177
- * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
178
- */
179
- public function _setTransactionType()
180
- {
181
- $this->setTransactionType(
182
- Ampersand_PaymentGateway_Model_Service_Abstract::TRANSACTION_TYPE_AGREEMENT_MANAGE
183
- );
184
-
185
- return $this;
186
- }
187
  }
1
  <?php
2
+ abstract class Ampersand_PaymentGateway_Model_Service_AgreementAbstract
3
  extends Ampersand_PaymentGateway_Model_Service_DirectAbstract
4
  {
5
  /**
16
  * Mage_Sales_Billing_AgreementController::returnWizardAction
17
  *
18
  * @param Mage_Payment_Model_Billing_AgreementAbstract $agreement
19
+ * @return Ampersand_PaymentGateway_Model_Service_AgreementAbstract
20
  * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
21
  */
22
  public function initBillingAgreementToken(Mage_Payment_Model_Billing_AgreementAbstract $agreement)
40
  * called immediately afterwards, we might as well put all of our logic in there...
41
  *
42
  * @param Mage_Payment_Model_Billing_AgreementAbstract $agreement
43
+ * @return Ampersand_PaymentGateway_Model_Service_AgreementAbstract
44
  * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
45
  */
46
  public function getBillingAgreementTokenInfo(Mage_Payment_Model_Billing_AgreementAbstract $agreement)
52
  * Create a billing agreement with the payment gateway.
53
  *
54
  * @param Mage_Payment_Model_Billing_AgreementAbstract $agreement
55
+ * @return Ampersand_PaymentGateway_Model_Service_AgreementAbstract
56
  * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
57
  */
58
  public function placeBillingAgreement(Mage_Payment_Model_Billing_AgreementAbstract $agreement)
59
  {
60
+ $this->setTransactionType($agreement->getTransactionType());
61
+
62
+ $this->getAdapter()
63
+ ->setPayment($agreement->getPayment())
64
+ ->setOrder($agreement->getOrder())
65
+ ->setResponse($agreement->getResponse());
66
 
67
  try {
68
  $this->getAdapter()->prepareBillingAgreementRequest();
88
  * Cancel a billing agreement.
89
  *
90
  * @param Mage_Payment_Model_Billing_AgreementAbstract $agreement
91
+ * @return Ampersand_PaymentGateway_Model_Service_AgreementAbstract
92
  * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
93
  */
94
  public function cancelBillingAgreement(Mage_Payment_Model_Billing_AgreementAbstract $agreement)
95
  {
96
+ $this->setTransactionType(
97
+ Ampersand_PaymentGateway_Model_Service_Abstract::TRANSACTION_TYPE_AGREEMENT_MANAGE
98
+ );
99
 
100
  // retrieve the additional information for this agreement
101
  $ampersandAgreement = Mage::getModel('ampersand_paymentgateway/agreement')
126
  * linked to the Magento billing agreement by a unique reference ID.
127
  *
128
  * @param Mage_Payment_Model_Billing_AgreementAbstract $agreement
129
+ * @return Ampersand_PaymentGateway_Model_Service_AgreementAbstract
130
  * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
131
  */
132
  protected function _saveBillingAgreement(Mage_Payment_Model_Billing_AgreementAbstract $agreement)
133
  {
 
 
134
  $agreement->setBillingAgreementId($this->_generateBillingAgreementId($agreement));
135
+ $agreementCredentials = $this->getAdapter()->getBillingAgreementCredentials();
136
+ $agreementCredentialsObject = new Ampersand_Object($agreementCredentials);
137
+
138
+ /**
139
+ * @todo this is not so black and white as Direct vs Redirect, since Direct methods
140
+ * might have the agreement data returned in the AUTH response, but OK for now...
141
+ *
142
+ * Need a better way of retrieving this information...
143
+ */
144
+ switch ($agreement->getTransactionType()) {
145
+ case Ampersand_PaymentGateway_Model_Service_Abstract::TRANSACTION_TYPE_AGREEMENT_CREATE_DIRECT:
146
+ $cardType = $agreement->getPayment()->getCcType();
147
+ $cardLastFour = $agreement->getPayment()->getCcLast4();
148
+ $cardExpiryMonth = str_pad($agreement->getPayment()->getCcExpMonth(), 2, 0, STR_PAD_LEFT);
149
+ $cardExpiryYear = $agreement->getPayment()->getCcExpYear();
150
+ break;
151
+
152
+ case Ampersand_PaymentGateway_Model_Service_Abstract::TRANSACTION_TYPE_AGREEMENT_CREATE_REDIRECT:
153
+ $cardType = $agreementCredentialsObject->getCcType();
154
+ $cardLastFour = $agreementCredentialsObject->getCcLast4();
155
+ $cardExpiryMonth = $agreementCredentialsObject->getCcExpMonth();
156
+ $cardExpiryYear = $agreementCredentialsObject->getCcExpYear();
157
+ break;
158
+
159
+ default:
160
+ throw new Exception('Invalid transaction type provided.');
161
+ break;
162
+ }
163
 
164
  Mage::getModel('ampersand_paymentgateway/agreement')
165
  ->setServiceCode($agreement->getMethodCode())
166
  ->setReferenceId($agreement->getBillingAgreementId())
167
  ->setCustomerId($agreement->getCustomer()->getId())
168
  ->setStoreId($agreement->getStoreId())
169
+ ->setAdditionalInformation($agreementCredentials)
170
+ ->setCardType($cardType)
171
+ ->setCardLastFour($cardLastFour)
172
+ ->setCardExpiryMonth($cardExpiryMonth)
173
+ ->setCardExpiryYear($cardExpiryYear)
174
  ->save();
175
 
176
  return $this;
186
  */
187
  protected function _generateBillingAgreementId(Mage_Payment_Model_Billing_AgreementAbstract $agreement)
188
  {
189
+ $billingAgreementId = '';
190
+ $billingAgreementId .= time() . '-';
191
+ $billingAgreementId .= $agreement->getCustomer()->getId() . '-';
192
+ $billingAgreementId .= mt_rand(11111111, 99999999);
 
 
 
 
 
 
 
 
193
 
194
  return $billingAgreementId;
195
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
196
  }
app/code/core/Ampersand/PaymentGateway/Model/Service/DirectAbstract.php CHANGED
@@ -40,4 +40,15 @@ abstract class Ampersand_PaymentGateway_Model_Service_DirectAbstract
40
 
41
  return $this;
42
  }
 
 
 
 
 
 
 
 
 
 
 
43
  }
40
 
41
  return $this;
42
  }
43
+
44
+ /**
45
+ * Retrieve the type of transaction type for creating a billing agreement.
46
+ *
47
+ * @return string
48
+ * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
49
+ */
50
+ protected function _getCreateAgreementTransactionType()
51
+ {
52
+ return self::TRANSACTION_TYPE_AGREEMENT_CREATE_DIRECT;
53
+ }
54
  }
app/code/core/Ampersand/PaymentGateway/Model/Service/Redirect/AgreementAbstract.php DELETED
@@ -1,174 +0,0 @@
1
- <?php
2
- abstract class Ampersand_PaymentGateway_Model_Service_Redirect_AgreementAbstract
3
- extends Ampersand_PaymentGateway_Model_Service_RedirectAbstract
4
- {
5
- /**
6
- * This method is only ever called from
7
- * Mage_Sales_Billing_AgreementController::startWizardAction
8
- *
9
- * When using the Wizard, this method is called to define the redirect URL that the customer
10
- * will be sent to in order to create a new billing token.
11
- *
12
- * For direct we should redirect to our own controller for collecting card details.
13
- * For redirect we can forward the customer on to the payment gateway.
14
- *
15
- * The end of the process should be a post with the payment_method and token to
16
- * Mage_Sales_Billing_AgreementController::returnWizardAction
17
- *
18
- * @param Mage_Payment_Model_Billing_AgreementAbstract $agreement
19
- * @return Ampersand_PaymentGateway_Model_Service_Redirect_AgreementAbstract
20
- * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
21
- */
22
- public function initBillingAgreementToken(Mage_Payment_Model_Billing_AgreementAbstract $agreement)
23
- {
24
- return $this;
25
-
26
- // $api = $this->_pro->getApi()
27
- // ->setReturnUrl($agreement->getReturnUrl())
28
- // ->setCancelUrl($agreement->getCancelUrl())
29
- // ->setBillingType($this->_pro->getApi()->getBillingAgreementType());
30
- //
31
- // $api->callSetCustomerBillingAgreement();
32
- // $agreement->setRedirectUrl(
33
- // $this->_pro->getConfig()->getStartBillingAgreementUrl($api->getToken())
34
- // );
35
- // return $this;
36
- }
37
-
38
- /**
39
- * Don't really see the point of this method, since placeBillingAgreement() is
40
- * called immediately afterwards, we might as well put all of our logic in there...
41
- *
42
- * @param Mage_Payment_Model_Billing_AgreementAbstract $agreement
43
- * @return Ampersand_PaymentGateway_Model_Service_Redirect_AgreementAbstract
44
- * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
45
- */
46
- public function getBillingAgreementTokenInfo(Mage_Payment_Model_Billing_AgreementAbstract $agreement)
47
- {
48
- return $this;
49
- }
50
-
51
- /**
52
- * Create a billing agreement with the payment gateway.
53
- *
54
- * @param Mage_Payment_Model_Billing_AgreementAbstract $agreement
55
- * @return Ampersand_PaymentGateway_Model_Service_Redirect_AgreementAbstract
56
- * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
57
- */
58
- public function placeBillingAgreement(Mage_Payment_Model_Billing_AgreementAbstract $agreement)
59
- {
60
- $this->_setTransactionType();
61
- $this->getAdapter()->setPayment($agreement->getPayment());
62
-
63
- try {
64
- $this->getAdapter()->prepareBillingAgreementRequest();
65
- $this->_processServiceMessages();
66
- $this->_saveBillingAgreement($agreement);
67
- } catch (Exception $e) {
68
- // retrieve custom exception message if available
69
- if ($methodException = $this->_getMethodException($e)) {
70
- $e = $methodException;
71
- }
72
-
73
- // create a flag against the message
74
- $this->_updateMessageForFailure($e);
75
-
76
- // re-throw
77
- throw $e;
78
- }
79
-
80
- return $this;
81
- }
82
-
83
- /**
84
- * Cancel a billing agreement.
85
- *
86
- * @param Mage_Payment_Model_Billing_AgreementAbstract $agreement
87
- * @return Ampersand_PaymentGateway_Model_Service_Redirect_AgreementAbstract
88
- * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
89
- */
90
- public function cancelBillingAgreement(Mage_Payment_Model_Billing_AgreementAbstract $agreement)
91
- {
92
- $this->_setTransactionType();
93
-
94
- // retrieve the additional information for this agreement
95
- $ampersandAgreement = Mage::getModel('ampersand_paymentgateway/agreement')
96
- ->loadByReferenceId($agreement->getMethodCode(), $agreement->getReferenceId());
97
- $this->getAdapter()->setAgreement($ampersandAgreement);
98
-
99
- $this->getAdapter()->prepareBillingAgreementCancel();
100
- $this->_processServiceMessages();
101
-
102
- return $this;
103
- }
104
-
105
- /**
106
- * Save the billing agreement data for use in future transactions,
107
- * linked to the Magento billing agreement by a unique reference ID.
108
- *
109
- * @param Mage_Payment_Model_Billing_AgreementAbstract $agreement
110
- * @return Ampersand_PaymentGateway_Model_Service_Redirect_AgreementAbstract
111
- * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
112
- */
113
- protected function _saveBillingAgreement(Mage_Payment_Model_Billing_AgreementAbstract $agreement)
114
- {
115
- $this->_setTransactionType();
116
-
117
- $agreement->setBillingAgreementId($this->_generateBillingAgreementId($agreement));
118
-
119
- Mage::getModel('ampersand_paymentgateway/agreement')
120
- ->setServiceCode($agreement->getMethodCode())
121
- ->setReferenceId($agreement->getBillingAgreementId())
122
- ->setCustomerId($agreement->getCustomer()->getId())
123
- ->setStoreId($agreement->getStoreId())
124
- ->setAdditionalInformation($this->getAdapter()->getBillingAgreementCredentials())
125
- ->setCardType($agreement->getPayment()->getCcType())
126
- ->setCardLastFour($agreement->getPayment()->getCcLast4())
127
- ->setCardExpiryMonth(str_pad($agreement->getPayment()->getCcExpMonth(), 2, 0, STR_PAD_LEFT))
128
- ->setCardExpiryYear($agreement->getPayment()->getCcExpYear())
129
- ->save();
130
-
131
- return $this;
132
- }
133
-
134
- /**
135
- * Generate a unique billing agreemend reference for a customer and card combination.
136
- * The maximum length of the billing agreement ID is 32 characters.
137
- *
138
- * @param Mage_Payment_Model_Billing_AgreementAbstract $agreement
139
- * @return string
140
- * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
141
- */
142
- protected function _generateBillingAgreementId(Mage_Payment_Model_Billing_AgreementAbstract $agreement)
143
- {
144
- /**
145
- * @todo
146
- * - remove the stars as they are irrelevant
147
- * - crossover here between direct and redirect.
148
- * - this should also be available to be used as externally (eg. for Realex) ?
149
- */
150
- $payment = $agreement->getPayment();
151
-
152
- $billingAgreementId = time() . '-';
153
- $billingAgreementId .= '****' . $payment->getCcLast4() . '-';
154
- $billingAgreementId .= str_pad($payment->getCcExpMonth(), 2, '0', STR_PAD_LEFT) . '-';
155
- $billingAgreementId .= $payment->getCcExpYear();
156
-
157
- return $billingAgreementId;
158
- }
159
-
160
- /**
161
- * Set the current transaction type for creating a new agreement.
162
- *
163
- * @return Ampersand_PaymentGateway_Model_Service_Redirect_AgreementAbstract
164
- * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
165
- */
166
- public function _setTransactionType()
167
- {
168
- $this->setTransactionType(
169
- Ampersand_PaymentGateway_Model_Service_Abstract::TRANSACTION_TYPE_AGREEMENT_MANAGE
170
- );
171
-
172
- return $this;
173
- }
174
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/core/Ampersand/PaymentGateway/Model/Service/RedirectAbstract.php CHANGED
@@ -55,4 +55,15 @@ abstract class Ampersand_PaymentGateway_Model_Service_RedirectAbstract
55
 
56
  return $transformedRedirectData;
57
  }
 
 
 
 
 
 
 
 
 
 
 
58
  }
55
 
56
  return $transformedRedirectData;
57
  }
58
+
59
+ /**
60
+ * Retrieve the type of transaction for creating a billing agreement.
61
+ *
62
+ * @return string
63
+ * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
64
+ */
65
+ protected function _getCreateAgreementTransactionType()
66
+ {
67
+ return self::TRANSACTION_TYPE_AGREEMENT_CREATE_REDIRECT;
68
+ }
69
  }
app/code/core/Ampersand/PaymentGateway/Model/Source/CardType.php CHANGED
@@ -79,10 +79,45 @@ class Ampersand_PaymentGateway_Model_Source_CardType extends Mage_Payment_Model_
79
  */
80
  public function getMagentoCardType($type)
81
  {
82
- return array_key_exists($type, $this->_supportedCcTypes)
83
- ? $this->_supportedCcTypes[$type]
 
84
  : $type;
85
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
 
87
  /**
88
  * Retrieve the PaymentGateway helper class.
79
  */
80
  public function getMagentoCardType($type)
81
  {
82
+ $supportedCcTypes = $this->getSupportedCardTypes();
83
+ return array_key_exists($type, $supportedCcTypes)
84
+ ? $supportedCcTypes[$type]
85
  : $type;
86
  }
87
+
88
+ /**
89
+ * Convert a Gateway card type to a Magento card code.
90
+ * eg. 'PG_AMEX' would be converted to 'AE'
91
+ *
92
+ * @param string $type
93
+ * @return string
94
+ * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
95
+ */
96
+ public function getMagentoCardTypeCodeFromGatewayCardType($type)
97
+ {
98
+ $supportedCcTypes = $this->getSupportedCardTypes();
99
+ $magentoCardTypeKey = array_search($type, $supportedCcTypes);
100
+ if ($magentoCardTypeKey === FALSE) {
101
+ return $type;
102
+ }
103
+
104
+ return $magentoCardTypeKey;
105
+ }
106
+
107
+ /**
108
+ * Convert a Gateway card type to a Magento card type.
109
+ * eg. 'PG_AMEX' would be converted to 'American Express'
110
+ *
111
+ * @param string $type
112
+ * @return string
113
+ * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
114
+ */
115
+ public function getMagentoCardTypeFromGatewayCardType($type)
116
+ {
117
+ return $this->getMagentoCardType(
118
+ $this->getMagentoCardTypeCodeFromGatewayCardType($type)
119
+ );
120
+ }
121
 
122
  /**
123
  * Retrieve the PaymentGateway helper class.
app/code/core/Ampersand/PaymentGateway/Model/Source/EncryptorStorageType.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Ampersand_PaymentGateway_Model_Source_EncryptorStorageType
3
+ {
4
+ /**
5
+ * Available options.
6
+ */
7
+ const TYPE_COOKIE = 'cookie';
8
+ const TYPE_SESSION = 'session';
9
+ const TYPE_DEFAULT = self::TYPE_COOKIE;
10
+
11
+ /**
12
+ * Retrieve the options.
13
+ *
14
+ * @return array
15
+ * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
16
+ */
17
+ public function toOptionArray()
18
+ {
19
+ $options = array();
20
+
21
+ $options[] = array(
22
+ 'value' => self::TYPE_COOKIE,
23
+ 'label' => $this->_getHelper()->__("Cookie (recommended)")
24
+ );
25
+
26
+ $options[] = array(
27
+ 'value' => self::TYPE_SESSION,
28
+ 'label' => $this->_getHelper()->__("Session")
29
+ );
30
+
31
+ return $options;
32
+ }
33
+
34
+ /**
35
+ * Retrieve the PaymentGateway helper class.
36
+ *
37
+ * @return Ampersand_PaymentGateway_Helper_Data
38
+ * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
39
+ */
40
+ protected function _getHelper()
41
+ {
42
+ return Mage::helper('ampersand_paymentgateway/data');
43
+ }
44
+ }
app/code/core/Ampersand/PaymentGateway/Model/Utility/Encryptor.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Ampersand_PaymentGateway_Model_Utility_Encryptor
3
+ {
4
+ /**
5
+ * Delete any items that remain in the DB for longer than a defined period of time.
6
+ *
7
+ * @param int $seconds
8
+ * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
9
+ */
10
+ public function deleteExpiredItems($seconds)
11
+ {
12
+ if (!preg_match('/\d+/', $seconds) || $seconds < 1) {
13
+ Mage::throwException(
14
+ 'A value must be provided for the age, in seconds, of items to delete.'
15
+ );
16
+ }
17
+
18
+ $expiryDate = date('Y-m-d H:i:s', strtotime("-{$seconds} seconds"));
19
+ $itemCollection = Mage::getModel('ampersand_paymentgateway/encryptor')->getCollection()
20
+ ->addFieldToFilter('created_at', array('lt' => $expiryDate))
21
+ ->setOrder('entity_id', 'ASC');
22
+
23
+ foreach ($itemCollection as $_item) {
24
+ try {
25
+ $_item = Mage::getModel('ampersand_paymentgateway/encryptor')
26
+ ->load($_item->getId());
27
+
28
+ if ($_item->getId() < 1) {
29
+ continue;
30
+ }
31
+
32
+ $_item->delete();
33
+ } catch (Exception $e) {
34
+ Mage::logException($e);
35
+ }
36
+ }
37
+ }
38
+ }
app/code/core/Ampersand/PaymentGateway/Model/Utility/{Cleanup.php → Order.php} RENAMED
@@ -1,10 +1,10 @@
1
  <?php
2
- class Ampersand_PaymentGateway_Model_Utility_Cleanup
3
  {
4
  /**
5
  * Cancel orders that remain in the payment_review state longer than a defined period of time.
6
  *
7
- * @param type $hours
8
  * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
9
  */
10
  public function cancelPaymentReviewOrders($hours)
1
  <?php
2
+ class Ampersand_PaymentGateway_Model_Utility_Order
3
  {
4
  /**
5
  * Cancel orders that remain in the payment_review state longer than a defined period of time.
6
  *
7
+ * @param int $hours
8
  * @author Joseph McDermott <joseph.mcdermott@ampersandcommerce.com>
9
  */
10
  public function cancelPaymentReviewOrders($hours)
app/code/core/Ampersand/PaymentGateway/changelog.txt CHANGED
@@ -1,14 +1,30 @@
1
- 29/01/2013 - v0.1.5 - Bumping version number due to issue with Magento Connect package.
 
2
 
3
- 24/01/2013 - v0.1.4 - Improved error logging on billing agreement creation failure.
 
4
 
5
- 16/01/2013 - v0.1.3 - Moved cron expressions to system configuration.
 
6
 
7
- 16/01/2013 - v0.1.2 - Updated Ampersand_PaymentGateway_Block_Payment_Form_BillingAgreement to depend
8
- on changes from Ampersand_BillingAgreementFix due to billing agreements from
9
- incorrect methods appearing on the checkout pages.
10
 
11
- 16/01/2013 - v0.1.1 - Improved integration message logging and flags,
12
- and added custom error message functionality to all transaction types.
13
 
14
- 07/01/2013 - v0.1.0 - Initial release.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 26/03/2013 - v0.1.11 - Moved Ampersand_PaymentGateway_Helper_Data::getLocaleCode() to its own method.
2
+ Changed Ampersand_PaymentGateway_Model_Config_Abstract::getMode() to abstract.
3
 
4
+ 19/03/2013 - v0.1.10 - Improved handling of sensitive information with cleanup schedule.
5
+ Renamed Ampersand_PaymentGateway_Model_Utility_Cleanup to Xxx_Order.
6
 
7
+ 05/03/2013 - v0.1.9 - Changed logic of getPaymentInfo(), which is used to retrieve relevant information
8
+ from the payment gateway to display in the admin panel, for more flexibility.
9
 
10
+ 28/02/2013 - v0.1.8 - Bug fixed when retrieving additional information from agreement collection items.
 
 
11
 
12
+ 20/02/2013 - v0.1.7 - Billing agreement structure updated and added ability for Redirect payment methods
13
+ to create billing agreements having received the credentials from the callback response.
14
 
15
+ 13/02/2013 - v0.1.6 - Added ability for each payment method to add custom information to order view page.
16
+
17
+ 29/01/2013 - v0.1.5 - Bumping version number due to issue with Magento Connect package.
18
+
19
+ 24/01/2013 - v0.1.4 - Improved error logging on billing agreement creation failure.
20
+
21
+ 16/01/2013 - v0.1.3 - Moved cron expressions to system configuration.
22
+
23
+ 16/01/2013 - v0.1.2 - Updated Ampersand_PaymentGateway_Block_Payment_Form_BillingAgreement to depend
24
+ on changes from Ampersand_BillingAgreementFix due to billing agreements from
25
+ incorrect methods appearing on the checkout pages.
26
+
27
+ 16/01/2013 - v0.1.1 - Improved integration message logging and flags,
28
+ and added custom error message functionality to all transaction types.
29
+
30
+ 07/01/2013 - v0.1.0 - Initial release.
app/code/core/Ampersand/PaymentGateway/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Ampersand_PaymentGateway>
5
- <version>0.1.5</version>
6
  </Ampersand_PaymentGateway>
7
  </modules>
8
  <global>
@@ -31,6 +31,8 @@
31
  <transaction><table>ampersand_paymentgateway_transaction</table></transaction>
32
  <subscription><table>ampersand_paymentgateway_subscription</table></subscription>
33
  <subscription_order><table>ampersand_paymentgateway_subscription_order</table></subscription_order>
 
 
34
  </entities>
35
  </ampersand_paymentgateway_resource>
36
  </models>
@@ -186,6 +188,17 @@
186
  </ampersand_paymentgateway>
187
  </updates>
188
  </layout>
 
 
 
 
 
 
 
 
 
 
 
189
  </adminhtml>
190
  <crontab>
191
  <jobs>
@@ -213,6 +226,14 @@
213
  <model>ampersand_paymentgateway/cron::processSubscriptionReminders</model>
214
  </run>
215
  </ampersand_paymentgateway_processSubscriptionReminders>
 
 
 
 
 
 
 
 
216
  </jobs>
217
  </crontab>
218
  <default>
@@ -234,10 +255,15 @@
234
  <email_identity>general</email_identity>
235
  <email_template>ampersand_paymentgateway_subscription_reminder</email_template>
236
  </subscription>
 
 
 
 
237
  <cron_expressions>
238
  <order_cleanup>*/5 * * * *</order_cleanup>
239
  <process_subscriptions>30 * * * *</process_subscriptions>
240
  <process_subscription_reminders>* 4 * * *</process_subscription_reminders>
 
241
  </cron_expressions>
242
  </ampersand_paymentgateway>
243
  </default>
2
  <config>
3
  <modules>
4
  <Ampersand_PaymentGateway>
5
+ <version>0.1.11</version>
6
  </Ampersand_PaymentGateway>
7
  </modules>
8
  <global>
31
  <transaction><table>ampersand_paymentgateway_transaction</table></transaction>
32
  <subscription><table>ampersand_paymentgateway_subscription</table></subscription>
33
  <subscription_order><table>ampersand_paymentgateway_subscription_order</table></subscription_order>
34
+ <paymentInfo><table>ampersand_paymentgateway_payment_info</table></paymentInfo>
35
+ <encryptor><table>core_amtp</table></encryptor> <!-- purposely vague -->
36
  </entities>
37
  </ampersand_paymentgateway_resource>
38
  </models>
188
  </ampersand_paymentgateway>
189
  </updates>
190
  </layout>
191
+ <events>
192
+ <payment_info_block_prepare_specific_information>
193
+ <observers>
194
+ <ampersand_paymentgateway_payment_information>
195
+ <type>singleton</type>
196
+ <class>ampersand_paymentgateway/observer</class>
197
+ <method>appendPaymentInfoBlock</method>
198
+ </ampersand_paymentgateway_payment_information>
199
+ </observers>
200
+ </payment_info_block_prepare_specific_information>
201
+ </events>
202
  </adminhtml>
203
  <crontab>
204
  <jobs>
226
  <model>ampersand_paymentgateway/cron::processSubscriptionReminders</model>
227
  </run>
228
  </ampersand_paymentgateway_processSubscriptionReminders>
229
+ <ampersand_paymentgateway_encryptorCleanup>
230
+ <schedule>
231
+ <config_path>ampersand_paymentgateway/cron_expressions/encryptor_cleanup</config_path>
232
+ </schedule>
233
+ <run>
234
+ <model>ampersand_paymentgateway/cron::encryptorCleanup</model>
235
+ </run>
236
+ </ampersand_paymentgateway_encryptorCleanup>
237
  </jobs>
238
  </crontab>
239
  <default>
255
  <email_identity>general</email_identity>
256
  <email_template>ampersand_paymentgateway_subscription_reminder</email_template>
257
  </subscription>
258
+ <encryptor>
259
+ <lifetime>120</lifetime>
260
+ <storage_type>cookie</storage_type>
261
+ </encryptor>
262
  <cron_expressions>
263
  <order_cleanup>*/5 * * * *</order_cleanup>
264
  <process_subscriptions>30 * * * *</process_subscriptions>
265
  <process_subscription_reminders>* 4 * * *</process_subscription_reminders>
266
+ <encryptor_cleanup>*/1 * * * *</encryptor_cleanup>
267
  </cron_expressions>
268
  </ampersand_paymentgateway>
269
  </default>
app/code/core/Ampersand/PaymentGateway/etc/system.xml CHANGED
@@ -21,7 +21,7 @@
21
  <show_in_website>1</show_in_website>
22
  <show_in_store>1</show_in_store>
23
  <groups>
24
- <notification translate="label" module="ampersand_paymentgateway">
25
  <label>Issue Notification</label>
26
  <comment>Please enter comma seperated email addresses to be contacted in each of the scenarios relating to payment gateways. eg. &lt;em&gt;foo@bar.com, joe@bloggs.co.uk, etc.&lt;/em&gt;</comment>
27
  <sort_order>10</sort_order>
@@ -38,7 +38,7 @@
38
  <show_in_website>1</show_in_website>
39
  <show_in_store>0</show_in_store>
40
  </email_identity>
41
- <critical translate="label">
42
  <label>Critical Issues</label>
43
  <frontend_type>text</frontend_type>
44
  <sort_order>20</sort_order>
@@ -47,7 +47,7 @@
47
  <show_in_store>0</show_in_store>
48
  <comment>eg. Magento encountered a problem when payment might have been already taken from customer.</comment>
49
  </critical>
50
- <warning translate="label">
51
  <label>Warning Issues</label>
52
  <frontend_type>text</frontend_type>
53
  <sort_order>30</sort_order>
@@ -74,7 +74,7 @@
74
  <show_in_website>1</show_in_website>
75
  <show_in_store>0</show_in_store>
76
  </active>
77
- <order_timeframe translate="label">
78
  <label>Order Timeframe</label>
79
  <frontend_type>text</frontend_type>
80
  <sort_order>20</sort_order>
@@ -117,7 +117,7 @@
117
  <show_in_website>1</show_in_website>
118
  <show_in_store>0</show_in_store>
119
  </frequency_monthly>
120
- <lead_time translate="label">
121
  <label>Lead Time</label>
122
  <frontend_type>text</frontend_type>
123
  <sort_order>40</sort_order>
@@ -135,7 +135,7 @@
135
  <show_in_website>1</show_in_website>
136
  <show_in_store>0</show_in_store>
137
  </email_identity>
138
- <reminder_time translate="label">
139
  <label>Reminder Time</label>
140
  <frontend_type>text</frontend_type>
141
  <sort_order>60</sort_order>
@@ -146,10 +146,38 @@
146
  </reminder_time>
147
  </fields>
148
  </subscription>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
149
  <cron_expressions translate="label comment">
150
  <label>Cron Expressions</label>
151
  <frontend_type>text</frontend_type>
152
- <sort_order>40</sort_order>
153
  <show_in_default>1</show_in_default>
154
  <show_in_website>0</show_in_website>
155
  <show_in_store>0</show_in_store>
@@ -176,6 +204,13 @@
176
  <show_in_website>0</show_in_website>
177
  <show_in_store>0</show_in_store>
178
  </process_subscription_reminders>
 
 
 
 
 
 
 
179
  </fields>
180
  </cron_expressions>
181
  </groups>
21
  <show_in_website>1</show_in_website>
22
  <show_in_store>1</show_in_store>
23
  <groups>
24
+ <notification translate="label comment" module="ampersand_paymentgateway">
25
  <label>Issue Notification</label>
26
  <comment>Please enter comma seperated email addresses to be contacted in each of the scenarios relating to payment gateways. eg. &lt;em&gt;foo@bar.com, joe@bloggs.co.uk, etc.&lt;/em&gt;</comment>
27
  <sort_order>10</sort_order>
38
  <show_in_website>1</show_in_website>
39
  <show_in_store>0</show_in_store>
40
  </email_identity>
41
+ <critical translate="label comment">
42
  <label>Critical Issues</label>
43
  <frontend_type>text</frontend_type>
44
  <sort_order>20</sort_order>
47
  <show_in_store>0</show_in_store>
48
  <comment>eg. Magento encountered a problem when payment might have been already taken from customer.</comment>
49
  </critical>
50
+ <warning translate="label comment">
51
  <label>Warning Issues</label>
52
  <frontend_type>text</frontend_type>
53
  <sort_order>30</sort_order>
74
  <show_in_website>1</show_in_website>
75
  <show_in_store>0</show_in_store>
76
  </active>
77
+ <order_timeframe translate="label comment">
78
  <label>Order Timeframe</label>
79
  <frontend_type>text</frontend_type>
80
  <sort_order>20</sort_order>
117
  <show_in_website>1</show_in_website>
118
  <show_in_store>0</show_in_store>
119
  </frequency_monthly>
120
+ <lead_time translate="label comment">
121
  <label>Lead Time</label>
122
  <frontend_type>text</frontend_type>
123
  <sort_order>40</sort_order>
135
  <show_in_website>1</show_in_website>
136
  <show_in_store>0</show_in_store>
137
  </email_identity>
138
+ <reminder_time translate="label comment">
139
  <label>Reminder Time</label>
140
  <frontend_type>text</frontend_type>
141
  <sort_order>60</sort_order>
146
  </reminder_time>
147
  </fields>
148
  </subscription>
149
+ <encryptor translate="label" module="ampersand_paymentgateway">
150
+ <label>Encryptor</label>
151
+ <sort_order>40</sort_order>
152
+ <show_in_default>1</show_in_default>
153
+ <show_in_website>0</show_in_website>
154
+ <show_in_store>0</show_in_store>
155
+ <fields>
156
+ <lifetime translate="label comment">
157
+ <label>Lifetime</label>
158
+ <frontend_type>text</frontend_type>
159
+ <sort_order>10</sort_order>
160
+ <show_in_default>1</show_in_default>
161
+ <show_in_website>0</show_in_website>
162
+ <show_in_store>0</show_in_store>
163
+ <comment>The length of time, in seconds, that a cookie and encrypted value can be stored in the database. Minimum = 60, maximum = 600.</comment>
164
+ </lifetime>
165
+ <storage_type translate="label comment">
166
+ <label>Storage Type</label>
167
+ <frontend_type>select</frontend_type>
168
+ <source_model>ampersand_paymentgateway/source_encryptorStorageType</source_model>
169
+ <sort_order>20</sort_order>
170
+ <show_in_default>1</show_in_default>
171
+ <show_in_website>0</show_in_website>
172
+ <show_in_store>0</show_in_store>
173
+ <comment>Type of storage for the single-use key for decrypting potentially sensitive data during the transition from Magento order review to displaying 3D Secure or Redirect payment method form.</comment>
174
+ </storage_type>
175
+ </fields>
176
+ </encryptor>
177
  <cron_expressions translate="label comment">
178
  <label>Cron Expressions</label>
179
  <frontend_type>text</frontend_type>
180
+ <sort_order>50</sort_order>
181
  <show_in_default>1</show_in_default>
182
  <show_in_website>0</show_in_website>
183
  <show_in_store>0</show_in_store>
204
  <show_in_website>0</show_in_website>
205
  <show_in_store>0</show_in_store>
206
  </process_subscription_reminders>
207
+ <encryptor_cleanup translate="label">
208
+ <label>Encryptor Cleanup</label>
209
+ <sort_order>40</sort_order>
210
+ <show_in_default>1</show_in_default>
211
+ <show_in_website>0</show_in_website>
212
+ <show_in_store>0</show_in_store>
213
+ </encryptor_cleanup>
214
  </fields>
215
  </cron_expressions>
216
  </groups>
app/code/core/Ampersand/PaymentGateway/sql/ampersand_paymentgateway_setup/mysql4-upgrade-0.1.5-0.1.6.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $this->startSetup();
3
+
4
+ $this->run("
5
+ CREATE TABLE `{$this->getTable('ampersand_paymentgateway/paymentInfo')}` (
6
+ `entity_id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
7
+ `created_at` DATETIME NOT NULL,
8
+ `updated_at` DATETIME NOT NULL,
9
+ `payment_id` VARCHAR(255) NOT NULL,
10
+ `field` VARCHAR(255) NOT NULL,
11
+ `value` TEXT NOT NULL,
12
+ PRIMARY KEY (`entity_id`),
13
+ INDEX (`payment_id`)
14
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
15
+ ");
16
+
17
+ $this->endSetup();
app/code/core/Ampersand/PaymentGateway/sql/ampersand_paymentgateway_setup/mysql4-upgrade-0.1.9-0.1.10.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $this->startSetup();
3
+
4
+ $this->run("
5
+ CREATE TABLE `{$this->getTable('ampersand_paymentgateway/encryptor')}` (
6
+ `entity_id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
7
+ `created_at` DATETIME NOT NULL,
8
+ `information` TEXT NOT NULL,
9
+ PRIMARY KEY (`entity_id`)
10
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
11
+ ");
12
+
13
+ $this->endSetup();
app/design/adminhtml/base/default/template/ampersand_paymentgateway/payment/info/payment-info.phtml ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $paymentInfo = $this->getPaymentInfo(); ?>
2
+ <?php if (count($paymentInfo) > 0): ?>
3
+ <div class="entry-edit ampersand_paymentgateway_payment_info">
4
+
5
+ <div class="entry-edit-head">
6
+ <h4 class="icon-head head-payment-method">
7
+ <?php echo $this->__('Additional information from Payment Gateway'); ?>
8
+ </h4>
9
+ </div>
10
+
11
+ <fieldset>
12
+ <?php foreach ($paymentInfo as $_label => $_value): ?>
13
+ <div class="ampersand_paymentgateway_payment_info_item">
14
+ <h5><?php echo $this->__($_label); ?></h5>
15
+ <?php if (is_array($_value)): ?>
16
+ <table cellspacing="5">
17
+ <tbody>
18
+ <?php foreach ($_value as $__key => $__value): ?>
19
+ <tr>
20
+ <td><?php echo $__key; ?>:</td>
21
+ <td><?php echo $__value; ?></td>
22
+ </tr>
23
+ <?php endforeach; ?>
24
+ </tbody>
25
+ </table>
26
+ <?php else: ?>
27
+ <?php echo $_value; ?>
28
+ <?php endif; ?>
29
+ </div>
30
+ <?php endforeach; ?>
31
+ </fieldset>
32
+
33
+ </div>
34
+ <?php endif; ?>
app/design/frontend/base/default/template/ampersand_paymentgateway/redirect/form.phtml CHANGED
@@ -3,9 +3,11 @@
3
  <title><?php echo $this->__($this->getTitle()) ?></title>
4
  </head>
5
  <body>
6
- <?php if ($redirectUrl = $this->getRedirectUrl()): ?>
 
 
7
  <form action="<?php echo $redirectUrl ?>" name="ampersand_redirect_form" method="POST" style="width:100%; text-align:center;">
8
- <?php foreach ($this->getHiddenFields() as $_fieldName => $_value): ?>
9
  <input type="hidden" name="<?php echo $_fieldName ?>" value="<?php echo $_value ?>" />
10
  <?php endforeach; ?>
11
 
3
  <title><?php echo $this->__($this->getTitle()) ?></title>
4
  </head>
5
  <body>
6
+ <?php $redirectUrl = $this->getRedirectUrl(); ?>
7
+ <?php $hiddenFields = $this->getHiddenFields(); ?>
8
+ <?php if ($this->isFormDataProcessed() && $redirectUrl != ''): ?>
9
  <form action="<?php echo $redirectUrl ?>" name="ampersand_redirect_form" method="POST" style="width:100%; text-align:center;">
10
+ <?php foreach ($hiddenFields as $_fieldName => $_value): ?>
11
  <input type="hidden" name="<?php echo $_fieldName ?>" value="<?php echo $_value ?>" />
12
  <?php endforeach; ?>
13
 
package.xml CHANGED
@@ -1,18 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Ampersand_PaymentGateway</name>
4
- <version>0.1.5</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/gpl-license.php">GNU General Public License (GPL)</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Ampersand Payment Gateway framework from Ampersand Commerce.</summary>
10
  <description>Ampersand Payment Gateway framework from Ampersand Commerce.</description>
11
- <notes>Ampersand_PaymentGateway v0.1.5</notes>
12
  <authors><author><name>AmpersandHQ</name><user>auto-converted</user><email>magento@ampersandcommerce.com</email></author></authors>
13
- <date>2013-01-29</date>
14
- <time>17:05:28</time>
15
- <contents><target name="magelocal"><dir name="Ampersand"><dir name="BillingAgreementFix"><dir name="etc"><file name="config.xml" hash="182ff5f59378cb85f2e640dab93e1d91"/></dir><dir name="Rewrite"><dir name="Mage"><dir name="Sales"><dir name="Block"><dir name="Payment"><dir name="Form"><dir name="Billing"><file name="Agreement.php" hash="ba18d3e86edacc6455e84e682e100190"/></dir></dir></dir></dir><dir name="Model"><dir name="Billing"><file name="Agreement.php" hash="09122c7aad1b186ef87e9c79fee62940"/></dir></dir></dir><dir name="Paypal"><dir name="Helper"><file name="Data.php" hash="5eb5f7e6fcad4ff6e48e12c7d9517a7a"/></dir><dir name="Model"><dir name="Express"><file name="Checkout.php" hash="9572f6a8a94b851ea2b9f5f7caf1fee7"/></dir><dir name="Method"><file name="Agreement.php" hash="d35b02f584e0359fb12aa685b1bc94a1"/></dir></dir></dir></dir></dir></dir></dir></target><target name="magecore"><dir name="Ampersand"><dir name="PaymentGateway"><dir name="Block"><dir name="Redirect"><file name="Iframe.php" hash="b896215490bb40fdbe3a50b45f73ec7b"/><file name="Form.php" hash="199184b410f7de50cd3cf2108021120f"/><file name="Location.php" hash="aabfaf8543541d11a098145f83d3e294"/></dir><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Fieldset"><file name="Hint.php" hash="389f6fc34bb33b049a6372a68a0f52f7"/></dir></dir></dir><dir name="Subscription"><dir name="Order"><file name="Grid.php" hash="4c1df2f20be9af3c4a0754cb1761ba48"/></dir><dir name="Edit"><file name="Form.php" hash="e070aa1106a6efb043313e959ac06195"/></dir><file name="Order.php" hash="493baa23d6c205002f06f26f49b84852"/><file name="Edit.php" hash="0bc4ad5fa46cd02740fb64c027502eed"/><file name="Grid.php" hash="a64d41c912d31995f2fc0fef37922773"/></dir><file name="Subscription.php" hash="5820166cc7762b370644936a01d51530"/></dir><dir name="Checkout"><dir name="Onepage"><dir name="Review"><file name="Subscription.php" hash="888e9b4af5749dfa58f31087591eab18"/></dir></dir><dir name="Cart"><file name="Subscription.php" hash="aefee3bff9660b4a360d8a0928c7cc46"/></dir></dir><dir name="Payment"><dir name="Form"><file name="BillingAgreementCheckbox.php" hash="2057de4e06ca0c92ccfe149e39e4df11"/><file name="Subscription.php" hash="c0c27e0802aab6bf98e0e6dc60f598d7"/><file name="Redirect.php" hash="7a0db3f83604c4bae31e49694d14d362"/><file name="BillingAgreement.php" hash="f022d1358e33976ccbd97629535a3dbb"/><file name="BillingAgreementCv2.php" hash="d402e86f22f044bc2b438d0f8370106c"/></dir><dir name="Info"><file name="Redirect.php" hash="befe27b6d3a0bad1dd79d9698d15ea16"/></dir></dir><dir name="Customer"><dir name="Account"><file name="Subscription.php" hash="fa70122cb56980ccb5b1d2ccd12fc8a8"/></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="16c35ebeecaac1fdfb78b39fbfef8877"/><file name="config.xml" hash="e99fc4c852a409fac214863f7067987f"/><file name="system.xml" hash="771dbf0516800e9005ed8a6d7e46ef5a"/></dir><dir name="sql"><dir name="ampersand_paymentgateway_setup"><file name="mysql4-upgrade-0.0.1-0.0.2.php" hash="b96f410245acdab1bac40be098cdf4ce"/><file name="mysql4-upgrade-0.0.9-0.0.10.php" hash="38eef68653f1a67fde4a2052d7689026"/><file name="mysql4-upgrade-0.0.2-0.0.3.php" hash="cd17a587f66e754b93038ba15aedf3a6"/><file name="mysql4-upgrade-0.0.12-0.0.13.php" hash="518960f36caf0083ba21657a18e08ccf"/><file name="mysql4-upgrade-0.0.5-0.0.6.php" hash="10082a8a8f0c087de164e99cf98f0f57"/><file name="mysql4-upgrade-0.0.7-0.0.8.php" hash="2bd23a19b2f5f95c317422965fc28e47"/><file name="mysql4-upgrade-0.0.4-0.0.5.php" hash="1c86fbd3c84be59c3c04a74e6f7d52c2"/><file name="mysql4-upgrade-0.0.8-0.0.9.php" hash="9e5e4daa4696083b1a2ce899c7b10a7c"/><file name="mysql4-install-0.0.1.php" hash="6496424212e5efd6e4cc5475b0daef07"/><file name="mysql4-upgrade-0.0.11-0.0.12.php" hash="d395b9cf9f98d8aeefd0d5817e3fd819"/><file name="mysql4-upgrade-0.0.10-0.0.11.php" hash="f29952c10a05f075d8afb73fd0d2468f"/><file name="mysql4-upgrade-0.0.3-0.0.4.php" hash="b43beea075582cfa471dd4ce2ec394ce"/><file name="mysql4-upgrade-0.0.6-0.0.7.php" hash="04f939ff1119ef282290256eb58229d9"/><file name="mysql4-upgrade-0.0.13-0.0.14.php" hash="a5bb6ff4cccb9e6302c6a0cd6ffd77e3"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Subscription"><file name="OrderController.php" hash="ddf95460175eccc37243df6e735290bc"/></dir><file name="SubscriptionController.php" hash="07bd75822d2bb18b953fca59ea9fc597"/></dir><dir name="Checkout"><dir name="Cart"><file name="SubscriptionController.php" hash="a7f345974379aff4803449df8c8cbf70"/></dir><file name="OnepageController.php" hash="21b5e60937833c31bcb9e0a136ced557"/></dir><dir name="Customer"><dir name="Account"><file name="SubscriptionController.php" hash="0a42fdbb7fd147f39e89c1f30e95ffee"/></dir></dir><file name="RedirectController.php" hash="35364646b7e0575e4e8c94d20f64bbc5"/></dir><dir name="Helper"><file name="Subscription.php" hash="1ae9df0ec8d95a679f61b07233f275f7"/><file name="Data.php" hash="2faf1fce37e89ab5921b0312c360cb01"/></dir><dir name="Model"><dir name="Exception"><file name="Error.php" hash="4ac369ee913575b427c6d15ff60ca27c"/><file name="DenyPayment.php" hash="b0c0b45291d220e490526ffd68e8dfc4"/></dir><dir name="Utility"><file name="Cleanup.php" hash="adb699e432fd13a81112ccb84952e570"/><file name="Subscription.php" hash="d03077eaf0873032cc5380b4574aea5a"/></dir><dir name="Resource"><dir name="Subscription"><dir name="Order"><file name="Collection.php" hash="9794d1183d0ffc7ce313e74170330c07"/></dir><file name="Order.php" hash="2958956cff03a6358c648bf5ecea564e"/><file name="Collection.php" hash="d316d3cf47157d2b4cdf1e5d2873ac08"/></dir><dir name="Agreement"><file name="Collection.php" hash="62e57e9e152d3fb54b0af1fdfd3776f4"/></dir><dir name="Transaction"><file name="Collection.php" hash="8b7be054183ad76cfb9c6b7c27595fbc"/></dir><file name="Agreement.php" hash="dcfc1ec7df22bd0ce24b64d332021e5a"/><file name="Subscription.php" hash="f5f927e1793f44fa384eb2aead41ee81"/><file name="Transaction.php" hash="7ca37cc46a5b24faa7658a61e47633e2"/></dir><dir name="Compatibility"><dir name="Mage"><dir name="Sales"><dir name="Model"><dir name="Order"><file name="Payment.php" hash="25de73c00d619ec65c2696906b35dfad"/></dir></dir></dir></dir></dir><dir name="Service"><dir name="Redirect"><file name="AgreementAbstract.php" hash="591733d0e48090a85899bf3701c1b0bc"/></dir><dir name="Direct"><file name="AgreementAbstract.php" hash="20ca0bebc7bceb30e0433aa316a5ed28"/></dir><file name="RedirectAbstract.php" hash="58ce2bcaa0197decba0bd17667e459fe"/><file name="Abstract.php" hash="3883464fa60b108b68a7ab5e3ee1553d"/><file name="DirectAbstract.php" hash="300c7144e500fd3e11489f2ef1b778c4"/></dir><dir name="Subscription"><file name="Order.php" hash="07c91afd16d567c6dcddee9374be97c8"/></dir><dir name="Method"><file name="RedirectAbstract.php" hash="fed166e8061a60c3730ace82612b343f"/><file name="AgreementAbstract.php" hash="73f51504d57b40de32a985e9c6d44465"/><file name="DirectAbstract.php" hash="41b092dfb0cfde9416d391c9e4b95ee5"/></dir><dir name="Adapter"><dir name="Redirect"><dir name="Agreement"><file name="ManageInterface.php" hash="06223d8ed9a015bf832450d829e4fd48"/></dir><file name="AuthCaptureInterface.php" hash="09405bde3024517a956a237b894f1808"/><file name="RefundInterface.php" hash="cb010029d08a9c1498356beea30f6627"/><file name="PartialInterface.php" hash="0593ecac5b49059960c7b185d550541e"/></dir><dir name="Direct"><dir name="Agreement"><file name="ManageInterface.php" hash="bfffa9aa8a4a5e5e1bba5d78a7475250"/></dir><file name="AuthCaptureInterface.php" hash="bea835c956bcf5c55a93074848e14a48"/><file name="RefundInterface.php" hash="b200ea17ac958bee2eefd5294ac4052e"/><file name="PartialInterface.php" hash="7b9b9f62e1b4ed310d281921f183b70d"/></dir><file name="Abstract.php" hash="a126350c16d111552caba7c422a3100d"/><file name="Interface.php" hash="887febfe4eafd98f285f9b6082462667"/></dir><dir name="Config"><file name="Abstract.php" hash="ebc3c7e63825c7e297ff9f19e8a10e1c"/></dir><dir name="Source"><file name="PaymentAction.php" hash="d94d62d900aac83e8bba6fe5d3459a70"/><file name="SubscriptionPeriods.php" hash="fdab5f7c2fdbb5f389facf94b9dae123"/><file name="AgreementMethod.php" hash="56add32f8838ac9a169c64ed6baa3318"/><file name="OrderStatus.php" hash="8a84a227a49229162a0310d604529165"/><file name="CardType.php" hash="b715c5b5605d84ce6561cc40418010ec"/></dir><file name="Email.php" hash="e03cb77df1a3d0fec0da4ebe26af2221"/><file name="Versioning.php" hash="ccf112f9a2e0a0c70003895989d42752"/><file name="Agreement.php" hash="f595fcd31730466fc8d11589d1e93f15"/><file name="Subscription.php" hash="0b8078fd132bd6290714aad293dfb332"/><file name="Transaction.php" hash="971544deae8e8cc4036e1f2fe9685435"/><file name="Cron.php" hash="3b53d7479628f06f769abbc53a6404e0"/><file name="Observer.php" hash="8f5d8cd814b821284c31ac7ba916f874"/></dir><file name="changelog.txt" hash="fc5f62aec5acfee57083a78fc7794caf"/></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="ampersand_paymentgateway.xml" hash="3b70309300dfed71a62b73578869fc5d"/></dir><dir name="template"><dir name="ampersand_paymentgateway"><dir name="customer"><dir name="account"><file name="subscription.phtml" hash="73825035ff1e2b1bf17f85502317acc9"/></dir></dir><dir name="redirect"><file name="iframe.phtml" hash="129820e210e01662bab8afd5f24fac7d"/><file name="location.phtml" hash="aef0c86a5dea767c81b287b7ba8551d0"/><file name="form.phtml" hash="42f2ddb4f1473271d8ec5c3cd9814654"/></dir><dir name="payment"><dir name="form"><file name="billing-agreement-cv2.phtml" hash="f41a166c9d7b9b6cb780e0304890504b"/><file name="billing-agreement-checkbox.phtml" hash="57c5e2d3813acaaf6c054adb5cfd0d5f"/><file name="redirect.phtml" hash="1decc25cf3907d7ef05be8748aea6322"/></dir></dir><dir name="sales"><dir name="payment"><dir name="form"><dir name="billing"><file name="agreement.phtml" hash="fc256f93338c1a244efb0a74a27e11fb"/></dir></dir></dir></dir><dir name="checkout"><dir name="cart"><file name="subscription.phtml" hash="0bf84cb7a162e8b4936e261752b6c20e"/></dir><dir name="onepage"><dir name="review"><file name="subscription.phtml" hash="f3cc1076c65ee3ae0e959888b39b54c1"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="base"><dir name="default"><dir name="layout"><file name="ampersand_paymentgateway.xml" hash="b7dfcf1a57cf6d79d261ad91d266db2e"/></dir><dir name="template"><dir name="ampersand_paymentgateway"><dir name="system"><dir name="config"><dir name="fieldset"><file name="hint.phtml" hash="3f10f63632a280153a96ec9f90784568"/></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Ampersand_PaymentGateway.xml" hash="80480a17487715a70e009757cd3c3dfe"/><file name="Ampersand_BillingAgreementFix.xml" hash="1d213328275ec29e62a7f580b7926604"/></dir></target><target name="magelocale"><dir name="en_US"><dir name="template"><dir name="email"><dir name="ampersand_paymentgateway"><file name="subscription_reminder.html" hash="79262315a694fcb63de89baf66ef6ce6"/><file name="notification.html" hash="dea93b8b048571ac1a527260838b15fd"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="ampersand_paymentgateway"><dir name="css"><file name="checkout.css" hash="dfa4f36777bb549531f550d32e25d96e"/><file name="cart.css" hash="65dc2c9e22a28242060f23871af9c38e"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="base"><dir name="default"><dir name="ampersand_paymentgateway"><dir name="images"><file name="logo.gif" hash="098947bdb00786d3632235ff1cebb9c6"/></dir><dir name="css"><file name="styles.css" hash="587ac33018919b134d96b04ea98b6359"/></dir></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="ampersand_paymentgateway"><file name="validation.js" hash="33042d5bd59da47ea0ba00af24f86894"/></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies/>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Ampersand_PaymentGateway</name>
4
+ <version>0.1.11</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/gpl-license.php">GNU General Public License (GPL)</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Ampersand Payment Gateway framework from Ampersand Commerce.</summary>
10
  <description>Ampersand Payment Gateway framework from Ampersand Commerce.</description>
11
+ <notes>Ampersand_PaymentGateway v0.1.11</notes>
12
  <authors><author><name>AmpersandHQ</name><user>auto-converted</user><email>magento@ampersandcommerce.com</email></author></authors>
13
+ <date>2013-03-28</date>
14
+ <time>11:25:02</time>
15
+ <contents><target name="magelocal"><dir name="Ampersand"><dir name="BillingAgreementFix"><dir name="etc"><file name="config.xml" hash="182ff5f59378cb85f2e640dab93e1d91"/></dir><dir name="Rewrite"><dir name="Mage"><dir name="Sales"><dir name="Block"><dir name="Payment"><dir name="Form"><dir name="Billing"><file name="Agreement.php" hash="ba18d3e86edacc6455e84e682e100190"/></dir></dir></dir></dir><dir name="Model"><dir name="Billing"><file name="Agreement.php" hash="09122c7aad1b186ef87e9c79fee62940"/></dir></dir></dir><dir name="Paypal"><dir name="Helper"><file name="Data.php" hash="5eb5f7e6fcad4ff6e48e12c7d9517a7a"/></dir><dir name="Model"><dir name="Express"><file name="Checkout.php" hash="9572f6a8a94b851ea2b9f5f7caf1fee7"/></dir><dir name="Method"><file name="Agreement.php" hash="d35b02f584e0359fb12aa685b1bc94a1"/></dir></dir></dir></dir></dir></dir></dir></target><target name="magecore"><dir name="Ampersand"><dir name="PaymentGateway"><dir name="Block"><dir name="Redirect"><file name="Iframe.php" hash="b896215490bb40fdbe3a50b45f73ec7b"/><file name="Form.php" hash="d27999a0f4f1263d11dff3b4d2894368"/><file name="Location.php" hash="aabfaf8543541d11a098145f83d3e294"/></dir><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Fieldset"><file name="Hint.php" hash="389f6fc34bb33b049a6372a68a0f52f7"/></dir></dir></dir><dir name="Subscription"><dir name="Order"><file name="Grid.php" hash="4c1df2f20be9af3c4a0754cb1761ba48"/></dir><dir name="Edit"><file name="Form.php" hash="e070aa1106a6efb043313e959ac06195"/></dir><file name="Order.php" hash="493baa23d6c205002f06f26f49b84852"/><file name="Edit.php" hash="0bc4ad5fa46cd02740fb64c027502eed"/><file name="Grid.php" hash="a64d41c912d31995f2fc0fef37922773"/></dir><file name="Subscription.php" hash="5820166cc7762b370644936a01d51530"/></dir><dir name="Checkout"><dir name="Onepage"><dir name="Review"><file name="Subscription.php" hash="888e9b4af5749dfa58f31087591eab18"/></dir></dir><dir name="Cart"><file name="Subscription.php" hash="aefee3bff9660b4a360d8a0928c7cc46"/></dir></dir><dir name="Payment"><dir name="Form"><file name="BillingAgreementCheckbox.php" hash="2057de4e06ca0c92ccfe149e39e4df11"/><file name="Subscription.php" hash="c0c27e0802aab6bf98e0e6dc60f598d7"/><file name="Redirect.php" hash="7a0db3f83604c4bae31e49694d14d362"/><file name="BillingAgreement.php" hash="f022d1358e33976ccbd97629535a3dbb"/><file name="BillingAgreementCv2.php" hash="d402e86f22f044bc2b438d0f8370106c"/></dir><dir name="Info"><file name="Redirect.php" hash="befe27b6d3a0bad1dd79d9698d15ea16"/></dir></dir><dir name="Customer"><dir name="Account"><file name="Subscription.php" hash="fa70122cb56980ccb5b1d2ccd12fc8a8"/></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="16c35ebeecaac1fdfb78b39fbfef8877"/><file name="config.xml" hash="ec5aa9fd838b51eeb58676c540317cff"/><file name="system.xml" hash="75b5da153055775011114c74881637df"/></dir><dir name="sql"><dir name="ampersand_paymentgateway_setup"><file name="mysql4-upgrade-0.0.1-0.0.2.php" hash="b96f410245acdab1bac40be098cdf4ce"/><file name="mysql4-upgrade-0.0.9-0.0.10.php" hash="38eef68653f1a67fde4a2052d7689026"/><file name="mysql4-upgrade-0.0.2-0.0.3.php" hash="cd17a587f66e754b93038ba15aedf3a6"/><file name="mysql4-upgrade-0.0.12-0.0.13.php" hash="518960f36caf0083ba21657a18e08ccf"/><file name="mysql4-upgrade-0.0.5-0.0.6.php" hash="10082a8a8f0c087de164e99cf98f0f57"/><file name="mysql4-upgrade-0.0.7-0.0.8.php" hash="2bd23a19b2f5f95c317422965fc28e47"/><file name="mysql4-upgrade-0.0.4-0.0.5.php" hash="1c86fbd3c84be59c3c04a74e6f7d52c2"/><file name="mysql4-upgrade-0.1.9-0.1.10.php" hash="dc0db40ddef773f24aca9dbf3ad39029"/><file name="mysql4-upgrade-0.0.8-0.0.9.php" hash="9e5e4daa4696083b1a2ce899c7b10a7c"/><file name="mysql4-install-0.0.1.php" hash="6496424212e5efd6e4cc5475b0daef07"/><file name="mysql4-upgrade-0.0.11-0.0.12.php" hash="d395b9cf9f98d8aeefd0d5817e3fd819"/><file name="mysql4-upgrade-0.0.10-0.0.11.php" hash="f29952c10a05f075d8afb73fd0d2468f"/><file name="mysql4-upgrade-0.0.3-0.0.4.php" hash="b43beea075582cfa471dd4ce2ec394ce"/><file name="mysql4-upgrade-0.0.6-0.0.7.php" hash="04f939ff1119ef282290256eb58229d9"/><file name="mysql4-upgrade-0.0.13-0.0.14.php" hash="a5bb6ff4cccb9e6302c6a0cd6ffd77e3"/><file name="mysql4-upgrade-0.1.5-0.1.6.php" hash="be5b9b7f8dd33f211ae7c16ee1028dce"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Subscription"><file name="OrderController.php" hash="ddf95460175eccc37243df6e735290bc"/></dir><file name="SubscriptionController.php" hash="07bd75822d2bb18b953fca59ea9fc597"/></dir><dir name="Checkout"><dir name="Cart"><file name="SubscriptionController.php" hash="a7f345974379aff4803449df8c8cbf70"/></dir><file name="OnepageController.php" hash="21b5e60937833c31bcb9e0a136ced557"/></dir><dir name="Customer"><dir name="Account"><file name="SubscriptionController.php" hash="0a42fdbb7fd147f39e89c1f30e95ffee"/></dir></dir><file name="RedirectController.php" hash="35364646b7e0575e4e8c94d20f64bbc5"/></dir><dir name="Helper"><file name="Subscription.php" hash="1ae9df0ec8d95a679f61b07233f275f7"/><file name="Data.php" hash="ff4b7674ec527189de94a8893bbeeb93"/></dir><dir name="Model"><dir name="Exception"><file name="Error.php" hash="4ac369ee913575b427c6d15ff60ca27c"/><file name="DenyPayment.php" hash="b0c0b45291d220e490526ffd68e8dfc4"/></dir><dir name="Utility"><file name="Order.php" hash="47808179695d5896ec57e04cd64a7a9f"/><file name="Subscription.php" hash="d03077eaf0873032cc5380b4574aea5a"/><file name="Encryptor.php" hash="8f03d6b76461d3700fadb2ce312c2e47"/></dir><dir name="Resource"><dir name="Encryptor"><file name="Collection.php" hash="852cfd93886da3e76f3c45acde4595b5"/></dir><dir name="Subscription"><dir name="Order"><file name="Collection.php" hash="9794d1183d0ffc7ce313e74170330c07"/></dir><file name="Order.php" hash="2958956cff03a6358c648bf5ecea564e"/><file name="Collection.php" hash="d316d3cf47157d2b4cdf1e5d2873ac08"/></dir><dir name="Agreement"><file name="Collection.php" hash="8eb8fca6c042fe9bfd196cbbf64996f1"/></dir><dir name="Transaction"><file name="Collection.php" hash="8b7be054183ad76cfb9c6b7c27595fbc"/></dir><dir name="PaymentInfo"><file name="Collection.php" hash="023bad0d605c3fa8fc6e91d1b71f1711"/></dir><file name="PaymentInfo.php" hash="f093013cafdf4e90a373b465fb1e09ad"/><file name="Agreement.php" hash="dcfc1ec7df22bd0ce24b64d332021e5a"/><file name="Subscription.php" hash="f5f927e1793f44fa384eb2aead41ee81"/><file name="Transaction.php" hash="7ca37cc46a5b24faa7658a61e47633e2"/><file name="Encryptor.php" hash="3b1628a7ec59b5bd25280d9236ce94dc"/></dir><dir name="Compatibility"><dir name="Mage"><dir name="Sales"><dir name="Model"><dir name="Order"><file name="Payment.php" hash="25de73c00d619ec65c2696906b35dfad"/></dir></dir></dir></dir></dir><dir name="Service"><file name="RedirectAbstract.php" hash="fc6a896415cbbad9a8b04b221b9d514e"/><file name="AgreementAbstract.php" hash="89b0c49ed0f4cf0d6c12b2b51a4e9ae8"/><file name="Abstract.php" hash="93c2146fe9a5dea06d9f293c7e8c4dd6"/><file name="DirectAbstract.php" hash="541f1cbce88d781bed2e7f04f7453945"/></dir><dir name="Subscription"><file name="Order.php" hash="07c91afd16d567c6dcddee9374be97c8"/></dir><dir name="Method"><file name="RedirectAbstract.php" hash="fed166e8061a60c3730ace82612b343f"/><file name="AgreementAbstract.php" hash="73f51504d57b40de32a985e9c6d44465"/><file name="DirectAbstract.php" hash="41b092dfb0cfde9416d391c9e4b95ee5"/></dir><dir name="Adapter"><dir name="Redirect"><file name="AuthCaptureInterface.php" hash="df746c0af2ebd7cec75393a7823395a6"/><file name="RefundInterface.php" hash="47b73ff9f4df8898169ceb6806e56e11"/><file name="PartialInterface.php" hash="0202182d017adcc232158f1d334963fa"/></dir><dir name="Direct"><file name="AuthCaptureInterface.php" hash="f4b252722efbd660bb51a81f6ddb89ba"/><file name="RefundInterface.php" hash="b9c08aaeff738595107db65b2b578644"/><file name="PartialInterface.php" hash="86782fa288b08fbaae0b15aaab314ad6"/></dir><dir name="Agreement"><file name="ManageInterface.php" hash="53f3aa3d00f7dfff4b799282204f4847"/><file name="CreateInterface.php" hash="41d3011c099de9ae372f9bcf60c92053"/></dir><file name="Abstract.php" hash="c7c01b8094cda569501920b69921c287"/><file name="Interface.php" hash="887febfe4eafd98f285f9b6082462667"/></dir><dir name="Config"><file name="Abstract.php" hash="30b71035f384e350a2071e233e0d353c"/></dir><dir name="Source"><file name="PaymentAction.php" hash="d94d62d900aac83e8bba6fe5d3459a70"/><file name="SubscriptionPeriods.php" hash="fdab5f7c2fdbb5f389facf94b9dae123"/><file name="AgreementMethod.php" hash="56add32f8838ac9a169c64ed6baa3318"/><file name="OrderStatus.php" hash="8a84a227a49229162a0310d604529165"/><file name="EncryptorStorageType.php" hash="a44ee883c792f3c1af7e07d265ddb731"/><file name="CardType.php" hash="bd6a2cd7d4ed013b0a244d666291ca6f"/></dir><file name="Email.php" hash="e03cb77df1a3d0fec0da4ebe26af2221"/><file name="Versioning.php" hash="ccf112f9a2e0a0c70003895989d42752"/><file name="PaymentInfo.php" hash="9a4bf37468dc68b7f1300bdfd1f0080c"/><file name="Agreement.php" hash="f595fcd31730466fc8d11589d1e93f15"/><file name="Subscription.php" hash="0b8078fd132bd6290714aad293dfb332"/><file name="Transaction.php" hash="971544deae8e8cc4036e1f2fe9685435"/><file name="Encryptor.php" hash="47a3d09aa175bc6d1327c7763eca4815"/><file name="Cron.php" hash="26fe7436ec01dbbc989587f8315dc6bf"/><file name="Observer.php" hash="28c83f6de3c499407ba64a22286f06c3"/></dir><file name="changelog.txt" hash="07bd88ebb58159d98028f98008b9fca8"/></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="ampersand_paymentgateway.xml" hash="3b70309300dfed71a62b73578869fc5d"/></dir><dir name="template"><dir name="ampersand_paymentgateway"><dir name="customer"><dir name="account"><file name="subscription.phtml" hash="73825035ff1e2b1bf17f85502317acc9"/></dir></dir><dir name="redirect"><file name="iframe.phtml" hash="129820e210e01662bab8afd5f24fac7d"/><file name="location.phtml" hash="aef0c86a5dea767c81b287b7ba8551d0"/><file name="form.phtml" hash="34118190ed5afa15cd4e9b3376239867"/></dir><dir name="payment"><dir name="form"><file name="billing-agreement-cv2.phtml" hash="f41a166c9d7b9b6cb780e0304890504b"/><file name="billing-agreement-checkbox.phtml" hash="57c5e2d3813acaaf6c054adb5cfd0d5f"/><file name="redirect.phtml" hash="1decc25cf3907d7ef05be8748aea6322"/></dir></dir><dir name="sales"><dir name="payment"><dir name="form"><dir name="billing"><file name="agreement.phtml" hash="fc256f93338c1a244efb0a74a27e11fb"/></dir></dir></dir></dir><dir name="checkout"><dir name="cart"><file name="subscription.phtml" hash="0bf84cb7a162e8b4936e261752b6c20e"/></dir><dir name="onepage"><dir name="review"><file name="subscription.phtml" hash="f3cc1076c65ee3ae0e959888b39b54c1"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="base"><dir name="default"><dir name="layout"><file name="ampersand_paymentgateway.xml" hash="b7dfcf1a57cf6d79d261ad91d266db2e"/></dir><dir name="template"><dir name="ampersand_paymentgateway"><dir name="payment"><dir name="info"><file name="payment-info.phtml" hash="be724367a7a703c70e2024ab1d4b28fc"/></dir></dir><dir name="system"><dir name="config"><dir name="fieldset"><file name="hint.phtml" hash="3f10f63632a280153a96ec9f90784568"/></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Ampersand_PaymentGateway.xml" hash="80480a17487715a70e009757cd3c3dfe"/><file name="Ampersand_BillingAgreementFix.xml" hash="1d213328275ec29e62a7f580b7926604"/></dir></target><target name="magelocale"><dir name="en_US"><dir name="template"><dir name="email"><dir name="ampersand_paymentgateway"><file name="subscription_reminder.html" hash="79262315a694fcb63de89baf66ef6ce6"/><file name="notification.html" hash="dea93b8b048571ac1a527260838b15fd"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="ampersand_paymentgateway"><dir name="css"><file name="checkout.css" hash="dfa4f36777bb549531f550d32e25d96e"/><file name="cart.css" hash="65dc2c9e22a28242060f23871af9c38e"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="base"><dir name="default"><dir name="ampersand_paymentgateway"><dir name="images"><file name="logo.gif" hash="098947bdb00786d3632235ff1cebb9c6"/></dir><dir name="css"><file name="styles.css" hash="476b0d182c430f90f8c3d887c45c3e91"/></dir></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="ampersand_paymentgateway"><file name="validation.js" hash="33042d5bd59da47ea0ba00af24f86894"/></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies/>
18
  </package>
skin/adminhtml/base/default/ampersand_paymentgateway/css/styles.css CHANGED
@@ -13,4 +13,18 @@
13
 
14
  .ampersand-paymentgateway-payment-notice p {
15
  margin: 0px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  }
13
 
14
  .ampersand-paymentgateway-payment-notice p {
15
  margin: 0px;
16
+ }
17
+
18
+ /* Sales > Order > View > Payment Information */
19
+
20
+ .ampersand_paymentgateway_payment_info {
21
+ margin-top: 10px;
22
+ }
23
+
24
+ .ampersand_paymentgateway_payment_info fieldset {
25
+ padding-bottom: 0px;
26
+ }
27
+
28
+ .ampersand_paymentgateway_payment_info_item {
29
+ margin-bottom: 10px;
30
  }