Version Notes
Added currency filter
Download this release
Release Info
Developer | Albert Fatsini |
Extension | Pagantis_Pagantis |
Version | 3.2.2 |
Comparing to | |
See all releases |
Code changes from version 3.2.1 to 3.2.2
- app/code/community/Pagantis/Pagantis/Helper/Data.php +6 -5
- app/code/community/Pagantis/Pagantis/Model/Payment.php +15 -1
- app/code/community/Pagantis/Pagantis/Model/Webservice/Request.php +110 -11
- app/code/community/Pagantis/Pagantis/Model/Webservice/Requestloan.php +76 -4
- app/design/frontend/base/default/template/pagantis/redirect.phtml +13 -14
- package.xml +5 -6
app/code/community/Pagantis/Pagantis/Helper/Data.php
CHANGED
@@ -96,7 +96,7 @@ class Pagantis_Pagantis_Helper_Data extends Mage_Core_Helper_Abstract
|
|
96 |
$request->setOrderId($orderId);
|
97 |
$request->setAmount($amount);
|
98 |
$request->setLanguagePagantis($language);
|
99 |
-
$request->setUrlPagantis
|
100 |
$request->setUserData($addressId);
|
101 |
$request->setUserBillData($addressBillingId);
|
102 |
$request->setOrderItems($orderId);
|
@@ -104,7 +104,8 @@ class Pagantis_Pagantis_Helper_Data extends Mage_Core_Helper_Abstract
|
|
104 |
$request->setDiscount($this->_config['discount']);
|
105 |
$request->setIframe($this->_config['iframe']);
|
106 |
$request->setEndOfMonth('true');
|
107 |
-
|
|
|
108 |
case Pagantis_Pagantis_Model_Webservice_Client::ENV_TESTING:
|
109 |
$request->setAccountCode($this->_config['account_code_test']);
|
110 |
$request->setAccountKey($this->_config['account_key_test']);
|
@@ -137,12 +138,11 @@ class Pagantis_Pagantis_Helper_Data extends Mage_Core_Helper_Abstract
|
|
137 |
$addressId = $order->getShippingAddress()->getId();
|
138 |
$addressBillingId = $order->getBillingAddress()->getId();
|
139 |
|
140 |
-
|
141 |
$request = Mage::getModel('pagantis_pagantis/webservice_requestloan');
|
142 |
$request->setOrderId($orderId);
|
143 |
$request->setAmount($amount);
|
144 |
$request->setLanguagePagantis($language);
|
145 |
-
$request->setUrlPagantis
|
146 |
$request->setUserData($addressId);
|
147 |
$request->setUserBillData($addressBillingId);
|
148 |
$request->setOrderItems($orderId);
|
@@ -150,7 +150,8 @@ class Pagantis_Pagantis_Helper_Data extends Mage_Core_Helper_Abstract
|
|
150 |
$request->setDiscount($this->_config['discount']);
|
151 |
$request->setIframe($this->_config['iframe']);
|
152 |
$request->setEndOfMonth('false');
|
153 |
-
|
|
|
154 |
case Pagantis_Pagantis_Model_Webservice_Client::ENV_TESTING:
|
155 |
$request->setAccountCode($this->_config['account_code_test']);
|
156 |
$request->setAccountKey($this->_config['account_key_test']);
|
96 |
$request->setOrderId($orderId);
|
97 |
$request->setAmount($amount);
|
98 |
$request->setLanguagePagantis($language);
|
99 |
+
$request->setUrlPagantis(Pagantis_Pagantis_Model_Payment::PMT_URL);
|
100 |
$request->setUserData($addressId);
|
101 |
$request->setUserBillData($addressBillingId);
|
102 |
$request->setOrderItems($orderId);
|
104 |
$request->setDiscount($this->_config['discount']);
|
105 |
$request->setIframe($this->_config['iframe']);
|
106 |
$request->setEndOfMonth('true');
|
107 |
+
$request->setUserExtraData($addressId);
|
108 |
+
switch ($this->_config['environment']) {
|
109 |
case Pagantis_Pagantis_Model_Webservice_Client::ENV_TESTING:
|
110 |
$request->setAccountCode($this->_config['account_code_test']);
|
111 |
$request->setAccountKey($this->_config['account_key_test']);
|
138 |
$addressId = $order->getShippingAddress()->getId();
|
139 |
$addressBillingId = $order->getBillingAddress()->getId();
|
140 |
|
|
|
141 |
$request = Mage::getModel('pagantis_pagantis/webservice_requestloan');
|
142 |
$request->setOrderId($orderId);
|
143 |
$request->setAmount($amount);
|
144 |
$request->setLanguagePagantis($language);
|
145 |
+
$request->setUrlPagantis(Pagantis_Pagantis_Model_Payment::PMT_URL);
|
146 |
$request->setUserData($addressId);
|
147 |
$request->setUserBillData($addressBillingId);
|
148 |
$request->setOrderItems($orderId);
|
150 |
$request->setDiscount($this->_config['discount']);
|
151 |
$request->setIframe($this->_config['iframe']);
|
152 |
$request->setEndOfMonth('false');
|
153 |
+
$request->setUserExtraData($addressId);
|
154 |
+
switch ($this->_config['environment']) {
|
155 |
case Pagantis_Pagantis_Model_Webservice_Client::ENV_TESTING:
|
156 |
$request->setAccountCode($this->_config['account_code_test']);
|
157 |
$request->setAccountKey($this->_config['account_key_test']);
|
app/code/community/Pagantis/Pagantis/Model/Payment.php
CHANGED
@@ -18,6 +18,8 @@ class Pagantis_Pagantis_Model_Payment extends Mage_Payment_Model_Method_Abstract
|
|
18 |
protected $_canUseInternal = false;
|
19 |
protected $_canUseForMultishipping = false;
|
20 |
protected $_config = null;
|
|
|
|
|
21 |
|
22 |
const PAYMENT_END_OF_MONTH = 'end_of_month';
|
23 |
const PAYMENT_LOAN = 'financiacion';
|
@@ -123,5 +125,17 @@ class Pagantis_Pagantis_Model_Payment extends Mage_Payment_Model_Method_Abstract
|
|
123 |
return false;
|
124 |
}
|
125 |
|
126 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
}
|
18 |
protected $_canUseInternal = false;
|
19 |
protected $_canUseForMultishipping = false;
|
20 |
protected $_config = null;
|
21 |
+
protected $_allowCurrencyCode = array('EUR');
|
22 |
+
|
23 |
|
24 |
const PAYMENT_END_OF_MONTH = 'end_of_month';
|
25 |
const PAYMENT_LOAN = 'financiacion';
|
125 |
return false;
|
126 |
}
|
127 |
|
128 |
+
/**
|
129 |
+
* Whether method is available for specified currency
|
130 |
+
*
|
131 |
+
* @param string $currencyCode
|
132 |
+
* @return bool
|
133 |
+
*/
|
134 |
+
public function canUseForCurrency($currencyCode)
|
135 |
+
{
|
136 |
+
if (!in_array($currencyCode, $this->_allowCurrencyCode)) {
|
137 |
+
return false;
|
138 |
+
}
|
139 |
+
return true;
|
140 |
+
}
|
141 |
}
|
app/code/community/Pagantis/Pagantis/Model/Webservice/Request.php
CHANGED
@@ -117,7 +117,7 @@ class Pagantis_Pagantis_Model_Webservice_Request
|
|
117 |
$array['end_of_month'] = $this->_end_of_month;
|
118 |
|
119 |
$array['locale'] = $this->_languagePagantis;
|
120 |
-
$array['
|
121 |
$array['full_name'] = $this->_userData['full_name'];
|
122 |
$array['email'] = $this->_userData['email'];
|
123 |
$array['address[street]'] = $this->_userData['Bstreet'];
|
@@ -129,8 +129,15 @@ class Pagantis_Pagantis_Model_Webservice_Request
|
|
129 |
$array['shipping[province]'] = $this->_userData['province'];
|
130 |
$array['shipping[zipcode]'] = $this->_userData['zipcode'];
|
131 |
$array['dni'] = $this->_userData['dni'];
|
132 |
-
|
133 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
134 |
$array['items[' . $key . '][description]'] = $value['description'];
|
135 |
$array['items[' . $key . '][quantity]'] = $value['quantity'];
|
136 |
$array['items[' . $key . '][amount]'] = $value['amount'];
|
@@ -212,8 +219,10 @@ class Pagantis_Pagantis_Model_Webservice_Request
|
|
212 |
if ($addressId) {
|
213 |
$address = Mage::getModel('sales/order_address')->load($addressId);
|
214 |
$street = $address->getStreet();
|
215 |
-
if ($street){
|
216 |
$this->_userData['street'] = $street[0];
|
|
|
|
|
217 |
}
|
218 |
$this->_userData['city'] = $address->getCity();
|
219 |
$this->_userData['province'] = $address->getCity();
|
@@ -221,10 +230,100 @@ class Pagantis_Pagantis_Model_Webservice_Request
|
|
221 |
$this->_userData['dni'] = $address->getVatId();
|
222 |
$this->_userData['full_name'] = $address->getFirstname() . ' ' . $address->getLastname();
|
223 |
$this->_userData['email'] = $address->getEmail();
|
224 |
-
$this->_userData['
|
225 |
} else {
|
226 |
throw new \Exception('Missing user data info');
|
227 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
228 |
}
|
229 |
|
230 |
/**
|
@@ -421,12 +520,12 @@ class Pagantis_Pagantis_Model_Webservice_Request
|
|
421 |
*/
|
422 |
public function setCacllbackUrl()
|
423 |
{
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
}
|
431 |
|
432 |
/**
|
117 |
$array['end_of_month'] = $this->_end_of_month;
|
118 |
|
119 |
$array['locale'] = $this->_languagePagantis;
|
120 |
+
$array['mobile_phone'] = $this->_userData['mobile_phone'];
|
121 |
$array['full_name'] = $this->_userData['full_name'];
|
122 |
$array['email'] = $this->_userData['email'];
|
123 |
$array['address[street]'] = $this->_userData['Bstreet'];
|
129 |
$array['shipping[province]'] = $this->_userData['province'];
|
130 |
$array['shipping[zipcode]'] = $this->_userData['zipcode'];
|
131 |
$array['dni'] = $this->_userData['dni'];
|
132 |
+
$array['dob'] = $this->_userData['dob'];
|
133 |
+
$array['metadata[member_since]'] = $this->_userData['sign_up_date'];
|
134 |
+
$array['metadata[num_orders]'] = $this->_userData['num_prev_orders'];
|
135 |
+
$array['metadata[amount_orders]'] = $this->_userData['total_paid'];
|
136 |
+
$array['metadata[num_full_refunds]'] = $this->_userData['num_full_refunds'];
|
137 |
+
$array['metadata[num_partial_refunds]'] = $this->_userData['num_partial_refunds'];
|
138 |
+
$array['metadata[amount_refunds]'] = $this->_userData['amount_refunded'];
|
139 |
+
|
140 |
+
foreach ($this->_items as $key => $value) {
|
141 |
$array['items[' . $key . '][description]'] = $value['description'];
|
142 |
$array['items[' . $key . '][quantity]'] = $value['quantity'];
|
143 |
$array['items[' . $key . '][amount]'] = $value['amount'];
|
219 |
if ($addressId) {
|
220 |
$address = Mage::getModel('sales/order_address')->load($addressId);
|
221 |
$street = $address->getStreet();
|
222 |
+
if (is_array($street)) {
|
223 |
$this->_userData['street'] = $street[0];
|
224 |
+
} else {
|
225 |
+
$this->_userData['street'] = $street;
|
226 |
}
|
227 |
$this->_userData['city'] = $address->getCity();
|
228 |
$this->_userData['province'] = $address->getCity();
|
230 |
$this->_userData['dni'] = $address->getVatId();
|
231 |
$this->_userData['full_name'] = $address->getFirstname() . ' ' . $address->getLastname();
|
232 |
$this->_userData['email'] = $address->getEmail();
|
233 |
+
$this->_userData['mobile_phone'] = $address->getTelephone();
|
234 |
} else {
|
235 |
throw new \Exception('Missing user data info');
|
236 |
}
|
237 |
+
|
238 |
+
//fix to avoid empty fields
|
239 |
+
if (Mage::getSingleton('customer/session')->isLoggedIn()) {
|
240 |
+
$customer = Mage::getSingleton('customer/session')->getCustomer();
|
241 |
+
if (empty($this->_userData['email'])){
|
242 |
+
$this->_userData['email'] = $customer->getEmail();
|
243 |
+
}
|
244 |
+
if (empty($this->_userData['full_name'])){
|
245 |
+
$this->_userData['full_name'] = $customer->getFirstname() . ' ' . $customer->getLastname();
|
246 |
+
}
|
247 |
+
if (empty($this->_userData['dni'])){
|
248 |
+
$this->_userData['dni'] = $customer->getData('taxvat');
|
249 |
+
}
|
250 |
+
if (empty($this->_userData['phone'])){
|
251 |
+
$this->_userData['phone'] = $customer->getPrimaryBillingAddress()->getTelephone();
|
252 |
+
}
|
253 |
+
if (empty($this->_userData['mobile_phone'])){
|
254 |
+
$this->_userData['mobile_phone'] = $customer->getPrimaryBillingAddress()->getTelephone();
|
255 |
+
}
|
256 |
+
if (empty($this->_userData['zipcode'])){
|
257 |
+
$this->_userData['zipcode'] = $customer->getPrimaryBillingAddress()->getPostcode();
|
258 |
+
}
|
259 |
+
$this->_userData['dob'] =substr($customer->getDob(),0,10);
|
260 |
+
}
|
261 |
+
}
|
262 |
+
|
263 |
+
/**
|
264 |
+
* Assign user extra data
|
265 |
+
* @param string $addressId
|
266 |
+
*/
|
267 |
+
public function setUserExtraData($addressId)
|
268 |
+
{
|
269 |
+
//set default values if we don't find the customer
|
270 |
+
$this->_userData['sign_up_date']= '';
|
271 |
+
$this->_userData['num_prev_orders'] = 0;
|
272 |
+
$this->_userData['total_paid'] = 0;
|
273 |
+
$this->_userData['amount_refunded'] = 0;
|
274 |
+
$this->_userData['num_refunds'] = 0;
|
275 |
+
if (Mage::getSingleton('customer/session')->isLoggedIn()) {
|
276 |
+
//if user is logged
|
277 |
+
$customer = Mage::getSingleton('customer/session')->getCustomer();
|
278 |
+
} else {
|
279 |
+
//user not logged
|
280 |
+
if ($addressId) {
|
281 |
+
$address = Mage::getModel('sales/order_address')->load($addressId);
|
282 |
+
$email = $address->getEmail();
|
283 |
+
$customer = Mage::getModel("customer/customer");
|
284 |
+
$customer->setWebsiteId(Mage::app()->getStore()->getWebsiteId());
|
285 |
+
$customer->loadByEmail($email);
|
286 |
+
}
|
287 |
+
}
|
288 |
+
|
289 |
+
if ($customer->getId() != null) {
|
290 |
+
$this->_userData['sign_up_date'] = date('Y/m/d', $customer->getCreatedAtTimestamp());
|
291 |
+
$_orders = Mage::getModel('sales/order')->getCollection()->
|
292 |
+
addFieldToFilter('customer_id', $customer->getId())->
|
293 |
+
addFieldToFilter('status', array(
|
294 |
+
array('finset'=> array('complete')),
|
295 |
+
array('finset'=> array('processing')),
|
296 |
+
));
|
297 |
+
$this->_userData['num_prev_orders'] = $_orders->count();
|
298 |
+
$total = 0;
|
299 |
+
foreach ($_orders as $order) {
|
300 |
+
$total += $order->getGrandTotal();
|
301 |
+
}
|
302 |
+
|
303 |
+
$total_memo_amt = 0;
|
304 |
+
$total_partial_memos = 0;
|
305 |
+
$total_full_memos = 0;
|
306 |
+
$_orders = Mage::getModel('sales/order')->getCollection()->
|
307 |
+
addFieldToFilter('customer_id', $customer->getId());
|
308 |
+
foreach ($_orders as $order) {
|
309 |
+
$creditMemos = Mage::getResourceModel('sales/order_creditmemo_collection');
|
310 |
+
$creditMemos->addFieldToFilter('order_id', $order->getId());
|
311 |
+
$creditMemos->setOrder('created_at', 'DESC');
|
312 |
+
foreach ($creditMemos as $memo) {
|
313 |
+
if ($order->getGrandTotal() == $memo->getGrandTotal()) {
|
314 |
+
$total_full_memos += 1;
|
315 |
+
} else {
|
316 |
+
$total_partial_memos += 1;
|
317 |
+
}
|
318 |
+
$total_memo_amt += $memo->getGrandTotal();
|
319 |
+
}
|
320 |
+
//$total_memos += $creditMemos->count();
|
321 |
+
}
|
322 |
+
$this->_userData['amount_refunded'] = ($total_memo_amt);
|
323 |
+
$this->_userData['num_full_refunds'] = ($total_full_memos);
|
324 |
+
$this->_userData['num_partial_refunds'] = ($total_partial_memos);
|
325 |
+
$this->_userData['total_paid'] = $total;
|
326 |
+
}
|
327 |
}
|
328 |
|
329 |
/**
|
520 |
*/
|
521 |
public function setCacllbackUrl()
|
522 |
{
|
523 |
+
if (Mage::app()->getStore()->isFrontUrlSecure()){
|
524 |
+
$this->_callback_url=Mage::getUrl('',array('_forced_secure'=>true))."pagantis/pagantis/notification";
|
525 |
+
}else{
|
526 |
+
$this->_callback_url=Mage::getUrl('',array('_forced_secure'=>false))."pagantis/pagantis/notification";
|
527 |
+
}
|
528 |
+
$this->_callback_url = Mage::getModel('core/url')->sessionUrlVar($this->_callback_url);
|
529 |
}
|
530 |
|
531 |
/**
|
app/code/community/Pagantis/Pagantis/Model/Webservice/Requestloan.php
CHANGED
@@ -130,8 +130,14 @@ class Pagantis_Pagantis_Model_Webservice_Requestloan
|
|
130 |
$array['shipping[zipcode]'] = $this->_userData['zipcode'];
|
131 |
$array['dni'] = $this->_userData['dni'];
|
132 |
$array['dob'] = $this->_userData['dob'];
|
133 |
-
|
134 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
$array['items[' . $key . '][description]'] = $value['description'];
|
136 |
$array['items[' . $key . '][quantity]'] = $value['quantity'];
|
137 |
$array['items[' . $key . '][amount]'] = $value['amount'];
|
@@ -214,9 +220,9 @@ class Pagantis_Pagantis_Model_Webservice_Requestloan
|
|
214 |
if ($addressId) {
|
215 |
$address = Mage::getModel('sales/order_address')->load($addressId);
|
216 |
$street = $address->getStreet();
|
217 |
-
if (is_array($street)){
|
218 |
$this->_userData['street'] = $street[0];
|
219 |
-
}else{
|
220 |
$this->_userData['street'] = $street;
|
221 |
}
|
222 |
$this->_userData['city'] = $address->getCity();
|
@@ -255,6 +261,72 @@ class Pagantis_Pagantis_Model_Webservice_Requestloan
|
|
255 |
}
|
256 |
}
|
257 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
258 |
/**
|
259 |
* Assign user data
|
260 |
* @param string $addressId
|
130 |
$array['shipping[zipcode]'] = $this->_userData['zipcode'];
|
131 |
$array['dni'] = $this->_userData['dni'];
|
132 |
$array['dob'] = $this->_userData['dob'];
|
133 |
+
$array['metadata[member_since]'] = $this->_userData['sign_up_date'];
|
134 |
+
$array['metadata[num_orders]'] = $this->_userData['num_prev_orders'];
|
135 |
+
$array['metadata[amount_orders]'] = $this->_userData['total_paid'];
|
136 |
+
$array['metadata[num_full_refunds]'] = $this->_userData['num_full_refunds'];
|
137 |
+
$array['metadata[num_partial_refunds]'] = $this->_userData['num_partial_refunds'];
|
138 |
+
$array['metadata[amount_refunds]'] = $this->_userData['amount_refunded'];
|
139 |
+
|
140 |
+
foreach ($this->_items as $key => $value) {
|
141 |
$array['items[' . $key . '][description]'] = $value['description'];
|
142 |
$array['items[' . $key . '][quantity]'] = $value['quantity'];
|
143 |
$array['items[' . $key . '][amount]'] = $value['amount'];
|
220 |
if ($addressId) {
|
221 |
$address = Mage::getModel('sales/order_address')->load($addressId);
|
222 |
$street = $address->getStreet();
|
223 |
+
if (is_array($street)) {
|
224 |
$this->_userData['street'] = $street[0];
|
225 |
+
} else {
|
226 |
$this->_userData['street'] = $street;
|
227 |
}
|
228 |
$this->_userData['city'] = $address->getCity();
|
261 |
}
|
262 |
}
|
263 |
|
264 |
+
/**
|
265 |
+
* Assign user extra data
|
266 |
+
* @param string $addressId
|
267 |
+
*/
|
268 |
+
public function setUserExtraData($addressId)
|
269 |
+
{
|
270 |
+
//set default values if we don't find the customer
|
271 |
+
$this->_userData['sign_up_date']= '';
|
272 |
+
$this->_userData['num_prev_orders'] = 0;
|
273 |
+
$this->_userData['total_paid'] = 0;
|
274 |
+
$this->_userData['amount_refunded'] = 0;
|
275 |
+
$this->_userData['num_refunds'] = 0;
|
276 |
+
if (Mage::getSingleton('customer/session')->isLoggedIn()) {
|
277 |
+
//if user is logged
|
278 |
+
$customer = Mage::getSingleton('customer/session')->getCustomer();
|
279 |
+
} else {
|
280 |
+
//user not logged
|
281 |
+
if ($addressId) {
|
282 |
+
$address = Mage::getModel('sales/order_address')->load($addressId);
|
283 |
+
$email = $address->getEmail();
|
284 |
+
$customer = Mage::getModel("customer/customer");
|
285 |
+
$customer->setWebsiteId(Mage::app()->getStore()->getWebsiteId());
|
286 |
+
$customer->loadByEmail($email);
|
287 |
+
}
|
288 |
+
}
|
289 |
+
|
290 |
+
if ($customer->getId() != null) {
|
291 |
+
$this->_userData['sign_up_date'] = date('Y/m/d', $customer->getCreatedAtTimestamp());
|
292 |
+
$_orders = Mage::getModel('sales/order')->getCollection()->
|
293 |
+
addFieldToFilter('customer_id', $customer->getId())->
|
294 |
+
addFieldToFilter('status', array(
|
295 |
+
array('finset'=> array('complete')),
|
296 |
+
array('finset'=> array('processing')),
|
297 |
+
));
|
298 |
+
$this->_userData['num_prev_orders'] = $_orders->count();
|
299 |
+
$total = 0;
|
300 |
+
foreach ($_orders as $order) {
|
301 |
+
$total += $order->getGrandTotal();
|
302 |
+
}
|
303 |
+
|
304 |
+
$total_memo_amt = 0;
|
305 |
+
$total_partial_memos = 0;
|
306 |
+
$total_full_memos = 0;
|
307 |
+
$_orders = Mage::getModel('sales/order')->getCollection()->
|
308 |
+
addFieldToFilter('customer_id', $customer->getId());
|
309 |
+
foreach ($_orders as $order) {
|
310 |
+
$creditMemos = Mage::getResourceModel('sales/order_creditmemo_collection');
|
311 |
+
$creditMemos->addFieldToFilter('order_id', $order->getId());
|
312 |
+
$creditMemos->setOrder('created_at', 'DESC');
|
313 |
+
foreach ($creditMemos as $memo) {
|
314 |
+
if ($order->getGrandTotal() == $memo->getGrandTotal()) {
|
315 |
+
$total_full_memos += 1;
|
316 |
+
} else {
|
317 |
+
$total_partial_memos += 1;
|
318 |
+
}
|
319 |
+
$total_memo_amt += $memo->getGrandTotal();
|
320 |
+
}
|
321 |
+
//$total_memos += $creditMemos->count();
|
322 |
+
}
|
323 |
+
$this->_userData['amount_refunded'] = ($total_memo_amt);
|
324 |
+
$this->_userData['num_full_refunds'] = ($total_full_memos);
|
325 |
+
$this->_userData['num_partial_refunds'] = ($total_partial_memos);
|
326 |
+
$this->_userData['total_paid'] = $total;
|
327 |
+
}
|
328 |
+
}
|
329 |
+
|
330 |
/**
|
331 |
* Assign user data
|
332 |
* @param string $addressId
|
app/design/frontend/base/default/template/pagantis/redirect.phtml
CHANGED
@@ -37,23 +37,22 @@ el.addEventListener('click', function (e){
|
|
37 |
document.getElementById('iframe-pagantis').style.display = 'block';
|
38 |
document.getElementById('myModal').style.display = 'block';
|
39 |
});
|
|
|
40 |
var closeModal = function closeModal(evt) {
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
</script>
|
50 |
|
51 |
-
<script>
|
52 |
document.addEventListener("DOMContentLoaded", function(event) {
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
});
|
58 |
</script>
|
59 |
|
37 |
document.getElementById('iframe-pagantis').style.display = 'block';
|
38 |
document.getElementById('myModal').style.display = 'block';
|
39 |
});
|
40 |
+
|
41 |
var closeModal = function closeModal(evt) {
|
42 |
+
evt.preventDefault();
|
43 |
+
document.getElementById('myModal').style.display = 'none';
|
44 |
+
};
|
45 |
+
|
46 |
+
var elements = document.querySelectorAll('#paylater_close, #myModal');
|
47 |
+
Array.prototype.forEach.call(elements, function(el){
|
48 |
+
el.addEventListener('click', closeModal);
|
49 |
+
});
|
|
|
50 |
|
|
|
51 |
document.addEventListener("DOMContentLoaded", function(event) {
|
52 |
+
document.getElementById('pagantis_pagantis_checkout').setAttribute('target', 'iframe-pagantis');
|
53 |
+
document.getElementById('pagantis_pagantis_checkout').submit();
|
54 |
+
document.getElementById('iframe-pagantis').style.display = 'block';
|
55 |
+
document.getElementById('myModal').style.display = 'block';
|
56 |
});
|
57 |
</script>
|
58 |
|
package.xml
CHANGED
@@ -1,19 +1,18 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Pagantis_Pagantis</name>
|
4 |
-
<version>3.2.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.gnu.org/licenses/gpl-3.0.en.html">GPL</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Modulo de Magento para habilitar la pasarela de pago Pagantis en Magento.</summary>
|
10 |
<description>Con este módulo se podrá activar la pasarela de pago Pagantis en Magento y aceptar pago con tarjetas de debito.</description>
|
11 |
-
<notes>
|
12 |
-
</notes>
|
13 |
<authors><author><name>Albert Fatsini</name><user>PagaMasTarde</user><email>afatsini@digitalorigin.com</email></author></authors>
|
14 |
-
<date>2016-11-
|
15 |
-
<time>
|
16 |
-
<contents><target name="magecommunity"><dir name="Pagantis"><dir name="Pagantis"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Fieldset"><file name="Payment.php" hash="7c2b0d3c7a7bf6d4a9ac02a5b6125af3"/></dir></dir></dir></dir><file name="Form.php" hash="89aded0a5a4754181ee2dd24f480cff9"/><file name="Redirect.php" hash="67d7cb6ddd3089cb5bba2a13c2b7493e"/></dir><dir name="Helper"><file name="Data.php" hash="
|
17 |
<compatible/>
|
18 |
<dependencies><required><php><min>5.2.0</min><max>8.0.0</max></php></required></dependencies>
|
19 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Pagantis_Pagantis</name>
|
4 |
+
<version>3.2.2</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.gnu.org/licenses/gpl-3.0.en.html">GPL</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Modulo de Magento para habilitar la pasarela de pago Pagantis en Magento.</summary>
|
10 |
<description>Con este módulo se podrá activar la pasarela de pago Pagantis en Magento y aceptar pago con tarjetas de debito.</description>
|
11 |
+
<notes>Added currency filter</notes>
|
|
|
12 |
<authors><author><name>Albert Fatsini</name><user>PagaMasTarde</user><email>afatsini@digitalorigin.com</email></author></authors>
|
13 |
+
<date>2016-11-21</date>
|
14 |
+
<time>08:36:05</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="Pagantis"><dir name="Pagantis"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Fieldset"><file name="Payment.php" hash="7c2b0d3c7a7bf6d4a9ac02a5b6125af3"/></dir></dir></dir></dir><file name="Form.php" hash="89aded0a5a4754181ee2dd24f480cff9"/><file name="Redirect.php" hash="67d7cb6ddd3089cb5bba2a13c2b7493e"/></dir><dir name="Helper"><file name="Data.php" hash="dd40634af028d3179be77b48d4d6e3b1"/></dir><dir name="Model"><file name="Currency.php" hash="a5557e10938898b0213a90dd7be15540"/><file name="Observer.php" hash="fa0e7d5688701cae875a8d14f58a816e"/><file name="Payment.php" hash="56017eb1aa5bd545811df915f0eeae8f"/><dir name="Source"><dir name="Payment"><file name="Currency.php" hash="7e51124f09e2028198fb9587df820809"/><file name="Environment.php" hash="30d6400967acdd8975c5748994c100e6"/></dir></dir><dir name="Webservice"><file name="Client.php" hash="6a14e0ae7ef5180445a3a99aec4717bb"/><file name="Paymentrequest.php" hash="dcf473ea7211a82b55b5374549c3cfc0"/><file name="Request.php" hash="f39f3312449a4aa41b716842ff0466dd"/><file name="Requestloan.php" hash="ab3944fbc9f15dd75016d429275d02be"/><file name="Response.php" hash="bb1ade5931c5580f4585fc0fdb2bc4b0"/></dir></dir><dir name="controllers"><file name="PagantisController.php" hash="a983c0bcb5b6b8b9d9ad28deb0f1a7df"/></dir><dir name="etc"><file name="config.xml" hash="ac4c7505180457b75b59d40691329db7"/><file name="system.xml" hash="a8a6b2cc704f825ad0688d49b783562c"/></dir><dir name="sql"><dir name="pagantis_setup"><file name="mysql4-install-1.0.0.php" hash="4ec10724709f8d381758409f55cff99d"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="pagantis.xml" hash="4328e44e218a0996f4e2412c545a8e9b"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="pagantis.xml" hash="29736a84ea78eaeb75fe2be77d0a63cb"/></dir><dir name="template"><dir name="pagantis"><file name="form.phtml" hash="11cf70a55d8ec9e8ae3c1d94a832eeab"/><file name="pagantis.phtml" hash="39f682244d4cb5998d42ef65ed498f7c"/><file name="redirect.phtml" hash="01cc228e3183b4751e324435f2782124"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Pagantis_Pagantis.xml" hash="c57db60bd03314d7a45f27acc9a9475a"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="base"><dir name="default"><file name="pagantis.css" hash="7d1b6daea9f42c2552ebb5bd5c15596d"/></dir></dir><dir name="default"><dir name="default"><dir name="images"><dir name="pagantis"><file name="logopagamastarde.png" hash="d51fa42e42d9811653df55710a395d07"/><file name="pagantis.png" hash="292403ede1f62affccf06df004ddfe12"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="images"><dir name="pagantis"><file name="logopagamastarde.png" hash="d51fa42e42d9811653df55710a395d07"/><file name="pagantis-fav.png" hash="c4e162b51c0792ff25385506d7998818"/><file name="pagantis.png" hash="292403ede1f62affccf06df004ddfe12"/></dir></dir></dir></dir></dir></target></contents>
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.2.0</min><max>8.0.0</max></php></required></dependencies>
|
18 |
</package>
|