Compare commits

...

2 Commits

Author SHA1 Message Date
Mihael
5227a50e01 add hookActionEmailSendBefore to set bankwire details for mail template 2025-07-31 16:46:11 +02:00
Mihael
7458f80c53 validation change order statuses 2025-07-31 16:23:49 +02:00
2 changed files with 16 additions and 4 deletions

View File

@@ -44,8 +44,9 @@ class B2BPayments extends PaymentModule implements PrestaShop\PrestaShop\Core\Mo
{ {
if ( if (
!parent::install() || !parent::install() ||
!$this->registerHook('paymentOptions') !$this->registerHook('paymentOptions') ||
|| !$this->registerHook('DisplayOrderConfirmation') !$this->registerHook('DisplayOrderConfirmation') ||
!$this->registerHook('actionEmailSendBefore')
) { ) {
return false; return false;
} }
@@ -411,4 +412,13 @@ class B2BPayments extends PaymentModule implements PrestaShop\PrestaShop\Core\Mo
Context::getContext()->customer = $originalCustomer; Context::getContext()->customer = $originalCustomer;
return $regularPrice; return $regularPrice;
} }
public function hookActionEmailSendBefore($params)
{
if ($params['template'] == 'bankwire_postpaid') {
$params['templateVars']['{bankwire_owner}'] = Configuration::get('BANK_WIRE_OWNER');
$params['templateVars']['{bankwire_details}'] = nl2br(Configuration::get('BANK_WIRE_DETAILS'));
}
}
} }

View File

@@ -36,9 +36,11 @@ class B2BPaymentsValidationModuleFrontController extends ModuleFrontController
$this->context->customer->id; $this->context->customer->id;
$b2b_postpaid_group_id = (int)Configuration::get('B2BPAYMENTS_POSTPAID_GROUP'); $b2b_postpaid_group_id = (int)Configuration::get('B2BPAYMENTS_POSTPAID_GROUP');
$b2b_prepaid_group_id = (int)Configuration::get('B2BPAYMENTS_PREPAID_GROUP'); $b2b_prepaid_group_id = (int)Configuration::get('B2BPAYMENTS_PREPAID_GROUP');
$payment_status = Configuration::get('PS_OS_PAYMENT'); // Default: Payment accepted //$payment_status = Configuration::get('PS_OS_PAYMENT'); // Default: Payment accepted
$payment_status = Configuration::get('PS_OS_BANKWIRE'); // Default for Prepaid: Awaiting payment via IBAN
if ($this->module->isDefaultCustomerGroup($this->context->customer->id, $b2b_postpaid_group_id) && $this->module->isCustomerInGroup($this->context->customer->id, $b2b_postpaid_group_id)) { if ($this->module->isDefaultCustomerGroup($this->context->customer->id, $b2b_postpaid_group_id) && $this->module->isCustomerInGroup($this->context->customer->id, $b2b_postpaid_group_id)) {
$payment_status = Configuration::get('PS_OS_PREPARATION'); // Order processing in progress. Adjust as needed. //$payment_status = Configuration::get('PS_OS_PREPARATION'); // Order processing in progress. Adjust as needed.
$payment_status = 15; // Fod Postpaid: Awaiting to process order (custom status ID: 15)
$payment_method = $this->module->b2b_postpaid_payment_name; $payment_method = $this->module->b2b_postpaid_payment_name;
} else if ($this->module->isDefaultCustomerGroup($this->context->customer->id, $b2b_prepaid_group_id) && $this->module->isCustomerInGroup($this->context->customer->id, $b2b_prepaid_group_id)) { } else if ($this->module->isDefaultCustomerGroup($this->context->customer->id, $b2b_prepaid_group_id) && $this->module->isCustomerInGroup($this->context->customer->id, $b2b_prepaid_group_id)) {
//Payment Status Already fine. //Payment Status Already fine.