Version Notes
Send module version to form to increase acceptance ratio
Download this release
Release Info
| Developer | Albert Fatsini |
| Extension | Pagantis_Pagantis |
| Version | 3.3.1 |
| Comparing to | |
| See all releases | |
Code changes from version 3.2.5 to 3.3.1
- app/code/community/Pagantis/Pagantis/Block/Redirect.php +0 -3
- app/code/community/Pagantis/Pagantis/Helper/Data.php +7 -9
- app/code/community/Pagantis/Pagantis/Model/Webservice/Request.php +40 -31
- app/code/community/Pagantis/Pagantis/Model/Webservice/Requestloan.php +211 -109
- app/design/frontend/base/default/template/pagantis/redirect.phtml +10 -2
- package.xml +4 -4
app/code/community/Pagantis/Pagantis/Block/Redirect.php
CHANGED
|
@@ -10,7 +10,6 @@
|
|
| 10 |
*/
|
| 11 |
class Pagantis_Pagantis_Block_Redirect extends Mage_Core_Block_Template
|
| 12 |
{
|
| 13 |
-
|
| 14 |
protected function _construct()
|
| 15 |
{
|
| 16 |
parent::_construct();
|
|
@@ -19,7 +18,6 @@ class Pagantis_Pagantis_Block_Redirect extends Mage_Core_Block_Template
|
|
| 19 |
$paymentMethod = Mage::getModel('pagantis_pagantis/payment');
|
| 20 |
$form = new Varien_Data_Form();
|
| 21 |
|
| 22 |
-
|
| 23 |
$form->setAction($urlPagantis)
|
| 24 |
->setId('pagantis_pagantis_checkout')
|
| 25 |
->setLabel('Pagantis')
|
|
@@ -38,5 +36,4 @@ class Pagantis_Pagantis_Block_Redirect extends Mage_Core_Block_Template
|
|
| 38 |
$form->addField('submitButton', 'submit', array('name' => 'submitButton', 'value' => 'Continue'));
|
| 39 |
$this->setFormRedirect($form->toHtml());
|
| 40 |
}
|
| 41 |
-
|
| 42 |
}
|
| 10 |
*/
|
| 11 |
class Pagantis_Pagantis_Block_Redirect extends Mage_Core_Block_Template
|
| 12 |
{
|
|
|
|
| 13 |
protected function _construct()
|
| 14 |
{
|
| 15 |
parent::_construct();
|
| 18 |
$paymentMethod = Mage::getModel('pagantis_pagantis/payment');
|
| 19 |
$form = new Varien_Data_Form();
|
| 20 |
|
|
|
|
| 21 |
$form->setAction($urlPagantis)
|
| 22 |
->setId('pagantis_pagantis_checkout')
|
| 23 |
->setLabel('Pagantis')
|
| 36 |
$form->addField('submitButton', 'submit', array('name' => 'submitButton', 'value' => 'Continue'));
|
| 37 |
$this->setFormRedirect($form->toHtml());
|
| 38 |
}
|
|
|
|
| 39 |
}
|
app/code/community/Pagantis/Pagantis/Helper/Data.php
CHANGED
|
@@ -97,14 +97,13 @@ class Pagantis_Pagantis_Helper_Data extends Mage_Core_Helper_Abstract
|
|
| 97 |
$request->setAmount($amount);
|
| 98 |
$request->setLanguagePagantis($language);
|
| 99 |
$request->setUrlPagantis(Pagantis_Pagantis_Model_Payment::PMT_URL);
|
| 100 |
-
$request->setUserData($
|
| 101 |
-
$request->setUserBillData($addressBillingId);
|
| 102 |
$request->setOrderItems($orderId);
|
| 103 |
$request->setAmount($amount);
|
| 104 |
$request->setDiscount($this->_config['discount']);
|
| 105 |
$request->setIframe($this->_config['iframe']);
|
| 106 |
$request->setEndOfMonth('true');
|
| 107 |
-
$request->setUserExtraData($
|
| 108 |
switch ($this->_config['environment']) {
|
| 109 |
case Pagantis_Pagantis_Model_Webservice_Client::ENV_TESTING:
|
| 110 |
$request->setAccountCode($this->_config['account_code_test']);
|
|
@@ -137,20 +136,18 @@ class Pagantis_Pagantis_Helper_Data extends Mage_Core_Helper_Abstract
|
|
| 137 |
$order = Mage::getModel('sales/order')->loadByIncrementId($orderId);
|
| 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($
|
| 147 |
-
$request->setUserBillData($addressBillingId);
|
| 148 |
$request->setOrderItems($orderId);
|
| 149 |
$request->setAmount($amount);
|
| 150 |
$request->setDiscount($this->_config['discount']);
|
| 151 |
$request->setIframe($this->_config['iframe']);
|
| 152 |
$request->setEndOfMonth('false');
|
| 153 |
-
$request->setUserExtraData($
|
| 154 |
switch ($this->_config['environment']) {
|
| 155 |
case Pagantis_Pagantis_Model_Webservice_Client::ENV_TESTING:
|
| 156 |
$request->setAccountCode($this->_config['account_code_test']);
|
|
@@ -181,7 +178,7 @@ class Pagantis_Pagantis_Helper_Data extends Mage_Core_Helper_Abstract
|
|
| 181 |
public function getTransactionInfo($transaction)
|
| 182 |
{
|
| 183 |
$paymentRequest = Mage::getModel('pagantis_pagantis/webservice_paymentrequest');
|
| 184 |
-
switch($this->_config['environment']) {
|
| 185 |
case Pagantis_Pagantis_Model_Webservice_Client::ENV_TESTING:
|
| 186 |
$paymentRequest->setBearer($this->_config['account_api_key_test']);
|
| 187 |
break;
|
|
@@ -196,7 +193,8 @@ class Pagantis_Pagantis_Helper_Data extends Mage_Core_Helper_Abstract
|
|
| 196 |
}
|
| 197 |
|
| 198 |
|
| 199 |
-
public function getUrlPagantis()
|
|
|
|
| 200 |
return Pagantis_Pagantis_Model_Payment::PMT_URL;
|
| 201 |
}
|
| 202 |
|
| 97 |
$request->setAmount($amount);
|
| 98 |
$request->setLanguagePagantis($language);
|
| 99 |
$request->setUrlPagantis(Pagantis_Pagantis_Model_Payment::PMT_URL);
|
| 100 |
+
$request->setUserData($orderId);
|
|
|
|
| 101 |
$request->setOrderItems($orderId);
|
| 102 |
$request->setAmount($amount);
|
| 103 |
$request->setDiscount($this->_config['discount']);
|
| 104 |
$request->setIframe($this->_config['iframe']);
|
| 105 |
$request->setEndOfMonth('true');
|
| 106 |
+
$request->setUserExtraData($addressBillingId);
|
| 107 |
switch ($this->_config['environment']) {
|
| 108 |
case Pagantis_Pagantis_Model_Webservice_Client::ENV_TESTING:
|
| 109 |
$request->setAccountCode($this->_config['account_code_test']);
|
| 136 |
$order = Mage::getModel('sales/order')->loadByIncrementId($orderId);
|
| 137 |
$addressId = $order->getShippingAddress()->getId();
|
| 138 |
$addressBillingId = $order->getBillingAddress()->getId();
|
|
|
|
| 139 |
$request = Mage::getModel('pagantis_pagantis/webservice_requestloan');
|
| 140 |
$request->setOrderId($orderId);
|
| 141 |
$request->setAmount($amount);
|
| 142 |
$request->setLanguagePagantis($language);
|
| 143 |
$request->setUrlPagantis(Pagantis_Pagantis_Model_Payment::PMT_URL);
|
| 144 |
+
$request->setUserData($orderId);
|
|
|
|
| 145 |
$request->setOrderItems($orderId);
|
| 146 |
$request->setAmount($amount);
|
| 147 |
$request->setDiscount($this->_config['discount']);
|
| 148 |
$request->setIframe($this->_config['iframe']);
|
| 149 |
$request->setEndOfMonth('false');
|
| 150 |
+
$request->setUserExtraData($addressBillingId);
|
| 151 |
switch ($this->_config['environment']) {
|
| 152 |
case Pagantis_Pagantis_Model_Webservice_Client::ENV_TESTING:
|
| 153 |
$request->setAccountCode($this->_config['account_code_test']);
|
| 178 |
public function getTransactionInfo($transaction)
|
| 179 |
{
|
| 180 |
$paymentRequest = Mage::getModel('pagantis_pagantis/webservice_paymentrequest');
|
| 181 |
+
switch ($this->_config['environment']) {
|
| 182 |
case Pagantis_Pagantis_Model_Webservice_Client::ENV_TESTING:
|
| 183 |
$paymentRequest->setBearer($this->_config['account_api_key_test']);
|
| 184 |
break;
|
| 193 |
}
|
| 194 |
|
| 195 |
|
| 196 |
+
public function getUrlPagantis()
|
| 197 |
+
{
|
| 198 |
return Pagantis_Pagantis_Model_Payment::PMT_URL;
|
| 199 |
}
|
| 200 |
|
app/code/community/Pagantis/Pagantis/Model/Webservice/Request.php
CHANGED
|
@@ -136,7 +136,7 @@ class Pagantis_Pagantis_Model_Webservice_Request
|
|
| 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 |
-
$array['metadata[module_version]'] = '3.
|
| 140 |
$array['metadata[platform]'] = 'magento '. Mage::getVersion();
|
| 141 |
|
| 142 |
foreach ($this->_items as $key => $value) {
|
|
@@ -239,26 +239,33 @@ class Pagantis_Pagantis_Model_Webservice_Request
|
|
| 239 |
|
| 240 |
//fix to avoid empty fields
|
| 241 |
if (Mage::getSingleton('customer/session')->isLoggedIn()) {
|
| 242 |
-
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
|
| 260 |
-
|
| 261 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 262 |
}
|
| 263 |
}
|
| 264 |
|
|
@@ -338,7 +345,7 @@ class Pagantis_Pagantis_Model_Webservice_Request
|
|
| 338 |
if ($addressId) {
|
| 339 |
$address = Mage::getModel('sales/order_address')->load($addressId);
|
| 340 |
$street = $address->getStreet();
|
| 341 |
-
if ($street){
|
| 342 |
$this->_userData['Bstreet'] = $street[0];
|
| 343 |
}
|
| 344 |
$this->_userData['Bcity'] = $address->getCity();
|
|
@@ -364,23 +371,23 @@ class Pagantis_Pagantis_Model_Webservice_Request
|
|
| 364 |
$order = Mage::getModel('sales/order')->loadByIncrementId($orderId);
|
| 365 |
$items = $order->getAllVisibleItems();
|
| 366 |
$i = 0;
|
| 367 |
-
foreach($items as $item){
|
| 368 |
-
$amount = round($item->getPriceInclTax(),2);
|
| 369 |
$quantity = round($item->getQtyOrdered());
|
| 370 |
$this->_items[$i]['description'] = $item->getName();
|
| 371 |
$this->_items[$i]['quantity'] = $quantity;
|
| 372 |
-
$this->_items[$i]['amount'] = round($amount*$quantity,2);
|
| 373 |
$i++;
|
| 374 |
}
|
| 375 |
-
$shippingAmount = round($order->getShippingInclTax(),2);
|
| 376 |
-
if($shippingAmount){
|
| 377 |
$this->_items[$i]['description'] = "Gastos de envío";
|
| 378 |
$this->_items[$i]['quantity'] = "1";
|
| 379 |
$this->_items[$i]['amount'] = $shippingAmount;
|
| 380 |
$i++;
|
| 381 |
}
|
| 382 |
-
$discountAmount = round($order->getBaseDiscountAmount(),2);
|
| 383 |
-
if($discountAmount){
|
| 384 |
$this->_items[$i]['description'] = "Descuento";
|
| 385 |
$this->_items[$i]['quantity'] = "1";
|
| 386 |
$this->_items[$i]['amount'] = $discountAmount;
|
|
@@ -396,7 +403,8 @@ class Pagantis_Pagantis_Model_Webservice_Request
|
|
| 396 |
* @param string $accountCode
|
| 397 |
* @throws Exception
|
| 398 |
*/
|
| 399 |
-
public function setAccountCode($accountCode='')
|
|
|
|
| 400 |
if (strlen(trim($accountCode)) > 0) {
|
| 401 |
$this->_accountCode = $accountCode;
|
| 402 |
} else {
|
|
@@ -409,7 +417,8 @@ class Pagantis_Pagantis_Model_Webservice_Request
|
|
| 409 |
* @param string $discount
|
| 410 |
* @throws Exception
|
| 411 |
*/
|
| 412 |
-
public function setDiscount($discount='')
|
|
|
|
| 413 |
if ($discount == 1) {
|
| 414 |
$this->_discount = 'true';
|
| 415 |
} else {
|
| 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 |
+
$array['metadata[module_version]'] = '3.3.1';
|
| 140 |
$array['metadata[platform]'] = 'magento '. Mage::getVersion();
|
| 141 |
|
| 142 |
foreach ($this->_items as $key => $value) {
|
| 239 |
|
| 240 |
//fix to avoid empty fields
|
| 241 |
if (Mage::getSingleton('customer/session')->isLoggedIn()) {
|
| 242 |
+
$customer = Mage::getSingleton('customer/session')->getCustomer();
|
| 243 |
+
if (empty($this->_userData['email'])) {
|
| 244 |
+
$this->_userData['email'] = $customer->getEmail();
|
| 245 |
+
}
|
| 246 |
+
if (empty($this->_userData['full_name'])) {
|
| 247 |
+
$this->_userData['full_name'] = $customer->getFirstname() . ' ' . $customer->getLastname();
|
| 248 |
+
}
|
| 249 |
+
if (empty($this->_userData['dni']) && $customer->getFirstname() == $address->getFirstname()
|
| 250 |
+
&& $customer->getLastname() == $address->getLastname()) {
|
| 251 |
+
$this->_userData['dni'] = $customer->getData('taxvat');
|
| 252 |
+
}
|
| 253 |
+
if (empty($this->_userData['phone']) && $customer->getFirstname() == $address->getFirstname()
|
| 254 |
+
&& $customer->getLastname() == $address->getLastname()) {
|
| 255 |
+
$this->_userData['phone'] = $customer->getPrimaryBillingAddress()->getTelephone();
|
| 256 |
+
}
|
| 257 |
+
if (empty($this->_userData['mobile_phone']) && $customer->getFirstname() == $address->getFirstname()
|
| 258 |
+
&& $customer->getLastname() == $address->getLastname()) {
|
| 259 |
+
$this->_userData['mobile_phone'] = $customer->getPrimaryBillingAddress()->getTelephone();
|
| 260 |
+
}
|
| 261 |
+
if (empty($this->_userData['zipcode']) && $customer->getFirstname() == $address->getFirstname()
|
| 262 |
+
&& $customer->getLastname() == $address->getLastname()) {
|
| 263 |
+
$this->_userData['zipcode'] = $customer->getPrimaryBillingAddress()->getPostcode();
|
| 264 |
+
}
|
| 265 |
+
if ($customer->getFirstname() == $address->getFirstname()
|
| 266 |
+
&& $customer->getLastname() == $address->getLastname()) {
|
| 267 |
+
$this->_userData['dob'] =substr($customer->getDob(), 0, 10);
|
| 268 |
+
}
|
| 269 |
}
|
| 270 |
}
|
| 271 |
|
| 345 |
if ($addressId) {
|
| 346 |
$address = Mage::getModel('sales/order_address')->load($addressId);
|
| 347 |
$street = $address->getStreet();
|
| 348 |
+
if ($street) {
|
| 349 |
$this->_userData['Bstreet'] = $street[0];
|
| 350 |
}
|
| 351 |
$this->_userData['Bcity'] = $address->getCity();
|
| 371 |
$order = Mage::getModel('sales/order')->loadByIncrementId($orderId);
|
| 372 |
$items = $order->getAllVisibleItems();
|
| 373 |
$i = 0;
|
| 374 |
+
foreach ($items as $item) {
|
| 375 |
+
$amount = round($item->getPriceInclTax(), 2);
|
| 376 |
$quantity = round($item->getQtyOrdered());
|
| 377 |
$this->_items[$i]['description'] = $item->getName();
|
| 378 |
$this->_items[$i]['quantity'] = $quantity;
|
| 379 |
+
$this->_items[$i]['amount'] = round($amount*$quantity, 2);
|
| 380 |
$i++;
|
| 381 |
}
|
| 382 |
+
$shippingAmount = round($order->getShippingInclTax(), 2);
|
| 383 |
+
if ($shippingAmount) {
|
| 384 |
$this->_items[$i]['description'] = "Gastos de envío";
|
| 385 |
$this->_items[$i]['quantity'] = "1";
|
| 386 |
$this->_items[$i]['amount'] = $shippingAmount;
|
| 387 |
$i++;
|
| 388 |
}
|
| 389 |
+
$discountAmount = round($order->getBaseDiscountAmount(), 2);
|
| 390 |
+
if ($discountAmount) {
|
| 391 |
$this->_items[$i]['description'] = "Descuento";
|
| 392 |
$this->_items[$i]['quantity'] = "1";
|
| 393 |
$this->_items[$i]['amount'] = $discountAmount;
|
| 403 |
* @param string $accountCode
|
| 404 |
* @throws Exception
|
| 405 |
*/
|
| 406 |
+
public function setAccountCode($accountCode = '')
|
| 407 |
+
{
|
| 408 |
if (strlen(trim($accountCode)) > 0) {
|
| 409 |
$this->_accountCode = $accountCode;
|
| 410 |
} else {
|
| 417 |
* @param string $discount
|
| 418 |
* @throws Exception
|
| 419 |
*/
|
| 420 |
+
public function setDiscount($discount = '')
|
| 421 |
+
{
|
| 422 |
if ($discount == 1) {
|
| 423 |
$this->_discount = 'true';
|
| 424 |
} else {
|
app/code/community/Pagantis/Pagantis/Model/Webservice/Requestloan.php
CHANGED
|
@@ -105,48 +105,85 @@ class Pagantis_Pagantis_Model_Webservice_Requestloan
|
|
| 105 |
public function toArray()
|
| 106 |
{
|
| 107 |
$array = array();
|
| 108 |
-
|
| 109 |
-
$array['
|
| 110 |
$array['currency'] = $this->_currency;
|
| 111 |
$array['ok_url'] = $this->_urlOk;
|
| 112 |
$array['nok_url'] = $this->_urlKo;
|
| 113 |
$array['callback_url'] = $this->_callback_url;
|
| 114 |
$array['cancelled_url'] = $this->_urlCancel;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 115 |
$array['discount[full]'] = $this->_discount;
|
| 116 |
$array['iframe'] = $this->_iframe;
|
| 117 |
$array['end_of_month'] = $this->_end_of_month;
|
| 118 |
|
| 119 |
-
|
| 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'];
|
| 124 |
-
$array['address[city]'] = $this->_userData['Bcity'];
|
| 125 |
-
$array['address[province]'] = $this->_userData['Bprovince'];
|
| 126 |
-
$array['address[zipcode]'] = $this->_userData['Bzipcode'];
|
| 127 |
-
$array['shipping[street]'] = $this->_userData['street'];
|
| 128 |
-
$array['shipping[city]'] = $this->_userData['city'];
|
| 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 |
-
$array['metadata[module_version]'] = '3.2.5';
|
| 140 |
-
$array['metadata[platform]'] = 'magento '. Mage::getVersion();
|
| 141 |
|
| 142 |
-
foreach ($this->_items as $key => $value) {
|
| 143 |
-
$array['items[' . $key . '][description]'] = $value['description'];
|
| 144 |
-
$array['items[' . $key . '][quantity]'] = $value['quantity'];
|
| 145 |
-
$array['items[' . $key . '][amount]'] = $value['amount'];
|
| 146 |
-
}
|
| 147 |
|
| 148 |
-
|
| 149 |
-
$array['
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 150 |
|
| 151 |
return $array;
|
| 152 |
}
|
|
@@ -217,49 +254,135 @@ class Pagantis_Pagantis_Model_Webservice_Requestloan
|
|
| 217 |
* @param string $addressId
|
| 218 |
* @throws Exception
|
| 219 |
*/
|
| 220 |
-
public function setUserData($
|
| 221 |
{
|
| 222 |
-
if ($
|
| 223 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 224 |
$street = $address->getStreet();
|
| 225 |
if (is_array($street)) {
|
| 226 |
-
$this->_userData['street'] = $street[0];
|
| 227 |
} else {
|
| 228 |
-
$this->_userData['street'] = $street;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 229 |
}
|
| 230 |
-
$this->_userData['
|
| 231 |
-
$this->_userData['province'] = $address->getCity();
|
| 232 |
-
$this->_userData['zipcode'] = $address->getPostcode();
|
| 233 |
-
$this->_userData['dni'] = $address->getVatId();
|
| 234 |
$this->_userData['full_name'] = $address->getFirstname() . ' ' . $address->getLastname();
|
| 235 |
$this->_userData['email'] = $address->getEmail();
|
| 236 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 237 |
} else {
|
| 238 |
throw new \Exception('Missing user data info');
|
| 239 |
}
|
| 240 |
|
|
|
|
|
|
|
| 241 |
//fix to avoid empty fields
|
| 242 |
if (Mage::getSingleton('customer/session')->isLoggedIn()) {
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
|
| 260 |
-
|
| 261 |
-
|
| 262 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 263 |
}
|
| 264 |
}
|
| 265 |
|
|
@@ -291,6 +414,7 @@ class Pagantis_Pagantis_Model_Webservice_Requestloan
|
|
| 291 |
|
| 292 |
if ($customer->getId() != null) {
|
| 293 |
$this->_userData['sign_up_date'] = date('Y/m/d', $customer->getCreatedAtTimestamp());
|
|
|
|
| 294 |
$_orders = Mage::getModel('sales/order')->getCollection()->
|
| 295 |
addFieldToFilter('customer_id', $customer->getId())->
|
| 296 |
addFieldToFilter('status', array(
|
|
@@ -329,33 +453,6 @@ class Pagantis_Pagantis_Model_Webservice_Requestloan
|
|
| 329 |
}
|
| 330 |
}
|
| 331 |
|
| 332 |
-
/**
|
| 333 |
-
* Assign user data
|
| 334 |
-
* @param string $addressId
|
| 335 |
-
* @throws Exception
|
| 336 |
-
*/
|
| 337 |
-
public function setUserBillData($addressId)
|
| 338 |
-
{
|
| 339 |
-
if ($addressId) {
|
| 340 |
-
$address = Mage::getModel('sales/order_address')->load($addressId);
|
| 341 |
-
$street = $address->getStreet();
|
| 342 |
-
if ($street){
|
| 343 |
-
$this->_userData['Bstreet'] = $street[0];
|
| 344 |
-
}
|
| 345 |
-
$this->_userData['Bcity'] = $address->getCity();
|
| 346 |
-
$this->_userData['Bprovince'] = $address->getCity();
|
| 347 |
-
$this->_userData['Bzipcode'] = $address->getPostcode();
|
| 348 |
-
$this->_userData['Bdni'] = $address->getVatId();
|
| 349 |
-
$this->_userData['Bfull_name'] = $address->getFirstname() . ' ' . $address->getLastname();
|
| 350 |
-
$this->_userData['Bemail'] = $address->getEmail();
|
| 351 |
-
$this->_userData['Bphone'] = $address->getTelephone();
|
| 352 |
-
} else {
|
| 353 |
-
throw new \Exception('Missing user data info');
|
| 354 |
-
}
|
| 355 |
-
}
|
| 356 |
-
|
| 357 |
-
|
| 358 |
-
|
| 359 |
/**
|
| 360 |
* Assign user data
|
| 361 |
* @param string $addressId
|
|
@@ -367,23 +464,23 @@ class Pagantis_Pagantis_Model_Webservice_Requestloan
|
|
| 367 |
$order = Mage::getModel('sales/order')->loadByIncrementId($orderId);
|
| 368 |
$items = $order->getAllVisibleItems();
|
| 369 |
$i = 0;
|
| 370 |
-
foreach($items as $item){
|
| 371 |
-
$amount = round($item->getPriceInclTax(),2);
|
| 372 |
$quantity = round($item->getQtyOrdered());
|
| 373 |
$this->_items[$i]['description'] = $item->getName();
|
| 374 |
$this->_items[$i]['quantity'] = $quantity;
|
| 375 |
-
$this->_items[$i]['amount'] = round($amount*$quantity,2);
|
| 376 |
$i++;
|
| 377 |
}
|
| 378 |
-
$shippingAmount = round($order->getShippingInclTax(),2);
|
| 379 |
-
if($shippingAmount){
|
| 380 |
$this->_items[$i]['description'] = "Gastos de envío";
|
| 381 |
$this->_items[$i]['quantity'] = "1";
|
| 382 |
$this->_items[$i]['amount'] = $shippingAmount;
|
| 383 |
$i++;
|
| 384 |
}
|
| 385 |
-
$discountAmount = round($order->getBaseDiscountAmount(),2);
|
| 386 |
-
if($discountAmount){
|
| 387 |
$this->_items[$i]['description'] = "Descuento";
|
| 388 |
$this->_items[$i]['quantity'] = "1";
|
| 389 |
$this->_items[$i]['amount'] = $discountAmount;
|
|
@@ -399,7 +496,8 @@ class Pagantis_Pagantis_Model_Webservice_Requestloan
|
|
| 399 |
* @param string $accountCode
|
| 400 |
* @throws Exception
|
| 401 |
*/
|
| 402 |
-
public function setAccountCode($accountCode='')
|
|
|
|
| 403 |
if (strlen(trim($accountCode)) > 0) {
|
| 404 |
$this->_accountCode = $accountCode;
|
| 405 |
} else {
|
|
@@ -412,7 +510,8 @@ class Pagantis_Pagantis_Model_Webservice_Requestloan
|
|
| 412 |
* @param string $discount
|
| 413 |
* @throws Exception
|
| 414 |
*/
|
| 415 |
-
public function setDiscount($discount='')
|
|
|
|
| 416 |
if ($discount == 1) {
|
| 417 |
$this->_discount = 'true';
|
| 418 |
} else {
|
|
@@ -425,7 +524,8 @@ class Pagantis_Pagantis_Model_Webservice_Requestloan
|
|
| 425 |
* @param string $iframe
|
| 426 |
* @throws Exception
|
| 427 |
*/
|
| 428 |
-
public function setIframe($iframe='')
|
|
|
|
| 429 |
if ($iframe == 1) {
|
| 430 |
$this->_iframe = 'true';
|
| 431 |
} else {
|
|
@@ -438,7 +538,8 @@ class Pagantis_Pagantis_Model_Webservice_Requestloan
|
|
| 438 |
* @param string end_of_month
|
| 439 |
* @throws Exception
|
| 440 |
*/
|
| 441 |
-
public function setEndOfMonth($end_of_month='')
|
|
|
|
| 442 |
if ($end_of_month == 'true') {
|
| 443 |
$this->_end_of_month = 'true';
|
| 444 |
} else {
|
|
@@ -451,7 +552,8 @@ class Pagantis_Pagantis_Model_Webservice_Requestloan
|
|
| 451 |
* @param string $accountKey
|
| 452 |
* @throws Exception
|
| 453 |
*/
|
| 454 |
-
public function setAccountKey($accountKey='')
|
|
|
|
| 455 |
if (strlen(trim($accountKey)) > 0) {
|
| 456 |
$this->_accountKey = $accountKey;
|
| 457 |
} else {
|
|
@@ -493,20 +595,20 @@ class Pagantis_Pagantis_Model_Webservice_Requestloan
|
|
| 493 |
* @param string $urlnok
|
| 494 |
* @throws Exception
|
| 495 |
*/
|
| 496 |
-
|
| 497 |
-
|
| 498 |
-
|
| 499 |
-
|
| 500 |
-
|
| 501 |
-
|
| 502 |
-
|
| 503 |
-
|
| 504 |
-
|
| 505 |
-
|
| 506 |
-
|
| 507 |
-
|
| 508 |
-
|
| 509 |
-
|
| 510 |
|
| 511 |
/**
|
| 512 |
* @param string $urlnok
|
|
@@ -514,10 +616,10 @@ class Pagantis_Pagantis_Model_Webservice_Requestloan
|
|
| 514 |
*/
|
| 515 |
public function setCacllbackUrl()
|
| 516 |
{
|
| 517 |
-
if (Mage::app()->getStore()->isFrontUrlSecure()){
|
| 518 |
-
$this->_callback_url=Mage::getUrl('',array('_forced_secure'=>true))."pagantis/pagantis/notification";
|
| 519 |
-
}else{
|
| 520 |
-
$this->_callback_url=Mage::getUrl('',array('_forced_secure'=>false))."pagantis/pagantis/notification";
|
| 521 |
}
|
| 522 |
$this->_callback_url = Mage::getModel('core/url')->sessionUrlVar($this->_callback_url);
|
| 523 |
}
|
|
@@ -535,7 +637,7 @@ class Pagantis_Pagantis_Model_Webservice_Requestloan
|
|
| 535 |
//encoding is SHA1
|
| 536 |
$this->_firma = sha1($textToEncode);
|
| 537 |
//encoding is SHA512
|
| 538 |
-
$this->_firma = hash('sha512'
|
| 539 |
/*
|
| 540 |
if (strlen(trim($textToEncode)) > 0) {
|
| 541 |
// Retrieve del SHA1
|
| 105 |
public function toArray()
|
| 106 |
{
|
| 107 |
$array = array();
|
| 108 |
+
//configuration parameters
|
| 109 |
+
$array['account_id'] = $this->_accountCode;
|
| 110 |
$array['currency'] = $this->_currency;
|
| 111 |
$array['ok_url'] = $this->_urlOk;
|
| 112 |
$array['nok_url'] = $this->_urlKo;
|
| 113 |
$array['callback_url'] = $this->_callback_url;
|
| 114 |
$array['cancelled_url'] = $this->_urlCancel;
|
| 115 |
+
$array['order_id'] = $this->_orderId;
|
| 116 |
+
$array['amount'] = $this->_amount;
|
| 117 |
+
$array['signature'] = $this->_firma;
|
| 118 |
+
$array['description'] = '';
|
| 119 |
+
foreach ($this->_items as $key => $value) {
|
| 120 |
+
$array['description'] .= $value['description'] . "(".$value['quantity']."),";
|
| 121 |
+
$array['items[' . $key . '][description]'] = $value['description'];
|
| 122 |
+
$array['items[' . $key . '][quantity]'] = $value['quantity'];
|
| 123 |
+
$array['items[' . $key . '][amount]'] = $value['amount'];
|
| 124 |
+
}
|
| 125 |
+
$array['description'] = substr($array['description'], 0, -1);
|
| 126 |
+
$array['locale'] = $this->_languagePagantis;
|
| 127 |
$array['discount[full]'] = $this->_discount;
|
| 128 |
$array['iframe'] = $this->_iframe;
|
| 129 |
$array['end_of_month'] = $this->_end_of_month;
|
| 130 |
|
| 131 |
+
// data used to prefill the form
|
|
|
|
| 132 |
$array['full_name'] = $this->_userData['full_name'];
|
| 133 |
$array['email'] = $this->_userData['email'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 134 |
$array['dni'] = $this->_userData['dni'];
|
| 135 |
$array['dob'] = $this->_userData['dob'];
|
| 136 |
+
$array['address[street]'] = $this->_userData['billing[street]'];
|
| 137 |
+
$array['address[city]'] = $this->_userData['billing[city]'];
|
| 138 |
+
$array['address[zipcode]'] = $this->_userData['billing[zipcode]'];
|
| 139 |
+
$array['mobile_phone'] = $this->_userData['billing[mobile_phone]'];
|
| 140 |
+
|
| 141 |
+
// customer iformation
|
| 142 |
+
$array['loginCustomer[gender]'] = $this->_userData['loginCustomer[gender]'];
|
| 143 |
+
$array['loginCustomer[email]'] = $this->_userData['loginCustomer[email]'];
|
| 144 |
+
$array['loginCustomer[dob]'] = $this->_userData['loginCustomer[dob]'];
|
| 145 |
+
$array['loginCustomer[dni]'] = $this->_userData['loginCustomer[dni]'];
|
| 146 |
+
$array['loginCustomer[is_guest]'] = $this->_userData['loginCustomer[is_guest]'];
|
| 147 |
+
$array['loginCustomer[last_updated]'] = $this->_userData['loginCustomer[last_updated]'];
|
| 148 |
+
$array['loginCustomer[full_name]'] = $this->_userData['loginCustomer[full_name]'];
|
| 149 |
+
|
| 150 |
$array['metadata[member_since]'] = $this->_userData['sign_up_date'];
|
| 151 |
$array['metadata[num_orders]'] = $this->_userData['num_prev_orders'];
|
| 152 |
$array['metadata[amount_orders]'] = $this->_userData['total_paid'];
|
| 153 |
$array['metadata[num_full_refunds]'] = $this->_userData['num_full_refunds'];
|
| 154 |
$array['metadata[num_partial_refunds]'] = $this->_userData['num_partial_refunds'];
|
| 155 |
$array['metadata[amount_refunds]'] = $this->_userData['amount_refunded'];
|
|
|
|
|
|
|
| 156 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 157 |
|
| 158 |
+
//shipping information
|
| 159 |
+
$array['shipping[street]'] = $this->_userData['shipping[street]'];
|
| 160 |
+
$array['shipping[city]'] = $this->_userData['shipping[city]'];
|
| 161 |
+
$array['shipping[province]'] = $this->_userData['shipping[province]'];
|
| 162 |
+
$array['shipping[zipcode]'] = $this->_userData['shipping[zipcode]'];
|
| 163 |
+
$array['shipping[company]'] = $this->_userData['shipping[company]'];
|
| 164 |
+
$array['shipping[vat_number]'] = $this->_userData['shipping[vat_number]'];
|
| 165 |
+
$array['shipping[mobile_phone]'] = $this->_userData['shipping[mobile_phone]'];
|
| 166 |
+
$array['shipping[date_add]'] = $this->_userData['shipping[date_add]'];
|
| 167 |
+
$array['shipping[last_updated]'] = $this->_userData['shipping[last_updated]'];
|
| 168 |
+
$array['shipping[dni]'] = $this->_userData['shipping[dni]'];
|
| 169 |
+
$array['shipping[full_name]'] = $this->_userData['shipping[full_name]'];
|
| 170 |
+
|
| 171 |
+
//billing information
|
| 172 |
+
$array['billing[street]'] = $this->_userData['billing[street]'];
|
| 173 |
+
$array['billing[city]'] = $this->_userData['billing[city]'];
|
| 174 |
+
$array['billing[province]'] = $this->_userData['billing[province]'];
|
| 175 |
+
$array['billing[zipcode]'] = $this->_userData['billing[zipcode]'];
|
| 176 |
+
$array['billing[company]'] = $this->_userData['billing[company]'];
|
| 177 |
+
$array['billing[vat_number]'] = $this->_userData['billing[vat_number]'];
|
| 178 |
+
$array['billing[mobile_phone]'] = $this->_userData['billing[mobile_phone]'];
|
| 179 |
+
$array['billing[date_add]'] = $this->_userData['billing[date_add]'];
|
| 180 |
+
$array['billing[last_updated]'] = $this->_userData['billing[last_updated]'];
|
| 181 |
+
$array['billing[dni]'] = $this->_userData['billing[dni]'];
|
| 182 |
+
$array['billing[full_name]'] = $this->_userData['billing[full_name]'];
|
| 183 |
+
|
| 184 |
+
|
| 185 |
+
$array['metadata[module_version]'] = '3.3.1';
|
| 186 |
+
$array['metadata[platform]'] = 'magento '. Mage::getVersion();
|
| 187 |
|
| 188 |
return $array;
|
| 189 |
}
|
| 254 |
* @param string $addressId
|
| 255 |
* @throws Exception
|
| 256 |
*/
|
| 257 |
+
public function setUserData($orderId)
|
| 258 |
{
|
| 259 |
+
if ($orderId) {
|
| 260 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($orderId);
|
| 261 |
+
$address = $order->getShippingAddress();
|
| 262 |
+
$street = $address->getStreet();
|
| 263 |
+
if (is_array($street)) {
|
| 264 |
+
$this->_userData['shipping[street]'] = $street[0];
|
| 265 |
+
} else {
|
| 266 |
+
$this->_userData['shipping[street]'] = $street;
|
| 267 |
+
}
|
| 268 |
+
|
| 269 |
+
$region = Mage::getModel('directory/region')->load($address->getRegionId());
|
| 270 |
+
$state_name = $region->getName();
|
| 271 |
+
$this->_userData['shipping[city]'] = $address->getCity();
|
| 272 |
+
$this->_userData['shipping[province]'] = $state_name;
|
| 273 |
+
$this->_userData['shipping[zipcode]'] = $address->getPostcode();
|
| 274 |
+
$this->_userData['shipping[dni]'] = $address->getVatId();
|
| 275 |
+
$this->_userData['shipping[full_name]'] = $address->getFirstname() . ' ' . $address->getLastname();
|
| 276 |
+
$this->_userData['shipping[email]'] = $address->getEmail();
|
| 277 |
+
$this->_userData['shipping[mobile_phone]'] = $address->getTelephone();
|
| 278 |
+
$this->_userData['shipping[company]'] = $address->getCompany();
|
| 279 |
+
$this->_userData['shipping[vat_number]'] = $address->getTaxvat();
|
| 280 |
+
|
| 281 |
+
$addressesCollection = Mage::getResourceModel('customer/address_collection');
|
| 282 |
+
$addressesCollection->addAttributeToFilter('city', $address->getCity());
|
| 283 |
+
$addressesCollection->addAttributeToFilter('postcode', $address->getPostcode());
|
| 284 |
+
$addressesCollection->addAttributeToFilter('firstname', $address->getFirstname());
|
| 285 |
+
$addressesCollection->addAttributeToFilter('lastname', $address->getLastname());
|
| 286 |
+
$addressesCollection->addAttributeToFilter('region', $state_name);
|
| 287 |
+
$addressesCollection->addAttributeToFilter('street', array("like" => '%'.$this->_userData['shipping[street]'].'%'));
|
| 288 |
+
|
| 289 |
+
foreach ($addressesCollection as $address) {
|
| 290 |
+
$this->_userData['shipping[date_add]'] = $address->created_at;
|
| 291 |
+
$this->_userData['shipping[last_updated]'] = $address->updated_at;
|
| 292 |
+
}
|
| 293 |
+
|
| 294 |
+
$address = $order->getBillingAddress();
|
| 295 |
$street = $address->getStreet();
|
| 296 |
if (is_array($street)) {
|
| 297 |
+
$this->_userData['billing[street]'] = $street[0];
|
| 298 |
} else {
|
| 299 |
+
$this->_userData['billing[street]'] = $street;
|
| 300 |
+
}
|
| 301 |
+
$region = Mage::getModel('directory/region')->load($address->getRegionId());
|
| 302 |
+
$state_name = $region->getName();
|
| 303 |
+
$this->_userData['billing[city]'] = $address->getCity();
|
| 304 |
+
$this->_userData['billing[province]'] = $state_name;
|
| 305 |
+
$this->_userData['billing[zipcode]'] = $address->getPostcode();
|
| 306 |
+
$this->_userData['billing[dni]'] = $address->getVatId();
|
| 307 |
+
|
| 308 |
+
switch ($order->getCustomerGender()) {
|
| 309 |
+
case 1:
|
| 310 |
+
$this->_userData['loginCustomer[gender]'] = 'male';
|
| 311 |
+
break;
|
| 312 |
+
case 2:
|
| 313 |
+
$this->_userData['loginCustomer[gender]'] = 'female';
|
| 314 |
+
break;
|
| 315 |
+
default:
|
| 316 |
+
$this->_userData['loginCustomer[gender]'] = '';
|
| 317 |
+
break;
|
| 318 |
}
|
| 319 |
+
$this->_userData['billing[full_name]'] = $address->getFirstname() . ' ' . $address->getLastname();
|
|
|
|
|
|
|
|
|
|
| 320 |
$this->_userData['full_name'] = $address->getFirstname() . ' ' . $address->getLastname();
|
| 321 |
$this->_userData['email'] = $address->getEmail();
|
| 322 |
+
|
| 323 |
+
$this->_userData['billing[email]'] = $address->getEmail();
|
| 324 |
+
$this->_userData['billing[mobile_phone]'] = $address->getTelephone();
|
| 325 |
+
$this->_userData['billing[company]'] = $address->getCompany();
|
| 326 |
+
$this->_userData['billing[vat_number]'] = $address->getTaxvat();
|
| 327 |
+
|
| 328 |
+
$addressesCollection = Mage::getResourceModel('customer/address_collection');
|
| 329 |
+
$addressesCollection->addAttributeToFilter('city', $address->getCity());
|
| 330 |
+
$addressesCollection->addAttributeToFilter('postcode', $address->getPostcode());
|
| 331 |
+
$addressesCollection->addAttributeToFilter('firstname', $address->getFirstname());
|
| 332 |
+
$addressesCollection->addAttributeToFilter('lastname', $address->getLastname());
|
| 333 |
+
$addressesCollection->addAttributeToFilter('region', $state_name);
|
| 334 |
+
$addressesCollection->addAttributeToFilter('street', array("like" => '%'.$this->_userData['billing[street]'].'%'));
|
| 335 |
+
|
| 336 |
+
foreach ($addressesCollection as $address) {
|
| 337 |
+
$this->_userData['billing[date_add]'] = $address->created_at;
|
| 338 |
+
$this->_userData['billing[last_updated]'] = $address->updated_at;
|
| 339 |
+
}
|
| 340 |
+
|
| 341 |
+
if ($order->getCustomerFirstname() == $address->getFirstname()
|
| 342 |
+
&& $order->getCustomerLastname() == $address->getLastname()) {
|
| 343 |
+
$this->_userData['dni'] = $address->getVatId();
|
| 344 |
+
$this->_userData['dob'] = substr($order->getCustomerDob(), 0, 10);
|
| 345 |
+
}
|
| 346 |
} else {
|
| 347 |
throw new \Exception('Missing user data info');
|
| 348 |
}
|
| 349 |
|
| 350 |
+
$this->_userData['loginCustomer[is_guest]'] = Mage::getSingleton('customer/session')->isLoggedIn() ? '0' : '1';
|
| 351 |
+
|
| 352 |
//fix to avoid empty fields
|
| 353 |
if (Mage::getSingleton('customer/session')->isLoggedIn()) {
|
| 354 |
+
$customer = Mage::getSingleton('customer/session')->getCustomer();
|
| 355 |
+
$this->_userData['loginCustomer[email]'] = $customer->getEmail();
|
| 356 |
+
$this->_userData['loginCustomer[full_name]'] = $customer->getFirstname() . ' ' . $customer->getLastname();
|
| 357 |
+
$this->_userData['loginCustomer[dni]'] = $customer->getData('taxvat');
|
| 358 |
+
$this->_userData['loginCustomer[dob]'] = substr($customer->getDob(), 0, 10);
|
| 359 |
+
if (empty($this->_userData['email'])) {
|
| 360 |
+
$this->_userData['email'] = $this->_userData['loginCustomer[email]'];
|
| 361 |
+
}
|
| 362 |
+
if (empty($this->_userData['full_name'])) {
|
| 363 |
+
$this->_userData['full_name'] = $this->_userData['loginCustomer[full_name]'];
|
| 364 |
+
}
|
| 365 |
+
if (empty($this->_userData['dni']) && $customer->getFirstname() == $address->getFirstname()
|
| 366 |
+
&& $customer->getLastname() == $address->getLastname()) {
|
| 367 |
+
$this->_userData['dni'] = $this->_userData['loginCustomer[dni]'];
|
| 368 |
+
}
|
| 369 |
+
if (empty($this->_userData['phone']) && $customer->getFirstname() == $address->getFirstname()
|
| 370 |
+
&& $customer->getLastname() == $address->getLastname()) {
|
| 371 |
+
$this->_userData['phone'] = $customer->getPrimaryBillingAddress()->getTelephone();
|
| 372 |
+
}
|
| 373 |
+
if (empty($this->_userData['mobile_phone']) && $customer->getFirstname() == $address->getFirstname()
|
| 374 |
+
&& $customer->getLastname() == $address->getLastname()) {
|
| 375 |
+
$this->_userData['mobile_phone'] = $customer->getPrimaryBillingAddress()->getTelephone();
|
| 376 |
+
}
|
| 377 |
+
if (empty($this->_userData['zipcode']) && $customer->getFirstname() == $address->getFirstname()
|
| 378 |
+
&& $customer->getLastname() == $address->getLastname()) {
|
| 379 |
+
$this->_userData['zipcode'] = $customer->getPrimaryBillingAddress()->getPostcode();
|
| 380 |
+
}
|
| 381 |
+
$this->_userData['customer_dob'] = substr($customer->getDob(), 0, 10);
|
| 382 |
+
if ($customer->getFirstname() == $address->getFirstname()
|
| 383 |
+
&& $customer->getLastname() == $address->getLastname()) {
|
| 384 |
+
$this->_userData['dob'] = substr($customer->getDob(), 0, 10);
|
| 385 |
+
}
|
| 386 |
}
|
| 387 |
}
|
| 388 |
|
| 414 |
|
| 415 |
if ($customer->getId() != null) {
|
| 416 |
$this->_userData['sign_up_date'] = date('Y/m/d', $customer->getCreatedAtTimestamp());
|
| 417 |
+
$this->_userData['loginCustomer[last_updated]'] = $customer->getUpdatedAt();
|
| 418 |
$_orders = Mage::getModel('sales/order')->getCollection()->
|
| 419 |
addFieldToFilter('customer_id', $customer->getId())->
|
| 420 |
addFieldToFilter('status', array(
|
| 453 |
}
|
| 454 |
}
|
| 455 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 456 |
/**
|
| 457 |
* Assign user data
|
| 458 |
* @param string $addressId
|
| 464 |
$order = Mage::getModel('sales/order')->loadByIncrementId($orderId);
|
| 465 |
$items = $order->getAllVisibleItems();
|
| 466 |
$i = 0;
|
| 467 |
+
foreach ($items as $item) {
|
| 468 |
+
$amount = round($item->getPriceInclTax(), 2);
|
| 469 |
$quantity = round($item->getQtyOrdered());
|
| 470 |
$this->_items[$i]['description'] = $item->getName();
|
| 471 |
$this->_items[$i]['quantity'] = $quantity;
|
| 472 |
+
$this->_items[$i]['amount'] = round($amount*$quantity, 2);
|
| 473 |
$i++;
|
| 474 |
}
|
| 475 |
+
$shippingAmount = round($order->getShippingInclTax(), 2);
|
| 476 |
+
if ($shippingAmount) {
|
| 477 |
$this->_items[$i]['description'] = "Gastos de envío";
|
| 478 |
$this->_items[$i]['quantity'] = "1";
|
| 479 |
$this->_items[$i]['amount'] = $shippingAmount;
|
| 480 |
$i++;
|
| 481 |
}
|
| 482 |
+
$discountAmount = round($order->getBaseDiscountAmount(), 2);
|
| 483 |
+
if ($discountAmount) {
|
| 484 |
$this->_items[$i]['description'] = "Descuento";
|
| 485 |
$this->_items[$i]['quantity'] = "1";
|
| 486 |
$this->_items[$i]['amount'] = $discountAmount;
|
| 496 |
* @param string $accountCode
|
| 497 |
* @throws Exception
|
| 498 |
*/
|
| 499 |
+
public function setAccountCode($accountCode = '')
|
| 500 |
+
{
|
| 501 |
if (strlen(trim($accountCode)) > 0) {
|
| 502 |
$this->_accountCode = $accountCode;
|
| 503 |
} else {
|
| 510 |
* @param string $discount
|
| 511 |
* @throws Exception
|
| 512 |
*/
|
| 513 |
+
public function setDiscount($discount = '')
|
| 514 |
+
{
|
| 515 |
if ($discount == 1) {
|
| 516 |
$this->_discount = 'true';
|
| 517 |
} else {
|
| 524 |
* @param string $iframe
|
| 525 |
* @throws Exception
|
| 526 |
*/
|
| 527 |
+
public function setIframe($iframe = '')
|
| 528 |
+
{
|
| 529 |
if ($iframe == 1) {
|
| 530 |
$this->_iframe = 'true';
|
| 531 |
} else {
|
| 538 |
* @param string end_of_month
|
| 539 |
* @throws Exception
|
| 540 |
*/
|
| 541 |
+
public function setEndOfMonth($end_of_month = '')
|
| 542 |
+
{
|
| 543 |
if ($end_of_month == 'true') {
|
| 544 |
$this->_end_of_month = 'true';
|
| 545 |
} else {
|
| 552 |
* @param string $accountKey
|
| 553 |
* @throws Exception
|
| 554 |
*/
|
| 555 |
+
public function setAccountKey($accountKey = '')
|
| 556 |
+
{
|
| 557 |
if (strlen(trim($accountKey)) > 0) {
|
| 558 |
$this->_accountKey = $accountKey;
|
| 559 |
} else {
|
| 595 |
* @param string $urlnok
|
| 596 |
* @throws Exception
|
| 597 |
*/
|
| 598 |
+
public function setUrlCancelled($urlKo = '')
|
| 599 |
+
{
|
| 600 |
+
#$urlCancel = Mage::helper('checkout/url')->getCheckoutUrl();
|
| 601 |
+
$urlCancel = $this->getUrl('cancel');
|
| 602 |
+
$have_params = strpos($urlCancel, '?');
|
| 603 |
+
if ($have_params !== false) {
|
| 604 |
+
$urlCancel = substr($urlCancel, 0, $have_params);
|
| 605 |
+
}
|
| 606 |
+
if (strlen(trim($urlCancel)) > 0) {
|
| 607 |
+
$this->_urlCancel = $urlCancel;
|
| 608 |
+
} else {
|
| 609 |
+
throw new \Exception('UrlKo not defined');
|
| 610 |
+
}
|
| 611 |
+
}
|
| 612 |
|
| 613 |
/**
|
| 614 |
* @param string $urlnok
|
| 616 |
*/
|
| 617 |
public function setCacllbackUrl()
|
| 618 |
{
|
| 619 |
+
if (Mage::app()->getStore()->isFrontUrlSecure()) {
|
| 620 |
+
$this->_callback_url=Mage::getUrl('', array('_forced_secure'=>true))."pagantis/pagantis/notification";
|
| 621 |
+
} else {
|
| 622 |
+
$this->_callback_url=Mage::getUrl('', array('_forced_secure'=>false))."pagantis/pagantis/notification";
|
| 623 |
}
|
| 624 |
$this->_callback_url = Mage::getModel('core/url')->sessionUrlVar($this->_callback_url);
|
| 625 |
}
|
| 637 |
//encoding is SHA1
|
| 638 |
$this->_firma = sha1($textToEncode);
|
| 639 |
//encoding is SHA512
|
| 640 |
+
$this->_firma = hash('sha512', $textToEncode);
|
| 641 |
/*
|
| 642 |
if (strlen(trim($textToEncode)) > 0) {
|
| 643 |
// Retrieve del SHA1
|
app/design/frontend/base/default/template/pagantis/redirect.phtml
CHANGED
|
@@ -16,7 +16,7 @@
|
|
| 16 |
|
| 17 |
|
| 18 |
<?php
|
| 19 |
-
|
| 20 |
?>
|
| 21 |
|
| 22 |
<!-- The Modal -->
|
|
@@ -57,5 +57,13 @@ document.addEventListener("DOMContentLoaded", function(event) {
|
|
| 57 |
</script>
|
| 58 |
|
| 59 |
<?php
|
| 60 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
?>
|
| 16 |
|
| 17 |
|
| 18 |
<?php
|
| 19 |
+
if ($this->iframe) {
|
| 20 |
?>
|
| 21 |
|
| 22 |
<!-- The Modal -->
|
| 57 |
</script>
|
| 58 |
|
| 59 |
<?php
|
| 60 |
+
} else {
|
| 61 |
+
?>
|
| 62 |
+
<script type="text/javascript">
|
| 63 |
+
(function () {
|
| 64 |
+
document.getElementById("pagantis_pagantis_checkout").submit();
|
| 65 |
+
})();
|
| 66 |
+
</script>
|
| 67 |
+
<?php
|
| 68 |
+
}
|
| 69 |
?>
|
package.xml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Pagantis_Pagantis</name>
|
| 4 |
-
<version>3.
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="http://www.gnu.org/licenses/gpl-3.0.en.html">GPL</license>
|
| 7 |
<channel>community</channel>
|
|
@@ -10,9 +10,9 @@
|
|
| 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>Send module version to form to increase acceptance ratio</notes>
|
| 12 |
<authors><author><name>Albert Fatsini</name><user>PagaMasTarde</user><email>afatsini@digitalorigin.com</email></author></authors>
|
| 13 |
-
<date>2017-
|
| 14 |
-
<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="
|
| 16 |
<compatible/>
|
| 17 |
<dependencies><required><php><min>5.2.0</min><max>8.0.0</max></php></required></dependencies>
|
| 18 |
</package>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Pagantis_Pagantis</name>
|
| 4 |
+
<version>3.3.1</version>
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="http://www.gnu.org/licenses/gpl-3.0.en.html">GPL</license>
|
| 7 |
<channel>community</channel>
|
| 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>Send module version to form to increase acceptance ratio</notes>
|
| 12 |
<authors><author><name>Albert Fatsini</name><user>PagaMasTarde</user><email>afatsini@digitalorigin.com</email></author></authors>
|
| 13 |
+
<date>2017-03-24</date>
|
| 14 |
+
<time>11:07:17</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="2c2dd64525f6f59dcd6b6d456ffc5ecf"/></dir><dir name="Helper"><file name="Data.php" hash="f411fc3dff8a30dde12612adcfc40921"/></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="172d7470e03c8e7be8a41fcad1ccc20f"/><file name="Requestloan.php" hash="d23eebdb6c091874098f3a12634a7f97"/><file name="Response.php" hash="bb1ade5931c5580f4585fc0fdb2bc4b0"/></dir></dir><dir name="controllers"><file name="PagantisController.php" hash="608a0e88c5c3267102464bd091ebb55e"/></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="d86f9c73af679745fa2541ecf03cbda3"/><file name="redirect.phtml" hash="78b3db7aac57b837c2f120757f767957"/></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><file name="iframe.css" hash="50660dc3125dee715f7d6ac8275d70da"/></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>
|
