Add log for IPN file
This commit is contained in:
parent
792ff708ff
commit
7de2219e07
@ -100,9 +100,17 @@ if (!empty($conf->global->STRIPE_USER_ACCOUNT_FOR_ACTIONS)) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$payload = @file_get_contents("php://input");
|
$payload = @file_get_contents("php://input");
|
||||||
$sig_header = $_SERVER["HTTP_STRIPE_SIGNATURE"];
|
$sig_header = empty($_SERVER["HTTP_STRIPE_SIGNATURE"]) ? $_SERVER["HTTP_STRIPE_SIGNATURE"] : '';
|
||||||
$event = null;
|
$event = null;
|
||||||
|
|
||||||
|
$fh = fopen(DOL_DATA_ROOT.'/dolibarr_stripe.log', 'w+');
|
||||||
|
if ($fh) {
|
||||||
|
fwrite($fh, 'HTTP_STRIPE_SIGNATURE='.$sig_header."\n");
|
||||||
|
fwrite($fh, $payload);
|
||||||
|
fclose($fh);
|
||||||
|
dolChmod(DOL_DATA_ROOT.'/dolibarr_stripe.log');
|
||||||
|
}
|
||||||
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -112,6 +120,8 @@ try {
|
|||||||
httponly_accessforbidden('Invalid payload', 400);
|
httponly_accessforbidden('Invalid payload', 400);
|
||||||
} catch (\Stripe\Error\SignatureVerification $e) {
|
} catch (\Stripe\Error\SignatureVerification $e) {
|
||||||
httponly_accessforbidden('Invalid signature', 400);
|
httponly_accessforbidden('Invalid signature', 400);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
httponly_accessforbidden('Error '.$e->getMessage(), 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do something with $event
|
// Do something with $event
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user