Version Notes
Birth
Download this release
Release Info
Developer | Magento Core Team |
Extension | Aplazame_Aplazame |
Version | 0.1.0.1 |
Comparing to | |
See all releases |
Code changes from version 0.1.0 to 0.1.0.1
- app/code/community/Aplazame/Aplazame/Block/Checkout/Onepage/Billing.php +26 -0
- app/code/community/Aplazame/Aplazame/Block/Checkout/Onepage/Shipping.php +26 -0
- app/code/community/Aplazame/Aplazame/Block/Payment/Form.php +31 -0
- app/code/community/Aplazame/Aplazame/Block/Payment/Info.php +13 -0
- app/code/community/Aplazame/Aplazame/Block/Payment/Redirect.php +34 -0
- app/code/community/Aplazame/Aplazame/Helper/Cart.php +108 -0
- app/code/community/Aplazame/Aplazame/Helper/Data.php +6 -0
- app/code/community/Aplazame/Aplazame/Model/Api/Client.php +106 -0
- app/code/community/Aplazame/Aplazame/Model/Api/Serializers.php +212 -0
- app/code/community/Aplazame/Aplazame/Model/Config.php +30 -0
- app/code/community/Aplazame/Aplazame/Model/Observer.php +79 -0
- app/code/community/Aplazame/Aplazame/Model/Payment.php +156 -0
- app/code/community/Aplazame/Aplazame/controllers/PaymentController.php +112 -0
- app/code/community/Aplazame/Aplazame/etc/config.xml +101 -0
- app/code/community/Aplazame/Aplazame/etc/system.xml +96 -0
- app/design/frontend/base/default/layout/aplazame.xml +7 -0
- app/design/frontend/base/default/template/aplazame/payment/common.phtml +7 -0
- app/design/frontend/base/default/template/aplazame/payment/form.phtml +23 -0
- app/etc/modules/Aplazame_Aplazame.xml +10 -0
- lib/Aplazame/Aplazame.php +6 -0
- lib/Aplazame/Aplazame/Util.php +35 -0
- package.xml +10 -6
app/code/community/Aplazame/Aplazame/Block/Checkout/Onepage/Billing.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Extendemos / Rewrite del bloque estandar de Magento
|
5 |
+
* para asegurarnos que el formulario del checkout puebla
|
6 |
+
* la dirección, aunque el usuario no este logineado,
|
7 |
+
* con la dirección del quote.
|
8 |
+
*
|
9 |
+
* Class Aplazame_Aplazame_Block_Checkout_Onepage_Billing
|
10 |
+
*/
|
11 |
+
class Aplazame_Aplazame_Block_Checkout_Onepage_Billing extends Mage_Checkout_Block_Onepage_Billing
|
12 |
+
{
|
13 |
+
/**
|
14 |
+
* Return Sales Quote Address model
|
15 |
+
*
|
16 |
+
* @return Mage_Sales_Model_Quote_Address
|
17 |
+
*/
|
18 |
+
public function getAddress()
|
19 |
+
{
|
20 |
+
if (is_null($this->_address)) {
|
21 |
+
$this->_address = $this->getQuote()->getBillingAddress();
|
22 |
+
}
|
23 |
+
|
24 |
+
return $this->_address;
|
25 |
+
}
|
26 |
+
}
|
app/code/community/Aplazame/Aplazame/Block/Checkout/Onepage/Shipping.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Extendemos / Rewrite del bloque estandar de Magento
|
5 |
+
* para asegurarnos que el formulario del checkout puebla
|
6 |
+
* la dirección, aunque el usuario no este logineado,
|
7 |
+
* con la dirección del quote.
|
8 |
+
*
|
9 |
+
* Class Aplazame_Aplazame_Block_Checkout_Onepage_Shipping
|
10 |
+
*/
|
11 |
+
class Aplazame_Aplazame_Block_Checkout_Onepage_Shipping extends Mage_Checkout_Block_Onepage_Shipping
|
12 |
+
{
|
13 |
+
/**
|
14 |
+
* Return Sales Quote Address model
|
15 |
+
*
|
16 |
+
* @return Mage_Sales_Model_Quote_Address
|
17 |
+
*/
|
18 |
+
public function getAddress()
|
19 |
+
{
|
20 |
+
if (is_null($this->_address)) {
|
21 |
+
$this->_address = $this->getQuote()->getShippingAddress();
|
22 |
+
}
|
23 |
+
|
24 |
+
return $this->_address;
|
25 |
+
}
|
26 |
+
}
|
app/code/community/Aplazame/Aplazame/Block/Payment/Form.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
require_once Mage::getBaseDir('lib').DS.'Aplazame'.DS.'Aplazame.php';
|
4 |
+
|
5 |
+
|
6 |
+
class Aplazame_Aplazame_Block_Payment_Form extends Mage_Payment_Block_Form
|
7 |
+
{
|
8 |
+
protected function _construct()
|
9 |
+
{
|
10 |
+
parent::_construct();
|
11 |
+
$this->setMethodLabel();
|
12 |
+
$this->setTemplate('aplazame/payment/form.phtml');
|
13 |
+
}
|
14 |
+
|
15 |
+
private function setMethodLabel()
|
16 |
+
{
|
17 |
+
$this->setMethodTitle("");
|
18 |
+
|
19 |
+
$logoSrc = 'https://aplazame.com/static/img/buttons/' . Mage::getStoreConfig('payment/aplazame/button_img') . '.png';
|
20 |
+
$html = '<img src="' . $logoSrc . '" height="27" class="v-middle" /> ';
|
21 |
+
$html.= 'Financia tu compa con Aplazame';
|
22 |
+
|
23 |
+
$this->setMethodLabelAfterHtml($html);
|
24 |
+
}
|
25 |
+
|
26 |
+
public function getTotal() {
|
27 |
+
return Aplazame_Util::formatDecimals(
|
28 |
+
$this->getMethod()->getCheckout()->getQuote()->getGrandTotal());
|
29 |
+
}
|
30 |
+
|
31 |
+
}
|
app/code/community/Aplazame/Aplazame/Block/Payment/Info.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
class Aplazame_Aplazame_Block_Payment_Info extends Mage_Payment_Block_Info
|
5 |
+
{
|
6 |
+
|
7 |
+
protected function _toHtml()
|
8 |
+
{
|
9 |
+
$html = '<a href="https://aplazame.com">Aplazame</a>';
|
10 |
+
return $html;
|
11 |
+
}
|
12 |
+
|
13 |
+
}
|
app/code/community/Aplazame/Aplazame/Block/Payment/Redirect.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
class Aplazame_Aplazame_Block_Payment_Redirect extends Mage_Core_Block_Abstract
|
5 |
+
{
|
6 |
+
protected function _toHtml()
|
7 |
+
{
|
8 |
+
$payment = Mage::getModel('aplazame/payment');
|
9 |
+
|
10 |
+
$html = '
|
11 |
+
<html>
|
12 |
+
<body style="margin: 0;">
|
13 |
+
|
14 |
+
<script
|
15 |
+
type="text/javascript"
|
16 |
+
src="'. trim(Mage::getStoreConfig('payment/aplazame/host'), "/") . '/static/aplazame.js' . '"
|
17 |
+
data-aplazame="publicKey: '. Mage::getStoreConfig('payment/aplazame/public_api_key') . '"
|
18 |
+
data-version="'. Mage::getStoreConfig('payment/aplazame/version') . '"
|
19 |
+
data-sandbox="'. (Mage::getStoreConfig('payment/aplazame/sandbox')?'true':'false') . '">
|
20 |
+
</script>
|
21 |
+
|
22 |
+
<script>
|
23 |
+
aplazame.checkout(' . json_encode($payment->getCheckoutSerializer(), 128) . ');
|
24 |
+
</script>
|
25 |
+
|
26 |
+
<iframe src="'./*Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB)*/Mage::getUrl('', array('_secure'=>true)).'" style="position:fixed; top:0px; left:0px; bottom:0px; right:0px; width:100%; height:100%; border:none; margin:0; padding:0; overflow:hidden;">
|
27 |
+
Your browser doesnt support IFrames
|
28 |
+
</iframe>
|
29 |
+
</body>
|
30 |
+
</html>';
|
31 |
+
|
32 |
+
return $html;
|
33 |
+
}
|
34 |
+
}
|
app/code/community/Aplazame/Aplazame/Helper/Cart.php
ADDED
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Aplazame_Aplazame_Helper_Cart extends Mage_Core_Helper_Abstract
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Funcion que resucita un carrito (quote) en caso
|
7 |
+
* de producirse algún fallo en el proceso de cobro de aplazame
|
8 |
+
* o bien se ha rechazado la operación.
|
9 |
+
*/
|
10 |
+
public function resuscitateCartFromOrder(Mage_Sales_Model_Order $order)
|
11 |
+
{
|
12 |
+
$this
|
13 |
+
->_cancelOrder($order)
|
14 |
+
->_resuscitateCartItems($order)
|
15 |
+
->_setCheckoutInfoFromOldOrder($order);
|
16 |
+
|
17 |
+
return $this;
|
18 |
+
}
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Cancela la order anterior que se le pasa como parametro
|
22 |
+
*
|
23 |
+
* @param Mage_Sales_Model_Order $order
|
24 |
+
* @return $this
|
25 |
+
*/
|
26 |
+
protected function _cancelOrder(Mage_Sales_Model_Order $order)
|
27 |
+
{
|
28 |
+
$order
|
29 |
+
->cancel()
|
30 |
+
->save();
|
31 |
+
|
32 |
+
return $this;
|
33 |
+
}
|
34 |
+
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Re-añade los productos comprados a carrito nuevamente
|
38 |
+
*
|
39 |
+
* @param Mage_Sales_Model_Order $order
|
40 |
+
* @return $this
|
41 |
+
*/
|
42 |
+
protected function _resuscitateCartItems(Mage_Sales_Model_Order $order)
|
43 |
+
{
|
44 |
+
foreach($order->getItemsCollection() as $orderItem)
|
45 |
+
{
|
46 |
+
$this->getCart()->addOrderItem($orderItem);
|
47 |
+
}
|
48 |
+
|
49 |
+
$this->getCart()->save();
|
50 |
+
|
51 |
+
return $this;
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Coge las billing y shipping address de la ultima order
|
56 |
+
* el checkout method y shipping method
|
57 |
+
* y las vuelve a meter en quote actual para que el checkout
|
58 |
+
* pueda tener las direcciones pre-populadas.
|
59 |
+
*
|
60 |
+
* @param Mage_Sales_Model_Order $order
|
61 |
+
*/
|
62 |
+
protected function _setCheckoutInfoFromOldOrder(Mage_Sales_Model_Order $order)
|
63 |
+
{
|
64 |
+
$checkoutSession = $this->getCheckoutSession();
|
65 |
+
$quote = $checkoutSession->getQuote();
|
66 |
+
$oldQuote = Mage::getModel('sales/quote')->load($order->getQuoteId());
|
67 |
+
|
68 |
+
$quote->setCheckoutMethod($oldQuote->getCheckoutMethod());
|
69 |
+
|
70 |
+
if($oldQuote->getId())
|
71 |
+
{
|
72 |
+
$billingAddress = clone $oldQuote->getBillingAddress();
|
73 |
+
$billingAddress->setQuote($quote);
|
74 |
+
|
75 |
+
$shippingAddress = clone $oldQuote->getShippingAddress();
|
76 |
+
$shippingAddress->setQuote($quote);
|
77 |
+
|
78 |
+
$quote->removeAddress($quote->getBillingAddress()->getId());
|
79 |
+
$quote->removeAddress($quote->getShippingAddress()->getId());
|
80 |
+
|
81 |
+
$quote->setBillingAddress($billingAddress);
|
82 |
+
$quote->setShippingAddress($shippingAddress);
|
83 |
+
}
|
84 |
+
|
85 |
+
$quote->save();
|
86 |
+
|
87 |
+
return $this;
|
88 |
+
}
|
89 |
+
|
90 |
+
/**
|
91 |
+
* @return Mage_Checkout_Model_Cart
|
92 |
+
*/
|
93 |
+
public function getCart()
|
94 |
+
{
|
95 |
+
return Mage::getSingleton('checkout/cart');
|
96 |
+
}
|
97 |
+
|
98 |
+
/**
|
99 |
+
* @return Mage_Checkout_Model_Session
|
100 |
+
*/
|
101 |
+
public function getCheckoutSession()
|
102 |
+
{
|
103 |
+
return Mage::getSingleton('checkout/session');
|
104 |
+
}
|
105 |
+
|
106 |
+
|
107 |
+
|
108 |
+
}
|
app/code/community/Aplazame/Aplazame/Helper/Data.php
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Aplazame_Aplazame_Helper_Data extends Mage_Core_Helper_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
}
|
app/code/community/Aplazame/Aplazame/Model/Api/Client.php
ADDED
@@ -0,0 +1,106 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Aplazame_Aplazame_Model_Api_Client extends Varien_Object
|
4 |
+
{
|
5 |
+
const USER_AGENT = 'AplazameMagento/';
|
6 |
+
const API_CHECKOUT_PATH = '/orders';
|
7 |
+
|
8 |
+
public function __construct()
|
9 |
+
{
|
10 |
+
}
|
11 |
+
|
12 |
+
public function getBaseApiUrl()
|
13 |
+
{
|
14 |
+
return str_replace('://', '://api.', Mage::getStoreConfig('payment/aplazame/host'));
|
15 |
+
}
|
16 |
+
|
17 |
+
protected function _api_request($method, $path, $data=null)
|
18 |
+
{
|
19 |
+
$url = trim($this->getBaseApiUrl(), "/") . self::API_CHECKOUT_PATH . $path;
|
20 |
+
$client = new Zend_Http_Client($url);
|
21 |
+
|
22 |
+
if (in_array($method, array(
|
23 |
+
Zend_Http_Client::POST, Zend_Http_Client::PUT, 'PATCH')) && $data)
|
24 |
+
{
|
25 |
+
$client->setHeaders('Content-type: application/json');
|
26 |
+
$client->setRawData(json_encode($data), 'application/json');
|
27 |
+
}
|
28 |
+
|
29 |
+
$client->setHeaders('Authorization: Bearer '.
|
30 |
+
Mage::getStoreConfig('payment/aplazame/secret_api_key'));
|
31 |
+
|
32 |
+
$version = Mage::getStoreConfig('payment/aplazame/version');
|
33 |
+
|
34 |
+
if ($version){
|
35 |
+
$version = explode(".", $version);
|
36 |
+
$version = $version[0];
|
37 |
+
}
|
38 |
+
|
39 |
+
$client->setHeaders('User-Agent: '. self::USER_AGENT .
|
40 |
+
Mage::getConfig()->getModuleConfig('Aplazame_Aplazame')->version);
|
41 |
+
|
42 |
+
$client->setHeaders('Accept: '. 'application/vnd.aplazame.'.
|
43 |
+
(Mage::getStoreConfig('payment/aplazame/sandbox')?'sandbox.': '') . $version . '+json');
|
44 |
+
|
45 |
+
$response = $client->request($method);
|
46 |
+
$raw_result = $response->getBody();
|
47 |
+
$status_code = $response->getStatus();
|
48 |
+
|
49 |
+
if ($status_code >= 500)
|
50 |
+
{
|
51 |
+
Mage::throwException(Mage::helper('aplazame')->__(
|
52 |
+
'Aplazame error code: ' . $status_code));
|
53 |
+
}
|
54 |
+
|
55 |
+
try{
|
56 |
+
$ret_json = Zend_Json::decode($raw_result, Zend_Json::TYPE_ARRAY);
|
57 |
+
} catch(Zend_Json_Exception $e)
|
58 |
+
{
|
59 |
+
Mage::throwException(Mage::helper('aplazame')->__(
|
60 |
+
'Invalid api response: '. $raw_result));
|
61 |
+
}
|
62 |
+
|
63 |
+
if ($status_code >= 400)
|
64 |
+
{
|
65 |
+
$errorMsg = Mage::helper('aplazame')->__('Aplazame error code ' . $status_code . ': '
|
66 |
+
. $ret_json['error']['message']);
|
67 |
+
|
68 |
+
if($status_code == 403)
|
69 |
+
{
|
70 |
+
//no tiramos exception, pero informamos de error
|
71 |
+
Mage::getSingleton('adminhtml/session')->addError($errorMsg);
|
72 |
+
}
|
73 |
+
|
74 |
+
//para los demás errores mayores de 400 menos el 403
|
75 |
+
//tiramos exception.
|
76 |
+
Mage::throwException($errorMsg);
|
77 |
+
}
|
78 |
+
|
79 |
+
return $ret_json;
|
80 |
+
}
|
81 |
+
|
82 |
+
public function authorize()
|
83 |
+
{
|
84 |
+
return $this->_api_request(Varien_Http_Client::POST, "/" .
|
85 |
+
$this->getOrderId() . "/authorize");
|
86 |
+
}
|
87 |
+
|
88 |
+
public function updateOrder()
|
89 |
+
{
|
90 |
+
$order = $this->getOrder();
|
91 |
+
|
92 |
+
$serializer = Mage::getModel('aplazame/api_serializers');
|
93 |
+
$data = $serializer->setOrder($order)->getOrderUpdate();
|
94 |
+
|
95 |
+
return $this->_api_request(
|
96 |
+
'PATCH', "/" . (int)$order->getIncrementId(), $data);
|
97 |
+
}
|
98 |
+
|
99 |
+
public function cancelOrder()
|
100 |
+
{
|
101 |
+
$order = $this->getOrder();
|
102 |
+
|
103 |
+
return $this->_api_request(
|
104 |
+
Varien_Http_Client::POST, "/" . (int)$order->getIncrementId() . "/cancel");
|
105 |
+
}
|
106 |
+
}
|
app/code/community/Aplazame/Aplazame/Model/Api/Serializers.php
ADDED
@@ -0,0 +1,212 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
require_once Mage::getBaseDir('lib').DS.'Aplazame'.DS.'Aplazame.php';
|
4 |
+
|
5 |
+
|
6 |
+
class Aplazame_Aplazame_Model_Api_Serializers extends Varien_Object
|
7 |
+
{
|
8 |
+
private static function formatDecimals($price)
|
9 |
+
{
|
10 |
+
return Aplazame_Util::formatDecimals($price);
|
11 |
+
}
|
12 |
+
|
13 |
+
private static function _getMetadata()
|
14 |
+
{
|
15 |
+
return array(
|
16 |
+
"module" => array(
|
17 |
+
"name" => "aplazame:magento",
|
18 |
+
"version" => Mage::getVersion()
|
19 |
+
),
|
20 |
+
"version" => Mage::getConfig()->getModuleConfig('Aplazame_Aplazame')->version
|
21 |
+
);
|
22 |
+
}
|
23 |
+
|
24 |
+
private function _orderTotal()
|
25 |
+
{
|
26 |
+
return $this->getOrder()->getTotalDue();
|
27 |
+
}
|
28 |
+
|
29 |
+
public function getInvoiceFeeIncludeTax()
|
30 |
+
{
|
31 |
+
return $this->getTotal()->getAddress()->getInvoiceFee();
|
32 |
+
}
|
33 |
+
|
34 |
+
public function getInvoiceFeeExcludeTax()
|
35 |
+
{
|
36 |
+
return $this->getTotal()->getAddress()->getInvoiceFeeExcludedVat();
|
37 |
+
}
|
38 |
+
|
39 |
+
protected function _getAddr($addr)
|
40 |
+
{
|
41 |
+
return array(
|
42 |
+
"first_name"=> $addr->getFirstname(),
|
43 |
+
"last_name"=> $addr->getLastname(),
|
44 |
+
"phone"=> $addr->getTelephone(),
|
45 |
+
"alt_phone"=> $addr->getAltTelephone(),
|
46 |
+
"street" => $addr->getStreet(1),
|
47 |
+
"address_addition" => $addr->getStreet(2),
|
48 |
+
"city" => $addr->getCity(),
|
49 |
+
"state" => $addr->getRegion(),
|
50 |
+
"country" => $addr->getCountryModel()->getIso2Code(),
|
51 |
+
"zip" => $addr->getPostcode());
|
52 |
+
}
|
53 |
+
|
54 |
+
protected function getCustomer()
|
55 |
+
{
|
56 |
+
$customer = Mage::getSingleton('customer/session')->getCustomer();
|
57 |
+
$logCustomer = Mage::getModel('log/customer')->loadByCustomer($customer);
|
58 |
+
$customer_serializer = array("gender"=>0);
|
59 |
+
|
60 |
+
if ($customer->getId()) {
|
61 |
+
$customer_serializer = array_merge($customer_serializer, array(
|
62 |
+
"id"=>$customer->getId(),
|
63 |
+
"type"=>"e",
|
64 |
+
"email"=>$customer->getEmail(),
|
65 |
+
"first_name"=>$customer->getFirstname(),
|
66 |
+
"last_name"=>$customer->getLastname(),
|
67 |
+
"date_joined"=>date(DATE_ISO8601, $customer->getCreatedAtTimestamp()),
|
68 |
+
"last_login"=>date(DATE_ISO8601, $logCustomer->getLoginAtTimestamp())));
|
69 |
+
} else {
|
70 |
+
$order = $this->getOrder();
|
71 |
+
|
72 |
+
$customer_serializer = array_merge($customer_serializer, array(
|
73 |
+
"type"=>"g",
|
74 |
+
"email"=>$order->getCustomerEmail(),
|
75 |
+
"first_name"=>$order->getCustomerFirstname(),
|
76 |
+
"last_name"=>$order->getCustomerLastname()));
|
77 |
+
}
|
78 |
+
|
79 |
+
return $customer_serializer;
|
80 |
+
}
|
81 |
+
|
82 |
+
protected function getShipping()
|
83 |
+
{
|
84 |
+
$order = $this->getOrder();
|
85 |
+
$shipping = null;
|
86 |
+
$shipping_address = $order->getShippingAddress();
|
87 |
+
|
88 |
+
if ($shipping_address)
|
89 |
+
{
|
90 |
+
$shipping = array_merge($this->_getAddr($shipping_address), array(
|
91 |
+
"price"=> static::formatDecimals($order->getShippingAmount()),
|
92 |
+
"tax_rate"=>static::formatDecimals(100 * $order->getShippingTaxAmount() / $order->getShippingAmount()),
|
93 |
+
"name"=>$order->getShippingMethod()
|
94 |
+
));
|
95 |
+
}
|
96 |
+
|
97 |
+
return $shipping;
|
98 |
+
}
|
99 |
+
|
100 |
+
private function getProductTaxRate($product)
|
101 |
+
{
|
102 |
+
$store = Mage::app()->getStore();
|
103 |
+
$request = Mage::getSingleton('tax/calculation')->getRateRequest(null, null, null, $store);
|
104 |
+
$taxclassid = $product->getData('tax_class_id');
|
105 |
+
return Mage::getSingleton('tax/calculation')->getRate($request->setProductClassId($taxclassid));
|
106 |
+
}
|
107 |
+
|
108 |
+
protected function getArticles()
|
109 |
+
{
|
110 |
+
$order = $this->getOrder();
|
111 |
+
$articles = array();
|
112 |
+
$products = Mage::getModel('catalog/product');
|
113 |
+
|
114 |
+
foreach($order->getAllVisibleItems() as $order_item)
|
115 |
+
{
|
116 |
+
$productId = $order_item->getProductId();
|
117 |
+
$product = $products->load($productId);
|
118 |
+
$discounts = $product->getPrice() - $product->getFinalPrice();
|
119 |
+
|
120 |
+
$articles[] = array(
|
121 |
+
"id" => $order_item->getId(),
|
122 |
+
"sku" => $order_item->getSku(),
|
123 |
+
"name" => $order_item->getName(),
|
124 |
+
"description" => substr($product->getDescription(), 0, 255),
|
125 |
+
"url" =>$product->getProductUrl(),
|
126 |
+
"image_url" => $product->getImageUrl(),
|
127 |
+
"quantity" => intval($order_item->getQtyOrdered()),
|
128 |
+
"price" => static::formatDecimals($order_item->getPrice() + $discounts),
|
129 |
+
"tax_rate" => static::formatDecimals($this->getProductTaxRate($product)),
|
130 |
+
"discount" => static::formatDecimals($discounts));
|
131 |
+
}
|
132 |
+
|
133 |
+
return $articles;
|
134 |
+
}
|
135 |
+
|
136 |
+
protected function getRenderOrder()
|
137 |
+
{
|
138 |
+
$order = $this->getOrder();
|
139 |
+
$discounts = $order->getDiscountAmount();
|
140 |
+
|
141 |
+
if (is_null($discounts)) {
|
142 |
+
$discounts = 0;
|
143 |
+
}
|
144 |
+
|
145 |
+
return array(
|
146 |
+
"id"=>$order->getIncrementId(),
|
147 |
+
"articles"=>$this->getArticles(),
|
148 |
+
"currency"=>$order->getOrderCurrencyCode(),
|
149 |
+
"tax_amount"=>static::formatDecimals($order->getTaxAmount()),
|
150 |
+
"total_amount"=>static::formatDecimals($this->_orderTotal()),
|
151 |
+
"discount"=>-static::formatDecimals($discounts));
|
152 |
+
}
|
153 |
+
|
154 |
+
public function getHistory()
|
155 |
+
{
|
156 |
+
$order = $this->getOrder();
|
157 |
+
$history_collection = Mage::getModel('sales/order')
|
158 |
+
->getCollection()
|
159 |
+
->addAttributeToFilter('customer_id', array('like'=>$order->getCustomerId()));
|
160 |
+
|
161 |
+
$history = array();
|
162 |
+
foreach($history_collection as $order_history){
|
163 |
+
|
164 |
+
$history[] = array(
|
165 |
+
"id"=>$order_history->getIncrementId(),
|
166 |
+
"amount"=>static::formatDecimals($order_history->getGrandTotal()),
|
167 |
+
"due"=>static::formatDecimals($order_history->getTotalDue()),
|
168 |
+
"status"=>$order_history->getStatus(),
|
169 |
+
"type"=>$order_history->getPayment()->getMethodInstance()->getCode(),
|
170 |
+
"order_date"=>date(DATE_ISO8601, strtotime($order_history->getCreatedAt())),
|
171 |
+
"currency"=>$order_history->getOrderCurrencyCode(),
|
172 |
+
"billing"=>$this->_getAddr($order_history->getBillingAddress()),
|
173 |
+
"shipping"=>$this->getShipping($order_history));
|
174 |
+
}
|
175 |
+
|
176 |
+
return $history;
|
177 |
+
}
|
178 |
+
|
179 |
+
public function getOrderUpdate()
|
180 |
+
{
|
181 |
+
$order = $this->getOrder();
|
182 |
+
|
183 |
+
return array(
|
184 |
+
"order"=>$this->getRenderOrder(),
|
185 |
+
"billing"=>$this->_getAddr($order->getBillingAddress()),
|
186 |
+
"shipping"=>$this->getShipping($order),
|
187 |
+
"meta"=>static::_getMetadata());
|
188 |
+
}
|
189 |
+
|
190 |
+
public function getCheckout()
|
191 |
+
{
|
192 |
+
$order = $this->getOrder();
|
193 |
+
$info = $this->getInfoInstance();
|
194 |
+
|
195 |
+
$merchant = array(
|
196 |
+
"confirmation_url"=>Mage::getUrl("aplazame/payment/confirm"),
|
197 |
+
"cancel_url"=>Mage::getUrl('aplazame/payment/cancel') . '?status=error',
|
198 |
+
"checkout_url"=>Mage::getUrl('aplazame/payment/cancel'),
|
199 |
+
"success_url"=>Mage::getUrl('checkout/onepage/success'));
|
200 |
+
|
201 |
+
return array(
|
202 |
+
"toc"=>True,
|
203 |
+
"merchant"=>$merchant,
|
204 |
+
"customer"=>$this->getCustomer(),
|
205 |
+
"order"=>$this->getRenderOrder(),
|
206 |
+
"billing"=>$this->_getAddr($order->getBillingAddress()),
|
207 |
+
"shipping"=>$this->getShipping($order),
|
208 |
+
"meta"=>static::_getMetadata());
|
209 |
+
|
210 |
+
}
|
211 |
+
}
|
212 |
+
|
app/code/community/Aplazame/Aplazame/Model/Config.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Aplazame_Aplazame_Model_Config
|
4 |
+
{
|
5 |
+
protected $_storeId = null;
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Return merchant country code
|
9 |
+
*/
|
10 |
+
public function getMerchantCountry()
|
11 |
+
{
|
12 |
+
$countryCode = Mage::getStoreConfig("aplazame/general/merchant_country", $this->_storeId);
|
13 |
+
if (!$countryCode) {
|
14 |
+
$countryCode = Mage::helper('core')->getDefaultCountry($this->_storeId);
|
15 |
+
}
|
16 |
+
return $countryCode;
|
17 |
+
}
|
18 |
+
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Check whether specified currency code is supported
|
22 |
+
*/
|
23 |
+
public function isCurrencyCodeSupported($code)
|
24 |
+
{
|
25 |
+
if ($this->getMerchantCountry() == 'ES' && $code == 'EUR') {
|
26 |
+
return true;
|
27 |
+
}
|
28 |
+
return false;
|
29 |
+
}
|
30 |
+
}
|
app/code/community/Aplazame/Aplazame/Model/Observer.php
ADDED
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
class Aplazame_Aplazame_Model_Observer extends Mage_Core_Model_Abstract
|
5 |
+
{
|
6 |
+
|
7 |
+
protected function is_aplazame_payment($order)
|
8 |
+
{
|
9 |
+
$code = Aplazame_Aplazame_Model_Payment::METHOD_CODE;
|
10 |
+
|
11 |
+
$parentOrder = Mage::getModel('sales/order')->loadByIncrementId(
|
12 |
+
(int)$order->getIncrementId());
|
13 |
+
|
14 |
+
return ($code == $parentOrder->getPayment()->getMethod());
|
15 |
+
}
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Method for updating the order status after completing a purchase
|
19 |
+
*/
|
20 |
+
public function salesOrderPlaceAfter($observer)
|
21 |
+
{
|
22 |
+
$order = $observer->getOrder();
|
23 |
+
|
24 |
+
if (!isset($order)) {
|
25 |
+
return $this;
|
26 |
+
}
|
27 |
+
|
28 |
+
$payment = $order->getPayment();
|
29 |
+
|
30 |
+
if (!isset($payment)) {
|
31 |
+
return $this;
|
32 |
+
}
|
33 |
+
|
34 |
+
if (!$this->is_aplazame_payment($order)) {
|
35 |
+
return $this;
|
36 |
+
}
|
37 |
+
|
38 |
+
$client = Mage::getModel('aplazame/api_client');
|
39 |
+
$result = $client->setOrder($order)->updateOrder();
|
40 |
+
|
41 |
+
return $this;
|
42 |
+
}
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Method after load order edition
|
46 |
+
*/
|
47 |
+
public function salesOrderLoadAfter($observer)
|
48 |
+
{
|
49 |
+
return $this;
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Method used for canceling a Aplazame invoice when a Magento order is canceled
|
54 |
+
*/
|
55 |
+
public function salesOrderPaymentCancel($observer)
|
56 |
+
{
|
57 |
+
$code = Aplazame_Aplazame_Model_Payment::METHOD_CODE;
|
58 |
+
$order = $observer->getOrder();
|
59 |
+
|
60 |
+
$orderId = explode("-", $order->getIncrementId());
|
61 |
+
|
62 |
+
$nextOrder = Mage::getModel('sales/order')->loadByIncrementId(
|
63 |
+
$orderId[0] . '-' . ((int)$orderId[1] + 1));
|
64 |
+
|
65 |
+
if ($nextOrder->getId()) {
|
66 |
+
return $this;
|
67 |
+
}
|
68 |
+
|
69 |
+
if (!$this->is_aplazame_payment($order)) {
|
70 |
+
return $this;
|
71 |
+
}
|
72 |
+
|
73 |
+
$client = Mage::getModel('aplazame/api_client');
|
74 |
+
$result = $client->setOrder($order)->cancelOrder();
|
75 |
+
|
76 |
+
return $this;
|
77 |
+
}
|
78 |
+
|
79 |
+
}
|
app/code/community/Aplazame/Aplazame/Model/Payment.php
ADDED
@@ -0,0 +1,156 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
require_once Mage::getBaseDir('lib').DS.'Aplazame'.DS.'Aplazame.php';
|
5 |
+
|
6 |
+
|
7 |
+
class Aplazame_Aplazame_Model_Payment extends Mage_Payment_Model_Method_Abstract
|
8 |
+
{
|
9 |
+
const METHOD_CODE = 'aplazame';
|
10 |
+
const CHECKOUT_TOKEN = 'checkout_token';
|
11 |
+
|
12 |
+
/**
|
13 |
+
* options
|
14 |
+
*/
|
15 |
+
protected $_code = self::METHOD_CODE;
|
16 |
+
protected $_formBlockType = 'aplazame/payment_form';
|
17 |
+
protected $_infoBlockType = 'aplazame/payment_info';
|
18 |
+
protected $_isInitializeNeeded = true;
|
19 |
+
protected $_canUseInternal = false;
|
20 |
+
protected $_canUseForMultishipping = false;
|
21 |
+
|
22 |
+
|
23 |
+
public function initialize($paymentAction, $stateObject)
|
24 |
+
{
|
25 |
+
$state = Mage_Sales_Model_Order::STATE_PENDING_PAYMENT;
|
26 |
+
|
27 |
+
$stateObject->setState($state);
|
28 |
+
$stateObject->setStatus($state);
|
29 |
+
$stateObject->setIsNotified(false);
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Whether method is available for specified currency
|
34 |
+
*/
|
35 |
+
public function canUseForCurrency($currencyCode)
|
36 |
+
{
|
37 |
+
return $this->getConfig()->isCurrencyCodeSupported($currencyCode);
|
38 |
+
}
|
39 |
+
|
40 |
+
private static function _orderTotal($order)
|
41 |
+
{
|
42 |
+
return $order->getTotalDue();
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Config instance getter
|
47 |
+
*/
|
48 |
+
public function getConfig()
|
49 |
+
{
|
50 |
+
if (null === $this->_config) {
|
51 |
+
$params = array($this->_code);
|
52 |
+
if ($store = $this->getStore()) {
|
53 |
+
$params[] = is_object($store) ? $store->getId() : $store;
|
54 |
+
}
|
55 |
+
$this->_config = Mage::getModel('aplazame/config', $params);
|
56 |
+
}
|
57 |
+
return $this->_config;
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Get aplazame session namespace
|
62 |
+
*/
|
63 |
+
public function getSession()
|
64 |
+
{
|
65 |
+
return Mage::getSingleton('aplazame/session');
|
66 |
+
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Get checkout session namespace
|
70 |
+
*/
|
71 |
+
public function getCheckout()
|
72 |
+
{
|
73 |
+
return Mage::getSingleton('checkout/session');
|
74 |
+
}
|
75 |
+
|
76 |
+
|
77 |
+
public function getOrderPlaceRedirectUrl()
|
78 |
+
{
|
79 |
+
return Mage::getUrl('aplazame/payment/redirect', array('_secure' => true));
|
80 |
+
}
|
81 |
+
|
82 |
+
public function getChargeId()
|
83 |
+
{
|
84 |
+
return $this->getInfoInstance()->getAdditionalInformation("charge_id");
|
85 |
+
}
|
86 |
+
|
87 |
+
protected function _validate_amount_result($amount, $result)
|
88 |
+
{
|
89 |
+
if ($result["amount"] != $amount)
|
90 |
+
{
|
91 |
+
Mage::throwException(Mage::helper('aplazame')->__(
|
92 |
+
'Aplazame authorized amount of ' . $result["amount"] .
|
93 |
+
' does not match requested amount of: ' . $amount));
|
94 |
+
}
|
95 |
+
}
|
96 |
+
|
97 |
+
public function authorize(Varien_Object $payment, $amount)
|
98 |
+
{
|
99 |
+
if ($amount <= 0) {
|
100 |
+
Mage::throwException(Mage::helper('aplazame')->__('Invalid amount for authorization.'));
|
101 |
+
}
|
102 |
+
|
103 |
+
$token = $payment->getAdditionalInformation(self::CHECKOUT_TOKEN);
|
104 |
+
|
105 |
+
$api = Mage::getModel('aplazame/api_client');
|
106 |
+
$result = $api->setOrderId($token)->authorize();
|
107 |
+
|
108 |
+
if (isset($result["id"]))
|
109 |
+
{
|
110 |
+
$this->getInfoInstance()->setAdditionalInformation("charge_id", $result["id"]);
|
111 |
+
}
|
112 |
+
else
|
113 |
+
{
|
114 |
+
Mage::throwException(Mage::helper('aplazame')->__('Aplazame charge id not returned from call.'));
|
115 |
+
}
|
116 |
+
|
117 |
+
$this->_validate_amount_result(Aplazame_Util::formatDecimals($amount), $result);
|
118 |
+
$payment->setTransactionId($this->getChargeId())->setIsTransactionClosed(0);
|
119 |
+
return $this;
|
120 |
+
}
|
121 |
+
|
122 |
+
public function processConfirmOrder($order, $checkout_token)
|
123 |
+
{
|
124 |
+
$payment = $order->getPayment();
|
125 |
+
|
126 |
+
$payment->setAdditionalInformation(self::CHECKOUT_TOKEN, $checkout_token);
|
127 |
+
$action = $this->getConfigData('payment_action');
|
128 |
+
|
129 |
+
//authorize the total amount.
|
130 |
+
$payment->authorize(true, static::_orderTotal($order));
|
131 |
+
$payment->setAmountAuthorized(static::_orderTotal($order));
|
132 |
+
$order->save();
|
133 |
+
}
|
134 |
+
|
135 |
+
public function processHistory($order, $checkout_token)
|
136 |
+
{
|
137 |
+
$serializer = Mage::getModel('aplazame/api_serializers');
|
138 |
+
|
139 |
+
$result = $serializer->setOrder($order)
|
140 |
+
->getHistory();
|
141 |
+
|
142 |
+
return json_encode($result, 128);
|
143 |
+
}
|
144 |
+
|
145 |
+
public function getCheckoutSerializer()
|
146 |
+
{
|
147 |
+
$orderIncrementId = $this->getCheckout()->getLastRealOrderId();
|
148 |
+
|
149 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId);
|
150 |
+
$serializer = Mage::getModel('aplazame/api_serializers');
|
151 |
+
|
152 |
+
$serializer->setOrder($order);
|
153 |
+
return $serializer->getCheckout();
|
154 |
+
}
|
155 |
+
}
|
156 |
+
|
app/code/community/Aplazame/Aplazame/controllers/PaymentController.php
ADDED
@@ -0,0 +1,112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Aplazame_Aplazame_PaymentController extends Mage_Core_Controller_Front_Action
|
4 |
+
{
|
5 |
+
|
6 |
+
private function _getCheckoutSession()
|
7 |
+
{
|
8 |
+
return Mage::getSingleton('checkout/session');
|
9 |
+
}
|
10 |
+
|
11 |
+
protected function _getAccessToken()
|
12 |
+
{
|
13 |
+
$request = new Zend_Controller_Request_Http();
|
14 |
+
$authorization = $request->getHeader('authorization');
|
15 |
+
|
16 |
+
if ($authorization) {
|
17 |
+
$token = explode(' ', $authorization);
|
18 |
+
$token =$token[1];
|
19 |
+
if (isset($token) && is_string($token)) {
|
20 |
+
return $token;
|
21 |
+
}
|
22 |
+
Mage::throwException($this->__('Authentication header format is invalid.'));
|
23 |
+
}
|
24 |
+
Mage::throwException($this->__('Authentication header is absent.'));
|
25 |
+
}
|
26 |
+
|
27 |
+
public function redirectAction()
|
28 |
+
{
|
29 |
+
$session = $this->_getCheckoutSession();
|
30 |
+
|
31 |
+
if (!$session->getLastRealOrderId())
|
32 |
+
{
|
33 |
+
$session->addError($this->__('Your order has expired.'));
|
34 |
+
$this->_redirect('checkout/cart');
|
35 |
+
return;
|
36 |
+
}
|
37 |
+
|
38 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($session->getLastRealOrderId());
|
39 |
+
$this->getResponse()->setBody($this->getLayout()->createBlock('aplazame/payment_redirect')->toHtml());
|
40 |
+
|
41 |
+
$session->unsQuoteId();
|
42 |
+
$session->unsRedirectUrl();
|
43 |
+
}
|
44 |
+
|
45 |
+
|
46 |
+
public function confirmAction()
|
47 |
+
{
|
48 |
+
|
49 |
+
$session = $this->_getCheckoutSession();
|
50 |
+
$checkout_token = $this->getRequest()->getParam("order_id");
|
51 |
+
|
52 |
+
if (!$checkout_token)
|
53 |
+
{
|
54 |
+
Mage::throwException($this->__('Confirm has no checkout token.'));
|
55 |
+
}
|
56 |
+
|
57 |
+
|
58 |
+
if ($session->getLastRealOrderId()) {
|
59 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($session->getLastRealOrderId());
|
60 |
+
$order->getPayment()->getMethodInstance()->processConfirmOrder($order, $checkout_token);
|
61 |
+
|
62 |
+
// TODO: add a boolean configuration option
|
63 |
+
$order->sendNewOrderEmail();
|
64 |
+
// $this->_redirect('checkout/onepage/success');
|
65 |
+
return;
|
66 |
+
}
|
67 |
+
// $this->_redirect('checkout/onepage');
|
68 |
+
}
|
69 |
+
|
70 |
+
public function cancelAction()
|
71 |
+
{
|
72 |
+
$session = $this->_getCheckoutSession();
|
73 |
+
$orderId = $session->getLastRealOrderId();
|
74 |
+
|
75 |
+
if($orderId)
|
76 |
+
{
|
77 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($orderId);
|
78 |
+
if ($order->getId()) {
|
79 |
+
Mage::helper('aplazame/cart')->resuscitateCartFromOrder($order);
|
80 |
+
}
|
81 |
+
}
|
82 |
+
|
83 |
+
$this->_redirect('checkout/onepage');
|
84 |
+
}
|
85 |
+
|
86 |
+
public function historyAction()
|
87 |
+
{
|
88 |
+
$checkout_token = $this->getRequest()->getParam("checkout_token");
|
89 |
+
|
90 |
+
if (!$checkout_token)
|
91 |
+
{
|
92 |
+
Mage::throwException($this->__('History has no checkout token.'));
|
93 |
+
}
|
94 |
+
|
95 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($checkout_token);
|
96 |
+
$payment = $order->getPayment()->getMethodInstance();
|
97 |
+
$code = Aplazame_Aplazame_Model_Payment::METHOD_CODE;
|
98 |
+
|
99 |
+
if (!$payment or $code !== $payment->getCode()) {
|
100 |
+
Mage::throwException($this->__('Order not found.'));
|
101 |
+
}
|
102 |
+
|
103 |
+
if ($this->_getAccessToken() !== $payment->getConfigData('secret_api_key')) {
|
104 |
+
Mage::throwException($this->__('You don\'t have permissions.'));
|
105 |
+
}
|
106 |
+
|
107 |
+
$result = $payment->processHistory($order, $checkout_token);
|
108 |
+
|
109 |
+
$this->getResponse()->setHeader('Content-type', 'application/json');
|
110 |
+
$this->getResponse()->setBody($result);
|
111 |
+
}
|
112 |
+
}
|
app/code/community/Aplazame/Aplazame/etc/config.xml
ADDED
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Aplazame_Aplazame>
|
5 |
+
<version>0.1.0</version>
|
6 |
+
<build></build>
|
7 |
+
</Aplazame_Aplazame>
|
8 |
+
</modules>
|
9 |
+
<global>
|
10 |
+
<models>
|
11 |
+
<aplazame>
|
12 |
+
<class>Aplazame_Aplazame_Model</class>
|
13 |
+
</aplazame>
|
14 |
+
</models>
|
15 |
+
<blocks>
|
16 |
+
<aplazame>
|
17 |
+
<class>Aplazame_Aplazame_Block</class>
|
18 |
+
</aplazame>
|
19 |
+
<checkout>
|
20 |
+
<rewrite>
|
21 |
+
<onepage_billing>Aplazame_Aplazame_Block_Checkout_Onepage_Billing</onepage_billing>
|
22 |
+
<onepage_shipping>Aplazame_Aplazame_Block_Checkout_Onepage_Shipping</onepage_shipping>
|
23 |
+
</rewrite>
|
24 |
+
</checkout>
|
25 |
+
</blocks>
|
26 |
+
<helpers>
|
27 |
+
<aplazame>
|
28 |
+
<class>Aplazame_Aplazame_Helper</class>
|
29 |
+
</aplazame>
|
30 |
+
</helpers>
|
31 |
+
</global>
|
32 |
+
<adminhtml>
|
33 |
+
<events>
|
34 |
+
<sales_order_place_after>
|
35 |
+
<observers>
|
36 |
+
<Aplazame>
|
37 |
+
<type>singleton</type>
|
38 |
+
<class>aplazame/observer</class>
|
39 |
+
<method>salesOrderPlaceAfter</method>
|
40 |
+
</Aplazame>
|
41 |
+
</observers>
|
42 |
+
</sales_order_place_after>
|
43 |
+
<sales_order_load_after>
|
44 |
+
<observers>
|
45 |
+
<Aplazame>
|
46 |
+
<type>singleton</type>
|
47 |
+
<class>aplazame/observer</class>
|
48 |
+
<method>salesOrderLoadAfter</method>
|
49 |
+
</Aplazame>
|
50 |
+
</observers>
|
51 |
+
</sales_order_load_after>
|
52 |
+
<order_cancel_after>
|
53 |
+
<observers>
|
54 |
+
<Aplazame>
|
55 |
+
<type>singleton</type>
|
56 |
+
<class>aplazame/observer</class>
|
57 |
+
<method>salesOrderPaymentCancel</method>
|
58 |
+
</Aplazame>
|
59 |
+
</observers>
|
60 |
+
</order_cancel_after>
|
61 |
+
</events>
|
62 |
+
</adminhtml>
|
63 |
+
|
64 |
+
<frontend>
|
65 |
+
<routers>
|
66 |
+
<aplazame>
|
67 |
+
<use>standard</use>
|
68 |
+
<args>
|
69 |
+
<module>Aplazame_Aplazame</module>
|
70 |
+
<frontName>aplazame</frontName>
|
71 |
+
</args>
|
72 |
+
</aplazame>
|
73 |
+
</routers>
|
74 |
+
|
75 |
+
<layout>
|
76 |
+
<updates>
|
77 |
+
<aplazame>
|
78 |
+
<file>aplazame.xml</file>
|
79 |
+
</aplazame>
|
80 |
+
</updates>
|
81 |
+
</layout>
|
82 |
+
|
83 |
+
</frontend>
|
84 |
+
<default>
|
85 |
+
<payment>
|
86 |
+
<aplazame>
|
87 |
+
<active>0</active>
|
88 |
+
<sandbox>1</sandbox>
|
89 |
+
<model>aplazame/payment</model>
|
90 |
+
<title>Aplazame</title>
|
91 |
+
<host>https://aplazame.com</host>
|
92 |
+
<version>v1.2</version>
|
93 |
+
<button_id>p_method_aplazame</button_id>
|
94 |
+
<button_img>white-148x46</button_img>
|
95 |
+
<sort_order>1</sort_order>
|
96 |
+
<secret_api_key backend_model="adminhtml/system_config_backend_encrypted"/>
|
97 |
+
</aplazame>
|
98 |
+
</payment>
|
99 |
+
</default>
|
100 |
+
|
101 |
+
</config>
|
app/code/community/Aplazame/Aplazame/etc/system.xml
ADDED
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<sections>
|
4 |
+
<payment>
|
5 |
+
<groups>
|
6 |
+
<aplazame translate="label" module="aplazame">
|
7 |
+
<label>Aplazame</label>
|
8 |
+
<frontend_type>text</frontend_type>
|
9 |
+
<sort_order>10</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 |
+
<expanded>1</expanded>
|
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>10</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 |
+
<sandbox translate="label">
|
25 |
+
<label>Sandbox</label>
|
26 |
+
<frontend_type>select</frontend_type>
|
27 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
28 |
+
<sort_order>20</sort_order>
|
29 |
+
<show_in_default>1</show_in_default>
|
30 |
+
<show_in_website>1</show_in_website>
|
31 |
+
<show_in_store>1</show_in_store>
|
32 |
+
</sandbox>
|
33 |
+
<host translate="label">
|
34 |
+
<label>Host</label>
|
35 |
+
<frontend_type>text</frontend_type>
|
36 |
+
<sort_order>30</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 |
+
</host>
|
41 |
+
<version translate="label">
|
42 |
+
<label>API Version</label>
|
43 |
+
<frontend_type>text</frontend_type>
|
44 |
+
<sort_order>40</sort_order>
|
45 |
+
<show_in_default>1</show_in_default>
|
46 |
+
<show_in_website>1</show_in_website>
|
47 |
+
<show_in_store>1</show_in_store>
|
48 |
+
</version>
|
49 |
+
<button_id>
|
50 |
+
<label>Button ID</label>
|
51 |
+
<frontend_type>text</frontend_type>
|
52 |
+
<sort_order>50</sort_order>
|
53 |
+
<show_in_default>1</show_in_default>
|
54 |
+
<show_in_website>1</show_in_website>
|
55 |
+
<show_in_store>1</show_in_store>
|
56 |
+
</button_id>
|
57 |
+
<button_img>
|
58 |
+
<label>Button Image</label>
|
59 |
+
<frontend_type>text</frontend_type>
|
60 |
+
<sort_order>60</sort_order>
|
61 |
+
<show_in_default>1</show_in_default>
|
62 |
+
<show_in_website>1</show_in_website>
|
63 |
+
<show_in_store>1</show_in_store>
|
64 |
+
</button_img>
|
65 |
+
<sort_order translate="label">
|
66 |
+
<label>Position</label>
|
67 |
+
<frontend_type>text</frontend_type>
|
68 |
+
<sort_order>70</sort_order>
|
69 |
+
<show_in_default>1</show_in_default>
|
70 |
+
<show_in_website>1</show_in_website>
|
71 |
+
<show_in_store>1</show_in_store>
|
72 |
+
<frontend_class>validate-number</frontend_class>
|
73 |
+
</sort_order>
|
74 |
+
<secret_api_key translate="label">
|
75 |
+
<label>Secret Api Key</label>
|
76 |
+
<frontend_type>obscure</frontend_type>
|
77 |
+
<backend_model>adminhtml/system_config_backend_encrypted</backend_model>
|
78 |
+
<sort_order>80</sort_order>
|
79 |
+
<show_in_default>1</show_in_default>
|
80 |
+
<show_in_website>1</show_in_website>
|
81 |
+
<show_in_store>1</show_in_store>
|
82 |
+
</secret_api_key>
|
83 |
+
<public_api_key translate="label">
|
84 |
+
<label>Public Api Key</label>
|
85 |
+
<frontend_type>text</frontend_type>
|
86 |
+
<sort_order>90</sort_order>
|
87 |
+
<show_in_default>1</show_in_default>
|
88 |
+
<show_in_website>1</show_in_website>
|
89 |
+
<show_in_store>1</show_in_store>
|
90 |
+
</public_api_key>
|
91 |
+
</fields>
|
92 |
+
</aplazame>
|
93 |
+
</groups>
|
94 |
+
</payment>
|
95 |
+
</sections>
|
96 |
+
</config>
|
app/design/frontend/base/default/layout/aplazame.xml
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<layout version="0.1.0">
|
2 |
+
<default>
|
3 |
+
<reference name="head" before="-">
|
4 |
+
<block type="page/html" name="aplazame_common" as="aplazame_common" template="aplazame/payment/common.phtml" />
|
5 |
+
</reference>
|
6 |
+
</default>
|
7 |
+
</layout>
|
app/design/frontend/base/default/template/aplazame/payment/common.phtml
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<script
|
2 |
+
type="text/javascript"
|
3 |
+
src="<?php echo trim(Mage::getStoreConfig('payment/aplazame/host'), "/") . '/static/aplazame.min.js' ?>"
|
4 |
+
data-aplazame="publicKey: <?php echo Mage::getStoreConfig('payment/aplazame/public_api_key') ?>"
|
5 |
+
data-version="<?php echo Mage::getStoreConfig('payment/aplazame/version') ?>"
|
6 |
+
data-sandbox="<?php echo Mage::getStoreConfig('payment/aplazame/sandbox')?'true':'false' ?>"
|
7 |
+
data-analytics="<?php echo ((!mageFindClassFile('Mage_Core_Helper_Cookie')) || (!Mage::helper('core/cookie')->isUserNotAllowSaveCookie()))?'true':'false' ?>"></script>
|
app/design/frontend/base/default/template/aplazame/payment/form.phtml
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<fieldset class="form-list">
|
2 |
+
<?php $_code=$this->getMethodCode() ?>
|
3 |
+
</fieldset>
|
4 |
+
|
5 |
+
<div data-aplazame-payment-info="">
|
6 |
+
<div id="payment_form_<?php echo $_code ?>" style="display:none;">
|
7 |
+
<p class="aplazame_title" style="padding-left: 20px; padding-top: 8px;">
|
8 |
+
Aplaza o fracciona tu compra con <a href="https://aplazame.com" target="_blank">Aplazame</a>.<br>
|
9 |
+
Obtén financiación al instante sólo con tu Nombre y Apellidos, DNI/NIE, Teléfono y tarjeta de débito o crédito.<br>
|
10 |
+
Sin comisiones ocultas ni letra pequeña.<br>
|
11 |
+
</p>
|
12 |
+
</div>
|
13 |
+
</div>
|
14 |
+
|
15 |
+
<script>
|
16 |
+
aplazame.button({
|
17 |
+
id: "<?php echo Mage::getStoreConfig('payment/aplazame/button_id') ?>",
|
18 |
+
amount: <?php echo $this->getTotal() ?>,
|
19 |
+
currency: "EUR",
|
20 |
+
parent: "*"
|
21 |
+
// country: "ES"
|
22 |
+
});
|
23 |
+
</script>
|
app/etc/modules/Aplazame_Aplazame.xml
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Aplazame_Aplazame>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
</Aplazame_Aplazame>
|
8 |
+
</modules>
|
9 |
+
</config>
|
10 |
+
|
lib/Aplazame/Aplazame.php
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// Utilities
|
4 |
+
require(dirname(__FILE__) . '/Aplazame/Util.php');
|
5 |
+
|
6 |
+
|
lib/Aplazame/Aplazame/Util.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Aplazame_Util {
|
4 |
+
|
5 |
+
public static function formatDecimals($amount = 0) {
|
6 |
+
$negative = false;
|
7 |
+
$str = sprintf("%.2f", $amount);
|
8 |
+
|
9 |
+
if (strcmp($str[0], "-") === 0) {
|
10 |
+
$str = substr($str, 1);
|
11 |
+
$negative = true;
|
12 |
+
}
|
13 |
+
|
14 |
+
$parts = explode(".", $str, 2);
|
15 |
+
if ($parts === false) {
|
16 |
+
return 0;
|
17 |
+
}
|
18 |
+
|
19 |
+
if (empty($parts)) {
|
20 |
+
return 0;
|
21 |
+
}
|
22 |
+
|
23 |
+
if (strcmp($parts[0], 0) === 0 && strcmp($parts[1], "00") === 0) {
|
24 |
+
return 0;
|
25 |
+
}
|
26 |
+
|
27 |
+
$retVal = "";
|
28 |
+
if ($negative) {
|
29 |
+
$retVal .= "-";
|
30 |
+
}
|
31 |
+
$retVal .= ltrim( $parts[0] . substr($parts[1], 0, 2), "0");
|
32 |
+
return intval($retVal);
|
33 |
+
}
|
34 |
+
|
35 |
+
}
|
package.xml
CHANGED
@@ -1,18 +1,22 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Aplazame_Aplazame</name>
|
4 |
-
<version>0.1.0</version>
|
5 |
<stability>stable</stability>
|
6 |
<license/>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
-
<summary>Aplazame, a consumer credit
|
10 |
-
<description>Aplazame, a consumer credit company, offers a payment system that can be used by online buyers to receive funding for their purchases
|
|
|
|
|
|
|
|
|
11 |
<notes>Birth</notes>
|
12 |
<authors><author><name>Daniel</name><user>auto-converted</user><email>dani@aplazame.com</email></author><author><name>Oscar</name><user>auto-converted</user><email>oreales@gmail.com</email></author></authors>
|
13 |
-
<date>2015-08-
|
14 |
-
<time>
|
15 |
-
<contents><target name="mageetc"><dir name="modules"><dir name="Aplazame"><dir name="Aplazame"><dir name="etc"><file name="config.xml" hash=""/></dir></dir></dir></dir></target></contents>
|
16 |
<compatible/>
|
17 |
<dependencies/>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Aplazame_Aplazame</name>
|
4 |
+
<version>0.1.0.1</version>
|
5 |
<stability>stable</stability>
|
6 |
<license/>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
+
<summary>Accept payments in Magento using the Aplazame Payment Gateway, a consumer credit service.</summary>
|
10 |
+
<description>Aplazame, a consumer credit company, offers a payment system that can be used by online buyers to receive funding for their purchases.
|
11 |
+

|
12 |
+
The module allows the customer to defer the payment of his online purchases in ecommerces offering Aplazame as a payment method.
|
13 |
+

|
14 |
+
Aplazame's mission is to increase sales of any online store eliminating any friction in the process.</description>
|
15 |
<notes>Birth</notes>
|
16 |
<authors><author><name>Daniel</name><user>auto-converted</user><email>dani@aplazame.com</email></author><author><name>Oscar</name><user>auto-converted</user><email>oreales@gmail.com</email></author></authors>
|
17 |
+
<date>2015-08-30</date>
|
18 |
+
<time>21:44:06</time>
|
19 |
+
<contents><target name="mageetc"><dir name="modules"><file name="Aplazame_Aplazame.xml" hash="8c6efc3c3906595d577d6952388110a1"/></dir></target><target name="magecommunity"><dir name="Aplazame"><dir name="Aplazame"><dir name="Block"><dir name="Checkout"><dir name="Onepage"><file name="Billing.php" hash="8f6fb00193c844dcf57802f3250e5983"/><file name="Shipping.php" hash="93ee90494a8addb58ae9a3242b44bf5e"/></dir></dir><dir name="Payment"><file name="Form.php" hash="996b6db7b3ac7d9e8b4858dca73802e1"/><file name="Info.php" hash="2e7b83e3cff16c8f813b834a239995ef"/><file name="Redirect.php" hash="9cbc88587076d51f187d0ad546258768"/></dir></dir><dir name="Helper"><file name="Cart.php" hash="85d4cfc9d435efe5f9ddc282e2245179"/><file name="Data.php" hash="eea913840306dfe78841ce22619c3175"/></dir><dir name="Model"><dir name="Api"><file name="Client.php" hash="3e0931300c2ee120f2f06cf33d39a432"/><file name="Serializers.php" hash="e14418bb9b1b4b6602c75b11e11ffe43"/></dir><file name="Config.php" hash="67254d968ff5a0a95c73484cc13efb33"/><file name="Observer.php" hash="28833b6f1f734c1bc0997a4006194bc7"/><file name="Payment.php" hash="8377767ab84c20a51e8cc13f76ad6a1f"/></dir><dir name="controllers"><file name="PaymentController.php" hash="56f3d45f6bfc8d812ff3d7b0e3cf6aed"/></dir><dir name="etc"><file name="config.xml" hash="b73bc9cb00f0ee1bacc692538bd1252c"/><file name="system.xml" hash="0107f888479fc9c099bea94d1084769a"/></dir></dir></dir></target><target name="magelib"><dir name="Aplazame"><dir name="Aplazame"><file name="Util.php" hash="8252beb4d098d2392b5e0bbf2ff7a907"/></dir><file name="Aplazame.php" hash="a7214383b6bf6953acde3153500f76b8"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="aplazame.xml" hash="d8b52c7c03ae464c9ac184d14985b50f"/></dir><dir name="template"><dir name="aplazame"><dir name="payment"><file name="common.phtml" hash="cdcc83ab18a52dff8c588fadb06c3c51"/><file name="form.phtml" hash="c700205046c076b13dd6be2503b6c398"/></dir></dir></dir></dir></dir></dir></target></contents>
|
20 |
<compatible/>
|
21 |
<dependencies/>
|
22 |
</package>
|