Version Notes
Stable Version
Download this release
Release Info
Developer | Apruve |
Extension | Apruve_B2B_Payment_Gateway |
Version | 1.0.13 |
Comparing to | |
See all releases |
Code changes from version 1.0.12 to 1.0.13
- app/code/community/Apruve/ApruvePayment/Helper/Data.php +4 -18
- app/code/community/Apruve/ApruvePayment/Model/Api/Abstract.php +160 -8
- app/code/community/Apruve/ApruvePayment/Model/Api/Payment.php +98 -0
- app/code/community/Apruve/ApruvePayment/Model/Api/PaymentRequest.php +69 -133
- app/code/community/Apruve/ApruvePayment/Model/Api/Rest.php +59 -25
- app/code/community/Apruve/ApruvePayment/Model/Observer.php +24 -0
- app/code/community/Apruve/ApruvePayment/Model/PaymentMethod.php +6 -11
- app/code/community/Apruve/ApruvePayment/etc/config.xml +12 -1
- package.xml +4 -4
app/code/community/Apruve/ApruvePayment/Helper/Data.php
CHANGED
@@ -25,7 +25,10 @@ class Apruve_ApruvePayment_Helper_Data extends Mage_Core_Helper_Abstract
|
|
25 |
*/
|
26 |
public function getPaymentRequestApiModel()
|
27 |
{
|
28 |
-
return Mage::getModel(
|
|
|
|
|
|
|
29 |
}
|
30 |
|
31 |
public function getMode()
|
@@ -46,21 +49,4 @@ class Apruve_ApruvePayment_Helper_Data extends Mage_Core_Helper_Abstract
|
|
46 |
$sourceArray = $sourceModel->toSrcArray();
|
47 |
return $sourceArray[Mage::getStoreConfig('payment/apruvepayment/mode')];
|
48 |
}
|
49 |
-
|
50 |
-
/**
|
51 |
-
* @param Mage_Sales_Model_Quote $quote
|
52 |
-
*/
|
53 |
-
public function getAmountsFromQuote($quote)
|
54 |
-
{
|
55 |
-
$result['amount_cents'] = $quote->getGrandTotal();
|
56 |
-
$result['tax_cents'] = 0;
|
57 |
-
$result['shipping_cents'] = 0;
|
58 |
-
foreach ($quote->getAllAddresses() as $address) {
|
59 |
-
/** @var Mage_Sales_Model_Quote_Address $address */
|
60 |
-
$result['tax_cents'] += $address->getTaxAmount();
|
61 |
-
$result['shipping_cents'] += $address->getShippingAmount();
|
62 |
-
}
|
63 |
-
|
64 |
-
return $result;
|
65 |
-
}
|
66 |
}
|
25 |
*/
|
26 |
public function getPaymentRequestApiModel()
|
27 |
{
|
28 |
+
return Mage::getModel(
|
29 |
+
'apruvepayment/api_paymentRequest',
|
30 |
+
Mage::getSingleton('checkout/session')->getQuote()
|
31 |
+
);
|
32 |
}
|
33 |
|
34 |
public function getMode()
|
49 |
$sourceArray = $sourceModel->toSrcArray();
|
50 |
return $sourceArray[Mage::getStoreConfig('payment/apruvepayment/mode')];
|
51 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
}
|
app/code/community/Apruve/ApruvePayment/Model/Api/Abstract.php
CHANGED
@@ -32,11 +32,11 @@ abstract class Apruve_ApruvePayment_Model_Api_Abstract
|
|
32 |
* Generate headers for rest request
|
33 |
* @return array
|
34 |
*/
|
35 |
-
protected function
|
36 |
{
|
37 |
return array(
|
38 |
'Content-type: application/json',
|
39 |
-
'Apruve-Api-Key: ' . $this->
|
40 |
);
|
41 |
}
|
42 |
|
@@ -44,7 +44,7 @@ abstract class Apruve_ApruvePayment_Model_Api_Abstract
|
|
44 |
* Get Merchant key from module configuration
|
45 |
* @return string|null
|
46 |
*/
|
47 |
-
protected function
|
48 |
{
|
49 |
$id = Mage::getStoreConfig('payment/apruvepayment/merchant');
|
50 |
return $id ? $id : null;
|
@@ -54,7 +54,7 @@ abstract class Apruve_ApruvePayment_Model_Api_Abstract
|
|
54 |
* Get Api key from module configuration
|
55 |
* @return string|null
|
56 |
*/
|
57 |
-
protected function
|
58 |
{
|
59 |
$api = Mage::getStoreConfig('payment/apruvepayment/api');
|
60 |
return $api ? $api : null;
|
@@ -66,7 +66,7 @@ abstract class Apruve_ApruvePayment_Model_Api_Abstract
|
|
66 |
* Check whether payment works in test mode
|
67 |
* @return bool
|
68 |
*/
|
69 |
-
protected function
|
70 |
{
|
71 |
return Mage::getStoreConfig('payment/apruvepayment/mode');
|
72 |
}
|
@@ -80,7 +80,7 @@ abstract class Apruve_ApruvePayment_Model_Api_Abstract
|
|
80 |
public function getBaseUrl($secure = false)
|
81 |
{
|
82 |
$http = $secure ? 'https://' : 'http://';
|
83 |
-
if($this->
|
84 |
return $http.'test.apruve.com/';
|
85 |
} else {
|
86 |
return $http.'www.apruve.com/';
|
@@ -92,7 +92,7 @@ abstract class Apruve_ApruvePayment_Model_Api_Abstract
|
|
92 |
* Get api url part based on version
|
93 |
* @return string
|
94 |
*/
|
95 |
-
protected function
|
96 |
{
|
97 |
return 'api/'.$this->_version.'/';
|
98 |
}
|
@@ -104,9 +104,161 @@ abstract class Apruve_ApruvePayment_Model_Api_Abstract
|
|
104 |
* @param float $price
|
105 |
* @return float
|
106 |
*/
|
107 |
-
protected function
|
108 |
{
|
109 |
return $price * 100;
|
110 |
}
|
111 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
}
|
32 |
* Generate headers for rest request
|
33 |
* @return array
|
34 |
*/
|
35 |
+
protected function getHeaders()
|
36 |
{
|
37 |
return array(
|
38 |
'Content-type: application/json',
|
39 |
+
'Apruve-Api-Key: ' . $this->getApiKey(),
|
40 |
);
|
41 |
}
|
42 |
|
44 |
* Get Merchant key from module configuration
|
45 |
* @return string|null
|
46 |
*/
|
47 |
+
protected function getMerchantKey()
|
48 |
{
|
49 |
$id = Mage::getStoreConfig('payment/apruvepayment/merchant');
|
50 |
return $id ? $id : null;
|
54 |
* Get Api key from module configuration
|
55 |
* @return string|null
|
56 |
*/
|
57 |
+
protected function getApiKey()
|
58 |
{
|
59 |
$api = Mage::getStoreConfig('payment/apruvepayment/api');
|
60 |
return $api ? $api : null;
|
66 |
* Check whether payment works in test mode
|
67 |
* @return bool
|
68 |
*/
|
69 |
+
protected function getIsTestMode()
|
70 |
{
|
71 |
return Mage::getStoreConfig('payment/apruvepayment/mode');
|
72 |
}
|
80 |
public function getBaseUrl($secure = false)
|
81 |
{
|
82 |
$http = $secure ? 'https://' : 'http://';
|
83 |
+
if($this->getIsTestMode()) {
|
84 |
return $http.'test.apruve.com/';
|
85 |
} else {
|
86 |
return $http.'www.apruve.com/';
|
92 |
* Get api url part based on version
|
93 |
* @return string
|
94 |
*/
|
95 |
+
protected function getApiUrl()
|
96 |
{
|
97 |
return 'api/'.$this->_version.'/';
|
98 |
}
|
104 |
* @param float $price
|
105 |
* @return float
|
106 |
*/
|
107 |
+
protected function convertPrice($price)
|
108 |
{
|
109 |
return $price * 100;
|
110 |
}
|
111 |
|
112 |
+
/**
|
113 |
+
* @return Apruve_ApruvePayment_Helper_Data
|
114 |
+
*/
|
115 |
+
protected function getHelper()
|
116 |
+
{
|
117 |
+
return Mage::helper('apruvepayment');
|
118 |
+
}
|
119 |
+
|
120 |
+
|
121 |
+
/**
|
122 |
+
* Get Product short description
|
123 |
+
* @param Mage_Sales_Model_Quote_Item | Mage_Sales_Model_Order_Item $item
|
124 |
+
* @return string
|
125 |
+
*/
|
126 |
+
protected function getShortDescription($item)
|
127 |
+
{
|
128 |
+
$shortDescription = $item->getProduct()->getShortDescription();
|
129 |
+
|
130 |
+
|
131 |
+
if (isset($shortDescription) && strlen($shortDescription) > 3500) {
|
132 |
+
$shortDescription = substr($shortDescription, 0, 3500);
|
133 |
+
}
|
134 |
+
|
135 |
+
return $shortDescription;
|
136 |
+
}
|
137 |
+
/**
|
138 |
+
* Get Product configuration if exits
|
139 |
+
* @param Mage_Sales_Model_Quote_Item | Mage_Sales_Model_Order_Item $item
|
140 |
+
* @return string
|
141 |
+
*/
|
142 |
+
protected function getVariantInfo($item)
|
143 |
+
{
|
144 |
+
$result = '';
|
145 |
+
$variantInfo = array();
|
146 |
+
$options = $item->getProduct()->getTypeInstance(true)->getOrderOptions($item->getProduct());
|
147 |
+
if (isset($options['options'])) {
|
148 |
+
$opt = $this->getProductCustomOptions($options['options']);
|
149 |
+
$variantInfo = array_merge($variantInfo, $opt);
|
150 |
+
}
|
151 |
+
if (isset($options['attributes_info'])) {
|
152 |
+
$opt = $this->getConfigurableOptions($options['attributes_info']);
|
153 |
+
$variantInfo = array_merge($variantInfo, $opt);
|
154 |
+
}
|
155 |
+
|
156 |
+
if (isset($options['bundle_options'])) {
|
157 |
+
$opt = $this->getBundleOptions($options['bundle_options']);
|
158 |
+
$variantInfo = array_merge($variantInfo, $opt);
|
159 |
+
}
|
160 |
+
|
161 |
+
if (!empty($variantInfo)) {
|
162 |
+
$result = $this->getFormatedVariantInfo($variantInfo);
|
163 |
+
}
|
164 |
+
|
165 |
+
return $result;
|
166 |
+
}
|
167 |
+
|
168 |
+
/**
|
169 |
+
* @param array $options
|
170 |
+
* @return array
|
171 |
+
*/
|
172 |
+
protected function getProductCustomOptions($options)
|
173 |
+
{
|
174 |
+
$arr = array();
|
175 |
+
foreach ($options as $option) {
|
176 |
+
$arr[] = $option['label'] . ': ' . $option['value'];
|
177 |
+
}
|
178 |
+
|
179 |
+
return $arr;
|
180 |
+
}
|
181 |
+
|
182 |
+
/**
|
183 |
+
* @param array $attributesInfo
|
184 |
+
* @return array
|
185 |
+
*/
|
186 |
+
protected function getConfigurableOptions($attributesInfo)
|
187 |
+
{
|
188 |
+
$arr = array();
|
189 |
+
foreach ($attributesInfo as $option) {
|
190 |
+
$arr[] = $option['label'] . ': ' . $option['value'];
|
191 |
+
}
|
192 |
+
return $arr;
|
193 |
+
}
|
194 |
+
|
195 |
+
/**
|
196 |
+
* @param array $bundleOptions
|
197 |
+
* @return array
|
198 |
+
*/
|
199 |
+
protected function getBundleOptions($bundleOptions)
|
200 |
+
{
|
201 |
+
$arr = array();
|
202 |
+
foreach ($bundleOptions as $option) {
|
203 |
+
$arr[] = $option['label'] . ': ' . $option['value'][0]['title'];
|
204 |
+
}
|
205 |
+
return $arr;
|
206 |
+
}
|
207 |
+
|
208 |
+
/**
|
209 |
+
* Concatenate all options to string
|
210 |
+
* @param array $arr
|
211 |
+
* @return string
|
212 |
+
*/
|
213 |
+
//todo: new line symbol
|
214 |
+
protected function getFormatedVariantInfo($arr)
|
215 |
+
{
|
216 |
+
if (count($arr) == 1) {
|
217 |
+
$result = $arr[0];
|
218 |
+
} else {
|
219 |
+
$result = implode(', ', $arr);
|
220 |
+
}
|
221 |
+
|
222 |
+
if (isset($result) && strlen($result) > 255) {
|
223 |
+
$result = substr($result, 0, 255);
|
224 |
+
}
|
225 |
+
|
226 |
+
return $result;
|
227 |
+
}
|
228 |
+
|
229 |
+
|
230 |
+
|
231 |
+
/**
|
232 |
+
* @param Mage_Sales_Model_Quote $quote
|
233 |
+
* @return float[]
|
234 |
+
*/
|
235 |
+
public function getAmountsFromQuote($quote)
|
236 |
+
{
|
237 |
+
$result['amount_cents'] = $quote->getGrandTotal();
|
238 |
+
$result['tax_cents'] = 0;
|
239 |
+
$result['shipping_cents'] = 0;
|
240 |
+
foreach ($quote->getAllAddresses() as $address) {
|
241 |
+
/** @var Mage_Sales_Model_Quote_Address $address */
|
242 |
+
$result['tax_cents'] += $address->getTaxAmount();
|
243 |
+
$result['shipping_cents'] += $address->getShippingAmount();
|
244 |
+
}
|
245 |
+
|
246 |
+
return $result;
|
247 |
+
}
|
248 |
+
|
249 |
+
/**
|
250 |
+
* @param Mage_Sales_Model_Order $order
|
251 |
+
* @return float[]
|
252 |
+
*/
|
253 |
+
public function getAmountsFromOrder($order)
|
254 |
+
{
|
255 |
+
$result['amount_cents'] = $order->getGrandTotal();
|
256 |
+
$result['tax_cents'] = $order->getTaxAmount();
|
257 |
+
$result['shipping_cents'] = $order->getShippingAmount();
|
258 |
+
|
259 |
+
return $result;
|
260 |
+
}
|
261 |
+
|
262 |
+
|
263 |
+
|
264 |
}
|
app/code/community/Apruve/ApruvePayment/Model/Api/Payment.php
ADDED
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Apache License, Version 2.0
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/Apache-2.0
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@apruve.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* @category Apruve
|
17 |
+
* @package Apruve_Payment
|
18 |
+
* @copyright Copyright (coffee) 2014 Apruve, Inc. (http://www.apruve.com).
|
19 |
+
* @license http://opensource.org/licenses/Apache-2.0 Apache License, Version 2.0
|
20 |
+
*/
|
21 |
+
|
22 |
+
|
23 |
+
class Apruve_ApruvePayment_Model_Api_Payment extends Apruve_ApruvePayment_Model_Api_Abstract
|
24 |
+
{
|
25 |
+
/** @var Mage_Sales_Model_Order */
|
26 |
+
private $order;
|
27 |
+
|
28 |
+
/** @var Mage_Sales_Model_Quote */
|
29 |
+
private $quote;
|
30 |
+
|
31 |
+
private $amounts;
|
32 |
+
|
33 |
+
function __construct(Mage_Sales_Model_Order $order)
|
34 |
+
{
|
35 |
+
$this->order = $order;
|
36 |
+
$this->quote = $order->getQuote();
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Return amount_cents, shipping_cents or tax_cents
|
41 |
+
* @param $key
|
42 |
+
* @return float | bool
|
43 |
+
*/
|
44 |
+
public function getAmount($key)
|
45 |
+
{
|
46 |
+
if (empty($this->amounts)) {
|
47 |
+
$this->amounts = $this->getAmountsFromOrder($this->order);
|
48 |
+
}
|
49 |
+
|
50 |
+
if (isset($this->amounts[$key])) {
|
51 |
+
return $this->amounts[$key];
|
52 |
+
}
|
53 |
+
|
54 |
+
return false;
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Generate payment request by given order
|
59 |
+
*
|
60 |
+
* @return array
|
61 |
+
*/
|
62 |
+
public function getPayment()
|
63 |
+
{
|
64 |
+
return array(
|
65 |
+
'amount_cents' => $this->convertPrice($this->getAmount('amount_cents')),
|
66 |
+
'payment_items' => $this->getLineItems($this->order),
|
67 |
+
'issue_on_create' => !$this->quote->getIsMultiShipping()
|
68 |
+
);
|
69 |
+
}
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Build Line items array
|
73 |
+
* @param Mage_Sales_Model_Order $itemsParent
|
74 |
+
* @return array
|
75 |
+
*/
|
76 |
+
protected function getLineItems($itemsParent)
|
77 |
+
{
|
78 |
+
$result = array();
|
79 |
+
/** @var Mage_Sales_Model_Order_Item[] $visibleItems */
|
80 |
+
$visibleItems = $itemsParent->getAllVisibleItems();
|
81 |
+
foreach ($visibleItems as $item) {
|
82 |
+
|
83 |
+
$result[] = array(
|
84 |
+
'title' => $item->getName(),
|
85 |
+
'amount_cents' => $this->convertPrice($item->getPrice()) * $item->getQtyOrdered(),
|
86 |
+
'price_ea_cents' => $this->convertPrice($item->getPrice()),
|
87 |
+
'quantity' => $item->getQtyOrdered(),
|
88 |
+
'description' => $this->getShortDescription($item),
|
89 |
+
'variant_info' => $this->getVariantInfo($item),
|
90 |
+
'sku' => $item->getSku(),
|
91 |
+
'view_product_url' => $item->getProduct()->getProductUrl(false),
|
92 |
+
);
|
93 |
+
|
94 |
+
}
|
95 |
+
|
96 |
+
return $result;
|
97 |
+
}
|
98 |
+
}
|
app/code/community/Apruve/ApruvePayment/Model/Api/PaymentRequest.php
CHANGED
@@ -27,6 +27,10 @@
|
|
27 |
*/
|
28 |
class Apruve_ApruvePayment_Model_Api_PaymentRequest extends Apruve_ApruvePayment_Model_Api_Abstract
|
29 |
{
|
|
|
|
|
|
|
|
|
30 |
/**
|
31 |
* Post request general fields
|
32 |
* @var array
|
@@ -64,9 +68,10 @@ class Apruve_ApruvePayment_Model_Api_PaymentRequest extends Apruve_ApruvePayment
|
|
64 |
protected $_paymentRequest;
|
65 |
|
66 |
|
67 |
-
public function __construct()
|
68 |
{
|
69 |
-
$this->
|
|
|
70 |
}
|
71 |
|
72 |
/**
|
@@ -85,7 +90,7 @@ class Apruve_ApruvePayment_Model_Api_PaymentRequest extends Apruve_ApruvePayment
|
|
85 |
*/
|
86 |
public function getSecureHash()
|
87 |
{
|
88 |
-
$concatString = $this->
|
89 |
|
90 |
foreach ($this->_paymentRequest as $val) {
|
91 |
if (!is_array($val)) {
|
@@ -103,169 +108,100 @@ class Apruve_ApruvePayment_Model_Api_PaymentRequest extends Apruve_ApruvePayment
|
|
103 |
return hash('sha256', $concatString);
|
104 |
}
|
105 |
|
106 |
-
|
107 |
/**
|
108 |
-
*
|
109 |
-
* @
|
|
|
110 |
*/
|
111 |
-
|
112 |
{
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
$paymentRequest = array(
|
118 |
-
'merchant_id' => $this->_getMerchantKey(),
|
119 |
-
'amount_cents' => $this->_convertPrice($amounts['amount_cents']),
|
120 |
-
'currency' => 'USD',
|
121 |
-
'tax_cents' => $this->_convertPrice($amounts['tax_cents']),
|
122 |
-
'shipping_cents' => $this->_convertPrice($amounts['shipping_cents']),
|
123 |
-
'line_items' => $this->_getLineItems($quote)
|
124 |
-
);
|
125 |
-
|
126 |
-
return $paymentRequest;
|
127 |
-
}
|
128 |
-
|
129 |
|
130 |
-
|
131 |
-
|
132 |
-
*/
|
133 |
-
public function getShopperInfo($attrName)
|
134 |
-
{
|
135 |
-
$quote = Mage::getSingleton('checkout/session')->getQuote();
|
136 |
-
$method = 'get' . ucfirst($attrName);
|
137 |
-
if ($quote->getCustomerIsGuest()) {
|
138 |
-
return $quote->getBillingAddress()->$method();
|
139 |
}
|
140 |
|
141 |
-
return
|
142 |
}
|
143 |
|
144 |
/**
|
145 |
-
* Build
|
146 |
-
* @param Mage_Sales_Model_Quote $quote
|
147 |
* @return array
|
148 |
*/
|
149 |
-
protected function
|
150 |
{
|
151 |
-
$line_items = array();
|
152 |
-
foreach ($quote->getAllVisibleItems() as $item) {
|
153 |
-
$qty = $item->getQty();
|
154 |
-
$title = $item->getName();
|
155 |
-
$amount_cents = $this->_convertPrice($item->getPrice()) * $qty;
|
156 |
-
$shortDescription = $item->getShortDescription();
|
157 |
-
$variantInfo = $this->_getVariantInfo($item);
|
158 |
-
$viewUrl = $item->getProduct()->getProductUrl(false);
|
159 |
-
$priceEaCents = $this->_convertPrice($item->getPrice());
|
160 |
-
|
161 |
-
if (isset($shortDescription) && strlen($shortDescription) > 3500) {
|
162 |
-
$shortDescription = substr($shortDescription, 0, 3500);
|
163 |
-
}
|
164 |
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
'quantity' => $qty,
|
174 |
-
'description' => isset($shortDescription) ? $shortDescription : '',
|
175 |
-
'variant_info' => $variantInfo ? $variantInfo : '',
|
176 |
-
'view_product_url' => $viewUrl,
|
177 |
-
);
|
178 |
-
|
179 |
-
$line_items[] = $line_item;
|
180 |
-
}
|
181 |
|
182 |
-
return $
|
183 |
}
|
184 |
|
185 |
-
|
186 |
-
/**
|
187 |
-
* Get Product configuration if exits
|
188 |
-
* @param Mage_Sales_Model_Quote_Item $item
|
189 |
-
* @return string
|
190 |
-
*/
|
191 |
-
protected function _getVariantInfo($item)
|
192 |
{
|
193 |
-
$
|
194 |
-
$
|
195 |
-
$
|
196 |
-
if (
|
197 |
-
|
198 |
-
$
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
if (isset($options['bundle_options'])) {
|
206 |
-
$opt = $this->_getBundleOptions($options['bundle_options']);
|
207 |
-
$variantInfo = array_merge($variantInfo, $opt);
|
208 |
-
}
|
209 |
|
210 |
-
|
211 |
-
$result = $this->_getFormatedVariantInfo($variantInfo);
|
212 |
}
|
213 |
-
|
214 |
-
return $result;
|
215 |
}
|
216 |
|
217 |
-
/**
|
218 |
-
* @param array $options
|
219 |
-
* @return array
|
220 |
-
*/
|
221 |
-
protected function _getProductCustomOptions($options)
|
222 |
-
{
|
223 |
-
$arr = array();
|
224 |
-
foreach ($options as $option) {
|
225 |
-
$arr[] = $option['label'] . ': ' . $option['value'];
|
226 |
-
}
|
227 |
-
|
228 |
-
return $arr;
|
229 |
-
}
|
230 |
|
231 |
/**
|
232 |
-
* @param
|
233 |
-
* @return array
|
234 |
*/
|
235 |
-
|
236 |
{
|
237 |
-
$
|
238 |
-
|
239 |
-
|
240 |
}
|
241 |
-
|
|
|
242 |
}
|
243 |
|
244 |
/**
|
245 |
-
*
|
|
|
246 |
* @return array
|
247 |
*/
|
248 |
-
protected function
|
249 |
{
|
250 |
-
$
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
256 |
|
257 |
-
/**
|
258 |
-
* Concatenate all options to string
|
259 |
-
* @param array $arr
|
260 |
-
* @return string
|
261 |
-
*/
|
262 |
-
//todo: new line symbol
|
263 |
-
protected function _getFormatedVariantInfo($arr)
|
264 |
-
{
|
265 |
-
if (count($arr) == 1) {
|
266 |
-
$result = $arr[0];
|
267 |
-
} else {
|
268 |
-
$result = implode(', ', $arr);
|
269 |
}
|
270 |
|
271 |
return $result;
|
27 |
*/
|
28 |
class Apruve_ApruvePayment_Model_Api_PaymentRequest extends Apruve_ApruvePayment_Model_Api_Abstract
|
29 |
{
|
30 |
+
private $quote;
|
31 |
+
|
32 |
+
private $amounts;
|
33 |
+
|
34 |
/**
|
35 |
* Post request general fields
|
36 |
* @var array
|
68 |
protected $_paymentRequest;
|
69 |
|
70 |
|
71 |
+
public function __construct(Mage_Sales_Model_Quote $quote)
|
72 |
{
|
73 |
+
$this->quote = $quote;
|
74 |
+
$this->_paymentRequest = $this->setPaymentRequest();
|
75 |
}
|
76 |
|
77 |
/**
|
90 |
*/
|
91 |
public function getSecureHash()
|
92 |
{
|
93 |
+
$concatString = $this->getApiKey();
|
94 |
|
95 |
foreach ($this->_paymentRequest as $val) {
|
96 |
if (!is_array($val)) {
|
108 |
return hash('sha256', $concatString);
|
109 |
}
|
110 |
|
|
|
111 |
/**
|
112 |
+
* Return amount_cents, shipping_cents or tax_cents
|
113 |
+
* @param $key
|
114 |
+
* @return float | bool
|
115 |
*/
|
116 |
+
public function getAmount($key)
|
117 |
{
|
118 |
+
if (empty($this->amounts)) {
|
119 |
+
$this->amounts = $this->getAmountsFromQuote($this->quote);
|
120 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
|
122 |
+
if (isset($this->amounts[$key])) {
|
123 |
+
return $this->amounts[$key];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
}
|
125 |
|
126 |
+
return false;
|
127 |
}
|
128 |
|
129 |
/**
|
130 |
+
* Build Payment Request Array
|
|
|
131 |
* @return array
|
132 |
*/
|
133 |
+
protected function setPaymentRequest()
|
134 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
|
136 |
+
$paymentRequest = array(
|
137 |
+
'merchant_id' => $this->getMerchantKey(),
|
138 |
+
'amount_cents' => $this->convertPrice($this->getAmount('amount_cents')),
|
139 |
+
'currency' => 'USD',
|
140 |
+
'tax_cents' => $this->convertPrice($this->getAmount('tax_cents')),
|
141 |
+
'shipping_cents' => $this->convertPrice($this->getAmount('shipping_cents')),
|
142 |
+
'line_items' => $this->getLineItems($this->quote)
|
143 |
+
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
144 |
|
145 |
+
return $paymentRequest;
|
146 |
}
|
147 |
|
148 |
+
public function updatePaymentRequest($token, $orderId)
|
|
|
|
|
|
|
|
|
|
|
|
|
149 |
{
|
150 |
+
/** @var Apruve_ApruvePayment_Model_Api_Rest $rest */
|
151 |
+
$rest = Mage::getModel('apruvepayment/api_rest');
|
152 |
+
$pRequest = Mage::registry('apruve_request_updated' . $token);
|
153 |
+
if ($pRequest === null) {
|
154 |
+
|
155 |
+
$pRequest = $rest->updatePaymentRequest(
|
156 |
+
$token,
|
157 |
+
$this->getAmount('amount_cents'),
|
158 |
+
$this->getAmount('shipping_cents'),
|
159 |
+
$this->getAmount('tax_cents'),
|
160 |
+
$orderId
|
161 |
+
);
|
|
|
|
|
|
|
|
|
162 |
|
163 |
+
Mage::register('apruve_request_updated' . $token, $pRequest);
|
|
|
164 |
}
|
165 |
+
return $pRequest;
|
|
|
166 |
}
|
167 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
168 |
|
169 |
/**
|
170 |
+
* @param Mage_Sales_Model_Quote $quote
|
|
|
171 |
*/
|
172 |
+
public function getShopperInfo($attrName)
|
173 |
{
|
174 |
+
$method = 'get' . ucfirst($attrName);
|
175 |
+
if ($this->quote->getCustomerIsGuest()) {
|
176 |
+
return $this->quote->getBillingAddress()->$method();
|
177 |
}
|
178 |
+
|
179 |
+
return $this->quote->getCustomer()->$method();
|
180 |
}
|
181 |
|
182 |
/**
|
183 |
+
* Build Line items array
|
184 |
+
* @param Mage_Sales_Model_Quote $itemsParent
|
185 |
* @return array
|
186 |
*/
|
187 |
+
protected function getLineItems($itemsParent)
|
188 |
{
|
189 |
+
$result = array();
|
190 |
+
/** @var Mage_Sales_Model_Quote_Item[] $visibleItems */
|
191 |
+
$visibleItems = $itemsParent->getAllVisibleItems();
|
192 |
+
foreach ($visibleItems as $item) {
|
193 |
+
|
194 |
+
$result[] = array(
|
195 |
+
'title' => $item->getName(),
|
196 |
+
'amount_cents' => $this->convertPrice($item->getPrice()) * $item->getQty(),
|
197 |
+
'price_ea_cents' => $this->convertPrice($item->getPrice()),
|
198 |
+
'quantity' => $item->getQty(),
|
199 |
+
'description' => $this->getShortDescription($item),
|
200 |
+
'variant_info' => $this->getVariantInfo($item),
|
201 |
+
'sku' => $item->getSku(),
|
202 |
+
'view_product_url' => $item->getProduct()->getProductUrl(false),
|
203 |
+
);
|
204 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
205 |
}
|
206 |
|
207 |
return $result;
|
app/code/community/Apruve/ApruvePayment/Model/Api/Rest.php
CHANGED
@@ -24,30 +24,30 @@
|
|
24 |
*
|
25 |
* Provide rest methods to communicate with apruve
|
26 |
*/
|
27 |
-
|
28 |
class Apruve_ApruvePayment_Model_Api_Rest extends Apruve_ApruvePayment_Model_Api_Abstract
|
29 |
{
|
30 |
/**
|
31 |
* Send Payment object
|
32 |
* @param string $paymentRequestId
|
33 |
-
* @param
|
|
|
34 |
* @return bool
|
35 |
*/
|
36 |
-
public function postPayment($paymentRequestId, $
|
37 |
{
|
38 |
-
$data = json_encode(
|
39 |
|
40 |
-
$c = curl_init($this->
|
41 |
|
42 |
-
curl_setopt($c, CURLOPT_HTTPHEADER, $this->
|
43 |
curl_setopt($c, CURLOPT_POST, true);
|
44 |
-
curl_setopt($c, CURLOPT_RETURNTRANSFER, true
|
45 |
-
curl_setopt($c, CURLOPT_POSTFIELDS, $data
|
46 |
$response = curl_exec($c);
|
47 |
$http_status = curl_getinfo($c, CURLINFO_HTTP_CODE);
|
48 |
curl_close($c);
|
49 |
|
50 |
-
if($http_status == '201') {
|
51 |
return json_decode($response);
|
52 |
} else {
|
53 |
return false;
|
@@ -68,23 +68,49 @@ class Apruve_ApruvePayment_Model_Api_Rest extends Apruve_ApruvePayment_Model_Api
|
|
68 |
{
|
69 |
$data = json_encode(array(
|
70 |
'merchant_order_id' => $orderIncrementId,
|
71 |
-
'amount_cents' => $this->
|
72 |
-
'shipping_cents' => $this->
|
73 |
-
'tax_cents' => $this->
|
74 |
));
|
75 |
|
76 |
-
$c = curl_init($this->
|
77 |
|
78 |
-
curl_setopt($c, CURLOPT_HTTPHEADER, $this->
|
79 |
curl_setopt($c, CURLOPT_CUSTOMREQUEST, "PUT");
|
80 |
-
curl_setopt($c, CURLOPT_RETURNTRANSFER, true
|
81 |
-
curl_setopt($c, CURLOPT_POSTFIELDS, $data
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
$response = curl_exec($c);
|
83 |
$http_status = curl_getinfo($c, CURLINFO_HTTP_CODE);
|
84 |
curl_close($c);
|
85 |
|
86 |
|
87 |
-
if($http_status == '200') {
|
88 |
return json_decode($response);
|
89 |
} else {
|
90 |
return false;
|
@@ -101,12 +127,10 @@ class Apruve_ApruvePayment_Model_Api_Rest extends Apruve_ApruvePayment_Model_Api
|
|
101 |
public function getApruveOrderStatus($apiUrl, $status)
|
102 |
{
|
103 |
$c = curl_init($apiUrl);
|
104 |
-
curl_setopt($c, CURLOPT_HTTPHEADER, $this->
|
105 |
curl_setopt($c, CURLOPT_CUSTOMREQUEST, "GET");
|
106 |
-
curl_setopt($c, CURLOPT_RETURNTRANSFER, true
|
107 |
curl_setopt($c, CURLOPT_HEADER, true);
|
108 |
-
|
109 |
-
|
110 |
}
|
111 |
|
112 |
/**
|
@@ -114,9 +138,9 @@ class Apruve_ApruvePayment_Model_Api_Rest extends Apruve_ApruvePayment_Model_Api
|
|
114 |
* @param string $paymentRequestId
|
115 |
* @return string
|
116 |
*/
|
117 |
-
protected function
|
118 |
{
|
119 |
-
return $this->getBaseUrl(true)
|
120 |
}
|
121 |
|
122 |
|
@@ -125,8 +149,18 @@ class Apruve_ApruvePayment_Model_Api_Rest extends Apruve_ApruvePayment_Model_Api
|
|
125 |
* @param string $paymentRequestId
|
126 |
* @return string
|
127 |
*/
|
128 |
-
protected function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
129 |
{
|
130 |
-
return $this->getBaseUrl(true)
|
131 |
}
|
132 |
}
|
24 |
*
|
25 |
* Provide rest methods to communicate with apruve
|
26 |
*/
|
|
|
27 |
class Apruve_ApruvePayment_Model_Api_Rest extends Apruve_ApruvePayment_Model_Api_Abstract
|
28 |
{
|
29 |
/**
|
30 |
* Send Payment object
|
31 |
* @param string $paymentRequestId
|
32 |
+
* @param array $payment
|
33 |
+
*
|
34 |
* @return bool
|
35 |
*/
|
36 |
+
public function postPayment($paymentRequestId, $payment)
|
37 |
{
|
38 |
+
$data = json_encode($payment);
|
39 |
|
40 |
+
$c = curl_init($this->getPaymentUrl($paymentRequestId));
|
41 |
|
42 |
+
curl_setopt($c, CURLOPT_HTTPHEADER, $this->getHeaders());
|
43 |
curl_setopt($c, CURLOPT_POST, true);
|
44 |
+
curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
|
45 |
+
curl_setopt($c, CURLOPT_POSTFIELDS, $data);
|
46 |
$response = curl_exec($c);
|
47 |
$http_status = curl_getinfo($c, CURLINFO_HTTP_CODE);
|
48 |
curl_close($c);
|
49 |
|
50 |
+
if ($http_status == '201') {
|
51 |
return json_decode($response);
|
52 |
} else {
|
53 |
return false;
|
68 |
{
|
69 |
$data = json_encode(array(
|
70 |
'merchant_order_id' => $orderIncrementId,
|
71 |
+
'amount_cents' => $this->convertPrice($amount),
|
72 |
+
'shipping_cents' => $this->convertPrice($shipping),
|
73 |
+
'tax_cents' => $this->convertPrice($tax),
|
74 |
));
|
75 |
|
76 |
+
$c = curl_init($this->getUpdatePaymentRequestUrl($paymentRequestId));
|
77 |
|
78 |
+
curl_setopt($c, CURLOPT_HTTPHEADER, $this->getHeaders());
|
79 |
curl_setopt($c, CURLOPT_CUSTOMREQUEST, "PUT");
|
80 |
+
curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
|
81 |
+
curl_setopt($c, CURLOPT_POSTFIELDS, $data);
|
82 |
+
$response = curl_exec($c);
|
83 |
+
$http_status = curl_getinfo($c, CURLINFO_HTTP_CODE);
|
84 |
+
curl_close($c);
|
85 |
+
|
86 |
+
|
87 |
+
if ($http_status == '200') {
|
88 |
+
return json_decode($response);
|
89 |
+
} else {
|
90 |
+
return false;
|
91 |
+
}
|
92 |
+
}
|
93 |
+
|
94 |
+
/**
|
95 |
+
* Finalize paymentRequest object
|
96 |
+
*
|
97 |
+
* @param string $paymentRequestId
|
98 |
+
*
|
99 |
+
* @return bool
|
100 |
+
*/
|
101 |
+
public function finalizePaymentRequest($paymentRequestId)
|
102 |
+
{
|
103 |
+
$c = curl_init($this->getFinalizePaymentRequestUrl($paymentRequestId));
|
104 |
+
|
105 |
+
curl_setopt($c, CURLOPT_HTTPHEADER, $this->getHeaders());
|
106 |
+
curl_setopt($c, CURLOPT_CUSTOMREQUEST, "POST");
|
107 |
+
curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
|
108 |
$response = curl_exec($c);
|
109 |
$http_status = curl_getinfo($c, CURLINFO_HTTP_CODE);
|
110 |
curl_close($c);
|
111 |
|
112 |
|
113 |
+
if ($http_status == '200') {
|
114 |
return json_decode($response);
|
115 |
} else {
|
116 |
return false;
|
127 |
public function getApruveOrderStatus($apiUrl, $status)
|
128 |
{
|
129 |
$c = curl_init($apiUrl);
|
130 |
+
curl_setopt($c, CURLOPT_HTTPHEADER, $this->getHeaders());
|
131 |
curl_setopt($c, CURLOPT_CUSTOMREQUEST, "GET");
|
132 |
+
curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
|
133 |
curl_setopt($c, CURLOPT_HEADER, true);
|
|
|
|
|
134 |
}
|
135 |
|
136 |
/**
|
138 |
* @param string $paymentRequestId
|
139 |
* @return string
|
140 |
*/
|
141 |
+
protected function getPaymentUrl($paymentRequestId)
|
142 |
{
|
143 |
+
return $this->getBaseUrl(true) . $this->getApiUrl() . 'payment_requests/' . $paymentRequestId . '/payments';
|
144 |
}
|
145 |
|
146 |
|
149 |
* @param string $paymentRequestId
|
150 |
* @return string
|
151 |
*/
|
152 |
+
protected function getUpdatePaymentRequestUrl($paymentRequestId)
|
153 |
+
{
|
154 |
+
return $this->getBaseUrl(true) . $this->getApiUrl() . 'payment_requests/' . $paymentRequestId;
|
155 |
+
}
|
156 |
+
|
157 |
+
/**
|
158 |
+
* Get url for paymentRequest finalizing
|
159 |
+
* @param string $paymentRequestId
|
160 |
+
* @return string
|
161 |
+
*/
|
162 |
+
protected function getFinalizePaymentRequestUrl($paymentRequestId)
|
163 |
{
|
164 |
+
return $this->getBaseUrl(true) . $this->getApiUrl() . 'payment_requests/' . $paymentRequestId . '/finalize';
|
165 |
}
|
166 |
}
|
app/code/community/Apruve/ApruvePayment/Model/Observer.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Apruve_ApruvePayment_Model_Observer
|
4 |
+
{
|
5 |
+
|
6 |
+
public function finalizePayment($observer)
|
7 |
+
{
|
8 |
+
/** @var Mage_Sales_Model_Quote $quote */
|
9 |
+
$quote = $observer->getQuote();
|
10 |
+
$payment = $quote->getPayment();
|
11 |
+
if ($quote->getIsMultiShipping()
|
12 |
+
&& $payment->getMethod() == 'apruvepayment'
|
13 |
+
) {
|
14 |
+
$additionalInformation = $payment->getAdditionalInformation();
|
15 |
+
$token = $additionalInformation['aprt'];
|
16 |
+
if ($token) {
|
17 |
+
/** @var Apruve_ApruvePayment_Model_Api_Rest $apiHelper */
|
18 |
+
$apiHelper = Mage::getModel('apruvepayment/api_rest');
|
19 |
+
$apiHelper->finalizePaymentRequest($token);
|
20 |
+
}
|
21 |
+
}
|
22 |
+
}
|
23 |
+
|
24 |
+
}
|
app/code/community/Apruve/ApruvePayment/Model/PaymentMethod.php
CHANGED
@@ -73,21 +73,16 @@ class Apruve_ApruvePayment_Model_PaymentMethod extends Mage_Payment_Model_Method
|
|
73 |
/** @var Mage_Sales_Model_Order $order */
|
74 |
$order = $payment->getOrder();
|
75 |
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
$amounts['amount_cents'],
|
81 |
-
$amounts['tax_cents'],
|
82 |
-
$amounts['shipping_cents'],
|
83 |
-
$order->getIncrementId()
|
84 |
-
);
|
85 |
|
|
|
86 |
if (!$updateResult) {
|
87 |
Mage::throwException('Couldn\'t update order totals to Apruve');
|
88 |
}
|
89 |
-
|
90 |
-
$apruvePayment = $rest->postPayment($token, $amount);
|
91 |
if (!$apruvePayment) {
|
92 |
Mage::throwException('Apruve couldn\'t process order information');
|
93 |
}
|
73 |
/** @var Mage_Sales_Model_Order $order */
|
74 |
$order = $payment->getOrder();
|
75 |
|
76 |
+
/** @var Apruve_ApruvePayment_Model_Api_Payment $paymentHelper */
|
77 |
+
$paymentHelper = Mage::getModel('apruvepayment/api_payment', $order);
|
78 |
+
/** @var Apruve_ApruvePayment_Model_Api_PaymentRequest $paymentRequestHelper */
|
79 |
+
$paymentRequestHelper = Mage::getModel('apruvepayment/api_paymentRequest', $order->getQuote());
|
|
|
|
|
|
|
|
|
|
|
80 |
|
81 |
+
$updateResult = $paymentRequestHelper->updatePaymentRequest($token, $order->getIncrementId());
|
82 |
if (!$updateResult) {
|
83 |
Mage::throwException('Couldn\'t update order totals to Apruve');
|
84 |
}
|
85 |
+
$apruvePayment = $rest->postPayment($token, $paymentHelper->getPayment());
|
|
|
86 |
if (!$apruvePayment) {
|
87 |
Mage::throwException('Apruve couldn\'t process order information');
|
88 |
}
|
app/code/community/Apruve/ApruvePayment/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Apruve_ApruvePayment>
|
5 |
-
<version>1.0.
|
6 |
</Apruve_ApruvePayment>
|
7 |
</modules>
|
8 |
<frontend>
|
@@ -15,6 +15,17 @@
|
|
15 |
</args>
|
16 |
</apruvepayment>
|
17 |
</routers>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
<layout>
|
19 |
<updates>
|
20 |
<apruvepayment>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Apruve_ApruvePayment>
|
5 |
+
<version>1.0.13</version>
|
6 |
</Apruve_ApruvePayment>
|
7 |
</modules>
|
8 |
<frontend>
|
15 |
</args>
|
16 |
</apruvepayment>
|
17 |
</routers>
|
18 |
+
<events>
|
19 |
+
<checkout_quote_destroy>
|
20 |
+
<observers>
|
21 |
+
<module>
|
22 |
+
<type>singleton</type>
|
23 |
+
<class>apruvepayment/observer</class>
|
24 |
+
<method>finalizePayment</method>
|
25 |
+
</module>
|
26 |
+
</observers>
|
27 |
+
</checkout_quote_destroy>
|
28 |
+
</events>
|
29 |
<layout>
|
30 |
<updates>
|
31 |
<apruvepayment>
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Apruve_B2B_Payment_Gateway</name>
|
4 |
-
<version>1.0.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.apache.org/licenses/LICENSE-2.0">Apache License, 2.0</license>
|
7 |
<channel>community</channel>
|
@@ -10,9 +10,9 @@
|
|
10 |
<description>Payments designed for business spending. Increase sales and reduce cart abandonment by allowing your shoppers to send purchases directly to their company or client for payment, simply by using an email address instead of a credit card. Learn more and sign up for a free merchant account at http://www.apruve.com.</description>
|
11 |
<notes>Stable Version</notes>
|
12 |
<authors><author><name>Apruve</name><user>Apruve</user><email>magento@apruve.com</email></author></authors>
|
13 |
-
<date>2015-
|
14 |
-
<time>
|
15 |
-
<contents><target name="magecommunity"><dir name="Apruve"><dir name="ApruvePayment"><dir name="Block"><dir name="Admin"><file name="Webhook.php" hash="339e11982444fd861a8ab3ee78e81f6e"/></dir><dir name="Payment"><file name="Form.php" hash="c84481487b8a831fc382d90c76eeb962"/></dir></dir><dir name="Helper"><file name="Data.php" hash="
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Apruve_B2B_Payment_Gateway</name>
|
4 |
+
<version>1.0.13</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.apache.org/licenses/LICENSE-2.0">Apache License, 2.0</license>
|
7 |
<channel>community</channel>
|
10 |
<description>Payments designed for business spending. Increase sales and reduce cart abandonment by allowing your shoppers to send purchases directly to their company or client for payment, simply by using an email address instead of a credit card. Learn more and sign up for a free merchant account at http://www.apruve.com.</description>
|
11 |
<notes>Stable Version</notes>
|
12 |
<authors><author><name>Apruve</name><user>Apruve</user><email>magento@apruve.com</email></author></authors>
|
13 |
+
<date>2015-12-10</date>
|
14 |
+
<time>10:47:02</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="Apruve"><dir name="ApruvePayment"><dir name="Block"><dir name="Admin"><file name="Webhook.php" hash="339e11982444fd861a8ab3ee78e81f6e"/></dir><dir name="Payment"><file name="Form.php" hash="c84481487b8a831fc382d90c76eeb962"/></dir></dir><dir name="Helper"><file name="Data.php" hash="a1f14f2f4383ddd39258fe7b2ad3e1e6"/></dir><file name="LICENSE.txt" hash="9b76dd4b62de4f9840b5d462fcb25e39"/><dir name="Model"><dir name="Api"><file name="Abstract.php" hash="bacd428acbc15b9a873b4d81f29c0252"/><file name="Payment.php" hash="c4d46501092961d448a8592bb2f82abf"/><file name="PaymentRequest.php" hash="54e5e5246c555f50048f7752133074eb"/><file name="Rest.php" hash="36f1519db699ec5c8d45714cbcf35ecb"/></dir><file name="Mode.php" hash="680b0b1bbcece8ac6d6606b80e4669df"/><dir name="Mysql4"><file name="Setup.php" hash="8b3e5b033dac91b47e59c024e16c04ec"/></dir><file name="Observer.php" hash="aa9a79b176f7f0ac580c3c751bd199dd"/><file name="PaymentMethod.php" hash="d094261d4ad6fcbcca063c8bc78c6845"/></dir><dir name="controllers"><file name="WebhookController.php" hash="185f4757d5d289982f55d551d1b4d5ae"/></dir><dir name="etc"><file name="config.xml" hash="99c798654d174822132db3b641800788"/><file name="system.xml" hash="065fd7d1ced76bb5fb2ba4bcb779efb3"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="apruvepayment.xml" hash="a5f41c280270a5fa44212c9d4cfe043a"/></dir><dir name="template"><dir name="apruvepayment"><file name="head.phtml" hash="36809c6a8fa5aad587b03e2107482bdf"/><dir name="payment"><file name="form.phtml" hash="fffe2fb194db0fa68bacf59174654a16"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Apruve_ApruvePayment.xml" hash="b9d4a9486387dce0b7911d46f1ab81c7"/></dir></target><target name="mage"><dir name="js"><dir name="Apruve"><file name="ApruvePayment.js" hash="5b84bf57eb8ae2bb76d99a4ab6844450"/></dir></dir></target></contents>
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|