| 1 |
<?php |
| 2 |
/** |
| 3 |
* Async Process Controller |
| 4 |
* |
| 5 |
* @package SeQura/WC |
| 6 |
* @subpackage SeQura/WC/Controllers |
| 7 |
*/ |
| 8 |
|
| 9 |
namespace SeQura\WC\Controllers\Hooks\Process; |
| 10 |
|
| 11 |
use SeQura\WC\Controllers\Controller; |
| 12 |
use SeQura\WC\Services\Log\Interface_Logger_Service; |
| 13 |
use SeQura\WC\Services\Report\Interface_Report_Service; |
| 14 |
|
| 15 |
/** |
| 16 |
* Async Process Controller implementation |
| 17 |
*/ |
| 18 |
class Async_Process_Controller extends Controller implements Interface_Async_Process_Controller { |
| 19 |
|
| 20 |
/** |
| 21 |
* Report service. |
| 22 |
* |
| 23 |
* @var Interface_Report_Service |
| 24 |
*/ |
| 25 |
private $report_service; |
| 26 |
|
| 27 |
/** |
| 28 |
* Constructor. |
| 29 |
*/ |
| 30 |
public function __construct( |
| 31 |
Interface_Logger_Service $logger, |
| 32 |
string $templates_path, |
| 33 |
Interface_Report_Service $report_service |
| 34 |
) { |
| 35 |
$this->logger = $logger; |
| 36 |
$this->templates_path = $templates_path; |
| 37 |
$this->report_service = $report_service; |
| 38 |
} |
| 39 |
|
| 40 |
/** |
| 41 |
* Send the delivery report |
| 42 |
* |
| 43 |
* @return void |
| 44 |
*/ |
| 45 |
public function send_delivery_report() { |
| 46 |
$this->logger->log_debug( 'Hook executed', __FUNCTION__, __CLASS__ ); |
| 47 |
try { |
| 48 |
$this->report_service->send_delivery_report_for_current_store(); |
| 49 |
} catch ( \Throwable $e ) { |
| 50 |
$this->logger->log_throwable( $e, __FUNCTION__, __CLASS__ ); |
| 51 |
} |
| 52 |
} |
| 53 |
} |
| 54 |
|