correctifs webhoook
This commit is contained in:
parent
67d6f66f59
commit
aff562f664
@ -205,16 +205,18 @@ class PEPPOL_Webhook_controller {
|
|||||||
* @param array $payload Données complètes du webhook.
|
* @param array $payload Données complètes du webhook.
|
||||||
* @return bool|WP_Error
|
* @return bool|WP_Error
|
||||||
*/
|
*/
|
||||||
private static function process_webhook_event(string $event, string $document_id, array $payload): bool|WP_Error {
|
private static function process_webhook_event(string $event, string $document_id, array $payload) {
|
||||||
$document_data = $payload['document'] ?? [];
|
$document_data = $payload['document'] ?? [];
|
||||||
|
|
||||||
// Déterminer le nouveau statut selon l'événement
|
// Déterminer le nouveau statut selon l'événement
|
||||||
$new_status = match ($event) {
|
$new_status = null;
|
||||||
'document.sent' => 'sent',
|
if ($event === 'document.sent') {
|
||||||
'document.error' => 'error',
|
$new_status = 'sent';
|
||||||
'document.completed' => 'completed',
|
} elseif ($event === 'document.error') {
|
||||||
default => null,
|
$new_status = 'error';
|
||||||
};
|
} elseif ($event === 'document.completed') {
|
||||||
|
$new_status = 'completed';
|
||||||
|
}
|
||||||
|
|
||||||
if ($new_status === null) {
|
if ($new_status === null) {
|
||||||
return new WP_Error(
|
return new WP_Error(
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user