|
|
@@ -9,9 +9,11 @@ use Longyi\RewardPoints\Services\GrowthValueService;
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
use Illuminate\Support\Facades\Log;
|
|
|
use Webkul\Sales\Models\Order;
|
|
|
+use Longyi\RewardPoints\Services\LevelCalculationTrait;
|
|
|
|
|
|
class OrderEvents
|
|
|
{
|
|
|
+ use LevelCalculationTrait;
|
|
|
protected RewardPointRepository $rewardPointRepository;
|
|
|
protected GrowthValueService $growthValueService;
|
|
|
|
|
|
@@ -25,6 +27,7 @@ class OrderEvents
|
|
|
|
|
|
public function handleOrderPlacement(Order $order): void
|
|
|
{
|
|
|
+ $startTime = microtime(true);
|
|
|
if (!$order->customer_id) {
|
|
|
return;
|
|
|
}
|
|
|
@@ -67,12 +70,14 @@ class OrderEvents
|
|
|
|
|
|
Log::info('Order points added as PENDING', [
|
|
|
'order_id' => $order->id,
|
|
|
+ 'customer_id' => $order->customer_id,
|
|
|
'points' => $points,
|
|
|
- 'rate' => $pointsPerCurrency
|
|
|
+ 'rate' => $pointsPerCurrency,
|
|
|
+ 'order_amount' => $order->base_grand_total,
|
|
|
+ 'execution_time' => $this->getExecutionTime($startTime)
|
|
|
]);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
public function handleOrderCancellation(Order $order): void
|
|
|
{
|
|
|
if (!$order->customer_id) {
|