add debug to try/catch block Controller

This commit is contained in:
Cyprian Beauvois 2019-07-16 17:08:03 +02:00
parent 8445ce1e34
commit 5453a69312
1 changed files with 10 additions and 9 deletions

View File

@ -30,6 +30,15 @@ class BillingController extends AbstractController
try { try {
$event = \Stripe\Webhook::constructEvent($payload, $sig_header, $endpoint_secret); $event = \Stripe\Webhook::constructEvent($payload, $sig_header, $endpoint_secret);
if ($event->type == 'checkout.session.completed') {
$session = $event->data->object;
// Fulfill the purchase...
if (file_put_contents("/tmp/return_stripe_session", json_encode($session)) !== false)
return $this->json("OK", 200);
return $this->json("KO", 500);
}
} catch(\UnexpectedValueException $e) { } catch(\UnexpectedValueException $e) {
$this->logger->error($e->getMessage()); $this->logger->error($e->getMessage());
exit(); exit();
@ -38,14 +47,6 @@ class BillingController extends AbstractController
exit(); exit();
} }
if ($event->type == 'checkout.session.completed') { return $this->json("KO", 500);
$session = $event->data->object;
// Fulfill the purchase...
file_put_contents("/tmp/return_stripe_session", json_encode($session));
//handle_checkout_session($session);
}
return $this->json("OK", 200);
} }
} }