Trigger payment events

This commit is contained in:
Deon George 2023-05-13 23:46:04 +10:00
parent dd82509008
commit 600dfec536

View File

@ -2,6 +2,7 @@
namespace Intuit\Controllers; namespace Intuit\Controllers;
use App\Events\ProviderPaymentCreated;
use Illuminate\Foundation\Bus\DispatchesJobs; use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Routing\Controller as BaseController; use Illuminate\Routing\Controller as BaseController;
@ -47,6 +48,11 @@ class Webhook extends BaseController
case 'entities': case 'entities':
foreach ($data as $eventData) { foreach ($data as $eventData) {
switch ($x=$eventData['name']) { switch ($x=$eventData['name']) {
case 'Payment':
Log::alert(sprintf('We got a payment event [%s:%s]',$object,$x),['data'=>$eventData]);
event(new ProviderPaymentCreated('intuit',$eventData));
break;
default: default:
Log::alert(sprintf('We dont know how to handle [%s:%s] yet',$object,$x),['data'=>$eventData]); Log::alert(sprintf('We dont know how to handle [%s:%s] yet',$object,$x),['data'=>$eventData]);
} }