Version Notes
1. New secure communication protocal.
Download this release
Release Info
Developer | Warrin |
Extension | Ced_LayBuy |
Version | 2.1.9.1 |
Comparing to | |
See all releases |
Code changes from version 2.1.9.0 to 2.1.9.1
- app/code/local/Ced/LayBuy/Block/Express/Layform.php +0 -43
- app/code/local/Ced/LayBuy/Block/Express/Layshortcut.php +0 -28
- app/code/local/Ced/LayBuy/Block/Express/Redirect.php +0 -55
- app/code/local/Ced/LayBuy/Block/Express/Review.php +0 -259
- app/code/local/Ced/LayBuy/Block/Express/Review/Billing.php +0 -59
- app/code/local/Ced/LayBuy/Block/Express/Review/Details.php +0 -60
- app/code/local/Ced/LayBuy/Block/Express/Review/Shipping.php +0 -53
- app/code/local/Ced/LayBuy/Block/Payment/Info.php +0 -63
- app/code/local/Ced/LayBuy/Helper/Address.php +0 -290
- app/code/local/Ced/LayBuy/Helper/Data.php +3 -25
- app/code/local/Ced/LayBuy/Model/Abstract.php +0 -168
- app/code/local/Ced/LayBuy/Model/Config.php +0 -1419
- app/code/local/Ced/LayBuy/Model/Express.php +0 -783
- app/code/local/Ced/LayBuy/Model/Laybuyresp.php +0 -12
- app/code/local/Ced/LayBuy/Model/Mysql4/Laybuyresp.php +0 -11
- app/code/local/Ced/LayBuy/Model/Mysql4/Laybuyresp/Collection.php +0 -37
- app/code/local/Ced/LayBuy/Model/Mysql4/Region/Collection.php +0 -140
- app/code/local/Ced/LayBuy/Model/Pro.php +0 -484
- app/code/local/Ced/LayBuy/Model/Resource/Region/Collection.php +0 -52
- app/code/local/Ced/LayBuy/controllers/ExpressController.php +0 -1859
- app/code/local/Ced/LayBuy/etc/config.xml +189 -224
- app/code/local/Ced/LayBuy/etc/system.xml +278 -296
- app/code/local/Ced/LayBuy/sql/laybuy_setup/mysql4-upgrade-1.0.0-1.0.1.php +0 -16
- app/design/frontend/base/default/layout/laybuy.xml +2 -86
- app/design/frontend/base/default/template/laybuy/checkout/onepage/review/button_express.phtml +0 -50
- app/design/frontend/base/default/template/laybuy/express/extraexpress.phtml +0 -154
- app/design/frontend/base/default/template/laybuy/express/layshortcut.phtml +0 -41
- app/design/frontend/base/default/template/laybuy/express/layshortcut1.phtml +0 -17
- app/design/frontend/base/default/template/laybuy/express/review.phtml +0 -177
- app/design/frontend/base/default/template/laybuy/express/review/address.phtml +0 -146
- app/design/frontend/base/default/template/laybuy/express/review/details.phtml +0 -65
- app/design/frontend/base/default/template/laybuy/express/review/shipping/method.phtml +0 -53
- js/laybuy/review.js +0 -454
- package.xml +12 -12
app/code/local/Ced/LayBuy/Block/Express/Layform.php
DELETED
@@ -1,43 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Ced_LayBuy_Block_Express_Layform extends Mage_Core_Block_Template
|
3 |
-
{
|
4 |
-
protected $_storeId = null;
|
5 |
-
|
6 |
-
public function getStoreId(){
|
7 |
-
if(empty($this->_storeId)){
|
8 |
-
$this->_storeId = Mage::app()->getStore()->getId();
|
9 |
-
}
|
10 |
-
return $this->_storeId;
|
11 |
-
}
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Block construction. Set block template.
|
15 |
-
*/
|
16 |
-
protected function _construct()
|
17 |
-
{
|
18 |
-
//parent::_construct();
|
19 |
-
|
20 |
-
$laybuyMark = Mage::getConfig()->getBlockClassName('core/template');
|
21 |
-
$laybuyMark = new $laybuyMark;
|
22 |
-
//$laybuyMark->setTemplate('laybuy/form/laybuy.phtml')
|
23 |
-
//->setLayBuyTitle(Mage::helper('laybuy')->__('A recurring payment solution'))
|
24 |
-
//->setPaymentAcceptanceMarkSrc('https://lay-buys.com/gateway/LAY-BUY.png')
|
25 |
-
//->setPaymentAcceptanceMarkHref('https://lay-buys.com/');
|
26 |
-
$note = 'Please Choose Your Payment Plan';
|
27 |
-
$this->setTemplate('laybuy/express/extraexpress.phtml')
|
28 |
-
->setMethodTitle('')
|
29 |
-
->setExtraMessage('<b>'.$this->__('%s',$note).'</b>');
|
30 |
-
//->setMethodLabelAfterHtml($laybuyMark->toHtml());
|
31 |
-
}
|
32 |
-
|
33 |
-
public function getArray($type){
|
34 |
-
$totals = Mage::getSingleton('checkout/session')->getQuote()->getTotals();
|
35 |
-
$grandtotal = round($totals["grand_total"]->getValue());
|
36 |
-
return Mage::getModel('laybuy/report')->getArray($type,$grandtotal,$this->getStoreId());
|
37 |
-
}
|
38 |
-
|
39 |
-
public function getConfigData($field){
|
40 |
-
return Mage::getStoreConfig('payment/laybuy/'.$field,$this->getStoreId());
|
41 |
-
}
|
42 |
-
|
43 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Ced/LayBuy/Block/Express/Layshortcut.php
DELETED
@@ -1,28 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Ced_LayBuy_Block_Express_Layshortcut extends Mage_Core_Block_Template
|
3 |
-
{
|
4 |
-
const POSITION_BEFORE = 'before';
|
5 |
-
const POSITION_AFTER = 'after';
|
6 |
-
/**
|
7 |
-
* Check is "OR" label position before shortcut
|
8 |
-
*
|
9 |
-
* @return bool
|
10 |
-
*/
|
11 |
-
public function isOrPositionBefore()
|
12 |
-
{
|
13 |
-
return ($this->getIsInCatalogProduct() && !$this->getShowOrPosition())
|
14 |
-
|| ($this->getShowOrPosition() && $this->getShowOrPosition() == self::POSITION_BEFORE);
|
15 |
-
|
16 |
-
}
|
17 |
-
|
18 |
-
/**
|
19 |
-
* Check is "OR" label position after shortcut
|
20 |
-
*
|
21 |
-
* @return bool
|
22 |
-
*/
|
23 |
-
public function isOrPositionAfter()
|
24 |
-
{
|
25 |
-
return (!$this->getIsInCatalogProduct() && !$this->getShowOrPosition())
|
26 |
-
|| ($this->getShowOrPosition() && $this->getShowOrPosition() == self::POSITION_AFTER);
|
27 |
-
}
|
28 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Ced/LayBuy/Block/Express/Redirect.php
DELETED
@@ -1,55 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Lay-Buys
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
-
* that is bundled with this package in the file LICENSE.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/osl-3.0.php
|
11 |
-
* If you did not receive a copy of the license and are unable to
|
12 |
-
* obtain it through the world-wide-web, please send an email
|
13 |
-
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
-
*
|
15 |
-
* DISCLAIMER
|
16 |
-
*
|
17 |
-
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
-
* versions in the future. If you wish to customize Magento for your
|
19 |
-
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
-
*
|
21 |
-
* @category Ced
|
22 |
-
* @package Ced_LayBuy
|
23 |
-
* @author Asheesh Singh<asheeshsingh@cedcoss.com>
|
24 |
-
* @copyright Copyright LAY-BUYS (2011). (http://lay-buys.com/)
|
25 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
-
*/
|
27 |
-
class Ced_LayBuy_Block_Express_Redirect extends Mage_Core_Block_Abstract
|
28 |
-
{
|
29 |
-
|
30 |
-
protected function _toHtml()
|
31 |
-
{
|
32 |
-
$redirectURL="http://lay-buys.com/expressgateway/";
|
33 |
-
$session = Mage::getSingleton('checkout/session');
|
34 |
-
$session->setLayBuyStandardQuoteId($session->getQuoteId());
|
35 |
-
if ($token=$this->getData('token')) {
|
36 |
-
$session->setLayBuyToken($token);
|
37 |
-
$redirectURL .= '?TOKEN='.$token;
|
38 |
-
$html = '<html><body>';
|
39 |
-
$html.= $this->__('You will be redirected to the PayPal website in a few seconds.');
|
40 |
-
$html.= '<br><input type="button" onClick="window.location=\''.$redirectURL.'\' " value="'.$this->__('Click here if you are not redirected within 10 seconds...').'" />';
|
41 |
-
$html.= '<script type="text/javascript">setTimeout(\'window.location="'.$redirectURL.'"\',1000);</script>';
|
42 |
-
$html.= '</body></html>';
|
43 |
-
}else{
|
44 |
-
$html = '<html><body>';
|
45 |
-
$html.= $this->__('You will be redirected to the PayPal website in a few seconds.');
|
46 |
-
$html.= '<br><input type="button" onClick="window.location=window.location;" value="'.$this->__('Click here if you are not redirected within 10 seconds...').'" />';
|
47 |
-
$html.= '<script type="text/javascript">setTimeout("window.location=window.location;",1000);</script>';
|
48 |
-
$html.= '</body></html>';
|
49 |
-
}
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
return $html;
|
54 |
-
}
|
55 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Ced/LayBuy/Block/Express/Review.php
DELETED
@@ -1,259 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Magento
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
-
* that is bundled with this package in the file LICENSE.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/osl-3.0.php
|
11 |
-
* If you did not receive a copy of the license and are unable to
|
12 |
-
* obtain it through the world-wide-web, please send an email
|
13 |
-
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
-
*
|
15 |
-
* DISCLAIMER
|
16 |
-
*
|
17 |
-
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
-
* versions in the future. If you wish to customize Magento for your
|
19 |
-
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
-
*
|
21 |
-
* @category Mage
|
22 |
-
* @package Mage_Paypal
|
23 |
-
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
-
*/
|
26 |
-
|
27 |
-
/**
|
28 |
-
* Paypal Express Onepage checkout block
|
29 |
-
*
|
30 |
-
* @category Mage
|
31 |
-
* @package Mage_Paypal
|
32 |
-
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
-
*/
|
34 |
-
class Ced_LayBuy_Block_Express_Review extends Mage_Core_Block_Template
|
35 |
-
{
|
36 |
-
/**
|
37 |
-
* @var Mage_Sales_Model_Quote
|
38 |
-
*/
|
39 |
-
protected $_quote;
|
40 |
-
|
41 |
-
/**
|
42 |
-
* Currently selected shipping rate
|
43 |
-
*
|
44 |
-
* @var Mage_Sales_Model_Quote_Address_Rate
|
45 |
-
*/
|
46 |
-
protected $_currentShippingRate = null;
|
47 |
-
|
48 |
-
/**
|
49 |
-
* Paypal action prefix
|
50 |
-
*
|
51 |
-
* @var string
|
52 |
-
*/
|
53 |
-
protected $_paypalActionPrefix = 'paypal';
|
54 |
-
|
55 |
-
/**
|
56 |
-
* Quote object setter
|
57 |
-
*
|
58 |
-
* @param Mage_Sales_Model_Quote $quote
|
59 |
-
* @return Mage_Paypal_Block_Express_Review
|
60 |
-
*/
|
61 |
-
public function setQuote(Mage_Sales_Model_Quote $quote)
|
62 |
-
{
|
63 |
-
$this->_quote = $quote;
|
64 |
-
return $this;
|
65 |
-
}
|
66 |
-
public function getPlaceOrderUrl(){
|
67 |
-
$url="";
|
68 |
-
$url=Mage::getUrl('laybuy/express/placeOrder');
|
69 |
-
return $url;
|
70 |
-
|
71 |
-
}
|
72 |
-
public function getUpdateShippingMethodsUrl(){
|
73 |
-
$url="";
|
74 |
-
$url=Mage::getUrl('laybuy/express/updateShippingMethods');
|
75 |
-
return $url;
|
76 |
-
|
77 |
-
}
|
78 |
-
public function getUpdateOrderSubmitUrl(){
|
79 |
-
$url="";
|
80 |
-
$url=Mage::getUrl('laybuy/express/updateOrder');
|
81 |
-
return $url;
|
82 |
-
|
83 |
-
}
|
84 |
-
|
85 |
-
|
86 |
-
/**
|
87 |
-
* Return quote billing address
|
88 |
-
*
|
89 |
-
* @return Mage_Sales_Model_Quote_Address
|
90 |
-
*/
|
91 |
-
public function getBillingAddress()
|
92 |
-
{
|
93 |
-
return $this->_quote->getBillingAddress();
|
94 |
-
}
|
95 |
-
|
96 |
-
/**
|
97 |
-
* Return quote shipping address
|
98 |
-
*
|
99 |
-
* @return Mage_Sales_Model_Quote_Address
|
100 |
-
*/
|
101 |
-
public function getShippingAddress()
|
102 |
-
{
|
103 |
-
if ($this->_quote->getIsVirtual()) {
|
104 |
-
return false;
|
105 |
-
}
|
106 |
-
return $this->_quote->getShippingAddress();
|
107 |
-
}
|
108 |
-
|
109 |
-
/**
|
110 |
-
* Get HTML output for specified address
|
111 |
-
*
|
112 |
-
* @param Mage_Sales_Model_Quote_Address
|
113 |
-
* @return string
|
114 |
-
*/
|
115 |
-
public function renderAddress($address)
|
116 |
-
{
|
117 |
-
return $address->getFormated(true);
|
118 |
-
}
|
119 |
-
|
120 |
-
/**
|
121 |
-
* Return carrier name from config, base on carrier code
|
122 |
-
*
|
123 |
-
* @param $carrierCode string
|
124 |
-
* @return string
|
125 |
-
*/
|
126 |
-
public function getCarrierName($carrierCode)
|
127 |
-
{
|
128 |
-
if ($name = Mage::getStoreConfig("carriers/{$carrierCode}/title")) {
|
129 |
-
return $name;
|
130 |
-
}
|
131 |
-
return $carrierCode;
|
132 |
-
}
|
133 |
-
|
134 |
-
/**
|
135 |
-
* Get either shipping rate code or empty value on error
|
136 |
-
*
|
137 |
-
* @param Varien_Object $rate
|
138 |
-
* @return string
|
139 |
-
*/
|
140 |
-
public function renderShippingRateValue(Varien_Object $rate)
|
141 |
-
{
|
142 |
-
if ($rate->getErrorMessage()) {
|
143 |
-
return '';
|
144 |
-
}
|
145 |
-
return $rate->getCode();
|
146 |
-
}
|
147 |
-
|
148 |
-
/**
|
149 |
-
* Get shipping rate code title and its price or error message
|
150 |
-
*
|
151 |
-
* @param Varien_Object $rate
|
152 |
-
* @param string $format
|
153 |
-
* @param string $inclTaxFormat
|
154 |
-
* @return string
|
155 |
-
*/
|
156 |
-
public function renderShippingRateOption($rate, $format = '%s - %s%s', $inclTaxFormat = ' (%s %s)')
|
157 |
-
{
|
158 |
-
$renderedInclTax = '';
|
159 |
-
if ($rate->getErrorMessage()) {
|
160 |
-
$price = $rate->getErrorMessage();
|
161 |
-
} else {
|
162 |
-
$price = $this->_getShippingPrice($rate->getPrice(),
|
163 |
-
$this->helper('tax')->displayShippingPriceIncludingTax());
|
164 |
-
|
165 |
-
$incl = $this->_getShippingPrice($rate->getPrice(), true);
|
166 |
-
if (($incl != $price) && $this->helper('tax')->displayShippingBothPrices()) {
|
167 |
-
$renderedInclTax = sprintf($inclTaxFormat, Mage::helper('tax')->__('Incl. Tax'), $incl);
|
168 |
-
}
|
169 |
-
}
|
170 |
-
return sprintf($format, $this->escapeHtml($rate->getMethodTitle()), $price, $renderedInclTax);
|
171 |
-
}
|
172 |
-
|
173 |
-
/**
|
174 |
-
* Getter for current shipping rate
|
175 |
-
*
|
176 |
-
* @return Mage_Sales_Model_Quote_Address_Rate
|
177 |
-
*/
|
178 |
-
public function getCurrentShippingRate()
|
179 |
-
{
|
180 |
-
return $this->_currentShippingRate;
|
181 |
-
}
|
182 |
-
|
183 |
-
/**
|
184 |
-
* Set paypal actions prefix
|
185 |
-
*/
|
186 |
-
public function setPaypalActionPrefix($prefix)
|
187 |
-
{
|
188 |
-
$this->_paypalActionPrefix = $prefix;
|
189 |
-
}
|
190 |
-
|
191 |
-
/**
|
192 |
-
* Return formatted shipping price
|
193 |
-
*
|
194 |
-
* @param float $price
|
195 |
-
* @param bool $isInclTax
|
196 |
-
*
|
197 |
-
* @return bool
|
198 |
-
*/
|
199 |
-
protected function _getShippingPrice($price, $isInclTax)
|
200 |
-
{
|
201 |
-
return $this->_formatPrice($this->helper('tax')->getShippingPrice($price, $isInclTax, $this->_address));
|
202 |
-
}
|
203 |
-
|
204 |
-
/**
|
205 |
-
* Format price base on store convert price method
|
206 |
-
*
|
207 |
-
* @param float $price
|
208 |
-
* @return string
|
209 |
-
*/
|
210 |
-
protected function _formatPrice($price)
|
211 |
-
{
|
212 |
-
return $this->_quote->getStore()->convertPrice($price, true);
|
213 |
-
}
|
214 |
-
|
215 |
-
/**
|
216 |
-
* Retrieve payment method and assign additional template values
|
217 |
-
*
|
218 |
-
* @return Mage_Paypal_Block_Express_Review
|
219 |
-
*/
|
220 |
-
protected function _beforeToHtml()
|
221 |
-
{
|
222 |
-
$methodInstance = $this->_quote->getPayment()->getMethodInstance();
|
223 |
-
$this->setPaymentMethodTitle($methodInstance->getTitle());
|
224 |
-
$this->setUpdateOrderSubmitUrl($this->getUrl("{$this->_paypalActionPrefix}/express/updateOrder"));
|
225 |
-
$this->setUpdateShippingMethodsUrl($this->getUrl("{$this->_paypalActionPrefix}/express/updateShippingMethods"));
|
226 |
-
|
227 |
-
$this->setShippingRateRequired(true);
|
228 |
-
if ($this->_quote->getIsVirtual()) {
|
229 |
-
$this->setShippingRateRequired(false);
|
230 |
-
} else {
|
231 |
-
// prepare shipping rates
|
232 |
-
$this->_address = $this->_quote->getShippingAddress();
|
233 |
-
$groups = $this->_address->getGroupedAllShippingRates();
|
234 |
-
if ($groups && $this->_address) {
|
235 |
-
$this->setShippingRateGroups($groups);
|
236 |
-
// determine current selected code & name
|
237 |
-
foreach ($groups as $code => $rates) {
|
238 |
-
foreach ($rates as $rate) {
|
239 |
-
if ($this->_address->getShippingMethod() == $rate->getCode()) {
|
240 |
-
$this->_currentShippingRate = $rate;
|
241 |
-
break(2);
|
242 |
-
}
|
243 |
-
}
|
244 |
-
}
|
245 |
-
}
|
246 |
-
|
247 |
-
// misc shipping parameters
|
248 |
-
$this->setShippingMethodSubmitUrl($this->getUrl("{$this->_paypalActionPrefix}/express/saveShippingMethod"))
|
249 |
-
->setCanEditShippingAddress($this->_quote->getMayEditShippingAddress())
|
250 |
-
->setCanEditShippingMethod($this->_quote->getMayEditShippingMethod())
|
251 |
-
;
|
252 |
-
}
|
253 |
-
|
254 |
-
$this->setEditUrl($this->getUrl("{$this->_paypalActionPrefix}/express/edit"))
|
255 |
-
->setPlaceOrderUrl($this->getUrl("{$this->_paypalActionPrefix}/express/placeOrder"));
|
256 |
-
|
257 |
-
return parent::_beforeToHtml();
|
258 |
-
}
|
259 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Ced/LayBuy/Block/Express/Review/Billing.php
DELETED
@@ -1,59 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Magento
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
-
* that is bundled with this package in the file LICENSE.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/osl-3.0.php
|
11 |
-
* If you did not receive a copy of the license and are unable to
|
12 |
-
* obtain it through the world-wide-web, please send an email
|
13 |
-
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
-
*
|
15 |
-
* DISCLAIMER
|
16 |
-
*
|
17 |
-
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
-
* versions in the future. If you wish to customize Magento for your
|
19 |
-
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
-
*
|
21 |
-
* @category Mage
|
22 |
-
* @package Mage_Paypal
|
23 |
-
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
-
*/
|
26 |
-
|
27 |
-
/**
|
28 |
-
* Paypal Express Onepage checkout block for Billing Address
|
29 |
-
*
|
30 |
-
* @category Mage
|
31 |
-
* @package Mage_Paypal
|
32 |
-
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
-
*/
|
34 |
-
class Ced_LayBuy_Block_Express_Review_Billing extends Mage_Checkout_Block_Onepage_Billing
|
35 |
-
{
|
36 |
-
/**
|
37 |
-
* Return Sales Quote Address model
|
38 |
-
*
|
39 |
-
* @return Mage_Sales_Model_Quote_Address
|
40 |
-
*/
|
41 |
-
public function getAddress()
|
42 |
-
{
|
43 |
-
if (is_null($this->_address)) {
|
44 |
-
if ($this->isCustomerLoggedIn() || $this->getQuote()->getBillingAddress()) {
|
45 |
-
$this->_address = $this->getQuote()->getBillingAddress();
|
46 |
-
if (!$this->_address->getFirstname()) {
|
47 |
-
$this->_address->setFirstname($this->getQuote()->getCustomer()->getFirstname());
|
48 |
-
}
|
49 |
-
if (!$this->_address->getLastname()) {
|
50 |
-
$this->_address->setLastname($this->getQuote()->getCustomer()->getLastname());
|
51 |
-
}
|
52 |
-
} else {
|
53 |
-
$this->_address = Mage::getModel('sales/quote_address');
|
54 |
-
}
|
55 |
-
}
|
56 |
-
|
57 |
-
return $this->_address;
|
58 |
-
}
|
59 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Ced/LayBuy/Block/Express/Review/Details.php
DELETED
@@ -1,60 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Magento
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
-
* that is bundled with this package in the file LICENSE.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/osl-3.0.php
|
11 |
-
* If you did not receive a copy of the license and are unable to
|
12 |
-
* obtain it through the world-wide-web, please send an email
|
13 |
-
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
-
*
|
15 |
-
* DISCLAIMER
|
16 |
-
*
|
17 |
-
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
-
* versions in the future. If you wish to customize Magento for your
|
19 |
-
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
-
*
|
21 |
-
* @category Mage
|
22 |
-
* @package Mage_Paypal
|
23 |
-
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
-
*/
|
26 |
-
|
27 |
-
/**
|
28 |
-
* Paypal Express Onepage checkout block
|
29 |
-
*
|
30 |
-
* @category Mage
|
31 |
-
* @package Mage_Paypal
|
32 |
-
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
-
*/
|
34 |
-
class Ced_LayBuy_Block_Express_Review_Details extends Mage_Checkout_Block_Cart_Totals
|
35 |
-
{
|
36 |
-
protected $_address;
|
37 |
-
|
38 |
-
/**
|
39 |
-
* Return review shipping address
|
40 |
-
*
|
41 |
-
* @return Mage_Sales_Model_Order_Address
|
42 |
-
*/
|
43 |
-
public function getAddress()
|
44 |
-
{
|
45 |
-
if (empty($this->_address)) {
|
46 |
-
$this->_address = $this->getQuote()->getShippingAddress();
|
47 |
-
}
|
48 |
-
return $this->_address;
|
49 |
-
}
|
50 |
-
|
51 |
-
/**
|
52 |
-
* Return review quote totals
|
53 |
-
*
|
54 |
-
* @return array
|
55 |
-
*/
|
56 |
-
public function getTotals()
|
57 |
-
{
|
58 |
-
return $this->getQuote()->getTotals();
|
59 |
-
}
|
60 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Ced/LayBuy/Block/Express/Review/Shipping.php
DELETED
@@ -1,53 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Magento
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
-
* that is bundled with this package in the file LICENSE.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/osl-3.0.php
|
11 |
-
* If you did not receive a copy of the license and are unable to
|
12 |
-
* obtain it through the world-wide-web, please send an email
|
13 |
-
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
-
*
|
15 |
-
* DISCLAIMER
|
16 |
-
*
|
17 |
-
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
-
* versions in the future. If you wish to customize Magento for your
|
19 |
-
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
-
*
|
21 |
-
* @category Mage
|
22 |
-
* @package Mage_Paypal
|
23 |
-
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
-
*/
|
26 |
-
|
27 |
-
/**
|
28 |
-
* Paypal Express Onepage checkout block for Shipping Address
|
29 |
-
*
|
30 |
-
* @category Mage
|
31 |
-
* @package Mage_Paypal
|
32 |
-
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
-
*/
|
34 |
-
class Ced_LayBuy_Block_Express_Review_Shipping extends Mage_Checkout_Block_Onepage_Shipping
|
35 |
-
{
|
36 |
-
/**
|
37 |
-
* Return Sales Quote Address model (shipping address)
|
38 |
-
*
|
39 |
-
* @return Mage_Sales_Model_Quote_Address
|
40 |
-
*/
|
41 |
-
public function getAddress()
|
42 |
-
{
|
43 |
-
if (is_null($this->_address)) {
|
44 |
-
if ($this->isCustomerLoggedIn() || $this->getQuote()->getShippingAddress()) {
|
45 |
-
$this->_address = $this->getQuote()->getShippingAddress();
|
46 |
-
} else {
|
47 |
-
$this->_address = Mage::getModel('sales/quote_address');
|
48 |
-
}
|
49 |
-
}
|
50 |
-
|
51 |
-
return $this->_address;
|
52 |
-
}
|
53 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Ced/LayBuy/Block/Payment/Info.php
DELETED
@@ -1,63 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Magento
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
-
* that is bundled with this package in the file LICENSE.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/osl-3.0.php
|
11 |
-
* If you did not receive a copy of the license and are unable to
|
12 |
-
* obtain it through the world-wide-web, please send an email
|
13 |
-
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
-
*
|
15 |
-
* DISCLAIMER
|
16 |
-
*
|
17 |
-
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
-
* versions in the future. If you wish to customize Magento for your
|
19 |
-
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
-
*
|
21 |
-
* @category Mage
|
22 |
-
* @package Mage_Paypal
|
23 |
-
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
-
*/
|
26 |
-
|
27 |
-
/**
|
28 |
-
* PayPal common payment info block
|
29 |
-
* Uses default templates
|
30 |
-
*/
|
31 |
-
class Ced_LayBuy_Block_Payment_Info extends Mage_Payment_Block_Info_Cc
|
32 |
-
{
|
33 |
-
/**
|
34 |
-
* Don't show CC type for non-CC methods
|
35 |
-
*
|
36 |
-
* @return string|null
|
37 |
-
*/
|
38 |
-
public function getCcTypeName()
|
39 |
-
{
|
40 |
-
if (Mage_Paypal_Model_Config::getIsCreditCardMethod($this->getInfo()->getMethod())) {
|
41 |
-
return parent::getCcTypeName();
|
42 |
-
}
|
43 |
-
}
|
44 |
-
|
45 |
-
/**
|
46 |
-
* Prepare PayPal-specific payment information
|
47 |
-
*
|
48 |
-
* @param Varien_Object|array $transport
|
49 |
-
* return Varien_Object
|
50 |
-
*/
|
51 |
-
protected function _prepareSpecificInformation($transport = null)
|
52 |
-
{
|
53 |
-
$transport = parent::_prepareSpecificInformation($transport);
|
54 |
-
$payment = $this->getInfo();
|
55 |
-
$paypalInfo = Mage::getModel('paypal/info');
|
56 |
-
if (!$this->getIsSecureMode()) {
|
57 |
-
$info = $paypalInfo->getPaymentInfo($payment, true);
|
58 |
-
} else {
|
59 |
-
$info = $paypalInfo->getPublicPaymentInfo($payment, true);
|
60 |
-
}
|
61 |
-
return $transport->addData($info);
|
62 |
-
}
|
63 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Ced/LayBuy/Helper/Address.php
DELETED
@@ -1,290 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Magento
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
-
* that is bundled with this package in the file LICENSE.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/osl-3.0.php
|
11 |
-
* If you did not receive a copy of the license and are unable to
|
12 |
-
* obtain it through the world-wide-web, please send an email
|
13 |
-
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
-
*
|
15 |
-
* DISCLAIMER
|
16 |
-
*
|
17 |
-
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
-
* versions in the future. If you wish to customize Magento for your
|
19 |
-
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
-
*
|
21 |
-
* @category Mage
|
22 |
-
* @package Mage_Customer
|
23 |
-
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
-
*/
|
26 |
-
|
27 |
-
/**
|
28 |
-
* Customer address helper
|
29 |
-
*
|
30 |
-
* @author Magento Core Team <core@magentocommerce.com>
|
31 |
-
*/
|
32 |
-
class Ced_Laybuy_Helper_Address extends Mage_Customer_Helper_Address
|
33 |
-
{
|
34 |
-
/**
|
35 |
-
* VAT Validation parameters XML paths
|
36 |
-
*/
|
37 |
-
const XML_PATH_VIV_DISABLE_AUTO_ASSIGN_DEFAULT = 'customer/create_account/viv_disable_auto_group_assign_default';
|
38 |
-
const XML_PATH_VIV_ON_EACH_TRANSACTION = 'customer/create_account/viv_on_each_transaction';
|
39 |
-
const XML_PATH_VAT_VALIDATION_ENABLED = 'customer/create_account/auto_group_assign';
|
40 |
-
const XML_PATH_VIV_TAX_CALCULATION_ADDRESS_TYPE = 'customer/create_account/tax_calculation_address_type';
|
41 |
-
const XML_PATH_VAT_FRONTEND_VISIBILITY = 'customer/create_account/vat_frontend_visibility';
|
42 |
-
|
43 |
-
/**
|
44 |
-
* Array of Customer Address Attributes
|
45 |
-
*
|
46 |
-
* @var array
|
47 |
-
*/
|
48 |
-
protected $_attributes;
|
49 |
-
|
50 |
-
/**
|
51 |
-
* Customer address config node per website
|
52 |
-
*
|
53 |
-
* @var array
|
54 |
-
*/
|
55 |
-
protected $_config = array();
|
56 |
-
|
57 |
-
/**
|
58 |
-
* Customer Number of Lines in a Street Address per website
|
59 |
-
*
|
60 |
-
* @var array
|
61 |
-
*/
|
62 |
-
protected $_streetLines = array();
|
63 |
-
protected $_formatTemplate = array();
|
64 |
-
|
65 |
-
/**
|
66 |
-
* Addresses url
|
67 |
-
*/
|
68 |
-
public function getBookUrl()
|
69 |
-
{
|
70 |
-
|
71 |
-
}
|
72 |
-
|
73 |
-
public function getEditUrl()
|
74 |
-
{
|
75 |
-
|
76 |
-
}
|
77 |
-
|
78 |
-
public function getDeleteUrl()
|
79 |
-
{
|
80 |
-
|
81 |
-
}
|
82 |
-
|
83 |
-
public function getCreateUrl()
|
84 |
-
{
|
85 |
-
|
86 |
-
}
|
87 |
-
|
88 |
-
public function getRenderer($renderer)
|
89 |
-
{
|
90 |
-
if(is_string($renderer) && $className = Mage::getConfig()->getBlockClassName($renderer)) {
|
91 |
-
return new $className();
|
92 |
-
} else {
|
93 |
-
return $renderer;
|
94 |
-
}
|
95 |
-
}
|
96 |
-
|
97 |
-
/**
|
98 |
-
* Return customer address config value by key and store
|
99 |
-
*
|
100 |
-
* @param string $key
|
101 |
-
* @param Mage_Core_Model_Store|int|string $store
|
102 |
-
* @return string|null
|
103 |
-
*/
|
104 |
-
public function getConfig($key, $store = null)
|
105 |
-
{
|
106 |
-
$websiteId = Mage::app()->getStore($store)->getWebsiteId();
|
107 |
-
|
108 |
-
if (!isset($this->_config[$websiteId])) {
|
109 |
-
$this->_config[$websiteId] = Mage::getStoreConfig('customer/address', $store);
|
110 |
-
}
|
111 |
-
return isset($this->_config[$websiteId][$key]) ? (string)$this->_config[$websiteId][$key] : null;
|
112 |
-
}
|
113 |
-
|
114 |
-
/**
|
115 |
-
* Return Number of Lines in a Street Address for store
|
116 |
-
*
|
117 |
-
* @param Mage_Core_Model_Store|int|string $store
|
118 |
-
* @return int
|
119 |
-
*/
|
120 |
-
public function getStreetLines($store = null)
|
121 |
-
{
|
122 |
-
$websiteId = Mage::app()->getStore($store)->getWebsiteId();
|
123 |
-
if (!isset($this->_streetLines[$websiteId])) {
|
124 |
-
$attribute = Mage::getSingleton('eav/config')->getAttribute('customer_address', 'street');
|
125 |
-
$lines = (int)$attribute->getMultilineCount();
|
126 |
-
if($lines <= 0) {
|
127 |
-
$lines = 2;
|
128 |
-
}
|
129 |
-
$this->_streetLines[$websiteId] = min(4, $lines);
|
130 |
-
}
|
131 |
-
|
132 |
-
return $this->_streetLines[$websiteId];
|
133 |
-
}
|
134 |
-
|
135 |
-
public function getFormat($code)
|
136 |
-
{
|
137 |
-
$format = Mage::getSingleton('customer/address_config')->getFormatByCode($code);
|
138 |
-
return $format->getRenderer() ? $format->getRenderer()->getFormat() : '';
|
139 |
-
}
|
140 |
-
|
141 |
-
/**
|
142 |
-
* Determine if specified address config value can be shown
|
143 |
-
*
|
144 |
-
* @param string $key
|
145 |
-
* @return bool
|
146 |
-
*/
|
147 |
-
public function canShowConfig($key)
|
148 |
-
{
|
149 |
-
return (bool)$this->getConfig($key);
|
150 |
-
}
|
151 |
-
|
152 |
-
/**
|
153 |
-
* Return array of Customer Address Attributes
|
154 |
-
*
|
155 |
-
* @return array
|
156 |
-
*/
|
157 |
-
public function getAttributes()
|
158 |
-
{
|
159 |
-
if (is_null($this->_attributes)) {
|
160 |
-
$this->_attributes = array();
|
161 |
-
/* @var $config Mage_Eav_Model_Config */
|
162 |
-
$config = Mage::getSingleton('eav/config');
|
163 |
-
foreach ($config->getEntityAttributeCodes('customer_address') as $attributeCode) {
|
164 |
-
$this->_attributes[$attributeCode] = $config->getAttribute('customer_address', $attributeCode);
|
165 |
-
}
|
166 |
-
}
|
167 |
-
return $this->_attributes;
|
168 |
-
}
|
169 |
-
|
170 |
-
/**
|
171 |
-
* Get string with frontend validation classes for attribute
|
172 |
-
*
|
173 |
-
* @param string $attributeCode
|
174 |
-
* @return string
|
175 |
-
*/
|
176 |
-
public function getAttributeValidationClass($attributeCode)
|
177 |
-
{
|
178 |
-
/** @var $attribute Mage_Customer_Model_Attribute */
|
179 |
-
$attribute = isset($this->_attributes[$attributeCode]) ? $this->_attributes[$attributeCode]
|
180 |
-
: Mage::getSingleton('eav/config')->getAttribute('customer_address', $attributeCode);
|
181 |
-
$class = $attribute ? $attribute->getFrontend()->getClass() : '';
|
182 |
-
|
183 |
-
if (in_array($attributeCode, array('firstname', 'middlename', 'lastname', 'prefix', 'suffix', 'taxvat'))) {
|
184 |
-
if ($class && !$attribute->getIsVisible()) {
|
185 |
-
$class = ''; // address attribute is not visible thus its validation rules are not applied
|
186 |
-
}
|
187 |
-
|
188 |
-
/** @var $customerAttribute Mage_Customer_Model_Attribute */
|
189 |
-
$customerAttribute = Mage::getSingleton('eav/config')->getAttribute('customer', $attributeCode);
|
190 |
-
$class .= $customerAttribute && $customerAttribute->getIsVisible()
|
191 |
-
? $customerAttribute->getFrontend()->getClass() : '';
|
192 |
-
$class = implode(' ', array_unique(array_filter(explode(' ', $class))));
|
193 |
-
}
|
194 |
-
|
195 |
-
return $class;
|
196 |
-
}
|
197 |
-
|
198 |
-
/**
|
199 |
-
* Convert streets array to new street lines count
|
200 |
-
* Examples of use:
|
201 |
-
* $origStreets = array('street1', 'street2', 'street3', 'street4')
|
202 |
-
* $toCount = 3
|
203 |
-
* Result:
|
204 |
-
* array('street1 street2', 'street3', 'street4')
|
205 |
-
* $toCount = 2
|
206 |
-
* Result:
|
207 |
-
* array('street1 street2', 'street3 street4')
|
208 |
-
*
|
209 |
-
* @param array $origStreets
|
210 |
-
* @param int $toCount
|
211 |
-
* @return array
|
212 |
-
*/
|
213 |
-
public function convertStreetLines($origStreets, $toCount)
|
214 |
-
{
|
215 |
-
$lines = array();
|
216 |
-
if (!empty($origStreets) && $toCount > 0) {
|
217 |
-
$countArgs = (int)floor(count($origStreets)/$toCount);
|
218 |
-
$modulo = count($origStreets) % $toCount;
|
219 |
-
$offset = 0;
|
220 |
-
$neededLinesCount = 0;
|
221 |
-
for ($i = 0; $i < $toCount; $i++) {
|
222 |
-
$offset += $neededLinesCount;
|
223 |
-
$neededLinesCount = $countArgs;
|
224 |
-
if ($modulo > 0) {
|
225 |
-
++$neededLinesCount;
|
226 |
-
--$modulo;
|
227 |
-
}
|
228 |
-
$values = array_slice($origStreets, $offset, $neededLinesCount);
|
229 |
-
if (is_array($values)) {
|
230 |
-
$lines[] = implode(' ', $values);
|
231 |
-
}
|
232 |
-
}
|
233 |
-
}
|
234 |
-
|
235 |
-
return $lines;
|
236 |
-
}
|
237 |
-
|
238 |
-
/**
|
239 |
-
* Check whether VAT ID validation is enabled
|
240 |
-
*
|
241 |
-
* @param Mage_Core_Model_Store|string|int $store
|
242 |
-
* @return bool
|
243 |
-
*/
|
244 |
-
public function isVatValidationEnabled($store = null)
|
245 |
-
{
|
246 |
-
return (bool)Mage::getStoreConfig(self::XML_PATH_VAT_VALIDATION_ENABLED, $store);
|
247 |
-
}
|
248 |
-
|
249 |
-
/**
|
250 |
-
* Retrieve disable auto group assign default value
|
251 |
-
*
|
252 |
-
* @return bool
|
253 |
-
*/
|
254 |
-
public function getDisableAutoGroupAssignDefaultValue()
|
255 |
-
{
|
256 |
-
return (bool)Mage::getStoreConfig(self::XML_PATH_VIV_DISABLE_AUTO_ASSIGN_DEFAULT);
|
257 |
-
}
|
258 |
-
|
259 |
-
/**
|
260 |
-
* Retrieve 'validate on each transaction' value
|
261 |
-
*
|
262 |
-
* @param Mage_Core_Model_Store|string|int $store
|
263 |
-
* @return bool
|
264 |
-
*/
|
265 |
-
public function getValidateOnEachTransaction($store = null)
|
266 |
-
{
|
267 |
-
return (bool)Mage::getStoreConfig(self::XML_PATH_VIV_ON_EACH_TRANSACTION, $store);
|
268 |
-
}
|
269 |
-
|
270 |
-
/**
|
271 |
-
* Retrieve customer address type on which tax calculation must be based
|
272 |
-
*
|
273 |
-
* @param Mage_Core_Model_Store|string|int|null $store
|
274 |
-
* @return string
|
275 |
-
*/
|
276 |
-
public function getTaxCalculationAddressType($store = null)
|
277 |
-
{
|
278 |
-
return (string)Mage::getStoreConfig(self::XML_PATH_VIV_TAX_CALCULATION_ADDRESS_TYPE, $store);
|
279 |
-
}
|
280 |
-
|
281 |
-
/**
|
282 |
-
* Check if VAT ID address attribute has to be shown on frontend (on Customer Address management forms)
|
283 |
-
*
|
284 |
-
* @return boolean
|
285 |
-
*/
|
286 |
-
public function isVatAttributeVisible()
|
287 |
-
{
|
288 |
-
return (bool)Mage::getStoreConfig(self::XML_PATH_VAT_FRONTEND_VISIBILITY);
|
289 |
-
}
|
290 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Ced/LayBuy/Helper/Data.php
CHANGED
@@ -291,37 +291,15 @@ class Ced_LayBuy_Helper_Data extends Mage_Core_Helper_Abstract{
|
|
291 |
}
|
292 |
}
|
293 |
|
294 |
-
|
295 |
$code = Mage::getModel('laybuy/standard')->_code;
|
296 |
$collection = Mage::getResourceModel('sales/order_grid_collection');
|
297 |
$collection->join(array('payment'=>'sales/order_payment'),'main_table.entity_id=parent_id && main_table.status = "processing"','method');
|
298 |
$collection->join(array('order'=>'sales/order'),'payment.parent_id = order.entity_id','*');
|
299 |
$collection->addFieldToFilter('method',$code);
|
300 |
return $collection->getAllIds();
|
301 |
-
}
|
302 |
-
|
303 |
-
$code = Mage::getModel('laybuy/standard')->_code;
|
304 |
-
$collection = Mage::getResourceModel('sales/order_grid_collection');
|
305 |
-
$paymentTable = Mage::getModel('core/resource')->getTableName("sales/order_payment");
|
306 |
-
//$paymentTable =$collection->getTable("sales/order_payment");
|
307 |
-
//$orderTable = $collection->getTable("sales/order");
|
308 |
-
$orderTable = Mage::getModel('core/resource')->getTableName("sales/order");
|
309 |
-
$collection->getSelect()->join(
|
310 |
-
array('e1'=>$paymentTable),
|
311 |
-
'`e1`.`parent_id`=`main_table`.`entity_id` and `main_table`.`status`="processing"',
|
312 |
-
array('method')
|
313 |
-
);
|
314 |
-
//$collection->join($paymentTable,'`main_table`.`entity_id`=`'.$paymentTable.'`.`parent_id` && `main_table`.`status` = "processing"','method');
|
315 |
-
|
316 |
-
$collection->getSelect()->join(
|
317 |
-
array('e2'=>$orderTable),
|
318 |
-
'`e1`.`parent_id`=`e2`.`entity_id`',
|
319 |
-
array('*')
|
320 |
-
);
|
321 |
-
//$collection->join($orderTable,'`'.$paymentTable.'`.`parent_id` = '.$orderTable.'.entity_id','*');
|
322 |
-
$collection->addFieldToFilter('method',$code);
|
323 |
-
return $collection->getAllIds();
|
324 |
-
}
|
325 |
public function fetchBeforeRevise($profileId = 0) {
|
326 |
if($profileId) {
|
327 |
$this->_matchingData = array('orderIds'=>'','profileIds'=>$profileId);
|
291 |
}
|
292 |
}
|
293 |
|
294 |
+
public function getPaidOrders() {
|
295 |
$code = Mage::getModel('laybuy/standard')->_code;
|
296 |
$collection = Mage::getResourceModel('sales/order_grid_collection');
|
297 |
$collection->join(array('payment'=>'sales/order_payment'),'main_table.entity_id=parent_id && main_table.status = "processing"','method');
|
298 |
$collection->join(array('order'=>'sales/order'),'payment.parent_id = order.entity_id','*');
|
299 |
$collection->addFieldToFilter('method',$code);
|
300 |
return $collection->getAllIds();
|
301 |
+
}
|
302 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
303 |
public function fetchBeforeRevise($profileId = 0) {
|
304 |
if($profileId) {
|
305 |
$this->_matchingData = array('orderIds'=>'','profileIds'=>$profileId);
|
app/code/local/Ced/LayBuy/Model/Abstract.php
DELETED
@@ -1,168 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Ced_LayBuy_Model_Abstract extends Varien_Object
|
3 |
-
{
|
4 |
-
protected $_importFromRequestFilters = array(
|
5 |
-
'REDIRECTREQUIRED' => '_filterToBool',
|
6 |
-
'SUCCESSPAGEREDIRECTREQUESTED' => '_filterToBool',
|
7 |
-
'PAYMENTSTATUS' => '_filterPaymentStatusFromNvpToInfo',
|
8 |
-
);
|
9 |
-
protected $_laybuyresponse=null;
|
10 |
-
/**
|
11 |
-
* Global public interface map
|
12 |
-
* @var array
|
13 |
-
*/
|
14 |
-
protected $_globalMap = array(
|
15 |
-
// each call
|
16 |
-
'VERSION' => 'version',
|
17 |
-
'USER' => 'api_username',
|
18 |
-
'PWD' => 'api_password',
|
19 |
-
'SIGNATURE' => 'api_signature',
|
20 |
-
'BUTTONSOURCE' => 'build_notation_code',
|
21 |
-
|
22 |
-
// for Unilateral payments
|
23 |
-
'SUBJECT' => 'business_account',
|
24 |
-
|
25 |
-
// commands
|
26 |
-
'PAYMENTACTION' => 'payment_action',
|
27 |
-
'RETURNURL' => 'return_url',
|
28 |
-
'CANCELURL' => 'cancel_url',
|
29 |
-
'INVNUM' => 'inv_num',
|
30 |
-
'TOKEN' => 'token',
|
31 |
-
'CORRELATIONID' => 'correlation_id',
|
32 |
-
'SOLUTIONTYPE' => 'solution_type',
|
33 |
-
'GIROPAYCANCELURL' => 'giropay_cancel_url',
|
34 |
-
'GIROPAYSUCCESSURL' => 'giropay_success_url',
|
35 |
-
'BANKTXNPENDINGURL' => 'giropay_bank_txn_pending_url',
|
36 |
-
'IPADDRESS' => 'ip_address',
|
37 |
-
'NOTIFYURL' => 'notify_url',
|
38 |
-
'RETURNFMFDETAILS' => 'fraud_management_filters_enabled',
|
39 |
-
'NOTE' => 'note',
|
40 |
-
'REFUNDTYPE' => 'refund_type',
|
41 |
-
'ACTION' => 'action',
|
42 |
-
'REDIRECTREQUIRED' => 'redirect_required',
|
43 |
-
'SUCCESSPAGEREDIRECTREQUESTED' => 'redirect_requested',
|
44 |
-
'REQBILLINGADDRESS' => 'require_billing_address',
|
45 |
-
// style settings
|
46 |
-
'PAGESTYLE' => 'page_style',
|
47 |
-
'HDRIMG' => 'hdrimg',
|
48 |
-
'HDRBORDERCOLOR' => 'hdrbordercolor',
|
49 |
-
'HDRBACKCOLOR' => 'hdrbackcolor',
|
50 |
-
'PAYFLOWCOLOR' => 'payflowcolor',
|
51 |
-
'LOCALECODE' => 'locale_code',
|
52 |
-
'PAL' => 'pal',
|
53 |
-
|
54 |
-
// transaction info
|
55 |
-
'TRANSACTIONID' => 'transaction_id',
|
56 |
-
'AUTHORIZATIONID' => 'authorization_id',
|
57 |
-
'REFUNDTRANSACTIONID' => 'refund_transaction_id',
|
58 |
-
'COMPLETETYPE' => 'complete_type',
|
59 |
-
'AMT' => 'amount',
|
60 |
-
'ITEMAMT' => 'subtotal_amount',
|
61 |
-
'GROSSREFUNDAMT' => 'refunded_amount', // possible mistake, check with API reference
|
62 |
-
|
63 |
-
// payment/billing info
|
64 |
-
'CURRENCYCODE' => 'currency_code',
|
65 |
-
'PAYMENTSTATUS' => 'payment_status',
|
66 |
-
'PENDINGREASON' => 'pending_reason',
|
67 |
-
'PROTECTIONELIGIBILITY' => 'protection_eligibility',
|
68 |
-
'PAYERID' => 'payer_id',
|
69 |
-
'PAYERSTATUS' => 'payer_status',
|
70 |
-
'ADDRESSID' => 'address_id',
|
71 |
-
'ADDRESSSTATUS' => 'address_status',
|
72 |
-
'EMAIL' => 'email',
|
73 |
-
// backwards compatibility
|
74 |
-
'FIRSTNAME' => 'firstname',
|
75 |
-
'LASTNAME' => 'lastname',
|
76 |
-
|
77 |
-
// shipping rate
|
78 |
-
'SHIPPINGOPTIONNAME' => 'shipping_rate_code',
|
79 |
-
'NOSHIPPING' => 'suppress_shipping',
|
80 |
-
|
81 |
-
// paypal direct credit card information
|
82 |
-
'CREDITCARDTYPE' => 'credit_card_type',
|
83 |
-
'ACCT' => 'credit_card_number',
|
84 |
-
'EXPDATE' => 'credit_card_expiration_date',
|
85 |
-
'CVV2' => 'credit_card_cvv2',
|
86 |
-
'STARTDATE' => 'maestro_solo_issue_date', // MMYYYY, always six chars, including leading zero
|
87 |
-
'ISSUENUMBER' => 'maestro_solo_issue_number',
|
88 |
-
'CVV2MATCH' => 'cvv2_check_result',
|
89 |
-
'AVSCODE' => 'avs_result',
|
90 |
-
// cardinal centinel
|
91 |
-
'AUTHSTATUS3DS' => 'centinel_authstatus',
|
92 |
-
'MPIVENDOR3DS' => 'centinel_mpivendor',
|
93 |
-
'CAVV' => 'centinel_cavv',
|
94 |
-
'ECI3DS' => 'centinel_eci',
|
95 |
-
'XID' => 'centinel_xid',
|
96 |
-
'VPAS' => 'centinel_vpas_result',
|
97 |
-
'ECISUBMITTED3DS' => 'centinel_eci_result',
|
98 |
-
|
99 |
-
// recurring payment profiles
|
100 |
-
//'TOKEN' => 'token',
|
101 |
-
'SUBSCRIBERNAME' =>'subscriber_name',
|
102 |
-
'PROFILESTARTDATE' => 'start_datetime',
|
103 |
-
'PROFILEREFERENCE' => 'internal_reference_id',
|
104 |
-
'DESC' => 'schedule_description',
|
105 |
-
'MAXFAILEDPAYMENTS' => 'suspension_threshold',
|
106 |
-
'AUTOBILLAMT' => 'bill_failed_later',
|
107 |
-
'BILLINGPERIOD' => 'period_unit',
|
108 |
-
'BILLINGFREQUENCY' => 'period_frequency',
|
109 |
-
'TOTALBILLINGCYCLES' => 'period_max_cycles',
|
110 |
-
//'AMT' => 'billing_amount', // have to use 'amount', see above
|
111 |
-
'TRIALBILLINGPERIOD' => 'trial_period_unit',
|
112 |
-
'TRIALBILLINGFREQUENCY' => 'trial_period_frequency',
|
113 |
-
'TRIALTOTALBILLINGCYCLES' => 'trial_period_max_cycles',
|
114 |
-
'TRIALAMT' => 'trial_billing_amount',
|
115 |
-
// 'CURRENCYCODE' => 'currency_code',
|
116 |
-
'SHIPPINGAMT' => 'shipping_amount',
|
117 |
-
'TAXAMT' => 'tax_amount',
|
118 |
-
'INITAMT' => 'init_amount',
|
119 |
-
'FAILEDINITAMTACTION' => 'init_may_fail',
|
120 |
-
'PROFILEID' => 'recurring_profile_id',
|
121 |
-
'PROFILESTATUS' => 'recurring_profile_status',
|
122 |
-
'STATUS' => 'status',
|
123 |
-
|
124 |
-
//Next two fields are used for Brazil only
|
125 |
-
'TAXID' => 'buyer_tax_id',
|
126 |
-
'TAXIDTYPE' => 'buyer_tax_id_type',
|
127 |
-
|
128 |
-
'BILLINGAGREEMENTID' => 'billing_agreement_id',
|
129 |
-
'REFERENCEID' => 'reference_id',
|
130 |
-
'BILLINGAGREEMENTSTATUS' => 'billing_agreement_status',
|
131 |
-
'BILLINGTYPE' => 'billing_type',
|
132 |
-
'SREET' => 'street',
|
133 |
-
'CITY' => 'city',
|
134 |
-
'STATE' => 'state',
|
135 |
-
'COUNTRYCODE' => 'countrycode',
|
136 |
-
'ZIP' => 'zip',
|
137 |
-
'PAYERBUSINESS' => 'payer_business',
|
138 |
-
);
|
139 |
-
/**
|
140 |
-
* Import $this public data from a private response array
|
141 |
-
*
|
142 |
-
* @param array $privateResponseMap
|
143 |
-
* @param array $response
|
144 |
-
*/
|
145 |
-
public function _importFromResponse(array $privateResponseMap, array $response)
|
146 |
-
{
|
147 |
-
$map = array();
|
148 |
-
foreach ($privateResponseMap as $key) {
|
149 |
-
if (isset($this->_globalMap[$key])) {
|
150 |
-
$map[$key] = $this->_globalMap[$key];
|
151 |
-
}
|
152 |
-
if (isset($response[$key]) && isset($this->_importFromRequestFilters[$key])) {
|
153 |
-
$callback = $this->_importFromRequestFilters[$key];
|
154 |
-
$response[$key] = call_user_func(array($this, $callback), $response[$key], $key, $map[$key]);
|
155 |
-
}
|
156 |
-
}
|
157 |
-
Varien_Object_Mapper::accumulateByMap($response, array($this, 'setDataUsingMethod'), $map);
|
158 |
-
}
|
159 |
-
public function setLaybuyResponse($resp="")
|
160 |
-
{
|
161 |
-
$this->_laybuyresponse=$resp;
|
162 |
-
}
|
163 |
-
public function getLaybuyResponse()
|
164 |
-
{
|
165 |
-
return $this->_laybuyresponse;
|
166 |
-
}
|
167 |
-
|
168 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Ced/LayBuy/Model/Config.php
DELETED
@@ -1,1419 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Magento
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
-
* that is bundled with this package in the file LICENSE.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/osl-3.0.php
|
11 |
-
* If you did not receive a copy of the license and are unable to
|
12 |
-
* obtain it through the world-wide-web, please send an email
|
13 |
-
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
-
*
|
15 |
-
* DISCLAIMER
|
16 |
-
*
|
17 |
-
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
-
* versions in the future. If you wish to customize Magento for your
|
19 |
-
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
-
*
|
21 |
-
* @category Mage
|
22 |
-
* @package Mage_Paypal
|
23 |
-
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
-
*/
|
26 |
-
|
27 |
-
/**
|
28 |
-
* Config model that is aware of all Mage_Paypal payment methods
|
29 |
-
* Works with PayPal-specific system configuration
|
30 |
-
*/
|
31 |
-
class Ced_LayBuy_Model_Config
|
32 |
-
{
|
33 |
-
/**
|
34 |
-
* PayPal Standard
|
35 |
-
* @var string
|
36 |
-
*/
|
37 |
-
const METHOD_WPS = 'laybuy_standard';
|
38 |
-
|
39 |
-
/**
|
40 |
-
* PayPal Website Payments Pro - Express Checkout
|
41 |
-
* @var string
|
42 |
-
*/
|
43 |
-
const METHOD_WPP_EXPRESS = 'laybuy_express';
|
44 |
-
|
45 |
-
/**
|
46 |
-
* PayPal Website Payments Pro - Direct Payments
|
47 |
-
* @var string
|
48 |
-
*/
|
49 |
-
const METHOD_WPP_DIRECT = 'laybuy_direct';
|
50 |
-
|
51 |
-
/**
|
52 |
-
* Direct Payments (Payflow Edition)
|
53 |
-
* @var string
|
54 |
-
*/
|
55 |
-
const METHOD_WPP_PE_DIRECT = 'laybuyuk_direct';
|
56 |
-
|
57 |
-
/**
|
58 |
-
* Express Checkout (Payflow Edition)
|
59 |
-
* @var string
|
60 |
-
*/
|
61 |
-
const METHOD_WPP_PE_EXPRESS = 'laybuyuk_express';
|
62 |
-
|
63 |
-
/**
|
64 |
-
* Payflow Pro Gateway
|
65 |
-
* @var string
|
66 |
-
*/
|
67 |
-
const METHOD_PAYFLOWPRO = 'verisign';
|
68 |
-
|
69 |
-
const METHOD_PAYFLOWLINK = 'payflow_link';
|
70 |
-
const METHOD_PAYFLOWADVANCED = 'payflow_advanced';
|
71 |
-
|
72 |
-
const METHOD_HOSTEDPRO = 'hosted_pro';
|
73 |
-
|
74 |
-
const METHOD_BILLING_AGREEMENT = 'laybuy_billing_agreement';
|
75 |
-
|
76 |
-
/**
|
77 |
-
* Buttons and images
|
78 |
-
* @var string
|
79 |
-
*/
|
80 |
-
const EC_FLAVOR_DYNAMIC = 'dynamic';
|
81 |
-
const EC_FLAVOR_STATIC = 'static';
|
82 |
-
const EC_BUTTON_TYPE_SHORTCUT = 'ecshortcut';
|
83 |
-
const EC_BUTTON_TYPE_MARK = 'ecmark';
|
84 |
-
const PAYMENT_MARK_37x23 = '37x23';
|
85 |
-
const PAYMENT_MARK_50x34 = '50x34';
|
86 |
-
const PAYMENT_MARK_60x38 = '60x38';
|
87 |
-
const PAYMENT_MARK_180x113 = '180x113';
|
88 |
-
|
89 |
-
const DEFAULT_LOGO_TYPE = 'wePrefer_150x60';
|
90 |
-
|
91 |
-
/**
|
92 |
-
* Payment actions
|
93 |
-
* @var string
|
94 |
-
*/
|
95 |
-
const PAYMENT_ACTION_SALE = 'Sale';
|
96 |
-
const PAYMENT_ACTION_ORDER = 'Order';
|
97 |
-
const PAYMENT_ACTION_AUTH = 'Authorization';
|
98 |
-
|
99 |
-
/**
|
100 |
-
* Authorization amounts for Account Verification
|
101 |
-
*
|
102 |
-
* @deprecated since 1.6.2.0
|
103 |
-
* @var int
|
104 |
-
*/
|
105 |
-
const AUTHORIZATION_AMOUNT_ZERO = 0;
|
106 |
-
const AUTHORIZATION_AMOUNT_ONE = 1;
|
107 |
-
const AUTHORIZATION_AMOUNT_FULL = 2;
|
108 |
-
|
109 |
-
/**
|
110 |
-
* Require Billing Address
|
111 |
-
* @var int
|
112 |
-
*/
|
113 |
-
const REQUIRE_BILLING_ADDRESS_NO = 0;
|
114 |
-
const REQUIRE_BILLING_ADDRESS_ALL = 1;
|
115 |
-
const REQUIRE_BILLING_ADDRESS_VIRTUAL = 2;
|
116 |
-
|
117 |
-
/**
|
118 |
-
* Fraud management actions
|
119 |
-
* @var string
|
120 |
-
*/
|
121 |
-
const FRAUD_ACTION_ACCEPT = 'Acept';
|
122 |
-
const FRAUD_ACTION_DENY = 'Deny';
|
123 |
-
|
124 |
-
/**
|
125 |
-
* Refund types
|
126 |
-
* @var string
|
127 |
-
*/
|
128 |
-
const REFUND_TYPE_FULL = 'Full';
|
129 |
-
const REFUND_TYPE_PARTIAL = 'Partial';
|
130 |
-
|
131 |
-
/**
|
132 |
-
* Express Checkout flows
|
133 |
-
* @var string
|
134 |
-
*/
|
135 |
-
const EC_SOLUTION_TYPE_SOLE = 'Sole';
|
136 |
-
const EC_SOLUTION_TYPE_MARK = 'Mark';
|
137 |
-
|
138 |
-
/**
|
139 |
-
* Payment data transfer methods (Standard)
|
140 |
-
*
|
141 |
-
* @var string
|
142 |
-
*/
|
143 |
-
const WPS_TRANSPORT_IPN = 'ipn';
|
144 |
-
const WPS_TRANSPORT_PDT = 'pdt';
|
145 |
-
const WPS_TRANSPORT_IPN_PDT = 'ipn_n_pdt';
|
146 |
-
|
147 |
-
/**
|
148 |
-
* Billing Agreement Signup
|
149 |
-
*
|
150 |
-
* @var string
|
151 |
-
*/
|
152 |
-
const EC_BA_SIGNUP_AUTO = 'auto';
|
153 |
-
const EC_BA_SIGNUP_ASK = 'ask';
|
154 |
-
const EC_BA_SIGNUP_NEVER = 'never';
|
155 |
-
|
156 |
-
/**
|
157 |
-
* Default URL for centinel API (PayPal Direct)
|
158 |
-
*
|
159 |
-
* @var string
|
160 |
-
*/
|
161 |
-
// public $centinelDefaultApiUrl = 'https://paypal.cardinalcommerce.com/maps/txns.asp';
|
162 |
-
|
163 |
-
/**
|
164 |
-
* Current payment method code
|
165 |
-
* @var string
|
166 |
-
*/
|
167 |
-
protected $_methodCode = null;
|
168 |
-
|
169 |
-
/**
|
170 |
-
* Current store id
|
171 |
-
*
|
172 |
-
* @var int
|
173 |
-
*/
|
174 |
-
protected $_storeId = null;
|
175 |
-
|
176 |
-
/**
|
177 |
-
* Instructions for generating proper BN code
|
178 |
-
*
|
179 |
-
* @var array
|
180 |
-
*/
|
181 |
-
protected $_buildNotationPPMap = array(
|
182 |
-
'paypal_standard' => 'WPS',
|
183 |
-
'paypal_express' => 'EC',
|
184 |
-
'paypal_direct' => 'DP',
|
185 |
-
'paypaluk_express' => 'EC',
|
186 |
-
'paypaluk_direct' => 'DP',
|
187 |
-
);
|
188 |
-
|
189 |
-
/**
|
190 |
-
* Style system config map (Express Checkout)
|
191 |
-
*
|
192 |
-
* @var array
|
193 |
-
*/
|
194 |
-
protected $_ecStyleConfigMap = array(
|
195 |
-
'page_style' => 'page_style',
|
196 |
-
'paypal_hdrimg' => 'hdrimg',
|
197 |
-
'paypal_hdrbordercolor' => 'hdrbordercolor',
|
198 |
-
'paypal_hdrbackcolor' => 'hdrbackcolor',
|
199 |
-
'paypal_payflowcolor' => 'payflowcolor',
|
200 |
-
);
|
201 |
-
|
202 |
-
/**
|
203 |
-
* Currency codes supported by PayPal methods
|
204 |
-
*
|
205 |
-
* @var array
|
206 |
-
*/
|
207 |
-
protected $_supportedCurrencyCodes = array('AUD', 'CAD', 'CZK', 'DKK', 'EUR', 'HKD', 'HUF', 'ILS', 'JPY', 'MXN',
|
208 |
-
'NOK', 'NZD', 'PLN', 'GBP', 'SGD', 'SEK', 'CHF', 'USD', 'TWD', 'THB');
|
209 |
-
|
210 |
-
/**
|
211 |
-
* Merchant country supported by PayPal
|
212 |
-
*
|
213 |
-
* @var array
|
214 |
-
*/
|
215 |
-
protected $_supportedCountryCodes = array(
|
216 |
-
'AE','AR','AT','AU','BE','BG','BR','CA','CH','CL','CR','CY','CZ','DE','DK','DO','EC','EE','ES','FI','FR','GB',
|
217 |
-
'GF','GI','GP','GR','HK','HU','ID','IE','IL','IN','IS','IT','JM','JP','KR','LI','LT','LU','LV','MQ','MT','MX',
|
218 |
-
'MY','NL','NO','NZ','PH','PL','PT','RE','RO','SE','SG','SI','SK','SM','TH','TR','TW','US','UY','VE','VN','ZA');
|
219 |
-
|
220 |
-
/**
|
221 |
-
* Buyer country supported by PayPal
|
222 |
-
*
|
223 |
-
* @var array
|
224 |
-
*/
|
225 |
-
protected $_supportedBuyerCountryCodes = array(
|
226 |
-
'AF ', 'AX ', 'AL ', 'DZ ', 'AS ', 'AD ', 'AO ', 'AI ', 'AQ ', 'AG ', 'AR ', 'AM ', 'AW ', 'AU ', 'AT ', 'AZ ',
|
227 |
-
'BS ', 'BH ', 'BD ', 'BB ', 'BY ', 'BE ', 'BZ ', 'BJ ', 'BM ', 'BT ', 'BO ', 'BA ', 'BW ', 'BV ', 'BR ', 'IO ',
|
228 |
-
'BN ', 'BG ', 'BF ', 'BI ', 'KH ', 'CM ', 'CA ', 'CV ', 'KY ', 'CF ', 'TD ', 'CL ', 'CN ', 'CX ', 'CC ', 'CO ',
|
229 |
-
'KM ', 'CG ', 'CD ', 'CK ', 'CR ', 'CI ', 'HR ', 'CU ', 'CY ', 'CZ ', 'DK ', 'DJ ', 'DM ', 'DO ', 'EC ', 'EG ',
|
230 |
-
'SV ', 'GQ ', 'ER ', 'EE ', 'ET ', 'FK ', 'FO ', 'FJ ', 'FI ', 'FR ', 'GF ', 'PF ', 'TF ', 'GA ', 'GM ', 'GE ',
|
231 |
-
'DE ', 'GH ', 'GI ', 'GR ', 'GL ', 'GD ', 'GP ', 'GU ', 'GT ', 'GG ', 'GN ', 'GW ', 'GY ', 'HT ', 'HM ', 'VA ',
|
232 |
-
'HN ', 'HK ', 'HU ', 'IS ', 'IN ', 'ID ', 'IR ', 'IQ ', 'IE ', 'IM ', 'IL ', 'IT ', 'JM ', 'JP ', 'JE ', 'JO ',
|
233 |
-
'KZ ', 'KE ', 'KI ', 'KP ', 'KR ', 'KW ', 'KG ', 'LA ', 'LV ', 'LB ', 'LS ', 'LR ', 'LY ', 'LI ', 'LT ', 'LU ',
|
234 |
-
'MO ', 'MK ', 'MG ', 'MW ', 'MY ', 'MV ', 'ML ', 'MT ', 'MH ', 'MQ ', 'MR ', 'MU ', 'YT ', 'MX ', 'FM ', 'MD ',
|
235 |
-
'MC ', 'MN ', 'MS ', 'MA ', 'MZ ', 'MM ', 'NA ', 'NR ', 'NP ', 'NL ', 'AN ', 'NC ', 'NZ ', 'NI ', 'NE ', 'NG ',
|
236 |
-
'NU ', 'NF ', 'MP ', 'NO ', 'OM ', 'PK ', 'PW ', 'PS ', 'PA ', 'PG ', 'PY ', 'PE ', 'PH ', 'PN ', 'PL ', 'PT ',
|
237 |
-
'PR ', 'QA ', 'RE ', 'RO ', 'RU ', 'RW ', 'SH ', 'KN ', 'LC ', 'PM ', 'VC ', 'WS ', 'SM ', 'ST ', 'SA ', 'SN ',
|
238 |
-
'CS ', 'SC ', 'SL ', 'SG ', 'SK ', 'SI ', 'SB ', 'SO ', 'ZA ', 'GS ', 'ES ', 'LK ', 'SD ', 'SR ', 'SJ ', 'SZ ',
|
239 |
-
'SE ', 'CH ', 'SY ', 'TW ', 'TJ ', 'TZ ', 'TH ', 'TL ', 'TG ', 'TK ', 'TO ', 'TT ', 'TN ', 'TR ', 'TM ', 'TC ',
|
240 |
-
'TV ', 'UG ', 'UA ', 'AE ', 'GB ', 'US ', 'UM ', 'UY ', 'UZ ', 'VU ', 'VE ', 'VN ', 'VG ', 'VI ', 'WF ', 'EH ',
|
241 |
-
'YE ', 'ZM ', 'ZW'
|
242 |
-
);
|
243 |
-
|
244 |
-
/**
|
245 |
-
* Locale codes supported by misc images (marks, shortcuts etc)
|
246 |
-
*
|
247 |
-
* @var array
|
248 |
-
* @link https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_ECButtonIntegration#id089QD0O0TX4__id08AH904I0YK
|
249 |
-
*/
|
250 |
-
protected $_supportedImageLocales = array('de_DE', 'en_AU', 'en_GB', 'en_US', 'es_ES', 'es_XC', 'fr_FR',
|
251 |
-
'fr_XC', 'it_IT', 'ja_JP', 'nl_NL', 'pl_PL', 'zh_CN', 'zh_XC',
|
252 |
-
);
|
253 |
-
|
254 |
-
/**
|
255 |
-
* Set method and store id, if specified
|
256 |
-
*
|
257 |
-
* @param array $params
|
258 |
-
*/
|
259 |
-
public function __construct($params = array())
|
260 |
-
{
|
261 |
-
if ($params) {
|
262 |
-
$method = array_shift($params);
|
263 |
-
$this->setMethod($method);
|
264 |
-
if ($params) {
|
265 |
-
$storeId = array_shift($params);
|
266 |
-
$this->setStoreId($storeId);
|
267 |
-
}
|
268 |
-
}
|
269 |
-
}
|
270 |
-
|
271 |
-
/**
|
272 |
-
* Method code setter
|
273 |
-
*
|
274 |
-
* @param string|Mage_Payment_Model_Method_Abstract $method
|
275 |
-
* @return Mage_Paypal_Model_Config
|
276 |
-
*/
|
277 |
-
public function setMethod($method)
|
278 |
-
{
|
279 |
-
if ($method instanceof Mage_Payment_Model_Method_Abstract) {
|
280 |
-
$this->_methodCode = $method->getCode();
|
281 |
-
} elseif (is_string($method)) {
|
282 |
-
$this->_methodCode = $method;
|
283 |
-
}
|
284 |
-
return $this;
|
285 |
-
}
|
286 |
-
|
287 |
-
/**
|
288 |
-
* Payment method instance code getter
|
289 |
-
*
|
290 |
-
* @return string
|
291 |
-
*/
|
292 |
-
public function getMethodCode()
|
293 |
-
{
|
294 |
-
return $this->_methodCode;
|
295 |
-
}
|
296 |
-
|
297 |
-
/**
|
298 |
-
* Store ID setter
|
299 |
-
*
|
300 |
-
* @param int $storeId
|
301 |
-
* @return Mage_Paypal_Model_Config
|
302 |
-
*/
|
303 |
-
public function setStoreId($storeId)
|
304 |
-
{
|
305 |
-
$this->_storeId = (int)$storeId;
|
306 |
-
return $this;
|
307 |
-
}
|
308 |
-
|
309 |
-
/**
|
310 |
-
* Check whether method active in configuration and supported for merchant country or not
|
311 |
-
*
|
312 |
-
* @param string $method Method code
|
313 |
-
* @return bool
|
314 |
-
*/
|
315 |
-
public function isMethodActive($method)
|
316 |
-
{
|
317 |
-
if ($this->isMethodSupportedForCountry($method)
|
318 |
-
&& Mage::getStoreConfigFlag("payment/{$method}/active", $this->_storeId)
|
319 |
-
) {
|
320 |
-
return true;
|
321 |
-
}
|
322 |
-
return false;
|
323 |
-
}
|
324 |
-
|
325 |
-
/**
|
326 |
-
* Check whether method available for checkout or not
|
327 |
-
* Logic based on merchant country, methods dependence
|
328 |
-
*
|
329 |
-
* @param string $method Method code
|
330 |
-
* @return bool
|
331 |
-
*/
|
332 |
-
public function isMethodAvailable($methodCode = null)
|
333 |
-
{
|
334 |
-
if ($methodCode === null) {
|
335 |
-
$methodCode = $this->getMethodCode();
|
336 |
-
}
|
337 |
-
|
338 |
-
$result = true;
|
339 |
-
|
340 |
-
if (!$this->isMethodActive($methodCode)) {
|
341 |
-
$result = false;
|
342 |
-
}
|
343 |
-
|
344 |
-
switch ($methodCode) {
|
345 |
-
case self::METHOD_WPS:
|
346 |
-
if (!$this->businessAccount) {
|
347 |
-
$result = false;
|
348 |
-
break;
|
349 |
-
}
|
350 |
-
// check for direct payments dependence
|
351 |
-
if ($this->isMethodActive(self::METHOD_WPP_DIRECT)
|
352 |
-
|| $this->isMethodActive(self::METHOD_WPP_PE_DIRECT)) {
|
353 |
-
$result = false;
|
354 |
-
}
|
355 |
-
break;
|
356 |
-
case self::METHOD_WPP_EXPRESS:
|
357 |
-
// check for direct payments dependence
|
358 |
-
if ($this->isMethodActive(self::METHOD_WPP_PE_DIRECT)) {
|
359 |
-
$result = false;
|
360 |
-
} elseif ($this->isMethodActive(self::METHOD_WPP_DIRECT)) {
|
361 |
-
$result = true;
|
362 |
-
}
|
363 |
-
break;
|
364 |
-
case self::METHOD_WPP_PE_EXPRESS:
|
365 |
-
// check for direct payments dependence
|
366 |
-
if ($this->isMethodActive(self::METHOD_WPP_PE_DIRECT)) {
|
367 |
-
$result = true;
|
368 |
-
} elseif (!$this->isMethodActive(self::METHOD_WPP_PE_DIRECT)
|
369 |
-
&& !$this->isMethodActive(self::METHOD_PAYFLOWPRO)) {
|
370 |
-
$result = false;
|
371 |
-
}
|
372 |
-
break;
|
373 |
-
case self::METHOD_BILLING_AGREEMENT:
|
374 |
-
$result = $this->isWppApiAvailabe();
|
375 |
-
break;
|
376 |
-
case self::METHOD_WPP_DIRECT:
|
377 |
-
case self::METHOD_WPP_PE_DIRECT:
|
378 |
-
break;
|
379 |
-
}
|
380 |
-
return $result;
|
381 |
-
}
|
382 |
-
|
383 |
-
/**
|
384 |
-
* Config field magic getter
|
385 |
-
* The specified key can be either in camelCase or under_score format
|
386 |
-
* Tries to map specified value according to set payment method code, into the configuration value
|
387 |
-
* Sets the values into public class parameters, to avoid redundant calls of this method
|
388 |
-
*
|
389 |
-
* @param string $key
|
390 |
-
* @return string|null
|
391 |
-
*/
|
392 |
-
public function __get($key)
|
393 |
-
{
|
394 |
-
$underscored = strtolower(preg_replace('/(.)([A-Z])/', "$1_$2", $key));
|
395 |
-
$value = Mage::getStoreConfig($this->_getSpecificConfigPath($underscored), $this->_storeId);
|
396 |
-
$value = $this->_prepareValue($underscored, $value);
|
397 |
-
$this->$key = $value;
|
398 |
-
$this->$underscored = $value;
|
399 |
-
return $value;
|
400 |
-
}
|
401 |
-
|
402 |
-
/**
|
403 |
-
* Perform additional config value preparation and return new value if needed
|
404 |
-
*
|
405 |
-
* @param string $key Underscored key
|
406 |
-
* @param string $value Old value
|
407 |
-
* @return string Modified value or old value
|
408 |
-
*/
|
409 |
-
protected function _prepareValue($key, $value)
|
410 |
-
{
|
411 |
-
// Always set payment action as "Sale" for Unilateral payments in EC
|
412 |
-
if ($key == 'payment_action'
|
413 |
-
&& $value != self::PAYMENT_ACTION_SALE
|
414 |
-
&& $this->_methodCode == self::METHOD_WPP_EXPRESS
|
415 |
-
&& $this->shouldUseUnilateralPayments())
|
416 |
-
{
|
417 |
-
return self::PAYMENT_ACTION_SALE;
|
418 |
-
}
|
419 |
-
return $value;
|
420 |
-
}
|
421 |
-
|
422 |
-
/**
|
423 |
-
* Return merchant country codes supported by PayPal
|
424 |
-
*
|
425 |
-
* @return array
|
426 |
-
*/
|
427 |
-
public function getSupportedMerchantCountryCodes()
|
428 |
-
{
|
429 |
-
return $this->_supportedCountryCodes;
|
430 |
-
}
|
431 |
-
|
432 |
-
/**
|
433 |
-
* Return buyer country codes supported by PayPal
|
434 |
-
*
|
435 |
-
* @return array
|
436 |
-
*/
|
437 |
-
public function getSupportedBuyerCountryCodes()
|
438 |
-
{
|
439 |
-
return $this->_supportedBuyerCountryCodes;
|
440 |
-
}
|
441 |
-
|
442 |
-
/**
|
443 |
-
* Return merchant country code, use default country if it not specified in General settings
|
444 |
-
*
|
445 |
-
* @return string
|
446 |
-
*/
|
447 |
-
public function getMerchantCountry()
|
448 |
-
{
|
449 |
-
$countryCode = Mage::getStoreConfig($this->_mapGeneralFieldset('merchant_country'), $this->_storeId);
|
450 |
-
if (!$countryCode) {
|
451 |
-
$countryCode = Mage::helper('core')->getDefaultCountry($this->_storeId);
|
452 |
-
}
|
453 |
-
return $countryCode;
|
454 |
-
}
|
455 |
-
|
456 |
-
/**
|
457 |
-
* Check whether method supported for specified country or not
|
458 |
-
* Use $_methodCode and merchant country by default
|
459 |
-
*
|
460 |
-
* @return bool
|
461 |
-
*/
|
462 |
-
public function isMethodSupportedForCountry($method = null, $countryCode = null)
|
463 |
-
{
|
464 |
-
if ($method === null) {
|
465 |
-
$method = $this->getMethodCode();
|
466 |
-
}
|
467 |
-
if ($countryCode === null) {
|
468 |
-
$countryCode = $this->getMerchantCountry();
|
469 |
-
}
|
470 |
-
$countryMethods = $this->getCountryMethods($countryCode);
|
471 |
-
if (in_array($method, $countryMethods)) {
|
472 |
-
return true;
|
473 |
-
}
|
474 |
-
return false;
|
475 |
-
}
|
476 |
-
|
477 |
-
/**
|
478 |
-
* Return list of allowed methods for specified country iso code
|
479 |
-
*
|
480 |
-
* @param string $countryCode 2-letters iso code
|
481 |
-
* @return array
|
482 |
-
*/
|
483 |
-
public function getCountryMethods($countryCode = null)
|
484 |
-
{
|
485 |
-
$countryMethods = array(
|
486 |
-
'other' => array(
|
487 |
-
self::METHOD_WPS,
|
488 |
-
self::METHOD_WPP_EXPRESS,
|
489 |
-
self::METHOD_BILLING_AGREEMENT,
|
490 |
-
),
|
491 |
-
'US' => array(
|
492 |
-
self::METHOD_PAYFLOWADVANCED,
|
493 |
-
self::METHOD_WPP_DIRECT,
|
494 |
-
self::METHOD_WPS,
|
495 |
-
self::METHOD_PAYFLOWPRO,
|
496 |
-
self::METHOD_PAYFLOWLINK,
|
497 |
-
self::METHOD_WPP_EXPRESS,
|
498 |
-
self::METHOD_BILLING_AGREEMENT,
|
499 |
-
self::METHOD_WPP_PE_EXPRESS,
|
500 |
-
),
|
501 |
-
'CA' => array(
|
502 |
-
self::METHOD_WPP_DIRECT,
|
503 |
-
self::METHOD_WPS,
|
504 |
-
self::METHOD_PAYFLOWPRO,
|
505 |
-
self::METHOD_PAYFLOWLINK,
|
506 |
-
self::METHOD_WPP_EXPRESS,
|
507 |
-
self::METHOD_BILLING_AGREEMENT,
|
508 |
-
),
|
509 |
-
'GB' => array(
|
510 |
-
self::METHOD_WPP_DIRECT,
|
511 |
-
self::METHOD_WPS,
|
512 |
-
self::METHOD_WPP_PE_DIRECT,
|
513 |
-
self::METHOD_HOSTEDPRO,
|
514 |
-
self::METHOD_WPP_EXPRESS,
|
515 |
-
self::METHOD_BILLING_AGREEMENT,
|
516 |
-
self::METHOD_WPP_PE_EXPRESS,
|
517 |
-
),
|
518 |
-
'AU' => array(
|
519 |
-
self::METHOD_WPS,
|
520 |
-
self::METHOD_PAYFLOWPRO,
|
521 |
-
self::METHOD_HOSTEDPRO,
|
522 |
-
self::METHOD_WPP_EXPRESS,
|
523 |
-
self::METHOD_BILLING_AGREEMENT,
|
524 |
-
),
|
525 |
-
'NZ' => array(
|
526 |
-
self::METHOD_WPS,
|
527 |
-
self::METHOD_PAYFLOWPRO,
|
528 |
-
self::METHOD_WPP_EXPRESS,
|
529 |
-
self::METHOD_BILLING_AGREEMENT,
|
530 |
-
),
|
531 |
-
'JP' => array(
|
532 |
-
self::METHOD_WPS,
|
533 |
-
self::METHOD_HOSTEDPRO,
|
534 |
-
self::METHOD_WPP_EXPRESS,
|
535 |
-
self::METHOD_BILLING_AGREEMENT,
|
536 |
-
),
|
537 |
-
'FR' => array(
|
538 |
-
self::METHOD_WPS,
|
539 |
-
self::METHOD_HOSTEDPRO,
|
540 |
-
self::METHOD_WPP_EXPRESS,
|
541 |
-
self::METHOD_BILLING_AGREEMENT,
|
542 |
-
),
|
543 |
-
'IT' => array(
|
544 |
-
self::METHOD_WPS,
|
545 |
-
self::METHOD_HOSTEDPRO,
|
546 |
-
self::METHOD_WPP_EXPRESS,
|
547 |
-
self::METHOD_BILLING_AGREEMENT,
|
548 |
-
),
|
549 |
-
'ES' => array(
|
550 |
-
self::METHOD_WPS,
|
551 |
-
self::METHOD_HOSTEDPRO,
|
552 |
-
self::METHOD_WPP_EXPRESS,
|
553 |
-
self::METHOD_BILLING_AGREEMENT,
|
554 |
-
),
|
555 |
-
'HK' => array(
|
556 |
-
self::METHOD_WPS,
|
557 |
-
self::METHOD_HOSTEDPRO,
|
558 |
-
self::METHOD_WPP_EXPRESS,
|
559 |
-
self::METHOD_BILLING_AGREEMENT,
|
560 |
-
),
|
561 |
-
);
|
562 |
-
if ($countryCode === null) {
|
563 |
-
return $countryMethods;
|
564 |
-
}
|
565 |
-
return isset($countryMethods[$countryCode]) ? $countryMethods[$countryCode] : $countryMethods['other']; }
|
566 |
-
|
567 |
-
/**
|
568 |
-
* Get url for dispatching customer to express checkout start
|
569 |
-
*
|
570 |
-
* @param string $token
|
571 |
-
* @return string
|
572 |
-
*/
|
573 |
-
public function getExpressCheckoutStartUrl($token)
|
574 |
-
{
|
575 |
-
return $this->getPaypalUrl(array(
|
576 |
-
'cmd' => '_express-checkout',
|
577 |
-
'token' => $token,
|
578 |
-
));
|
579 |
-
}
|
580 |
-
|
581 |
-
/**
|
582 |
-
* Get url that allows to edit checkout details on paypal side
|
583 |
-
*
|
584 |
-
* @param $token
|
585 |
-
* @return string
|
586 |
-
*/
|
587 |
-
public function getExpressCheckoutEditUrl($token)
|
588 |
-
{
|
589 |
-
return $this->getPaypalUrl(array(
|
590 |
-
'cmd' => '_express-checkout',
|
591 |
-
'useraction' => 'continue',
|
592 |
-
'token' => $token,
|
593 |
-
));
|
594 |
-
}
|
595 |
-
|
596 |
-
/**
|
597 |
-
* Get url for additional actions that PayPal may require customer to do after placing the order.
|
598 |
-
* For instance, redirecting customer to bank for payment confirmation.
|
599 |
-
*
|
600 |
-
* @param string $token
|
601 |
-
* @return string
|
602 |
-
*/
|
603 |
-
public function getExpressCheckoutCompleteUrl($token)
|
604 |
-
{
|
605 |
-
return $this->getPaypalUrl(array(
|
606 |
-
'cmd' => '_complete-express-checkout',
|
607 |
-
'token' => $token,
|
608 |
-
));
|
609 |
-
}
|
610 |
-
|
611 |
-
/**
|
612 |
-
* Retrieve url for initialization of billing agreement
|
613 |
-
*
|
614 |
-
* @param string $token
|
615 |
-
* @return string
|
616 |
-
*/
|
617 |
-
public function getStartBillingAgreementUrl($token)
|
618 |
-
{
|
619 |
-
return $this->getPaypalUrl(array(
|
620 |
-
'cmd' => '_customer-billing-agreement',
|
621 |
-
'token' => $token,
|
622 |
-
));
|
623 |
-
}
|
624 |
-
|
625 |
-
/**
|
626 |
-
* PayPal web URL generic getter
|
627 |
-
*
|
628 |
-
* @param array $params
|
629 |
-
* @return string
|
630 |
-
*/
|
631 |
-
public function getPaypalUrl(array $params = array())
|
632 |
-
{
|
633 |
-
return sprintf('https://www.%spaypal.com/cgi-bin/webscr%s',
|
634 |
-
$this->sandboxFlag ? 'sandbox.' : '',
|
635 |
-
$params ? '?' . http_build_query($params) : ''
|
636 |
-
);
|
637 |
-
}
|
638 |
-
|
639 |
-
/**
|
640 |
-
* Whether Express Checkout button should be rendered dynamically
|
641 |
-
*
|
642 |
-
* @return bool
|
643 |
-
*/
|
644 |
-
public function areButtonsDynamic()
|
645 |
-
{
|
646 |
-
return $this->buttonFlavor === self::EC_FLAVOR_DYNAMIC;
|
647 |
-
}
|
648 |
-
|
649 |
-
/**
|
650 |
-
* Express checkout shortcut pic URL getter
|
651 |
-
* PayPal will ignore "pal", if there is no total amount specified
|
652 |
-
*
|
653 |
-
* @param string $localeCode
|
654 |
-
* @param float $orderTotal
|
655 |
-
* @param string $pal encrypted summary about merchant
|
656 |
-
* @see Paypal_Model_Api_Nvp::callGetPalDetails()
|
657 |
-
*/
|
658 |
-
public function getExpressCheckoutShortcutImageUrl($localeCode, $orderTotal = null, $pal = null)
|
659 |
-
{
|
660 |
-
if ($this->areButtonsDynamic()) {
|
661 |
-
return $this->_getDynamicImageUrl(self::EC_BUTTON_TYPE_SHORTCUT, $localeCode, $orderTotal, $pal);
|
662 |
-
}
|
663 |
-
if ($this->buttonType === self::EC_BUTTON_TYPE_MARK) {
|
664 |
-
return $this->getPaymentMarkImageUrl($localeCode);
|
665 |
-
}
|
666 |
-
return sprintf('https://www.paypal.com/%s/i/btn/btn_xpressCheckout.gif',
|
667 |
-
$this->_getSupportedLocaleCode($localeCode));
|
668 |
-
}
|
669 |
-
|
670 |
-
/**
|
671 |
-
* Get PayPal "mark" image URL
|
672 |
-
* Supposed to be used on payment methods selection
|
673 |
-
* $staticSize is applicable for static images only
|
674 |
-
*
|
675 |
-
* @param string $localeCode
|
676 |
-
* @param float $orderTotal
|
677 |
-
* @param string $pal
|
678 |
-
* @param string $staticSize
|
679 |
-
*/
|
680 |
-
public function getPaymentMarkImageUrl($localeCode, $orderTotal = null, $pal = null, $staticSize = null)
|
681 |
-
{
|
682 |
-
if ($this->areButtonsDynamic()) {
|
683 |
-
return $this->_getDynamicImageUrl(self::EC_BUTTON_TYPE_MARK, $localeCode, $orderTotal, $pal);
|
684 |
-
}
|
685 |
-
|
686 |
-
if (null === $staticSize) {
|
687 |
-
$staticSize = $this->paymentMarkSize;
|
688 |
-
}
|
689 |
-
switch ($staticSize) {
|
690 |
-
case self::PAYMENT_MARK_37x23:
|
691 |
-
case self::PAYMENT_MARK_50x34:
|
692 |
-
case self::PAYMENT_MARK_60x38:
|
693 |
-
case self::PAYMENT_MARK_180x113:
|
694 |
-
break;
|
695 |
-
default:
|
696 |
-
$staticSize = self::PAYMENT_MARK_37x23;
|
697 |
-
}
|
698 |
-
return sprintf('https://www.paypal.com/%s/i/logo/PayPal_mark_%s.gif',
|
699 |
-
$this->_getSupportedLocaleCode($localeCode), $staticSize);
|
700 |
-
}
|
701 |
-
|
702 |
-
/**
|
703 |
-
* Get "What Is PayPal" localized URL
|
704 |
-
* Supposed to be used with "mark" as popup window
|
705 |
-
*
|
706 |
-
* @param Mage_Core_Model_Locale $locale
|
707 |
-
*/
|
708 |
-
public function getPaymentMarkWhatIsPaypalUrl(Mage_Core_Model_Locale $locale = null)
|
709 |
-
{
|
710 |
-
$countryCode = 'US';
|
711 |
-
if (null !== $locale) {
|
712 |
-
$shouldEmulate = (null !== $this->_storeId) && (Mage::app()->getStore()->getId() != $this->_storeId);
|
713 |
-
if ($shouldEmulate) {
|
714 |
-
$locale->emulate($this->_storeId);
|
715 |
-
}
|
716 |
-
$countryCode = $locale->getLocale()->getRegion();
|
717 |
-
if ($shouldEmulate) {
|
718 |
-
$locale->revert();
|
719 |
-
}
|
720 |
-
}
|
721 |
-
return sprintf('https://www.paypal.com/%s/cgi-bin/webscr?cmd=xpt/Marketing/popup/OLCWhatIsPayPal-outside',
|
722 |
-
strtolower($countryCode)
|
723 |
-
);
|
724 |
-
}
|
725 |
-
|
726 |
-
/**
|
727 |
-
* Getter for Solution banner images
|
728 |
-
*
|
729 |
-
* @param string $localeCode
|
730 |
-
* @param bool $isVertical
|
731 |
-
* @param bool $isEcheck
|
732 |
-
*/
|
733 |
-
public function getSolutionImageUrl($localeCode, $isVertical = false, $isEcheck = false)
|
734 |
-
{
|
735 |
-
return sprintf('https://www.paypal.com/%s/i/bnr/%s_solution_PP%s.gif',
|
736 |
-
$this->_getSupportedLocaleCode($localeCode),
|
737 |
-
$isVertical ? 'vertical' : 'horizontal', $isEcheck ? 'eCheck' : ''
|
738 |
-
);
|
739 |
-
}
|
740 |
-
|
741 |
-
/**
|
742 |
-
* Getter for Payment form logo images
|
743 |
-
*
|
744 |
-
* @param string $localeCode
|
745 |
-
*/
|
746 |
-
public function getPaymentFormLogoUrl($localeCode)
|
747 |
-
{
|
748 |
-
$locale = $this->_getSupportedLocaleCode($localeCode);
|
749 |
-
|
750 |
-
$imageType = 'logo';
|
751 |
-
$domain = 'paypal.com';
|
752 |
-
list (,$country) = explode('_', $locale);
|
753 |
-
$countryPrefix = $country . '/';
|
754 |
-
|
755 |
-
switch ($locale) {
|
756 |
-
case 'en_GB':
|
757 |
-
$imageName = 'horizontal_solution_PP';
|
758 |
-
$imageType = 'bnr';
|
759 |
-
$countryPrefix = '';
|
760 |
-
break;
|
761 |
-
case 'de_DE':
|
762 |
-
$imageName = 'lockbox_150x47';
|
763 |
-
break;
|
764 |
-
case 'fr_FR':
|
765 |
-
$imageName = 'bnr_horizontal_solution_PP_327wx80h';
|
766 |
-
$imageType = 'bnr';
|
767 |
-
$locale = 'en_US';
|
768 |
-
$domain = 'paypalobjects.com';
|
769 |
-
break;
|
770 |
-
case 'it_IT':
|
771 |
-
$imageName = 'bnr_horizontal_solution_PP_178wx80h';
|
772 |
-
$imageType = 'bnr';
|
773 |
-
$domain = 'paypalobjects.com';
|
774 |
-
break;
|
775 |
-
default:
|
776 |
-
$imageName='PayPal_mark_60x38';
|
777 |
-
$countryPrefix = '';
|
778 |
-
break;
|
779 |
-
}
|
780 |
-
return sprintf('https://www.%s/%s/%si/%s/%s.gif', $domain, $locale, $countryPrefix, $imageType, $imageName);
|
781 |
-
}
|
782 |
-
|
783 |
-
/**
|
784 |
-
* Return supported types for PayPal logo
|
785 |
-
*
|
786 |
-
* @return array
|
787 |
-
*/
|
788 |
-
public function getAdditionalOptionsLogoTypes()
|
789 |
-
{
|
790 |
-
return array(
|
791 |
-
'wePrefer_150x60' => Mage::helper('paypal')->__('We prefer PayPal (150 X 60)'),
|
792 |
-
'wePrefer_150x40' => Mage::helper('paypal')->__('We prefer PayPal (150 X 40)'),
|
793 |
-
'nowAccepting_150x60' => Mage::helper('paypal')->__('Now accepting PayPal (150 X 60)'),
|
794 |
-
'nowAccepting_150x40' => Mage::helper('paypal')->__('Now accepting PayPal (150 X 40)'),
|
795 |
-
'paymentsBy_150x60' => Mage::helper('paypal')->__('Payments by PayPal (150 X 60)'),
|
796 |
-
'paymentsBy_150x40' => Mage::helper('paypal')->__('Payments by PayPal (150 X 40)'),
|
797 |
-
'shopNowUsing_150x60' => Mage::helper('paypal')->__('Shop now using (150 X 60)'),
|
798 |
-
'shopNowUsing_150x40' => Mage::helper('paypal')->__('Shop now using (150 X 40)'),
|
799 |
-
);
|
800 |
-
}
|
801 |
-
|
802 |
-
/**
|
803 |
-
* Return PayPal logo URL with additional options
|
804 |
-
*
|
805 |
-
* @param string $localeCode Supported locale code
|
806 |
-
* @param string $type One of supported logo types
|
807 |
-
* @return string|bool Logo Image URL or false if logo disabled in configuration
|
808 |
-
*/
|
809 |
-
public function getAdditionalOptionsLogoUrl($localeCode, $type = false)
|
810 |
-
{
|
811 |
-
$configType = Mage::getStoreConfig($this->_mapGenericStyleFieldset('logo'), $this->_storeId);
|
812 |
-
if (!$configType) {
|
813 |
-
return false;
|
814 |
-
}
|
815 |
-
$type = $type ? $type : $configType;
|
816 |
-
$locale = $this->_getSupportedLocaleCode($localeCode);
|
817 |
-
$supportedTypes = array_keys($this->getAdditionalOptionsLogoTypes());
|
818 |
-
if (!in_array($type, $supportedTypes)) {
|
819 |
-
$type = self::DEFAULT_LOGO_TYPE;
|
820 |
-
}
|
821 |
-
return sprintf('https://www.paypalobjects.com/%s/i/bnr/bnr_%s.gif', $locale, $type);
|
822 |
-
}
|
823 |
-
|
824 |
-
/**
|
825 |
-
* BN code getter
|
826 |
-
*
|
827 |
-
* @param string $countryCode ISO 3166-1
|
828 |
-
*/
|
829 |
-
public function getBuildNotationCode($countryCode = null)
|
830 |
-
{
|
831 |
-
$product = 'WPP';
|
832 |
-
if ($this->_methodCode && isset($this->_buildNotationPPMap[$this->_methodCode])) {
|
833 |
-
$product = $this->_buildNotationPPMap[$this->_methodCode];
|
834 |
-
}
|
835 |
-
if (null === $countryCode) {
|
836 |
-
$countryCode = $this->_matchBnCountryCode($this->getMerchantCountry());
|
837 |
-
}
|
838 |
-
if ($countryCode) {
|
839 |
-
$countryCode = '_' . $countryCode;
|
840 |
-
}
|
841 |
-
return sprintf('Varien_Cart_%s%s', $product, $countryCode);
|
842 |
-
}
|
843 |
-
|
844 |
-
/**
|
845 |
-
* Express Checkout button "flavors" source getter
|
846 |
-
*
|
847 |
-
* @return array
|
848 |
-
*/
|
849 |
-
public function getExpressCheckoutButtonFlavors()
|
850 |
-
{
|
851 |
-
return array(
|
852 |
-
self::EC_FLAVOR_DYNAMIC => Mage::helper('paypal')->__('Dynamic'),
|
853 |
-
self::EC_FLAVOR_STATIC => Mage::helper('paypal')->__('Static'),
|
854 |
-
);
|
855 |
-
}
|
856 |
-
|
857 |
-
/**
|
858 |
-
* Express Checkout button types source getter
|
859 |
-
*
|
860 |
-
* @return array
|
861 |
-
*/
|
862 |
-
public function getExpressCheckoutButtonTypes()
|
863 |
-
{
|
864 |
-
return array(
|
865 |
-
self::EC_BUTTON_TYPE_SHORTCUT => Mage::helper('paypal')->__('Shortcut'),
|
866 |
-
self::EC_BUTTON_TYPE_MARK => Mage::helper('paypal')->__('Acceptance Mark Image'),
|
867 |
-
);
|
868 |
-
}
|
869 |
-
|
870 |
-
/**
|
871 |
-
* Payment actions source getter
|
872 |
-
*
|
873 |
-
* @return array
|
874 |
-
*/
|
875 |
-
public function getPaymentActions()
|
876 |
-
{
|
877 |
-
$paymentActions = array(
|
878 |
-
self::PAYMENT_ACTION_AUTH => Mage::helper('paypal')->__('Authorization'),
|
879 |
-
self::PAYMENT_ACTION_SALE => Mage::helper('paypal')->__('Sale')
|
880 |
-
);
|
881 |
-
if (!is_null($this->_methodCode) && $this->_methodCode == self::METHOD_WPP_EXPRESS) {
|
882 |
-
$paymentActions[self::PAYMENT_ACTION_ORDER] = Mage::helper('paypal')->__('Order');
|
883 |
-
}
|
884 |
-
return $paymentActions;
|
885 |
-
}
|
886 |
-
|
887 |
-
/**
|
888 |
-
* Require Billing Address source getter
|
889 |
-
*
|
890 |
-
* @return array
|
891 |
-
*/
|
892 |
-
public function getRequireBillingAddressOptions()
|
893 |
-
{
|
894 |
-
return array(
|
895 |
-
self::REQUIRE_BILLING_ADDRESS_ALL => Mage::helper('paypal')->__('Yes'),
|
896 |
-
self::REQUIRE_BILLING_ADDRESS_NO => Mage::helper('paypal')->__('No'),
|
897 |
-
self::REQUIRE_BILLING_ADDRESS_VIRTUAL => Mage::helper('paypal')->__('For Virtual Quotes Only'),
|
898 |
-
);
|
899 |
-
}
|
900 |
-
|
901 |
-
/**
|
902 |
-
* Mapper from PayPal-specific payment actions to Magento payment actions
|
903 |
-
*
|
904 |
-
* @return string|null
|
905 |
-
*/
|
906 |
-
public function getPaymentAction()
|
907 |
-
{
|
908 |
-
switch ($this->paymentAction) {
|
909 |
-
case self::PAYMENT_ACTION_AUTH:
|
910 |
-
return Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE;
|
911 |
-
case self::PAYMENT_ACTION_SALE:
|
912 |
-
return Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE_CAPTURE;
|
913 |
-
case self::PAYMENT_ACTION_ORDER:
|
914 |
-
return Mage_Payment_Model_Method_Abstract::ACTION_ORDER;
|
915 |
-
}
|
916 |
-
}
|
917 |
-
|
918 |
-
/**
|
919 |
-
* Returns array of possible Authorization Amounts for Account Verification
|
920 |
-
*
|
921 |
-
* @deprecated since 1.6.2.0
|
922 |
-
* @return array
|
923 |
-
*/
|
924 |
-
public function getAuthorizationAmounts()
|
925 |
-
{
|
926 |
-
return array();
|
927 |
-
}
|
928 |
-
|
929 |
-
/**
|
930 |
-
* Express Checkout "solution types" source getter
|
931 |
-
* "sole" = "Express Checkout for Auctions" - PayPal allows guest checkout
|
932 |
-
* "mark" = "Normal Express Checkout" - PayPal requires to checkout with PayPal buyer account only
|
933 |
-
*
|
934 |
-
* @return array
|
935 |
-
*/
|
936 |
-
public function getExpressCheckoutSolutionTypes()
|
937 |
-
{
|
938 |
-
return array(
|
939 |
-
self::EC_SOLUTION_TYPE_SOLE => Mage::helper('paypal')->__('Yes'),
|
940 |
-
self::EC_SOLUTION_TYPE_MARK => Mage::helper('paypal')->__('No'),
|
941 |
-
);
|
942 |
-
}
|
943 |
-
|
944 |
-
/**
|
945 |
-
* Retrieve express checkout billing agreement signup options
|
946 |
-
*
|
947 |
-
* @return array
|
948 |
-
*/
|
949 |
-
public function getExpressCheckoutBASignupOptions()
|
950 |
-
{
|
951 |
-
return array(
|
952 |
-
self::EC_BA_SIGNUP_AUTO => Mage::helper('paypal')->__('Auto'),
|
953 |
-
self::EC_BA_SIGNUP_ASK => Mage::helper('paypal')->__('Ask Customer'),
|
954 |
-
self::EC_BA_SIGNUP_NEVER => Mage::helper('paypal')->__('Never')
|
955 |
-
);
|
956 |
-
}
|
957 |
-
|
958 |
-
/**
|
959 |
-
* Whether to ask customer to create billing agreements
|
960 |
-
* Unilateral payments are incompatible with the billing agreements
|
961 |
-
*
|
962 |
-
* @return bool
|
963 |
-
*/
|
964 |
-
public function shouldAskToCreateBillingAgreement()
|
965 |
-
{
|
966 |
-
return ($this->allow_ba_signup === self::EC_BA_SIGNUP_ASK) && !$this->shouldUseUnilateralPayments();
|
967 |
-
}
|
968 |
-
|
969 |
-
/**
|
970 |
-
* Check whether only Unilateral payments (Accelerated Boarding) possible for Express method or not
|
971 |
-
*
|
972 |
-
* @return bool
|
973 |
-
*/
|
974 |
-
public function shouldUseUnilateralPayments()
|
975 |
-
{
|
976 |
-
return $this->business_account && !$this->isWppApiAvailabe();
|
977 |
-
}
|
978 |
-
|
979 |
-
/**
|
980 |
-
* Check whether WPP API credentials are available for this method
|
981 |
-
*
|
982 |
-
* @return bool
|
983 |
-
*/
|
984 |
-
public function isWppApiAvailabe()
|
985 |
-
{
|
986 |
-
return $this->api_username && $this->api_password && ($this->api_signature || $this->api_cert);
|
987 |
-
}
|
988 |
-
|
989 |
-
/**
|
990 |
-
* Payment data delivery methods getter for PayPal Standard
|
991 |
-
*
|
992 |
-
* @return array
|
993 |
-
*/
|
994 |
-
public function getWpsPaymentDeliveryMethods()
|
995 |
-
{
|
996 |
-
return array(
|
997 |
-
self::WPS_TRANSPORT_IPN => Mage::helper('adminhtml')->__('IPN (Instant Payment Notification) Only'),
|
998 |
-
// not supported yet:
|
999 |
-
// self::WPS_TRANSPORT_PDT => Mage::helper('adminhtml')->__('PDT (Payment Data Transfer) Only'),
|
1000 |
-
// self::WPS_TRANSPORT_IPN_PDT => Mage::helper('adminhtml')->__('Both IPN and PDT'),
|
1001 |
-
);
|
1002 |
-
}
|
1003 |
-
|
1004 |
-
/**
|
1005 |
-
* Return list of supported credit card types by Paypal Direct gateway
|
1006 |
-
*
|
1007 |
-
* @return array
|
1008 |
-
*/
|
1009 |
-
public function getWppCcTypesAsOptionArray()
|
1010 |
-
{
|
1011 |
-
$model = Mage::getModel('payment/source_cctype')->setAllowedTypes(array('AE', 'VI', 'MC', 'SM', 'SO', 'DI'));
|
1012 |
-
return $model->toOptionArray();
|
1013 |
-
}
|
1014 |
-
|
1015 |
-
/**
|
1016 |
-
* Return list of supported credit card types by Paypal Direct (Payflow Edition) gateway
|
1017 |
-
*
|
1018 |
-
* @return array
|
1019 |
-
*/
|
1020 |
-
public function getWppPeCcTypesAsOptionArray()
|
1021 |
-
{
|
1022 |
-
$model = Mage::getModel('payment/source_cctype')->setAllowedTypes(array('VI', 'MC', 'SM', 'SO', 'OT', 'AE'));
|
1023 |
-
return $model->toOptionArray();
|
1024 |
-
}
|
1025 |
-
|
1026 |
-
/**
|
1027 |
-
* Return list of supported credit card types by Payflow Pro gateway
|
1028 |
-
*
|
1029 |
-
* @return array
|
1030 |
-
*/
|
1031 |
-
public function getPayflowproCcTypesAsOptionArray()
|
1032 |
-
{
|
1033 |
-
$model = Mage::getModel('payment/source_cctype')->setAllowedTypes(array('AE', 'VI', 'MC', 'JCB', 'DI'));
|
1034 |
-
return $model->toOptionArray();
|
1035 |
-
}
|
1036 |
-
|
1037 |
-
/**
|
1038 |
-
* Check whether the specified payment method is a CC-based one
|
1039 |
-
*
|
1040 |
-
* @param string $code
|
1041 |
-
* @return bool
|
1042 |
-
*/
|
1043 |
-
public static function getIsCreditCardMethod($code)
|
1044 |
-
{
|
1045 |
-
switch ($code) {
|
1046 |
-
case self::METHOD_WPP_DIRECT:
|
1047 |
-
case self::METHOD_WPP_PE_DIRECT:
|
1048 |
-
case self::METHOD_PAYFLOWPRO:
|
1049 |
-
case self::METHOD_PAYFLOWLINK:
|
1050 |
-
case self::METHOD_PAYFLOWADVANCED:
|
1051 |
-
case self::METHOD_HOSTEDPRO:
|
1052 |
-
return true;
|
1053 |
-
}
|
1054 |
-
return false;
|
1055 |
-
}
|
1056 |
-
|
1057 |
-
/**
|
1058 |
-
* Check whether specified currency code is supported
|
1059 |
-
*
|
1060 |
-
* @param string $code
|
1061 |
-
* @return bool
|
1062 |
-
*/
|
1063 |
-
public function isCurrencyCodeSupported($code)
|
1064 |
-
{
|
1065 |
-
if (in_array($code, $this->_supportedCurrencyCodes)) {
|
1066 |
-
return true;
|
1067 |
-
}
|
1068 |
-
if ($this->getMerchantCountry() == 'BR' && $code == 'BRL') {
|
1069 |
-
return true;
|
1070 |
-
}
|
1071 |
-
if ($this->getMerchantCountry() == 'MY' && $code == 'MYR') {
|
1072 |
-
return true;
|
1073 |
-
}
|
1074 |
-
return false;
|
1075 |
-
}
|
1076 |
-
|
1077 |
-
/**
|
1078 |
-
* Export page style current settings to specified object
|
1079 |
-
*
|
1080 |
-
* @param Varien_Object $to
|
1081 |
-
*/
|
1082 |
-
public function exportExpressCheckoutStyleSettings(Varien_Object $to)
|
1083 |
-
{
|
1084 |
-
foreach ($this->_ecStyleConfigMap as $key => $exportKey) {
|
1085 |
-
if ($this->$key) {
|
1086 |
-
$to->setData($exportKey, $this->$key);
|
1087 |
-
}
|
1088 |
-
}
|
1089 |
-
}
|
1090 |
-
|
1091 |
-
/**
|
1092 |
-
* Dynamic PayPal image URL getter
|
1093 |
-
* Also can render dynamic Acceptance Mark
|
1094 |
-
*
|
1095 |
-
* @param string $type
|
1096 |
-
* @param string $localeCode
|
1097 |
-
* @param float $orderTotal
|
1098 |
-
* @param string $pal
|
1099 |
-
*/
|
1100 |
-
protected function _getDynamicImageUrl($type, $localeCode, $orderTotal, $pal)
|
1101 |
-
{
|
1102 |
-
$params = array(
|
1103 |
-
'cmd' => '_dynamic-image',
|
1104 |
-
'buttontype' => $type,
|
1105 |
-
'locale' => $this->_getSupportedLocaleCode($localeCode),
|
1106 |
-
);
|
1107 |
-
if ($orderTotal) {
|
1108 |
-
$params['ordertotal'] = sprintf('%.2F', $orderTotal);
|
1109 |
-
if ($pal) {
|
1110 |
-
$params['pal'] = $pal;
|
1111 |
-
}
|
1112 |
-
}
|
1113 |
-
return sprintf('https://fpdbs%s.paypal.com/dynamicimageweb?%s',
|
1114 |
-
$this->sandboxFlag ? '.sandbox' : '', http_build_query($params)
|
1115 |
-
);
|
1116 |
-
}
|
1117 |
-
|
1118 |
-
/**
|
1119 |
-
* Check whether specified locale code is supported. Fallback to en_US
|
1120 |
-
*
|
1121 |
-
* @param string $localeCode
|
1122 |
-
* @return string
|
1123 |
-
*/
|
1124 |
-
protected function _getSupportedLocaleCode($localeCode = null)
|
1125 |
-
{
|
1126 |
-
if (!$localeCode || !in_array($localeCode, $this->_supportedImageLocales)) {
|
1127 |
-
return 'en_US';
|
1128 |
-
}
|
1129 |
-
return $localeCode;
|
1130 |
-
}
|
1131 |
-
|
1132 |
-
/**
|
1133 |
-
* Map any supported payment method into a config path by specified field name
|
1134 |
-
*
|
1135 |
-
* @param string $fieldName
|
1136 |
-
* @return string|null
|
1137 |
-
*/
|
1138 |
-
protected function _getSpecificConfigPath($fieldName)
|
1139 |
-
{
|
1140 |
-
$path = null;
|
1141 |
-
switch ($this->_methodCode) {
|
1142 |
-
case self::METHOD_WPS:
|
1143 |
-
$path = $this->_mapStandardFieldset($fieldName);
|
1144 |
-
break;
|
1145 |
-
case self::METHOD_WPP_EXPRESS:
|
1146 |
-
case self::METHOD_WPP_PE_EXPRESS:
|
1147 |
-
$path = $this->_mapExpressFieldset($fieldName);
|
1148 |
-
break;
|
1149 |
-
case self::METHOD_WPP_DIRECT:
|
1150 |
-
case self::METHOD_WPP_PE_DIRECT:
|
1151 |
-
$path = $this->_mapDirectFieldset($fieldName);
|
1152 |
-
break;
|
1153 |
-
case self::METHOD_BILLING_AGREEMENT:
|
1154 |
-
case self::METHOD_HOSTEDPRO:
|
1155 |
-
$path = $this->_mapMethodFieldset($fieldName);
|
1156 |
-
break;
|
1157 |
-
}
|
1158 |
-
|
1159 |
-
if ($path === null) {
|
1160 |
-
switch ($this->_methodCode) {
|
1161 |
-
case self::METHOD_WPP_EXPRESS:
|
1162 |
-
case self::METHOD_WPP_DIRECT:
|
1163 |
-
case self::METHOD_BILLING_AGREEMENT:
|
1164 |
-
case self::METHOD_HOSTEDPRO:
|
1165 |
-
$path = $this->_mapWppFieldset($fieldName);
|
1166 |
-
break;
|
1167 |
-
case self::METHOD_WPP_PE_EXPRESS:
|
1168 |
-
case self::METHOD_WPP_PE_DIRECT:
|
1169 |
-
case self::METHOD_PAYFLOWADVANCED:
|
1170 |
-
case self::METHOD_PAYFLOWLINK:
|
1171 |
-
$path = $this->_mapWpukFieldset($fieldName);
|
1172 |
-
break;
|
1173 |
-
}
|
1174 |
-
}
|
1175 |
-
|
1176 |
-
if ($path === null) {
|
1177 |
-
$path = $this->_mapGeneralFieldset($fieldName);
|
1178 |
-
}
|
1179 |
-
if ($path === null) {
|
1180 |
-
$path = $this->_mapGenericStyleFieldset($fieldName);
|
1181 |
-
}
|
1182 |
-
return $path;
|
1183 |
-
}
|
1184 |
-
|
1185 |
-
/**
|
1186 |
-
* Check wheter specified country code is supported by build notation codes for specific countries
|
1187 |
-
*
|
1188 |
-
* @param $code
|
1189 |
-
* @return string|null
|
1190 |
-
*/
|
1191 |
-
private function _matchBnCountryCode($code)
|
1192 |
-
{
|
1193 |
-
switch ($code) {
|
1194 |
-
// GB == UK
|
1195 |
-
case 'GB':
|
1196 |
-
return 'UK';
|
1197 |
-
// Australia, Austria, Belgium, Canada, China, France, Germany, Hong Kong, Italy
|
1198 |
-
case 'AU': case 'AT': case 'BE': case 'CA': case 'CN': case 'FR': case 'DE': case 'HK': case 'IT':
|
1199 |
-
// Japan, Mexico, Netherlands, Poland, Singapore, Spain, Switzerland, United Kingdom, United States
|
1200 |
-
case 'JP': case 'MX': case 'NL': case 'PL': case 'SG': case 'ES': case 'CH': case 'UK': case 'US':
|
1201 |
-
return $code;
|
1202 |
-
}
|
1203 |
-
}
|
1204 |
-
|
1205 |
-
/**
|
1206 |
-
* Map PayPal Standard config fields
|
1207 |
-
*
|
1208 |
-
* @param string $fieldName
|
1209 |
-
* @return string|null
|
1210 |
-
*/
|
1211 |
-
protected function _mapStandardFieldset($fieldName)
|
1212 |
-
{
|
1213 |
-
switch ($fieldName)
|
1214 |
-
{
|
1215 |
-
case 'line_items_summary':
|
1216 |
-
case 'sandbox_flag':
|
1217 |
-
return 'payment/' . self::METHOD_WPS . "/{$fieldName}";
|
1218 |
-
default:
|
1219 |
-
return $this->_mapMethodFieldset($fieldName);
|
1220 |
-
}
|
1221 |
-
}
|
1222 |
-
|
1223 |
-
/**
|
1224 |
-
* Map PayPal Express config fields
|
1225 |
-
*
|
1226 |
-
* @param string $fieldName
|
1227 |
-
* @return string|null
|
1228 |
-
*/
|
1229 |
-
protected function _mapExpressFieldset($fieldName)
|
1230 |
-
{
|
1231 |
-
switch ($fieldName)
|
1232 |
-
{
|
1233 |
-
case 'transfer_shipping_options':
|
1234 |
-
case 'solution_type':
|
1235 |
-
case 'visible_on_cart':
|
1236 |
-
case 'visible_on_product':
|
1237 |
-
case 'require_billing_address':
|
1238 |
-
case 'authorization_honor_period':
|
1239 |
-
case 'order_valid_period':
|
1240 |
-
case 'child_authorization_number':
|
1241 |
-
case 'allow_ba_signup':
|
1242 |
-
return "payment/{$this->_methodCode}/{$fieldName}";
|
1243 |
-
default:
|
1244 |
-
return $this->_mapMethodFieldset($fieldName);
|
1245 |
-
}
|
1246 |
-
}
|
1247 |
-
|
1248 |
-
/**
|
1249 |
-
* Map PayPal Direct config fields
|
1250 |
-
*
|
1251 |
-
* @param string $fieldName
|
1252 |
-
* @return string|null
|
1253 |
-
*/
|
1254 |
-
protected function _mapDirectFieldset($fieldName)
|
1255 |
-
{
|
1256 |
-
switch ($fieldName)
|
1257 |
-
{
|
1258 |
-
case 'useccv':
|
1259 |
-
case 'centinel':
|
1260 |
-
case 'centinel_is_mode_strict':
|
1261 |
-
case 'centinel_api_url':
|
1262 |
-
return "payment/{$this->_methodCode}/{$fieldName}";
|
1263 |
-
default:
|
1264 |
-
return $this->_mapMethodFieldset($fieldName);
|
1265 |
-
}
|
1266 |
-
}
|
1267 |
-
|
1268 |
-
/**
|
1269 |
-
* Map PayPal Website Payments Pro common config fields
|
1270 |
-
*
|
1271 |
-
* @param string $fieldName
|
1272 |
-
* @return string|null
|
1273 |
-
*/
|
1274 |
-
protected function _mapWppFieldset($fieldName)
|
1275 |
-
{
|
1276 |
-
switch ($fieldName)
|
1277 |
-
{
|
1278 |
-
case 'api_authentication':
|
1279 |
-
case 'api_username':
|
1280 |
-
case 'api_password':
|
1281 |
-
case 'api_signature':
|
1282 |
-
case 'api_cert':
|
1283 |
-
case 'sandbox_flag':
|
1284 |
-
case 'use_proxy':
|
1285 |
-
case 'proxy_host':
|
1286 |
-
case 'proxy_port':
|
1287 |
-
case 'button_flavor':
|
1288 |
-
return "paypal/wpp/{$fieldName}";
|
1289 |
-
default:
|
1290 |
-
return null;
|
1291 |
-
}
|
1292 |
-
}
|
1293 |
-
|
1294 |
-
/**
|
1295 |
-
* Map PayPal Website Payments Pro common config fields
|
1296 |
-
*
|
1297 |
-
* @param string $fieldName
|
1298 |
-
* @return string|null
|
1299 |
-
*/
|
1300 |
-
protected function _mapWpukFieldset($fieldName)
|
1301 |
-
{
|
1302 |
-
$pathPrefix = 'paypal/wpuk';
|
1303 |
-
// Use PUMP credentials from Verisign for EC when Direct Payments are unavailable
|
1304 |
-
if ($this->_methodCode == self::METHOD_WPP_PE_EXPRESS
|
1305 |
-
&& !$this->isMethodAvailable(self::METHOD_WPP_PE_DIRECT)) {
|
1306 |
-
$pathPrefix = 'payment/verisign';
|
1307 |
-
} elseif ($this->_methodCode == self::METHOD_PAYFLOWADVANCED
|
1308 |
-
|| $this->_methodCode == self::METHOD_PAYFLOWLINK
|
1309 |
-
) {
|
1310 |
-
$pathPrefix = 'payment/' . $this->_methodCode;
|
1311 |
-
}
|
1312 |
-
switch ($fieldName) {
|
1313 |
-
case 'partner':
|
1314 |
-
case 'user':
|
1315 |
-
case 'vendor':
|
1316 |
-
case 'pwd':
|
1317 |
-
case 'sandbox_flag':
|
1318 |
-
case 'use_proxy':
|
1319 |
-
case 'proxy_host':
|
1320 |
-
case 'proxy_port':
|
1321 |
-
return $pathPrefix . '/' . $fieldName;
|
1322 |
-
default:
|
1323 |
-
return null;
|
1324 |
-
}
|
1325 |
-
}
|
1326 |
-
|
1327 |
-
/**
|
1328 |
-
* Map PayPal common style config fields
|
1329 |
-
*
|
1330 |
-
* @param string $fieldName
|
1331 |
-
* @return string|null
|
1332 |
-
*/
|
1333 |
-
protected function _mapGenericStyleFieldset($fieldName)
|
1334 |
-
{
|
1335 |
-
switch ($fieldName) {
|
1336 |
-
case 'logo':
|
1337 |
-
case 'page_style':
|
1338 |
-
case 'paypal_hdrimg':
|
1339 |
-
case 'paypal_hdrbackcolor':
|
1340 |
-
case 'paypal_hdrbordercolor':
|
1341 |
-
case 'paypal_payflowcolor':
|
1342 |
-
return "paypal/style/{$fieldName}";
|
1343 |
-
default:
|
1344 |
-
return null;
|
1345 |
-
}
|
1346 |
-
}
|
1347 |
-
|
1348 |
-
/**
|
1349 |
-
* Map PayPal General Settings
|
1350 |
-
*
|
1351 |
-
* @param string $fieldName
|
1352 |
-
* @return string|null
|
1353 |
-
*/
|
1354 |
-
protected function _mapGeneralFieldset($fieldName)
|
1355 |
-
{
|
1356 |
-
switch ($fieldName)
|
1357 |
-
{
|
1358 |
-
case 'business_account':
|
1359 |
-
case 'merchant_country':
|
1360 |
-
return "paypal/general/{$fieldName}";
|
1361 |
-
default:
|
1362 |
-
return null;
|
1363 |
-
}
|
1364 |
-
}
|
1365 |
-
|
1366 |
-
/**
|
1367 |
-
* Map PayPal General Settings
|
1368 |
-
*
|
1369 |
-
* @param string $fieldName
|
1370 |
-
* @return string|null
|
1371 |
-
*/
|
1372 |
-
protected function _mapMethodFieldset($fieldName)
|
1373 |
-
{
|
1374 |
-
if (!$this->_methodCode) {
|
1375 |
-
return null;
|
1376 |
-
}
|
1377 |
-
switch ($fieldName)
|
1378 |
-
{
|
1379 |
-
case 'active':
|
1380 |
-
case 'title':
|
1381 |
-
case 'payment_action':
|
1382 |
-
case 'allowspecific':
|
1383 |
-
case 'specificcountry':
|
1384 |
-
case 'line_items_enabled':
|
1385 |
-
case 'cctypes':
|
1386 |
-
case 'sort_order':
|
1387 |
-
case 'debug':
|
1388 |
-
case 'verify_peer':
|
1389 |
-
return "payment/{$this->_methodCode}/{$fieldName}";
|
1390 |
-
default:
|
1391 |
-
return null;
|
1392 |
-
}
|
1393 |
-
}
|
1394 |
-
|
1395 |
-
/**
|
1396 |
-
* Payment API authentication methods source getter
|
1397 |
-
*
|
1398 |
-
* @return array
|
1399 |
-
*/
|
1400 |
-
public function getApiAuthenticationMethods()
|
1401 |
-
{
|
1402 |
-
return array(
|
1403 |
-
'0' => Mage::helper('paypal')->__('API Signature'),
|
1404 |
-
'1' => Mage::helper('paypal')->__('API Certificate')
|
1405 |
-
);
|
1406 |
-
}
|
1407 |
-
|
1408 |
-
/**
|
1409 |
-
* Api certificate getter
|
1410 |
-
*
|
1411 |
-
* @return string
|
1412 |
-
*/
|
1413 |
-
public function getApiCertificate()
|
1414 |
-
{
|
1415 |
-
$websiteId = Mage::app()->getStore($this->_storeId)->getWebsiteId();
|
1416 |
-
return Mage::getModel('paypal/cert')->loadByWebsite($websiteId, false)->getCertPath();
|
1417 |
-
}
|
1418 |
-
}
|
1419 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Ced/LayBuy/Model/Express.php
DELETED
@@ -1,783 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Magento
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
-
* that is bundled with this package in the file LICENSE.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/osl-3.0.php
|
11 |
-
* If you did not receive a copy of the license and are unable to
|
12 |
-
* obtain it through the world-wide-web, please send an email
|
13 |
-
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
-
*
|
15 |
-
* DISCLAIMER
|
16 |
-
*
|
17 |
-
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
-
* versions in the future. If you wish to customize Magento for your
|
19 |
-
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
-
*
|
21 |
-
* @category Mage
|
22 |
-
* @package Mage_Paypal
|
23 |
-
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
-
*/
|
26 |
-
|
27 |
-
/**
|
28 |
-
*
|
29 |
-
* PayPal Express Module
|
30 |
-
*/
|
31 |
-
class Ced_LayBuy_Model_Express extends Mage_Payment_Model_Method_Abstract
|
32 |
-
implements Mage_Payment_Model_Recurring_Profile_MethodInterface
|
33 |
-
{
|
34 |
-
protected $_code = "laybuy_express";
|
35 |
-
//protected $_formBlockType = 'laybuy/express_form';
|
36 |
-
// protected $_infoBlockType = 'laybuy/payment_info';
|
37 |
-
protected $_formBlockType = 'laybuy/form_laybuy';
|
38 |
-
protected $_infoBlockType = 'laybuy/info_laybuy';
|
39 |
-
/**
|
40 |
-
* Website Payments Pro instance type
|
41 |
-
*
|
42 |
-
* @var $_proType string
|
43 |
-
*/
|
44 |
-
protected $_proType = 'laybuy/pro';
|
45 |
-
|
46 |
-
/**
|
47 |
-
* Availability options
|
48 |
-
*/
|
49 |
-
protected $_isGateway = false;
|
50 |
-
protected $_canOrder = true;
|
51 |
-
protected $_canAuthorize = true;
|
52 |
-
protected $_canCapture = true;
|
53 |
-
protected $_canCapturePartial = true;
|
54 |
-
protected $_canRefund = true;
|
55 |
-
protected $_canRefundInvoicePartial = true;
|
56 |
-
protected $_canVoid = true;
|
57 |
-
protected $_canUseInternal = false;
|
58 |
-
protected $_canUseCheckout = true;
|
59 |
-
protected $_canUseForMultishipping = false;
|
60 |
-
protected $_canFetchTransactionInfo = true;
|
61 |
-
protected $_canCreateBillingAgreement = true;
|
62 |
-
protected $_canReviewPayment = true;
|
63 |
-
|
64 |
-
/**
|
65 |
-
* Website Payments Pro instance
|
66 |
-
*
|
67 |
-
* @var Mage_Paypal_Model_Pro
|
68 |
-
*/
|
69 |
-
protected $_pro = null;
|
70 |
-
|
71 |
-
/**
|
72 |
-
* Payment additional information key for payment action
|
73 |
-
* @var string
|
74 |
-
*/
|
75 |
-
protected $_isOrderPaymentActionKey = 'is_order_action';
|
76 |
-
|
77 |
-
/**
|
78 |
-
* Payment additional information key for number of used authorizations
|
79 |
-
* @var string
|
80 |
-
*/
|
81 |
-
protected $_authorizationCountKey = 'authorization_count';
|
82 |
-
|
83 |
-
public function __construct($params = array())
|
84 |
-
{
|
85 |
-
$proInstance = array_shift($params);
|
86 |
-
if ($proInstance && ($proInstance instanceof Ced_LayBuy_Model_Pro)) {
|
87 |
-
$this->_pro = $proInstance;
|
88 |
-
} else {
|
89 |
-
$this->_pro = Mage::getModel($this->_proType);
|
90 |
-
}
|
91 |
-
$this->_pro->setMethod($this->_code);
|
92 |
-
|
93 |
-
}
|
94 |
-
|
95 |
-
/**
|
96 |
-
* Store setter
|
97 |
-
* Also updates store ID in config object
|
98 |
-
*
|
99 |
-
* @param Mage_Core_Model_Store|int $store
|
100 |
-
*/
|
101 |
-
public function setStore($store)
|
102 |
-
{
|
103 |
-
$this->setData('store', $store);
|
104 |
-
if (null === $store) {
|
105 |
-
$store = Mage::app()->getStore()->getId();
|
106 |
-
}
|
107 |
-
$this->_pro->getConfig()->setStoreId(is_object($store) ? $store->getId() : $store);
|
108 |
-
return $this;
|
109 |
-
}
|
110 |
-
|
111 |
-
/**
|
112 |
-
* Can be used in regular checkout
|
113 |
-
*
|
114 |
-
* @return bool
|
115 |
-
*/
|
116 |
-
public function canUseCheckout()
|
117 |
-
{
|
118 |
-
if (Mage::getStoreConfigFlag('payment/hosted_pro/active')
|
119 |
-
&& !Mage::getStoreConfigFlag('payment/hosted_pro/display_ec')
|
120 |
-
) {
|
121 |
-
return false;
|
122 |
-
}
|
123 |
-
return parent::canUseCheckout();
|
124 |
-
}
|
125 |
-
|
126 |
-
/**
|
127 |
-
* Whether method is available for specified currency
|
128 |
-
*
|
129 |
-
* @param string $currencyCode
|
130 |
-
* @return bool
|
131 |
-
*/
|
132 |
-
public function canUseForCurrency($currencyCode)
|
133 |
-
{
|
134 |
-
return $this->_pro->getConfig()->isCurrencyCodeSupported($currencyCode);
|
135 |
-
}
|
136 |
-
|
137 |
-
/**
|
138 |
-
* Payment action getter compatible with payment model
|
139 |
-
*
|
140 |
-
* @see Mage_Sales_Model_Payment::place()
|
141 |
-
* @return string
|
142 |
-
*/
|
143 |
-
public function getConfigPaymentAction()
|
144 |
-
{
|
145 |
-
/* echo get_class($this->_pro);
|
146 |
-
var_dump($this->_pro->getConfig()->getPaymentAction());die("herrooo"); */
|
147 |
-
return 'authorize';
|
148 |
-
}
|
149 |
-
|
150 |
-
/**
|
151 |
-
* Check whether payment method can be used
|
152 |
-
* @param Mage_Sales_Model_Quote
|
153 |
-
* @return bool
|
154 |
-
*/
|
155 |
-
/* public function isAvailable($quote = null)
|
156 |
-
{
|
157 |
-
if (parent::isAvailable($quote) && $this->_pro->getConfig()->isMethodAvailable()) {
|
158 |
-
return true;
|
159 |
-
}
|
160 |
-
return false;
|
161 |
-
} */
|
162 |
-
|
163 |
-
/**
|
164 |
-
* Custom getter for payment configuration
|
165 |
-
*
|
166 |
-
* @param string $field
|
167 |
-
* @param int $storeId
|
168 |
-
* @return mixed
|
169 |
-
*/
|
170 |
-
public function getConfigData($field, $storeId = null)
|
171 |
-
{
|
172 |
-
return $this->_pro->getConfig()->$field;
|
173 |
-
}
|
174 |
-
|
175 |
-
/**
|
176 |
-
* Order payment
|
177 |
-
*
|
178 |
-
* @param Mage_Sales_Model_Order_Payment $payment
|
179 |
-
* @param float $amount
|
180 |
-
* @return Mage_Paypal_Model_Express
|
181 |
-
*/
|
182 |
-
public function order(Varien_Object $payment, $amount)
|
183 |
-
{
|
184 |
-
$this->_placeOrder($payment, $amount);
|
185 |
-
|
186 |
-
$payment->setAdditionalInformation($this->_isOrderPaymentActionKey, true);
|
187 |
-
|
188 |
-
if ($payment->getIsFraudDetected()) {
|
189 |
-
return $this;
|
190 |
-
}
|
191 |
-
|
192 |
-
$order = $payment->getOrder();
|
193 |
-
$orderTransactionId = $payment->getTransactionId();
|
194 |
-
|
195 |
-
$api = $this->_callDoAuthorize($amount, $payment, $payment->getTransactionId());
|
196 |
-
|
197 |
-
$state = Mage_Sales_Model_Order::STATE_PROCESSING;
|
198 |
-
$status = true;
|
199 |
-
|
200 |
-
$formatedPrice = $order->getBaseCurrency()->formatTxt($amount);
|
201 |
-
if ($payment->getIsTransactionPending()) {
|
202 |
-
$message = Mage::helper('laybuy')->__('Ordering amount of %s is pending approval on gateway.', $formatedPrice);
|
203 |
-
$state = Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW;
|
204 |
-
} else {
|
205 |
-
$message = Mage::helper('laybuy')->__('Ordered amount of %s.', $formatedPrice);
|
206 |
-
}
|
207 |
-
|
208 |
-
$payment->addTransaction(Mage_Sales_Model_Order_Payment_Transaction::TYPE_ORDER, null, false, $message);
|
209 |
-
|
210 |
-
$this->_pro->importPaymentInfo($api, $payment);
|
211 |
-
|
212 |
-
if ($payment->getIsTransactionPending()) {
|
213 |
-
$message = Mage::helper('laybuy')->__('Authorizing amount of %s is pending approval on gateway.', $formatedPrice);
|
214 |
-
$state = Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW;
|
215 |
-
if ($payment->getIsFraudDetected()) {
|
216 |
-
$status = Mage_Sales_Model_Order::STATUS_FRAUD;
|
217 |
-
}
|
218 |
-
} else {
|
219 |
-
$message = Mage::helper('laybuy')->__('Authorized amount of %s.', $formatedPrice);
|
220 |
-
}
|
221 |
-
|
222 |
-
$payment->resetTransactionAdditionalInfo();
|
223 |
-
|
224 |
-
$payment->setTransactionId($api->getTransactionId());
|
225 |
-
$payment->setParentTransactionId($orderTransactionId);
|
226 |
-
|
227 |
-
$transaction = $payment->addTransaction(Mage_Sales_Model_Order_Payment_Transaction::TYPE_AUTH, null, false,
|
228 |
-
$message
|
229 |
-
);
|
230 |
-
|
231 |
-
$order->setState($state, $status);
|
232 |
-
|
233 |
-
$payment->setSkipOrderProcessing(true);
|
234 |
-
return $this;
|
235 |
-
}
|
236 |
-
|
237 |
-
/**
|
238 |
-
* Authorize payment
|
239 |
-
*
|
240 |
-
* @param Mage_Sales_Model_Order_Payment $payment
|
241 |
-
* @param float $amount
|
242 |
-
* @return Mage_Paypal_Model_Express
|
243 |
-
*/
|
244 |
-
public function authorize(Varien_Object $payment, $amount)
|
245 |
-
{
|
246 |
-
return $this->_placeOrder($payment, $amount);
|
247 |
-
}
|
248 |
-
|
249 |
-
/**
|
250 |
-
* Void payment
|
251 |
-
*
|
252 |
-
* @param Mage_Sales_Model_Order_Payment $payment
|
253 |
-
* @return Mage_Paypal_Model_Express
|
254 |
-
*/
|
255 |
-
public function void(Varien_Object $payment)
|
256 |
-
{
|
257 |
-
//Switching to order transaction if needed
|
258 |
-
if ($payment->getAdditionalInformation($this->_isOrderPaymentActionKey)
|
259 |
-
&& !$payment->getVoidOnlyAuthorization()
|
260 |
-
) {
|
261 |
-
$orderTransaction = $payment->lookupTransaction(
|
262 |
-
false, Mage_Sales_Model_Order_Payment_Transaction::TYPE_ORDER
|
263 |
-
);
|
264 |
-
if ($orderTransaction) {
|
265 |
-
$payment->setParentTransactionId($orderTransaction->getTxnId());
|
266 |
-
$payment->setTransactionId($orderTransaction->getTxnId() . '-void');
|
267 |
-
}
|
268 |
-
}
|
269 |
-
$this->_pro->void($payment);
|
270 |
-
return $this;
|
271 |
-
}
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
/**
|
276 |
-
* Refund capture
|
277 |
-
*
|
278 |
-
* @param Mage_Sales_Model_Order_Payment $payment
|
279 |
-
* @param float $amount
|
280 |
-
* @return Mage_Paypal_Model_Express
|
281 |
-
*/
|
282 |
-
public function refund(Varien_Object $payment, $amount)
|
283 |
-
{
|
284 |
-
$this->_pro->refund($payment, $amount);
|
285 |
-
return $this;
|
286 |
-
}
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
/**
|
291 |
-
* Whether payment can be reviewed
|
292 |
-
*
|
293 |
-
* @param Mage_Sales_Model_Order_Payment $payment
|
294 |
-
* @return bool
|
295 |
-
*/
|
296 |
-
public function canReviewPayment(Mage_Payment_Model_Info $payment)
|
297 |
-
{
|
298 |
-
return parent::canReviewPayment($payment) && $this->_pro->canReviewPayment($payment);
|
299 |
-
}
|
300 |
-
|
301 |
-
/**
|
302 |
-
* Attempt to accept a pending payment
|
303 |
-
*
|
304 |
-
* @param Mage_Sales_Model_Order_Payment $payment
|
305 |
-
* @return bool
|
306 |
-
*/
|
307 |
-
public function acceptPayment(Mage_Payment_Model_Info $payment)
|
308 |
-
{
|
309 |
-
parent::acceptPayment($payment);
|
310 |
-
return $this->_pro->reviewPayment($payment, Mage_Paypal_Model_Pro::PAYMENT_REVIEW_ACCEPT);
|
311 |
-
}
|
312 |
-
|
313 |
-
/**
|
314 |
-
* Attempt to deny a pending payment
|
315 |
-
*
|
316 |
-
* @param Mage_Sales_Model_Order_Payment $payment
|
317 |
-
* @return bool
|
318 |
-
*/
|
319 |
-
public function denyPayment(Mage_Payment_Model_Info $payment)
|
320 |
-
{
|
321 |
-
parent::denyPayment($payment);
|
322 |
-
return $this->_pro->reviewPayment($payment, Mage_Paypal_Model_Pro::PAYMENT_REVIEW_DENY);
|
323 |
-
}
|
324 |
-
|
325 |
-
/**
|
326 |
-
* Checkout redirect URL getter for onepage checkout (hardcode)
|
327 |
-
*
|
328 |
-
* @see Mage_Checkout_OnepageController::savePaymentAction()
|
329 |
-
* @see Mage_Sales_Model_Quote_Payment::getCheckoutRedirectUrl()
|
330 |
-
* @return string
|
331 |
-
*/
|
332 |
-
public function getCheckoutRedirectUrl()
|
333 |
-
{
|
334 |
-
return Mage::getUrl('laybuy/express/start');
|
335 |
-
}
|
336 |
-
|
337 |
-
/**
|
338 |
-
* Fetch transaction details info
|
339 |
-
*
|
340 |
-
* @param Mage_Payment_Model_Info $payment
|
341 |
-
* @param string $transactionId
|
342 |
-
* @return array
|
343 |
-
*/
|
344 |
-
public function fetchTransactionInfo(Mage_Payment_Model_Info $payment, $transactionId)
|
345 |
-
{
|
346 |
-
return $this->_pro->fetchTransactionInfo($payment, $transactionId);
|
347 |
-
}
|
348 |
-
|
349 |
-
/**
|
350 |
-
* Validate RP data
|
351 |
-
*
|
352 |
-
* @param Mage_Payment_Model_Recurring_Profile $profile
|
353 |
-
*/
|
354 |
-
public function validateRecurringProfile(Mage_Payment_Model_Recurring_Profile $profile)
|
355 |
-
{
|
356 |
-
return $this->_pro->validateRecurringProfile($profile);
|
357 |
-
}
|
358 |
-
|
359 |
-
/**
|
360 |
-
* Submit RP to the gateway
|
361 |
-
*
|
362 |
-
* @param Mage_Payment_Model_Recurring_Profile $profile
|
363 |
-
* @param Mage_Payment_Model_Info $paymentInfo
|
364 |
-
*/
|
365 |
-
public function submitRecurringProfile(Mage_Payment_Model_Recurring_Profile $profile,
|
366 |
-
Mage_Payment_Model_Info $paymentInfo
|
367 |
-
) {
|
368 |
-
$token = $paymentInfo->
|
369 |
-
getAdditionalInformation(Mage_Paypal_Model_Express_Checkout::PAYMENT_INFO_TRANSPORT_TOKEN);
|
370 |
-
$profile->setToken($token);
|
371 |
-
$this->_pro->submitRecurringProfile($profile, $paymentInfo);
|
372 |
-
}
|
373 |
-
|
374 |
-
/**
|
375 |
-
* Fetch RP details
|
376 |
-
*
|
377 |
-
* @param string $referenceId
|
378 |
-
* @param Varien_Object $result
|
379 |
-
*/
|
380 |
-
public function getRecurringProfileDetails($referenceId, Varien_Object $result)
|
381 |
-
{
|
382 |
-
return $this->_pro->getRecurringProfileDetails($referenceId, $result);
|
383 |
-
}
|
384 |
-
|
385 |
-
/**
|
386 |
-
* Whether can get recurring profile details
|
387 |
-
*/
|
388 |
-
public function canGetRecurringProfileDetails()
|
389 |
-
{
|
390 |
-
return true;
|
391 |
-
}
|
392 |
-
|
393 |
-
/**
|
394 |
-
* Update RP data
|
395 |
-
*
|
396 |
-
* @param Mage_Payment_Model_Recurring_Profile $profile
|
397 |
-
*/
|
398 |
-
public function updateRecurringProfile(Mage_Payment_Model_Recurring_Profile $profile)
|
399 |
-
{
|
400 |
-
return $this->_pro->updateRecurringProfile($profile);
|
401 |
-
}
|
402 |
-
|
403 |
-
/**
|
404 |
-
* Manage status
|
405 |
-
*
|
406 |
-
* @param Mage_Payment_Model_Recurring_Profile $profile
|
407 |
-
*/
|
408 |
-
public function updateRecurringProfileStatus(Mage_Payment_Model_Recurring_Profile $profile)
|
409 |
-
{
|
410 |
-
return $this->_pro->updateRecurringProfileStatus($profile);
|
411 |
-
}
|
412 |
-
|
413 |
-
/**
|
414 |
-
* Assign data to info model instance
|
415 |
-
*
|
416 |
-
* @param mixed $data
|
417 |
-
* @return Mage_Payment_Model_Info
|
418 |
-
*/
|
419 |
-
public function assignData($data)
|
420 |
-
{
|
421 |
-
$result = parent::assignData($data);
|
422 |
-
$key = Mage_Paypal_Model_Express_Checkout::PAYMENT_INFO_TRANSPORT_BILLING_AGREEMENT;
|
423 |
-
if (is_array($data)) {
|
424 |
-
$this->getInfoInstance()->setAdditionalInformation($key, isset($data[$key]) ? $data[$key] : null);
|
425 |
-
}
|
426 |
-
elseif ($data instanceof Varien_Object) {
|
427 |
-
$this->getInfoInstance()->setAdditionalInformation($key, $data->getData($key));
|
428 |
-
}
|
429 |
-
return $result;
|
430 |
-
}
|
431 |
-
|
432 |
-
/**
|
433 |
-
* Place an order with authorization or capture action
|
434 |
-
*
|
435 |
-
* @param Mage_Sales_Model_Order_Payment $payment
|
436 |
-
* @param float $amount
|
437 |
-
* @return Mage_Paypal_Model_Express
|
438 |
-
*/
|
439 |
-
protected function _placeOrder(Mage_Sales_Model_Order_Payment $payment, $amount)
|
440 |
-
{
|
441 |
-
$order = $payment->getOrder();
|
442 |
-
|
443 |
-
// prepare api call
|
444 |
-
$token = $payment->getAdditionalInformation(Mage_Paypal_Model_Express_Checkout::PAYMENT_INFO_TRANSPORT_TOKEN);
|
445 |
-
$api = $this->_pro->getApi();
|
446 |
-
$api->setToken($token);
|
447 |
-
$api->setPayerId($payment->
|
448 |
-
getAdditionalInformation(Mage_Paypal_Model_Express_Checkout::PAYMENT_INFO_TRANSPORT_PAYER_ID));
|
449 |
-
$api->setAmount($amount);
|
450 |
-
$api->setPaymentAction($this->_pro->getConfig()->paymentAction);
|
451 |
-
$api->setNotifyUrl(Mage::getUrl('paypal/ipn/'));
|
452 |
-
$api->setInvNum($order->getIncrementId());
|
453 |
-
$api->setCurrencyCode($order->getBaseCurrencyCode());
|
454 |
-
//$api->setPaypalCart(Mage::getModel('paypal/cart', array($order)));
|
455 |
-
$api->setIsLineItemsEnabled($this->_pro->getConfig()->lineItemsEnabled);
|
456 |
-
|
457 |
-
if ($order->getIsVirtual()) {
|
458 |
-
$api->setAddress($order->getBillingAddress())->setSuppressShipping(true);
|
459 |
-
} else {
|
460 |
-
$api->setAddress($order->getShippingAddress());
|
461 |
-
$api->setBillingAddress($order->getBillingAddress());
|
462 |
-
}
|
463 |
-
// call api and get details from it
|
464 |
-
$api->callDoExpressCheckoutPayment();
|
465 |
-
$this->_importToPayment($api, $payment);//$api
|
466 |
-
|
467 |
-
return $this;
|
468 |
-
}
|
469 |
-
|
470 |
-
/**
|
471 |
-
* Import payment info to payment
|
472 |
-
*
|
473 |
-
* @param Mage_Paypal_Model_Api_Nvp
|
474 |
-
* @param Mage_Sales_Model_Order_Payment
|
475 |
-
*/
|
476 |
-
protected function _importToPayment($api, $payment)
|
477 |
-
{
|
478 |
-
$payment->setTransactionId($api->getTransactionId())->setIsTransactionClosed(0)
|
479 |
-
->setAdditionalInformation('laybuy_express_checkout_redirect_required',
|
480 |
-
$api->getRedirectRequired()
|
481 |
-
);
|
482 |
-
$model_obj=$api->getModelObject();
|
483 |
-
if ($model_obj->getBillingAgreementId()) {
|
484 |
-
$payment->setBillingAgreementData(array(
|
485 |
-
'billing_agreement_id' => $model_obj->getBillingAgreementId(),
|
486 |
-
'method_code' => 'laybuy_billing_agreement'
|
487 |
-
));
|
488 |
-
}
|
489 |
-
|
490 |
-
$this->_pro->importPaymentInfo($model_obj, $payment);
|
491 |
-
}
|
492 |
-
|
493 |
-
/**
|
494 |
-
* Check void availability
|
495 |
-
*
|
496 |
-
* @param Varien_Object $payment
|
497 |
-
* @return bool
|
498 |
-
*/
|
499 |
-
public function canVoid(Varien_Object $payment)
|
500 |
-
{
|
501 |
-
if ($payment instanceof Mage_Sales_Model_Order_Invoice
|
502 |
-
|| $payment instanceof Mage_Sales_Model_Order_Creditmemo
|
503 |
-
) {
|
504 |
-
return false;
|
505 |
-
}
|
506 |
-
$info = $this->getInfoInstance();
|
507 |
-
if ($info->getAdditionalInformation($this->_isOrderPaymentActionKey)) {
|
508 |
-
$orderTransaction = $info->lookupTransaction(
|
509 |
-
false, Mage_Sales_Model_Order_Payment_Transaction::TYPE_ORDER
|
510 |
-
);
|
511 |
-
if ($orderTransaction) {
|
512 |
-
$info->setParentTransactionId($orderTransaction->getTxnId());
|
513 |
-
}
|
514 |
-
}
|
515 |
-
|
516 |
-
return $this->_canVoid;
|
517 |
-
}
|
518 |
-
|
519 |
-
/**
|
520 |
-
* Check capture availability
|
521 |
-
*
|
522 |
-
* @return bool
|
523 |
-
*/
|
524 |
-
public function canCapture()
|
525 |
-
{
|
526 |
-
$payment = $this->getInfoInstance();
|
527 |
-
$this->_pro->getConfig()->setStoreId($payment->getOrder()->getStore()->getId());
|
528 |
-
|
529 |
-
if ($payment->getAdditionalInformation($this->_isOrderPaymentActionKey)) {
|
530 |
-
$orderTransaction = $payment->lookupTransaction(false,
|
531 |
-
Mage_Sales_Model_Order_Payment_Transaction::TYPE_ORDER
|
532 |
-
);
|
533 |
-
if ($orderTransaction->getIsClosed()) {
|
534 |
-
return false;
|
535 |
-
}
|
536 |
-
|
537 |
-
$orderValidPeriod = abs(intval($this->getConfigData('order_valid_period')));
|
538 |
-
|
539 |
-
$dateCompass = new DateTime($orderTransaction->getCreatedAt());
|
540 |
-
$dateCompass->modify('+' . $orderValidPeriod . ' days');
|
541 |
-
$currentDate = new DateTime();
|
542 |
-
|
543 |
-
if ($currentDate > $dateCompass || $orderValidPeriod == 0) {
|
544 |
-
return false;
|
545 |
-
}
|
546 |
-
}
|
547 |
-
return $this->_canCapture;
|
548 |
-
}
|
549 |
-
|
550 |
-
/**
|
551 |
-
* Call DoAuthorize
|
552 |
-
*
|
553 |
-
* @param int $amount
|
554 |
-
* @param Varien_Object $payment
|
555 |
-
* @param string $parentTransactionId
|
556 |
-
* @return Mage_Paypal_Model_Api_Abstract
|
557 |
-
*/
|
558 |
-
protected function _callDoAuthorize($amount, $payment, $parentTransactionId)
|
559 |
-
{
|
560 |
-
$api = $this->_pro->resetApi()->getApi()
|
561 |
-
->setAmount($amount)
|
562 |
-
->setCurrencyCode($payment->getOrder()->getBaseCurrencyCode())
|
563 |
-
->setTransactionId($parentTransactionId)
|
564 |
-
->callDoAuthorization();
|
565 |
-
|
566 |
-
$payment->setAdditionalInformation($this->_authorizationCountKey,
|
567 |
-
$payment->getAdditionalInformation($this->_authorizationCountKey) + 1
|
568 |
-
);
|
569 |
-
|
570 |
-
return $api;
|
571 |
-
}
|
572 |
-
|
573 |
-
/**
|
574 |
-
* Check transaction for expiration in PST
|
575 |
-
*
|
576 |
-
* @param Mage_Sales_Model_Order_Payment_Transaction $transaction
|
577 |
-
* @param int $period
|
578 |
-
* @return boolean
|
579 |
-
*/
|
580 |
-
protected function _isTransactionExpired(Mage_Sales_Model_Order_Payment_Transaction $transaction, $period)
|
581 |
-
{
|
582 |
-
$period = intval($period);
|
583 |
-
if (0 == $period) {
|
584 |
-
return true;
|
585 |
-
}
|
586 |
-
|
587 |
-
$transactionClosingDate = new DateTime($transaction->getCreatedAt(), new DateTimeZone('GMT'));
|
588 |
-
$transactionClosingDate->setTimezone(new DateTimeZone('US/Pacific'));
|
589 |
-
/**
|
590 |
-
* 11:49:00 PayPal transactions closing time
|
591 |
-
*/
|
592 |
-
$transactionClosingDate->setTime(11, 49, 00);
|
593 |
-
$transactionClosingDate->modify('+' . $period . ' days');
|
594 |
-
|
595 |
-
$currentTime = new DateTime(null, new DateTimeZone('US/Pacific'));
|
596 |
-
|
597 |
-
if ($currentTime > $transactionClosingDate) {
|
598 |
-
return true;
|
599 |
-
}
|
600 |
-
|
601 |
-
return false;
|
602 |
-
}
|
603 |
-
|
604 |
-
/***************************new code********************************/
|
605 |
-
/**
|
606 |
-
* Check whether payment method can be used
|
607 |
-
* @param Mage_Sales_Model_Quote
|
608 |
-
* @return bool
|
609 |
-
*/
|
610 |
-
public function isAvailable($quote = null)
|
611 |
-
{
|
612 |
-
$controller_name=Mage::app()->getRequest()->getControllerName();
|
613 |
-
$action_name=Mage::app()->getRequest()->getActionName();
|
614 |
-
$module_name=Mage::app()->getRequest()->getModuleName();
|
615 |
-
/* if($controller_name=="onepage" && $module_name=="checkout"){
|
616 |
-
return false;
|
617 |
-
exit();
|
618 |
-
} */
|
619 |
-
if(($controller_name=="product" && $module_name=="catalog" && $action_name=="view") || ($controller_name=="index" && $module_name=="cms" && $action_name=="index") || ($controller_name=="cart" && $module_name=="checkout" && $action_name=="index") || ($controller_name=="express" && $module_name=="laybuy" )){
|
620 |
-
if ($status = parent::isAvailable($quote)) {
|
621 |
-
|
622 |
-
$storeId = $quote ? $quote->getStoreId() : null;
|
623 |
-
|
624 |
-
/* Condition for minimum checkout amount for method availability */
|
625 |
-
$configTotal = Mage::getStoreConfig('laybuy/conditional_criteria/total',$storeId);
|
626 |
-
$total = $quote ? $quote->getData('grand_total') : 0;
|
627 |
-
if($total && $status && $configTotal){
|
628 |
-
if($configTotal<$total){
|
629 |
-
$status = true;
|
630 |
-
}else{
|
631 |
-
$status = false;
|
632 |
-
}
|
633 |
-
}
|
634 |
-
|
635 |
-
/* Condition for customer groups for method availability */
|
636 |
-
if($status){
|
637 |
-
if(Mage::getStoreConfig('laybuy/conditional_criteria/allowspecificgroup',$storeId)) {
|
638 |
-
$configCustomerGroupId = explode(',',Mage::getStoreConfig('laybuy/conditional_criteria/customergroup',$storeId ));
|
639 |
-
$customerGroupId = $quote ? $quote->getData('customer_group_id'):-5;
|
640 |
-
if($customerGroupId != -5){
|
641 |
-
if($configCustomerGroupId && in_array($customerGroupId,$configCustomerGroupId)){
|
642 |
-
$status = true;
|
643 |
-
}else{
|
644 |
-
$status = false;
|
645 |
-
}
|
646 |
-
}
|
647 |
-
}
|
648 |
-
}
|
649 |
-
|
650 |
-
return $status;
|
651 |
-
}
|
652 |
-
}
|
653 |
-
else{
|
654 |
-
return false;
|
655 |
-
}
|
656 |
-
}
|
657 |
-
|
658 |
-
/**
|
659 |
-
* Validate payment method information object
|
660 |
-
*
|
661 |
-
* @return Mage_Payment_Model_Abstract
|
662 |
-
*/
|
663 |
-
public function validate()
|
664 |
-
{
|
665 |
-
/**
|
666 |
-
* to validate payment method is allowed for billing country or not
|
667 |
-
*/
|
668 |
-
parent::validate();
|
669 |
-
|
670 |
-
$paymentInfo = $this->getInfoInstance();
|
671 |
-
if ($paymentInfo instanceof Mage_Sales_Model_Order_Payment) {
|
672 |
-
$cartItems = $paymentInfo->getOrder()->getAllItems();
|
673 |
-
$storeId = $paymentInfo->getOrder()->getStoreId();
|
674 |
-
} else {
|
675 |
-
$cartItems = $paymentInfo->getQuote()->getAllItems();
|
676 |
-
$storeId = $paymentInfo->getQuote()->getStoreId();
|
677 |
-
}
|
678 |
-
$flagArr = $this->canUseForCategories($cartItems, $storeId);
|
679 |
-
if (!$flagArr[0]) {
|
680 |
-
Mage::throwException(Mage::helper('laybuy')->__('Selected payment type is not allowed for '.$flagArr[1].' products.'));
|
681 |
-
}
|
682 |
-
return $this;
|
683 |
-
}
|
684 |
-
public function returnRestrictedProductNames($product_id="",$storeId=0){
|
685 |
-
$status = true;
|
686 |
-
$productName = '';
|
687 |
-
$configCategories = explode(',',Mage::getStoreConfig('laybuy/conditional_criteria/categories',$storeId ));
|
688 |
-
$xproducts = explode(',',Mage::getStoreConfig('laybuy/conditional_criteria/xproducts',$storeId));
|
689 |
-
$cartItems=Mage::getModel('checkout/cart')->getQuote()->getAllItems();
|
690 |
-
foreach($cartItems as $_product){
|
691 |
-
$_product = Mage::getModel('catalog/product')->load($_product->getProductId());
|
692 |
-
if($xproducts && in_array($_product->getId(),$xproducts)){
|
693 |
-
$status = false;
|
694 |
-
$productName .= $_product->getName().',';
|
695 |
-
} elseif(!Mage::getStoreConfig('laybuy/conditional_criteria/allowspecificcategory',$storeId)) {
|
696 |
-
$status = true;
|
697 |
-
} elseif ($configCategories && count(array_diff($_product->getCategoryIds(),$configCategories))>0){
|
698 |
-
$status = false;
|
699 |
-
$productName .= $_product->getName().',';
|
700 |
-
}
|
701 |
-
}
|
702 |
-
$productName = rtrim($productName,',');
|
703 |
-
|
704 |
-
return $productName;
|
705 |
-
}
|
706 |
-
public function checkForCategoriesAndProducts($product_id="",$storeId=0){
|
707 |
-
$status = true;
|
708 |
-
$productName = '';
|
709 |
-
$cartItems="";
|
710 |
-
$configCategories = explode(',',Mage::getStoreConfig('laybuy/conditional_criteria/categories',$storeId ));
|
711 |
-
$xproducts = explode(',',Mage::getStoreConfig('laybuy/conditional_criteria/xproducts',$storeId));
|
712 |
-
$controller_name=Mage::app()->getRequest()->getControllerName();
|
713 |
-
$action_name=Mage::app()->getRequest()->getActionName();
|
714 |
-
$module_name=Mage::app()->getRequest()->getModuleName();
|
715 |
-
if($controller_name=="product" && $module_name="catalog" && $action_name=="view" && $product_id !=""){
|
716 |
-
$_product = Mage::getModel('catalog/product')->load($product_id);
|
717 |
-
if($xproducts && in_array($_product->getId(),$xproducts)){
|
718 |
-
$status = false;
|
719 |
-
$productName .= $_product->getName().',';
|
720 |
-
} elseif(!Mage::getStoreConfig('laybuy/conditional_criteria/allowspecificcategory',$storeId)) {
|
721 |
-
$status = true;
|
722 |
-
} elseif ($configCategories && count(array_diff($_product->getCategoryIds(),$configCategories))>0){
|
723 |
-
$status = false;
|
724 |
-
$productName .= $_product->getName().',';
|
725 |
-
}
|
726 |
-
|
727 |
-
}else{
|
728 |
-
$cartItems=Mage::getModel('checkout/cart')->getQuote()->getAllItems();
|
729 |
-
foreach($cartItems as $_product){
|
730 |
-
$_product = Mage::getModel('catalog/product')->load($_product->getProductId());
|
731 |
-
if($xproducts && in_array($_product->getId(),$xproducts)){
|
732 |
-
$status = false;
|
733 |
-
$productName .= $_product->getName().',';
|
734 |
-
} elseif(!Mage::getStoreConfig('laybuy/conditional_criteria/allowspecificcategory',$storeId)) {
|
735 |
-
$status = true;
|
736 |
-
} elseif ($configCategories && count(array_diff($_product->getCategoryIds(),$configCategories))>0){
|
737 |
-
$status = false;
|
738 |
-
$productName .= $_product->getName().',';
|
739 |
-
}
|
740 |
-
if($status==false){
|
741 |
-
break;
|
742 |
-
}
|
743 |
-
}
|
744 |
-
|
745 |
-
}
|
746 |
-
return $status;
|
747 |
-
|
748 |
-
}
|
749 |
-
|
750 |
-
/**
|
751 |
-
* To check billing country is allowed for the payment method
|
752 |
-
*
|
753 |
-
* @return bool
|
754 |
-
*/
|
755 |
-
public function canUseForCategories($cartItems = array(), $storeId=0)
|
756 |
-
{
|
757 |
-
/*
|
758 |
-
for specific categories, the flag will set up as 1
|
759 |
-
*/
|
760 |
-
$status = true;
|
761 |
-
$productName = '';
|
762 |
-
$configCategories = explode(',',Mage::getStoreConfig('laybuy/conditional_criteria/categories',$storeId ));
|
763 |
-
$xproducts = explode(',',Mage::getStoreConfig('laybuy/conditional_criteria/xproducts',$storeId));
|
764 |
-
|
765 |
-
foreach($cartItems as $_product){
|
766 |
-
$_product = Mage::getModel('catalog/product')->load($_product->getProductId());
|
767 |
-
if($xproducts && in_array($_product->getId(),$xproducts)){
|
768 |
-
$status = false;
|
769 |
-
$productName .= $_product->getName().',';
|
770 |
-
} elseif(!Mage::getStoreConfig('laybuy/conditional_criteria/allowspecificcategory',$storeId)) {
|
771 |
-
$status = true;
|
772 |
-
} elseif ($configCategories && count(array_diff($_product->getCategoryIds(),$configCategories))>0){
|
773 |
-
$status = false;
|
774 |
-
$productName .= $_product->getName().',';
|
775 |
-
}
|
776 |
-
}
|
777 |
-
$productName = rtrim($productName,',');
|
778 |
-
|
779 |
-
return array($status,$productName);
|
780 |
-
}
|
781 |
-
|
782 |
-
/***************************ends************************************/
|
783 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Ced/LayBuy/Model/Laybuyresp.php
DELETED
@@ -1,12 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Ced_LayBuy_Model_Laybuyresp extends Mage_Core_Model_Abstract
|
3 |
-
{
|
4 |
-
|
5 |
-
/**
|
6 |
-
* Initialize resource model
|
7 |
-
*/
|
8 |
-
protected function _construct()
|
9 |
-
{
|
10 |
-
$this->_init('laybuy/laybuyresp');
|
11 |
-
}
|
12 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Ced/LayBuy/Model/Mysql4/Laybuyresp.php
DELETED
@@ -1,11 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Ced_LayBuy_Model_Mysql4_Laybuyresp extends Mage_Core_Model_Mysql4_Abstract{
|
3 |
-
|
4 |
-
protected function _construct()
|
5 |
-
|
6 |
-
{
|
7 |
-
|
8 |
-
$this->_init('laybuy/laybuyresp', 'resp_id');
|
9 |
-
|
10 |
-
}
|
11 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Ced/LayBuy/Model/Mysql4/Laybuyresp/Collection.php
DELETED
@@ -1,37 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Lay-Buys
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
-
* that is bundled with this package in the file LICENSE.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/osl-3.0.php
|
11 |
-
* If you did not receive a copy of the license and are unable to
|
12 |
-
* obtain it through the world-wide-web, please send an email
|
13 |
-
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
-
*
|
15 |
-
* DISCLAIMER
|
16 |
-
*
|
17 |
-
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
-
* versions in the future. If you wish to customize Magento for your
|
19 |
-
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
-
*
|
21 |
-
* @category Ced
|
22 |
-
* @package Ced_LayBuy
|
23 |
-
* @author Asheesh Singh<asheeshsingh@cedcoss.com>
|
24 |
-
* @copyright Copyright LAY-BUYS (2011). (http://lay-buys.com/)
|
25 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
-
*/
|
27 |
-
|
28 |
-
/**
|
29 |
-
* LayBuy Report Collection model
|
30 |
-
*/
|
31 |
-
|
32 |
-
class Ced_LayBuy_Model_Mysql4_Laybuyresp_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract {
|
33 |
-
protected function _construct()
|
34 |
-
{
|
35 |
-
$this->_init('laybuy/laybuyresp');
|
36 |
-
}
|
37 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Ced/LayBuy/Model/Mysql4/Region/Collection.php
DELETED
@@ -1,140 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Magento
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
-
* that is bundled with this package in the file LICENSE.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/osl-3.0.php
|
11 |
-
* If you did not receive a copy of the license and are unable to
|
12 |
-
* obtain it through the world-wide-web, please send an email
|
13 |
-
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
-
*
|
15 |
-
* DISCLAIMER
|
16 |
-
*
|
17 |
-
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
-
* versions in the future. If you wish to customize Magento for your
|
19 |
-
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
-
*
|
21 |
-
* @category Mage
|
22 |
-
* @package Mage_Directory
|
23 |
-
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
24 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
-
*/
|
26 |
-
|
27 |
-
/**
|
28 |
-
* Country collection
|
29 |
-
*
|
30 |
-
* @category Mage
|
31 |
-
* @package Mage_Directory
|
32 |
-
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
-
*/
|
34 |
-
class Ced_Laybuy_Model_Mysql4_Region_Collection extends Mage_Directory_Model_Mysql4_Region_Collection
|
35 |
-
{
|
36 |
-
protected $_regionTable;
|
37 |
-
protected $_regionNameTable;
|
38 |
-
protected $_countryTable;
|
39 |
-
|
40 |
-
public function __construct()
|
41 |
-
{
|
42 |
-
parent::__construct(Mage::getSingleton('core/resource')->getConnection('directory_read'));
|
43 |
-
|
44 |
-
$this->_countryTable = Mage::getSingleton('core/resource')->getTableName('directory/country');
|
45 |
-
$this->_regionTable = Mage::getSingleton('core/resource')->getTableName('directory/country_region');
|
46 |
-
$this->_regionNameTable = Mage::getSingleton('core/resource')->getTableName('directory/country_region_name');
|
47 |
-
|
48 |
-
$locale = $this->_select->getAdapter()->quote(
|
49 |
-
Mage::app()->getLocale()->getLocaleCode());
|
50 |
-
|
51 |
-
|
52 |
-
$this->_select->from(array('region'=>$this->_regionTable),
|
53 |
-
array(
|
54 |
-
'region_id' => 'region_id',
|
55 |
-
'country_id' => 'country_id',
|
56 |
-
'code' => 'code',
|
57 |
-
'default_name' => 'default_name'
|
58 |
-
));
|
59 |
-
$this->_select->joinLeft(array('rname'=>$this->_regionNameTable),
|
60 |
-
'region.region_id = rname.region_id AND rname.locale = ' . $locale,
|
61 |
-
array('name'));
|
62 |
-
|
63 |
-
$this->setItemObjectClass(Mage::getConfig()->getModelClassName('directory/region'));
|
64 |
-
}
|
65 |
-
|
66 |
-
public function addCountryFilter($countryId)
|
67 |
-
{
|
68 |
-
if (!empty($countryId)) {
|
69 |
-
if (is_array($countryId)) {
|
70 |
-
$this->addFieldToFilter('region.country_id', array('in' => $countryId));
|
71 |
-
} else {
|
72 |
-
$this->addFieldToFilter('region.country_id', $countryId);
|
73 |
-
}
|
74 |
-
}
|
75 |
-
return $this;
|
76 |
-
}
|
77 |
-
|
78 |
-
public function addCountryCodeFilter($countryCode)
|
79 |
-
{
|
80 |
-
$this->_select->joinLeft(array('country'=>$this->_countryTable), 'region.country_id=country.country_id');
|
81 |
-
$this->_select->where('country.iso3_code = ?', $countryCode);
|
82 |
-
return $this;
|
83 |
-
}
|
84 |
-
|
85 |
-
public function addRegionCodeFilter($regionCode)
|
86 |
-
{
|
87 |
-
if (!empty($regionCode)) {
|
88 |
-
if (is_array($regionCode)) {
|
89 |
-
$this->_select->where('region.code IN(?)', $regionCode);
|
90 |
-
} else {
|
91 |
-
$this->_select->where('region.code = ?', $regionCode);
|
92 |
-
}
|
93 |
-
}
|
94 |
-
return $this;
|
95 |
-
}
|
96 |
-
|
97 |
-
public function addRegionNameFilter($regionName)
|
98 |
-
{
|
99 |
-
if (!empty($regionName)) {
|
100 |
-
if (is_array($regionName)) {
|
101 |
-
$this->_select->where('region.default_name IN(?)', $regionName);
|
102 |
-
} else {
|
103 |
-
$this->_select->where('region.default_name = ?', $regionName);
|
104 |
-
}
|
105 |
-
}
|
106 |
-
return $this;
|
107 |
-
}
|
108 |
-
|
109 |
-
public function toOptionArray()
|
110 |
-
{
|
111 |
-
$options = array();
|
112 |
-
foreach ($this as $item) {
|
113 |
-
$options[] = array(
|
114 |
-
'value' => $item->getId(),
|
115 |
-
'label' => $item->getName()
|
116 |
-
);
|
117 |
-
}
|
118 |
-
if (count($options)>0) {
|
119 |
-
array_unshift($options,
|
120 |
-
array('title' => null,
|
121 |
-
'value' => '0',
|
122 |
-
'label' => Mage::helper('directory')->__('-- Please select --')));
|
123 |
-
}
|
124 |
-
return $options;
|
125 |
-
}
|
126 |
-
/**
|
127 |
-
* Filter region by its code or name
|
128 |
-
*
|
129 |
-
* @param string|array $region
|
130 |
-
* @return Mage_Directory_Model_Resource_Region_Collection
|
131 |
-
*/
|
132 |
-
public function addRegionCodeOrNameFilter($region)
|
133 |
-
{
|
134 |
-
if (!empty($region)) {
|
135 |
-
$condition = is_array($region) ? array('in' => $region) : $region;
|
136 |
-
$this->addFieldToFilter(array('region.code', 'region.default_name'), array($condition, $condition));
|
137 |
-
}
|
138 |
-
return $this;
|
139 |
-
}
|
140 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Ced/LayBuy/Model/Pro.php
DELETED
@@ -1,484 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Magento
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
-
* that is bundled with this package in the file LICENSE.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/osl-3.0.php
|
11 |
-
* If you did not receive a copy of the license and are unable to
|
12 |
-
* obtain it through the world-wide-web, please send an email
|
13 |
-
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
-
*
|
15 |
-
* DISCLAIMER
|
16 |
-
*
|
17 |
-
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
-
* versions in the future. If you wish to customize Magento for your
|
19 |
-
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
-
*
|
21 |
-
* @category Mage
|
22 |
-
* @package Mage_Paypal
|
23 |
-
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
-
*/
|
26 |
-
|
27 |
-
/**
|
28 |
-
* PayPal Website Payments Pro implementation for payment method instaces
|
29 |
-
* This model was created because right now PayPal Direct and PayPal Express payment methods cannot have same abstract
|
30 |
-
*/
|
31 |
-
class Ced_LayBuy_Model_Pro
|
32 |
-
{
|
33 |
-
/**
|
34 |
-
* Possible payment review actions (for FMF only)
|
35 |
-
*
|
36 |
-
* @var string
|
37 |
-
*/
|
38 |
-
const PAYMENT_REVIEW_ACCEPT = 'accept';
|
39 |
-
const PAYMENT_REVIEW_DENY = 'deny';
|
40 |
-
|
41 |
-
/**
|
42 |
-
* Config instance
|
43 |
-
*
|
44 |
-
* @var Mage_Paypal_Model_Config
|
45 |
-
*/
|
46 |
-
protected $_config = null;
|
47 |
-
|
48 |
-
/**
|
49 |
-
* API instance
|
50 |
-
*
|
51 |
-
* @var Mage_Paypal_Model_Api_Nvp
|
52 |
-
*/
|
53 |
-
protected $_api = null;
|
54 |
-
|
55 |
-
/**
|
56 |
-
* PayPal info object
|
57 |
-
*
|
58 |
-
* @var Mage_Paypal_Model_Info
|
59 |
-
*/
|
60 |
-
protected $_infoInstance = null;
|
61 |
-
|
62 |
-
/**
|
63 |
-
* API model type
|
64 |
-
*
|
65 |
-
* @var string
|
66 |
-
*/
|
67 |
-
protected $_apiType = 'laybuy/api_nvp';
|
68 |
-
|
69 |
-
/**
|
70 |
-
* Config model type
|
71 |
-
*
|
72 |
-
* @var string
|
73 |
-
*/
|
74 |
-
protected $_configType = 'laybuy/config';
|
75 |
-
|
76 |
-
/**
|
77 |
-
* Payment method code setter. Also instantiates/updates config
|
78 |
-
*
|
79 |
-
* @param string $code
|
80 |
-
* @param int|null $storeId
|
81 |
-
*/
|
82 |
-
public function setMethod($code, $storeId = null)
|
83 |
-
{
|
84 |
-
if (null === $this->_config) {
|
85 |
-
$params = array($code);
|
86 |
-
if (null !== $storeId) {
|
87 |
-
$params[] = $storeId;
|
88 |
-
}
|
89 |
-
$this->_config = Mage::getModel($this->_configType, $params);
|
90 |
-
|
91 |
-
} else {
|
92 |
-
$this->_config->setMethod($code);
|
93 |
-
if (null !== $storeId) {
|
94 |
-
$this->_config->setStoreId($storeId);
|
95 |
-
}
|
96 |
-
}
|
97 |
-
return $this;
|
98 |
-
}
|
99 |
-
|
100 |
-
/**
|
101 |
-
* Config instance setter
|
102 |
-
*
|
103 |
-
* @param Mage_Paypal_Model_Config $instace
|
104 |
-
* @param int $storeId
|
105 |
-
*/
|
106 |
-
public function setConfig(Mage_Paypal_Model_Config $instace, $storeId = null)
|
107 |
-
{
|
108 |
-
$this->_config = $instace;
|
109 |
-
if (null !== $storeId) {
|
110 |
-
$this->_config->setStoreId($storeId);
|
111 |
-
}
|
112 |
-
return $this;
|
113 |
-
}
|
114 |
-
|
115 |
-
/**
|
116 |
-
* Config instance getter
|
117 |
-
*
|
118 |
-
* @return Mage_Paypal_Model_Config
|
119 |
-
*/
|
120 |
-
public function getConfig()
|
121 |
-
{
|
122 |
-
return $this->_config;
|
123 |
-
}
|
124 |
-
|
125 |
-
/**
|
126 |
-
* API instance getter
|
127 |
-
* Sets current store id to current config instance and passes it to API
|
128 |
-
*
|
129 |
-
* @return Mage_Paypal_Model_Api_Nvp
|
130 |
-
*/
|
131 |
-
public function getApi()
|
132 |
-
{
|
133 |
-
if (null === $this->_api) {
|
134 |
-
//$this->_api = Mage::getModel($this->_apiType);
|
135 |
-
$this->_api=new Ced_LayBuy_ExpressController();
|
136 |
-
}
|
137 |
-
$this->_api->setConfigObject($this->_config);
|
138 |
-
return $this->_api;
|
139 |
-
}
|
140 |
-
|
141 |
-
/**
|
142 |
-
* Destroy existing NVP Api object
|
143 |
-
*
|
144 |
-
* @return Mage_Paypal_Model_Pro
|
145 |
-
*/
|
146 |
-
public function resetApi()
|
147 |
-
{
|
148 |
-
$this->_api = null;
|
149 |
-
|
150 |
-
return $this;
|
151 |
-
}
|
152 |
-
|
153 |
-
/**
|
154 |
-
* Instantiate and return info model
|
155 |
-
*
|
156 |
-
* @return Mage_Paypal_Model_Info
|
157 |
-
*/
|
158 |
-
public function getInfo()
|
159 |
-
{
|
160 |
-
if (null === $this->_infoInstance) {
|
161 |
-
$this->_infoInstance = new Ced_LayBuy_ExpressController();//Mage::getModel('paypal/info');
|
162 |
-
}
|
163 |
-
return $this->_infoInstance;
|
164 |
-
}
|
165 |
-
|
166 |
-
/**
|
167 |
-
* Transfer transaction/payment information from API instance to order payment
|
168 |
-
*
|
169 |
-
* @param Mage_Paypal_Model_Api_Abstract $from
|
170 |
-
* @param Mage_Payment_Model_Info $to
|
171 |
-
* @return Mage_Paypal_Model_Pro
|
172 |
-
*/
|
173 |
-
public function importPaymentInfo(Varien_Object $from, Mage_Payment_Model_Info $to)
|
174 |
-
{
|
175 |
-
// update PayPal-specific payment information in the payment object
|
176 |
-
$this->getInfo()->importToPayment($from, $to);
|
177 |
-
|
178 |
-
/**
|
179 |
-
* Detect payment review and/or frauds
|
180 |
-
* PayPal pro API returns fraud results only in the payment call response
|
181 |
-
*/
|
182 |
-
try{
|
183 |
-
//
|
184 |
-
//echo get_class($this->getInfo());die("kkkiran..");
|
185 |
-
if ($from->getDataUsingMethod(Ced_LayBuy_ExpressController::IS_FRAUD)) {//Mage_Paypal_Model_Info
|
186 |
-
$to->setIsTransactionPending(true);
|
187 |
-
$to->setIsFraudDetected(true);
|
188 |
-
} elseif ($this->getInfo()->isPaymentReviewRequired($to)) {//->getModelObject()
|
189 |
-
$to->setIsTransactionPending(true);
|
190 |
-
}
|
191 |
-
|
192 |
-
// give generic info about transaction state
|
193 |
-
if ($this->getInfo()->isPaymentSuccessful($to)) {
|
194 |
-
$to->setIsTransactionApproved(true);
|
195 |
-
} elseif ($this->getInfo()->isPaymentFailed($to)) {
|
196 |
-
$to->setIsTransactionDenied(true);
|
197 |
-
}
|
198 |
-
}catch(Exception $e){
|
199 |
-
echo $e->getMessage();die("hasan..");
|
200 |
-
|
201 |
-
}
|
202 |
-
|
203 |
-
return $this;
|
204 |
-
}
|
205 |
-
|
206 |
-
/**
|
207 |
-
* Void transaction
|
208 |
-
*
|
209 |
-
* @param Varien_Object $payment
|
210 |
-
*/
|
211 |
-
public function void(Varien_Object $payment)
|
212 |
-
{
|
213 |
-
if ($authTransactionId = $this->_getParentTransactionId($payment)) {
|
214 |
-
$api = $this->getApi();
|
215 |
-
$api->setPayment($payment)->setAuthorizationId($authTransactionId)->callDoVoid();
|
216 |
-
$this->importPaymentInfo($api, $payment);
|
217 |
-
} else {
|
218 |
-
Mage::throwException(Mage::helper('laybuy')->__('Authorization transaction is required to void.'));
|
219 |
-
}
|
220 |
-
}
|
221 |
-
|
222 |
-
/**
|
223 |
-
* Attempt to capture payment
|
224 |
-
* Will return false if the payment is not supposed to be captured
|
225 |
-
*
|
226 |
-
* @param Varien_Object $payment
|
227 |
-
* @param float $amount
|
228 |
-
* @return false|null
|
229 |
-
*/
|
230 |
-
public function capture(Varien_Object $payment, $amount)
|
231 |
-
{
|
232 |
-
$authTransactionId = $this->_getParentTransactionId($payment);
|
233 |
-
if (!$authTransactionId) {
|
234 |
-
return false;
|
235 |
-
}
|
236 |
-
$api = $this->getApi()
|
237 |
-
->setAuthorizationId($authTransactionId)
|
238 |
-
->setIsCaptureComplete($payment->getShouldCloseParentTransaction())
|
239 |
-
->setAmount($amount)
|
240 |
-
->setCurrencyCode($payment->getOrder()->getBaseCurrencyCode())
|
241 |
-
->setInvNum($payment->getOrder()->getIncrementId())
|
242 |
-
// TODO: pass 'NOTE' to API
|
243 |
-
;
|
244 |
-
|
245 |
-
$api->callDoCapture();
|
246 |
-
$this->_importCaptureResultToPayment($api, $payment);
|
247 |
-
}
|
248 |
-
|
249 |
-
/**
|
250 |
-
* Refund a capture transaction
|
251 |
-
*
|
252 |
-
* @param Varien_Object $payment
|
253 |
-
* @param float $amount
|
254 |
-
*/
|
255 |
-
public function refund(Varien_Object $payment, $amount)
|
256 |
-
{
|
257 |
-
$captureTxnId = $this->_getParentTransactionId($payment);
|
258 |
-
if ($captureTxnId) {
|
259 |
-
$api = $this->getApi();
|
260 |
-
$order = $payment->getOrder();
|
261 |
-
$api->setPayment($payment)
|
262 |
-
->setTransactionId($captureTxnId)
|
263 |
-
->setAmount($amount)
|
264 |
-
->setCurrencyCode($order->getBaseCurrencyCode())
|
265 |
-
;
|
266 |
-
$canRefundMore = $payment->getCreditmemo()->getInvoice()->canRefund();
|
267 |
-
$isFullRefund = !$canRefundMore
|
268 |
-
&& (0 == ((float)$order->getBaseTotalOnlineRefunded() + (float)$order->getBaseTotalOfflineRefunded()));
|
269 |
-
$api->setRefundType($isFullRefund ? Mage_Paypal_Model_Config::REFUND_TYPE_FULL
|
270 |
-
: Mage_Paypal_Model_Config::REFUND_TYPE_PARTIAL
|
271 |
-
);
|
272 |
-
$api->callRefundTransaction();
|
273 |
-
$this->_importRefundResultToPayment($api, $payment, $canRefundMore);
|
274 |
-
} else {
|
275 |
-
Mage::throwException(Mage::helper('laybuy')->__('Impossible to issue a refund transaction because the capture transaction does not exist.'));
|
276 |
-
}
|
277 |
-
}
|
278 |
-
|
279 |
-
/**
|
280 |
-
* Cancel payment
|
281 |
-
*
|
282 |
-
* @param Varien_Object $payment
|
283 |
-
*/
|
284 |
-
public function cancel(Varien_Object $payment)
|
285 |
-
{
|
286 |
-
if (!$payment->getOrder()->getInvoiceCollection()->count()) {
|
287 |
-
$this->void($payment);
|
288 |
-
}
|
289 |
-
}
|
290 |
-
|
291 |
-
/**
|
292 |
-
*
|
293 |
-
* @param Mage_Sales_Model_Order_Payment $payment
|
294 |
-
* @return bool
|
295 |
-
*/
|
296 |
-
public function canReviewPayment(Mage_Payment_Model_Info $payment)
|
297 |
-
{
|
298 |
-
return Mage_Paypal_Model_Info::isPaymentReviewRequired($payment);
|
299 |
-
}
|
300 |
-
|
301 |
-
/**
|
302 |
-
* Perform the payment review
|
303 |
-
*
|
304 |
-
* @param Mage_Payment_Model_Info $payment
|
305 |
-
* @param string $action
|
306 |
-
* @return bool
|
307 |
-
*/
|
308 |
-
public function reviewPayment(Mage_Payment_Model_Info $payment, $action)
|
309 |
-
{
|
310 |
-
$api = $this->getApi()->setTransactionId($payment->getLastTransId());
|
311 |
-
|
312 |
-
// check whether the review is still needed
|
313 |
-
$api->callGetTransactionDetails();
|
314 |
-
$this->importPaymentInfo($api, $payment);
|
315 |
-
if (!$this->getInfo()->isPaymentReviewRequired($payment)) {
|
316 |
-
return false;
|
317 |
-
}
|
318 |
-
|
319 |
-
// perform the review action
|
320 |
-
$api->setAction($action)->callManagePendingTransactionStatus();
|
321 |
-
$api->callGetTransactionDetails();
|
322 |
-
$this->importPaymentInfo($api, $payment);
|
323 |
-
return true;
|
324 |
-
}
|
325 |
-
|
326 |
-
/**
|
327 |
-
* Fetch transaction details info
|
328 |
-
*
|
329 |
-
* @param Mage_Payment_Model_Info $payment
|
330 |
-
* @param string $transactionId
|
331 |
-
* @return array
|
332 |
-
*/
|
333 |
-
public function fetchTransactionInfo(Mage_Payment_Model_Info $payment, $transactionId)
|
334 |
-
{
|
335 |
-
$api = $this->getApi()
|
336 |
-
->setTransactionId($transactionId)
|
337 |
-
->setRawResponseNeeded(true);
|
338 |
-
$api->callGetTransactionDetails();
|
339 |
-
$this->importPaymentInfo($api, $payment);
|
340 |
-
$data = $api->getRawSuccessResponseData();
|
341 |
-
return ($data) ? $data : array();
|
342 |
-
}
|
343 |
-
|
344 |
-
/**
|
345 |
-
* Validate RP data
|
346 |
-
*
|
347 |
-
* @param Mage_Payment_Model_Recurring_Profile $profile
|
348 |
-
* @throws Mage_Core_Exception
|
349 |
-
*/
|
350 |
-
public function validateRecurringProfile(Mage_Payment_Model_Recurring_Profile $profile)
|
351 |
-
{
|
352 |
-
$errors = array();
|
353 |
-
if (strlen($profile->getSubscriberName()) > 32) { // up to 32 single-byte chars
|
354 |
-
$errors[] = Mage::helper('laybuy')->__('Subscriber name is too long.');
|
355 |
-
}
|
356 |
-
$refId = $profile->getInternalReferenceId(); // up to 127 single-byte alphanumeric
|
357 |
-
if (strlen($refId) > 127) { // || !preg_match('/^[a-z\d\s]+$/i', $refId)
|
358 |
-
$errors[] = Mage::helper('laybuy')->__('Merchant reference ID format is not supported.');
|
359 |
-
}
|
360 |
-
$scheduleDescr = $profile->getScheduleDescription(); // up to 127 single-byte alphanumeric
|
361 |
-
if (strlen($refId) > 127) { // || !preg_match('/^[a-z\d\s]+$/i', $scheduleDescr)
|
362 |
-
$errors[] = Mage::helper('laybuy')->__('Schedule description is too long.');
|
363 |
-
}
|
364 |
-
if ($errors) {
|
365 |
-
Mage::throwException(implode(' ', $errors));
|
366 |
-
}
|
367 |
-
}
|
368 |
-
|
369 |
-
/**
|
370 |
-
* Submit RP to the gateway
|
371 |
-
*
|
372 |
-
* @param Mage_Payment_Model_Recurring_Profile $profile
|
373 |
-
* @param Mage_Payment_Model_Info $paymentInfo
|
374 |
-
* @throws Mage_Core_Exception
|
375 |
-
*/
|
376 |
-
public function submitRecurringProfile(Mage_Payment_Model_Recurring_Profile $profile,
|
377 |
-
Mage_Payment_Model_Info $paymentInfo
|
378 |
-
) {
|
379 |
-
$api = $this->getApi();
|
380 |
-
Varien_Object_Mapper::accumulateByMap($profile, $api, array(
|
381 |
-
'token', // EC fields
|
382 |
-
// TODO: DP fields
|
383 |
-
// profile fields
|
384 |
-
'subscriber_name', 'start_datetime', 'internal_reference_id', 'schedule_description',
|
385 |
-
'suspension_threshold', 'bill_failed_later', 'period_unit', 'period_frequency', 'period_max_cycles',
|
386 |
-
'billing_amount' => 'amount', 'trial_period_unit', 'trial_period_frequency', 'trial_period_max_cycles',
|
387 |
-
'trial_billing_amount', 'currency_code', 'shipping_amount', 'tax_amount', 'init_amount', 'init_may_fail',
|
388 |
-
));
|
389 |
-
$api->callCreateRecurringPaymentsProfile();
|
390 |
-
$profile->setReferenceId($api->getRecurringProfileId());
|
391 |
-
if ($api->getIsProfileActive()) {
|
392 |
-
$profile->setState(Mage_Sales_Model_Recurring_Profile::STATE_ACTIVE);
|
393 |
-
} elseif ($api->getIsProfilePending()) {
|
394 |
-
$profile->setState(Mage_Sales_Model_Recurring_Profile::STATE_PENDING);
|
395 |
-
}
|
396 |
-
}
|
397 |
-
|
398 |
-
/**
|
399 |
-
* Fetch RP details
|
400 |
-
*
|
401 |
-
* @param string $referenceId
|
402 |
-
* @param Varien_Object $result
|
403 |
-
*/
|
404 |
-
public function getRecurringProfileDetails($referenceId, Varien_Object $result)
|
405 |
-
{
|
406 |
-
$api = $this->getApi();
|
407 |
-
$api->setRecurringProfileId($referenceId)
|
408 |
-
->callGetRecurringPaymentsProfileDetails($result)
|
409 |
-
;
|
410 |
-
}
|
411 |
-
|
412 |
-
/**
|
413 |
-
* Update RP data
|
414 |
-
*
|
415 |
-
* @param Mage_Payment_Model_Recurring_Profile $profile
|
416 |
-
*/
|
417 |
-
public function updateRecurringProfile(Mage_Payment_Model_Recurring_Profile $profile)
|
418 |
-
{
|
419 |
-
|
420 |
-
}
|
421 |
-
|
422 |
-
/**
|
423 |
-
* Manage status
|
424 |
-
*
|
425 |
-
* @param Mage_Payment_Model_Recurring_Profile $profile
|
426 |
-
*/
|
427 |
-
public function updateRecurringProfileStatus(Mage_Payment_Model_Recurring_Profile $profile)
|
428 |
-
{
|
429 |
-
$api = $this->getApi();
|
430 |
-
$action = null;
|
431 |
-
switch ($profile->getNewState()) {
|
432 |
-
case Mage_Sales_Model_Recurring_Profile::STATE_CANCELED: $action = 'cancel'; break;
|
433 |
-
case Mage_Sales_Model_Recurring_Profile::STATE_SUSPENDED: $action = 'suspend'; break;
|
434 |
-
case Mage_Sales_Model_Recurring_Profile::STATE_ACTIVE: $action = 'activate'; break;
|
435 |
-
}
|
436 |
-
$state = $profile->getState();
|
437 |
-
$api->setRecurringProfileId($profile->getReferenceId())
|
438 |
-
->setIsAlreadyCanceled($state == Mage_Sales_Model_Recurring_Profile::STATE_CANCELED)
|
439 |
-
->setIsAlreadySuspended($state == Mage_Sales_Model_Recurring_Profile::STATE_SUSPENDED)
|
440 |
-
->setIsAlreadyActive($state == Mage_Sales_Model_Recurring_Profile::STATE_ACTIVE)
|
441 |
-
->setAction($action)
|
442 |
-
->callManageRecurringPaymentsProfileStatus()
|
443 |
-
;
|
444 |
-
}
|
445 |
-
|
446 |
-
/**
|
447 |
-
* Import capture results to payment
|
448 |
-
*
|
449 |
-
* @param Mage_Paypal_Model_Api_Nvp
|
450 |
-
* @param Mage_Sales_Model_Order_Payment
|
451 |
-
*/
|
452 |
-
protected function _importCaptureResultToPayment($api, $payment)
|
453 |
-
{
|
454 |
-
$payment->setTransactionId($api->getTransactionId())->setIsTransactionClosed(false);
|
455 |
-
$this->importPaymentInfo($api, $payment);
|
456 |
-
}
|
457 |
-
|
458 |
-
/**
|
459 |
-
* Import refund results to payment
|
460 |
-
*
|
461 |
-
* @param Mage_Paypal_Model_Api_Nvp
|
462 |
-
* @param Mage_Sales_Model_Order_Payment
|
463 |
-
* @param bool $canRefundMore
|
464 |
-
*/
|
465 |
-
protected function _importRefundResultToPayment($api, $payment, $canRefundMore)
|
466 |
-
{
|
467 |
-
$payment->setTransactionId($api->getRefundTransactionId())
|
468 |
-
->setIsTransactionClosed(1) // refund initiated by merchant
|
469 |
-
->setShouldCloseParentTransaction(!$canRefundMore)
|
470 |
-
;
|
471 |
-
$this->importPaymentInfo($api, $payment);
|
472 |
-
}
|
473 |
-
|
474 |
-
/**
|
475 |
-
* Parent transaction id getter
|
476 |
-
*
|
477 |
-
* @param Varien_Object $payment
|
478 |
-
* @return string
|
479 |
-
*/
|
480 |
-
protected function _getParentTransactionId(Varien_Object $payment)
|
481 |
-
{
|
482 |
-
return $payment->getParentTransactionId() ? $payment->getParentTransactionId() : $payment->getLastTransId();
|
483 |
-
}
|
484 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Ced/LayBuy/Model/Resource/Region/Collection.php
DELETED
@@ -1,52 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Magento
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
-
* that is bundled with this package in the file LICENSE.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/osl-3.0.php
|
11 |
-
* If you did not receive a copy of the license and are unable to
|
12 |
-
* obtain it through the world-wide-web, please send an email
|
13 |
-
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
-
*
|
15 |
-
* DISCLAIMER
|
16 |
-
*
|
17 |
-
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
-
* versions in the future. If you wish to customize Magento for your
|
19 |
-
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
-
*
|
21 |
-
* @category Mage
|
22 |
-
* @package Mage_Directory
|
23 |
-
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
-
*/
|
26 |
-
|
27 |
-
|
28 |
-
/**
|
29 |
-
* Country collection
|
30 |
-
*
|
31 |
-
* @category Mage
|
32 |
-
* @package Mage_Directory
|
33 |
-
* @author Magento Core Team <core@magentocommerce.com>
|
34 |
-
*/
|
35 |
-
class Ced_LayBuy_Model_Resource_Region_Collection extends Mage_Directory_Model_Resource_Region_Collection
|
36 |
-
{
|
37 |
-
/**
|
38 |
-
* Filter region by its code or name
|
39 |
-
*
|
40 |
-
* @param string|array $region
|
41 |
-
* @return Mage_Directory_Model_Resource_Region_Collection
|
42 |
-
*/
|
43 |
-
public function addRegionCodeOrNameFilter($region)
|
44 |
-
{
|
45 |
-
if (!empty($region)) {
|
46 |
-
$condition = is_array($region) ? array('in' => $region) : $region;
|
47 |
-
$this->addFieldToFilter(array('main_table.code', 'main_table.default_name'), array($condition, $condition));
|
48 |
-
}
|
49 |
-
return $this;
|
50 |
-
}
|
51 |
-
|
52 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Ced/LayBuy/controllers/ExpressController.php
DELETED
@@ -1,1859 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Ced_LayBuy_ExpressController extends Mage_Core_Controller_Front_Action
|
3 |
-
{
|
4 |
-
const PAYER_ID = 'payer_id';
|
5 |
-
const PAYER_EMAIL = 'email';
|
6 |
-
const PAYER_STATUS = 'payer_status';
|
7 |
-
const ADDRESS_ID = 'address_id';
|
8 |
-
const ADDRESS_STATUS = 'address_status';
|
9 |
-
const PROTECTION_EL = 'protection_eligibility';
|
10 |
-
const FRAUD_FILTERS = 'collected_fraud_filters';
|
11 |
-
const CORRELATION_ID = 'correlation_id';
|
12 |
-
const AVS_CODE = 'avs_result';
|
13 |
-
const CVV2_MATCH = 'cvv2_check_result';
|
14 |
-
const CENTINEL_VPAS = 'centinel_vpas_result';
|
15 |
-
const CENTINEL_ECI = 'centinel_eci_result';
|
16 |
-
|
17 |
-
// Next two fields are required for Brazil
|
18 |
-
const BUYER_TAX_ID = 'buyer_tax_id';
|
19 |
-
const BUYER_TAX_ID_TYPE = 'buyer_tax_id_type';
|
20 |
-
|
21 |
-
const PAYMENT_STATUS = 'payment_status';
|
22 |
-
const PENDING_REASON = 'pending_reason';
|
23 |
-
const IS_FRAUD = 'is_fraud_detected';
|
24 |
-
const PAYMENT_STATUS_GLOBAL = 'paypal_payment_status';
|
25 |
-
const PENDING_REASON_GLOBAL = 'paypal_pending_reason';
|
26 |
-
const IS_FRAUD_GLOBAL = 'paypal_is_fraud_detected';
|
27 |
-
|
28 |
-
/**
|
29 |
-
* Possible buyer's tax id types (Brazil only)
|
30 |
-
*/
|
31 |
-
const BUYER_TAX_ID_TYPE_CPF = 'BR_CPF';
|
32 |
-
const BUYER_TAX_ID_TYPE_CNPJ = 'BR_CNPJ';
|
33 |
-
|
34 |
-
const PAYMENTSTATUS_NONE = 'none';
|
35 |
-
const PAYMENTSTATUS_COMPLETED = 'completed';
|
36 |
-
const PAYMENTSTATUS_DENIED = 'denied';
|
37 |
-
const PAYMENTSTATUS_EXPIRED = 'expired';
|
38 |
-
const PAYMENTSTATUS_FAILED = 'failed';
|
39 |
-
const PAYMENTSTATUS_INPROGRESS = 'in_progress';
|
40 |
-
const PAYMENTSTATUS_PENDING = 'pending';
|
41 |
-
const PAYMENTSTATUS_REFUNDED = 'refunded';
|
42 |
-
const PAYMENTSTATUS_REFUNDEDPART = 'partially_refunded';
|
43 |
-
const PAYMENTSTATUS_REVERSED = 'reversed';
|
44 |
-
const PAYMENTSTATUS_UNREVERSED = 'canceled_reversal';
|
45 |
-
const PAYMENTSTATUS_PROCESSED = 'processed';
|
46 |
-
const PAYMENTSTATUS_VOIDED = 'voided';
|
47 |
-
|
48 |
-
/**
|
49 |
-
* PayPal payment transaction type
|
50 |
-
*/
|
51 |
-
const TXN_TYPE_ADJUSTMENT = 'adjustment';
|
52 |
-
const TXN_TYPE_NEW_CASE = 'new_case';
|
53 |
-
|
54 |
-
|
55 |
-
/**
|
56 |
-
* Order
|
57 |
-
*
|
58 |
-
* @var Mage_Sales_Model_QuoteMage_Sales_Model_Quote
|
59 |
-
*/
|
60 |
-
protected $_order = null;
|
61 |
-
protected $_amount=null;
|
62 |
-
/**
|
63 |
-
* State helper variables
|
64 |
-
* @var string
|
65 |
-
*/
|
66 |
-
protected $_redirectUrl = '';
|
67 |
-
/**
|
68 |
-
* Billing agreement that might be created during order placing
|
69 |
-
*
|
70 |
-
* @var Mage_Sales_Model_Billing_Agreement
|
71 |
-
*/
|
72 |
-
protected $_billingAgreement = null;
|
73 |
-
/**
|
74 |
-
* Recurring payment profiles
|
75 |
-
*
|
76 |
-
* @var array
|
77 |
-
*/
|
78 |
-
protected $_recurringPaymentProfiles = array();
|
79 |
-
protected $_init=null;
|
80 |
-
protected $_months=null;
|
81 |
-
/**
|
82 |
-
* Map for shipping address import/export (extends billing address mapper)
|
83 |
-
* @var array
|
84 |
-
*/
|
85 |
-
|
86 |
-
protected $_shippingAddressMap = array(
|
87 |
-
'SHIPTOCOUNTRYCODE' => 'country_id',
|
88 |
-
'SHIPTOSTATE' => 'region',
|
89 |
-
'SHIPTOCITY' => 'city',
|
90 |
-
'SHIPTOSTREET' => 'street',
|
91 |
-
'SHIPTOSTREET2' => 'street2',
|
92 |
-
'SHIPTOZIP' => 'postcode',
|
93 |
-
'SHIPTOPHONENUM' => 'telephone',
|
94 |
-
// 'SHIPTONAME' will be treated manually in address import/export methods
|
95 |
-
);
|
96 |
-
/**
|
97 |
-
* All payment information map
|
98 |
-
*
|
99 |
-
* @var array
|
100 |
-
*/
|
101 |
-
protected $_paymentMap = array(
|
102 |
-
self::PAYER_ID => 'paypal_payer_id',
|
103 |
-
self::PAYER_EMAIL => 'paypal_payer_email',
|
104 |
-
self::PAYER_STATUS => 'paypal_payer_status',
|
105 |
-
self::ADDRESS_ID => 'paypal_address_id',
|
106 |
-
self::ADDRESS_STATUS => 'paypal_address_status',
|
107 |
-
self::PROTECTION_EL => 'paypal_protection_eligibility',
|
108 |
-
self::FRAUD_FILTERS => 'paypal_fraud_filters',
|
109 |
-
self::CORRELATION_ID => 'paypal_correlation_id',
|
110 |
-
self::AVS_CODE => 'paypal_avs_code',
|
111 |
-
self::CVV2_MATCH => 'paypal_cvv2_match',
|
112 |
-
self::CENTINEL_VPAS => self::CENTINEL_VPAS,
|
113 |
-
self::CENTINEL_ECI => self::CENTINEL_ECI,
|
114 |
-
self::BUYER_TAX_ID => self::BUYER_TAX_ID,
|
115 |
-
self::BUYER_TAX_ID_TYPE => self::BUYER_TAX_ID_TYPE,
|
116 |
-
);
|
117 |
-
|
118 |
-
/**
|
119 |
-
* System information map
|
120 |
-
*
|
121 |
-
* @var array
|
122 |
-
*/
|
123 |
-
protected $_systemMap = array(
|
124 |
-
self::PAYMENT_STATUS => self::PAYMENT_STATUS_GLOBAL,
|
125 |
-
self::PENDING_REASON => self::PENDING_REASON_GLOBAL,
|
126 |
-
self::IS_FRAUD => self::IS_FRAUD_GLOBAL,
|
127 |
-
);
|
128 |
-
|
129 |
-
protected $_importFromRequestFilters = array(
|
130 |
-
'REDIRECTREQUIRED' => '_filterToBool',
|
131 |
-
'SUCCESSPAGEREDIRECTREQUESTED' => '_filterToBool',
|
132 |
-
'PAYMENTSTATUS' => '_filterPaymentStatusFromNvpToInfo',
|
133 |
-
);
|
134 |
-
public $_laybuyresponse=null;
|
135 |
-
/**
|
136 |
-
* Global public interface map
|
137 |
-
* @var array
|
138 |
-
*/
|
139 |
-
protected $_globalMap = array(
|
140 |
-
// each call
|
141 |
-
'VERSION' => 'version',
|
142 |
-
'USER' => 'api_username',
|
143 |
-
'PWD' => 'api_password',
|
144 |
-
'SIGNATURE' => 'api_signature',
|
145 |
-
'BUTTONSOURCE' => 'build_notation_code',
|
146 |
-
|
147 |
-
// for Unilateral payments
|
148 |
-
'SUBJECT' => 'business_account',
|
149 |
-
|
150 |
-
// commands
|
151 |
-
'PAYMENTACTION' => 'payment_action',
|
152 |
-
'RETURNURL' => 'return_url',
|
153 |
-
'CANCELURL' => 'cancel_url',
|
154 |
-
'INVNUM' => 'inv_num',
|
155 |
-
'TOKEN' => 'token',
|
156 |
-
'CORRELATIONID' => 'correlation_id',
|
157 |
-
'SOLUTIONTYPE' => 'solution_type',
|
158 |
-
'GIROPAYCANCELURL' => 'giropay_cancel_url',
|
159 |
-
'GIROPAYSUCCESSURL' => 'giropay_success_url',
|
160 |
-
'BANKTXNPENDINGURL' => 'giropay_bank_txn_pending_url',
|
161 |
-
'IPADDRESS' => 'ip_address',
|
162 |
-
'NOTIFYURL' => 'notify_url',
|
163 |
-
'RETURNFMFDETAILS' => 'fraud_management_filters_enabled',
|
164 |
-
'NOTE' => 'note',
|
165 |
-
'REFUNDTYPE' => 'refund_type',
|
166 |
-
'ACTION' => 'action',
|
167 |
-
'REDIRECTREQUIRED' => 'redirect_required',
|
168 |
-
'SUCCESSPAGEREDIRECTREQUESTED' => 'redirect_requested',
|
169 |
-
'REQBILLINGADDRESS' => 'require_billing_address',
|
170 |
-
// style settings
|
171 |
-
'PAGESTYLE' => 'page_style',
|
172 |
-
'HDRIMG' => 'hdrimg',
|
173 |
-
'HDRBORDERCOLOR' => 'hdrbordercolor',
|
174 |
-
'HDRBACKCOLOR' => 'hdrbackcolor',
|
175 |
-
'PAYFLOWCOLOR' => 'payflowcolor',
|
176 |
-
'LOCALECODE' => 'locale_code',
|
177 |
-
'PAL' => 'pal',
|
178 |
-
|
179 |
-
// transaction info
|
180 |
-
'TRANSACTIONID' => 'transaction_id',
|
181 |
-
'AUTHORIZATIONID' => 'authorization_id',
|
182 |
-
'REFUNDTRANSACTIONID' => 'refund_transaction_id',
|
183 |
-
'COMPLETETYPE' => 'complete_type',
|
184 |
-
'AMT' => 'amount',
|
185 |
-
'ITEMAMT' => 'subtotal_amount',
|
186 |
-
'GROSSREFUNDAMT' => 'refunded_amount', // possible mistake, check with API reference
|
187 |
-
|
188 |
-
// payment/billing info
|
189 |
-
'CURRENCYCODE' => 'currency_code',
|
190 |
-
'PAYMENTSTATUS' => 'payment_status',
|
191 |
-
'PENDINGREASON' => 'pending_reason',
|
192 |
-
'PROTECTIONELIGIBILITY' => 'protection_eligibility',
|
193 |
-
'PAYERID' => 'payer_id',
|
194 |
-
'PAYERSTATUS' => 'payer_status',
|
195 |
-
'ADDRESSID' => 'address_id',
|
196 |
-
'ADDRESSSTATUS' => 'address_status',
|
197 |
-
'EMAIL' => 'email',
|
198 |
-
// backwards compatibility
|
199 |
-
'FIRSTNAME' => 'firstname',
|
200 |
-
'LASTNAME' => 'lastname',
|
201 |
-
|
202 |
-
// shipping rate
|
203 |
-
'SHIPPINGOPTIONNAME' => 'shipping_rate_code',
|
204 |
-
'NOSHIPPING' => 'suppress_shipping',
|
205 |
-
|
206 |
-
// paypal direct credit card information
|
207 |
-
'CREDITCARDTYPE' => 'credit_card_type',
|
208 |
-
'ACCT' => 'credit_card_number',
|
209 |
-
'EXPDATE' => 'credit_card_expiration_date',
|
210 |
-
'CVV2' => 'credit_card_cvv2',
|
211 |
-
'STARTDATE' => 'maestro_solo_issue_date', // MMYYYY, always six chars, including leading zero
|
212 |
-
'ISSUENUMBER' => 'maestro_solo_issue_number',
|
213 |
-
'CVV2MATCH' => 'cvv2_check_result',
|
214 |
-
'AVSCODE' => 'avs_result',
|
215 |
-
// cardinal centinel
|
216 |
-
'AUTHSTATUS3DS' => 'centinel_authstatus',
|
217 |
-
'MPIVENDOR3DS' => 'centinel_mpivendor',
|
218 |
-
'CAVV' => 'centinel_cavv',
|
219 |
-
'ECI3DS' => 'centinel_eci',
|
220 |
-
'XID' => 'centinel_xid',
|
221 |
-
'VPAS' => 'centinel_vpas_result',
|
222 |
-
'ECISUBMITTED3DS' => 'centinel_eci_result',
|
223 |
-
|
224 |
-
// recurring payment profiles
|
225 |
-
//'TOKEN' => 'token',
|
226 |
-
'SUBSCRIBERNAME' =>'subscriber_name',
|
227 |
-
'PROFILESTARTDATE' => 'start_datetime',
|
228 |
-
'PROFILEREFERENCE' => 'internal_reference_id',
|
229 |
-
'DESC' => 'schedule_description',
|
230 |
-
'MAXFAILEDPAYMENTS' => 'suspension_threshold',
|
231 |
-
'AUTOBILLAMT' => 'bill_failed_later',
|
232 |
-
'BILLINGPERIOD' => 'period_unit',
|
233 |
-
'BILLINGFREQUENCY' => 'period_frequency',
|
234 |
-
'TOTALBILLINGCYCLES' => 'period_max_cycles',
|
235 |
-
//'AMT' => 'billing_amount', // have to use 'amount', see above
|
236 |
-
'TRIALBILLINGPERIOD' => 'trial_period_unit',
|
237 |
-
'TRIALBILLINGFREQUENCY' => 'trial_period_frequency',
|
238 |
-
'TRIALTOTALBILLINGCYCLES' => 'trial_period_max_cycles',
|
239 |
-
'TRIALAMT' => 'trial_billing_amount',
|
240 |
-
// 'CURRENCYCODE' => 'currency_code',
|
241 |
-
'SHIPPINGAMT' => 'shipping_amount',
|
242 |
-
'TAXAMT' => 'tax_amount',
|
243 |
-
'INITAMT' => 'init_amount',
|
244 |
-
'FAILEDINITAMTACTION' => 'init_may_fail',
|
245 |
-
'PROFILEID' => 'recurring_profile_id',
|
246 |
-
'PROFILESTATUS' => 'recurring_profile_status',
|
247 |
-
'STATUS' => 'status',
|
248 |
-
|
249 |
-
//Next two fields are used for Brazil only
|
250 |
-
'TAXID' => 'buyer_tax_id',
|
251 |
-
'TAXIDTYPE' => 'buyer_tax_id_type',
|
252 |
-
|
253 |
-
'BILLINGAGREEMENTID' => 'billing_agreement_id',
|
254 |
-
'REFERENCEID' => 'reference_id',
|
255 |
-
'BILLINGAGREEMENTSTATUS' => 'billing_agreement_status',
|
256 |
-
'BILLINGTYPE' => 'billing_type',
|
257 |
-
'SREET' => 'street',
|
258 |
-
'CITY' => 'city',
|
259 |
-
'STATE' => 'state',
|
260 |
-
'COUNTRYCODE' => 'countrycode',
|
261 |
-
'ZIP' => 'zip',
|
262 |
-
'PAYERBUSINESS' => 'payer_business',
|
263 |
-
);
|
264 |
-
/**
|
265 |
-
* Payment information response specifically to be collected after some requests
|
266 |
-
* @var array
|
267 |
-
*/
|
268 |
-
protected $_paymentInformationResponse = array(
|
269 |
-
'PAYERID', 'PAYERSTATUS', 'CORRELATIONID', 'ADDRESSID', 'ADDRESSSTATUS',
|
270 |
-
'PAYMENTSTATUS', 'PENDINGREASON', 'PROTECTIONELIGIBILITY', 'EMAIL', 'SHIPPINGOPTIONNAME', 'TAXID', 'TAXIDTYPE'
|
271 |
-
);
|
272 |
-
protected $_doExpressCheckoutPaymentResponse = array(
|
273 |
-
'TRANSACTIONID', 'AMT', 'PAYMENTSTATUS', 'PENDINGREASON', 'REDIRECTREQUIRED'
|
274 |
-
);
|
275 |
-
|
276 |
-
protected $_billingaddress;
|
277 |
-
protected $_shippingaddress;
|
278 |
-
/**
|
279 |
-
* Map for billing address import/export
|
280 |
-
* @var array
|
281 |
-
*/
|
282 |
-
protected $_token;
|
283 |
-
protected $_billingAddressMap = array (
|
284 |
-
'BUSINESS' => 'company',
|
285 |
-
'NOTETEXT' => 'customer_notes',
|
286 |
-
'EMAIL' => 'email',
|
287 |
-
'FIRSTNAME' => 'firstname',
|
288 |
-
'LASTNAME' => 'lastname',
|
289 |
-
'MIDDLENAME' => 'middlename',
|
290 |
-
'SALUTATION' => 'prefix',
|
291 |
-
'SUFFIX' => 'suffix',
|
292 |
-
|
293 |
-
'COUNTRYCODE' => 'country_id', // iso-3166 two-character code
|
294 |
-
'STATE' => 'region',
|
295 |
-
'CITY' => 'city',
|
296 |
-
'STREET' => 'street',
|
297 |
-
'STREET2' => 'street2',
|
298 |
-
'ZIP' => 'postcode',
|
299 |
-
'PHONENUM' => 'telephone',
|
300 |
-
);
|
301 |
-
public $_model_obj=null;
|
302 |
-
protected $_checkout = null;
|
303 |
-
protected $_payer_id=null;
|
304 |
-
/**
|
305 |
-
* DoExpressCheckoutPayment request/response map
|
306 |
-
* @var array
|
307 |
-
*/
|
308 |
-
protected $_doExpressCheckoutPaymentRequest = array(
|
309 |
-
'TOKEN', 'PAYERID', 'PAYMENTACTION', 'AMT', 'CURRENCYCODE', 'IPADDRESS', 'BUTTONSOURCE', 'NOTIFYURL',
|
310 |
-
'RETURNFMFDETAILS', 'SUBJECT', 'ITEMAMT', 'SHIPPINGAMT', 'TAXAMT',
|
311 |
-
);
|
312 |
-
protected $_createBillingAgreementResponse = array('BILLINGAGREEMENTID');
|
313 |
-
/**
|
314 |
-
* @var Mage_Paypal_Model_Config
|
315 |
-
*/
|
316 |
-
protected $_config = null;
|
317 |
-
protected $_notify_url=null;
|
318 |
-
protected $_payment_action=null;
|
319 |
-
protected $_increment_id=null;
|
320 |
-
protected $_currency_code=null;
|
321 |
-
protected $_line_item_enabled=null;
|
322 |
-
protected $_address=null;
|
323 |
-
protected $_transaction_id=null;
|
324 |
-
protected $_redirect_req=null;
|
325 |
-
/**
|
326 |
-
* @var Mage_Sales_Model_Quote
|
327 |
-
*/
|
328 |
-
protected $_quote = false;
|
329 |
-
public function setToken($token){
|
330 |
-
$this->_token=$token;
|
331 |
-
}
|
332 |
-
public function setTransactionId($trans_id=null){
|
333 |
-
$this->_transaction_id=$trans_id;
|
334 |
-
}
|
335 |
-
public function getTransactionId(){
|
336 |
-
return $this->_transaction_id;
|
337 |
-
}
|
338 |
-
public function getModelObject(){
|
339 |
-
return $this->_model_obj;
|
340 |
-
}
|
341 |
-
public function getRedirectRequired(){
|
342 |
-
return $this->_redirect_req;
|
343 |
-
}
|
344 |
-
public function getToken($token){
|
345 |
-
return $this->_token;
|
346 |
-
}
|
347 |
-
public function setPayerId($id=""){
|
348 |
-
$this->_payer_id=$id;
|
349 |
-
}
|
350 |
-
public function getPayerId(){
|
351 |
-
return $this->_payer_id;
|
352 |
-
}
|
353 |
-
public function setAmount($amount=""){
|
354 |
-
$this->_amount=$amount;
|
355 |
-
}
|
356 |
-
public function getAmount(){
|
357 |
-
return $this->_amount;
|
358 |
-
}
|
359 |
-
public function setPaymentAction($action=""){
|
360 |
-
$this->_payment_action=$action;
|
361 |
-
}
|
362 |
-
public function getPaymentAction(){
|
363 |
-
return $this->_payment_action;
|
364 |
-
}
|
365 |
-
public function setNotifyUrl($notify=""){
|
366 |
-
$this->_notify_url=$notify;
|
367 |
-
}
|
368 |
-
public function getNotifyUrl(){
|
369 |
-
return $this->_notify_url;
|
370 |
-
}
|
371 |
-
public function setInvNum($increment_id=""){
|
372 |
-
$this->_increment_id=$increment_id;
|
373 |
-
}
|
374 |
-
public function getInvNum(){
|
375 |
-
return $this->_increment_id;
|
376 |
-
}
|
377 |
-
public function setCurrencyCode($currency_code=""){
|
378 |
-
$this->_currency_code=$currency_code;
|
379 |
-
}
|
380 |
-
public function getCurrencyCode(){
|
381 |
-
return $this->_currency_code;
|
382 |
-
}
|
383 |
-
public function setIsLineItemsEnabled($line=""){
|
384 |
-
$this->_line_item_enabled=$line;
|
385 |
-
}
|
386 |
-
public function getIsLineItemsEnabled(){
|
387 |
-
return $this->_line_item_enabled;
|
388 |
-
}
|
389 |
-
public function setAddress($address=""){
|
390 |
-
$this->_address=$address;
|
391 |
-
}
|
392 |
-
public function getAddress(){
|
393 |
-
return $this->_address;
|
394 |
-
}
|
395 |
-
public function setBillingAddress($billing=""){
|
396 |
-
$this->_billing_address=$billing;
|
397 |
-
}
|
398 |
-
public function getBillingAddress(){
|
399 |
-
return $this->_billing_address;
|
400 |
-
}
|
401 |
-
/**
|
402 |
-
* Return checkout session object
|
403 |
-
*
|
404 |
-
* @return Mage_Checkout_Model_Session
|
405 |
-
*/
|
406 |
-
private function _getCheckoutSession()
|
407 |
-
{
|
408 |
-
return Mage::getSingleton('checkout/session');
|
409 |
-
}
|
410 |
-
|
411 |
-
/**
|
412 |
-
* Return checkout quote object
|
413 |
-
*
|
414 |
-
* @return Mage_Sale_Model_Quote
|
415 |
-
*/
|
416 |
-
private function _getQuote()
|
417 |
-
{
|
418 |
-
if (!$this->_quote) {
|
419 |
-
$this->_quote = $this->_getCheckoutSession()->getQuote();
|
420 |
-
}
|
421 |
-
return $this->_quote;
|
422 |
-
}
|
423 |
-
public function setConfigObject($obj){
|
424 |
-
$this->_config=$obj;
|
425 |
-
}
|
426 |
-
public function getConfigObject(){
|
427 |
-
return $this->_config;
|
428 |
-
}
|
429 |
-
/**
|
430 |
-
* Instantiate quote and checkout
|
431 |
-
* @throws Mage_Core_Exception
|
432 |
-
*/
|
433 |
-
/* private function _initCheckout()
|
434 |
-
{
|
435 |
-
$quote = $this->_getQuote();
|
436 |
-
if (!$quote->hasItems() || $quote->getHasError()) {
|
437 |
-
$this->getResponse()->setHeader('HTTP/1.1','403 Forbidden');
|
438 |
-
Mage::throwException(Mage::helper('paypal')->__('Unable to initialize Express Checkout.'));
|
439 |
-
}
|
440 |
-
|
441 |
-
} */
|
442 |
-
|
443 |
-
public function indexAction(){
|
444 |
-
|
445 |
-
$quote = $this->_getQuote();
|
446 |
-
if (!$quote->hasItems() || $quote->getHasError()) {
|
447 |
-
$url = Mage::helper('core/http')->getHttpReferer() ? Mage::helper('core/http')->getHttpReferer() : Mage::getUrl();
|
448 |
-
Mage::getSingleton('core/session')->addError(Mage::helper('laybuy')->__('Product is not added to Cart,unable to initialize Laybuy Express Checkout.Please try again.'));
|
449 |
-
Mage::app()->getFrontController()->getResponse()->setRedirect($url);
|
450 |
-
Mage::app()->getResponse()->sendResponse();
|
451 |
-
exit;
|
452 |
-
//$this->getResponse()->setHeader('HTTP/1.1','403 Forbidden');
|
453 |
-
//Mage::throwException(Mage::helper('laybuy')->__('Unable to initialize Laybuy Express Checkout.'));
|
454 |
-
}
|
455 |
-
$model=Mage::getModel("laybuy/express");
|
456 |
-
$product_id="";
|
457 |
-
$store_id="";
|
458 |
-
if(!$model->isAvailable($quote) || !$model->checkForCategoriesAndProducts($product_id,$store_id)){
|
459 |
-
if(!$model->isAvailable($quote)){
|
460 |
-
Mage::getSingleton('core/session')->addError(Mage::helper('laybuy')->__('Laybuy Express is not Available.'));
|
461 |
-
$this->_redirect('checkout/cart/index');
|
462 |
-
}
|
463 |
-
if(!$model->checkForCategoriesAndProducts($product_id,$store_id)){
|
464 |
-
$product_names="";
|
465 |
-
$product_names=$model->returnRestrictedProductNames($product_id,$store_id);
|
466 |
-
Mage::getSingleton('core/session')->addError(Mage::helper('laybuy')->__('Your cart contains restricted products that are not allowed to pay using Lay-Buy.Please first remove these products - '.$product_names.'.'));
|
467 |
-
|
468 |
-
}
|
469 |
-
$this->_redirect('checkout/cart/index');
|
470 |
-
}
|
471 |
-
else{
|
472 |
-
$this->loadLayout();
|
473 |
-
$this->renderLayout();
|
474 |
-
}
|
475 |
-
|
476 |
-
}
|
477 |
-
public function formAction(){
|
478 |
-
|
479 |
-
$quote = $this->_getQuote();
|
480 |
-
$model=Mage::getModel("laybuy/express");
|
481 |
-
$product_id="";
|
482 |
-
$store_id="";
|
483 |
-
if(!$model->isAvailable($quote) || !$model->checkForCategoriesAndProducts($product_id,$store_id)){
|
484 |
-
if(!$model->checkForCategoriesAndProducts($product_id,$store_id)){
|
485 |
-
$product_names="";
|
486 |
-
$product_names=$model->returnRestrictedProductNames($product_id,$store_id);
|
487 |
-
Mage::getSingleton('core/session')->addError(Mage::helper('laybuy')->__('Your cart contains restricted products that are not allowed to pay using Lay-Buy.Please first remove these products - '.$product_names.'.'));
|
488 |
-
|
489 |
-
}
|
490 |
-
$this->_redirect('checkout/cart/index');
|
491 |
-
}
|
492 |
-
|
493 |
-
if($this->getRequest()->getParams()){
|
494 |
-
$quote=Mage::getSingleton('checkout/session')->getQuote();
|
495 |
-
|
496 |
-
$email = $quote->getBillingAddress()->getEmail();
|
497 |
-
|
498 |
-
if (!$email) $email = $quote->getCustomerEmail();
|
499 |
-
|
500 |
-
$request=array();
|
501 |
-
$amt="";
|
502 |
-
$storeId="";
|
503 |
-
$storeId=Mage::app()->getStore()->getId();
|
504 |
-
if($checkout = Mage::getSingleton('checkout/session')){
|
505 |
-
$totals = $checkout->getQuote()->getTotals();
|
506 |
-
$amt = $totals["grand_total"]->getValue();
|
507 |
-
}
|
508 |
-
|
509 |
-
$currency_code ="";
|
510 |
-
$currency_code = Mage::app()->getStore()->getCurrentCurrencyCode();
|
511 |
-
$request["AMOUNT"]=$amt;
|
512 |
-
$request["MEMBER"]=Mage::getStoreConfig('payment/laybuy/membership_number',$storeId);
|
513 |
-
$request["CURRENCY"]=$currency_code;
|
514 |
-
$request["RETURNURL"]=Mage::getUrl("laybuy/express/return");
|
515 |
-
$request["CANCELURL"]=Mage::getUrl("laybuy/express/cancel");
|
516 |
-
$request["GETEXPRESSRETURNURL"]=Mage::getUrl("laybuy/express/returnfromgetexpress");
|
517 |
-
/* $request["RETURNURL"]="http://192.168.1.44/magento18/magento/index.php/laybuy/express/return/";
|
518 |
-
$request["CANCELURL"]="http://192.168.1.44/magento18/magento/index.php/laybuy/express/cancel/";
|
519 |
-
$request["GETEXPRESSRETURNURL"]="http://192.168.1.44/magento18/magento/index.php/laybuy/express/returnfromgetexpress";
|
520 |
-
*/
|
521 |
-
$cartItems = Mage::getSingleton('checkout/session')->getQuote()->getAllItems();
|
522 |
-
$description="";
|
523 |
-
foreach ($cartItems as $item) {
|
524 |
-
$_product = Mage::getModel('catalog/product')->load($item->getProduct()->getId());
|
525 |
-
if($description){
|
526 |
-
$description .= ' <br/> ';
|
527 |
-
}
|
528 |
-
$description .= strip_tags($_product->getShortDescription()).'(Qty '.(int)$item->getQty().')';
|
529 |
-
}
|
530 |
-
$request["DESC"]=$description;
|
531 |
-
$reserved_order_id="";
|
532 |
-
Mage::getSingleton('checkout/session')->getQuote()->reserveOrderId()->save();
|
533 |
-
$reserved_order_id=Mage::getSingleton('checkout/session')->getQuote()->getReservedOrderId();
|
534 |
-
$request["CUSTOM"]=$reserved_order_id;
|
535 |
-
$request["EMAIL"]=$email;
|
536 |
-
$request["BYPASSLAYBUY"]=Mage::getStoreConfig('payment/laybuy/bypasslaybuy');
|
537 |
-
$request["VERSION"]='0.2';
|
538 |
-
$params="";
|
539 |
-
$params=$this->getRequest()->getParam("payment");
|
540 |
-
$mnth="";
|
541 |
-
$init="";
|
542 |
-
|
543 |
-
$mnth= $params["laybuy_months"];
|
544 |
-
$init=$params["laybuy_init"];
|
545 |
-
|
546 |
-
$request["INIT"]=0;
|
547 |
-
$MAXD = Mage::getStoreConfig('payment/laybuy/maxd',$storeId);
|
548 |
-
$MIND = Mage::getStoreConfig('payment/laybuy/mind',$storeId);
|
549 |
-
$IMAGE = Mage::getStoreConfig('payment/laybuy/image',$storeId);
|
550 |
-
if(isset($mnth) && $mnth){
|
551 |
-
$MONTHS =$mnth;
|
552 |
-
}else{
|
553 |
-
$MONTHS = Mage::getStoreConfig('payment/laybuy/months',$storeId);
|
554 |
-
}
|
555 |
-
if(isset($init) && $init){
|
556 |
-
$INIT = $init;
|
557 |
-
}else{
|
558 |
-
$INIT = 0;
|
559 |
-
}
|
560 |
-
/* Restrict maxiumum possible downpayment percentage to less then or equal 50% */
|
561 |
-
if(!$MIND || $MIND<20 || $MIND>50){
|
562 |
-
$MIND = 20;
|
563 |
-
}
|
564 |
-
if(!$MAXD || $MAXD<20 || $MAXD>50){
|
565 |
-
$MAXD = 50;
|
566 |
-
}
|
567 |
-
if($IMAGE){
|
568 |
-
$IMAGE = Mage::getBaseUrl('media')."laybuy/".$IMAGE;
|
569 |
-
}else{
|
570 |
-
$IMAGE = 'http://lay-buys.com/lb2.jpg';
|
571 |
-
}
|
572 |
-
if(!$MONTHS || $MONTHS<0){
|
573 |
-
$MONTHS = 3;
|
574 |
-
}
|
575 |
-
if($INIT){
|
576 |
-
|
577 |
-
$request["INIT"]=$INIT;
|
578 |
-
}
|
579 |
-
$this->_init=$request["INIT"];
|
580 |
-
|
581 |
-
$request["MIND"]=$MIND ;
|
582 |
-
$request["MAXD"]=$MAXD;
|
583 |
-
$request["IMAGE"]=$IMAGE;
|
584 |
-
$request["MONTHS"]=$MONTHS;
|
585 |
-
Mage::getSingleton('core/session')->setPaymentMonths($request["MONTHS"]);
|
586 |
-
Mage::getSingleton('core/session')->setPaymentInit($request["INIT"]);
|
587 |
-
$sessionPayment = Mage::getSingleton('checkout/session')->getQuote()->getPayment();
|
588 |
-
$sessionPayment->setData('laybuy_init',$request["INIT"]);
|
589 |
-
$sessionPayment->setData('laybuy_months',$request["MONTHS"]);
|
590 |
-
$sessionPayment->save();
|
591 |
-
$this->_months=$request["MONTHS"];
|
592 |
-
$helper=Mage::helper('laybuy');
|
593 |
-
$redirectURL="http://lay-buys.com/expressgateway/";
|
594 |
-
$token="";
|
595 |
-
|
596 |
-
if($token = $helper->postToLaybuy($redirectURL,$request)){
|
597 |
-
$this->getResponse()->setBody($this->getLayout()->createBlock('Ced_LayBuy_Block_Express_Redirect')->setData('token',$token)->toHtml());
|
598 |
-
}
|
599 |
-
|
600 |
-
|
601 |
-
}
|
602 |
-
else{
|
603 |
-
$this->_redirect("laybuy/express/index");
|
604 |
-
}
|
605 |
-
}
|
606 |
-
/**
|
607 |
-
* DoExpressCheckout call
|
608 |
-
* @link https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_DoExpressCheckoutPayment
|
609 |
-
*/
|
610 |
-
public function callDoExpressCheckoutPayment()
|
611 |
-
{
|
612 |
-
|
613 |
-
$payer_id="";
|
614 |
-
if(Mage::getSingleton('core/session')->getPaymentPayerId()){
|
615 |
-
$payer_id=Mage::getSingleton('core/session')->getPaymentPayerId();
|
616 |
-
}
|
617 |
-
$token="";
|
618 |
-
if(Mage::getSingleton('core/session')->getLaybuyExpressToken()){
|
619 |
-
$token=Mage::getSingleton('core/session')->getLaybuyExpressToken();
|
620 |
-
}
|
621 |
-
$sandbox="";
|
622 |
-
if(Mage::getSingleton('core/session')->getSandbox()){
|
623 |
-
$sandbox=Mage::getSingleton('core/session')->getSandbox();
|
624 |
-
}
|
625 |
-
$vpayment="";
|
626 |
-
if(Mage::getSingleton('core/session')->getVpaymentId()){
|
627 |
-
$vpayment=Mage::getSingleton('core/session')->getVpaymentId();
|
628 |
-
}
|
629 |
-
$quote="";
|
630 |
-
$email ="";
|
631 |
-
$city="";
|
632 |
-
$firstname="";
|
633 |
-
$lastname="";
|
634 |
-
$company="";
|
635 |
-
$street="";
|
636 |
-
$region_id="";
|
637 |
-
$region ="";
|
638 |
-
$state="";
|
639 |
-
$postcode="";
|
640 |
-
$country_id="";
|
641 |
-
$telephone="";
|
642 |
-
$country_name="";
|
643 |
-
$quote=Mage::getSingleton('checkout/session')->getQuote();
|
644 |
-
$email = $quote->getBillingAddress()->getEmail();
|
645 |
-
$city=$quote->getBillingAddress()->getCity();
|
646 |
-
$firstname=$quote->getBillingAddress()->getFirstname();
|
647 |
-
$lastname=$quote->getBillingAddress()->getLastname();
|
648 |
-
$company=$quote->getBillingAddress()->getCompany();
|
649 |
-
$street=$quote->getBillingAddress()->getStreet();
|
650 |
-
$region_id=$quote->getBillingAddress()->getRegionId();
|
651 |
-
$region = Mage::getModel('directory/region')->load($region_id);
|
652 |
-
$state=$region->getName();
|
653 |
-
$postcode=$quote->getBillingAddress()->getPostcode();
|
654 |
-
$country_id=$quote->getBillingAddress()->getCountryId();
|
655 |
-
$country = Mage::getModel('directory/country')->loadByCode($country_id);
|
656 |
-
$country_name=$country->getName();
|
657 |
-
$telephone=$quote->getBillingAddress()->getTelephone();
|
658 |
-
|
659 |
-
$request=array();
|
660 |
-
$cartItems = Mage::getSingleton('checkout/session')->getQuote()->getAllItems();
|
661 |
-
$description="";
|
662 |
-
foreach ($cartItems as $item) {
|
663 |
-
$_product = Mage::getModel('catalog/product')->load($item->getProduct()->getId());
|
664 |
-
if($description){
|
665 |
-
$description .= ' <br/> ';
|
666 |
-
}
|
667 |
-
$description .= strip_tags($_product->getShortDescription()).'(Qty '.(int)$item->getQty().')';
|
668 |
-
}
|
669 |
-
$request["DESC"]=$description;
|
670 |
-
$request["TOKEN"]=$token;
|
671 |
-
$request["PAYERID"]=$payer_id;
|
672 |
-
$request["COUNTRY_NAME"]=$country_name;
|
673 |
-
$request["CITY"]=$city;
|
674 |
-
$request["FIRSTNAME"]=$firstname;
|
675 |
-
$request["LASTNAME"]=$lastname;
|
676 |
-
$request["COMPANY"]=$company;
|
677 |
-
$street2="";
|
678 |
-
$street1="";
|
679 |
-
if(is_array($street)){
|
680 |
-
$street1=$street[0];
|
681 |
-
if(isset($street[1])){
|
682 |
-
$street2=$street[1];
|
683 |
-
}
|
684 |
-
|
685 |
-
}
|
686 |
-
$request["STREET1"]=$street1;
|
687 |
-
$request["STREET2"]=$street2;
|
688 |
-
$request["STATE"]=$state;
|
689 |
-
$request["POSTCODE"]=$postcode;
|
690 |
-
$request["COUNTRYID"]=$country_id;
|
691 |
-
$request["TELEPHONE"]=$telephone;
|
692 |
-
$amt="";
|
693 |
-
$storeId="";
|
694 |
-
$storeId=Mage::app()->getStore()->getId();
|
695 |
-
if($checkout = Mage::getSingleton('checkout/session')){
|
696 |
-
$totals = $checkout->getQuote()->getTotals();
|
697 |
-
$amt = $totals["grand_total"]->getValue();
|
698 |
-
}
|
699 |
-
$currency_code ="";
|
700 |
-
$currency_code = Mage::app()->getStore()->getCurrentCurrencyCode();
|
701 |
-
$request["AMOUNT"]=$amt;
|
702 |
-
|
703 |
-
$request["MEMBER"]=Mage::getStoreConfig('payment/laybuy/membership_number',$storeId);
|
704 |
-
|
705 |
-
$request["CURRENCY"]=$currency_code;
|
706 |
-
$cartItems = Mage::getSingleton('checkout/session')->getQuote()->getAllItems();
|
707 |
-
$description="";
|
708 |
-
foreach ($cartItems as $item) {
|
709 |
-
$_product = Mage::getModel('catalog/product')->load($item->getProduct()->getId());
|
710 |
-
if($description){
|
711 |
-
$description .= ' <br/> ';
|
712 |
-
}
|
713 |
-
$description .= strip_tags($_product->getShortDescription()).'(Qty '.(int)$item->getQty().')';
|
714 |
-
}
|
715 |
-
$request["DESC"]=$description;
|
716 |
-
$reserved_order_id="";
|
717 |
-
$reserved_order_id=Mage::getSingleton('checkout/session')->getQuote()->getReservedOrderId();
|
718 |
-
$request["CUSTOM"]=$reserved_order_id;
|
719 |
-
$request["EMAIL"]=$email;
|
720 |
-
$request["BYPASSLAYBUY"]=Mage::getStoreConfig('payment/laybuy/bypasslaybuy');
|
721 |
-
$request["VERSION"]='0.2';
|
722 |
-
if( Mage::getSingleton('core/session')->getPaymentMonths()){
|
723 |
-
$mnth= Mage::getSingleton('core/session')->getPaymentMonths();
|
724 |
-
}
|
725 |
-
if(Mage::getSingleton('core/session')->getPaymentInit()){
|
726 |
-
$init=Mage::getSingleton('core/session')->getPaymentInit();
|
727 |
-
}
|
728 |
-
$request["INIT"]=0;
|
729 |
-
$MAXD = Mage::getStoreConfig('payment/laybuy/maxd',$storeId);
|
730 |
-
$MIND = Mage::getStoreConfig('payment/laybuy/mind',$storeId);
|
731 |
-
$IMAGE = Mage::getStoreConfig('payment/laybuy/image',$storeId);
|
732 |
-
if(isset($mnth) && $mnth){
|
733 |
-
$MONTHS =$mnth;
|
734 |
-
}else{
|
735 |
-
$MONTHS = Mage::getStoreConfig('payment/laybuy/months',$storeId);
|
736 |
-
}
|
737 |
-
if(isset($init) && $init){
|
738 |
-
$INIT = $init;
|
739 |
-
}else{
|
740 |
-
$INIT = 0;
|
741 |
-
}
|
742 |
-
/* Restrict maxiumum possible downpayment percentage to less then or equal 50% */
|
743 |
-
if(!$MIND || $MIND<20 || $MIND>50){
|
744 |
-
$MIND = 20;
|
745 |
-
}
|
746 |
-
if(!$MAXD || $MAXD<20 || $MAXD>50){
|
747 |
-
$MAXD = 50;
|
748 |
-
}
|
749 |
-
if($IMAGE){
|
750 |
-
$IMAGE = Mage::getBaseUrl('media')."laybuy/".$IMAGE;
|
751 |
-
}else{
|
752 |
-
$IMAGE = 'http://lay-buys.com/lb2.jpg';
|
753 |
-
}
|
754 |
-
if(!$MONTHS || $MONTHS<0){
|
755 |
-
$MONTHS = 3;
|
756 |
-
}
|
757 |
-
if($INIT){
|
758 |
-
|
759 |
-
$request["INIT"]=$INIT;
|
760 |
-
}
|
761 |
-
$request["MIND"]=$MIND ;
|
762 |
-
$request["MAXD"]=$MAXD;
|
763 |
-
$request["IMAGE"]=$IMAGE;
|
764 |
-
$request["MONTHS"]=$MONTHS;
|
765 |
-
$request["DO_EXPRESS"]="1";
|
766 |
-
$request['SANDBOX']=$sandbox;
|
767 |
-
$request['VPAYMENTID']=$vpayment;
|
768 |
-
|
769 |
-
$helper=Mage::helper('laybuy');
|
770 |
-
$redirectURL="https://lay-buys.com/expressgateway/doexpress/";
|
771 |
-
|
772 |
-
$postdata ='';
|
773 |
-
|
774 |
-
foreach($request as $lname=>$lvalue){
|
775 |
-
/* if($lname == 'MEMBER') continue; */
|
776 |
-
$postdata .= $lname."=".urlencode($lvalue)."&";
|
777 |
-
}
|
778 |
-
$postdata = rtrim($postdata,'&');
|
779 |
-
|
780 |
-
$ch = curl_init();
|
781 |
-
curl_setopt($ch, CURLOPT_URL,$redirectURL);
|
782 |
-
curl_setopt($ch, CURLOPT_POST, 1);
|
783 |
-
curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
|
784 |
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
785 |
-
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,false);
|
786 |
-
$result = curl_exec($ch);
|
787 |
-
curl_close ($ch);
|
788 |
-
$result = json_decode($result,true);
|
789 |
-
if($result['ACK']=="FAILURE"){
|
790 |
-
print_r($result);die();
|
791 |
-
}
|
792 |
-
$doexpressresponse="";
|
793 |
-
$laybuyresponse="";
|
794 |
-
if(isset($result['doexpressresponse'])){
|
795 |
-
$doexpressresponse=$result['doexpressresponse'];
|
796 |
-
}
|
797 |
-
if(isset($result['laybuyresponse'])){
|
798 |
-
$laybuyresponse=$result['laybuyresponse'];
|
799 |
-
$this->_laybuyresponse=$result['laybuyresponse'];
|
800 |
-
$jsonresponse=json_encode($result['laybuyresponse']);
|
801 |
-
$respmodel=Mage::getModel("laybuy/laybuyresp");
|
802 |
-
$respmodel->setData("order_id",$result['laybuyresponse']["CUSTOM"]);
|
803 |
-
$respmodel->setData("response",$jsonresponse);
|
804 |
-
$respmodel->save();
|
805 |
-
}
|
806 |
-
if($laybuyresponse){
|
807 |
-
$this->_transaction_id=$laybuyresponse['DP_PAYPAL_TXN_ID'];
|
808 |
-
}
|
809 |
-
if($doexpressresponse){
|
810 |
-
$this->_redirect_req=$doexpressresponse['SUCCESSPAGEREDIRECTREQUESTED'];
|
811 |
-
}
|
812 |
-
/* $this->_prepareExpressCheckoutCallRequest($this->_doExpressCheckoutPaymentRequest);
|
813 |
-
$request = $this->_exportToRequest($this->_doExpressCheckoutPaymentRequest);
|
814 |
-
$this->_exportLineItems($request);
|
815 |
-
|
816 |
-
if ($this->getAddress()) {
|
817 |
-
$request = $this->_importAddresses($request);
|
818 |
-
$request['ADDROVERRIDE'] = 1;
|
819 |
-
}*/
|
820 |
-
$response = $doexpressresponse;
|
821 |
-
$this->_model_obj=new Ced_LayBuy_Model_Abstract();
|
822 |
-
$this->_model_obj->_importFromResponse($this->_paymentInformationResponse, $response);//$this
|
823 |
-
$this->_model_obj->_importFromResponse($this->_doExpressCheckoutPaymentResponse, $response);
|
824 |
-
$this->_model_obj->_importFromResponse($this->_createBillingAgreementResponse, $response);
|
825 |
-
|
826 |
-
|
827 |
-
}
|
828 |
-
|
829 |
-
public function returnfromgetexpressAction(){
|
830 |
-
if($this->getRequest()->getParams()){
|
831 |
-
$data=$this->getRequest()->getParams();
|
832 |
-
//var_dump($data);die("hellooooohiii");
|
833 |
-
Mage::getSingleton('core/session')->setSandbox($data['sand']);
|
834 |
-
Mage::getSingleton('core/session')->setVpaymentId($data['vpay']);
|
835 |
-
$token=$data['TOKEN'];
|
836 |
-
$this->_token=$data['TOKEN'];
|
837 |
-
$payer_id=$data['PAYERID'];
|
838 |
-
$this->_payer_id=$data['PAYERID'];
|
839 |
-
Mage::getSingleton('core/session')->setPaymentPayerId($payer_id);
|
840 |
-
Mage::getSingleton('core/session')->setLaybuyExpressToken($token);
|
841 |
-
$this->_importFromResponse($this->_paymentInformationResponse, $data);
|
842 |
-
$this->_exportAddressses($data);
|
843 |
-
$this->_initCheckout();
|
844 |
-
$quote = $this->_quote;
|
845 |
-
$this->_ignoreAddressValidation();
|
846 |
-
$billingAddress = $quote->getBillingAddress();
|
847 |
-
$exportedBillingAddress = $this->getExportedBillingAddress();
|
848 |
-
$quote->setCustomerEmail($billingAddress->getEmail());
|
849 |
-
$quote->setCustomerPrefix($billingAddress->getPrefix());
|
850 |
-
$quote->setCustomerFirstname($billingAddress->getFirstname());
|
851 |
-
$quote->setCustomerMiddlename($billingAddress->getMiddlename());
|
852 |
-
$quote->setCustomerLastname($billingAddress->getLastname());
|
853 |
-
$quote->setCustomerSuffix($billingAddress->getSuffix());
|
854 |
-
$quote->setCustomerNote($exportedBillingAddress->getData('note'));
|
855 |
-
$this->_setExportedAddressData($billingAddress, $exportedBillingAddress);
|
856 |
-
// import shipping address
|
857 |
-
$exportedShippingAddress = $this->getExportedShippingAddress();
|
858 |
-
if (!$quote->getIsVirtual()) {
|
859 |
-
$shippingAddress = $quote->getShippingAddress();
|
860 |
-
if ($shippingAddress) {
|
861 |
-
if ($exportedShippingAddress) {
|
862 |
-
$this->_setExportedAddressData($shippingAddress, $exportedShippingAddress);
|
863 |
-
$shippingAddress->setCollectShippingRates(true);
|
864 |
-
$shippingAddress->setSameAsBilling(0);
|
865 |
-
|
866 |
-
}
|
867 |
-
|
868 |
-
// import shipping method
|
869 |
-
/* $code = '';
|
870 |
-
|
871 |
-
if ($this->_api->getShippingRateCode()) {
|
872 |
-
if ($code = $this->_matchShippingMethodCode($shippingAddress, $this->_api->getShippingRateCode())) {
|
873 |
-
// possible bug of double collecting rates :-/
|
874 |
-
$shippingAddress->setShippingMethod($code)->setCollectShippingRates(true);
|
875 |
-
}
|
876 |
-
}
|
877 |
-
$quote->getPayment()->setAdditionalInformation(
|
878 |
-
self::PAYMENT_INFO_TRANSPORT_SHIPPING_METHOD,
|
879 |
-
$code
|
880 |
-
);*/
|
881 |
-
}
|
882 |
-
}
|
883 |
-
$payment = $quote->getPayment();
|
884 |
-
|
885 |
-
$payment->setMethod("laybuy_express");
|
886 |
-
$this->importToPayment($this, $payment);
|
887 |
-
$payment->setAdditionalInformation('laybuy_express_checkout_payer_id', $payer_id)
|
888 |
-
->setAdditionalInformation('laybuy_express_checkout_token', $token);
|
889 |
-
$quote->collectTotals()->save();
|
890 |
-
$this->_redirect('*/*/review');
|
891 |
-
return;
|
892 |
-
}
|
893 |
-
|
894 |
-
}
|
895 |
-
/**
|
896 |
-
* Check whether the payment was processed successfully
|
897 |
-
*
|
898 |
-
* @param Mage_Payment_Model_Info $payment
|
899 |
-
* @return bool
|
900 |
-
*/
|
901 |
-
public static function isPaymentSuccessful(Mage_Payment_Model_Info $payment)
|
902 |
-
{
|
903 |
-
$paymentStatus = $payment->getAdditionalInformation(self::PAYMENT_STATUS_GLOBAL);
|
904 |
-
if (in_array($paymentStatus, array(
|
905 |
-
self::PAYMENTSTATUS_COMPLETED, self::PAYMENTSTATUS_INPROGRESS, self::PAYMENTSTATUS_REFUNDED,
|
906 |
-
self::PAYMENTSTATUS_REFUNDEDPART, self::PAYMENTSTATUS_UNREVERSED, self::PAYMENTSTATUS_PROCESSED,
|
907 |
-
))) {
|
908 |
-
return true;
|
909 |
-
}
|
910 |
-
$pendingReason = $payment->getAdditionalInformation(self::PENDING_REASON_GLOBAL);
|
911 |
-
return self::PAYMENTSTATUS_PENDING === $paymentStatus
|
912 |
-
&& in_array($pendingReason, array('authorization', 'order'));
|
913 |
-
}
|
914 |
-
/**
|
915 |
-
* Check whether the payment was processed unsuccessfully or failed
|
916 |
-
*
|
917 |
-
* @param Mage_Payment_Model_Info $payment
|
918 |
-
* @return bool
|
919 |
-
*/
|
920 |
-
public static function isPaymentFailed(Mage_Payment_Model_Info $payment)
|
921 |
-
{
|
922 |
-
$paymentStatus = $payment->getAdditionalInformation(self::PAYMENT_STATUS_GLOBAL);
|
923 |
-
return in_array($paymentStatus, array(
|
924 |
-
self::PAYMENTSTATUS_DENIED, self::PAYMENTSTATUS_EXPIRED, self::PAYMENTSTATUS_FAILED,
|
925 |
-
self::PAYMENTSTATUS_REVERSED, self::PAYMENTSTATUS_VOIDED,
|
926 |
-
));
|
927 |
-
}
|
928 |
-
/**
|
929 |
-
* Check whether the payment is in review state
|
930 |
-
*
|
931 |
-
* @param Mage_Payment_Model_Info $payment
|
932 |
-
* @return bool
|
933 |
-
*/
|
934 |
-
public static function isPaymentReviewRequired(Mage_Payment_Model_Info $payment)
|
935 |
-
{
|
936 |
-
$paymentStatus = $payment->getAdditionalInformation(self::PAYMENT_STATUS_GLOBAL);
|
937 |
-
if (self::PAYMENTSTATUS_PENDING === $paymentStatus) {
|
938 |
-
$pendingReason = $payment->getAdditionalInformation(self::PENDING_REASON_GLOBAL);
|
939 |
-
return !in_array($pendingReason, array('authorization', 'order'));
|
940 |
-
}
|
941 |
-
return false;
|
942 |
-
}
|
943 |
-
/**
|
944 |
-
* Grab data from source and map it into payment
|
945 |
-
*
|
946 |
-
* @param array|Varien_Object|callback $from
|
947 |
-
* @param Mage_Payment_Model_Info $payment
|
948 |
-
*/
|
949 |
-
public function importToPayment($from, Mage_Payment_Model_Info $payment)
|
950 |
-
{
|
951 |
-
$fullMap = array_merge($this->_paymentMap, $this->_systemMap);
|
952 |
-
|
953 |
-
if (is_object($from)) {
|
954 |
-
$from = array($from, 'getDataUsingMethod');
|
955 |
-
}
|
956 |
-
|
957 |
-
Varien_Object_Mapper::accumulateByMap($from, array($payment, 'setAdditionalInformation'), $fullMap);
|
958 |
-
|
959 |
-
}
|
960 |
-
|
961 |
-
/**
|
962 |
-
* Import $this public data from a private response array
|
963 |
-
*
|
964 |
-
* @param array $privateResponseMap
|
965 |
-
* @param array $response
|
966 |
-
*/
|
967 |
-
protected function _importFromResponse(array $privateResponseMap, array $response)
|
968 |
-
{
|
969 |
-
$map = array();
|
970 |
-
foreach ($privateResponseMap as $key) {
|
971 |
-
if (isset($this->_globalMap[$key])) {
|
972 |
-
$map[$key] = $this->_globalMap[$key];
|
973 |
-
}
|
974 |
-
if (isset($response[$key]) && isset($this->_importFromRequestFilters[$key])) {
|
975 |
-
$callback = $this->_importFromRequestFilters[$key];
|
976 |
-
$response[$key] = call_user_func(array($this, $callback), $response[$key], $key, $map[$key]);
|
977 |
-
}
|
978 |
-
}
|
979 |
-
Varien_Object_Mapper::accumulateByMap($response, array($this, 'setDataUsingMethod'), $map);
|
980 |
-
}
|
981 |
-
|
982 |
-
/**
|
983 |
-
* Sets address data from exported address
|
984 |
-
*
|
985 |
-
* @param Mage_Sales_Model_Quote_Address $address
|
986 |
-
* @param array $exportedAddress
|
987 |
-
*/
|
988 |
-
protected function _setExportedAddressData($address, $exportedAddress)
|
989 |
-
{
|
990 |
-
foreach ($exportedAddress->getExportedKeys() as $key) {
|
991 |
-
$oldData = $address->getDataUsingMethod($key);
|
992 |
-
$isEmpty = null;
|
993 |
-
if (is_array($oldData)) {
|
994 |
-
foreach($oldData as $val) {
|
995 |
-
if(!empty($val)) {
|
996 |
-
$isEmpty = false;
|
997 |
-
break;
|
998 |
-
}
|
999 |
-
$isEmpty = true;
|
1000 |
-
}
|
1001 |
-
}
|
1002 |
-
if (empty($oldData) || $isEmpty === true) {
|
1003 |
-
$address->setDataUsingMethod($key, $exportedAddress->getData($key));
|
1004 |
-
}
|
1005 |
-
}
|
1006 |
-
}
|
1007 |
-
protected function setExportedBillingAddress($address=""){
|
1008 |
-
$this->_billingaddress=$address;
|
1009 |
-
}
|
1010 |
-
protected function getExportedBillingAddress($address=""){
|
1011 |
-
return $this->_billingaddress;
|
1012 |
-
}
|
1013 |
-
protected function setExportedShippingAddress($address=""){
|
1014 |
-
$this->_shippingaddress=$address;
|
1015 |
-
}
|
1016 |
-
protected function getExportedShippingAddress($address=""){
|
1017 |
-
return $this->_shippingaddress;
|
1018 |
-
}
|
1019 |
-
/**
|
1020 |
-
* Create billing and shipping addresses basing on response data
|
1021 |
-
* @param array $data
|
1022 |
-
*/
|
1023 |
-
protected function _exportAddressses($data)
|
1024 |
-
{
|
1025 |
-
$address = new Varien_Object();
|
1026 |
-
Varien_Object_Mapper::accumulateByMap($data, $address, $this->_billingAddressMap);
|
1027 |
-
$address->setExportedKeys(array_values($this->_billingAddressMap));
|
1028 |
-
$this->_applyStreetAndRegionWorkarounds($address);
|
1029 |
-
$this->setExportedBillingAddress($address);
|
1030 |
-
// assume there is shipping address if there is at least one field specific to shipping
|
1031 |
-
if (isset($data['SHIPTONAME'])) {
|
1032 |
-
$shippingAddress = clone $address;
|
1033 |
-
Varien_Object_Mapper::accumulateByMap($data, $shippingAddress, $this->_shippingAddressMap);
|
1034 |
-
$this->_applyStreetAndRegionWorkarounds($shippingAddress);
|
1035 |
-
// PayPal doesn't provide detailed shipping name fields, so the name will be overwritten
|
1036 |
-
$firstName = $data['SHIPTONAME'];
|
1037 |
-
$lastName = null;
|
1038 |
-
if (isset($data['FIRSTNAME']) && $data['LASTNAME']) {
|
1039 |
-
$firstName = $data['FIRSTNAME'];
|
1040 |
-
$lastName = $data['LASTNAME'];
|
1041 |
-
}
|
1042 |
-
$shippingAddress->addData(array(
|
1043 |
-
'prefix' => null,
|
1044 |
-
'firstname' => $firstName,
|
1045 |
-
'middlename' => null,
|
1046 |
-
'lastname' => $lastName,
|
1047 |
-
'suffix' => null,
|
1048 |
-
));
|
1049 |
-
$this->setExportedShippingAddress($shippingAddress);
|
1050 |
-
|
1051 |
-
}
|
1052 |
-
}
|
1053 |
-
/**
|
1054 |
-
* Adopt specified address object to be compatible with Magento
|
1055 |
-
*
|
1056 |
-
* @param Varien_Object $address
|
1057 |
-
*/
|
1058 |
-
protected function _applyStreetAndRegionWorkarounds(Varien_Object $address)
|
1059 |
-
{
|
1060 |
-
// merge street addresses into 1
|
1061 |
-
if ($address->hasStreet2()) {
|
1062 |
-
$address->setStreet(implode("\n", array($address->getStreet(), $address->getStreet2())));
|
1063 |
-
$address->unsStreet2();
|
1064 |
-
}
|
1065 |
-
// attempt to fetch region_id from directory
|
1066 |
-
if ($address->getCountryId() && $address->getRegion()) {
|
1067 |
-
$regions = Mage::getModel('directory/country')->loadByCode($address->getCountryId())->getRegionCollection()
|
1068 |
-
->addRegionCodeOrNameFilter($address->getRegion())
|
1069 |
-
->setPageSize(1);
|
1070 |
-
/**********************new added code*************************/
|
1071 |
-
/*$region1="";
|
1072 |
-
$condition="";
|
1073 |
-
$region1=$address->getRegion();
|
1074 |
-
|
1075 |
-
if (!empty($region1)) {
|
1076 |
-
$condition = is_array($region1) ? array('in' => $region1) : $region1;
|
1077 |
-
$regions->addFieldToFilter(array('e.code', 'e.default_name'), array($condition, $condition));
|
1078 |
-
echo $regions->getSelect();die("lkhj");
|
1079 |
-
}*/
|
1080 |
-
/**********************new added code ends*************************/
|
1081 |
-
foreach ($regions as $region) {
|
1082 |
-
$address->setRegionId($region->getId());
|
1083 |
-
$address->setExportedKeys(array_merge($address->getExportedKeys(), array('region_id')));
|
1084 |
-
break;
|
1085 |
-
}
|
1086 |
-
}
|
1087 |
-
}
|
1088 |
-
/**
|
1089 |
-
* Make sure addresses will be saved without validation errors
|
1090 |
-
*/
|
1091 |
-
private function _ignoreAddressValidation()
|
1092 |
-
{
|
1093 |
-
$this->_quote->getBillingAddress()->setShouldIgnoreValidation(true);
|
1094 |
-
if (!$this->_quote->getIsVirtual()) {
|
1095 |
-
$this->_quote->getShippingAddress()->setShouldIgnoreValidation(true);
|
1096 |
-
if ( !$this->_quote->getBillingAddress()->getEmail()) {//!$this->_config->requireBillingAddress &&
|
1097 |
-
$this->_quote->getBillingAddress()->setSameAsBilling(1);
|
1098 |
-
}
|
1099 |
-
}
|
1100 |
-
}
|
1101 |
-
public function continueAction(){
|
1102 |
-
$quote = $this->_getQuote();
|
1103 |
-
if (!$quote->hasItems() || $quote->getHasError()) {
|
1104 |
-
$this->getResponse()->setHeader('HTTP/1.1','403 Forbidden');
|
1105 |
-
Mage::throwException(Mage::helper('laybuy')->__('Unable to initialize Express Checkout.'));
|
1106 |
-
}
|
1107 |
-
$this->_checkout = Mage::getSingleton("laybuy/express_checkout", array(
|
1108 |
-
'quote' => $quote,
|
1109 |
-
));
|
1110 |
-
if ($this->_getQuote()->getIsMultiShipping()) {
|
1111 |
-
$this->_getQuote()->setIsMultiShipping(false);
|
1112 |
-
$this->_getQuote()->removeAllAddresses();
|
1113 |
-
}
|
1114 |
-
$customer = Mage::getSingleton('customer/session')->getCustomer();
|
1115 |
-
if ($customer && $customer->getId()) {
|
1116 |
-
$this->_checkout->setCustomerWithAddressChange(
|
1117 |
-
$customer, $this->_getQuote()->getBillingAddress(), $this->_getQuote()->getShippingAddress()
|
1118 |
-
);
|
1119 |
-
}
|
1120 |
-
$this->_checkout->prepareGiropayUrls(
|
1121 |
-
Mage::getUrl('checkout/onepage/success'),
|
1122 |
-
Mage::getUrl('laybuy/express/cancel'),
|
1123 |
-
Mage::getUrl('checkout/onepage/success')
|
1124 |
-
);
|
1125 |
-
$token = $this->_checkout->start(Mage::getUrl('*/*/return'), Mage::getUrl('*/*/cancel'));
|
1126 |
-
|
1127 |
-
}
|
1128 |
-
/**
|
1129 |
-
* when laybuy returns
|
1130 |
-
* The order information at this point is in POST
|
1131 |
-
*/
|
1132 |
-
public function success($order_id)
|
1133 |
-
{
|
1134 |
-
//var_dump($order_id);echo "<br>";
|
1135 |
-
$respmodel=Mage::getModel("laybuy/laybuyresp")->getCollection();
|
1136 |
-
$laybuyresponse="";
|
1137 |
-
foreach($respmodel as $model)
|
1138 |
-
{
|
1139 |
-
if($order_id==$model->getData("order_id")){
|
1140 |
-
$resp="";
|
1141 |
-
$resp=$model->getData("response");
|
1142 |
-
$laybuyresponse=json_decode($resp,true);
|
1143 |
-
break;
|
1144 |
-
}
|
1145 |
-
}
|
1146 |
-
//var_dump($laybuyresponse);echo "<br>";
|
1147 |
-
$format = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM);
|
1148 |
-
$status = array_change_key_case($laybuyresponse,CASE_LOWER);
|
1149 |
-
//var_dump($status);echo "<br>";
|
1150 |
-
if(isset($status['result']) && $status['result']=='FAILURE'){
|
1151 |
-
$this->_forward('cancel');
|
1152 |
-
}
|
1153 |
-
$session = Mage::getSingleton('checkout/session');
|
1154 |
-
try{
|
1155 |
-
$status['_secure'] = true;
|
1156 |
-
$str = print_r($status, true);
|
1157 |
-
/* $status['first_payment_due'] = '13/12/13';
|
1158 |
-
$status['last_payment_due'] = '13/01/14'; */
|
1159 |
-
$status['first_payment_due'] = date('Y-m-d h:i:s', strtotime(str_replace('/','-',$status['first_payment_due'])));
|
1160 |
-
$status['last_payment_due'] = date('Y-m-d h:i:s', strtotime(str_replace('/','-',$status['last_payment_due'])));
|
1161 |
-
//$session->setQuoteId($session->getLayBuyStandardQuoteId(true));
|
1162 |
-
//Mage::getSingleton('checkout/session')->getQuote()->setIsActive(false)->save();
|
1163 |
-
$order = Mage::getModel('sales/order')->loadByIncrementId($status['custom']);
|
1164 |
-
$payment_info = array();
|
1165 |
-
if($order && $order->getId()){
|
1166 |
-
$order->sendNewOrderEmail();
|
1167 |
-
$order->setEmailSent(true);
|
1168 |
-
$payment_info = $order->getPayment()->getData('additional_information');
|
1169 |
-
$payment_info['transactions'][$status['paypal_profile_id']][] = array(
|
1170 |
-
'txnID' => $status['dp_paypal_txn_id'],
|
1171 |
-
'type' => 'd',
|
1172 |
-
'paymentStatus' => 'Completed',
|
1173 |
-
'paymentDate' => $order->getCreatedAt(),
|
1174 |
-
'amount' => $status['downpayment_amount']
|
1175 |
-
);
|
1176 |
-
$order->getPayment()->setData('additional_information',$payment_info);
|
1177 |
-
$order->setData('state', "new");
|
1178 |
-
$order->setStatus("pending");
|
1179 |
-
//$order->addStatusToHistory("pending", 'Put your comment here', true);
|
1180 |
-
/* $history = Mage::getModel('sales/order_status_history')
|
1181 |
-
->setStatus("pending")
|
1182 |
-
->setComment('My Comment!')
|
1183 |
-
->setEntityName(Mage_Sales_Model_Order::HISTORY_ENTITY_NAME)
|
1184 |
-
->setIsCustomerNotified(false)
|
1185 |
-
->setCreatedAt(date('Y-m-d H:i:s', time() - 60*60*24));
|
1186 |
-
|
1187 |
-
$order->addStatusHistory($history); */
|
1188 |
-
$comments = $order->getStatusHistoryCollection(true);
|
1189 |
-
$com="Authorized amount of ".Mage::app()->getLocale()->currency($status['currency'])->toCurrency($status['downpayment_amount']).". Transaction ID: \"".$status['dp_paypal_txn_id']."\".";
|
1190 |
-
foreach ($comments as $c) {
|
1191 |
-
|
1192 |
-
$c->setStatus("complete");
|
1193 |
-
$c->setComment($com)->save();
|
1194 |
-
|
1195 |
-
}
|
1196 |
-
$order->save();
|
1197 |
-
$createdAt = Mage::helper('core')->formatDate($order->getCreatedAt(), Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM, true);
|
1198 |
-
$newStr = '<div class="grid"><div class="hor-scroll"><table cellspacing=0 class="data"><thead><tr class="headings"><th colspan=2 class=" no-link" style="text-align: center;"><span class="nobr">Installment</span></th><th class=" no-link" style="text-align: center;"><span class="nobr">Date</span></th><th class=" no-link" style="text-align: center;"><span class="nobr">PayPal Transaction ID</span></th><th class=" no-link" style="text-align: center;"><span class="nobr">Status</span></th></tr></thead>';
|
1199 |
-
$newStr .= '<colgroup>
|
1200 |
-
<col width="100">
|
1201 |
-
<col width="75">
|
1202 |
-
<col width="183">
|
1203 |
-
<col width="183">
|
1204 |
-
<col width="98">
|
1205 |
-
</colgroup>';
|
1206 |
-
$months = (int)$status['months'];
|
1207 |
-
$newStr .= '<tbody><tr class="even" ><td style="text-align: center;"> DP: </td><td style="text-align: center;"> '.Mage::app()->getLocale()
|
1208 |
-
->currency($status['currency'])
|
1209 |
-
->toCurrency($status['downpayment_amount']).' </td>'.
|
1210 |
-
'<td style="text-align: center;"> '.$createdAt.' </td>'.
|
1211 |
-
'<td style="text-align: center;">'.$status['dp_paypal_txn_id'].'</td>'.
|
1212 |
-
'<td style="text-align: center;"> Completed </td></tr>';
|
1213 |
-
for($month=1;$month<=$months;$month++){
|
1214 |
-
$newStr .= '<tr ';
|
1215 |
-
if($month%2==0)
|
1216 |
-
$newStr .= 'class="even"';
|
1217 |
-
$newStr .= '>';
|
1218 |
-
$newStr .= '<td style="text-align: center;"> Month '.$month.': </td><td style="text-align: center;"> '.Mage::app()->getLocale()
|
1219 |
-
->currency($status['currency'])
|
1220 |
-
->toCurrency($status['payment_amounts']).' </td>';
|
1221 |
-
$date = date("Y-m-d h:i:s", strtotime($status['first_payment_due'] . " +".($month-1)." month"));
|
1222 |
-
$date = Mage::helper('core')->formatDate($date, Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM, true);
|
1223 |
-
$newStr .= '<td style="text-align: center;"> '.$date.' </td>';
|
1224 |
-
$newStr .= '<td style="text-align: center;"> </td>';
|
1225 |
-
$newStr .= '<td style="text-align: center;"> Pending </td></tr>';
|
1226 |
-
}
|
1227 |
-
$newStr .= '</tbody></table></div></div>';
|
1228 |
-
$model = Mage::getModel('laybuy/report')->setData($status)
|
1229 |
-
->setOrderId($status['custom'])
|
1230 |
-
->setStoreId($order->getStoreId())
|
1231 |
-
->setCreatedAt($order->getCreatedAt())
|
1232 |
-
->setStatus(0)
|
1233 |
-
->setReport($newStr)
|
1234 |
-
/* ->setTransaction(0) */
|
1235 |
-
->save();
|
1236 |
-
Mage::log('Response Array From LayBuy {{'.$str."}}", null, 'laybuy_success.log');
|
1237 |
-
}
|
1238 |
-
$session->addSuccess($this->__('Payment was recieved successfully.'));
|
1239 |
-
}catch(Exception $e){
|
1240 |
-
$status = array_change_key_case($this->getRequest()->getParams(),CASE_LOWER);
|
1241 |
-
if($status){
|
1242 |
-
$str = print_r($status, true);
|
1243 |
-
$session->addError($this->__('Payment Recieved.But transaction not saved please contact us.'));
|
1244 |
-
Mage::log('Exception Order of LayBuy {{'."Order_id=".$status['custom']."|".$status['errormessage']."|".'Response Array From LayBuy {{'.$status."}}"."}}", null, 'laybuy_failure.log');
|
1245 |
-
}else{
|
1246 |
-
$session->addError($this->__('Try Again Later.'));
|
1247 |
-
}
|
1248 |
-
}
|
1249 |
-
//$this->_redirect('checkout/onepage/success',array('_secure' => true));
|
1250 |
-
}
|
1251 |
-
public function returnAction()
|
1252 |
-
{
|
1253 |
-
try {
|
1254 |
-
$this->_initCheckout();
|
1255 |
-
$this->_checkout->returnFromPaypal($this->_initToken());
|
1256 |
-
$this->_redirect('*/*/review');
|
1257 |
-
return;
|
1258 |
-
}
|
1259 |
-
catch (Mage_Core_Exception $e) {
|
1260 |
-
Mage::getSingleton('checkout/session')->addError($e->getMessage());
|
1261 |
-
}
|
1262 |
-
catch (Exception $e) {
|
1263 |
-
Mage::getSingleton('checkout/session')->addError($this->__('Unable to process Express Checkout approval.'));
|
1264 |
-
Mage::logException($e);
|
1265 |
-
}
|
1266 |
-
$this->_redirect('checkout/cart');
|
1267 |
-
}
|
1268 |
-
public function _initToken(){
|
1269 |
-
return $this->_token;
|
1270 |
-
}
|
1271 |
-
/**
|
1272 |
-
* Get checkout method
|
1273 |
-
*
|
1274 |
-
* @return string
|
1275 |
-
*/
|
1276 |
-
public function getCheckoutMethod()
|
1277 |
-
{
|
1278 |
-
if ($this->getCustomerSession()->isLoggedIn()) {
|
1279 |
-
return Mage_Checkout_Model_Type_Onepage::METHOD_CUSTOMER;
|
1280 |
-
}
|
1281 |
-
|
1282 |
-
if (!$this->_quote->getCheckoutMethod()) {
|
1283 |
-
if (Mage::helper('checkout')->isAllowedGuestCheckout($this->_quote)) {
|
1284 |
-
$this->_quote->setCheckoutMethod(Mage_Checkout_Model_Type_Onepage::METHOD_GUEST);
|
1285 |
-
} else {
|
1286 |
-
$this->_quote->setCheckoutMethod(Mage_Checkout_Model_Type_Onepage::METHOD_REGISTER);
|
1287 |
-
}
|
1288 |
-
}
|
1289 |
-
return $this->_quote->getCheckoutMethod();
|
1290 |
-
}
|
1291 |
-
|
1292 |
-
/**
|
1293 |
-
* Set shipping method to quote, if needed
|
1294 |
-
* @param string $methodCode
|
1295 |
-
*/
|
1296 |
-
public function updateShippingMethod($methodCode)
|
1297 |
-
{
|
1298 |
-
if (!$this->_quote->getIsVirtual() && $shippingAddress = $this->_quote->getShippingAddress()) {
|
1299 |
-
if ($methodCode != $shippingAddress->getShippingMethod()) {
|
1300 |
-
$this->_ignoreAddressValidation();
|
1301 |
-
$shippingAddress->setShippingMethod($methodCode)->setCollectShippingRates(true);
|
1302 |
-
$this->_quote->collectTotals();
|
1303 |
-
}
|
1304 |
-
}
|
1305 |
-
}
|
1306 |
-
/**
|
1307 |
-
* Prepare quote for guest checkout order submit
|
1308 |
-
*
|
1309 |
-
* @return Mage_Paypal_Model_Express_Checkout
|
1310 |
-
*/
|
1311 |
-
protected function _prepareGuestQuote()
|
1312 |
-
{
|
1313 |
-
$quote = $this->_quote;
|
1314 |
-
$quote->setCustomerId(null)
|
1315 |
-
->setCustomerEmail($quote->getBillingAddress()->getEmail())
|
1316 |
-
->setCustomerIsGuest(true)
|
1317 |
-
->setCustomerGroupId(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID);
|
1318 |
-
return $this;
|
1319 |
-
}
|
1320 |
-
/**
|
1321 |
-
* Checks if customer with email coming from Express checkout exists
|
1322 |
-
*
|
1323 |
-
* @return int
|
1324 |
-
*/
|
1325 |
-
protected function _lookupCustomerId()
|
1326 |
-
{
|
1327 |
-
return Mage::getModel('customer/customer')
|
1328 |
-
->setWebsiteId(Mage::app()->getWebsite()->getId())
|
1329 |
-
->loadByEmail($this->_quote->getCustomerEmail())
|
1330 |
-
->getId();
|
1331 |
-
}
|
1332 |
-
/**
|
1333 |
-
* Get customer session object
|
1334 |
-
*
|
1335 |
-
* @return Mage_Customer_Model_Session
|
1336 |
-
*/
|
1337 |
-
public function getCustomerSession()
|
1338 |
-
{
|
1339 |
-
return Mage::getSingleton('customer/session');
|
1340 |
-
}
|
1341 |
-
/**
|
1342 |
-
* Prepare quote for customer order submit
|
1343 |
-
*
|
1344 |
-
* @return Mage_Paypal_Model_Express_Checkout
|
1345 |
-
*/
|
1346 |
-
protected function _prepareCustomerQuote()
|
1347 |
-
{
|
1348 |
-
$quote = $this->_quote;
|
1349 |
-
$billing = $quote->getBillingAddress();
|
1350 |
-
$shipping = $quote->isVirtual() ? null : $quote->getShippingAddress();
|
1351 |
-
|
1352 |
-
$customer = $this->getCustomerSession()->getCustomer();
|
1353 |
-
if (!$billing->getCustomerId() || $billing->getSaveInAddressBook()) {
|
1354 |
-
$customerBilling = $billing->exportCustomerAddress();
|
1355 |
-
$customer->addAddress($customerBilling);
|
1356 |
-
$billing->setCustomerAddress($customerBilling);
|
1357 |
-
}
|
1358 |
-
if ($shipping && ((!$shipping->getCustomerId() && !$shipping->getSameAsBilling())
|
1359 |
-
|| (!$shipping->getSameAsBilling() && $shipping->getSaveInAddressBook()))) {
|
1360 |
-
$customerShipping = $shipping->exportCustomerAddress();
|
1361 |
-
$customer->addAddress($customerShipping);
|
1362 |
-
$shipping->setCustomerAddress($customerShipping);
|
1363 |
-
}
|
1364 |
-
|
1365 |
-
if (isset($customerBilling) && !$customer->getDefaultBilling()) {
|
1366 |
-
$customerBilling->setIsDefaultBilling(true);
|
1367 |
-
}
|
1368 |
-
if ($shipping && isset($customerBilling) && !$customer->getDefaultShipping() && $shipping->getSameAsBilling()) {
|
1369 |
-
$customerBilling->setIsDefaultShipping(true);
|
1370 |
-
} elseif ($shipping && isset($customerShipping) && !$customer->getDefaultShipping()) {
|
1371 |
-
$customerShipping->setIsDefaultShipping(true);
|
1372 |
-
}
|
1373 |
-
$quote->setCustomer($customer);
|
1374 |
-
|
1375 |
-
return $this;
|
1376 |
-
}
|
1377 |
-
|
1378 |
-
/**
|
1379 |
-
* Prepare quote for customer registration and customer order submit
|
1380 |
-
* and restore magento customer data from quote
|
1381 |
-
*
|
1382 |
-
* @return Mage_Paypal_Model_Express_Checkout
|
1383 |
-
*/
|
1384 |
-
protected function _prepareNewCustomerQuote()
|
1385 |
-
{
|
1386 |
-
$quote = $this->_quote;
|
1387 |
-
$billing = $quote->getBillingAddress();
|
1388 |
-
$shipping = $quote->isVirtual() ? null : $quote->getShippingAddress();
|
1389 |
-
|
1390 |
-
$customerId = $this->_lookupCustomerId();
|
1391 |
-
if ($customerId) {
|
1392 |
-
$this->getCustomerSession()->loginById($customerId);
|
1393 |
-
return $this->_prepareCustomerQuote();
|
1394 |
-
}
|
1395 |
-
|
1396 |
-
$customer = $quote->getCustomer();
|
1397 |
-
/** @var $customer Mage_Customer_Model_Customer */
|
1398 |
-
$customerBilling = $billing->exportCustomerAddress();
|
1399 |
-
$customer->addAddress($customerBilling);
|
1400 |
-
$billing->setCustomerAddress($customerBilling);
|
1401 |
-
$customerBilling->setIsDefaultBilling(true);
|
1402 |
-
if ($shipping && !$shipping->getSameAsBilling()) {
|
1403 |
-
$customerShipping = $shipping->exportCustomerAddress();
|
1404 |
-
$customer->addAddress($customerShipping);
|
1405 |
-
$shipping->setCustomerAddress($customerShipping);
|
1406 |
-
$customerShipping->setIsDefaultShipping(true);
|
1407 |
-
} elseif ($shipping) {
|
1408 |
-
$customerBilling->setIsDefaultShipping(true);
|
1409 |
-
}
|
1410 |
-
/**
|
1411 |
-
* @todo integration with dynamica attributes customer_dob, customer_taxvat, customer_gender
|
1412 |
-
*/
|
1413 |
-
if ($quote->getCustomerDob() && !$billing->getCustomerDob()) {
|
1414 |
-
$billing->setCustomerDob($quote->getCustomerDob());
|
1415 |
-
}
|
1416 |
-
|
1417 |
-
if ($quote->getCustomerTaxvat() && !$billing->getCustomerTaxvat()) {
|
1418 |
-
$billing->setCustomerTaxvat($quote->getCustomerTaxvat());
|
1419 |
-
}
|
1420 |
-
|
1421 |
-
if ($quote->getCustomerGender() && !$billing->getCustomerGender()) {
|
1422 |
-
$billing->setCustomerGender($quote->getCustomerGender());
|
1423 |
-
}
|
1424 |
-
|
1425 |
-
Mage::helper('core')->copyFieldset('checkout_onepage_billing', 'to_customer', $billing, $customer);
|
1426 |
-
$customer->setEmail($quote->getCustomerEmail());
|
1427 |
-
$customer->setPrefix($quote->getCustomerPrefix());
|
1428 |
-
$customer->setFirstname($quote->getCustomerFirstname());
|
1429 |
-
$customer->setMiddlename($quote->getCustomerMiddlename());
|
1430 |
-
$customer->setLastname($quote->getCustomerLastname());
|
1431 |
-
$customer->setSuffix($quote->getCustomerSuffix());
|
1432 |
-
$customer->setPassword($customer->decryptPassword($quote->getPasswordHash()));
|
1433 |
-
$customer->setPasswordHash($customer->hashPassword($customer->getPassword()));
|
1434 |
-
$customer->save();
|
1435 |
-
$quote->setCustomer($customer);
|
1436 |
-
|
1437 |
-
return $this;
|
1438 |
-
}
|
1439 |
-
/**
|
1440 |
-
* Involve new customer to system
|
1441 |
-
*
|
1442 |
-
* @return Mage_Paypal_Model_Express_Checkout
|
1443 |
-
*/
|
1444 |
-
protected function _involveNewCustomer()
|
1445 |
-
{
|
1446 |
-
$customer = $this->_quote->getCustomer();
|
1447 |
-
if ($customer->isConfirmationRequired()) {
|
1448 |
-
$customer->sendNewAccountEmail('confirmation');
|
1449 |
-
$url = Mage::helper('customer')->getEmailConfirmationUrl($customer->getEmail());
|
1450 |
-
$this->getCustomerSession()->addSuccess(
|
1451 |
-
Mage::helper('customer')->__('Account confirmation is required. Please, check your e-mail for confirmation link. To resend confirmation email please <a href="%s">click here</a>.', $url)
|
1452 |
-
);
|
1453 |
-
} else {
|
1454 |
-
$customer->sendNewAccountEmail();
|
1455 |
-
$this->getCustomerSession()->loginById($customer->getId());
|
1456 |
-
}
|
1457 |
-
return $this;
|
1458 |
-
}
|
1459 |
-
|
1460 |
-
/**
|
1461 |
-
* Place the order and recurring payment profiles when customer returned from paypal
|
1462 |
-
* Until this moment all quote data must be valid
|
1463 |
-
*
|
1464 |
-
* @param string $token
|
1465 |
-
* @param string $shippingMethodCode
|
1466 |
-
*/
|
1467 |
-
public function place($token, $shippingMethodCode = null)
|
1468 |
-
{
|
1469 |
-
if ($shippingMethodCode) {
|
1470 |
-
$this->updateShippingMethod($shippingMethodCode);
|
1471 |
-
}
|
1472 |
-
|
1473 |
-
$isNewCustomer = false;
|
1474 |
-
switch ($this->getCheckoutMethod()) {
|
1475 |
-
case Mage_Checkout_Model_Type_Onepage::METHOD_GUEST:
|
1476 |
-
$this->_prepareGuestQuote();
|
1477 |
-
break;
|
1478 |
-
case Mage_Checkout_Model_Type_Onepage::METHOD_REGISTER:
|
1479 |
-
$this->_prepareNewCustomerQuote();
|
1480 |
-
$isNewCustomer = true;
|
1481 |
-
break;
|
1482 |
-
default:
|
1483 |
-
$this->_prepareCustomerQuote();
|
1484 |
-
break;
|
1485 |
-
}
|
1486 |
-
|
1487 |
-
$this->_ignoreAddressValidation();
|
1488 |
-
$this->_quote->collectTotals();
|
1489 |
-
|
1490 |
-
$service = Mage::getModel('sales/service_quote', $this->_quote);
|
1491 |
-
|
1492 |
-
$service->submitAll();
|
1493 |
-
|
1494 |
-
|
1495 |
-
$this->_quote->save();
|
1496 |
-
|
1497 |
-
if ($isNewCustomer) {
|
1498 |
-
try {
|
1499 |
-
$this->_involveNewCustomer();
|
1500 |
-
} catch (Exception $e) {
|
1501 |
-
Mage::logException($e);
|
1502 |
-
}
|
1503 |
-
}
|
1504 |
-
|
1505 |
-
$this->_recurringPaymentProfiles = $service->getRecurringPaymentProfiles();
|
1506 |
-
// TODO: send recurring profile emails
|
1507 |
-
|
1508 |
-
$order = $service->getOrder();
|
1509 |
-
if (!$order) {
|
1510 |
-
return;
|
1511 |
-
}
|
1512 |
-
$this->_billingAgreement = $order->getPayment()->getBillingAgreement();
|
1513 |
-
|
1514 |
-
|
1515 |
-
// commence redirecting to finish payment, if paypal requires it
|
1516 |
-
|
1517 |
-
if ($order->getPayment()->getAdditionalInformation(
|
1518 |
-
'laybuy_express_checkout_redirect_required'
|
1519 |
-
)) {
|
1520 |
-
$this->_redirectUrl = $this->getExpressCheckoutCompleteUrl($token);
|
1521 |
-
}
|
1522 |
-
|
1523 |
-
switch ($order->getState()) {
|
1524 |
-
// even after placement paypal can disallow to authorize/capture, but will wait until bank transfers money
|
1525 |
-
case Mage_Sales_Model_Order::STATE_PENDING_PAYMENT:
|
1526 |
-
// TODO
|
1527 |
-
break;
|
1528 |
-
// regular placement, when everything is ok
|
1529 |
-
case Mage_Sales_Model_Order::STATE_PROCESSING:
|
1530 |
-
case Mage_Sales_Model_Order::STATE_COMPLETE:
|
1531 |
-
case Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW:
|
1532 |
-
$order->sendNewOrderEmail();
|
1533 |
-
break;
|
1534 |
-
}
|
1535 |
-
|
1536 |
-
$this->_order = $order;
|
1537 |
-
}
|
1538 |
-
/**
|
1539 |
-
* Get url for additional actions that PayPal may require customer to do after placing the order.
|
1540 |
-
* For instance, redirecting customer to bank for payment confirmation.
|
1541 |
-
*
|
1542 |
-
* @param string $token
|
1543 |
-
* @return string
|
1544 |
-
*/
|
1545 |
-
public function getExpressCheckoutCompleteUrl($token)
|
1546 |
-
{
|
1547 |
-
return $this->getLaybuyUrl(array(
|
1548 |
-
'cmd' => '_complete-express-checkout',
|
1549 |
-
'token' => $token,
|
1550 |
-
));
|
1551 |
-
}
|
1552 |
-
|
1553 |
-
/**
|
1554 |
-
* PayPal web URL generic getter
|
1555 |
-
*
|
1556 |
-
* @param array $params
|
1557 |
-
* @return string
|
1558 |
-
*/
|
1559 |
-
public function getLaybuyUrl(array $params = array())
|
1560 |
-
{
|
1561 |
-
/* return sprintf('https://www.%spaypal.com/cgi-bin/webscr%s',
|
1562 |
-
$this->sandboxFlag ? 'sandbox.' : '',
|
1563 |
-
$params ? '?' . http_build_query($params) : ''
|
1564 |
-
); */
|
1565 |
-
$url="http://lay-buys.com/expressgateway".'?' . http_build_query($params) ;
|
1566 |
-
return $url;
|
1567 |
-
}
|
1568 |
-
/**
|
1569 |
-
* Submit the order
|
1570 |
-
*/
|
1571 |
-
public function placeOrderAction()
|
1572 |
-
{
|
1573 |
-
|
1574 |
-
try {
|
1575 |
-
$requiredAgreements = Mage::helper('checkout')->getRequiredAgreementIds();
|
1576 |
-
if ($requiredAgreements) {
|
1577 |
-
$postedAgreements = array_keys($this->getRequest()->getPost('agreement', array()));
|
1578 |
-
if (array_diff($requiredAgreements, $postedAgreements)) {
|
1579 |
-
Mage::throwException(Mage::helper('laybuy')->__('Please agree to all the terms and conditions before placing the order.'));
|
1580 |
-
}
|
1581 |
-
}
|
1582 |
-
|
1583 |
-
$this->_initCheckout();
|
1584 |
-
$this->place($this->_initToken());
|
1585 |
-
// prepare session to success or cancellation page
|
1586 |
-
$session = $this->_getCheckoutSession();
|
1587 |
-
$session->clearHelperData();
|
1588 |
-
|
1589 |
-
// "last successful quote"
|
1590 |
-
$quoteId = $this->_getQuote()->getId();
|
1591 |
-
$session->setLastQuoteId($quoteId)->setLastSuccessQuoteId($quoteId);
|
1592 |
-
|
1593 |
-
// an order may be created
|
1594 |
-
$order = $this->getOrder();
|
1595 |
-
if ($order) {
|
1596 |
-
$session->setLastOrderId($order->getId())
|
1597 |
-
->setLastRealOrderId($order->getIncrementId());
|
1598 |
-
// as well a billing agreement can be created
|
1599 |
-
$agreement = $this->getBillingAgreement();
|
1600 |
-
if ($agreement) {
|
1601 |
-
$session->setLastBillingAgreementId($agreement->getId());
|
1602 |
-
}
|
1603 |
-
}
|
1604 |
-
|
1605 |
-
// recurring profiles may be created along with the order or without it
|
1606 |
-
$profiles = $this->getRecurringPaymentProfiles();
|
1607 |
-
if ($profiles) {
|
1608 |
-
$ids = array();
|
1609 |
-
foreach($profiles as $profile) {
|
1610 |
-
$ids[] = $profile->getId();
|
1611 |
-
}
|
1612 |
-
$session->setLastRecurringProfileIds($ids);
|
1613 |
-
}
|
1614 |
-
|
1615 |
-
// redirect if PayPal specified some URL (for example, to Giropay bank)
|
1616 |
-
/* $url = $this->getRedirectUrl();
|
1617 |
-
if ($url) {
|
1618 |
-
$this->getResponse()->setRedirect($url);
|
1619 |
-
return;
|
1620 |
-
} */
|
1621 |
-
//$this->_initToken(false); // no need in token anymore
|
1622 |
-
$order_id=$order->getIncrementId();
|
1623 |
-
$this->success($order_id);
|
1624 |
-
$this->_redirect('checkout/onepage/success');
|
1625 |
-
return;
|
1626 |
-
}
|
1627 |
-
catch (Mage_Core_Exception $e) {
|
1628 |
-
$this->_getSession()->addError($e->getMessage());
|
1629 |
-
}
|
1630 |
-
catch (Exception $e) {
|
1631 |
-
$this->_getSession()->addError($this->__('Unable to place the order.'));
|
1632 |
-
Mage::logException($e);
|
1633 |
-
}
|
1634 |
-
$this->_redirect('*/*/review');
|
1635 |
-
}
|
1636 |
-
/**
|
1637 |
-
* Determine whether redirect somewhere specifically is required
|
1638 |
-
*
|
1639 |
-
* @return string
|
1640 |
-
*/
|
1641 |
-
public function getRedirectUrl()
|
1642 |
-
{
|
1643 |
-
return $this->_redirectUrl;
|
1644 |
-
}
|
1645 |
-
/**
|
1646 |
-
* PayPal session instance getter
|
1647 |
-
*
|
1648 |
-
* @return Mage_PayPal_Model_Session
|
1649 |
-
*/
|
1650 |
-
private function _getSession()
|
1651 |
-
{
|
1652 |
-
return Mage::getSingleton('core/session');
|
1653 |
-
}
|
1654 |
-
/**
|
1655 |
-
* Return recurring payment profiles
|
1656 |
-
*
|
1657 |
-
* @return array
|
1658 |
-
*/
|
1659 |
-
public function getRecurringPaymentProfiles()
|
1660 |
-
{
|
1661 |
-
return $this->_recurringPaymentProfiles;
|
1662 |
-
}
|
1663 |
-
/**
|
1664 |
-
* Get created billing agreement
|
1665 |
-
*
|
1666 |
-
* @return Mage_Sales_Model_Billing_Agreement|null
|
1667 |
-
*/
|
1668 |
-
public function getBillingAgreement()
|
1669 |
-
{
|
1670 |
-
return $this->_billingAgreement;
|
1671 |
-
}
|
1672 |
-
/**
|
1673 |
-
* Return order
|
1674 |
-
*
|
1675 |
-
* @return Mage_Sales_Model_Order
|
1676 |
-
*/
|
1677 |
-
public function getOrder()
|
1678 |
-
{
|
1679 |
-
return $this->_order;
|
1680 |
-
}
|
1681 |
-
public function reviewAction()
|
1682 |
-
{
|
1683 |
-
try {
|
1684 |
-
$this->_initCheckout();
|
1685 |
-
$this->prepareOrderReview($this->_initToken());
|
1686 |
-
$this->loadLayout();
|
1687 |
-
$this->_initLayoutMessages('paypal/session');
|
1688 |
-
$reviewBlock = $this->getLayout()->getBlock('laybuy.express.review');
|
1689 |
-
$reviewBlock->setQuote($this->_getQuote());
|
1690 |
-
$reviewBlock->getChild('details')->setQuote($this->_getQuote());
|
1691 |
-
if ($reviewBlock->getChild('shipping_method')) {
|
1692 |
-
$reviewBlock->getChild('shipping_method')->setQuote($this->_getQuote());
|
1693 |
-
}
|
1694 |
-
$this->renderLayout();
|
1695 |
-
return;
|
1696 |
-
}
|
1697 |
-
catch (Mage_Core_Exception $e) {
|
1698 |
-
Mage::getSingleton('checkout/session')->addError($e->getMessage());
|
1699 |
-
}
|
1700 |
-
catch (Exception $e) {
|
1701 |
-
Mage::getSingleton('checkout/session')->addError(
|
1702 |
-
$this->__('Unable to initialize Express Checkout review.')
|
1703 |
-
);
|
1704 |
-
Mage::logException($e);
|
1705 |
-
}
|
1706 |
-
$this->_redirect('checkout/cart');
|
1707 |
-
}
|
1708 |
-
/**
|
1709 |
-
* Update Order (combined action for ajax and regular request)
|
1710 |
-
*/
|
1711 |
-
public function updateOrderAction()
|
1712 |
-
{
|
1713 |
-
try {
|
1714 |
-
$isAjax = $this->getRequest()->getParam('isAjax');
|
1715 |
-
$this->_initCheckout();
|
1716 |
-
$this->updateOrders($this->getRequest()->getParams());
|
1717 |
-
if ($isAjax) {
|
1718 |
-
$this->loadLayout('laybuy_express_review_details');
|
1719 |
-
$this->getResponse()->setBody($this->getLayout()->getBlock('root')
|
1720 |
-
->setQuote($this->_getQuote())
|
1721 |
-
->toHtml());
|
1722 |
-
return;
|
1723 |
-
}
|
1724 |
-
} catch (Mage_Core_Exception $e) {
|
1725 |
-
$this->_getSession()->addError($e->getMessage());
|
1726 |
-
} catch (Exception $e) {
|
1727 |
-
$this->_getSession()->addError($this->__('Unable to update Order data.'));
|
1728 |
-
Mage::logException($e);
|
1729 |
-
}
|
1730 |
-
if ($isAjax) {
|
1731 |
-
$this->getResponse()->setBody('<script type="text/javascript">window.location.href = '
|
1732 |
-
. Mage::getUrl('*/*/review') . ';</script>');
|
1733 |
-
} else {
|
1734 |
-
$this->_redirect('*/*/review');
|
1735 |
-
}
|
1736 |
-
}
|
1737 |
-
/**
|
1738 |
-
* Update order data
|
1739 |
-
*
|
1740 |
-
* @param array $data
|
1741 |
-
*/
|
1742 |
-
public function updateOrders($data)
|
1743 |
-
{
|
1744 |
-
/** @var $checkout Mage_Checkout_Model_Type_Onepage */
|
1745 |
-
$checkout = Mage::getModel('checkout/type_onepage');
|
1746 |
-
|
1747 |
-
$this->_quote->setTotalsCollectedFlag(true);
|
1748 |
-
$checkout->setQuote($this->_quote);
|
1749 |
-
if (isset($data['billing'])) {
|
1750 |
-
if (isset($data['customer-email'])) {
|
1751 |
-
$data['billing']['email'] = $data['customer-email'];
|
1752 |
-
}
|
1753 |
-
$checkout->saveBilling($data['billing'], 0);
|
1754 |
-
}
|
1755 |
-
if (!$this->_quote->getIsVirtual() && isset($data['shipping'])) {
|
1756 |
-
$checkout->saveShipping($data['shipping'], 0);
|
1757 |
-
}
|
1758 |
-
|
1759 |
-
if (isset($data['shipping_method'])) {
|
1760 |
-
$this->updateShippingMethod($data['shipping_method']);
|
1761 |
-
}
|
1762 |
-
$this->_quote->setTotalsCollectedFlag(false);
|
1763 |
-
$this->_quote->collectTotals();
|
1764 |
-
$this->_quote->setDataChanges(true);
|
1765 |
-
$this->_quote->save();
|
1766 |
-
}
|
1767 |
-
|
1768 |
-
/**
|
1769 |
-
* Update Order (combined action for ajax and regular request)
|
1770 |
-
*/
|
1771 |
-
public function updateShippingMethodsAction()
|
1772 |
-
{
|
1773 |
-
try {
|
1774 |
-
$this->_initCheckout();
|
1775 |
-
$this->prepareOrderReview($this->_initToken());
|
1776 |
-
$this->loadLayout('laybuy_express_review');
|
1777 |
-
|
1778 |
-
$this->getResponse()->setBody($this->getLayout()->getBlock('express.review.shipping.method')
|
1779 |
-
->setQuote($this->_getQuote())
|
1780 |
-
->toHtml());
|
1781 |
-
return;
|
1782 |
-
} catch (Mage_Core_Exception $e) {
|
1783 |
-
$this->_getSession()->addError($e->getMessage());
|
1784 |
-
} catch (Exception $e) {
|
1785 |
-
$this->_getSession()->addError($this->__('Unable to update Order data.'));
|
1786 |
-
Mage::logException($e);
|
1787 |
-
}
|
1788 |
-
$this->getResponse()->setBody('<script type="text/javascript">window.location.href = '
|
1789 |
-
. Mage::getUrl('*/*/review') . ';</script>');
|
1790 |
-
}
|
1791 |
-
|
1792 |
-
/**
|
1793 |
-
* Check whether order review has enough data to initialize
|
1794 |
-
*
|
1795 |
-
* @param $token
|
1796 |
-
* @throws Mage_Core_Exception
|
1797 |
-
*/
|
1798 |
-
public function prepareOrderReview($token = null)
|
1799 |
-
{
|
1800 |
-
$payment = $this->_quote->getPayment();
|
1801 |
-
if (!$payment || !$payment->getAdditionalInformation("laybuy_express_checkout_payer_id")) {
|
1802 |
-
Mage::throwException(Mage::helper('laybuy')->__('Payer is not identified.'));
|
1803 |
-
}
|
1804 |
-
$this->_quote->setMayEditShippingAddress(
|
1805 |
-
1 != $this->_quote->getPayment()->getAdditionalInformation('laybuy_express_checkout_shipping_overriden')
|
1806 |
-
);
|
1807 |
-
$this->_quote->setMayEditShippingMethod(
|
1808 |
-
'' == $this->_quote->getPayment()->getAdditionalInformation('laybuy_express_checkout_shipping_method')
|
1809 |
-
);
|
1810 |
-
$this->_ignoreAddressValidation();
|
1811 |
-
$this->_quote->collectTotals()->save();
|
1812 |
-
}
|
1813 |
-
|
1814 |
-
private function _initCheckout()
|
1815 |
-
{
|
1816 |
-
$quote = $this->_getQuote();
|
1817 |
-
if (!$quote->hasItems() || $quote->getHasError()) {
|
1818 |
-
$this->getResponse()->setHeader('HTTP/1.1','403 Forbidden');
|
1819 |
-
Mage::throwException(Mage::helper('laybuy')->__('Unable to initialize Express Checkout.'));
|
1820 |
-
}
|
1821 |
-
|
1822 |
-
$this->_checkout = Mage::getSingleton($this->_checkoutType, array(
|
1823 |
-
'quote' => $quote,
|
1824 |
-
));
|
1825 |
-
}
|
1826 |
-
public function cancelAction()
|
1827 |
-
{
|
1828 |
-
try {
|
1829 |
-
//$this->_initToken(false);
|
1830 |
-
$this->_token=null;
|
1831 |
-
// TODO verify if this logic of order cancelation is deprecated
|
1832 |
-
// if there is an order - cancel it
|
1833 |
-
$orderId = $this->_getCheckoutSession()->getLastOrderId();
|
1834 |
-
$order = ($orderId) ? Mage::getModel('sales/order')->load($orderId) : false;
|
1835 |
-
if ($order && $order->getId() && $order->getQuoteId() == $this->_getCheckoutSession()->getQuoteId()) {
|
1836 |
-
$order->cancel()->save();
|
1837 |
-
$this->_getCheckoutSession()
|
1838 |
-
->unsLastQuoteId()
|
1839 |
-
->unsLastSuccessQuoteId()
|
1840 |
-
->unsLastOrderId()
|
1841 |
-
->unsLastRealOrderId()
|
1842 |
-
->addSuccess($this->__('Laybuy Express Checkout and Order have been canceled.'))
|
1843 |
-
;
|
1844 |
-
} else {
|
1845 |
-
$this->_getCheckoutSession()->addSuccess($this->__('Laybuy Express Checkout has been canceled.'));
|
1846 |
-
}
|
1847 |
-
} catch (Mage_Core_Exception $e) {
|
1848 |
-
$this->_getCheckoutSession()->addError($e->getMessage());
|
1849 |
-
} catch (Exception $e) {
|
1850 |
-
$this->_getCheckoutSession()->addError($this->__('Unable to cancel Laybuy Express Checkout.'));
|
1851 |
-
Mage::logException($e);
|
1852 |
-
}
|
1853 |
-
|
1854 |
-
$this->_redirect('checkout/cart');
|
1855 |
-
}
|
1856 |
-
|
1857 |
-
}
|
1858 |
-
|
1859 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Ced/LayBuy/etc/config.xml
CHANGED
@@ -1,224 +1,189 @@
|
|
1 |
-
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
-
<config>
|
3 |
-
<modules>
|
4 |
-
<Ced_LayBuy>
|
5 |
-
<version>1.0.
|
6 |
-
<author>ASHEESH SINGH (asheeshsingh@cedcoss.com)</author>
|
7 |
-
</Ced_LayBuy>
|
8 |
-
</modules>
|
9 |
-
<admin>
|
10 |
-
<routers>
|
11 |
-
<laybuy>
|
12 |
-
<use>admin</use>
|
13 |
-
<args>
|
14 |
-
<module>Ced_LayBuy</module>
|
15 |
-
<frontName>laybuy</frontName>
|
16 |
-
</args>
|
17 |
-
</laybuy>
|
18 |
-
</routers>
|
19 |
-
</admin>
|
20 |
-
<adminhtml>
|
21 |
-
<translate>
|
22 |
-
<modules>
|
23 |
-
<Ced_LayBuy>
|
24 |
-
<files>
|
25 |
-
<default>Ced_LayBuy.csv</default>
|
26 |
-
</files>
|
27 |
-
</Ced_LayBuy>
|
28 |
-
</modules>
|
29 |
-
</translate>
|
30 |
-
<layout>
|
31 |
-
<updates>
|
32 |
-
<laybuy>
|
33 |
-
<file>laybuy.xml</file>
|
34 |
-
</laybuy>
|
35 |
-
</updates>
|
36 |
-
</layout>
|
37 |
-
</adminhtml>
|
38 |
-
<frontend>
|
39 |
-
<routers>
|
40 |
-
<laybuy>
|
41 |
-
<use>standard</use>
|
42 |
-
<args>
|
43 |
-
<module>Ced_LayBuy</module>
|
44 |
-
<frontName>laybuy</frontName>
|
45 |
-
</args>
|
46 |
-
</laybuy>
|
47 |
-
</routers>
|
48 |
-
<layout>
|
49 |
-
<updates>
|
50 |
-
<laybuy>
|
51 |
-
<file>laybuy.xml</file>
|
52 |
-
</laybuy>
|
53 |
-
</updates>
|
54 |
-
</layout>
|
55 |
-
<translate>
|
56 |
-
<modules>
|
57 |
-
<Ced_LayBuy>
|
58 |
-
<files>
|
59 |
-
<default>Ced_LayBuy.csv</default>
|
60 |
-
</files>
|
61 |
-
</Ced_LayBuy>
|
62 |
-
</modules>
|
63 |
-
</translate>
|
64 |
-
</frontend>
|
65 |
-
<global>
|
66 |
-
<fieldsets>
|
67 |
-
<sales_convert_quote_payment>
|
68 |
-
<laybuy_init>
|
69 |
-
<to_order_payment>*</to_order_payment>
|
70 |
-
</laybuy_init>
|
71 |
-
<laybuy_months>
|
72 |
-
<to_order_payment>*</to_order_payment>
|
73 |
-
</laybuy_months>
|
74 |
-
</sales_convert_quote_payment>
|
75 |
-
</fieldsets>
|
76 |
-
<models>
|
77 |
-
<laybuy>
|
78 |
-
<class>Ced_LayBuy_Model</class>
|
79 |
-
<resourceModel>laybuy_mysql4</resourceModel>
|
80 |
-
</laybuy>
|
81 |
-
<
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
<
|
122 |
-
<
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
<
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
<
|
157 |
-
<
|
158 |
-
<
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
<conditional_criteria>
|
191 |
-
<total>0</total>
|
192 |
-
<allowspecificcategory>0</allowspecificcategory>
|
193 |
-
<allowspecificgroup>0</allowspecificgroup>
|
194 |
-
</conditional_criteria>
|
195 |
-
<fetch_reports>
|
196 |
-
<schedule>1</schedule>
|
197 |
-
<time>00,00,00</time>
|
198 |
-
</fetch_reports>
|
199 |
-
</laybuy>
|
200 |
-
</default>
|
201 |
-
<crontab>
|
202 |
-
<jobs>
|
203 |
-
<LayBuy_Cron_Check>
|
204 |
-
<schedule>
|
205 |
-
<cron_expr>* * * * *</cron_expr>
|
206 |
-
</schedule>
|
207 |
-
<run>
|
208 |
-
<model>laybuy/Observer::checkCron</model>
|
209 |
-
|
210 |
-
</run>
|
211 |
-
</LayBuy_Cron_Check>
|
212 |
-
<LayBuy_Automated_Fetch_Updates>
|
213 |
-
<schedule>
|
214 |
-
|
215 |
-
<config_path>crontab/jobs/LayBuy_Automated_Fetch_Updates/schedule/cron_expr</config_path>
|
216 |
-
</schedule>
|
217 |
-
<run>
|
218 |
-
<model>laybuy/Observer::fetchUpdates</model>
|
219 |
-
|
220 |
-
</run>
|
221 |
-
</LayBuy_Automated_Fetch_Updates>
|
222 |
-
</jobs>
|
223 |
-
</crontab>
|
224 |
-
</config>
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Ced_LayBuy>
|
5 |
+
<version>1.0.0</version>
|
6 |
+
<author>ASHEESH SINGH (asheeshsingh@cedcoss.com)</author>
|
7 |
+
</Ced_LayBuy>
|
8 |
+
</modules>
|
9 |
+
<admin>
|
10 |
+
<routers>
|
11 |
+
<laybuy>
|
12 |
+
<use>admin</use>
|
13 |
+
<args>
|
14 |
+
<module>Ced_LayBuy</module>
|
15 |
+
<frontName>laybuy</frontName>
|
16 |
+
</args>
|
17 |
+
</laybuy>
|
18 |
+
</routers>
|
19 |
+
</admin>
|
20 |
+
<adminhtml>
|
21 |
+
<translate>
|
22 |
+
<modules>
|
23 |
+
<Ced_LayBuy>
|
24 |
+
<files>
|
25 |
+
<default>Ced_LayBuy.csv</default>
|
26 |
+
</files>
|
27 |
+
</Ced_LayBuy>
|
28 |
+
</modules>
|
29 |
+
</translate>
|
30 |
+
<layout>
|
31 |
+
<updates>
|
32 |
+
<laybuy>
|
33 |
+
<file>laybuy.xml</file>
|
34 |
+
</laybuy>
|
35 |
+
</updates>
|
36 |
+
</layout>
|
37 |
+
</adminhtml>
|
38 |
+
<frontend>
|
39 |
+
<routers>
|
40 |
+
<laybuy>
|
41 |
+
<use>standard</use>
|
42 |
+
<args>
|
43 |
+
<module>Ced_LayBuy</module>
|
44 |
+
<frontName>laybuy</frontName>
|
45 |
+
</args>
|
46 |
+
</laybuy>
|
47 |
+
</routers>
|
48 |
+
<layout>
|
49 |
+
<updates>
|
50 |
+
<laybuy>
|
51 |
+
<file>laybuy.xml</file>
|
52 |
+
</laybuy>
|
53 |
+
</updates>
|
54 |
+
</layout>
|
55 |
+
<translate>
|
56 |
+
<modules>
|
57 |
+
<Ced_LayBuy>
|
58 |
+
<files>
|
59 |
+
<default>Ced_LayBuy.csv</default>
|
60 |
+
</files>
|
61 |
+
</Ced_LayBuy>
|
62 |
+
</modules>
|
63 |
+
</translate>
|
64 |
+
</frontend>
|
65 |
+
<global>
|
66 |
+
<fieldsets>
|
67 |
+
<sales_convert_quote_payment>
|
68 |
+
<laybuy_init>
|
69 |
+
<to_order_payment>*</to_order_payment>
|
70 |
+
</laybuy_init>
|
71 |
+
<laybuy_months>
|
72 |
+
<to_order_payment>*</to_order_payment>
|
73 |
+
</laybuy_months>
|
74 |
+
</sales_convert_quote_payment>
|
75 |
+
</fieldsets>
|
76 |
+
<models>
|
77 |
+
<laybuy>
|
78 |
+
<class>Ced_LayBuy_Model</class>
|
79 |
+
<resourceModel>laybuy_mysql4</resourceModel>
|
80 |
+
</laybuy>
|
81 |
+
<laybuy_mysql4>
|
82 |
+
<class>Ced_LayBuy_Model_Mysql4</class>
|
83 |
+
<entities>
|
84 |
+
<report>
|
85 |
+
<table>laybuy_transaction_report</table>
|
86 |
+
</report>
|
87 |
+
<revise>
|
88 |
+
<table>laybuy_revise_request_report</table>
|
89 |
+
</revise>
|
90 |
+
</entities>
|
91 |
+
</laybuy_mysql4>
|
92 |
+
</models>
|
93 |
+
<resources>
|
94 |
+
<laybuy_setup>
|
95 |
+
<setup>
|
96 |
+
<module>Ced_LayBuy</module>
|
97 |
+
<class>Ced_LayBuy_Model_Mysql4_Setup</class>
|
98 |
+
</setup>
|
99 |
+
</laybuy_setup>
|
100 |
+
</resources>
|
101 |
+
<helpers>
|
102 |
+
<laybuy>
|
103 |
+
<class>Ced_LayBuy_Helper</class>
|
104 |
+
</laybuy>
|
105 |
+
</helpers>
|
106 |
+
<blocks>
|
107 |
+
<laybuy>
|
108 |
+
<class>Ced_LayBuy_Block</class>
|
109 |
+
</laybuy>
|
110 |
+
</blocks>
|
111 |
+
<events>
|
112 |
+
<payment_info_block_prepare_specific_information>
|
113 |
+
<observers>
|
114 |
+
<laybuy_payment_info>
|
115 |
+
<type>model</type>
|
116 |
+
<class>laybuy/observer</class>
|
117 |
+
<method>paymentInfoBlockPrepareSpecificInformation</method>
|
118 |
+
</laybuy_payment_info>
|
119 |
+
</observers>
|
120 |
+
</payment_info_block_prepare_specific_information>
|
121 |
+
<order_cancel_after>
|
122 |
+
<observers>
|
123 |
+
<laybuy_order_cancel>
|
124 |
+
<type>model</type>
|
125 |
+
<class>laybuy/observer</class>
|
126 |
+
<method>orderCancelAfter</method>
|
127 |
+
</laybuy_order_cancel>
|
128 |
+
</observers>
|
129 |
+
</order_cancel_after>
|
130 |
+
</events>
|
131 |
+
</global>
|
132 |
+
<default>
|
133 |
+
<payment>
|
134 |
+
<laybuy>
|
135 |
+
<model>laybuy/standard</model><!-- very important thing, here you select the model for your payment method -->
|
136 |
+
<active>1</active>
|
137 |
+
<order_status>pending</order_status>
|
138 |
+
<title>Lay-Buy</title>
|
139 |
+
<payment_action>sale</payment_action>
|
140 |
+
<submit_url>http://lay-buys.com/gateway/</submit_url>
|
141 |
+
<multipledesc>1</multipledesc>
|
142 |
+
<desc>Description of products / services</desc>
|
143 |
+
<mind>20%</mind>
|
144 |
+
<maxd>50%</maxd>
|
145 |
+
<months>3</months>
|
146 |
+
<adminfee>0</adminfee>
|
147 |
+
<ftp_ip>https://lay-buys.com/report/</ftp_ip>
|
148 |
+
<allowspecific>0</allowspecific>
|
149 |
+
<sort_order>1</sort_order>
|
150 |
+
<bypasslaybuy>1</bypasslaybuy>
|
151 |
+
<cronenabled>0</cronenabled>
|
152 |
+
</laybuy>
|
153 |
+
</payment>
|
154 |
+
<laybuy>
|
155 |
+
<conditional_criteria>
|
156 |
+
<total>0</total>
|
157 |
+
<allowspecificcategory>0</allowspecificcategory>
|
158 |
+
<allowspecificgroup>0</allowspecificgroup>
|
159 |
+
</conditional_criteria>
|
160 |
+
<fetch_reports>
|
161 |
+
<schedule>1</schedule>
|
162 |
+
<time>00,00,00</time>
|
163 |
+
</fetch_reports>
|
164 |
+
</laybuy>
|
165 |
+
</default>
|
166 |
+
<crontab>
|
167 |
+
<jobs>
|
168 |
+
<LayBuy_Cron_Check>
|
169 |
+
<schedule>
|
170 |
+
<cron_expr>* * * * *</cron_expr>
|
171 |
+
</schedule>
|
172 |
+
<run>
|
173 |
+
<model>laybuy/Observer::checkCron</model>
|
174 |
+
|
175 |
+
</run>
|
176 |
+
</LayBuy_Cron_Check>
|
177 |
+
<LayBuy_Automated_Fetch_Updates>
|
178 |
+
<schedule>
|
179 |
+
|
180 |
+
<config_path>crontab/jobs/LayBuy_Automated_Fetch_Updates/schedule/cron_expr</config_path>
|
181 |
+
</schedule>
|
182 |
+
<run>
|
183 |
+
<model>laybuy/Observer::fetchUpdates</model>
|
184 |
+
|
185 |
+
</run>
|
186 |
+
</LayBuy_Automated_Fetch_Updates>
|
187 |
+
</jobs>
|
188 |
+
</crontab>
|
189 |
+
</config>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Ced/LayBuy/etc/system.xml
CHANGED
@@ -1,297 +1,279 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<config>
|
3 |
-
<sections>
|
4 |
-
<payment>
|
5 |
-
<groups>
|
6 |
-
<laybuy translate="label comment" module="laybuy">
|
7 |
-
<label>PUT IT ON LAY-BUY (powered by PayPal)</label>
|
8 |
-
<frontend_type>text</frontend_type>
|
9 |
-
<sort_order>999</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 |
-
<fields>
|
14 |
-
<active translate="label comment">
|
15 |
-
<label>Enabled</label>
|
16 |
-
<frontend_type>select</frontend_type>
|
17 |
-
<source_model>adminhtml/system_config_source_yesno</source_model>
|
18 |
-
<sort_order>10</sort_order>
|
19 |
-
<show_in_default>1</show_in_default>
|
20 |
-
<show_in_website>1</show_in_website>
|
21 |
-
<show_in_store>0</show_in_store>
|
22 |
-
</active>
|
23 |
-
<title translate="label comment">
|
24 |
-
<label>Title</label>
|
25 |
-
<frontend_type>text</frontend_type>
|
26 |
-
<sort_order>20</sort_order>
|
27 |
-
<show_in_default>1</show_in_default>
|
28 |
-
<show_in_website>1</show_in_website>
|
29 |
-
<show_in_store>1</show_in_store>
|
30 |
-
</title>
|
31 |
-
<order_status translate="label comment">
|
32 |
-
<label>New Order Status</label>
|
33 |
-
<frontend_type>select</frontend_type>
|
34 |
-
<source_model>adminhtml/system_config_source_order_status</source_model>
|
35 |
-
<sort_order>51</sort_order>
|
36 |
-
<show_in_default>1</show_in_default>
|
37 |
-
<show_in_website>1</show_in_website>
|
38 |
-
<show_in_store>0</show_in_store>
|
39 |
-
</order_status>
|
40 |
-
<submit_url translate="label comment">
|
41 |
-
<label>Gateway URL</label>
|
42 |
-
<frontend_type>text</frontend_type>
|
43 |
-
<sort_order>58</sort_order>
|
44 |
-
<show_in_default>1</show_in_default>
|
45 |
-
<show_in_website>0</show_in_website>
|
46 |
-
<show_in_store>0</show_in_store>
|
47 |
-
</submit_url>
|
48 |
-
<membership_number translate="label comment">
|
49 |
-
<label>Lay-Buys Membership Number</label>
|
50 |
-
<frontend_type>password</frontend_type>
|
51 |
-
<sort_order>59</sort_order>
|
52 |
-
<show_in_default>1</show_in_default>
|
53 |
-
<show_in_website>1</show_in_website>
|
54 |
-
<show_in_store>0</show_in_store>
|
55 |
-
</membership_number>
|
56 |
-
<multipledesc translate="label comment">
|
57 |
-
<label>Line Items Description</label>
|
58 |
-
<frontend_type>select</frontend_type>
|
59 |
-
<source_model>adminhtml/system_config_source_yesno</source_model>
|
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 |
-
</multipledesc>
|
65 |
-
<desc translate="label comment">
|
66 |
-
<label>Description</label>
|
67 |
-
<frontend_type>textarea</frontend_type>
|
68 |
-
<sort_order>61</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 |
-
<depends><multipledesc>0</multipledesc></depends>
|
73 |
-
<comment>Description of products / services</comment>
|
74 |
-
</desc>
|
75 |
-
<mind translate="label comment">
|
76 |
-
<label>Minimum</label>
|
77 |
-
<frontend_type>text</frontend_type>
|
78 |
-
<sort_order>62</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 |
-
<comment>Minimum Deposit Amount (defaults to 20%)</comment>
|
83 |
-
</mind>
|
84 |
-
<maxd translate="label comment">
|
85 |
-
<label>Maximum</label>
|
86 |
-
<frontend_type>text</frontend_type>
|
87 |
-
<sort_order>63</sort_order>
|
88 |
-
<show_in_default>1</show_in_default>
|
89 |
-
<show_in_website>1</show_in_website>
|
90 |
-
<show_in_store>1</show_in_store>
|
91 |
-
<comment>Maximum Deposit Amount (defaults to 50%)</comment>
|
92 |
-
</maxd>
|
93 |
-
<months translate="label comment">
|
94 |
-
<label>Months</label>
|
95 |
-
<frontend_type>text</frontend_type>
|
96 |
-
<sort_order>64</sort_order>
|
97 |
-
<show_in_default>1</show_in_default>
|
98 |
-
<show_in_website>1</show_in_website>
|
99 |
-
<show_in_store>1</show_in_store>
|
100 |
-
<comment>Maximum Number of Months to pay Balance (defaults to 3)</comment>
|
101 |
-
</months>
|
102 |
-
<adminfee translate="label comment">
|
103 |
-
<label>Show Lay-Buy Fee in Description</label>
|
104 |
-
<frontend_type>select</frontend_type>
|
105 |
-
<source_model>adminhtml/system_config_source_yesno</source_model>
|
106 |
-
<sort_order>65</sort_order>
|
107 |
-
<show_in_default>1</show_in_default>
|
108 |
-
<show_in_website>1</show_in_website>
|
109 |
-
<show_in_store>0</show_in_store>
|
110 |
-
<comment><![CDATA[ This payment option attracts a 0.9% surcharge. For more detail please login to <a href="https://www.lay-buys.com/vtmob/login/" target="_blank" title="https://www.lay-buys.com/vtmob/login/">merchant panel</a> using your merchant credentials.]]></comment>
|
111 |
-
</adminfee>
|
112 |
-
<conditional_criteria_total translate="label comment">
|
113 |
-
<label>Minimum Cart Total</label>
|
114 |
-
<config_path>laybuy/conditional_criteria/total</config_path>
|
115 |
-
<frontend_type>text</frontend_type>
|
116 |
-
<comment>The checkout total the order must reach before this payment method becomes active.</comment>
|
117 |
-
<sort_order>67</sort_order>
|
118 |
-
<show_in_default>1</show_in_default>
|
119 |
-
<show_in_website>1</show_in_website>
|
120 |
-
<show_in_store>1</show_in_store>
|
121 |
-
<shared>1</shared>
|
122 |
-
</conditional_criteria_total>
|
123 |
-
<allowspecificcategory translate="label comment">
|
124 |
-
<label>Allowed Categories</label>
|
125 |
-
<config_path>laybuy/conditional_criteria/allowspecificcategory</config_path>
|
126 |
-
<frontend_type>select</frontend_type>
|
127 |
-
<sort_order>69</sort_order>
|
128 |
-
<source_model>laybuy/system_config_source_allowspecificcategory</source_model>
|
129 |
-
<show_in_default>1</show_in_default>
|
130 |
-
<show_in_website>1</show_in_website>
|
131 |
-
<show_in_store>1</show_in_store>
|
132 |
-
</allowspecificcategory>
|
133 |
-
<conditional_criteria_category translate="comment">
|
134 |
-
<config_path>laybuy/conditional_criteria/categories</config_path>
|
135 |
-
<frontend_type>multiselect</frontend_type>
|
136 |
-
<source_model>laybuy/system_config_source_categories</source_model>
|
137 |
-
<can_be_empty>1</can_be_empty>
|
138 |
-
<comment>The checkout products of the orders must be in these categories before this payment method becomes active.</comment>
|
139 |
-
<sort_order>71</sort_order>
|
140 |
-
<depends><allowspecificcategory>1</allowspecificcategory></depends>
|
141 |
-
<show_in_default>1</show_in_default>
|
142 |
-
<show_in_website>1</show_in_website>
|
143 |
-
<show_in_store>1</show_in_store>
|
144 |
-
<shared>1</shared>
|
145 |
-
</conditional_criteria_category>
|
146 |
-
<allowspecificgroup translate="label comment">
|
147 |
-
<label>Allowed Customer Groups</label>
|
148 |
-
<config_path>laybuy/conditional_criteria/allowspecificgroup</config_path>
|
149 |
-
<frontend_type>select</frontend_type>
|
150 |
-
<sort_order>72</sort_order>
|
151 |
-
<source_model>laybuy/system_config_source_allowspecificgroup</source_model>
|
152 |
-
<show_in_default>1</show_in_default>
|
153 |
-
<show_in_website>1</show_in_website>
|
154 |
-
<show_in_store>1</show_in_store>
|
155 |
-
</allowspecificgroup>
|
156 |
-
<conditional_criteria_customergroup translate="comment">
|
157 |
-
<config_path>laybuy/conditional_criteria/customergroup</config_path>
|
158 |
-
<frontend_type>multiselect</frontend_type>
|
159 |
-
<source_model>laybuy/system_config_source_groups</source_model>
|
160 |
-
<comment>The checkout customer must be in these customer groups before this payment method becomes active.</comment>
|
161 |
-
<sort_order>73</sort_order>
|
162 |
-
<depends><allowspecificgroup>1</allowspecificgroup></depends>
|
163 |
-
<show_in_default>1</show_in_default>
|
164 |
-
<show_in_website>1</show_in_website>
|
165 |
-
<show_in_store>1</show_in_store>
|
166 |
-
<shared>1</shared>
|
167 |
-
</conditional_criteria_customergroup>
|
168 |
-
<conditional_criteria_exclude_products translate="label comment">
|
169 |
-
<label>Excluded Product Ids</label>
|
170 |
-
<config_path>laybuy/conditional_criteria/xproducts</config_path>
|
171 |
-
<frontend_type>textarea</frontend_type>
|
172 |
-
<can_be_empty>1</can_be_empty>
|
173 |
-
<comment>Add product ids separated by comma(,) for which method will not available.</comment>
|
174 |
-
<sort_order>75</sort_order>
|
175 |
-
<show_in_default>1</show_in_default>
|
176 |
-
<show_in_website>1</show_in_website>
|
177 |
-
<show_in_store>1</show_in_store>
|
178 |
-
<shared>1</shared>
|
179 |
-
</conditional_criteria_exclude_products>
|
180 |
-
<image translate="label comment">
|
181 |
-
<label>Image/Logo</label>
|
182 |
-
<frontend_type>image</frontend_type>
|
183 |
-
<backend_model>adminhtml/system_config_backend_image</backend_model>
|
184 |
-
<upload_dir config="system/filesystem/media" scope_info="1">laybuy</upload_dir>
|
185 |
-
<base_url type="media" scope_info="1">laybuy</base_url>
|
186 |
-
<sort_order>77</sort_order>
|
187 |
-
<show_in_default>1</show_in_default>
|
188 |
-
<show_in_website>1</show_in_website>
|
189 |
-
<show_in_store>1</show_in_store>
|
190 |
-
<comment>logo or image (max. 750x90) to appear on Lay-Buys page for your branding or white-labeling.</comment>
|
191 |
-
</image>
|
192 |
-
<allowspecific translate="label comment">
|
193 |
-
<label>Payment Applicable From</label>
|
194 |
-
<frontend_type>select</frontend_type>
|
195 |
-
<sort_order>79</sort_order>
|
196 |
-
<source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
|
197 |
-
<show_in_default>1</show_in_default>
|
198 |
-
<show_in_website>1</show_in_website>
|
199 |
-
</allowspecific>
|
200 |
-
<specificcountry translate="label comment">
|
201 |
-
<label>Countries Payment Applicable From</label>
|
202 |
-
<frontend_type>multiselect</frontend_type>
|
203 |
-
<sort_order>81</sort_order>
|
204 |
-
<source_model>adminhtml/system_config_source_country</source_model>
|
205 |
-
<show_in_default>1</show_in_default>
|
206 |
-
<show_in_website>1</show_in_website>
|
207 |
-
<depends><allowspecific>1</allowspecific></depends>
|
208 |
-
</specificcountry>
|
209 |
-
<sort_order translate="label comment">
|
210 |
-
<label>Sort Order</label>
|
211 |
-
<frontend_type>text</frontend_type>
|
212 |
-
<sort_order>82</sort_order>
|
213 |
-
<show_in_default>1</show_in_default>
|
214 |
-
<show_in_website>1</show_in_website>
|
215 |
-
<show_in_store>1</show_in_store>
|
216 |
-
</sort_order>
|
217 |
-
<heading_sftp translate="label">
|
218 |
-
<label>Api Credentials</label>
|
219 |
-
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
220 |
-
<sort_order>83</sort_order>
|
221 |
-
<show_in_default>1</show_in_default>
|
222 |
-
<show_in_website>1</show_in_website>
|
223 |
-
</heading_sftp>
|
224 |
-
<settlement_reports_ftp_ip translate="label comment">
|
225 |
-
<label>Api IP-Address</label>
|
226 |
-
<comment>By default it is "https://lay-buys.com/report/".</comment>
|
227 |
-
<config_path>laybuy/fetch_reports/ftp_ip</config_path>
|
228 |
-
<frontend_type>text</frontend_type>
|
229 |
-
<sort_order>85</sort_order>
|
230 |
-
<show_in_default>1</show_in_default>
|
231 |
-
<show_in_website>1</show_in_website>
|
232 |
-
<shared>1</shared>
|
233 |
-
</settlement_reports_ftp_ip>
|
234 |
-
<heading_schedule translate="label">
|
235 |
-
<label>Scheduled Fetching</label>
|
236 |
-
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
237 |
-
<sort_order>87</sort_order>
|
238 |
-
<show_in_default>1</show_in_default>
|
239 |
-
<show_in_website>1</show_in_website>
|
240 |
-
<shared>1</shared>
|
241 |
-
</heading_schedule>
|
242 |
-
<settlement_reports_active translate="label">
|
243 |
-
<label>Enable Automatic Fetching</label>
|
244 |
-
<config_path>laybuy/fetch_reports/active</config_path>
|
245 |
-
<frontend_type>select</frontend_type>
|
246 |
-
<source_model>adminhtml/system_config_source_yesno</source_model>
|
247 |
-
<sort_order>89</sort_order>
|
248 |
-
<show_in_default>1</show_in_default>
|
249 |
-
<show_in_website>1</show_in_website>
|
250 |
-
<shared>1</shared>
|
251 |
-
</settlement_reports_active>
|
252 |
-
<settlement_reports_schedule translate="label comment">
|
253 |
-
<label>Schedule</label>
|
254 |
-
<config_path>laybuy/fetch_reports/schedule</config_path>
|
255 |
-
<frontend_type>select</frontend_type>
|
256 |
-
<source_model>laybuy/system_config_source_fetchingSchedule</source_model>
|
257 |
-
<backend_model>laybuy/system_config_backend_cron</backend_model>
|
258 |
-
<sort_order>91</sort_order>
|
259 |
-
<show_in_default>1</show_in_default>
|
260 |
-
<shared>1</shared>
|
261 |
-
</settlement_reports_schedule>
|
262 |
-
<settlement_reports_time translate="label">
|
263 |
-
<label>Time of Day</label>
|
264 |
-
<config_path>laybuy/fetch_reports/time</config_path>
|
265 |
-
<frontend_type>time</frontend_type>
|
266 |
-
<sort_order>100</sort_order>
|
267 |
-
<show_in_default>1</show_in_default>
|
268 |
-
<shared>1</shared>
|
269 |
-
</settlement_reports_time>
|
270 |
-
<
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
<label>Enabled</label>
|
280 |
-
<frontend_type>select</frontend_type>
|
281 |
-
<config_path>payment/laybuy_express/active</config_path>
|
282 |
-
<source_model>adminhtml/system_config_source_yesno</source_model>
|
283 |
-
<sort_order>101</sort_order>
|
284 |
-
<show_in_default>1</show_in_default>
|
285 |
-
<show_in_website>1</show_in_website>
|
286 |
-
<show_in_store>0</show_in_store>
|
287 |
-
</active_express>
|
288 |
-
<sort_order>101</sort_order>
|
289 |
-
<show_in_default>1</show_in_default>
|
290 |
-
<show_in_website>1</show_in_website>
|
291 |
-
<show_in_store>0</show_in_store>
|
292 |
-
</fields>
|
293 |
-
</laybuy>
|
294 |
-
</groups>
|
295 |
-
</payment>
|
296 |
-
</sections>
|
297 |
</config>
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<sections>
|
4 |
+
<payment>
|
5 |
+
<groups>
|
6 |
+
<laybuy translate="label comment" module="laybuy">
|
7 |
+
<label>PUT IT ON LAY-BUY (powered by PayPal)</label>
|
8 |
+
<frontend_type>text</frontend_type>
|
9 |
+
<sort_order>999</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 |
+
<fields>
|
14 |
+
<active translate="label comment">
|
15 |
+
<label>Enabled</label>
|
16 |
+
<frontend_type>select</frontend_type>
|
17 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
18 |
+
<sort_order>10</sort_order>
|
19 |
+
<show_in_default>1</show_in_default>
|
20 |
+
<show_in_website>1</show_in_website>
|
21 |
+
<show_in_store>0</show_in_store>
|
22 |
+
</active>
|
23 |
+
<title translate="label comment">
|
24 |
+
<label>Title</label>
|
25 |
+
<frontend_type>text</frontend_type>
|
26 |
+
<sort_order>20</sort_order>
|
27 |
+
<show_in_default>1</show_in_default>
|
28 |
+
<show_in_website>1</show_in_website>
|
29 |
+
<show_in_store>1</show_in_store>
|
30 |
+
</title>
|
31 |
+
<order_status translate="label comment">
|
32 |
+
<label>New Order Status</label>
|
33 |
+
<frontend_type>select</frontend_type>
|
34 |
+
<source_model>adminhtml/system_config_source_order_status</source_model>
|
35 |
+
<sort_order>51</sort_order>
|
36 |
+
<show_in_default>1</show_in_default>
|
37 |
+
<show_in_website>1</show_in_website>
|
38 |
+
<show_in_store>0</show_in_store>
|
39 |
+
</order_status>
|
40 |
+
<submit_url translate="label comment">
|
41 |
+
<label>Gateway URL</label>
|
42 |
+
<frontend_type>text</frontend_type>
|
43 |
+
<sort_order>58</sort_order>
|
44 |
+
<show_in_default>1</show_in_default>
|
45 |
+
<show_in_website>0</show_in_website>
|
46 |
+
<show_in_store>0</show_in_store>
|
47 |
+
</submit_url>
|
48 |
+
<membership_number translate="label comment">
|
49 |
+
<label>Lay-Buys Membership Number</label>
|
50 |
+
<frontend_type>password</frontend_type>
|
51 |
+
<sort_order>59</sort_order>
|
52 |
+
<show_in_default>1</show_in_default>
|
53 |
+
<show_in_website>1</show_in_website>
|
54 |
+
<show_in_store>0</show_in_store>
|
55 |
+
</membership_number>
|
56 |
+
<multipledesc translate="label comment">
|
57 |
+
<label>Line Items Description</label>
|
58 |
+
<frontend_type>select</frontend_type>
|
59 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
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 |
+
</multipledesc>
|
65 |
+
<desc translate="label comment">
|
66 |
+
<label>Description</label>
|
67 |
+
<frontend_type>textarea</frontend_type>
|
68 |
+
<sort_order>61</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 |
+
<depends><multipledesc>0</multipledesc></depends>
|
73 |
+
<comment>Description of products / services</comment>
|
74 |
+
</desc>
|
75 |
+
<mind translate="label comment">
|
76 |
+
<label>Minimum</label>
|
77 |
+
<frontend_type>text</frontend_type>
|
78 |
+
<sort_order>62</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 |
+
<comment>Minimum Deposit Amount (defaults to 20%)</comment>
|
83 |
+
</mind>
|
84 |
+
<maxd translate="label comment">
|
85 |
+
<label>Maximum</label>
|
86 |
+
<frontend_type>text</frontend_type>
|
87 |
+
<sort_order>63</sort_order>
|
88 |
+
<show_in_default>1</show_in_default>
|
89 |
+
<show_in_website>1</show_in_website>
|
90 |
+
<show_in_store>1</show_in_store>
|
91 |
+
<comment>Maximum Deposit Amount (defaults to 50%)</comment>
|
92 |
+
</maxd>
|
93 |
+
<months translate="label comment">
|
94 |
+
<label>Months</label>
|
95 |
+
<frontend_type>text</frontend_type>
|
96 |
+
<sort_order>64</sort_order>
|
97 |
+
<show_in_default>1</show_in_default>
|
98 |
+
<show_in_website>1</show_in_website>
|
99 |
+
<show_in_store>1</show_in_store>
|
100 |
+
<comment>Maximum Number of Months to pay Balance (defaults to 3)</comment>
|
101 |
+
</months>
|
102 |
+
<adminfee translate="label comment">
|
103 |
+
<label>Show Lay-Buy Fee in Description</label>
|
104 |
+
<frontend_type>select</frontend_type>
|
105 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
106 |
+
<sort_order>65</sort_order>
|
107 |
+
<show_in_default>1</show_in_default>
|
108 |
+
<show_in_website>1</show_in_website>
|
109 |
+
<show_in_store>0</show_in_store>
|
110 |
+
<comment><![CDATA[ This payment option attracts a 0.9% surcharge. For more detail please login to <a href="https://www.lay-buys.com/vtmob/login/" target="_blank" title="https://www.lay-buys.com/vtmob/login/">merchant panel</a> using your merchant credentials.]]></comment>
|
111 |
+
</adminfee>
|
112 |
+
<conditional_criteria_total translate="label comment">
|
113 |
+
<label>Minimum Cart Total</label>
|
114 |
+
<config_path>laybuy/conditional_criteria/total</config_path>
|
115 |
+
<frontend_type>text</frontend_type>
|
116 |
+
<comment>The checkout total the order must reach before this payment method becomes active.</comment>
|
117 |
+
<sort_order>67</sort_order>
|
118 |
+
<show_in_default>1</show_in_default>
|
119 |
+
<show_in_website>1</show_in_website>
|
120 |
+
<show_in_store>1</show_in_store>
|
121 |
+
<shared>1</shared>
|
122 |
+
</conditional_criteria_total>
|
123 |
+
<allowspecificcategory translate="label comment">
|
124 |
+
<label>Allowed Categories</label>
|
125 |
+
<config_path>laybuy/conditional_criteria/allowspecificcategory</config_path>
|
126 |
+
<frontend_type>select</frontend_type>
|
127 |
+
<sort_order>69</sort_order>
|
128 |
+
<source_model>laybuy/system_config_source_allowspecificcategory</source_model>
|
129 |
+
<show_in_default>1</show_in_default>
|
130 |
+
<show_in_website>1</show_in_website>
|
131 |
+
<show_in_store>1</show_in_store>
|
132 |
+
</allowspecificcategory>
|
133 |
+
<conditional_criteria_category translate="comment">
|
134 |
+
<config_path>laybuy/conditional_criteria/categories</config_path>
|
135 |
+
<frontend_type>multiselect</frontend_type>
|
136 |
+
<source_model>laybuy/system_config_source_categories</source_model>
|
137 |
+
<can_be_empty>1</can_be_empty>
|
138 |
+
<comment>The checkout products of the orders must be in these categories before this payment method becomes active.</comment>
|
139 |
+
<sort_order>71</sort_order>
|
140 |
+
<depends><allowspecificcategory>1</allowspecificcategory></depends>
|
141 |
+
<show_in_default>1</show_in_default>
|
142 |
+
<show_in_website>1</show_in_website>
|
143 |
+
<show_in_store>1</show_in_store>
|
144 |
+
<shared>1</shared>
|
145 |
+
</conditional_criteria_category>
|
146 |
+
<allowspecificgroup translate="label comment">
|
147 |
+
<label>Allowed Customer Groups</label>
|
148 |
+
<config_path>laybuy/conditional_criteria/allowspecificgroup</config_path>
|
149 |
+
<frontend_type>select</frontend_type>
|
150 |
+
<sort_order>72</sort_order>
|
151 |
+
<source_model>laybuy/system_config_source_allowspecificgroup</source_model>
|
152 |
+
<show_in_default>1</show_in_default>
|
153 |
+
<show_in_website>1</show_in_website>
|
154 |
+
<show_in_store>1</show_in_store>
|
155 |
+
</allowspecificgroup>
|
156 |
+
<conditional_criteria_customergroup translate="comment">
|
157 |
+
<config_path>laybuy/conditional_criteria/customergroup</config_path>
|
158 |
+
<frontend_type>multiselect</frontend_type>
|
159 |
+
<source_model>laybuy/system_config_source_groups</source_model>
|
160 |
+
<comment>The checkout customer must be in these customer groups before this payment method becomes active.</comment>
|
161 |
+
<sort_order>73</sort_order>
|
162 |
+
<depends><allowspecificgroup>1</allowspecificgroup></depends>
|
163 |
+
<show_in_default>1</show_in_default>
|
164 |
+
<show_in_website>1</show_in_website>
|
165 |
+
<show_in_store>1</show_in_store>
|
166 |
+
<shared>1</shared>
|
167 |
+
</conditional_criteria_customergroup>
|
168 |
+
<conditional_criteria_exclude_products translate="label comment">
|
169 |
+
<label>Excluded Product Ids</label>
|
170 |
+
<config_path>laybuy/conditional_criteria/xproducts</config_path>
|
171 |
+
<frontend_type>textarea</frontend_type>
|
172 |
+
<can_be_empty>1</can_be_empty>
|
173 |
+
<comment>Add product ids separated by comma(,) for which method will not available.</comment>
|
174 |
+
<sort_order>75</sort_order>
|
175 |
+
<show_in_default>1</show_in_default>
|
176 |
+
<show_in_website>1</show_in_website>
|
177 |
+
<show_in_store>1</show_in_store>
|
178 |
+
<shared>1</shared>
|
179 |
+
</conditional_criteria_exclude_products>
|
180 |
+
<image translate="label comment">
|
181 |
+
<label>Image/Logo</label>
|
182 |
+
<frontend_type>image</frontend_type>
|
183 |
+
<backend_model>adminhtml/system_config_backend_image</backend_model>
|
184 |
+
<upload_dir config="system/filesystem/media" scope_info="1">laybuy</upload_dir>
|
185 |
+
<base_url type="media" scope_info="1">laybuy</base_url>
|
186 |
+
<sort_order>77</sort_order>
|
187 |
+
<show_in_default>1</show_in_default>
|
188 |
+
<show_in_website>1</show_in_website>
|
189 |
+
<show_in_store>1</show_in_store>
|
190 |
+
<comment>logo or image (max. 750x90) to appear on Lay-Buys page for your branding or white-labeling.</comment>
|
191 |
+
</image>
|
192 |
+
<allowspecific translate="label comment">
|
193 |
+
<label>Payment Applicable From</label>
|
194 |
+
<frontend_type>select</frontend_type>
|
195 |
+
<sort_order>79</sort_order>
|
196 |
+
<source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
|
197 |
+
<show_in_default>1</show_in_default>
|
198 |
+
<show_in_website>1</show_in_website>
|
199 |
+
</allowspecific>
|
200 |
+
<specificcountry translate="label comment">
|
201 |
+
<label>Countries Payment Applicable From</label>
|
202 |
+
<frontend_type>multiselect</frontend_type>
|
203 |
+
<sort_order>81</sort_order>
|
204 |
+
<source_model>adminhtml/system_config_source_country</source_model>
|
205 |
+
<show_in_default>1</show_in_default>
|
206 |
+
<show_in_website>1</show_in_website>
|
207 |
+
<depends><allowspecific>1</allowspecific></depends>
|
208 |
+
</specificcountry>
|
209 |
+
<sort_order translate="label comment">
|
210 |
+
<label>Sort Order</label>
|
211 |
+
<frontend_type>text</frontend_type>
|
212 |
+
<sort_order>82</sort_order>
|
213 |
+
<show_in_default>1</show_in_default>
|
214 |
+
<show_in_website>1</show_in_website>
|
215 |
+
<show_in_store>1</show_in_store>
|
216 |
+
</sort_order>
|
217 |
+
<heading_sftp translate="label">
|
218 |
+
<label>Api Credentials</label>
|
219 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
220 |
+
<sort_order>83</sort_order>
|
221 |
+
<show_in_default>1</show_in_default>
|
222 |
+
<show_in_website>1</show_in_website>
|
223 |
+
</heading_sftp>
|
224 |
+
<settlement_reports_ftp_ip translate="label comment">
|
225 |
+
<label>Api IP-Address</label>
|
226 |
+
<comment>By default it is "https://lay-buys.com/report/".</comment>
|
227 |
+
<config_path>laybuy/fetch_reports/ftp_ip</config_path>
|
228 |
+
<frontend_type>text</frontend_type>
|
229 |
+
<sort_order>85</sort_order>
|
230 |
+
<show_in_default>1</show_in_default>
|
231 |
+
<show_in_website>1</show_in_website>
|
232 |
+
<shared>1</shared>
|
233 |
+
</settlement_reports_ftp_ip>
|
234 |
+
<heading_schedule translate="label">
|
235 |
+
<label>Scheduled Fetching</label>
|
236 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
237 |
+
<sort_order>87</sort_order>
|
238 |
+
<show_in_default>1</show_in_default>
|
239 |
+
<show_in_website>1</show_in_website>
|
240 |
+
<shared>1</shared>
|
241 |
+
</heading_schedule>
|
242 |
+
<settlement_reports_active translate="label">
|
243 |
+
<label>Enable Automatic Fetching</label>
|
244 |
+
<config_path>laybuy/fetch_reports/active</config_path>
|
245 |
+
<frontend_type>select</frontend_type>
|
246 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
247 |
+
<sort_order>89</sort_order>
|
248 |
+
<show_in_default>1</show_in_default>
|
249 |
+
<show_in_website>1</show_in_website>
|
250 |
+
<shared>1</shared>
|
251 |
+
</settlement_reports_active>
|
252 |
+
<settlement_reports_schedule translate="label comment">
|
253 |
+
<label>Schedule</label>
|
254 |
+
<config_path>laybuy/fetch_reports/schedule</config_path>
|
255 |
+
<frontend_type>select</frontend_type>
|
256 |
+
<source_model>laybuy/system_config_source_fetchingSchedule</source_model>
|
257 |
+
<backend_model>laybuy/system_config_backend_cron</backend_model>
|
258 |
+
<sort_order>91</sort_order>
|
259 |
+
<show_in_default>1</show_in_default>
|
260 |
+
<shared>1</shared>
|
261 |
+
</settlement_reports_schedule>
|
262 |
+
<settlement_reports_time translate="label">
|
263 |
+
<label>Time of Day</label>
|
264 |
+
<config_path>laybuy/fetch_reports/time</config_path>
|
265 |
+
<frontend_type>time</frontend_type>
|
266 |
+
<sort_order>100</sort_order>
|
267 |
+
<show_in_default>1</show_in_default>
|
268 |
+
<shared>1</shared>
|
269 |
+
</settlement_reports_time>
|
270 |
+
<sort_order>101</sort_order>
|
271 |
+
<show_in_default>1</show_in_default>
|
272 |
+
<show_in_website>1</show_in_website>
|
273 |
+
<show_in_store>0</show_in_store>
|
274 |
+
</fields>
|
275 |
+
</laybuy>
|
276 |
+
</groups>
|
277 |
+
</payment>
|
278 |
+
</sections>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
279 |
</config>
|
app/code/local/Ced/LayBuy/sql/laybuy_setup/mysql4-upgrade-1.0.0-1.0.1.php
DELETED
@@ -1,16 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
$installer = $this;
|
3 |
-
/* @var $installer Mage_Customer_Model_Entity_Setup */
|
4 |
-
|
5 |
-
$installer->startSetup();
|
6 |
-
|
7 |
-
$installer->run("
|
8 |
-
CREATE TABLE IF NOT EXISTS `{$installer->getTable('laybuy/laybuyresp')}` (
|
9 |
-
`resp_id` int(100) NOT NULL AUTO_INCREMENT,
|
10 |
-
`order_id` int(100) NOT NULL,
|
11 |
-
`response` text NOT NULL,
|
12 |
-
PRIMARY KEY (`resp_id`)
|
13 |
-
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
|
14 |
-
");
|
15 |
-
|
16 |
-
$installer->endSetup();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/frontend/base/default/layout/laybuy.xml
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
<layout version="0.1.0">
|
3 |
<default>
|
4 |
<reference name="head">
|
5 |
-
<action method="addItem"><type>js</type><name>laybuy/jquery.min.js</name></action>
|
6 |
-
<action method="addItem"><type>js</type><name>laybuy/jquery.atooltip.js</name></action>
|
7 |
</reference>
|
8 |
</default>
|
9 |
<checkout_onepage_review>
|
@@ -49,88 +49,4 @@
|
|
49 |
<block type="laybuy/customer_account_grid" name="transaction_grid" template="laybuy/customer/account/grid.phtml"/>
|
50 |
</reference>
|
51 |
</laybuy_report_grid>
|
52 |
-
|
53 |
-
<!-- new code by me starts-->
|
54 |
-
<catalog_product_view>
|
55 |
-
<reference name="product.info.addtocart">
|
56 |
-
<block type="page/html_wrapper" name="product.info.addtocart.laybuy.wrapper" translate="label">
|
57 |
-
<label>Laybuy Express Checkout Shortcut Wrapper</label>
|
58 |
-
<block type="laybuy/express_layshortcut" name="product.info.addtocart.laybuy" template="laybuy/express/layshortcut.phtml">
|
59 |
-
<action method="setIsInCatalogProduct"><value>1</value></action>
|
60 |
-
</block>
|
61 |
-
</block>
|
62 |
-
</reference>
|
63 |
-
</catalog_product_view>
|
64 |
-
<default>
|
65 |
-
<reference name="topCart.extra_actions">
|
66 |
-
<block type="laybuy/express_layshortcut" name="laybuy.partner.top_cart.shortcut" template="laybuy/express/layshortcut1.phtml"/>
|
67 |
-
</reference>
|
68 |
-
<reference name="cart_sidebar.extra_actions">
|
69 |
-
<block type="laybuy/express_layshortcut" name="laybuy.partner.cart_sidebar.shortcut" template="laybuy/express/layshortcut1.phtml"/>
|
70 |
-
</reference>
|
71 |
-
</default>
|
72 |
-
<checkout_cart_index>
|
73 |
-
<reference name="checkout.cart.top_methods">
|
74 |
-
<block type="laybuy/express_layshortcut" name="checkout.cart.methods.laybuy_express.top" before="-" template="laybuy/express/layshortcut1.phtml">
|
75 |
-
<action method="setIsQuoteAllowed"><value>1</value></action>
|
76 |
-
</block>
|
77 |
-
</reference>
|
78 |
-
|
79 |
-
<reference name="checkout.cart.methods">
|
80 |
-
<block type="laybuy/express_layshortcut" name="checkout.cart.methods.laybuy_express.bottom" before="-" template="laybuy/express/layshortcut1.phtml">
|
81 |
-
<action method="setIsQuoteAllowed"><value>1</value></action>
|
82 |
-
</block>
|
83 |
-
</reference>
|
84 |
-
|
85 |
-
<!-- <update handle="SHORTCUT_popup" />-->
|
86 |
-
</checkout_cart_index>
|
87 |
-
<laybuy_express_index>
|
88 |
-
<remove name="right"/>
|
89 |
-
<remove name="left"/>
|
90 |
-
<reference name="root">
|
91 |
-
<action method="setTemplate"><template>page/1column.phtml</template></action>
|
92 |
-
</reference>
|
93 |
-
<reference name="content">
|
94 |
-
<block type="laybuy/express_layform" name="laybuy.express.layform" template="laybuy/express/extraexpress.phtml">
|
95 |
-
</block>
|
96 |
-
</reference>
|
97 |
-
</laybuy_express_index>
|
98 |
-
<laybuy_express_review translate="label">
|
99 |
-
<label>Laybuy Express Order Review Form</label>
|
100 |
-
<remove name="right"/>
|
101 |
-
<remove name="left"/>
|
102 |
-
<reference name="root">
|
103 |
-
<action method="setTemplate"><template>page/1column.phtml</template></action>
|
104 |
-
</reference>
|
105 |
-
<reference name="content">
|
106 |
-
<block type="laybuy/express_review" name="laybuy.express.review" template="laybuy/express/review.phtml">
|
107 |
-
<block type="core/template" name="laybuy.checkout.onepage.review.button" as="laybuy_button" template="laybuy/checkout/onepage/review/button_express.phtml"/>
|
108 |
-
<block type="laybuy/express_review_billing" name="express.review.billing" as="billing" template="laybuy/express/review/address.phtml"/>
|
109 |
-
<block type="laybuy/express_review_shipping" name="express.review.shipping" as="shipping" template="laybuy/express/review/address.phtml"/>
|
110 |
-
<block type="laybuy/express_review" name="express.review.shipping.method" as="shipping_method" template="laybuy/express/review/shipping/method.phtml"/>
|
111 |
-
<block type="laybuy/express_review_details" name="laybuy.express.review.details" as="details" template="laybuy/express/review/details.phtml">
|
112 |
-
<action method="addItemRender"><type>default</type><block>checkout/cart_item_renderer</block><template>checkout/onepage/review/item.phtml</template></action>
|
113 |
-
<action method="addItemRender"><type>grouped</type><block>checkout/cart_item_renderer_grouped</block><template>checkout/onepage/review/item.phtml</template></action>
|
114 |
-
<action method="addItemRender"><type>configurable</type><block>checkout/cart_item_renderer_configurable</block><template>checkout/onepage/review/item.phtml</template></action>
|
115 |
-
<block type="checkout/cart_totals" name="laybuy.express.review.details.totals" as="totals" template="checkout/onepage/review/totals.phtml"/>
|
116 |
-
</block>
|
117 |
-
<block type="checkout/agreements" name="laybuy.express.review.details.agreements" as="agreements" template="checkout/onepage/agreements.phtml"/>
|
118 |
-
</block>
|
119 |
-
</reference>
|
120 |
-
<reference name="head">
|
121 |
-
<!--<action method="addItem"><type>skin_js</type><name>js/checkout/review.js</name></action>-->
|
122 |
-
<action method="addItem"><type>js</type><name>laybuy/review.js</name></action>
|
123 |
-
</reference>
|
124 |
-
<block type="core/text_list" name="additional.product.info" />
|
125 |
-
</laybuy_express_review>
|
126 |
-
<laybuy_express_review_details>
|
127 |
-
<block type="laybuy/express_review_details" name="root" output="toHtml" template="laybuy/express/review/details.phtml">
|
128 |
-
<action method="addItemRender"><type>default</type><block>checkout/cart_item_renderer</block><template>checkout/onepage/review/item.phtml</template></action>
|
129 |
-
<action method="addItemRender"><type>grouped</type><block>checkout/cart_item_renderer_grouped</block><template>checkout/onepage/review/item.phtml</template></action>
|
130 |
-
<action method="addItemRender"><type>configurable</type><block>checkout/cart_item_renderer_configurable</block><template>checkout/onepage/review/item.phtml</template></action>
|
131 |
-
<block type="core/template" name="laybuy.checkout.onepage.review.button" as="laybuy_button" template="laybuy/checkout/onepage/review/button_express.phtml"/>
|
132 |
-
<block type="checkout/cart_totals" name="laybuy.express.review.details.totals" as="totals" template="checkout/onepage/review/totals.phtml"/>
|
133 |
-
</block>
|
134 |
-
</laybuy_express_review_details>
|
135 |
-
<!-- new code by me ends -->
|
136 |
</layout>
|
2 |
<layout version="0.1.0">
|
3 |
<default>
|
4 |
<reference name="head">
|
5 |
+
<action method="addItem" ifconfig="payment/laybuy/active"><type>js</type><name>laybuy/jquery.min.js</name></action>
|
6 |
+
<action method="addItem" ifconfig="payment/laybuy/active"><type>js</type><name>laybuy/jquery.atooltip.js</name></action>
|
7 |
</reference>
|
8 |
</default>
|
9 |
<checkout_onepage_review>
|
49 |
<block type="laybuy/customer_account_grid" name="transaction_grid" template="laybuy/customer/account/grid.phtml"/>
|
50 |
</reference>
|
51 |
</laybuy_report_grid>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
</layout>
|
app/design/frontend/base/default/template/laybuy/checkout/onepage/review/button_express.phtml
DELETED
@@ -1,50 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Lay-Buys
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
-
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/afl-3.0.php
|
11 |
-
* If you did not receive a copy of the license and are unable to
|
12 |
-
* obtain it through the world-wide-web, please send an email
|
13 |
-
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
-
*
|
15 |
-
* DISCLAIMER
|
16 |
-
*
|
17 |
-
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
-
* versions in the future. If you wish to customize Magento for your
|
19 |
-
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
-
*
|
21 |
-
* @category design
|
22 |
-
* @package base_default
|
23 |
-
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
-
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
-
*/
|
26 |
-
?>
|
27 |
-
<?php
|
28 |
-
$this->setLayBuyTitle(Mage::helper('laybuy')->__('A recurring payment solution'))
|
29 |
-
->setPaymentAcceptanceMarkSrc('http://lay-buys.com/gateway/LAY-BUY.png')
|
30 |
-
->setPaymentAcceptanceMarkHref('http://lay-buys.com/');
|
31 |
-
$sessionPayment = Mage::getSingleton('checkout/session')->getQuote()->getPayment();
|
32 |
-
$method = $sessionPayment->getData('method');
|
33 |
-
$init=Mage::getSingleton('core/session')->getPaymentInit();
|
34 |
-
$month=Mage::getSingleton('core/session')->getPaymentMonths();
|
35 |
-
$customerOptions = Mage::helper('laybuy')->getInstalmentData($sessionPayment);
|
36 |
-
$totals = Mage::getSingleton('checkout/session')->getQuote()->getTotals();
|
37 |
-
$grandtotal = $totals["grand_total"]->getValue();
|
38 |
-
?>
|
39 |
-
<?php if($method == 'laybuy_express'){ ?>
|
40 |
-
<div class="buttons-set">
|
41 |
-
<br/>
|
42 |
-
<div class="input-box" id="laybuy-preview-wrapper" style="clear: both !important;">
|
43 |
-
<span style="text-align: center !important; display: block !important;"><strong><?php echo $this->__('Plan Preview'); ?></strong></span>
|
44 |
-
<iframe src="<?php echo $this->getUrl('laybuy/standard/docalc',array('_secure' => true)); ?>?currency=<?php echo Mage::app()->getStore()->getCurrentCurrencyCode(); ?>&amt=<?php echo $grandtotal; ?>&init=<?php echo $init;//$customerOptions['INIT']; ?>&mnth=<?php echo $month;//$customerOptions['MONTHS']; ?>&html=1" name="preview-tbl" id="preview-tbl" style="width:100%; height:157px; border:0; margin:0; overflow:hidden" marginheight="0" marginwidth="0" noscroll></iframe>
|
45 |
-
</div>
|
46 |
-
</div>
|
47 |
-
<?php } ?>
|
48 |
-
<?php //echo $this->getLayout()->createBlock("core/template")->setTemplate("checkout/onepage/review/button.phtml")->toHtml();
|
49 |
-
|
50 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/frontend/base/default/template/laybuy/express/extraexpress.phtml
DELETED
@@ -1,154 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Lay-Buys
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
-
* that is bundled with this package in the file LICENSE.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/osl-3.0.php
|
11 |
-
* If you did not receive a copy of the license and are unable to
|
12 |
-
* obtain it through the world-wide-web, please send an email
|
13 |
-
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
-
*
|
15 |
-
* DISCLAIMER
|
16 |
-
*
|
17 |
-
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
-
* versions in the future. If you wish to customize Magento for your
|
19 |
-
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
-
*
|
21 |
-
* @category design
|
22 |
-
* @package base_default
|
23 |
-
* @author Asheesh Singh<asheeshsingh@cedcoss.com>
|
24 |
-
* @copyright Copyright LAY-BUYS (2011). (http://lay-buys.com/)
|
25 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
-
*/
|
27 |
-
?>
|
28 |
-
<?php
|
29 |
-
/**
|
30 |
-
* @see Ced_LayBuy_Block_Form_Laybuy
|
31 |
-
*/
|
32 |
-
?>
|
33 |
-
|
34 |
-
<?php
|
35 |
-
$storeId=Mage::app()->getStore()->getId();
|
36 |
-
$adminFeeDescription = '';
|
37 |
-
if(Mage::getStoreConfig('payment/laybuy/adminfee',$storeId)) {
|
38 |
-
//$adminFeeDescription = " A 0.9% admin fee is payable to Lay-Buys.";
|
39 |
-
$adminFeeDescription = " This payment option attracts a 0.9% surcharge.";
|
40 |
-
}
|
41 |
-
if(Mage::getStoreConfig('payment/laybuy/months',$storeId)) {
|
42 |
-
$paymentmonths=Mage::getStoreConfig('payment/laybuy/months',$storeId);
|
43 |
-
}
|
44 |
-
|
45 |
-
|
46 |
-
?>
|
47 |
-
|
48 |
-
<link media="all" rel="stylesheet" href="<?php echo Mage::getBaseUrl('skin'); ?>frontend/base/default/css/laybuy/tooltip.css" type="text/css">
|
49 |
-
<?php
|
50 |
-
$sessionPayment = Mage::getSingleton('checkout/session')->getQuote()->getPayment();
|
51 |
-
$customerOptions = Mage::helper('laybuy')->getInstalmentData($sessionPayment);
|
52 |
-
/* $customerOptions['INIT'] = $sessionPayment->getData('laybuy_init');
|
53 |
-
$customerOptions['MONTHS'] = $sessionPayment->getData('laybuy_months'); */
|
54 |
-
|
55 |
-
$totals = Mage::getSingleton('checkout/session')->getQuote()->getTotals();
|
56 |
-
$grandtotal = $totals["grand_total"]->getValue();
|
57 |
-
?>
|
58 |
-
<form method="post" action="<?php echo Mage::getBaseUrl();?>laybuy/express/form">
|
59 |
-
<div class="fieldset">
|
60 |
-
<ul class="form-list" id="payment_form" style="display:block;">
|
61 |
-
<li class="form-alt"><h2 class="legend"><?php echo $this->getExtraMessage() ?></h2></li>
|
62 |
-
|
63 |
-
<li>
|
64 |
-
<label for="init" class="required"><em>*</em><?php echo $this->__('Initial Payment') ?> : </label>
|
65 |
-
<div class="input-box">
|
66 |
-
<select onChange="document.getElementById('preview-tbl1').src = '<?php echo $this->getUrl('laybuy/standard/docalc',array('_secure'=>true)); ?>?currency=<?php echo Mage::app()->getStore()->getCurrentCurrencyCode(); ?>&amt=<?php echo $grandtotal; ?>&init='+document.getElementById('init').value+'&mnth='+document.getElementById('months').value+'&rnd='+Math.random()+'&html=1';" id="init" name="payment[laybuy_init]" title="<?php echo $this->__('Initial Payment') ?>" class="required-entry">
|
67 |
-
<?php foreach ($this->getArray('dp_amount') as $_data): ?>
|
68 |
-
<option value="<?php echo $_data['value'] ?>" <?php if(isset($customerOptions['INIT']) && $customerOptions['INIT'] && $customerOptions['INIT']==$_data['value']){ ?> selected="selected" <?php } ?>><?php echo $_data['label'] ?></option>
|
69 |
-
<?php endforeach ?>
|
70 |
-
</select>
|
71 |
-
</div>
|
72 |
-
</li>
|
73 |
-
<li>
|
74 |
-
<label for="months" class="required"><em>*</em><?php echo $this->__('Months to Pay') ?> : </label>
|
75 |
-
<div class="input-box">
|
76 |
-
<select onChange="document.getElementById('preview-tbl1').src = '<?php echo $this->getUrl('laybuy/standard/docalc',array('_secure'=>true)); ?>?currency=<?php echo Mage::app()->getStore()->getCurrentCurrencyCode(); ?>&amt=<?php echo $grandtotal; ?>&init='+document.getElementById('init').value+'&mnth='+document.getElementById('months').value+'&rnd='+Math.random()+'&html=1';" id="months" name="payment[laybuy_months]" title="<?php echo $this->__('Months to Pay') ?>" class="required-entry">
|
77 |
-
<?php $_recommendedMonth = isset($customerOptions['MONTHS']) && $customerOptions['MONTHS']?$customerOptions['MONTHS']:$this->getConfigData('months'); ?>
|
78 |
-
<?php foreach ($this->getArray('months') as $_data): ?>
|
79 |
-
<option value="<?php echo $_data['value'] ?>"<?php if($_data['value']==$_recommendedMonth): ?> selected="selected"<?php endif ?>><?php echo $_data['label'] ?></option>
|
80 |
-
<?php endforeach ?>
|
81 |
-
</select>
|
82 |
-
</div>
|
83 |
-
</li>
|
84 |
-
<li>
|
85 |
-
<label for="preview-tbl1"><?php echo $this->__('Plan Preview') ?></label>
|
86 |
-
<div id="preview-tbl1-wrapper" class="input-box" style="width:100% !important">
|
87 |
-
<iframe src="<?php echo $this->getUrl('laybuy/standard/docalc',array('_secure'=>true)); ?>?currency=<?php echo Mage::app()->getStore()->getCurrentCurrencyCode(); ?>&amt=<?php echo $grandtotal; ?>&init=<?php if(isset($customerOptions['INIT']) && $customerOptions['INIT']){ $a=$customerOptions['INIT'];$b=trim($a,"%");echo $b; } else { $c=$this->getConfigData('mind');$d=trim($c,"%");echo $d; } ?>&mnth=<?php echo $_recommendedMonth; ?>&html=1" name="preview-tbl1" id="preview-tbl1" style="width:100%; height:120px; border:0; margin:0; overflow:hidden" marginheight="0" marginwidth="0" noscroll></iframe>
|
88 |
-
|
89 |
-
</div>
|
90 |
-
</li>
|
91 |
-
|
92 |
-
<li>
|
93 |
-
<div class="buttons-set" style="margin-top: 0px; text-align:left;">
|
94 |
-
<label for="preview-tbl12"><?php echo $this->__('* Here initial Down-Payment and Lay-Buy Installment Plan excludes the shipping.') ?></label>
|
95 |
-
<br> <label for="preview-tbl12"><?php echo $this->__('Your goods/services will be delivered once your final payment has been received.') ?></label>
|
96 |
-
<p class="required">* Required Fields</p>
|
97 |
-
<button class="button" title="Continue" type="submit"><span><span>Continue</span></span></button>
|
98 |
-
<label style="float: right ! important; padding-top: 6px;">
|
99 |
-
<a class="callBackTip" title="<?php echo Mage::helper('laybuy')->__('Lay-Buy is an affordable payment plan option that allows you to pay-off a product or service via one down payment, with the balance paid over')?>
|
100 |
-
<?php
|
101 |
-
$secondlast=$paymentmonths-1;
|
102 |
-
for($i=1;$i<=$paymentmonths;$i++){
|
103 |
-
|
104 |
-
echo $i;
|
105 |
-
if($i==$paymentmonths){
|
106 |
-
}
|
107 |
-
else{
|
108 |
-
if($i==$secondlast){
|
109 |
-
echo " ";
|
110 |
-
}
|
111 |
-
else{
|
112 |
-
echo ",";
|
113 |
-
}
|
114 |
-
|
115 |
-
}
|
116 |
-
|
117 |
-
if($i==$secondlast){
|
118 |
-
echo "or"." ";
|
119 |
-
}
|
120 |
-
|
121 |
-
}
|
122 |
-
|
123 |
-
?>
|
124 |
-
<?php echo Mage::helper('laybuy')->__('monthly instalments. Your purchase is delivered to you after the final instalment payment is completed.'.$adminFeeDescription) ?>">
|
125 |
-
<?php echo Mage::helper('laybuy')->__('What is LAY-BUY?') ?></a></label>
|
126 |
-
<script type="text/javascript">
|
127 |
-
laybuy(function(){
|
128 |
-
// List of all parameters and their default values:
|
129 |
-
laybuy('a.callBackTip').aToolTip({
|
130 |
-
// no need to change/override
|
131 |
-
closeTipBtn: 'aToolTipCloseBtn',
|
132 |
-
toolTipId: 'aToolTip',
|
133 |
-
// ok to override
|
134 |
-
fixed: false, // Set true to activate fixed position
|
135 |
-
clickIt: true, // set to true for click activated tooltip
|
136 |
-
inSpeed: 200, // Speed tooltip fades in
|
137 |
-
outSpeed: 100, // Speed tooltip fades out
|
138 |
-
tipContent: '<?php echo Mage::helper('laybuy')->__('Lay-Buy is an affordable payment plan option that allows you to pay-off a product or service via one down payment, with the balance paid over 1, 2 or 3 monthly instalments. Your purchase is delivered to you after the final instalment payment is completed.'.$adminFeeDescription) ?>', // Pass in content or it will use objects 'title' attribute
|
139 |
-
toolTipClass: 'defaultTheme', // Set class name for custom theme/styles
|
140 |
-
xOffset: 5, // x position
|
141 |
-
yOffset: 5, // y position
|
142 |
-
onShow: function(){}, // callback function that fires after atooltip has shown
|
143 |
-
onHide: function(){} // callback function that fires after atooltip has faded out
|
144 |
-
});
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
});
|
149 |
-
</script>
|
150 |
-
</div>
|
151 |
-
</li>
|
152 |
-
</ul>
|
153 |
-
</div>
|
154 |
-
</form>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/frontend/base/default/template/laybuy/express/layshortcut.phtml
DELETED
@@ -1,41 +0,0 @@
|
|
1 |
-
|
2 |
-
<?php $model="";?>
|
3 |
-
<?php $product_id="";?>
|
4 |
-
<?php $store_id="";?>
|
5 |
-
<?php $store_id=Mage::app()->getStore()->getStoreId();?>
|
6 |
-
<?php $model=Mage::getModel("laybuy/express");?>
|
7 |
-
<?php $quote=Mage::getModel('checkout/cart')->getQuote();?>
|
8 |
-
<?php $product_id = Mage::registry('current_product')->getId();?>
|
9 |
-
<?php if($model->isAvailable($quote) && $model->checkForCategoriesAndProducts($product_id,$store_id)){// ?>
|
10 |
-
<p class="paypal-logo">
|
11 |
-
<?php if ($this->isOrPositionBefore()): ?>
|
12 |
-
<span class="paypal-or"><?php echo $this->__('-OR-');?></span>
|
13 |
-
<?php endif; ?>
|
14 |
-
|
15 |
-
<a id="laybuy_express_link" style="cursor: pointer;float:left;"><img src="https://lay-buys.com/gateway/LAY-BUY.png" alt="<?php echo Mage::helper('laybuy')->__('Checkout with Laybuy Express');?>" title="<?php echo Mage::helper('laybuy')->__('Checkout with Laybuy Express');?>" /></a>
|
16 |
-
<span id="payment-please-wait" class="please-wait" style="display:none;margin:5px;float:left;">
|
17 |
-
<img class="v-middle" title="Loading next step..." alt="Loading next step..." src="<?php echo Mage::getBaseUrl("skin");?>frontend/default/default/images/opc-ajax-loader.gif"/>
|
18 |
-
</span>
|
19 |
-
<p style="clear:both;"></p>
|
20 |
-
<?php if ($this->isOrPositionAfter()): ?>
|
21 |
-
<span class="paypal-or"><?php echo $this->__('-OR-');?></span>
|
22 |
-
<?php endif; ?>
|
23 |
-
</p>
|
24 |
-
|
25 |
-
<script type="text/javascript">
|
26 |
-
laybuy(document).ready(function(){
|
27 |
-
laybuy("a#laybuy_express_link").click(function(){
|
28 |
-
laybuy("#payment-please-wait").css("display","block");
|
29 |
-
var other_data = laybuy('#product_addtocart_form').serialize();
|
30 |
-
var url=laybuy('#product_addtocart_form').attr('action');
|
31 |
-
var url1='<?php echo Mage::getBaseurl();?>laybuy/express';
|
32 |
-
laybuy.post( url, other_data,function(data){
|
33 |
-
window.location = url1;
|
34 |
-
});
|
35 |
-
});
|
36 |
-
|
37 |
-
});
|
38 |
-
|
39 |
-
</script>
|
40 |
-
|
41 |
-
<?php }?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/frontend/base/default/template/laybuy/express/layshortcut1.phtml
DELETED
@@ -1,17 +0,0 @@
|
|
1 |
-
<?php $model="";?>
|
2 |
-
<?php $product_id="";?>
|
3 |
-
<?php $store_id="";?>
|
4 |
-
<?php $store_id=Mage::app()->getStore()->getStoreId();?>
|
5 |
-
<?php $quote=Mage::getModel('checkout/cart')->getQuote();?>
|
6 |
-
<?php $model=Mage::getModel("laybuy/express");?>
|
7 |
-
<?php if($model->isAvailable($quote)){ // && $model->checkForCategoriesAndProducts($product_id,$store_id)?>
|
8 |
-
<p class="paypal-logo">
|
9 |
-
<?php if ($this->isOrPositionBefore()): ?>
|
10 |
-
<span class="paypal-or"><?php echo $this->__('-OR-');?></span>
|
11 |
-
<?php endif; ?>
|
12 |
-
<a id="laybuy_express_link" style="cursor: pointer;" href="<?php echo Mage::getBaseurl();?>laybuy/express" ><img src="https://lay-buys.com/gateway/LAY-BUY.png" alt="<?php echo Mage::helper('laybuy')->__('Checkout with Laybuy Express');?>" title="<?php echo Mage::helper('laybuy')->__('Checkout with Laybuy Express');?>" /></a>
|
13 |
-
<?php if ($this->isOrPositionAfter()): ?>
|
14 |
-
<span class="paypal-or"><?php echo $this->__('-OR-');?></span>
|
15 |
-
<?php endif; ?>
|
16 |
-
</p>
|
17 |
-
<?php }?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/frontend/base/default/template/laybuy/express/review.phtml
DELETED
@@ -1,177 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Magento
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
-
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/afl-3.0.php
|
11 |
-
* If you did not receive a copy of the license and are unable to
|
12 |
-
* obtain it through the world-wide-web, please send an email
|
13 |
-
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
-
*
|
15 |
-
* DISCLAIMER
|
16 |
-
*
|
17 |
-
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
-
* versions in the future. If you wish to customize Magento for your
|
19 |
-
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
-
*
|
21 |
-
* @category design
|
22 |
-
* @package base_default
|
23 |
-
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
-
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
-
*/
|
26 |
-
/** @var $this Mage_Paypal_Block_Express_Review */
|
27 |
-
|
28 |
-
$billingBlock = $this->getChild('billing')->setFieldNamePrefix('billing')->setHideEmailAddress(true);
|
29 |
-
$shippingAddress = $this->getShippingAddress();
|
30 |
-
?>
|
31 |
-
<div class="page-title">
|
32 |
-
<h1><?php echo $this->__('Review Order') ?></h1>
|
33 |
-
</div>
|
34 |
-
<?php echo $this->getMessagesBlock()->toHtml() ?>
|
35 |
-
<script type="text/javascript">
|
36 |
-
//<![CDATA[
|
37 |
-
var countryRegions = <?php echo $this->helper('directory')->getRegionJson() ?>
|
38 |
-
//]]>
|
39 |
-
</script>
|
40 |
-
<h2 class="sub-title">
|
41 |
-
Please confirm your addresses
|
42 |
-
</h2>
|
43 |
-
<div class="paypal-review-order">
|
44 |
-
<form method="post" id="order_review_form" action="<?php echo $this->getPlaceOrderUrl() ?>">
|
45 |
-
<?php if(!$billingBlock->isCustomerLoggedIn()): ?>
|
46 |
-
<div class="info-set col2-set">
|
47 |
-
<h2 class="legend"><?php echo $this->__('Customer Information') ?></h2>
|
48 |
-
<ul class="form-list form-list-narrow">
|
49 |
-
<li id="customer-info-form" class="address-form">
|
50 |
-
<div class="field">
|
51 |
-
<label for="customer:email" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
|
52 |
-
<div class="input-box">
|
53 |
-
<input type="text" name="customer-email" id="customer:email" value="<?php echo $this->escapeHtml($billingBlock->getAddress()->getEmail()) ?>" title="<?php echo $this->__('Email Address') ?>" class="input-text validate-email required-entry" />
|
54 |
-
</div>
|
55 |
-
</div>
|
56 |
-
</li>
|
57 |
-
</ul>
|
58 |
-
</div>
|
59 |
-
<?php endif ?>
|
60 |
-
<div class="info-set col2-set">
|
61 |
-
<div class="col-1" id="billing-address">
|
62 |
-
<h2 class="legend"><?php echo $this->__('Billing Address') ?></h2>
|
63 |
-
<?php if ($shippingAddress): ?>
|
64 |
-
<?php echo $billingBlock->setShowAsShippingCheckbox(true)->toHtml(); ?>
|
65 |
-
<?php else: ?>
|
66 |
-
<?php echo $billingBlock->toHtml(); ?>
|
67 |
-
<?php endif; ?>
|
68 |
-
</div>
|
69 |
-
<?php if ($shippingAddress): ?>
|
70 |
-
<div class="col-2" id="shipping-address">
|
71 |
-
<h2 class="legend"><?php echo $this->__('Shipping Address') ?></h2>
|
72 |
-
<?php echo $this->getChild('shipping')->setFieldNamePrefix('shipping')->setHideEmailAddress(true)->toHtml(); ?>
|
73 |
-
</div>
|
74 |
-
</div>
|
75 |
-
|
76 |
-
<div class="info-set col2-set">
|
77 |
-
<div class="col-2">
|
78 |
-
<div class="box paypal-shipping-method">
|
79 |
-
<div class="box-title">
|
80 |
-
<h3><?php echo $this->__('Shipping Method') ?></h3>
|
81 |
-
</div>
|
82 |
-
<div class="box-content">
|
83 |
-
<?php echo $this->getChild('shipping_method')->toHtml(); ?>
|
84 |
-
</div>
|
85 |
-
</div>
|
86 |
-
</div>
|
87 |
-
<?php endif; ?>
|
88 |
-
</div>
|
89 |
-
|
90 |
-
<div class="info-set">
|
91 |
-
<h2 class="legend"><?php echo $this->__('Items in Your Shopping Cart') ?><span class="separator"> | </span><a href="<?php echo $this->getUrl('checkout/cart') ?>"><?php echo $this->__('Edit Shopping Cart') ?></a></h2>
|
92 |
-
<div id="details-reload">
|
93 |
-
<?php echo $this->getChildHtml('details') ?>
|
94 |
-
<?php echo $this->getChildHtml('laybuy_button') ?>
|
95 |
-
</div>
|
96 |
-
</div>
|
97 |
-
<?php echo $this->getChildHtml('agreements'); ?>
|
98 |
-
<div class="buttons-set buttons-set-order" id="review-buttons-container">
|
99 |
-
<button type="button" id="review_button" value="<?php echo $this->__('Place Order') ?>" class="button btn-checkout"><span><span><?php echo $this->__('Place Order') ?></span></span></button>
|
100 |
-
<button type="button" id="review_submit" value="<?php echo $this->__('Place Order') ?>" class="button btn-checkout"><span><span><?php echo $this->__('Place Order') ?></span></span></button>
|
101 |
-
<button type="button" id="update_order" class="button btn-checkout"><span><span><?php echo $this->__('Update Order Data') ?></span></span></button>
|
102 |
-
<span class="please-wait" id="review-please-wait" style="display:none;">
|
103 |
-
<img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" alt="<?php echo $this->__('Submitting order information...') ?>" title="<?php echo $this->__('Submitting order information...') ?>" class="v-middle" /> <?php echo $this->__('Submitting order information...') ?>
|
104 |
-
</span>
|
105 |
-
</div>
|
106 |
-
</form>
|
107 |
-
</div>
|
108 |
-
<script type="text/javascript">
|
109 |
-
//<![CDATA[
|
110 |
-
// submit buttons are not needed when submitting with ajax
|
111 |
-
$('review_submit').hide();
|
112 |
-
if ($('update_shipping_method_submit')) {
|
113 |
-
$('update_shipping_method_submit').hide();
|
114 |
-
}
|
115 |
-
|
116 |
-
<?php if ($this->getUseAjax()):?>
|
117 |
-
OrderReviewController.prototype._submitOrder = function() {
|
118 |
-
if (this._canSubmitOrder) {
|
119 |
-
if (this._pleaseWait) {
|
120 |
-
this._pleaseWait.show();
|
121 |
-
}
|
122 |
-
new Ajax.Request(this.form.action, {
|
123 |
-
parameters: {isAjax: 1, method: 'POST'},
|
124 |
-
onSuccess: function(transport) {
|
125 |
-
try{
|
126 |
-
response = eval('(' + transport.responseText + ')');
|
127 |
-
} catch (e) {
|
128 |
-
response = {};
|
129 |
-
}
|
130 |
-
if (response.redirect) {
|
131 |
-
setLocation(response.redirect);
|
132 |
-
return;
|
133 |
-
}
|
134 |
-
if (response.success) {
|
135 |
-
setLocation('<?php echo $this->getSuccessUrl()?>');
|
136 |
-
return;
|
137 |
-
} else {
|
138 |
-
var msg = response.error_messages;
|
139 |
-
if (typeof(msg)=='object') {
|
140 |
-
msg = msg.join("\n");
|
141 |
-
}
|
142 |
-
if (msg) {
|
143 |
-
$('review-please-wait').hide();
|
144 |
-
alert(msg);
|
145 |
-
return;
|
146 |
-
}
|
147 |
-
}
|
148 |
-
$('review-please-wait').hide();
|
149 |
-
alert('<?php echo $this->jsQuoteEscape($this->__('Unknown Error. Please try again later.')); ?>');
|
150 |
-
return;
|
151 |
-
},
|
152 |
-
onFailure: function(){
|
153 |
-
alert('<?php echo $this->jsQuoteEscape($this->__('Server Error. Please try again.')) ?>');
|
154 |
-
$('review-please-wait').hide();
|
155 |
-
}
|
156 |
-
});
|
157 |
-
}
|
158 |
-
}
|
159 |
-
<?php endif ?>
|
160 |
-
<?php
|
161 |
-
/* $shippingMethodsUpdateUrl="";
|
162 |
-
$UpdateOrderSubmitUrl="";
|
163 |
-
$shippingMethodsUpdateUrl="http://192.168.1.44/magento18/magento/index.php/laybuy/express/updateOrder/";
|
164 |
-
$UpdateOrderSubmitUrl="http://192.168.1.44/magento18/magento/index.php/laybuy/express/updateShippingMethods/" ; */?>
|
165 |
-
PayPalExpressAjax = new OrderReviewController($('order_review_form'), $('review_button'),
|
166 |
-
'shipping_method', null, 'details-reload'
|
167 |
-
);
|
168 |
-
PayPalExpressAjax.addPleaseWait($('review-please-wait'));
|
169 |
-
PayPalExpressAjax.setShippingAddressContainer($('shipping-address'));
|
170 |
-
PayPalExpressAjax.setShippingMethodContainer('shipping-method-container');
|
171 |
-
PayPalExpressAjax.shippingMethodsUpdateUrl = '<?php echo $this->escapeHtml($this->getUpdateShippingMethodsUrl());?>';//$this->escapeHtml($this->getUpdateShippingMethodsUrl()) $UpdateOrderSubmitUrl
|
172 |
-
PayPalExpressAjax.setUpdateButton($('update_order'),'<?php echo $this->escapeHtml($this->getUpdateOrderSubmitUrl());?>','details-reload');//$this->escapeHtml($this->getUpdateOrderSubmitUrl()) $shippingMethodsUpdateUrl
|
173 |
-
if ($('billing:as_shipping')) {
|
174 |
-
PayPalExpressAjax.setCopyElement($('billing:as_shipping'));
|
175 |
-
}
|
176 |
-
//]]>
|
177 |
-
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/frontend/base/default/template/laybuy/express/review/address.phtml
DELETED
@@ -1,146 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Magento
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
-
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/afl-3.0.php
|
11 |
-
* If you did not receive a copy of the license and are unable to
|
12 |
-
* obtain it through the world-wide-web, please send an email
|
13 |
-
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
-
*
|
15 |
-
* DISCLAIMER
|
16 |
-
*
|
17 |
-
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
-
* versions in the future. If you wish to customize Magento for your
|
19 |
-
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
-
*
|
21 |
-
* @category design
|
22 |
-
* @package base_default
|
23 |
-
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
-
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
-
*/
|
26 |
-
?>
|
27 |
-
<?php $prefix = $this->getFieldNamePrefix();?>
|
28 |
-
|
29 |
-
<fieldset>
|
30 |
-
<ul class="form-list form-list-narrow">
|
31 |
-
<li id="<?php echo $prefix ?>-address-form" class="address-form">
|
32 |
-
<fieldset>
|
33 |
-
<input type="hidden" name="<?php echo $prefix ?>[address_id]" value="<?php echo $this->getAddress()->getId() ?>" id="<?php echo $prefix ?>:address_id" />
|
34 |
-
<ul>
|
35 |
-
<li class="fields"><?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getAddress()->getFirstname() ? $this->getAddress() : $this->getQuote()->getCustomer())->setForceUseCustomerRequiredAttributes(!$this->isCustomerLoggedIn())->setFieldIdFormat($prefix . ':%s')->setFieldNameFormat($prefix . '[%s]')->toHtml() ?></li>
|
36 |
-
<li class="fields">
|
37 |
-
<div class="field">
|
38 |
-
<label for="<?php echo $prefix ?>:company"><?php echo $this->__('Company') ?></label>
|
39 |
-
<div class="input-box">
|
40 |
-
<input type="text" id="<?php echo $prefix ?>:company" name="<?php echo $prefix ?>[company]" value="<?php echo $this->escapeHtml($this->getAddress()->getCompany()) ?>" title="<?php echo $this->__('Company') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('company') ?>" />
|
41 |
-
</div>
|
42 |
-
</div>
|
43 |
-
<?php if(!$this->isCustomerLoggedIn() && !$this->getHideEmailAddress()): ?>
|
44 |
-
<div class="field">
|
45 |
-
<label for="<?php echo $prefix ?>:email" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
|
46 |
-
<div class="input-box">
|
47 |
-
<input type="text" name="<?php echo $prefix ?>[email]" id="<?php echo $prefix ?>:email" value="<?php echo $this->escapeHtml($this->getAddress()->getEmail()) ?>" title="<?php echo $this->__('Email Address') ?>" class="input-text validate-email required-entry" />
|
48 |
-
</div>
|
49 |
-
</div>
|
50 |
-
<?php endif; ?>
|
51 |
-
</li>
|
52 |
-
<?php $_streetValidationClass = $this->helper('customer/address')->getAttributeValidationClass('street'); ?>
|
53 |
-
<li class="wide">
|
54 |
-
<label for="<?php echo $prefix ?>:street1" class="required"><em>*</em><?php echo $this->__('Address') ?></label>
|
55 |
-
<div class="input-box">
|
56 |
-
<input type="text" title="<?php echo $this->__('Street Address') ?>" name="<?php echo $prefix ?>[street][]" id="<?php echo $prefix ?>:street1" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet(1)) ?>" class="input-text <?php echo $_streetValidationClass ?>" />
|
57 |
-
</div>
|
58 |
-
</li>
|
59 |
-
<?php $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); ?>
|
60 |
-
<?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
|
61 |
-
<li class="add-field">
|
62 |
-
<div class="input-box">
|
63 |
-
<input type="text" title="<?php echo $this->__('Street Address %s', $_i) ?>" name="<?php echo $prefix ?>[street][]" id="<?php echo $prefix ?>:street<?php echo $_i?>" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet($_i)) ?>" class="input-text <?php echo $_streetValidationClass ?>" />
|
64 |
-
</div>
|
65 |
-
</li>
|
66 |
-
<?php endfor; ?>
|
67 |
-
<?php if ($this->helper('customer/address')->isVatAttributeVisible()) : ?>
|
68 |
-
<li class="wide">
|
69 |
-
<label for="<?php echo $prefix ?>:vat_id"><?php echo $this->__('VAT Number') ?></label>
|
70 |
-
<div class="input-box">
|
71 |
-
<input type="text" id="<?php echo $prefix ?>:vat_id" name="<?php echo $prefix ?>[vat_id]" value="<?php echo $this->escapeHtml($this->getAddress()->getVatId()) ?>" title="<?php echo $this->__('VAT Number') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('vat_id') ?>" />
|
72 |
-
</div>
|
73 |
-
</li>
|
74 |
-
<?php endif; ?>
|
75 |
-
<li class="fields">
|
76 |
-
<div class="field">
|
77 |
-
<label for="<?php echo $prefix ?>:city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
|
78 |
-
<div class="input-box">
|
79 |
-
<input type="text" title="<?php echo $this->__('City') ?>" name="<?php echo $prefix ?>[city]" value="<?php echo $this->escapeHtml($this->getAddress()->getCity()) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('city') ?>" id="<?php echo $prefix ?>:city" />
|
80 |
-
</div>
|
81 |
-
</div>
|
82 |
-
<div class="field">
|
83 |
-
<label for="<?php echo $prefix ?>:region_id" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
|
84 |
-
<div class="input-box">
|
85 |
-
<select id="<?php echo $prefix ?>:region_id" name="<?php echo $prefix ?>[region_id]" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
|
86 |
-
<option value=""><?php echo $this->__('Please select region, state or province') ?></option>
|
87 |
-
</select>
|
88 |
-
<script type="text/javascript">
|
89 |
-
//<![CDATA[
|
90 |
-
$('<?php echo $prefix ?>:region_id').setAttribute('defaultValue', "<?php echo $this->getAddress()->getRegionId() ?>");
|
91 |
-
//]]>
|
92 |
-
</script>
|
93 |
-
<input type="text" id="<?php echo $prefix ?>:region" name="<?php echo $prefix ?>[region]" value="<?php echo $this->escapeHtml($this->getAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('region') ?>" style="display:none;" />
|
94 |
-
</div>
|
95 |
-
</div>
|
96 |
-
</li>
|
97 |
-
<li class="fields">
|
98 |
-
<div class="field">
|
99 |
-
<label for="<?php echo $prefix ?>:postcode" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
|
100 |
-
<div class="input-box">
|
101 |
-
<input type="text" title="<?php echo $this->__('Zip/Postal Code') ?>" name="<?php echo $prefix ?>[postcode]" id="<?php echo $prefix ?>:postcode" value="<?php echo $this->escapeHtml($this->getAddress()->getPostcode()) ?>" class="input-text validate-zip-international <?php echo $this->helper('customer/address')->getAttributeValidationClass('postcode') ?>" />
|
102 |
-
</div>
|
103 |
-
</div>
|
104 |
-
<div class="field">
|
105 |
-
<label for="<?php echo $prefix ?>:country_id" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
|
106 |
-
<div class="input-box">
|
107 |
-
<?php echo $this->getCountryHtmlSelect($prefix) ?>
|
108 |
-
</div>
|
109 |
-
</div>
|
110 |
-
</li>
|
111 |
-
<li class="fields">
|
112 |
-
<div class="field">
|
113 |
-
<label for="<?php echo $prefix ?>:telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
|
114 |
-
<div class="input-box">
|
115 |
-
<input type="text" name="<?php echo $prefix ?>[telephone]" value="<?php echo $this->escapeHtml($this->getAddress()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('telephone') ?>" id="<?php echo $prefix ?>:telephone" />
|
116 |
-
</div>
|
117 |
-
</div>
|
118 |
-
<div class="field">
|
119 |
-
<label for="<?php echo $prefix ?>:fax"><?php echo $this->__('Fax') ?></label>
|
120 |
-
<div class="input-box">
|
121 |
-
<input type="text" name="<?php echo $prefix ?>[fax]" value="<?php echo $this->escapeHtml($this->getAddress()->getFax()) ?>" title="<?php echo $this->__('Fax') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('fax') ?>" id="<?php echo $prefix ?>:fax" />
|
122 |
-
</div>
|
123 |
-
</div>
|
124 |
-
</li>
|
125 |
-
<?php echo $this->getChildHtml('form.additional.info'); ?>
|
126 |
-
<?php if ($this->getShowAsShippingCheckbox()): ?>
|
127 |
-
<li class="control">
|
128 |
-
<div class="field">
|
129 |
-
<div class="input-box">
|
130 |
-
<input type="checkbox" name="<?php echo $prefix ?>[as_shipping]" class="checkbox" value="1" title="<?php echo $this->__('Same as shipping') ?>" id="<?php echo $prefix ?>:as_shipping" <?php if ($this->getAddress()->getSameAsBilling()):?>checked="checked"<?php endif;?>/>
|
131 |
-
</div>
|
132 |
-
<label for="<?php echo $prefix ?>:as_shipping"><?php echo $this->__('Same as shipping') ?></label>
|
133 |
-
</div>
|
134 |
-
</li>
|
135 |
-
<?php endif; ?>
|
136 |
-
</ul>
|
137 |
-
</fieldset>
|
138 |
-
</li>
|
139 |
-
</ul>
|
140 |
-
</fieldset>
|
141 |
-
<script type="text/javascript">
|
142 |
-
//<![CDATA[
|
143 |
-
var <?php echo $prefix ?>RegionUpdater = new RegionUpdater('<?php echo $prefix ?>:country_id', '<?php echo $prefix ?>:region', '<?php echo $prefix ?>:region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, '<?php echo $prefix ?>:postcode');
|
144 |
-
<?php echo $prefix ?>RegionUpdater.update();
|
145 |
-
//]]>
|
146 |
-
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/frontend/base/default/template/laybuy/express/review/details.phtml
DELETED
@@ -1,65 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Magento
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
-
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/afl-3.0.php
|
11 |
-
* If you did not receive a copy of the license and are unable to
|
12 |
-
* obtain it through the world-wide-web, please send an email
|
13 |
-
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
-
*
|
15 |
-
* DISCLAIMER
|
16 |
-
*
|
17 |
-
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
-
* versions in the future. If you wish to customize Magento for your
|
19 |
-
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
-
*
|
21 |
-
* @category design
|
22 |
-
* @package base_default
|
23 |
-
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
-
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
-
*/
|
26 |
-
|
27 |
-
/**
|
28 |
-
* @see Mage_Paypal_Block_Express_Review_Details
|
29 |
-
*/
|
30 |
-
?>
|
31 |
-
<table id="details-table" class="data-table">
|
32 |
-
<?php if ($this->helper('tax')->displayCartBothPrices()): $colspan = $rowspan = 2; else: $colspan = $rowspan = 1; endif; ?>
|
33 |
-
<col />
|
34 |
-
<col width="1" />
|
35 |
-
<col width="1" />
|
36 |
-
<col width="1" />
|
37 |
-
<?php if ($this->helper('tax')->displayCartBothPrices()): ?>
|
38 |
-
<col width="1" />
|
39 |
-
<col width="1" />
|
40 |
-
<?php endif; ?>
|
41 |
-
<thead>
|
42 |
-
<tr>
|
43 |
-
<th rowspan="<?php echo $rowspan ?>"><?php echo $this->__('Product Name') ?></th>
|
44 |
-
<th colspan="<?php echo $colspan ?>" class="a-center"><?php echo $this->__('Price') ?></th>
|
45 |
-
<th rowspan="<?php echo $rowspan ?>" class="a-center"><?php echo $this->__('Qty') ?></th>
|
46 |
-
<th colspan="<?php echo $colspan ?>" class="a-center"><?php echo $this->__('Subtotal') ?></th>
|
47 |
-
</tr>
|
48 |
-
<?php if ($this->helper('tax')->displayCartBothPrices()): ?>
|
49 |
-
<tr>
|
50 |
-
<th class="a-right"><?php echo $this->helper('tax')->getIncExcTaxLabel(false) ?></th>
|
51 |
-
<th><?php echo $this->helper('tax')->getIncExcTaxLabel(true) ?></th>
|
52 |
-
<th class="a-right"><?php echo $this->helper('tax')->getIncExcTaxLabel(false) ?></th>
|
53 |
-
<th><?php echo $this->helper('tax')->getIncExcTaxLabel(true) ?></th>
|
54 |
-
</tr>
|
55 |
-
<?php endif; ?>
|
56 |
-
</thead>
|
57 |
-
<?php echo $this->getChildHtml('totals'); ?>
|
58 |
-
<tbody>
|
59 |
-
<?php foreach($this->getItems() as $_item): ?>
|
60 |
-
<?php echo $this->getItemHtml($_item) ?>
|
61 |
-
<?php endforeach ?>
|
62 |
-
</tbody>
|
63 |
-
</table>
|
64 |
-
<?php echo $this->getChildHtml('laybuy_button'); ?>
|
65 |
-
<script type="text/javascript">decorateTable('details-table');</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/frontend/base/default/template/laybuy/express/review/shipping/method.phtml
DELETED
@@ -1,53 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Magento
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
-
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/afl-3.0.php
|
11 |
-
* If you did not receive a copy of the license and are unable to
|
12 |
-
* obtain it through the world-wide-web, please send an email
|
13 |
-
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
-
*
|
15 |
-
* DISCLAIMER
|
16 |
-
*
|
17 |
-
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
-
* versions in the future. If you wish to customize Magento for your
|
19 |
-
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
-
*
|
21 |
-
* @category design
|
22 |
-
* @package base_default
|
23 |
-
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
|
24 |
-
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
-
*/
|
26 |
-
/** @var $this Mage_Paypal_Block_Express_Review */
|
27 |
-
?>
|
28 |
-
<fieldset id="shipping-method-container">
|
29 |
-
<?php if ($this->getCanEditShippingMethod() || !$this->getCurrentShippingRate()):?>
|
30 |
-
<?php if ($groups = $this->getShippingRateGroups()):?>
|
31 |
-
<?php $currentRate = $this->getCurrentShippingRate(); ?>
|
32 |
-
<select name="shipping_method" id="shipping_method" style="width:250px;" class="required-entry">
|
33 |
-
<?php if (!$currentRate):?>
|
34 |
-
<option value=""><?php echo $this->__('Please select a shipping method...') ?></option>
|
35 |
-
<?php endif;?>
|
36 |
-
<?php foreach ($groups as $code => $rates):?>
|
37 |
-
<optgroup label="<?php echo $this->escapeHtml($this->getCarrierName($code)) ?>" style="font-style:normal;">
|
38 |
-
<?php foreach ($rates as $rate):?>
|
39 |
-
<option value="<?php echo $this->renderShippingRateValue($rate)?>"<?php echo ($currentRate === $rate) ? ' selected="selected"' : '' ;?>>
|
40 |
-
<?php echo $this->renderShippingRateOption($rate)?>
|
41 |
-
</option>
|
42 |
-
<?php endforeach;?>
|
43 |
-
</optgroup>
|
44 |
-
<?php endforeach;?>
|
45 |
-
</select>
|
46 |
-
<?php else: ?>
|
47 |
-
<p><strong><?php echo $this->__('Sorry, no quotes are available for this order at this time.') ?></strong></p>
|
48 |
-
<?php endif;?>
|
49 |
-
<?php else: ?>
|
50 |
-
<p><strong><?php echo $this->renderShippingRateOption($this->getCurrentShippingRate())?></strong></p>
|
51 |
-
<?php endif; ?>
|
52 |
-
</fieldset>
|
53 |
-
<div style="display:none" id="shipping_method_update"><p><?php echo $this->__('Please update order data to get shipping methods and rates') ?></p></div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
js/laybuy/review.js
DELETED
@@ -1,454 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* Magento
|
3 |
-
*
|
4 |
-
* NOTICE OF LICENSE
|
5 |
-
*
|
6 |
-
* This source file is subject to the Academic Free License (AFL 3.0)
|
7 |
-
* that is bundled with this package in the file LICENSE_AFL.txt.
|
8 |
-
* It is also available through the world-wide-web at this URL:
|
9 |
-
* http://opensource.org/licenses/afl-3.0.php
|
10 |
-
* If you did not receive a copy of the license and are unable to
|
11 |
-
* obtain it through the world-wide-web, please send an email
|
12 |
-
* to license@magentocommerce.com so we can send you a copy immediately.
|
13 |
-
*
|
14 |
-
* DISCLAIMER
|
15 |
-
*
|
16 |
-
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
17 |
-
* versions in the future. If you wish to customize Magento for your
|
18 |
-
* needs please refer to http://www.magentocommerce.com for more information.
|
19 |
-
*
|
20 |
-
* @category design
|
21 |
-
* @package base_default
|
22 |
-
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
23 |
-
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
24 |
-
*/
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Controller of order review form that may select shipping method
|
28 |
-
*/
|
29 |
-
OrderReviewController = Class.create();
|
30 |
-
OrderReviewController.prototype = {
|
31 |
-
_canSubmitOrder : false,
|
32 |
-
_pleaseWait : false,
|
33 |
-
shippingSelect : false,
|
34 |
-
reloadByShippingSelect : false,
|
35 |
-
_copyElement : false,
|
36 |
-
onSubmitShippingSuccess : false,
|
37 |
-
shippingMethodsUpdateUrl : false,
|
38 |
-
_updateShippingMethods: false,
|
39 |
-
_ubpdateOrderButton : false,
|
40 |
-
shippingMethodsContainer: false,
|
41 |
-
_submitUpdateOrderUrl : false,
|
42 |
-
_itemsGrid : false,
|
43 |
-
|
44 |
-
/**
|
45 |
-
* Add listeners to provided objects, if any
|
46 |
-
* @param orderForm - form of the order submission
|
47 |
-
* @param orderFormSubmit - element for the order form submission (optional)
|
48 |
-
* @param shippingSelect - dropdown with available shipping methods (optional)
|
49 |
-
* @param shippingSubmitForm - form of shipping method submission (optional, requires shippingSelect)
|
50 |
-
* @param shippingResultId - element where to update results of shipping ajax submission (optional, requires shippingSubmitForm)
|
51 |
-
*/
|
52 |
-
initialize : function(orderForm, orderFormSubmit, shippingSelect, shippingSubmitForm, shippingResultId, shippingSubmit)
|
53 |
-
{
|
54 |
-
if (!orderForm) {
|
55 |
-
return;
|
56 |
-
}
|
57 |
-
this.form = orderForm;
|
58 |
-
if (orderFormSubmit) {
|
59 |
-
this.formSubmit = orderFormSubmit;
|
60 |
-
Event.observe(orderFormSubmit, 'click', this._submitOrder.bind(this));
|
61 |
-
}
|
62 |
-
|
63 |
-
if (shippingSubmitForm) {
|
64 |
-
this.reloadByShippingSelect = true;
|
65 |
-
if (shippingSubmitForm && shippingSelect) {
|
66 |
-
this.shippingSelect = shippingSelect;
|
67 |
-
Event.observe(
|
68 |
-
shippingSelect,
|
69 |
-
'change',
|
70 |
-
this._submitShipping.bindAsEventListener(this, shippingSubmitForm.action, shippingResultId)
|
71 |
-
);
|
72 |
-
this._updateOrderSubmit(false);
|
73 |
-
} else {
|
74 |
-
this._canSubmitOrder = true;
|
75 |
-
}
|
76 |
-
} else {
|
77 |
-
Form.getElements(this.form).each(this._bindElementChange, this);
|
78 |
-
|
79 |
-
if (shippingSelect && $(shippingSelect)) {
|
80 |
-
this.shippingSelect = $(shippingSelect).id;
|
81 |
-
this.shippingMethodsContainer = $(this.shippingSelect).up();
|
82 |
-
} else {
|
83 |
-
this.shippingSelect = shippingSelect;
|
84 |
-
}
|
85 |
-
this._updateOrderSubmit(false);
|
86 |
-
}
|
87 |
-
},
|
88 |
-
|
89 |
-
/**
|
90 |
-
* Register element that should show up when ajax request is in progress
|
91 |
-
* @param element
|
92 |
-
*/
|
93 |
-
addPleaseWait : function(element)
|
94 |
-
{
|
95 |
-
if (element) {
|
96 |
-
this._pleaseWait = element;
|
97 |
-
}
|
98 |
-
},
|
99 |
-
|
100 |
-
/**
|
101 |
-
* Dispatch an ajax request of shipping method submission
|
102 |
-
* @param event
|
103 |
-
* @param url - url where to submit shipping method
|
104 |
-
* @param resultId - id of element to be updated
|
105 |
-
*/
|
106 |
-
_submitShipping : function(event, url, resultId)
|
107 |
-
{
|
108 |
-
if (this.shippingSelect && url && resultId) {
|
109 |
-
this._updateOrderSubmit(true);
|
110 |
-
if (this._pleaseWait) {
|
111 |
-
this._pleaseWait.show();
|
112 |
-
}
|
113 |
-
if ('' != this.shippingSelect.value) {
|
114 |
-
new Ajax.Updater(resultId, url, {
|
115 |
-
parameters: {isAjax:true, shipping_method:this.shippingSelect.value},
|
116 |
-
onComplete: function() {
|
117 |
-
if (this._pleaseWait) {
|
118 |
-
this._pleaseWait.hide();
|
119 |
-
}
|
120 |
-
}.bind(this),
|
121 |
-
onSuccess: this._onSubmitShippingSuccess.bind(this),
|
122 |
-
evalScripts: true
|
123 |
-
});
|
124 |
-
}
|
125 |
-
}
|
126 |
-
},
|
127 |
-
|
128 |
-
/**
|
129 |
-
* Set event observer to Update Order button
|
130 |
-
* @param element
|
131 |
-
* @param url - url to submit on Update button
|
132 |
-
* @param resultId - id of element to be updated
|
133 |
-
*/
|
134 |
-
setUpdateButton : function(element, url, resultId)
|
135 |
-
{
|
136 |
-
if (element) {
|
137 |
-
this._ubpdateOrderButton = element;
|
138 |
-
this._submitUpdateOrderUrl = url;
|
139 |
-
this._itemsGrid = resultId;
|
140 |
-
Event.observe(element, 'click', this._submitUpdateOrder.bindAsEventListener(this, url, resultId));
|
141 |
-
if(this.shippingSelect) {
|
142 |
-
this._updateShipping();
|
143 |
-
}
|
144 |
-
this._updateOrderSubmit(!this._validateForm());
|
145 |
-
this.formValidator.reset();
|
146 |
-
this._clearValidation('');
|
147 |
-
}
|
148 |
-
},
|
149 |
-
|
150 |
-
/**
|
151 |
-
* Set event observer to copy data from shipping address to billing
|
152 |
-
* @param element
|
153 |
-
*/
|
154 |
-
setCopyElement : function(element)
|
155 |
-
{
|
156 |
-
if (element) {
|
157 |
-
this._copyElement = element;
|
158 |
-
Event.observe(element, 'click', this._copyShippingToBilling.bind(this));
|
159 |
-
this._copyShippingToBilling();
|
160 |
-
}
|
161 |
-
},
|
162 |
-
|
163 |
-
/**
|
164 |
-
* Set observers to Shipping Address elements
|
165 |
-
* @param element Container of Shipping Address elements
|
166 |
-
*/
|
167 |
-
setShippingAddressContainer: function(element)
|
168 |
-
{
|
169 |
-
if (element) {
|
170 |
-
Form.getElements(element).each(function(input) {
|
171 |
-
if (input.type.toLowerCase() == 'radio' || input.type.toLowerCase() == 'checkbox') {
|
172 |
-
Event.observe(input, 'click', this._onShippingChange.bindAsEventListener(this));
|
173 |
-
} else {
|
174 |
-
Event.observe(input, 'change', this._onShippingChange.bindAsEventListener(this));
|
175 |
-
}
|
176 |
-
}, this);
|
177 |
-
}
|
178 |
-
},
|
179 |
-
|
180 |
-
/**
|
181 |
-
* Sets Container element of Shipping Method
|
182 |
-
* @param element Container element of Shipping Method
|
183 |
-
*/
|
184 |
-
setShippingMethodContainer: function(element)
|
185 |
-
{
|
186 |
-
if (element) {
|
187 |
-
this.shippingMethodsContainer = element;
|
188 |
-
}
|
189 |
-
},
|
190 |
-
|
191 |
-
/**
|
192 |
-
* Copy element value from shipping to billing address
|
193 |
-
* @param el
|
194 |
-
*/
|
195 |
-
_copyElementValue: function(el)
|
196 |
-
{
|
197 |
-
var newId = el.id.replace('shipping:','billing:');
|
198 |
-
if (newId && $(newId) && $(newId).type != 'hidden') {
|
199 |
-
$(newId).value = el.value;
|
200 |
-
$(newId).setAttribute('readOnly', 'readonly');
|
201 |
-
$(newId).addClassName('local-validation');
|
202 |
-
$(newId).setStyle({opacity:.5});
|
203 |
-
$(newId).disable();
|
204 |
-
}
|
205 |
-
},
|
206 |
-
|
207 |
-
/**
|
208 |
-
* Copy data from shipping address to billing
|
209 |
-
*/
|
210 |
-
_copyShippingToBilling : function (event)
|
211 |
-
{
|
212 |
-
if (!this._copyElement) {
|
213 |
-
return;
|
214 |
-
}
|
215 |
-
if (this._copyElement.checked) {
|
216 |
-
this._copyElementValue($('shipping:country_id'));
|
217 |
-
billingRegionUpdater.update();
|
218 |
-
$$('[id^="shipping:"]').each(this._copyElementValue);
|
219 |
-
this._clearValidation('billing');
|
220 |
-
} else {
|
221 |
-
$$('[id^="billing:"]').invoke('enable');
|
222 |
-
$$('[id^="billing:"]').each(function(el){el.removeAttribute("readOnly");});
|
223 |
-
$$('[id^="billing:"]').invoke('removeClassName', 'local-validation');
|
224 |
-
$$('[id^="billing:"]').invoke('setStyle', {opacity:1});
|
225 |
-
}
|
226 |
-
if (event) {
|
227 |
-
this._updateOrderSubmit(true);
|
228 |
-
}
|
229 |
-
},
|
230 |
-
|
231 |
-
/**
|
232 |
-
* Dispatch an ajax request of Update Order submission
|
233 |
-
* @param url - url where to submit shipping method
|
234 |
-
* @param resultId - id of element to be updated
|
235 |
-
*/
|
236 |
-
_submitUpdateOrder : function(event, url, resultId)
|
237 |
-
{
|
238 |
-
this._copyShippingToBilling();
|
239 |
-
if (url && resultId && this._validateForm()) {
|
240 |
-
if (this._copyElement && this._copyElement.checked) {
|
241 |
-
this._clearValidation('billing');
|
242 |
-
}
|
243 |
-
this._updateOrderSubmit(true);
|
244 |
-
if (this._pleaseWait) {
|
245 |
-
this._pleaseWait.show();
|
246 |
-
}
|
247 |
-
this._toggleButton(this._ubpdateOrderButton, true);
|
248 |
-
|
249 |
-
arr = $$('[id^="billing:"]').invoke('enable');
|
250 |
-
var formData = this.form.serialize(true);
|
251 |
-
if (this._copyElement.checked) {
|
252 |
-
$$('[id^="billing:"]').invoke('disable');
|
253 |
-
this._copyElement.enable();
|
254 |
-
}
|
255 |
-
formData.isAjax = true;
|
256 |
-
new Ajax.Updater(resultId, url, {
|
257 |
-
parameters: formData,
|
258 |
-
onComplete: function() {
|
259 |
-
if (this._pleaseWait && !this._updateShippingMethods) {
|
260 |
-
this._pleaseWait.hide();
|
261 |
-
}
|
262 |
-
this._toggleButton(this._ubpdateOrderButton, false);
|
263 |
-
}.bind(this),
|
264 |
-
onSuccess: this._updateShippingMethodsElement.bind(this),
|
265 |
-
evalScripts: true
|
266 |
-
});
|
267 |
-
} else {
|
268 |
-
if (this._copyElement && this._copyElement.checked) {
|
269 |
-
this._clearValidation('billing');
|
270 |
-
}
|
271 |
-
}
|
272 |
-
},
|
273 |
-
|
274 |
-
/**
|
275 |
-
* Update Shipping Methods Element from server
|
276 |
-
*/
|
277 |
-
_updateShippingMethodsElement : function (){
|
278 |
-
if (this._updateShippingMethods ) {
|
279 |
-
new Ajax.Updater($(this.shippingMethodsContainer).up(), this.shippingMethodsUpdateUrl, {
|
280 |
-
onComplete: this._updateShipping.bind(this),
|
281 |
-
onSuccess: this._onSubmitShippingSuccess.bind(this),
|
282 |
-
evalScripts: false
|
283 |
-
});
|
284 |
-
} else {
|
285 |
-
this._onSubmitShippingSuccess();
|
286 |
-
}
|
287 |
-
},
|
288 |
-
|
289 |
-
/**
|
290 |
-
* Update Shipping Method select element and bind events
|
291 |
-
*/
|
292 |
-
_updateShipping : function () {
|
293 |
-
if ($(this.shippingSelect)) {
|
294 |
-
$(this.shippingSelect).enable();
|
295 |
-
Event.stopObserving($(this.shippingSelect), 'change');
|
296 |
-
|
297 |
-
this._bindElementChange($(this.shippingSelect));
|
298 |
-
Event.observe(
|
299 |
-
$(this.shippingSelect),
|
300 |
-
'change',
|
301 |
-
this._submitUpdateOrder.bindAsEventListener(this, this._submitUpdateOrderUrl, this._itemsGrid)
|
302 |
-
);
|
303 |
-
|
304 |
-
$(this.shippingSelect + '_update').hide();
|
305 |
-
$(this.shippingSelect).show();
|
306 |
-
}
|
307 |
-
this._updateShippingMethods = false;
|
308 |
-
if (this._pleaseWait) {
|
309 |
-
this._pleaseWait.hide();
|
310 |
-
}
|
311 |
-
},
|
312 |
-
|
313 |
-
/**
|
314 |
-
* Validate Order form
|
315 |
-
*/
|
316 |
-
_validateForm : function()
|
317 |
-
{
|
318 |
-
if (!this.form) {
|
319 |
-
return false;
|
320 |
-
}
|
321 |
-
if (!this.formValidator) {
|
322 |
-
this.formValidator = new Validation(this.form);
|
323 |
-
}
|
324 |
-
|
325 |
-
return this.formValidator.validate();
|
326 |
-
},
|
327 |
-
|
328 |
-
/**
|
329 |
-
* Actions on change Shipping Address data
|
330 |
-
* @param event
|
331 |
-
*/
|
332 |
-
_onShippingChange : function(event){
|
333 |
-
var element = Event.element(event);
|
334 |
-
if (element != $(this.shippingSelect) && !($(this.shippingSelect) && $(this.shippingSelect).disabled)) {
|
335 |
-
if ($(this.shippingSelect)) {
|
336 |
-
$(this.shippingSelect).disable();
|
337 |
-
$(this.shippingSelect).hide();
|
338 |
-
if ($('advice-required-entry-' + this.shippingSelect)) {
|
339 |
-
$('advice-required-entry-' + this.shippingSelect).hide();
|
340 |
-
}
|
341 |
-
}
|
342 |
-
if (this.shippingMethodsContainer && $(this.shippingMethodsContainer)) {
|
343 |
-
$(this.shippingMethodsContainer).hide();
|
344 |
-
}
|
345 |
-
|
346 |
-
if (this.shippingSelect && $(this.shippingSelect + '_update')) {
|
347 |
-
$(this.shippingSelect + '_update').show();
|
348 |
-
}
|
349 |
-
this._updateShippingMethods = true;
|
350 |
-
}
|
351 |
-
},
|
352 |
-
|
353 |
-
/**
|
354 |
-
* Bind onChange event listener to elements for update Submit Order button state
|
355 |
-
* @param input
|
356 |
-
*/
|
357 |
-
_bindElementChange : function(input){
|
358 |
-
Event.observe(input, 'change', this._onElementChange.bindAsEventListener(this))
|
359 |
-
},
|
360 |
-
|
361 |
-
/**
|
362 |
-
* Disable Submit Order button
|
363 |
-
*/
|
364 |
-
_onElementChange : function(){
|
365 |
-
this._updateOrderSubmit(true);
|
366 |
-
},
|
367 |
-
|
368 |
-
/**
|
369 |
-
* Clear validation result for all form elements or for elements with id prefix
|
370 |
-
* @param idprefix
|
371 |
-
*/
|
372 |
-
_clearValidation : function(idprefix)
|
373 |
-
{
|
374 |
-
var prefix = '';
|
375 |
-
if (idprefix) {
|
376 |
-
prefix = '[id*="' + idprefix + ':"]';
|
377 |
-
$$(prefix).each(function(el){
|
378 |
-
el.up().removeClassName('validation-failed')
|
379 |
-
.removeClassName('validation-passed')
|
380 |
-
.removeClassName('validation-error');
|
381 |
-
});
|
382 |
-
} else {
|
383 |
-
this.formValidator.reset();
|
384 |
-
}
|
385 |
-
$$('.validation-advice' + prefix).invoke('remove');
|
386 |
-
$$('.validation-failed' + prefix).invoke('removeClassName', 'validation-failed');
|
387 |
-
$$('.validation-passed' + prefix).invoke('removeClassName', 'validation-passed');
|
388 |
-
$$('.validation-error' + prefix).invoke('removeClassName', 'validation-error');
|
389 |
-
},
|
390 |
-
|
391 |
-
/**
|
392 |
-
* Attempt to submit order
|
393 |
-
*/
|
394 |
-
_submitOrder : function()
|
395 |
-
{
|
396 |
-
if (this._canSubmitOrder && (this.reloadByShippingSelect || this._validateForm())) {
|
397 |
-
this.form.submit();
|
398 |
-
this._updateOrderSubmit(true);
|
399 |
-
if (this._ubpdateOrderButton) {
|
400 |
-
this._ubpdateOrderButton.addClassName('no-checkout');
|
401 |
-
this._ubpdateOrderButton.setStyle({opacity:.5});
|
402 |
-
}
|
403 |
-
if (this._pleaseWait) {
|
404 |
-
this._pleaseWait.show();
|
405 |
-
}
|
406 |
-
return;
|
407 |
-
}
|
408 |
-
this._updateOrderSubmit(true);
|
409 |
-
},
|
410 |
-
|
411 |
-
/**
|
412 |
-
* Explicitly enable order submission
|
413 |
-
*/
|
414 |
-
_onSubmitShippingSuccess : function()
|
415 |
-
{
|
416 |
-
this._updateOrderSubmit(false);
|
417 |
-
if (this.onSubmitShippingSuccess) {
|
418 |
-
this.onSubmitShippingSuccess();
|
419 |
-
}
|
420 |
-
},
|
421 |
-
|
422 |
-
/**
|
423 |
-
* Check/Set whether order can be submitted
|
424 |
-
* Also disables form submission element, if any
|
425 |
-
* @param shouldDisable - whether should prevent order submission explicitly
|
426 |
-
*/
|
427 |
-
_updateOrderSubmit : function(shouldDisable)
|
428 |
-
{
|
429 |
-
var isDisabled = shouldDisable || (
|
430 |
-
this.reloadByShippingSelect && (!this.shippingSelect || '' == this.shippingSelect.value)
|
431 |
-
);
|
432 |
-
this._canSubmitOrder = !isDisabled;
|
433 |
-
if (this.formSubmit) {
|
434 |
-
this._toggleButton(this.formSubmit, isDisabled);
|
435 |
-
}
|
436 |
-
},
|
437 |
-
|
438 |
-
/**
|
439 |
-
* Enable/Disable button
|
440 |
-
*
|
441 |
-
* @param button
|
442 |
-
* @param disable
|
443 |
-
*/
|
444 |
-
_toggleButton : function(button, disable)
|
445 |
-
{
|
446 |
-
button.disabled = disable;
|
447 |
-
button.removeClassName('no-checkout');
|
448 |
-
button.setStyle({opacity:1});
|
449 |
-
if (disable) {
|
450 |
-
button.addClassName('no-checkout');
|
451 |
-
button.setStyle({opacity:.5});
|
452 |
-
}
|
453 |
-
}
|
454 |
-
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
package.xml
CHANGED
@@ -1,28 +1,28 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Ced_LayBuy</name>
|
4 |
-
<version>2.1.9.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Magento LayBuy Payment Gateway Module Developed By Lay-Buy Financial Solutions Pty Ltd (warrin@lay-buys.com)</summary>
|
10 |
-
<description>Welcome to Lay-Buys, the leading provider of deferred payment plan solutions for online PayPal merchants globally
|
11 |

|
12 |
-
We integrate affordable, flexible, secure, and scalable deferred payment plan solutions into your website shopping cart check-out zone
|
13 |

|
14 |
-
Our sophisticated flagship SDK is PUT IT ON LAY-BUY and is powered by PayPal
|
15 |

|
16 |
-
PUT IT ON LAY-BUY enables online shoppers to pay-off a product or service via a down payment and up to 3 monthly instalment payments
|
17 |

|
18 |
-
Merchants however only deliver the product or service after receipt of the final instalment payment
|
19 |

|
20 |
-
This effectively increases sales and radically improves cash flow where all the customer monies are paid directly into your PayPal account
|
21 |
-
<notes>1.New secure communication protocal.</notes>
|
22 |
-
<authors><author><name>Warrin</name><user>
|
23 |
-
<date>2015-
|
24 |
-
<time>
|
25 |
-
<contents><target name="magelocal"><dir name="Ced"><dir name="LayBuy"><dir><dir name="Block"><dir name="Adminhtml"><file name="Docalc.php" hash="c12af05bee0d480ac49835b46ca8011e"/><dir name="Orders"><file name="Grid.php" hash="54a924cd69f95cf9496f91702a4edeec"/><file name="Grid.php.bkp" hash="b37908e3e7f57787c4b3d441be869ba9"/></dir><file name="Orders.php" hash="aa89abe43868eedab8cb195b5dcbe77f"/><dir name="Report"><dir name="Details"><file name="Form.php" hash="e0ce57d85efc14656d4294021e5f5257"/></dir><file name="Details.php" hash="16317e0652d7e33e1207d0a1b29ed185"/><dir name="Edit"><file name="Form.php" hash="ca0b74b0301d0051930478f87aec2080"/></dir><file name="Edit.php" hash="5dc6f961714c5d38a228f6b943c3127d"/><file name="Grid.php" hash="a94a86483b880c9908572e3fc8f5d30d"/><dir name="Renderer"><file name="Email.php" hash="8e6c0938d80f629cd285303018945ea1"/><file name="Order.php" hash="51a2ba685b652f69df633ccfa4b5900a"/><file name="Record.php" hash="95eb9f836a50f3f80d254a7cdd8e1d6e"/></dir></dir><file name="Report.php" hash="ff77fef080779db3a699cdb8a4703c49"/></dir><dir name="Customer"><dir name="Account"><file name="Details.php" hash="5bb9caf5b0a6e9584046f6af9ee4ae5f"/><file name="Grid.php" hash="3b170ed3f70422b3a64263535d3543e3"/></dir></dir><dir name="
|
26 |
<compatible/>
|
27 |
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
28 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Ced_LayBuy</name>
|
4 |
+
<version>2.1.9.1</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Magento LayBuy Payment Gateway Module Developed By Lay-Buy Financial Solutions Pty Ltd (warrin@lay-buys.com)</summary>
|
10 |
+
<description>Welcome to Lay-Buys, the leading provider of deferred payment plan solutions for online PayPal merchants globally.
|
11 |

|
12 |
+
We integrate affordable, flexible, secure, and scalable deferred payment plan solutions into your website shopping cart check-out zone.
|
13 |

|
14 |
+
Our sophisticated flagship SDK is PUT IT ON LAY-BUY and is powered by PayPal.
|
15 |

|
16 |
+
PUT IT ON LAY-BUY enables online shoppers to pay-off a product or service via a down payment and up to 3 monthly instalment payments.
|
17 |

|
18 |
+
Merchants however only deliver the product or service after receipt of the final instalment payment.
|
19 |

|
20 |
+
This effectively increases sales and radically improves cash flow where all the customer monies are paid directly into your PayPal account.</description>
|
21 |
+
<notes>1. New secure communication protocal.</notes>
|
22 |
+
<authors><author><name>Warrin</name><user>warrin</user><email>warrin@lay-buys.com</email></author><author><name>Asheesh Singh</name><user>asheeshsingh</user><email>asheeshsingh@cedcoss.com</email></author></authors>
|
23 |
+
<date>2015-08-24</date>
|
24 |
+
<time>09:37:50</time>
|
25 |
+
<contents><target name="magelocal"><dir name="Ced"><dir name="LayBuy"><dir><dir name="Block"><dir name="Adminhtml"><file name="Docalc.php" hash="c12af05bee0d480ac49835b46ca8011e"/><dir name="Orders"><file name="Grid.php" hash="54a924cd69f95cf9496f91702a4edeec"/><file name="Grid.php.bkp" hash="b37908e3e7f57787c4b3d441be869ba9"/></dir><file name="Orders.php" hash="aa89abe43868eedab8cb195b5dcbe77f"/><dir name="Report"><dir name="Details"><file name="Form.php" hash="e0ce57d85efc14656d4294021e5f5257"/></dir><file name="Details.php" hash="16317e0652d7e33e1207d0a1b29ed185"/><dir name="Edit"><file name="Form.php" hash="ca0b74b0301d0051930478f87aec2080"/></dir><file name="Edit.php" hash="5dc6f961714c5d38a228f6b943c3127d"/><file name="Grid.php" hash="a94a86483b880c9908572e3fc8f5d30d"/><dir name="Renderer"><file name="Email.php" hash="8e6c0938d80f629cd285303018945ea1"/><file name="Order.php" hash="51a2ba685b652f69df633ccfa4b5900a"/><file name="Record.php" hash="95eb9f836a50f3f80d254a7cdd8e1d6e"/></dir></dir><file name="Report.php" hash="ff77fef080779db3a699cdb8a4703c49"/></dir><dir name="Customer"><dir name="Account"><file name="Details.php" hash="5bb9caf5b0a6e9584046f6af9ee4ae5f"/><file name="Grid.php" hash="3b170ed3f70422b3a64263535d3543e3"/></dir></dir><dir name="Form"><file name="Laybuy.php" hash="cbf8b96d0fa26d4b772bafd021e3fc83"/></dir><dir name="Info"><file name="Laybuy.php" hash="bced26100dc8bbadc334b54349734637"/></dir><dir name="Revise"><file name="Redirect.php" hash="6f63613d0fe5540a296804c14263a614"/></dir><dir name="Standard"><file name="Docalc.php" hash="42b2b63a23577c888cccc5f6c20b8867"/><file name="Redirect.php" hash="bdf403ef8c7c290ce0af83cdd172dcb7"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="OrdersController.php" hash="b439600c08514fb9ada1ae0e75272e21"/><file name="ReportController.php" hash="b22ab26daaeca1c067427288230d1656"/></dir><file name="ReportController.php" hash="e2c5e9ce734b2c3320eb503e05baecae"/><file name="ReviseController.php" hash="39cf4f4031522b1cf0f623f51c186715"/><file name="StandardController.php" hash="0c4233798441091d6749766c0a894789"/></dir><dir name="etc"><file name="adminhtml.xml" hash="6bc550c65f0f65b11d6dbb38aafcb63d"/><file name="config.xml" hash="b4989e2e7bc0e017b0202523cdc13097"/><file name="system.xml" hash="de7ca437cd91076c098ec22b3cf10fb8"/></dir><dir name="Helper"><file name="Config.php" hash="360b6125612be9de5cd0e3b69f4422c2"/><file name="Data.php" hash="7e5ba01ef723858f4752d03cf2242103"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Report"><file name="Collection.php" hash="a3e133f1128200662330a5e21a94c809"/></dir><file name="Report.php" hash="25568238c401ab5e5768596fb76f7ef8"/><dir name="Revise"><file name="Collection.php" hash="2a502f75e4634e4f231f93226ef49b8a"/></dir><file name="Revise.php" hash="cd1a424882417e0ec94561a8cca378e8"/><file name="Setup.php" hash="261838defadf805c7ee29768f6ea8cec"/></dir><file name="Observer.php" hash="e085e396516583f6685648f75d967a66"/><file name="Report.php" hash="ffb651448186ad401e238b2060074317"/><file name="Revise.php" hash="b9bbea4b6760b464ec8ff66c872def7a"/><file name="Standard.php" hash="b991b733940156d1b24b6a0c813d68e0"/><dir name="System"><dir name="Config"><dir name="Backend"><file name="Cron.php" hash="955ae77c29ecbc063d8f779898d08472"/><file name="Cron.php.bkp" hash="24c8fcf93531c9877d03f2eebde2e2dd"/></dir><dir name="Source"><file name="Allowspecificcategory.php" hash="0463f2be60a2695e4f76411c979b6bc8"/><file name="Allowspecificgroup.php" hash="a27c9bf1231a59a8f38668b525c420ba"/><file name="Categories.php" hash="92c61dba3c23e7838cddbaaee8f21d05"/><file name="FetchingSchedule.php" hash="7ad862c46ec8f54299cc92ae87b61322"/><file name="FetchingSchedule.php.bkp" hash="4f3e5aec5a17991d1625d6f17c0f7d32"/><file name="Groups.php" hash="87a205676d93d59a26d1d7bb69266991"/></dir></dir></dir></dir><dir name="sql"><dir name="laybuy_setup"><file name="mysql4-install-0.1.0.php" hash="68e359cd24b6051d0c2a91daad899d71"/><file name="mysql4-upgrade-0.1.0-0.2.0.php" hash="bec5e37090cb5a6da6c8ba3652a8bd32"/><file name="mysql4-upgrade-0.2.0-0.3.0.php" hash="97aa7a2a8c91e46c896a6d04d9554aeb"/><file name="mysql4-upgrade-0.3.0-0.4.0.php" hash="9b147158166b94d52e0cfff369ce965c"/><file name="mysql4-upgrade-0.4.0-0.5.0.php" hash="7626925b0cac03d0918eb6b1d51e6d19"/><file name="mysql4-upgrade-0.5.0-0.6.0.php" hash="bc96daed76ca1f04b1eb422508bc3a4b"/><file name="mysql4-upgrade-0.6.0-0.7.0.php" hash="6aa013f47e3b78e4d78e2cba9b471cd4"/><file name="mysql4-upgrade-0.7.0-0.8.0.php" hash="c2ea0f16c8f1e0dc7412a6a0fda1c622"/><file name="mysql4-upgrade-0.8.0-0.9.0.php" hash="d98ba6bef5f4f46ca741d5db014686f1"/><file name="mysql4-upgrade-0.9.0-1.0.0.php" hash="a20364c9f3a1b2a6a7e33a2e2f03bd60"/></dir></dir></dir><file name="README.txt" hash="7930d4ac1e8f9957bb2052983eab4340"/></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="laybuy.xml" hash="963cc90317ac79c032f2530eca1813ba"/></dir><dir name="template"><dir name="laybuy"><dir><dir name="checkout"><dir name="onepage"><dir name="review"><file name="button.phtml" hash="a1e678a76d674b223e944bdd4de0625a"/></dir></dir></dir><dir name="customer"><dir name="account"><file name="details.phtml" hash="965a58454b4b3cdcc115d78e595f7c33"/><file name="grid.phtml" hash="2dc802991a69b459f263f4e78c657549"/></dir></dir><dir name="form"><file name="extra.phtml" hash="535609083ce3e06706ec30766b354d8a"/><file name="extra.phtml.bkp" hash="e089ba0a3bd4ff1c0bc631c88ba32dd2"/><file name="laybuy.phtml" hash="5169cbb58cb7fec4312eb70325829e70"/><file name="laybuy.phtml.bkp" hash="a1c8dc8ff7ebd565d0100785ad089f64"/></dir><dir name="info"><file name="default.phtml" hash="b0bdfa731e4410c99a79c3b5b0a86cff"/></dir></dir></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="laybuy.xml" hash="b60d76e466dac9154654041350d5e829"/></dir><dir name="template"><dir name="laybuy"><dir><dir name="info"><file name="default.phtml" hash="a9dfb322a83df7bc53bb2a64c6f192e3"/><dir name="pdf"><file name="laybuy.phtml" hash="e96cab97e4bd4ca32a022e90d5449eae"/></dir></dir></dir><file name="notification.phtml" hash="efb99f36ea192d6bc8c60d53dec8a6e1"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Ced_LayBuy.xml" hash="394d4e115e1955ba12681f6a81cb118d"/></dir></target><target name="magelocale"><dir name="en_US"><file name="Ced_LayBuy.csv" hash="f79a1a6ca61c5e7a7463c380eb00896d"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="laybuy"><file name="tooltip.css" hash="ece078bf3d8bb27db4a616fdad505671"/></dir></dir><dir name="images"><dir name="laybuy"><file name="closeBtn.png" hash="b0be9d9ef1053c79b0ebdcef83b53f44"/></dir></dir></dir></dir></dir></target><target name="mage"><dir name="js"><dir name="laybuy"><file name="jquery.atooltip.js" hash="5ad78b7e8ac539053ff56a2ea25e4d4c"/><file name="jquery.min.js" hash="41ab3fafa358a66f764b91d072f16615"/></dir></dir></target></contents>
|
26 |
<compatible/>
|
27 |
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
28 |
</package>
|