AMG_SecurePay - Version 0.1.0

Version Notes

AMG_SecurePay

Download this release

Release Info

Developer AMG
Extension AMG_SecurePay
Version 0.1.0
Comparing to
See all releases


Version 0.1.0

Files changed (26) hide show
  1. app/code/community/AMG/SecurePay/Block/Customer/Storedcard.php +30 -0
  2. app/code/community/AMG/SecurePay/Block/Directpost/Customervault/Form.php +20 -0
  3. app/code/community/AMG/SecurePay/Block/Directpost/Form.php +14 -0
  4. app/code/community/AMG/SecurePay/Helper/Data.php +162 -0
  5. app/code/community/AMG/SecurePay/Model/Api.php +371 -0
  6. app/code/community/AMG/SecurePay/Model/Customervault.php +62 -0
  7. app/code/community/AMG/SecurePay/Model/Directpost.php +163 -0
  8. app/code/community/AMG/SecurePay/Model/Directpost/Customervault.php +112 -0
  9. app/code/community/AMG/SecurePay/Model/Directpost/Customervault/Source/PaymentAction.php +25 -0
  10. app/code/community/AMG/SecurePay/Model/Directpost/Source/PaymentAction.php +25 -0
  11. app/code/community/AMG/SecurePay/Model/Mysql4/Customervault.php +52 -0
  12. app/code/community/AMG/SecurePay/Model/Mysql4/Customervault/Collection.php +9 -0
  13. app/code/community/AMG/SecurePay/Model/Observer.php +104 -0
  14. app/code/community/AMG/SecurePay/controllers/StoredcardController.php +40 -0
  15. app/code/community/AMG/SecurePay/etc/config.xml +131 -0
  16. app/code/community/AMG/SecurePay/etc/system.xml +246 -0
  17. app/code/community/AMG/SecurePay/sql/securepay_setup/mysql4-install-0.1.0.php +32 -0
  18. app/design/adminhtml/default/default/template/AMG/securepay/directpost/customervault/form.phtml +19 -0
  19. app/design/adminhtml/default/default/template/AMG/securepay/directpost/form.phtml +67 -0
  20. app/design/frontend/base/default/layout/AMG/securepay.xml +19 -0
  21. app/design/frontend/base/default/template/AMG/securepay/customer/storedcard.phtml +39 -0
  22. app/design/frontend/base/default/template/AMG/securepay/directpost/customervault/form.phtml +19 -0
  23. app/design/frontend/base/default/template/AMG/securepay/directpost/form.phtml +98 -0
  24. app/etc/modules/AMG_SecurePay.xml +9 -0
  25. app/locale/en_US/AMG/SecurePay.csv +1 -0
  26. package.xml +18 -0
