feat: Version 3.6.2 - Correctifs tâches #17-20
- #17: Amélioration gestion des secteurs et statistiques - #18: Optimisation services API et logs - #19: Corrections Flutter widgets et repositories - #20: Fix création passage - détection automatique ope_users.id vs users.id Suppression dossier web/ (migration vers app Flutter) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -305,6 +305,141 @@ class EventLogService
|
||||
]);
|
||||
}
|
||||
|
||||
// ==================== MÉTHODES STRIPE ====================
|
||||
|
||||
/**
|
||||
* Log la création d'un PaymentIntent
|
||||
*
|
||||
* @param string $paymentIntentId ID Stripe du PaymentIntent
|
||||
* @param int $passageId ID du passage
|
||||
* @param int $amount Montant en centimes
|
||||
* @param string $method Méthode (tap_to_pay, qr_code, web)
|
||||
*/
|
||||
public static function logStripePaymentCreated(
|
||||
string $paymentIntentId,
|
||||
int $passageId,
|
||||
int $amount,
|
||||
string $method
|
||||
): void {
|
||||
$entityId = Session::getEntityId();
|
||||
self::writeEvent('stripe_payment_created', [
|
||||
'payment_intent_id' => $paymentIntentId,
|
||||
'passage_id' => $passageId,
|
||||
'entity_id' => $entityId,
|
||||
'amount' => $amount,
|
||||
'method' => $method
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Log un paiement Stripe réussi
|
||||
*
|
||||
* @param string $paymentIntentId ID Stripe du PaymentIntent
|
||||
* @param int $passageId ID du passage
|
||||
* @param int $amount Montant en centimes
|
||||
* @param string $method Méthode (tap_to_pay, qr_code, web)
|
||||
*/
|
||||
public static function logStripePaymentSuccess(
|
||||
string $paymentIntentId,
|
||||
int $passageId,
|
||||
int $amount,
|
||||
string $method
|
||||
): void {
|
||||
$entityId = Session::getEntityId();
|
||||
self::writeEvent('stripe_payment_success', [
|
||||
'payment_intent_id' => $paymentIntentId,
|
||||
'passage_id' => $passageId,
|
||||
'entity_id' => $entityId,
|
||||
'amount' => $amount,
|
||||
'method' => $method
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Log un paiement Stripe échoué
|
||||
*
|
||||
* @param string|null $paymentIntentId ID Stripe (peut être null si création échouée)
|
||||
* @param int|null $passageId ID du passage (peut être null)
|
||||
* @param int|null $amount Montant en centimes (peut être null)
|
||||
* @param string $method Méthode tentée
|
||||
* @param string $errorCode Code d'erreur
|
||||
* @param string $errorMessage Message d'erreur
|
||||
*/
|
||||
public static function logStripePaymentFailed(
|
||||
?string $paymentIntentId,
|
||||
?int $passageId,
|
||||
?int $amount,
|
||||
string $method,
|
||||
string $errorCode,
|
||||
string $errorMessage
|
||||
): void {
|
||||
$entityId = Session::getEntityId();
|
||||
$data = [
|
||||
'entity_id' => $entityId,
|
||||
'method' => $method,
|
||||
'error_code' => $errorCode,
|
||||
'error_message' => $errorMessage
|
||||
];
|
||||
|
||||
if ($paymentIntentId !== null) {
|
||||
$data['payment_intent_id'] = $paymentIntentId;
|
||||
}
|
||||
if ($passageId !== null) {
|
||||
$data['passage_id'] = $passageId;
|
||||
}
|
||||
if ($amount !== null) {
|
||||
$data['amount'] = $amount;
|
||||
}
|
||||
|
||||
self::writeEvent('stripe_payment_failed', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Log l'annulation d'un paiement Stripe
|
||||
*
|
||||
* @param string $paymentIntentId ID Stripe du PaymentIntent
|
||||
* @param int|null $passageId ID du passage (peut être null)
|
||||
* @param string $reason Raison (user_cancelled, timeout, error, etc.)
|
||||
*/
|
||||
public static function logStripePaymentCancelled(
|
||||
string $paymentIntentId,
|
||||
?int $passageId,
|
||||
string $reason
|
||||
): void {
|
||||
$entityId = Session::getEntityId();
|
||||
$data = [
|
||||
'payment_intent_id' => $paymentIntentId,
|
||||
'entity_id' => $entityId,
|
||||
'reason' => $reason
|
||||
];
|
||||
|
||||
if ($passageId !== null) {
|
||||
$data['passage_id'] = $passageId;
|
||||
}
|
||||
|
||||
self::writeEvent('stripe_payment_cancelled', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Log une erreur du Terminal Tap to Pay
|
||||
*
|
||||
* @param string $errorCode Code d'erreur (cardReadTimedOut, device_not_compatible, etc.)
|
||||
* @param string $errorMessage Message d'erreur
|
||||
* @param array $metadata Métadonnées supplémentaires (device_model, is_simulated, etc.)
|
||||
*/
|
||||
public static function logStripeTerminalError(
|
||||
string $errorCode,
|
||||
string $errorMessage,
|
||||
array $metadata = []
|
||||
): void {
|
||||
$entityId = Session::getEntityId();
|
||||
self::writeEvent('stripe_terminal_error', array_merge([
|
||||
'entity_id' => $entityId,
|
||||
'error_code' => $errorCode,
|
||||
'error_message' => $errorMessage
|
||||
], $metadata));
|
||||
}
|
||||
|
||||
// ==================== MÉTHODES OPÉRATIONS ====================
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user