Merge pull request #881 from shreesh-webkul/gli-1078

Improvement: Address is not required in booking/order flow
This commit is contained in:
Rohit Jain
2024-03-17 14:37:16 +05:30
committed by GitHub
20 changed files with 114 additions and 213 deletions

View File

@@ -181,9 +181,6 @@ abstract class PaymentModuleCore extends Module
ShopUrl::resetMainDomainCache();
$id_currency = $currency_special ? (int)$currency_special : (int)$this->context->cart->id_currency;
$this->context->currency = new Currency((int)$id_currency, null, (int)$this->context->shop->id);
if (Configuration::get('PS_TAX_ADDRESS_TYPE') == 'id_address_delivery') {
$context_country = $this->context->country;
}
$order_status = new OrderState((int)$id_order_state, (int)$this->context->language->id);
if (!Validate::isLoadedObject($order_status)) {
@@ -274,14 +271,6 @@ abstract class PaymentModuleCore extends Module
$order = new Order();
$order->product_list = $package['product_list'];
if (Configuration::get('PS_TAX_ADDRESS_TYPE') == 'id_address_delivery') {
$address = new Address((int)$id_address);
$this->context->country = new Country((int)$address->id_country, (int)$this->context->cart->id_lang);
if (!$this->context->country->active && $this->name != 'wsorder') {
throw new PrestaShopException('The delivery address country is not active.');
}
}
$carrier = null;
if (!$this->context->cart->isVirtualCart() && isset($package['id_carrier'])) {
$carrier = new Carrier((int)$package['id_carrier'], (int)$this->context->cart->id_lang);
@@ -463,15 +452,6 @@ abstract class PaymentModuleCore extends Module
}
}
// The country can only change if the address used for the calculation is the delivery address, and if multi-shipping is activated
if (Configuration::get('PS_TAX_ADDRESS_TYPE') == 'id_address_delivery') {
$this->context->country = $context_country;
}
if (!$this->context->country->active && $this->name != 'wsorder') {
PrestaShopLogger::addLog('PaymentModule::validateOrder - Country is not active', 3, null, 'Cart', (int)$id_cart, true);
throw new PrestaShopException('The order address country is not active.');
}
if (self::DEBUG_MODE) {
PrestaShopLogger::addLog('PaymentModule::validateOrder - Payment is about to be added', 1, null, 'Cart', (int)$id_cart, true);