addition of delivery address checking
This commit is contained in:
parent
5c755acd4b
commit
e9ea05d32b
@ -108,7 +108,7 @@ class PayPal extends PaymentModule
|
||||
|
||||
if (self::isInstalled($this->name))
|
||||
{
|
||||
$this->loadDefaults();
|
||||
$this->loadDefaults();
|
||||
if ($mobile_enabled && $this->active)
|
||||
$this->checkMobileCredentials();
|
||||
elseif ($mobile_enabled && !$this->active)
|
||||
@ -542,8 +542,13 @@ class PayPal extends PaymentModule
|
||||
elseif ($method == WPS || $method == ECS)
|
||||
{
|
||||
$cart = $this->context->cart;
|
||||
|
||||
$this->context->smarty->assign('accounts', $this->getBillingAgreement($cart->id_customer));
|
||||
$orders_with_delivery_address = Db::getInstance()->getValue('
|
||||
SELECT COUNT(`id_order`)
|
||||
FROM `'._DB_PREFIX_.'orders
|
||||
WHERE `id_address_delivery` = '.(int)$cart->id_address_delivery.'
|
||||
AND `id_customer` = '.(int)$cart->id_customer.'
|
||||
');
|
||||
$this->context->smarty->assign('accounts', (($orders_with_delivery_address==0)?array():$this->getBillingAgreement($cart->id_customer)));
|
||||
$this->getTranslations();
|
||||
$this->context->smarty->assign(array(
|
||||
'custom' => Tools::jsonEncode(array('id_cart' => $cart->id, 'hash' => sha1(serialize($cart->nbProducts())))),
|
||||
@ -632,13 +637,13 @@ class PayPal extends PaymentModule
|
||||
if ($this->_canRefund((int)$params['id_order']))
|
||||
$admin_templates[] = 'refund';
|
||||
}
|
||||
|
||||
|
||||
if (count($admin_templates) > 0)
|
||||
{
|
||||
$sql = "SELECT `id_transaction`FROM `"._DB_PREFIX_."paypal_order` WHERE id_order = " .$params['id_order'];
|
||||
$id_transaction = Db::getInstance()->getValue($sql);
|
||||
if(empty($id_transaction)){
|
||||
$id_transaction = "";
|
||||
$id_transaction = "";
|
||||
}
|
||||
|
||||
$order = new Order((int)$params['id_order']);
|
||||
@ -675,7 +680,7 @@ class PayPal extends PaymentModule
|
||||
{
|
||||
// if (Tools::isSubmit('generateDiscount') || !$this->isPayPalAPIAvailable())
|
||||
// return false;
|
||||
// // delete test sur la génération d'avoir
|
||||
// // delete test sur la génération d'avoir
|
||||
if (!$this->isPayPalAPIAvailable())
|
||||
return false;
|
||||
elseif ($params['order']->module != $this->name || !($order = $params['order']) || !Validate::isLoadedObject($order))
|
||||
@ -1359,8 +1364,8 @@ class PayPal extends PaymentModule
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function getBillingAgreement($id_customer)
|
||||
|
||||
public function getBillingAgreement($id_customer)
|
||||
{
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT `id_paypal_agreement`, `email`, `name`, `city`, `address`
|
||||
@ -1390,7 +1395,7 @@ class PayPal extends PaymentModule
|
||||
if (isset($this->pcc))
|
||||
$this->pcc->transaction_id = (isset($transaction['transaction_id']) ? $transaction['transaction_id'] : '');
|
||||
|
||||
if (version_compare(_PS_VERSION_, '1.5', '<'))
|
||||
if (version_compare(_PS_VERSION_, '1.5', '<'))
|
||||
parent::validateOrder((int)$id_cart, (int)$id_order_state, (float)$amount_paid, $payment_method, $message, $transaction, $currency_special, $dont_touch_amount, $secure_key);
|
||||
else
|
||||
parent::validateOrder((int)$id_cart, (int)$id_order_state, (float)$amount_paid, $payment_method, $message, $transaction, $currency_special, $dont_touch_amount, $secure_key, $shop);
|
||||
|
Loading…
Reference in New Issue
Block a user