Documentation

webhook.php

\file talerbarr/webhook/webhook.php \ingroup talerbarr \brief Lightweight webhook listener for the Taler synchronisation.

Table of Contents

Constants

NOCSRFCHECK  = 1
NOLOGIN  = 1
\file talerbarr/webhook/webhook.php \ingroup talerbarr \brief Lightweight webhook listener for the Taler synchronisation.
NOREQUIREAJAX  = 1
NOREQUIREHTML  = 1
NOREQUIREMENU  = 1
NOSCANGETFORINJECTION  = 1
NOSCANPOSTFORINJECTION  = 1
NOSESSION  = 1

Functions

talerbarrWebhookRespond()  : void
Emit a JSON error/success response and exit.
talerbarrEscapeNestedJsonStrings()  : string
Escape unescaped quotes inside stringified JSON blobs embedded in a JSON payload.
talerbarrDecodeWebhookJson()  : array<string|int, mixed>|null
Decode a JSON payload with a couple of sanitation fallbacks.
talerbarrPersistInvalidJsonPayload()  : void
Persist the raw body of a JSON payload that could not be decoded for debugging.

Constants

NOCSRFCHECK

public mixed NOCSRFCHECK = 1

NOLOGIN

\file talerbarr/webhook/webhook.php \ingroup talerbarr \brief Lightweight webhook listener for the Taler synchronisation.

public mixed NOLOGIN = 1

NOREQUIREAJAX

public mixed NOREQUIREAJAX = 1

NOREQUIREHTML

public mixed NOREQUIREHTML = 1

NOREQUIREMENU

public mixed NOREQUIREMENU = 1

NOSCANGETFORINJECTION

public mixed NOSCANGETFORINJECTION = 1

NOSCANPOSTFORINJECTION

public mixed NOSCANPOSTFORINJECTION = 1

NOSESSION

public mixed NOSESSION = 1

Functions

talerbarrWebhookRespond()

Emit a JSON error/success response and exit.

talerbarrWebhookRespond(int $status, string $message[, array<string|int, mixed> $extra = [] ]) : void
Parameters
$status : int

HTTP status code

$message : string

Human readable message

$extra : array<string|int, mixed> = []

Optional extra payload

talerbarrEscapeNestedJsonStrings()

Escape unescaped quotes inside stringified JSON blobs embedded in a JSON payload.

talerbarrEscapeNestedJsonStrings(string $raw) : string

This is a defensive fix for Taler payloads that wrap arrays/objects in strings without escaping inner quotes (e.g., "taxes":"[{"tax":"..."}]").

Parameters
$raw : string

Raw body

Return values
string

Sanitised body

talerbarrDecodeWebhookJson()

Decode a JSON payload with a couple of sanitation fallbacks.

talerbarrDecodeWebhookJson(string $raw[, string|null &$error = null ][, string|null &$lastAttempt = null ]) : array<string|int, mixed>|null
Parameters
$raw : string

Raw HTTP body.

$error : string|null = null

Receives the last json_last_error_msg() if decoding fails.

$lastAttempt : string|null = null

Receives the sanitised payload used for the final attempt.

Return values
array<string|int, mixed>|null

Decoded associative array on success, null on failure.

talerbarrPersistInvalidJsonPayload()

Persist the raw body of a JSON payload that could not be decoded for debugging.

talerbarrPersistInvalidJsonPayload(string $raw, string $error) : void
Parameters
$raw : string

Raw body string.

$error : string

Last json_last_error_msg().


        
On this page

Search results