feat(cronjob): implement CronJobProcessor and CronJobRepository for job scheduling and processing
- Added CronJobProcessor class to handle job creation and queue processing. - Implemented CronJobRepository for database interactions related to cron jobs. - Introduced CronJobType class to define job types, priorities, and statuses. - Created ApiloLogger for logging actions related to job processing. - Initialized apilo-sync-queue.json for job queue management.
This commit is contained in:
@@ -323,7 +323,9 @@ class TransportRepository
|
||||
$transports[] = $tr;
|
||||
}
|
||||
|
||||
if ( \Shared\Helpers\Helpers::normalize_decimal( \Domain\Basket\BasketCalculator::summaryPrice( $basket, $coupon ) ) >= \Shared\Helpers\Helpers::normalize_decimal( $settings['free_delivery'] ) )
|
||||
$products_summary = (float)\Domain\Basket\BasketCalculator::summaryPrice( $basket, $coupon );
|
||||
|
||||
if ( \Shared\Helpers\Helpers::normalize_decimal( $products_summary ) >= \Shared\Helpers\Helpers::normalize_decimal( $settings['free_delivery'] ) )
|
||||
{
|
||||
for ( $i = 0; $i < count( $transports ); $i++ ) {
|
||||
if ( $transports[$i]['delivery_free'] == 1 ) {
|
||||
@@ -332,7 +334,39 @@ class TransportRepository
|
||||
}
|
||||
}
|
||||
|
||||
return $transports;
|
||||
// Ukryj transporty, dla których nie ma żadnej dostępnej formy płatności
|
||||
$paymentMethodRepo = new \Domain\PaymentMethod\PaymentMethodRepository( $this->db );
|
||||
$filtered = [];
|
||||
|
||||
foreach ( $transports as $tr )
|
||||
{
|
||||
$paymentMethods = $paymentMethodRepo->paymentMethodsByTransport( $tr['id'] );
|
||||
$order_total = $products_summary + (float)$tr['cost'];
|
||||
$has_available_pm = false;
|
||||
|
||||
foreach ( $paymentMethods as $pm )
|
||||
{
|
||||
$min = isset( $pm['min_order_amount'] ) ? (float)$pm['min_order_amount'] : null;
|
||||
$max = isset( $pm['max_order_amount'] ) ? (float)$pm['max_order_amount'] : null;
|
||||
$available = true;
|
||||
|
||||
if ( $min !== null && $min > 0 && $order_total < $min ) $available = false;
|
||||
if ( $max !== null && $max > 0 && $order_total > $max ) $available = false;
|
||||
|
||||
if ( $available )
|
||||
{
|
||||
$has_available_pm = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( $has_available_pm )
|
||||
{
|
||||
$filtered[] = $tr;
|
||||
}
|
||||
}
|
||||
|
||||
return $filtered;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user