public function RecurringOrderRenew::process in Commerce Recurring Framework 8
Processes the given job.
Parameters
\Drupal\advancedqueue\Job $job: The job.
Return value
\Drupal\advancedqueue\JobResult The job result.
Overrides JobTypeInterface::process
File
- src/
Plugin/ AdvancedQueue/ JobType/ RecurringOrderRenew.php, line 21
Class
- RecurringOrderRenew
- Provides the job type for renewing recurring orders.
Namespace
Drupal\commerce_recurring\Plugin\AdvancedQueue\JobTypeCode
public function process(Job $job) {
$order_id = $job
->getPayload()['order_id'];
$order_storage = $this->entityTypeManager
->getStorage('commerce_order');
/** @var \Drupal\commerce_order\Entity\OrderInterface $order */
$order = $order_storage
->load($order_id);
if (!$order) {
return JobResult::failure('Order not found.');
}
$this->recurringOrderManager
->renewOrder($order);
return JobResult::success();
}