app/code/community/AMG/SecurePay/Block/Customer/Storedcard.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class AMG_SecurePay_Block_Customer_Storedcard extends Mage_Core_Block_Template
3
+ {
4
+ protected function _prepareLayout()
5
+ {
6
+ parent::_prepareLayout();
7
+ if($head = $this->getLayout()->getBlock('head')){
8
+ $head->setTitle($this->__('My Credit Cards'));
9
+ }
10
+ }
11
+
12
+ public function getStoredCards()
13
+ {
14
+ if(Mage::getSingleton('customer/session')->isLoggedIn()){
15
+ $loggedInCustomerId = Mage::getSingleton('customer/session')->getCustomer()->getId();
16
+ if($loggedInCustomerId>0){
17
+ $collection = Mage::getModel('securepay/customervault')->getCollection()
18
+ ->addFieldToFilter('customer_id',$loggedInCustomerId);
19
+ if(count($collection)>0)
20
+ return $collection;
21
+ }
22
+ }
23
+ return array();
24
+ }
25
+
26
+ public function getDeleteUrl($storedCard)
27
+ {
28
+ return $this->getUrl('*/*/delete', array('c'=>$storedCard->getCode()));
29
+ }
30
+ }
app/code/community/AMG/SecurePay/Block/Directpost/Customervault/Form.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class AMG_SecurePay_Block_Directpost_Customervault_Form extends Mage_Payment_Block_Form_Cc
3
+ {
4
+ protected function _construct()
5
+ {
6
+ parent::_construct();
7
+ $this->setTemplate('AMG/securepay/directpost/customervault/form.phtml');
8
+
9
+ }
10
+
11
+ public function getCustomerVaultsCollection()
12
+ {
13
+ $customerId = Mage::helper('securepay')->getCurrentQuoteCustomerId();
14
+ if($customerId>0){
15
+ return Mage::getModel('securepay/customervault')->getCollection()
16
+ ->addFieldToFilter('customer_id',$customerId);
17
+ }
18
+ return array();
19
+ }
20
+ }
app/code/community/AMG/SecurePay/Block/Directpost/Form.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class AMG_SecurePay_Block_Directpost_Form extends Mage_Payment_Block_Form_Cc
3
+ {
4
+ protected function _construct()
5
+ {
6
+ parent::_construct();
7
+ $this->setTemplate('AMG/securepay/directpost/form.phtml');
8
+ }
9
+
10
+ public function isCcSaveAllowed()
11
+ {
12
+ return Mage::helper('securepay')->isCcSaveAllowed();
13
+ }
14
+ }
app/code/community/AMG/SecurePay/Helper/Data.php ADDED
@@ -0,0 +1,162 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class AMG_SecurePay_Helper_Data extends Mage_Core_Helper_Abstract
3
+ {
4
+ const TYPE_SALE = 'sale';
5
+ const TYPE_AUTHORIZATION = 'auth';
6
+ const TYPE_CAPTURE = 'capture';
7
+ const TYPE_REFUND = 'refund';
8
+ const TYPE_ADD_CUSTOMER_VAULT = 'add_customer';
9
+ const TYPE_UPDATE_CUSTOMER_VAULT = 'update_customer';
10
+
11
+ const DEFAULT_DUP_SECONDS = 0;
12
+ const DEFAULT_AMG_PAYMENT_TYPE = 'creditcard';
13
+
14
+ protected $_ccTypes = array();
15
+
16
+ public function isPaymentMethodAvailable()
17
+ {
18
+ $apiId = trim($this->getAmgApiId());
19
+ $transKey = trim($this->getAmgTransKey());
20
+ $gatewayUrl = trim($this->getAmgGatewayUrl());
21
+
22
+ if($apiId!='' && $transKey!='' && $gatewayUrl!='')
23
+ return true;
24
+
25
+ return false;
26
+ }
27
+
28
+ public function getAmgApiId()
29
+ {
30
+ return Mage::getStoreConfig('payment/securepay_directpost/api_id');
31
+ }
32
+
33
+ public function getAmgTransKey()
34
+ {
35
+ return Mage::getStoreConfig('payment/securepay_directpost/trans_key');
36
+ }
37
+
38
+ public function getAmgGatewayUrl()
39
+ {
40
+ return Mage::getStoreConfig('payment/securepay_directpost/gateway_url');
41
+ }
42
+
43
+ public function getUseCcv()
44
+ {
45
+ return Mage::getStoreConfigFlag('payment/securepay_directpost/useccv');
46
+ }
47
+
48
+ public function isLogEnabled()
49
+ {
50
+ return Mage::getStoreConfigFlag('payment/securepay_directpost/log');
51
+ }
52
+
53
+ public function getDuplicateTransSeconds()
54
+ {
55
+ if(Mage::getStoreConfig('payment/securepay_directpost/dup_seconds'))
56
+ return Mage::getStoreConfig('payment/securepay_directpost/dup_seconds');
57
+ return self::DEFAULT_DUP_SECONDS;
58
+ }
59
+
60
+ public function getDuplicateTransSecondsFeatureEnabled()
61
+ {
62
+ return Mage::getStoreConfigFlag('payment/securepay_directpost/check_dup_seconds');
63
+ }
64
+
65
+ public function getApiPaymentType()
66
+ {
67
+ return self::DEFAULT_AMG_PAYMENT_TYPE;
68
+ }
69
+
70
+ public function getApiAuthorizationType()
71
+ {
72
+ return self::TYPE_AUTHORIZATION;
73
+ }
74
+
75
+ public function getAddCustomerVaultType()
76
+ {
77
+ return self::TYPE_ADD_CUSTOMER_VAULT;
78
+ }
79
+
80
+ public function getUpdateCustomerVaultType()
81
+ {
82
+ return self::TYPE_UPDATE_CUSTOMER_VAULT;
83
+ }
84
+
85
+ public function getApiCaptureType()
86
+ {
87
+ return self::TYPE_CAPTURE;
88
+ }
89
+
90
+ public function getApiRefundType()
91
+ {
92
+ return self::TYPE_REFUND;
93
+ }
94
+
95
+ public function getApiSaleType()
96
+ {
97
+ return self::TYPE_SALE;
98
+ }
99
+
100
+ public function getPaymentMethodAdditionalInfoFields()
101
+ {
102
+ return array('cc_save_future_directpost','customervault_id','amg_customer_vault_id');
103
+ }
104
+
105
+ public function getLogDir()
106
+ {
107
+ return Mage::getBaseDir().DS.'var'.DS.'log'.DS.'AMG'.DS.'SecurePay';
108
+ }
109
+
110
+ protected function _getCcTypes()
111
+ {
112
+ if(empty($this->_ccTypes)){
113
+ $this->_ccTypes = Mage::getSingleton('payment/config')->getCcTypes();
114
+ }
115
+
116
+ return $this->_ccTypes;
117
+ }
118
+
119
+ public function translateCcType($ccTypeShort)
120
+ {
121
+ $ccTypes = $this->_getCcTypes();
122
+ if ( !empty($ccTypes) && $ccTypeShort && isset($ccTypes[$ccTypeShort]) ) {
123
+ return $ccTypes[$ccTypeShort];
124
+ }
125
+
126
+ return '';
127
+ }
128
+
129
+ public function getCurrentQuoteCustomerId()
130
+ {
131
+ if(Mage::getSingleton('admin/session')->isLoggedIn()){
132
+ $quote = Mage::getSingleton('adminhtml/session_quote')->getQuote();
133
+ if($quote){
134
+ if($quote->getId()){
135
+ if($quote->getCustomerId()){
136
+ return $quote->getCustomerId();
137
+ }
138
+ }
139
+ }
140
+ }
141
+ else{
142
+ if(Mage::getSingleton('customer/session')->isLoggedIn()){
143
+ $loggedInCustomerId = Mage::getSingleton('customer/session')->getCustomer()->getId();
144
+ if($loggedInCustomerId>0)
145
+ return $loggedInCustomerId;
146
+ }
147
+ }
148
+
149
+ return 0;
150
+ }
151
+
152
+ public function isCcSaveAllowed()
153
+ {
154
+ if(Mage::getStoreConfigFlag('payment/securepay_directpost/allowsavecc')){
155
+ $customerId = $this->getCurrentQuoteCustomerId();
156
+ if($customerId>0)
157
+ return true;
158
+ }
159
+ return false;
160
+ }
161
+ }
162
+
app/code/community/AMG/SecurePay/Model/Api.php ADDED
@@ -0,0 +1,371 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class AMG_SecurePay_Model_Api extends Mage_Core_Model_Abstract
3
+ {
4
+ protected $_helper;
5
+ protected $_payment;
6
+ protected $_order;
7
+ protected $_amount;
8
+
9
+ public function _construct()
10
+ {
11
+ parent::_construct();
12
+ $this->_helper = Mage::helper('securepay');
13
+ }
14
+
15
+ public function isPaymentMethodAvailable()
16
+ {
17
+ return $this->_helper->isPaymentMethodAvailable();
18
+ }
19
+
20
+ public function setPayment(Varien_Object $payment)
21
+ {
22
+ if($payment){
23
+ $this->_payment = $payment;
24
+ $order = $payment->getOrder();
25
+ if($order && $order->getId()){
26
+ $this->_order = $order;
27
+ }
28
+ }
29
+ }
30
+
31
+ public function setAmount($amount)
32
+ {
33
+ $this->_amount = $amount;
34
+ }
35
+
36
+ protected function getBillingAddress()
37
+ {
38
+ $billingAddressArr['firstname'] = '';
39
+ $billingAddressArr['lastname'] = '';
40
+ $billingAddressArr['company'] = '';
41
+ $billingAddressArr['address1'] = '';
42
+ $billingAddressArr['address2'] = '';
43
+ $billingAddressArr['city'] = '';
44
+ $billingAddressArr['state'] = '';
45
+ $billingAddressArr['zip'] = '';
46
+ $billingAddressArr['country'] = '';
47
+ $billingAddressArr['phone'] = '';
48
+ $billingAddressArr['fax'] = '';
49
+ $billingAddressArr['email'] = '';
50
+
51
+ if($this->_order){
52
+ $billingAddress = $this->_order->getBillingAddress();
53
+ if($billingAddress && $billingAddress->getId()){
54
+ $billingAddressArr['firstname'] = $billingAddress->getData('firstname');
55
+ $billingAddressArr['lastname'] = $billingAddress->getData('lastname');
56
+ $billingAddressArr['company'] = $billingAddress->getData('company');
57
+ $billingAddressArr['address1'] = $billingAddress->getStreet1();
58
+ $billingAddressArr['address2'] = $billingAddress->getStreet2();
59
+ $billingAddressArr['city'] = $billingAddress->getData('city');
60
+ $billingAddressArr['state'] = $billingAddress->getData('region');
61
+ $billingAddressArr['zip'] = $billingAddress->getData('postcode');
62
+ $billingAddressArr['country'] = $billingAddress->getData('country_id');
63
+ $billingAddressArr['phone'] = $billingAddress->getData('telephone');
64
+ $billingAddressArr['fax'] = $billingAddress->getData('fax');
65
+ $billingAddressArr['email'] = $billingAddress->getData('email');
66
+ }
67
+ }
68
+
69
+ return $billingAddressArr;
70
+ }
71
+
72
+ protected function getShippingAddress()
73
+ {
74
+ $shippingAddressArr['shipping_firstname'] = '';
75
+ $shippingAddressArr['shipping_lastname'] = '';
76
+ $shippingAddressArr['shipping_company'] = '';
77
+ $shippingAddressArr['shipping_address1'] = '';
78
+ $shippingAddressArr['shipping_address2'] = '';
79
+ $shippingAddressArr['shipping_city'] = '';
80
+ $shippingAddressArr['shipping_state'] = '';
81
+ $shippingAddressArr['shipping_zip'] = '';
82
+ $shippingAddressArr['shipping_country'] = '';
83
+ $shippingAddressArr['shipping_phone'] = '';
84
+ $shippingAddressArr['shipping_fax'] = '';
85
+ $shippingAddressArr['shipping_email'] = '';
86
+
87
+ if($this->_order){
88
+ if(!$this->_order->getIsVirtual()){
89
+ $shippingAddress = $this->_order->getShippingAddress();
90
+ }
91
+ else{
92
+ $shippingAddress = $this->_order->getBillingAddress();
93
+ }
94
+
95
+ if($shippingAddress && $shippingAddress->getId()){
96
+ $shippingAddressArr['shipping_firstname'] = $shippingAddress->getData('firstname');
97
+ $shippingAddressArr['shipping_lastname'] = $shippingAddress->getData('lastname');
98
+ $shippingAddressArr['shipping_company'] = $shippingAddress->getData('company');
99
+ $shippingAddressArr['shipping_address1'] = $shippingAddress->getStreet1();
100
+ $shippingAddressArr['shipping_address2'] = $shippingAddress->getStreet2();
101
+ $shippingAddressArr['shipping_city'] = $shippingAddress->getData('city');
102
+ $shippingAddressArr['shipping_state'] = $shippingAddress->getData('region');
103
+ $shippingAddressArr['shipping_zip'] = $shippingAddress->getData('postcode');
104
+ $shippingAddressArr['shipping_country'] = $shippingAddress->getData('country_id');
105
+ $shippingAddressArr['shipping_phone'] = $shippingAddress->getData('telephone');
106
+ $shippingAddressArr['shipping_fax'] = $shippingAddress->getData('fax');
107
+ $shippingAddressArr['shipping_email'] = $shippingAddress->getData('email');
108
+ }
109
+ }
110
+
111
+ return $shippingAddressArr;
112
+ }
113
+
114
+ protected function getCreditCardData()
115
+ {
116
+ $creditCardArr['ccnumber'] = '';
117
+ $creditCardArr['ccexp'] = '';
118
+ $creditCardArr['cvv'] = '';
119
+
120
+ if($this->_payment){
121
+ $creditCardArr['ccnumber'] = $this->_payment->getCcNumber();
122
+ $creditCardArr['ccexp'] = $this->_payment->getCcExpMonth().'-'.$this->_payment->getCcExpYear();
123
+ if($this->_helper->getUseCcv())
124
+ $creditCardArr['cvv'] = $this->_payment->getCcCid();
125
+ }
126
+
127
+ return $creditCardArr;
128
+ }
129
+
130
+ protected function getApiCredentials()
131
+ {
132
+ $apiCredentialsArr['username'] = $this->_helper->getAmgApiId();
133
+ $apiCredentialsArr['password'] = $this->_helper->getAmgTransKey();
134
+
135
+ return $apiCredentialsArr;
136
+ }
137
+
138
+ protected function getOrderAmounts()
139
+ {
140
+ $orderAmounts['shipping'] = 0;
141
+ $orderAmounts['discount_amount'] = 0;
142
+ $orderAmounts['tax'] = 0;
143
+
144
+ if($this->_payment && $this->_order){
145
+ $orderAmounts['shipping'] = $this->_order->getShippingAmount();
146
+ $orderAmounts['discount_amount'] = $this->_order->getDiscountAmount();
147
+ $orderAmounts['tax'] = $this->_order->getTaxAmount();
148
+ }
149
+
150
+ return $orderAmounts;
151
+ }
152
+
153
+ protected function getApiCommonFields()
154
+ {
155
+ $commonFieldsArr['amount'] = '';
156
+ $commonFieldsArr['ipaddress'] = '';
157
+ $commonFieldsArr['orderid'] = '';
158
+ $commonFieldsArr['merchant_ref_number'] = '';
159
+ $commonFieldsArr['currency'] = '';
160
+ $commonFieldsArr['payment'] = $this->_helper->getApiPaymentType();
161
+
162
+ if($this->_helper->getDuplicateTransSecondsFeatureEnabled())
163
+ $commonFieldsArr['dup_seconds'] = $this->_helper->getDuplicateTransSeconds();
164
+
165
+ if($this->_payment && $this->_order){
166
+ $commonFieldsArr['amount'] = $this->_amount;
167
+ $commonFieldsArr['ipaddress'] = $_SERVER['REMOTE_ADDR'];
168
+ $commonFieldsArr['orderid'] = $this->_order->getIncrementId();
169
+ $commonFieldsArr['merchant_ref_number'] = $this->_order->getIncrementId();
170
+ $commonFieldsArr['currency'] = $this->_order->getBaseCurrencyCode();
171
+ }
172
+
173
+ return $commonFieldsArr;
174
+ }
175
+
176
+ protected function getApiCustomerValutFields()
177
+ {
178
+
179
+ $customerVault = $this->getCustomerVaultIfApplicable();
180
+ if($customerVault){
181
+ $customerValutFieldsArr['customer_vault'] = $this->_helper->getAddCustomerVaultType();
182
+ if($customerVault->getAmgCustomerVaultId()){
183
+ $customerValutFieldsArr['customer_vault'] = $this->_helper->getUpdateCustomerVaultType();
184
+ $customerValutFieldsArr['customer_vault_id'] = $customerVault->getAmgCustomerVaultId();
185
+ $customerValutFieldsArr['customer_id'] = $customerVault->getAmgCustomerVaultId();
186
+ }
187
+ return $customerValutFieldsArr;
188
+ }
189
+ return array();
190
+ }
191
+
192
+ public function getAuthorizationRequest()
193
+ {
194
+ $billingAddressArr = $this->getBillingAddress();
195
+ $shippingAddressArr = $this->getShippingAddress();
196
+ $creditCardArr = $this->getCreditCardData();
197
+ $apiCredentialsArr = $this->getApiCredentials();
198
+ $orderAmounts = $this->getOrderAmounts();
199
+ $commonFieldsArr = $this->getApiCommonFields();
200
+ $customerValutFieldsArr = $this->getApiCustomerValutFields();
201
+
202
+ $authorizeRequest = array_merge($billingAddressArr,$shippingAddressArr,$creditCardArr,$apiCredentialsArr,$orderAmounts,$commonFieldsArr,$customerValutFieldsArr);
203
+
204
+ $authorizeRequest['type'] = $this->_helper->getApiAuthorizationType();
205
+
206
+ return $authorizeRequest;
207
+ }
208
+
209
+ public function getSaleRequest()
210
+ {
211
+ $saleRequest = $this->getAuthorizationRequest();
212
+
213
+ $saleRequest['type'] = $this->_helper->getApiSaleType();
214
+
215
+ return $saleRequest;
216
+ }
217
+
218
+
219
+ public function getCustomerVaultAuthorizationRequest($amgCustomerVaultId)
220
+ {
221
+ $apiCredentialsArr = $this->getApiCredentials();
222
+
223
+ $commonFieldsArr['amount'] = $this->_amount;
224
+ $commonFieldsArr['customer_vault_id'] = $amgCustomerVaultId;
225
+ $commonFieldsArr['orderid'] = $this->_order->getIncrementId();
226
+ $commonFieldsArr['merchant_ref_number'] = $this->_order->getIncrementId();
227
+
228
+ $authorizeRequest = array_merge($apiCredentialsArr,$commonFieldsArr);
229
+
230
+ $authorizeRequest['type'] = $this->_helper->getApiAuthorizationType();
231
+
232
+ return $authorizeRequest;
233
+ }
234
+
235
+ public function getCustomerVaultSaleRequest($amgCustomerVaultId)
236
+ {
237
+ $saleRequest = $this->getCustomerVaultAuthorizationRequest($amgCustomerVaultId);
238
+
239
+ $saleRequest['type'] = $this->_helper->getApiSaleType();
240
+
241
+ return $saleRequest;
242
+ }
243
+
244
+ public function getCaptureRequest($transactionId)
245
+ {
246
+ $apiCredentialsArr = $this->getApiCredentials();
247
+
248
+ $commonFieldsArr['amount'] = $this->_amount;
249
+ $commonFieldsArr['transactionid'] = $transactionId;
250
+ $commonFieldsArr['orderid'] = $this->_order->getIncrementId();
251
+
252
+ $captureRequest = array_merge($apiCredentialsArr,$commonFieldsArr);
253
+
254
+ $captureRequest['type'] = $this->_helper->getApiCaptureType();
255
+
256
+ return $captureRequest;
257
+ }
258
+
259
+ public function getRefundRequest()
260
+ {
261
+ $apiCredentialsArr = $this->getApiCredentials();
262
+
263
+ $commonFieldsArr['amount'] = $this->_amount;
264
+ $commonFieldsArr['transactionid'] = $this->_payment->getLastTransId();
265
+
266
+ $refundRequest = array_merge($apiCredentialsArr,$commonFieldsArr);
267
+
268
+ $refundRequest['type'] = $this->_helper->getApiRefundType();
269
+
270
+ return $refundRequest;
271
+ }
272
+
273
+ protected function getCustomerVaultIfApplicable()
274
+ {
275
+ $paymentMethodCode = $this->_payment->getMethod();
276
+ $directPostPaymentMethodCode = Mage::getModel('securepay/directpost')->getCode();
277
+ if($paymentMethodCode==$directPostPaymentMethodCode){
278
+ if(Mage::helper('securepay')->isCcSaveAllowed()){
279
+ if($this->_payment->hasAdditionalInformation('cc_save_future_directpost') && ($this->_payment->getAdditionalInformation('cc_save_future_directpost') == 'Y')) {
280
+ $customerVaultModel = Mage::getModel('securepay/customervault');
281
+ $customerVaultModel->loadByCreditCard(
282
+ $this->_payment->getOrder()->getData('customer_id'),
283
+ $this->_payment->getData('cc_type'),
284
+ $this->_payment->getData('cc_last4'),
285
+ $this->_payment->getData('cc_exp_month'),
286
+ $this->_payment->getData('cc_exp_year')
287
+ );
288
+ return $customerVaultModel;
289
+ }
290
+ }
291
+ }
292
+ return false;
293
+ }
294
+
295
+ public function _postApiRequest($requestArr)
296
+ {
297
+ $this->log($requestArr);
298
+
299
+ $requestString = "";
300
+ foreach($requestArr as $key=>$value) {
301
+ $requestString .= $key.'='. urlencode($value).'&';
302
+ }
303
+ $requestString = substr($requestString,0,-1);
304
+
305
+ $gatewayUrl = $this->_helper->getAmgGatewayUrl();
306
+
307
+ $ch = curl_init();
308
+ curl_setopt($ch, CURLOPT_URL,$gatewayUrl);
309
+ curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
310
+ curl_setopt($ch, CURLOPT_TIMEOUT, 30);
311
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
312
+ curl_setopt($ch, CURLOPT_HEADER, 0);
313
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
314
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $requestString);
315
+ curl_setopt($ch, CURLOPT_POST, 1);
316
+ if (!($data = curl_exec($ch))) {
317
+ Mage::throwException(Mage::helper('securepay')->__('Payment Gateway Request Timeout.'));
318
+ }
319
+ curl_close($ch);
320
+ unset($ch);
321
+
322
+ $responseArr = array();
323
+ $data = explode("&",$data);
324
+ for($i=0;$i<count($data);$i++) {
325
+ $rdata = explode("=",$data[$i]);
326
+ $responseArr[$rdata[0]] = $rdata[1];
327
+ }
328
+
329
+ $this->log($responseArr);
330
+
331
+ return $responseArr;
332
+ }
333
+
334
+ protected function log($message)
335
+ {
336
+ if($this->_helper->isLogEnabled()){
337
+ $orderNumber = $this->_order->getIncrementId();
338
+ $file = $orderNumber.'.log';
339
+
340
+ if($message && $orderNumber){
341
+ $logDir = $this->_helper->getLogDir();
342
+ $logFile = $logDir . DS . $file;
343
+ $level = Zend_Log::DEBUG;
344
+ if(!is_dir($logDir)){
345
+ mkdir($logDir);
346
+ chmod($logDir, 0777);
347
+ }
348
+ if(!file_exists($logFile)){
349
+ file_put_contents($logFile, '');
350
+ chmod($logFile, 0777);
351
+ }
352
+ $currentTime = Mage::getModel('core/date')->date('Y-m-d H:i:s');
353
+ $format = "$currentTime %priorityName% (%priority%) : %message%" . PHP_EOL;
354
+ $formatter = new Zend_Log_Formatter_Simple($format);
355
+ $writerModel = (string)Mage::getConfig()->getNode('global/log/core/writer_model');
356
+ if(!$writerModel){
357
+ $writer = new Zend_Log_Writer_Stream($logFile);
358
+ }
359
+ else{
360
+ $writer = new $writerModel($logFile);
361
+ }
362
+ $writer->setFormatter($formatter);
363
+ $logger = new Zend_Log($writer);
364
+ if(is_array($message) || is_object($message)){
365
+ $message = print_r($message, true);
366
+ }
367
+ $logger->log($message, $level);
368
+ }
369
+ }
370
+ }
371
+ }
app/code/community/AMG/SecurePay/Model/Customervault.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class AMG_SecurePay_Model_Customervault extends Mage_Core_Model_Abstract
3
+ {
4
+ public function __construct()
5
+ {
6
+ $this->_init('securepay/customervault');
7
+ }
8
+
9
+ public function loadByCreditCard($customerId, $ccType, $ccLast4, $ccExpMonth, $ccExpYear)
10
+ {
11
+ if($customerId && $ccType && $ccLast4 && $ccExpMonth && $ccExpYear){
12
+ $customerVaultId = $this->_getResource()->getCustomerVaultIdByCreditCard($customerId, $ccType, $ccLast4, $ccExpMonth, $ccExpYear);
13
+ if($customerVaultId>0){
14
+ $this->load($customerVaultId);
15
+ }
16
+ }
17
+ return $this;
18
+ }
19
+
20
+ public function loadByCode($code)
21
+ {
22
+ if($code){
23
+ $customerVaultId = $this->_getResource()->getCustomerVaultIdByCode($code);
24
+ if($customerVaultId>0){
25
+ $this->load($customerVaultId);
26
+ }
27
+ }
28
+ return $this;
29
+ }
30
+
31
+ public function generateUniqueCode()
32
+ {
33
+ return $this->_getResource()->generateUniqueCode();
34
+ }
35
+
36
+ protected function _beforeSave()
37
+ {
38
+ parent::_beforeSave();
39
+ if(!$this->getId()){
40
+ $this->_dataSaveAllowed = false;
41
+
42
+ $customerId = $this->getData('customer_id');
43
+ $code = $this->getData('code');
44
+ $ccType = $this->getData('cc_type');
45
+ $ccLast4 = $this->getData('cc_last4');
46
+ $ccExpMonth = $this->getData('cc_exp_month');
47
+ $ccExpYear = $this->getData('cc_exp_year');
48
+ $amgCustomerVaultId = $this->getData('amg_customer_vault_id');
49
+
50
+ if($customerId && $code && $ccType && $ccLast4 && $ccExpMonth && $ccExpYear && $amgCustomerVaultId){
51
+ $customerVaultId = $this->_getResource()->getCustomerVaultIdByCreditCard($customerId, $ccType, $ccLast4, $ccExpMonth, $ccExpYear);
52
+ if($customerVaultId==0){
53
+ $customerVaultId = $this->_getResource()->getCustomerVaultIdByCode($code);
54
+ if($customerVaultId==0)
55
+ $this->_dataSaveAllowed = true;
56
+ }
57
+ }
58
+
59
+ }
60
+ return $this;
61
+ }
62
+ }
app/code/community/AMG/SecurePay/Model/Directpost.php ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class AMG_SecurePay_Model_Directpost extends Mage_Payment_Model_Method_Cc
3
+ {
4
+ protected $_code = 'securepay_directpost';
5
+ protected $_formBlockType = 'securepay/directpost_form';
6
+
7
+ protected $_canAuthorize = true;
8
+ protected $_canCapture = true;
9
+ protected $_canRefund = true;
10
+
11
+ protected $_apiModel;
12
+
13
+ public function __construct()
14
+ {
15
+ $this->_apiModel = Mage::getModel('securepay/api');
16
+ }
17
+
18
+ public function isAvailable($quote = null)
19
+ {
20
+ $isVailable = parent::isAvailable($quote);
21
+ if($isVailable){
22
+ return $this->_apiModel->isPaymentMethodAvailable();
23
+ }
24
+ return false;
25
+ }
26
+
27
+ public function getConfigData($field, $storeId = null)
28
+ {
29
+ if($field!='payment_action')
30
+ return parent::getConfigData($field, $storeId);
31
+
32
+ $path = 'payment/'.$this->getCode().'/'.$field;
33
+ $value = Mage::getStoreConfig($path, $storeId);
34
+ if($value==AMG_SecurePay_Model_Directpost_Source_PaymentAction::SALE){
35
+ $value = AMG_SecurePay_Model_Directpost_Source_PaymentAction::AUTHORIZE_CAPTURE;
36
+ }
37
+ return $value;
38
+ }
39
+
40
+ protected function initializeApiModel(Varien_Object $payment,$amount)
41
+ {
42
+ $this->_apiModel->setPayment($payment);
43
+ $this->_apiModel->setAmount($amount);
44
+ }
45
+
46
+ protected function _shouldDoSale()
47
+ {
48
+ if(Mage::getStoreConfig('payment/'.$this->getCode().'/payment_action')==AMG_SecurePay_Model_Directpost_Source_PaymentAction::SALE){
49
+ return true;
50
+ }
51
+ return false;
52
+ }
53
+
54
+ protected function sale(Varien_Object $payment, $amount)
55
+ {
56
+ if($amount <= 0){
57
+ Mage::throwException(Mage::helper('securepay')->__('Invalid amount.'));
58
+ }
59
+
60
+ $this->initializeApiModel($payment,$amount);
61
+
62
+ $saleRequest = $this->_apiModel->getSaleRequest();
63
+
64
+ $saleResponse = $this->_apiModel->_postApiRequest($saleRequest);
65
+
66
+ if($saleResponse['response'] == 1){
67
+ $this->updatePaymentWithApiResponse($payment,$saleResponse);
68
+ }
69
+ else{
70
+ Mage::throwException($saleResponse['responsetext']);
71
+ }
72
+ }
73
+
74
+ public function authorize(Varien_Object $payment, $amount)
75
+ {
76
+ if($amount <= 0){
77
+ Mage::throwException(Mage::helper('securepay')->__('Invalid amount to authorize.'));
78
+ }
79
+
80
+ $this->initializeApiModel($payment,$amount);
81
+
82
+ $authorizeRequest = $this->_apiModel->getAuthorizationRequest();
83
+
84
+ $authorizationResponse = $this->_apiModel->_postApiRequest($authorizeRequest);
85
+
86
+ if($authorizationResponse['response'] == 1){
87
+ $this->updatePaymentWithApiResponse($payment,$authorizationResponse);
88
+ }
89
+ else{
90
+ Mage::throwException($authorizationResponse['responsetext']);
91
+ }
92
+ return $authorizationResponse;
93
+ }
94
+
95
+ public function capture(Varien_Object $payment, $amount)
96
+ {
97
+ if($this->_shouldDoSale()){
98
+ $this->sale($payment, $amount);
99
+ return;
100
+ }
101
+
102
+ $this->initializeApiModel($payment,$amount);
103
+
104
+ $transactionId = '';
105
+
106
+ $authorizationTransaction = $payment->getAuthorizationTransaction();
107
+ if($authorizationTransaction){
108
+ if($authorizationTransaction->getTxnId()){
109
+ $transactionId = $authorizationTransaction->getTxnId();
110
+ }
111
+ }
112
+ if($transactionId==''){
113
+ $authorizationResponse = $this->authorize($payment, $amount);
114
+ if($authorizationResponse['response'] == 1 && $authorizationResponse['transactionid']){
115
+ $transactionId = $authorizationResponse['transactionid'];
116
+ }
117
+ }
118
+ if($transactionId!=''){
119
+ $captureRequest = $this->_apiModel->getCaptureRequest($transactionId);
120
+ $captureResponse = $this->_apiModel->_postApiRequest($captureRequest);
121
+ if($captureResponse['response'] == 1){
122
+ $this->updatePaymentWithApiResponse($payment,$captureResponse);
123
+ }
124
+ else{
125
+ Mage::throwException($captureResponse['responsetext']);
126
+ }
127
+ }
128
+ else{
129
+ Mage::throwException(Mage::helper('securepay')->__('Amount is not authorized.'));
130
+ }
131
+ }
132
+
133
+ protected function updatePaymentWithApiResponse(Varien_Object $payment,$response, $transactionClosed = 0)
134
+ {
135
+ $payment->setTransactionId($response['transactionid']);
136
+ if(isset($response['customer_vault_id'])){
137
+ $payment->setAdditionalInformation('amg_customer_vault_id', $response['customer_vault_id']);
138
+ }
139
+ $payment->setIsTransactionClosed($transactionClosed);
140
+ $payment->setTransactionAdditionalInfo(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS,$response);
141
+ }
142
+
143
+ public function refund(Varien_Object $payment, $amount)
144
+ {
145
+ if($amount <= 0){
146
+ Mage::throwException(Mage::helper('securepay')->__('Invalid amount to refund.'));
147
+ }
148
+
149
+ $this->initializeApiModel($payment,$amount);
150
+
151
+ $refundRequest = $this->_apiModel->getRefundRequest();
152
+
153
+ $refundResponse = $this->_apiModel->_postApiRequest($refundRequest);
154
+ if($refundResponse['response'] == 1){
155
+ $transactionClosed = 1;
156
+ $this->updatePaymentWithApiResponse($payment,$refundResponse,$transactionClosed);
157
+ }
158
+ else{
159
+ Mage::throwException($captureResponse['responsetext']);
160
+ }
161
+ return $this;
162
+ }
163
+ }
app/code/community/AMG/SecurePay/Model/Directpost/Customervault.php ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class AMG_SecurePay_Model_Directpost_Customervault extends AMG_SecurePay_Model_Directpost
3
+ {
4
+ protected $_code = 'securepay_directpost_customervault';
5
+ protected $_formBlockType = 'securepay/directpost_customervault_form';
6
+
7
+ protected $_canAuthorize = true;
8
+ protected $_canCapture = true;
9
+ protected $_canRefund = true;
10
+
11
+ protected $_apiModel;
12
+
13
+ public function __construct()
14
+ {
15
+ $this->_apiModel = Mage::getModel('securepay/api');
16
+ }
17
+
18
+ public function isAvailable($quote = null)
19
+ {
20
+ if(Mage::getStoreConfigFlag('payment/securepay_directpost/active') && $this->getConfigData('active')){
21
+ $isVailable = $this->_apiModel->isPaymentMethodAvailable();
22
+ if($isVailable){
23
+ $customerId = Mage::helper('securepay')->getCurrentQuoteCustomerId();
24
+ if($customerId>0){
25
+ $collection = Mage::getModel('securepay/customervault')->getCollection()
26
+ ->addFieldToFilter('customer_id',$customerId);
27
+ if(count($collection)>0)
28
+ return true;
29
+ }
30
+ }
31
+ }
32
+ return false;
33
+ }
34
+
35
+ public function validate()
36
+ {
37
+ return true;
38
+ }
39
+
40
+ public function authorize(Varien_Object $payment, $amount)
41
+ {
42
+ if($amount <= 0){
43
+ Mage::throwException(Mage::helper('securepay')->__('Invalid amount to authorize.'));
44
+ }
45
+
46
+ $amgCustomerVaultId = $this->getAmgCustomerVaultId($payment);
47
+ if($amgCustomerVaultId <= 0){
48
+ Mage::throwException(Mage::helper('securepay')->__('Could not find customer vault information.'));
49
+ }
50
+
51
+ $this->initializeApiModel($payment,$amount);
52
+
53
+ $authorizeRequest = $this->_apiModel->getCustomerVaultAuthorizationRequest($amgCustomerVaultId);
54
+
55
+ $authorizationResponse = $this->_apiModel->_postApiRequest($authorizeRequest);
56
+
57
+ if($authorizationResponse['response'] == 1){
58
+ $this->updatePaymentWithApiResponse($payment,$authorizationResponse);
59
+ }
60
+ else{
61
+ Mage::throwException($authorizationResponse['responsetext']);
62
+ }
63
+ return $authorizationResponse;
64
+ }
65
+
66
+ protected function sale(Varien_Object $payment, $amount)
67
+ {
68
+ if($amount <= 0){
69
+ Mage::throwException(Mage::helper('securepay')->__('Invalid amount.'));
70
+ }
71
+
72
+ $amgCustomerVaultId = $this->getAmgCustomerVaultId($payment);
73
+ if($amgCustomerVaultId <= 0){
74
+ Mage::throwException(Mage::helper('securepay')->__('Could not find customer vault information.'));
75
+ }
76
+
77
+ $this->initializeApiModel($payment,$amount);
78
+
79
+ $saleRequest = $this->_apiModel->getCustomerVaultSaleRequest($amgCustomerVaultId);
80
+
81
+ $saleResponse = $this->_apiModel->_postApiRequest($saleRequest);
82
+
83
+ if($saleResponse['response'] == 1){
84
+ $this->updatePaymentWithApiResponse($payment,$saleResponse);
85
+ }
86
+ else{
87
+ Mage::throwException($saleResponse['responsetext']);
88
+ }
89
+ }
90
+
91
+ protected function getAmgCustomerVaultId($payment)
92
+ {
93
+ $paymentMethod = $payment->getMethod();
94
+ if($paymentMethod==$this->_code){
95
+ if($payment->hasAdditionalInformation('customervault_id')){
96
+ $customervault_id = $payment->getAdditionalInformation('customervault_id');
97
+ if($customervault_id>0){
98
+ $customerVaultModel = Mage::getModel('securepay/customervault');
99
+ $customerVaultModel->load($customervault_id);
100
+ if($customerVaultModel->getId()){
101
+ if($customerVaultModel->getCustomerId()>0){
102
+ if($payment->getOrder()->getData('customer_id')==$customerVaultModel->getCustomerId()){
103
+ return $customerVaultModel->getAmgCustomerVaultId();
104
+ }
105
+ }
106
+ }
107
+ }
108
+ }
109
+ }
110
+ return 0;
111
+ }
112
+ }
app/code/community/AMG/SecurePay/Model/Directpost/Customervault/Source/PaymentAction.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class AMG_SecurePay_Model_Directpost_Customervault_Source_PaymentAction
3
+ {
4
+ const AUTHORIZE = 'authorize';
5
+ const AUTHORIZE_CAPTURE = 'authorize_capture';
6
+ const SALE = 'sale';
7
+
8
+ public function toOptionArray()
9
+ {
10
+ return array(
11
+ array(
12
+ 'value' => self::AUTHORIZE,
13
+ 'label' => Mage::helper('securepay')->__('Authorize Only')
14
+ ),
15
+ array(
16
+ 'value' => self::AUTHORIZE_CAPTURE,
17
+ 'label' => Mage::helper('securepay')->__('Authorize And Capture')
18
+ ),
19
+ array(
20
+ 'value' => self::SALE,
21
+ 'label' => Mage::helper('securepay')->__('Sale')
22
+ ),
23
+ );
24
+ }
25
+ }
app/code/community/AMG/SecurePay/Model/Directpost/Source/PaymentAction.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class AMG_SecurePay_Model_Directpost_Source_PaymentAction
3
+ {
4
+ const AUTHORIZE = 'authorize';
5
+ const AUTHORIZE_CAPTURE = 'authorize_capture';
6
+ const SALE = 'sale';
7
+
8
+ public function toOptionArray()
9
+ {
10
+ return array(
11
+ array(
12
+ 'value' => self::AUTHORIZE,
13
+ 'label' => Mage::helper('securepay')->__('Authorize Only')
14
+ ),
15
+ array(
16
+ 'value' => self::AUTHORIZE_CAPTURE,
17
+ 'label' => Mage::helper('securepay')->__('Authorize And Capture')
18
+ ),
19
+ array(
20
+ 'value' => self::SALE,
21
+ 'label' => Mage::helper('securepay')->__('Sale')
22
+ ),
23
+ );
24
+ }
25
+ }
app/code/community/AMG/SecurePay/Model/Mysql4/Customervault.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class AMG_SecurePay_Model_Mysql4_Customervault extends Mage_Core_Model_Mysql4_Abstract
3
+ {
4
+ public function _construct()
5
+ {
6
+ $this->_init('securepay/customervault','customervault_id');
7
+ }
8
+
9
+ public function getCustomerVaultIdByCreditCard($customerId, $ccType, $ccLast4, $ccExpMonth, $ccExpYear)
10
+ {
11
+ if($customerId && $ccType && $ccLast4 && $ccExpMonth && $ccExpYear){
12
+ $select = $this->_getReadAdapter()->select()->reset();
13
+ $select->from($this->getMainTable(), array('customervault_id'))
14
+ ->where('customer_id =? ',$customerId)
15
+ ->where('cc_type =? ',$ccType)
16
+ ->where('cc_last4 =? ', $ccLast4)
17
+ ->where('cc_exp_month =? ',$ccExpMonth)
18
+ ->where('cc_exp_year =? ',$ccExpYear);
19
+ $rows = $this->_getReadAdapter()->fetchAll($select);
20
+ if(count($rows)>0)
21
+ return $rows[0]['customervault_id'];
22
+ }
23
+ return 0;
24
+ }
25
+
26
+ public function getCustomerVaultIdByCode($code)
27
+ {
28
+ if($code){
29
+ $select = $this->_getReadAdapter()->select()->reset();
30
+ $select->from($this->getMainTable(), array('customervault_id'))
31
+ ->where('code =? ',$code);
32
+ $rows = $this->_getReadAdapter()->fetchAll($select);
33
+ if(count($rows)>0)
34
+ return $rows[0]['customervault_id'];
35
+ }
36
+ return 0;
37
+ }
38
+
39
+ public function generateUniqueCode()
40
+ {
41
+ for($i=0;$i<50;$i++){
42
+ $code = Mage::helper('core')->getRandomString(10);
43
+ $select = $this->_getReadAdapter()->select()->reset()
44
+ ->from(array('main_table'=>$this->getMainTable()),array('noofrd'=>'COUNT(*)'))
45
+ ->where('main_table.code = ?', $code);
46
+ $row = $this->_getReadAdapter()->fetchRow($select);
47
+ if($row['noofrd']==0)
48
+ return $code;
49
+ }
50
+ return '';
51
+ }
52
+ }
app/code/community/AMG/SecurePay/Model/Mysql4/Customervault/Collection.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class AMG_SecurePay_Model_Mysql4_Customervault_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
3
+ {
4
+ public function _construct()
5
+ {
6
+ parent::_construct();
7
+ $this->_init('securepay/customervault');
8
+ }
9
+ }
app/code/community/AMG/SecurePay/Model/Observer.php ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class AMG_SecurePay_Model_Observer
3
+ {
4
+ public function salesQuotePaymentImportDataBefore(Varien_Event_Observer $observer)
5
+ {
6
+ $input = $observer->getInput();
7
+ $payment = $observer->getPayment();
8
+ $paymentMethod = $input->getMethod();
9
+ if(isset($paymentMethod)){
10
+ $additionalFields = Mage::helper('securepay')->getPaymentMethodAdditionalInfoFields();
11
+ if(!empty($additionalFields)){
12
+ foreach($additionalFields as $field){
13
+ if($payment->hasAdditionalInformation($field)){
14
+ $payment->unsAdditionalInformation($field);
15
+ }
16
+ }
17
+ }
18
+ if($paymentMethod==Mage::getModel('securepay/directpost')->getCode()){
19
+ if(Mage::helper('securepay')->isCcSaveAllowed()){
20
+ if($input['cc_save_future_directpost'] == 'Y'){
21
+ $payment->setAdditionalInformation('cc_save_future_directpost', 'Y');
22
+ }
23
+ }
24
+ }
25
+ elseif($paymentMethod==Mage::getModel('securepay/directpost_customervault')->getCode()){
26
+ if($input['customervault_code']) {
27
+ $code = $input['customervault_code'];
28
+ $customerVaultModel = Mage::getModel('securepay/customervault');
29
+ $customerVaultModel->loadByCode($code);
30
+ if($customerVaultModel->getId()){
31
+ $customerId = Mage::helper('securepay')->getCurrentQuoteCustomerId();
32
+ if($customerVaultModel->getCustomerId()==$customerId)
33
+ $payment->setAdditionalInformation('customervault_id', $customerVaultModel->getCustomervaultId());
34
+ }
35
+ }
36
+ }
37
+ }
38
+ }
39
+
40
+ public function checkoutSubmitAllAfter($observer)
41
+ {
42
+ $orders = $observer->getOrders();
43
+ if(is_null($orders)){
44
+ $orders = array($observer->getOrder());
45
+ }
46
+ foreach($orders as $order){
47
+ $customerId = $order->getData('customer_id');
48
+ if(!$customerId){
49
+ return;
50
+ }
51
+ $payment = $order->getPayment();
52
+ $paymentMethod = $payment->getMethod();
53
+ if(isset($paymentMethod) && $payment->getData('transaction_id') ){
54
+ if($paymentMethod==Mage::getModel('securepay/directpost')->getCode()){
55
+ if(Mage::helper('securepay')->isCcSaveAllowed()){
56
+ if($payment->hasAdditionalInformation('cc_save_future_directpost') &&($payment->getAdditionalInformation('cc_save_future_directpost') == 'Y')){
57
+ $amg_customer_vault_id = '';
58
+ if($payment->hasAdditionalInformation('amg_customer_vault_id') &&($payment->getAdditionalInformation('amg_customer_vault_id') != '')){
59
+ $amg_customer_vault_id = $payment->getAdditionalInformation('amg_customer_vault_id');
60
+
61
+ $customerVaultModel = Mage::getModel('securepay/customervault');
62
+ $customerVaultModel->setData(array(
63
+ 'transaction_id' => $payment->getData('transaction_id'),
64
+ 'customer_id' => $customerId,
65
+ 'cc_type' => $payment->getData('cc_type'),
66
+ 'cc_last4' => $payment->getData('cc_last4'),
67
+ 'cc_exp_month' => $payment->getData('cc_exp_month'),
68
+ 'cc_exp_year' => $payment->getData('cc_exp_year'),
69
+ 'created_date' => now(),
70
+ 'updated_date' => now(),
71
+ 'amg_customer_vault_id' => $amg_customer_vault_id
72
+ ));
73
+ if($payment->hasAdditionalInformation('customervault_id') &&($payment->getAdditionalInformation('customervault_id') != '')){
74
+ $customerVaultModel->setId($payment->getAdditionalInformation('customervault_id'));
75
+ }
76
+ else{
77
+ $code = $customerVaultModel->generateUniqueCode();
78
+ $customerVaultModel->setData('code',$code);
79
+ }
80
+ $customerVaultModel->save();
81
+ }
82
+ }
83
+ }
84
+ }
85
+ elseif($paymentMethod==Mage::getModel('securepay/directpost_customervault')->getCode()){
86
+ if ($payment->hasAdditionalInformation('customervault_id') && $payment->getData('transaction_id')) {
87
+ $customervault_id = $payment->getAdditionalInformation('customervault_id');
88
+ if($customervault_id>0){
89
+ $customerVaultModel = Mage::getModel('securepay/customervault');
90
+ $customerVaultModel->load($customervault_id);
91
+ if($customerVaultModel->getId()){
92
+ if($customerVaultModel->getCustomerId()>0 && ($customerVaultModel->getCustomerId()==$customerId))
93
+ $customerVaultModel->setData('transaction_id', $payment->getData('transaction_id'))
94
+ ->setData('updated_date', now())
95
+ ->save();
96
+ }
97
+ }
98
+ }
99
+ }
100
+ }
101
+ }
102
+ }
103
+
104
+ }
app/code/community/AMG/SecurePay/controllers/StoredcardController.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class AMG_SecurePay_StoredcardController extends Mage_Core_Controller_Front_Action
3
+ {
4
+ public function preDispatch()
5
+ {
6
+ parent::preDispatch();
7
+ $action = $this->getRequest()->getActionName();
8
+ $loginUrl = Mage::helper('customer')->getLoginUrl();
9
+
10
+ if(!Mage::getSingleton('customer/session')->authenticate($this, $loginUrl)){
11
+ $this->setFlag('', self::FLAG_NO_DISPATCH, true);
12
+ }
13
+ }
14
+
15
+ public function indexAction()
16
+ {
17
+ $this->loadLayout();
18
+ $this->_initLayoutMessages('customer/session');
19
+ $this->renderLayout();
20
+ }
21
+
22
+ public function deleteAction()
23
+ {
24
+ if(Mage::getSingleton('customer/session')->isLoggedIn()){
25
+ $loggedInCustomerId = Mage::getSingleton('customer/session')->getCustomer()->getId();
26
+ if($loggedInCustomerId>0){
27
+ $code = $this->getRequest()->getParam('c');
28
+ if($code){
29
+ $customerVaultModel = Mage::getModel('securepay/customervault');
30
+ $customerVaultModel->loadByCode($code);
31
+ if($customerVaultModel->getId() && ($customerVaultModel->getCustomerId() == $loggedInCustomerId)){
32
+ $customerVaultModel->delete();
33
+ Mage::getSingleton('customer/session')->addSuccess($this->__('Your selected Credit Card record has been deleted.'));
34
+ }
35
+ }
36
+ }
37
+ }
38
+ $this->_redirect('*/*/');
39
+ }
40
+ }
app/code/community/AMG/SecurePay/etc/config.xml ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <AMG_SecurePay>
5
+ <version>0.1.0</version>
6
+ </AMG_SecurePay>
7
+ </modules>
8
+ <frontend>
9
+ <routers>
10
+ <AMG_SecurePay>
11
+ <use>standard</use>
12
+ <args>
13
+ <module>AMG_SecurePay</module>
14
+ <frontName>securepay</frontName>
15
+ </args>
16
+ </AMG_SecurePay>
17
+ </routers>
18
+ <layout>
19
+ <updates>
20
+ <securepay>
21
+ <file>AMG/securepay.xml</file>
22
+ </securepay>
23
+ </updates>
24
+ </layout>
25
+ <translate>
26
+ <modules>
27
+ <AMG_SecurePay>
28
+ <files>
29
+ <default>AMG/SecurePay.csv</default>
30
+ </files>
31
+ </AMG_SecurePay>
32
+ </modules>
33
+ </translate>
34
+ </frontend>
35
+ <global>
36
+ <blocks>
37
+ <securepay>
38
+ <class>AMG_SecurePay_Block</class>
39
+ </securepay>
40
+ </blocks>
41
+ <helpers>
42
+ <securepay>
43
+ <class>AMG_SecurePay_Helper</class>
44
+ </securepay>
45
+ </helpers>
46
+ <models>
47
+ <securepay>
48
+ <class>AMG_SecurePay_Model</class>
49
+ <resourceModel>securepay_mysql4</resourceModel>
50
+ </securepay>
51
+ <securepay_mysql4>
52
+ <class>AMG_SecurePay_Model_Mysql4</class>
53
+ <entities>
54
+ <customervault>
55
+ <table>amg_securepay_customervault</table>
56
+ </customervault>
57
+ </entities>
58
+ </securepay_mysql4>
59
+ </models>
60
+ <resources>
61
+ <securepay_setup>
62
+ <setup>
63
+ <module>AMG_SecurePay</module>
64
+ </setup>
65
+ <connection>
66
+ <use>core_setup</use>
67
+ </connection>
68
+ </securepay_setup>
69
+ <securepay_write>
70
+ <connection>
71
+ <use>core_write</use>
72
+ </connection>
73
+ </securepay_write>
74
+ <securepay_read>
75
+ <connection>
76
+ <use>core_read</use>
77
+ </connection>
78
+ </securepay_read>
79
+ </resources>
80
+ <events>
81
+ <sales_quote_payment_import_data_before>
82
+ <observers>
83
+ <amg_securepay_sales_quote_payment_import_data_before>
84
+ <class>securepay/observer</class>
85
+ <method>salesQuotePaymentImportDataBefore</method>
86
+ </amg_securepay_sales_quote_payment_import_data_before>
87
+ </observers>
88
+ </sales_quote_payment_import_data_before>
89
+ <checkout_submit_all_after>
90
+ <observers>
91
+ <amg_securepay_checkout_submit_all_after>
92
+ <class>securepay/observer</class>
93
+ <method>checkoutSubmitAllAfter</method>
94
+ </amg_securepay_checkout_submit_all_after>
95
+ </observers>
96
+ </checkout_submit_all_after>
97
+ </events>
98
+ </global>
99
+ <default>
100
+ <payment>
101
+ <securepay_directpost>
102
+ <active>0</active>
103
+ <title>AMG SecurePay</title>
104
+ <gateway_url>https://secure.advancedmerchantgroupgateway.com/api/transact.php</gateway_url>
105
+ <payment_action>authorize</payment_action>
106
+ <order_status>processing</order_status>
107
+ <currency>USD</currency>
108
+ <log>1</log>
109
+ <cctypes>AE,VI,MC,DI</cctypes>
110
+ <useccv>1</useccv>
111
+ <allowsavecc>1</allowsavecc>
112
+ <allowspecific>0</allowspecific>
113
+ <check_dup_seconds>0</check_dup_seconds>
114
+ <dup_seconds>0</dup_seconds>
115
+ <sort_order>200</sort_order>
116
+ <model>securepay/directpost</model>
117
+ <api_id backend_model="adminhtml/system_config_backend_encrypted"/>
118
+ <trans_key backend_model="adminhtml/system_config_backend_encrypted"/>
119
+ </securepay_directpost>
120
+ <securepay_directpost_customervault>
121
+ <active>0</active>
122
+ <title>AMG SecurePay - Customer Vault</title>
123
+ <payment_action>authorize</payment_action>
124
+ <order_status>processing</order_status>
125
+ <allowspecific>0</allowspecific>
126
+ <sort_order>201</sort_order>
127
+ <model>securepay/directpost_customervault</model>
128
+ </securepay_directpost_customervault>
129
+ </payment>
130
+ </default>
131
+ </config>
app/code/community/AMG/SecurePay/etc/system.xml ADDED
@@ -0,0 +1,246 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <sections>
4
+ <payment>
5
+ <groups>
6
+ <securepay_directpost translate="label" module="securepay">
7
+ <label>AMG SecurePay</label>
8
+ <frontend_type>text</frontend_type>
9
+ <sort_order>200</sort_order>
10
+ <show_in_default>1</show_in_default>
11
+ <show_in_website>1</show_in_website>
12
+ <show_in_store>1</show_in_store>
13
+ <comment><![CDATA[If you don’t have an <strong>AMG SecurePay </strong> <em>account</em> please fill out this <a style="color:#eb5e00; font-weight:bold" href="https://merchantaccountsources.com/online/OnlineApplicationForm.php?action=rip&ID=001-0017&thehost=348" target="_blank">Pre-Application Form.</a>]]></comment>
14
+ <fields>
15
+ <active translate="label">
16
+ <label>Enabled</label>
17
+ <frontend_type>select</frontend_type>
18
+ <source_model>adminhtml/system_config_source_yesno</source_model>
19
+ <sort_order>1</sort_order>
20
+ <show_in_default>1</show_in_default>
21
+ <show_in_website>1</show_in_website>
22
+ <show_in_store>1</show_in_store>
23
+ </active>
24
+ <title translate="label">
25
+ <label>Title</label>
26
+ <frontend_type>text</frontend_type>
27
+ <sort_order>2</sort_order>
28
+ <show_in_default>1</show_in_default>
29
+ <show_in_website>1</show_in_website>
30
+ <show_in_store>1</show_in_store>
31
+ </title>
32
+ <api_id translate="label">
33
+ <label>API ID</label>
34
+ <frontend_type>obscure</frontend_type>
35
+ <backend_model>adminhtml/system_config_backend_encrypted</backend_model>
36
+ <sort_order>3</sort_order>
37
+ <show_in_default>1</show_in_default>
38
+ <show_in_website>1</show_in_website>
39
+ <show_in_store>1</show_in_store>
40
+ </api_id>
41
+ <trans_key translate="label">
42
+ <label>Transaction Key</label>
43
+ <frontend_type>obscure</frontend_type>
44
+ <backend_model>adminhtml/system_config_backend_encrypted</backend_model>
45
+ <sort_order>4</sort_order>
46
+ <show_in_default>1</show_in_default>
47
+ <show_in_website>1</show_in_website>
48
+ <show_in_store>1</show_in_store>
49
+ </trans_key>
50
+ <gateway_url translate="label">
51
+ <label>Gateway URL</label>
52
+ <frontend_type>text</frontend_type>
53
+ <sort_order>5</sort_order>
54
+ <show_in_default>1</show_in_default>
55
+ <show_in_website>1</show_in_website>
56
+ <show_in_store>1</show_in_store>
57
+ </gateway_url>
58
+ <payment_action translate="label">
59
+ <label>Payment Action</label>
60
+ <frontend_type>select</frontend_type>
61
+ <source_model>securepay/directpost_source_paymentAction</source_model>
62
+ <sort_order>6</sort_order>
63
+ <show_in_default>1</show_in_default>
64
+ <show_in_website>1</show_in_website>
65
+ <show_in_store>1</show_in_store>
66
+ </payment_action>
67
+ <order_status translate="label">
68
+ <label>New Order Status</label>
69
+ <frontend_type>select</frontend_type>
70
+ <source_model>adminhtml/system_config_source_order_status_processing</source_model>
71
+ <sort_order>7</sort_order>
72
+ <show_in_default>1</show_in_default>
73
+ <show_in_website>1</show_in_website>
74
+ <show_in_store>1</show_in_store>
75
+ </order_status>
76
+ <currency translate="label">
77
+ <label>Accepted Currency</label>
78
+ <frontend_type>select</frontend_type>
79
+ <source_model>adminhtml/system_config_source_currency</source_model>
80
+ <sort_order>8</sort_order>
81
+ <show_in_default>1</show_in_default>
82
+ <show_in_website>1</show_in_website>
83
+ <show_in_store>1</show_in_store>
84
+ </currency>
85
+ <log translate="label">
86
+ <label>Enable Log</label>
87
+ <frontend_type>select</frontend_type>
88
+ <source_model>adminhtml/system_config_source_yesno</source_model>
89
+ <sort_order>9</sort_order>
90
+ <show_in_default>1</show_in_default>
91
+ <show_in_website>1</show_in_website>
92
+ <show_in_store>1</show_in_store>
93
+ </log>
94
+ <cctypes translate="label">
95
+ <label>Credit Card Types</label>
96
+ <frontend_type>multiselect</frontend_type>
97
+ <source_model>paygate/authorizenet_source_cctype</source_model>
98
+ <sort_order>10</sort_order>
99
+ <show_in_default>1</show_in_default>
100
+ <show_in_website>1</show_in_website>
101
+ <show_in_store>1</show_in_store>
102
+ </cctypes>
103
+ <useccv translate="label">
104
+ <label>Credit Card Verification ( CCV )</label>
105
+ <frontend_type>select</frontend_type>
106
+ <source_model>adminhtml/system_config_source_yesno</source_model>
107
+ <sort_order>11</sort_order>
108
+ <show_in_default>1</show_in_default>
109
+ <show_in_website>1</show_in_website>
110
+ <show_in_store>1</show_in_store>
111
+ </useccv>
112
+ <allowsavecc translate="label">
113
+ <label>Allow To Save Credit Card</label>
114
+ <frontend_type>select</frontend_type>
115
+ <source_model>adminhtml/system_config_source_yesno</source_model>
116
+ <sort_order>12</sort_order>
117
+ <show_in_default>1</show_in_default>
118
+ <show_in_website>1</show_in_website>
119
+ <show_in_store>1</show_in_store>
120
+ </allowsavecc>
121
+ <allowspecific translate="label">
122
+ <label>Payment from Applicable Countries</label>
123
+ <frontend_type>allowspecific</frontend_type>
124
+ <sort_order>13</sort_order>
125
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
126
+ <show_in_default>1</show_in_default>
127
+ <show_in_website>1</show_in_website>
128
+ <show_in_store>1</show_in_store>
129
+ </allowspecific>
130
+ <specificcountry translate="label">
131
+ <label>Payment from Specific Countries</label>
132
+ <frontend_type>multiselect</frontend_type>
133
+ <sort_order>14</sort_order>
134
+ <source_model>adminhtml/system_config_source_country</source_model>
135
+ <show_in_default>1</show_in_default>
136
+ <show_in_website>1</show_in_website>
137
+ <show_in_store>1</show_in_store>
138
+ </specificcountry>
139
+ <check_dup_seconds translate="label">
140
+ <label>Duplicate Checking In Seconds Feature Enabled</label>
141
+ <frontend_type>select</frontend_type>
142
+ <source_model>adminhtml/system_config_source_yesno</source_model>
143
+ <sort_order>15</sort_order>
144
+ <show_in_default>1</show_in_default>
145
+ <show_in_website>1</show_in_website>
146
+ <show_in_store>1</show_in_store>
147
+ <comment>Enable this feature only if your AMG account has this feature enabled.</comment>
148
+ </check_dup_seconds>
149
+ <dup_seconds translate="label comment">
150
+ <label>Duplicate Checking In Seconds</label>
151
+ <frontend_type>text</frontend_type>
152
+ <sort_order>16</sort_order>
153
+ <show_in_default>1</show_in_default>
154
+ <show_in_website>1</show_in_website>
155
+ <show_in_store>1</show_in_store>
156
+ <frontend_class>validate-number</frontend_class>
157
+ <comment>Sets the time in seconds for duplicate transaction checking on supported processors. Set to 0 to disable duplicate checking. Default value is 0.</comment>
158
+ </dup_seconds>
159
+ <sort_order translate="label comment">
160
+ <label>Sort Order</label>
161
+ <frontend_type>text</frontend_type>
162
+ <sort_order>17</sort_order>
163
+ <show_in_default>1</show_in_default>
164
+ <show_in_website>1</show_in_website>
165
+ <show_in_store>1</show_in_store>
166
+ <frontend_class>validate-number</frontend_class>
167
+ </sort_order>
168
+ </fields>
169
+ </securepay_directpost>
170
+ <securepay_directpost_customervault translate="label" module="securepay">
171
+ <label>AMG SecurePay - Customer Vault</label>
172
+ <frontend_type>text</frontend_type>
173
+ <sort_order>201</sort_order>
174
+ <show_in_default>1</show_in_default>
175
+ <show_in_website>1</show_in_website>
176
+ <show_in_store>1</show_in_store>
177
+ <comment><![CDATA[Only enable this feature if you have signed up for the "Customer Vault" <em>service</em> with AMG. <br> The Customer Vault is our PCI Compliant service that allows you to securely store your customer’s credit cards <a style="color:#eb5e00; font-weight:bold" href="https://amgsecurepay.com/customer-vault/" target="_blank">Learn more.</a>]]></comment>
178
+ <fields>
179
+ <active translate="label">
180
+ <label>Enabled</label>
181
+ <frontend_type>select</frontend_type>
182
+ <source_model>adminhtml/system_config_source_yesno</source_model>
183
+ <sort_order>1</sort_order>
184
+ <show_in_default>1</show_in_default>
185
+ <show_in_website>1</show_in_website>
186
+ <show_in_store>1</show_in_store>
187
+ </active>
188
+ <title translate="label">
189
+ <label>Title</label>
190
+ <frontend_type>text</frontend_type>
191
+ <sort_order>2</sort_order>
192
+ <show_in_default>1</show_in_default>
193
+ <show_in_website>1</show_in_website>
194
+ <show_in_store>1</show_in_store>
195
+ </title>
196
+ <payment_action translate="label">
197
+ <label>Payment Action</label>
198
+ <frontend_type>select</frontend_type>
199
+ <source_model>securepay/directpost_customervault_source_paymentAction</source_model>
200
+ <sort_order>3</sort_order>
201
+ <show_in_default>1</show_in_default>
202
+ <show_in_website>1</show_in_website>
203
+ <show_in_store>1</show_in_store>
204
+ </payment_action>
205
+ <order_status translate="label">
206
+ <label>New Order Status</label>
207
+ <frontend_type>select</frontend_type>
208
+ <source_model>adminhtml/system_config_source_order_status_processing</source_model>
209
+ <sort_order>4</sort_order>
210
+ <show_in_default>1</show_in_default>
211
+ <show_in_website>1</show_in_website>
212
+ <show_in_store>1</show_in_store>
213
+ </order_status>
214
+ <allowspecific translate="label">
215
+ <label>Payment from Applicable Countries</label>
216
+ <frontend_type>allowspecific</frontend_type>
217
+ <sort_order>5</sort_order>
218
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
219
+ <show_in_default>1</show_in_default>
220
+ <show_in_website>1</show_in_website>
221
+ <show_in_store>1</show_in_store>
222
+ </allowspecific>
223
+ <specificcountry translate="label">
224
+ <label>Payment from Specific Countries</label>
225
+ <frontend_type>multiselect</frontend_type>
226
+ <sort_order>6</sort_order>
227
+ <source_model>adminhtml/system_config_source_country</source_model>
228
+ <show_in_default>1</show_in_default>
229
+ <show_in_website>1</show_in_website>
230
+ <show_in_store>1</show_in_store>
231
+ </specificcountry>
232
+ <sort_order translate="label">
233
+ <label>Sort Order</label>
234
+ <frontend_type>text</frontend_type>
235
+ <sort_order>7</sort_order>
236
+ <show_in_default>1</show_in_default>
237
+ <show_in_website>1</show_in_website>
238
+ <show_in_store>1</show_in_store>
239
+ <frontend_class>validate-number</frontend_class>
240
+ </sort_order>
241
+ </fields>
242
+ </securepay_directpost_customervault>
243
+ </groups>
244
+ </payment>
245
+ </sections>
246
+ </config>
app/code/community/AMG/SecurePay/sql/securepay_setup/mysql4-install-0.1.0.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+ $installer->startSetup();
4
+ try{
5
+ $installer->run("
6
+ DROP TABLE IF EXISTS {$this->getTable('securepay/customervault')};
7
+ CREATE TABLE IF NOT EXISTS {$this->getTable('securepay/customervault')} (
8
+ `customervault_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
9
+ `code` varchar(20) NOT NULL DEFAULT '',
10
+ `transaction_id` varchar(255) NOT NULL DEFAULT '',
11
+ `customer_id` int(10) unsigned NOT NULL DEFAULT '0',
12
+ `cc_type` varchar(10) NOT NULL DEFAULT '',
13
+ `cc_last4` varchar(20) NOT NULL DEFAULT '',
14
+ `cc_exp_month` int(10) NOT NULL DEFAULT 0,
15
+ `cc_exp_year` int(10) NOT NULL DEFAULT 0,
16
+ `created_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
17
+ `updated_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
18
+ `amg_customer_vault_id` varchar(255) NOT NULL DEFAULT '',
19
+ PRIMARY KEY (`customervault_id`),
20
+ UNIQUE KEY `code` (`code`),
21
+ KEY `FK_AMG_CUSTOMER_VAULT_ID_CUSTOMER_ENTITY_ID` (`customer_id`),
22
+ CONSTRAINT `FK_AMG_CUSTOMER_VAULT_ID_TO_CUSTOMER_ENTITY_ID` FOREIGN KEY (`customer_id`) REFERENCES `{$this->getTable('customer/entity')}` (`entity_id`) ON DELETE CASCADE
23
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
24
+ ");
25
+
26
+ $io = new Varien_Io_File();
27
+ $io->checkAndCreateFolder(Mage::getBaseDir().DS.'var'.DS.'log'.DS.'AMG'.DS.'SecurePay');
28
+ }
29
+ catch(Exception $e){
30
+ Mage::log($e->getMessage());
31
+ }
32
+ $installer->endSetup();
app/design/adminhtml/default/default/template/AMG/securepay/directpost/customervault/form.phtml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $_code=$this->getMethodCode();
3
+ $_storedCards = $this->getCustomerVaultsCollection();
4
+ $_storedCardHelper = Mage::helper('securepay');
5
+ ?>
6
+ <ul class="form-list" id="payment_form_<?php echo $_code ?>" style="display:none;">
7
+ <li>
8
+ <div class="input-box">
9
+ <?php if ( $_storedCards && (count($_storedCards) > 0) ): ?>
10
+ <select id="<?php echo $_code ?>_customervault_code" name="payment[customervault_code]" class="required-entry validate-select">
11
+ <option value=""><?php echo $this->__('--Please Select--')?></option>
12
+ <?php foreach ($_storedCards as $_storedCard): ?>
13
+ <option value="<?php echo $_storedCard->getCode() ?>"><?php echo $_storedCardHelper->translateCcType($_storedCard->getData('cc_type')) ?> (<?php echo sprintf('xxxx-%s', $_storedCard->getData('cc_last4')) ?>)</option>
14
+ <?php endforeach ?>
15
+ </select>
16
+ <?php endif; ?>
17
+ </div>
18
+ </li>
19
+ </ul>
app/design/adminhtml/default/default/template/AMG/securepay/directpost/form.phtml ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $_form = $this;
3
+ $_code = $_form->getMethodCode();
4
+ $_method = $_form->getMethod();
5
+ ?>
6
+ <ul id="payment_form_<?php echo $_code ?>" class="form-list" style="display:none;">
7
+ <li>
8
+ <label for="<?php echo $_code ?>_cc_type"><?php echo $this->__('Credit Card Type') ?> <span class="required">*</span></label>
9
+ <div class="input-box">
10
+ <select id="<?php echo $_code ?>_cc_type" name="payment[cc_type]" class="required-entry validate-cc-type-select">
11
+ <option value=""><?php echo $this->__('--Please Select--')?></option>
12
+ <?php $_ccType = $_form->getInfoData('cc_type') ?>
13
+ <?php foreach ($_form->getCcAvailableTypes() as $_typeCode => $_typeName): ?>
14
+ <option value="<?php echo $_typeCode ?>"<?php if($_typeCode==$_ccType): ?> selected="selected"<?php endif ?>><?php echo $_typeName ?></option>
15
+ <?php endforeach ?>
16
+ </select>
17
+ </div>
18
+ </li>
19
+ <li>
20
+ <label for="<?php echo $_code ?>_cc_number"><?php echo $this->__('Credit Card Number') ?> <span class="required">*</span></label>
21
+ <div class="input-box">
22
+ <input type="text" id="<?php echo $_code ?>_cc_number" name="payment[cc_number]" title="<?php echo $this->__('Credit Card Number') ?>" class="input-text validate-cc-number validate-cc-type" value="" />
23
+ </div>
24
+ </li>
25
+ <li id="<?php echo $_code ?>_cc_type_exp_div">
26
+ <label for="<?php echo $_code ?>_expiration"><?php echo $this->__('Expiration Date') ?> <span class="required">*</span></label>
27
+ <div class="input-box">
28
+ <select id="<?php echo $_code ?>_expiration" name="payment[cc_exp_month]" class="month validate-cc-exp required-entry">
29
+ <?php $_ccExpMonth = $_form->getInfoData('cc_exp_month') ?>
30
+ <?php
31
+ foreach ($_form->getCcMonths() as $k=>$v):
32
+ $k = sprintf("%02d", $k)
33
+ ?>
34
+ <option value="<?php echo $k?$k:'' ?>"<?php if($k==$_ccExpMonth): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
35
+ <?php endforeach ?>
36
+ </select>
37
+ <?php $_ccExpYear = $_form->getInfoData('cc_exp_year') ?>
38
+ <select id="<?php echo $_code ?>_expiration_yr" name="payment[cc_exp_year]" class="year required-entry">
39
+ <?php foreach ($_form->getCcYears() as $k=>$v): ?>
40
+ <option value="<?php echo $k?$k:'' ?>"<?php if($k==$_ccExpYear): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
41
+ <?php endforeach ?>
42
+ </select>
43
+ </div>
44
+ </li>
45
+ <?php echo $_form->getChildHtml() ?>
46
+ <?php if($_form->hasVerification()): ?>
47
+ <li id="<?php echo $_code ?>_cc_type_cvv_div">
48
+ <label for="<?php echo $_code ?>_cc_cid"><?php echo $this->__('Card Verification Number') ?> <span class="required">*</span></label>
49
+ <div class="input-box">
50
+ <div class="v-fix">
51
+ <input type="text" title="<?php echo $this->__('Card Verification Number') ?>" class="input-text cvv required-entry validate-cc-cvn" id="<?php echo $_code ?>_cc_cid" name="payment[cc_cid]" value="" />
52
+ </div>
53
+ </div>
54
+ </li>
55
+ <?php endif; ?>
56
+ <?php if ($this->isCcSaveAllowed()): ?>
57
+ <li>
58
+ <div class="input-box">
59
+ <div class="v-fix">
60
+ <input type="checkbox" id="<?php echo $_code ?>_cc_save_future_directpost" name="payment[cc_save_future_directpost]" value="Y" />
61
+ <label for="<?php echo $_code ?>_cc_save_future_directpost"><?php echo $this->__('Save this card for future use') ?></label>
62
+ </div>
63
+ </div>
64
+
65
+ </li>
66
+ <?php endif; ?>
67
+ </ul>
app/design/frontend/base/default/layout/AMG/securepay.xml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <customer_account>
4
+ <reference name="customer_account_navigation">
5
+ <action method="addLink" translate="label">
6
+ <name>securepay_storecard</name>
7
+ <path>securepay/storedcard/</path>
8
+ <label>My Credit Cards</label>
9
+ </action>
10
+ </reference>
11
+ </customer_account>
12
+
13
+ <amg_securepay_storedcard_index>
14
+ <update handle="customer_account"/>
15
+ <reference name="my.account.wrapper">
16
+ <block type="securepay/customer_storedcard" name="securepay_customer_storedcard" template="AMG/securepay/customer/storedcard.phtml"/>
17
+ </reference>
18
+ </amg_securepay_storedcard_index>
19
+ </layout>
app/design/frontend/base/default/template/AMG/securepay/customer/storedcard.phtml ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="page-title"><h1><?php echo $this->__('My Credit Cards') ?></h1></div>
2
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
3
+ <div class="box-account">
4
+ <?php $_storedCards = $this->getStoredCards(); ?>
5
+ <div class="box-head"><h2><?php echo $this->__('Credit Cards') ?></h2></div>
6
+ <?php if( $_storedCards && (count($_storedCards) > 0) ): ?>
7
+ <table class="data-table" id="stored-cards-table">
8
+ <col />
9
+ <col width="1" />
10
+ <col width="1" />
11
+ <col width="1" />
12
+ <thead>
13
+ <tr>
14
+ <th><?php echo $this->__('Credit Card') ?></th>
15
+ <th><?php echo $this->__('Expiration Date') ?></th>
16
+ <th><?php echo $this->__('Last Used') ?></th>
17
+ <th>&nbsp;</th>
18
+ </tr>
19
+ </thead>
20
+ <tbody>
21
+ <?php foreach ($_storedCards as $_storedCard): ?>
22
+ <tr>
23
+ <td><?php echo Mage::helper('securepay')->translateCcType($_storedCard->getCcType()) ?> (<?php echo sprintf('xxxx-%s', $_storedCard->getCcLast4()) ?>)</td>
24
+ <td class="a-center"><span class="nobr"><?php echo sprintf('%02d',$_storedCard->getCcExpMonth()); ?>/<?php echo $_storedCard->getCcExpYear() ?></span></td>
25
+ <td class="a-center"><span class="nobr"><?php echo Mage::app()->getLocale()->date($_storedCard->getUpdatedDate())->toString('MMM-dd-yyyy') ?></span></td>
26
+ <td class="a-center">
27
+ <span class="nobr">
28
+ <a href="<?php echo $this->getDeleteUrl($_storedCard) ?>" onclick="return confirm('<?php echo $this->__('Are you sure?') ?>')"><?php echo $this->__('Delete') ?></a>
29
+ </span>
30
+ </td>
31
+ </tr>
32
+ <?php endforeach; ?>
33
+ </tbody>
34
+ </table>
35
+ <script type="text/javascript">decorateTable('stored-cards-table')</script>
36
+ <?php else: ?>
37
+ <p><?php echo $this->__('You have not saved any credit card details.'); ?></p>
38
+ <?php endif; ?>
39
+ </div>
app/design/frontend/base/default/template/AMG/securepay/directpost/customervault/form.phtml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $_code=$this->getMethodCode();
3
+ $_storedCards = $this->getCustomerVaultsCollection();
4
+ $_storedCardHelper = Mage::helper('securepay');
5
+ ?>
6
+ <ul class="form-list" id="payment_form_<?php echo $_code ?>" style="display:none;">
7
+ <li>
8
+ <div class="input-box">
9
+ <?php if ( $_storedCards && (count($_storedCards) > 0) ): ?>
10
+ <select id="<?php echo $_code ?>_customervault_code" name="payment[customervault_code]" class="required-entry validate-select">
11
+ <option value=""><?php echo $this->__('--Please Select--')?></option>
12
+ <?php foreach ($_storedCards as $_storedCard): ?>
13
+ <option value="<?php echo $_storedCard->getCode() ?>"><?php echo $_storedCardHelper->translateCcType($_storedCard->getData('cc_type')) ?> (<?php echo sprintf('xxxx-%s', $_storedCard->getData('cc_last4')) ?>)</option>
14
+ <?php endforeach ?>
15
+ </select>
16
+ <?php endif; ?>
17
+ </div>
18
+ </li>
19
+ </ul>
app/design/frontend/base/default/template/AMG/securepay/directpost/form.phtml ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $_form = $this;
3
+ $_code = $_form->getMethodCode();
4
+ $_method = $_form->getMethod();
5
+ ?>
6
+
7
+ <ul id="payment_form_<?php echo $_code ?>" class="form-list" style="display:none;">
8
+ <li>
9
+ <label for="<?php echo $_code ?>_cc_type" class="required"><em>*</em><?php echo $this->__('Credit Card Type') ?></label>
10
+ <div class="input-box">
11
+ <select id="<?php echo $_code ?>_cc_type" name="payment[cc_type]" class="required-entry validate-cc-type-select">
12
+ <option value=""><?php echo $this->__('--Please Select--')?></option>
13
+ <?php $_ccType = $_form->getInfoData('cc_type') ?>
14
+ <?php foreach ($_form->getCcAvailableTypes() as $_typeCode => $_typeName): ?>
15
+ <option value="<?php echo $_typeCode ?>"<?php if($_typeCode==$_ccType): ?> selected="selected"<?php endif ?>><?php echo $_typeName ?></option>
16
+ <?php endforeach ?>
17
+ </select>
18
+ </div>
19
+ </li>
20
+ <li>
21
+ <label for="<?php echo $_code ?>_cc_number" class="required"><em>*</em><?php echo $this->__('Credit Card Number') ?></label>
22
+ <div class="input-box">
23
+ <input type="text" id="<?php echo $_code ?>_cc_number" name="payment[cc_number]" title="<?php echo $this->__('Credit Card Number') ?>" class="input-text validate-cc-number validate-cc-type" value="" />
24
+ </div>
25
+ </li>
26
+ <li id="<?php echo $_code ?>_cc_type_exp_div">
27
+ <label for="<?php echo $_code ?>_expiration" class="required"><em>*</em><?php echo $this->__('Expiration Date') ?></label>
28
+ <div class="input-box">
29
+ <div class="v-fix">
30
+ <select id="<?php echo $_code ?>_expiration" name="payment[cc_exp_month]" class="month validate-cc-exp required-entry">
31
+ <?php $_ccExpMonth = $_form->getInfoData('cc_exp_month') ?>
32
+ <?php
33
+ foreach ($_form->getCcMonths() as $k=>$v):
34
+ $k = sprintf("%02d", $k)
35
+ ?>
36
+ <option value="<?php echo $k?$k:'' ?>"<?php if($k==$_ccExpMonth): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
37
+ <?php endforeach ?>
38
+ </select>
39
+ </div>
40
+ <div class="v-fix">
41
+ <?php $_ccExpYear = $_form->getInfoData('cc_exp_year') ?>
42
+ <select id="<?php echo $_code ?>_expiration_yr" name="payment[cc_exp_year]" class="year required-entry">
43
+ <?php foreach ($_form->getCcYears() as $k=>$v): ?>
44
+ <option value="<?php echo $k?$k:'' ?>"<?php if($k==$_ccExpYear): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
45
+ <?php endforeach ?>
46
+ </select>
47
+ </div>
48
+ </div>
49
+ </li>
50
+ <?php echo $_form->getChildHtml() ?>
51
+ <?php if($_form->hasVerification()): ?>
52
+ <li id="<?php echo $_code ?>_cc_type_cvv_div">
53
+ <label for="<?php echo $_code ?>_cc_cid" class="required"><em>*</em><?php echo $this->__('Card Verification Number') ?></label>
54
+ <div class="input-box">
55
+ <div class="v-fix">
56
+ <input type="text" title="<?php echo $this->__('Card Verification Number') ?>" class="input-text cvv required-entry validate-cc-cvn" id="<?php echo $_code ?>_cc_cid" name="payment[cc_cid]" value="" />
57
+ </div>
58
+ <a href="#" id="directpost-cvv-what-is-this" style="cursor:help; margin-left:5px;"><?php echo $this->__('What is this?') ?></a>
59
+ </div>
60
+ </li>
61
+ <?php endif; ?>
62
+ <?php if ($this->isCcSaveAllowed()): ?>
63
+ <li>
64
+ <div class="input-box">
65
+ <div class="v-fix">
66
+ <input type="checkbox" id="<?php echo $_code ?>_cc_save_future_directpost" name="payment[cc_save_future_directpost]" value="Y" />
67
+ <label for="<?php echo $_code ?>_cc_save_future_directpost"><?php echo $this->__('Save this card for future use') ?></label>
68
+ </div>
69
+ </div>
70
+
71
+ </li>
72
+ <?php endif; ?>
73
+ </ul>
74
+ <div class="tool-tip" id="directpost-tool-tip" style="display:none;">
75
+ <div class="btn-close"><a href="#" id="directpost-tool-tip-close" title="<?php echo $this->__('Close') ?>"><?php echo $this->__('Close') ?></a></div>
76
+ <div class="tool-tip-content"><img src="<?php echo $this->getSkinUrl('images/cvv.gif') ?>" alt="<?php echo $this->__('Card Verification Number Visual Reference') ?>" title="<?php echo $this->__('Card Verification Number Visual Reference') ?>" /></div>
77
+
78
+ <script type="text/javascript">
79
+ //<![CDATA[
80
+ if ($('directpost-cvv-what-is-this')) {
81
+ $('directpost-cvv-what-is-this').observe('click', toggleCvvToolTip);
82
+ }
83
+ new Validation('co-directpost-form-1');
84
+
85
+ function toggleCvvToolTip(event){
86
+ if($('directpost-tool-tip')){
87
+ $('directpost-tool-tip').setStyle({
88
+ top: (Event.pointerY(event)-560)+'px'
89
+ })
90
+ $('directpost-tool-tip').toggle();
91
+ }
92
+ Event.stop(event);
93
+ }
94
+ if($('directpost-tool-tip-close')){
95
+ Event.observe($('directpost-tool-tip-close'), 'click', toggleCvvToolTip);
96
+ }
97
+ //]]>
98
+ </script>
app/etc/modules/AMG_SecurePay.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <AMG_SecurePay>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </AMG_SecurePay>
8
+ </modules>
9
+ </config>
app/locale/en_US/AMG/SecurePay.csv ADDED
@@ -0,0 +1 @@
 
1
+
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>AMG_SecurePay</name>
4
+ <version>0.1.0</version>
5
+ <stability>stable</stability>
6
+ <license>GNU</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>AMG_SecurePay</summary>
10
+ <description>AMG_SecurePay</description>
11
+ <notes>AMG_SecurePay</notes>
12
+ <authors><author><name>AMG</name><user>amgms</user><email>magento@amgms.com</email></author></authors>
13
+ <date>2016-09-13</date>
14
+ <time>06:43:42</time>
15
+ <contents><target name="magecommunity"><dir name="AMG"><dir name="SecurePay"><dir name="Block"><dir name="Customer"><file name="Storedcard.php" hash="5155e82c17a0657305fef2ac4fd1709f"/></dir><dir name="Directpost"><dir name="Customervault"><file name="Form.php" hash="0f5a9c26e08ad45298874e5db09e35cf"/></dir><file name="Form.php" hash="fd5fd0f7238722ecb255d4859834d4b9"/></dir></dir><dir name="Helper"><file name="Data.php" hash="9bf2d56189deb05cc1fa8b513c40dfb1"/></dir><dir name="Model"><file name="Api.php" hash="7c6559545ca272b78c7ed1088c7eb182"/><file name="Customervault.php" hash="d8a723bd068d3b7f13dc7352bd8c9509"/><dir name="Directpost"><dir name="Customervault"><dir name="Source"><file name="PaymentAction.php" hash="98bfad6ca419d0db31005eb4a763d199"/></dir></dir><file name="Customervault.php" hash="680ebff6c7fb603bd16fcf9ebf6c71a9"/><dir name="Source"><file name="PaymentAction.php" hash="e2162e441acc4bcad6c36fe386e50520"/></dir></dir><file name="Directpost.php" hash="2520bdf2a8b9b75daa4209215cf55799"/><dir name="Mysql4"><dir name="Customervault"><file name="Collection.php" hash="fc6ceef57e7d676a985df03f1c93d857"/></dir><file name="Customervault.php" hash="9bb15741d53bd491b43ee4884e6ed2a2"/></dir><file name="Observer.php" hash="bfefefa446d27d6bb02a056e8549b088"/></dir><dir name="controllers"><file name="StoredcardController.php" hash="77e6805a8d6eea7b40372c4dba2470da"/></dir><dir name="etc"><file name="config.xml" hash="6eab3d49399e8faa85fead10b84999fe"/><file name="system.xml" hash="29d4b60b9bd2346f843a418fc9f6892e"/></dir><dir name="sql"><dir name="securepay_setup"><file name="mysql4-install-0.1.0.php" hash="36ad780c2559b0aad527cad97a29ee7e"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="AMG"><dir name="securepay"><dir name="directpost"><dir name="customervault"><file name="form.phtml" hash="13f5325afb5b0c8ea7b33888416d3a7f"/></dir><file name="form.phtml" hash="42ff9821f7c07e24f5498b2a7d0726d7"/></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="AMG"><file name="securepay.xml" hash="13c5ae311ac8f3df9519180bed2b77f3"/></dir></dir><dir name="template"><dir name="AMG"><dir name="securepay"><dir name="customer"><file name="storedcard.phtml" hash="79c567da290f7274c527dff2d66a41fc"/></dir><dir name="directpost"><dir name="customervault"><file name="form.phtml" hash="13f5325afb5b0c8ea7b33888416d3a7f"/></dir><file name="form.phtml" hash="54f969bf71cd3c2e6fe9be64cfdb9c6f"/></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="AMG_SecurePay.xml" hash="438f9aa78bbf55028c080141df9b1b66"/></dir></target><target name="magelocale"><dir name="en_US"><dir name="AMG"><file name="SecurePay.csv" hash="81051bcc2cf1bedf378224b0a93e2877"/></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>4.5.0</min><max>7.0.0</max></php></required></dependencies>
18
+ </package>