use DreamTechnologies\TelebirrLaravelPlus\Events\TelebirrNotificationReceived;
use Illuminate\Support\Facades\Event;
Event::listen(TelebirrNotificationReceived::class, function ($event) {
$notification = $event->notification;
if (!$notification?->accepted || !$notification->isCompleted()) {
return;
}
$order = YourOrder::where('merchant_order_id', $notification->merchantOrderId)
->firstOrFail();
if (!$notification->matches($order->merchant_order_id, $order->amount, $order->currency)) {
return;
}
// Query Telebirr, verify the returned status and amount, then update your
// order once inside a database transaction with duplicate protection.
});