HEX
Server: Apache/2.4.58 (Ubuntu)
System: Linux Bradford-Sitios 6.14.0-1017-azure #17~24.04.1-Ubuntu SMP Mon Dec 1 20:10:50 UTC 2025 x86_64
User: www-data (33)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/matriculas_api_dev/app/Services/OdooPlaceholderService.php
<?php

namespace App\Services;

use App\Models\SyncLog;
use Illuminate\Support\Facades\Log;

/**
 * Implementación placeholder de Odoo
 * Registra en sync_logs lo que se enviaría a Odoo
 * Se reemplazará cuando Opens entregue documentación de su API
 */
class OdooPlaceholderService implements OdooServiceInterface
{
    public function sendDebts(int $contractId, array $debts): array
    {
        $payload = [
            'contract_id' => $contractId,
            'debts' => $debts,
        ];

        Log::info('[Odoo Placeholder] sendDebts', $payload);

        SyncLog::create([
            'sync_type'        => 'odoo_debts',
            'direction'        => 'outbound',
            'entity_type'      => 'contract',
            'entity_id'        => $contractId,
            'status'           => 'success',
            'request_payload'  => $payload,
            'response_payload' => ['placeholder' => true, 'message' => 'Odoo integration pending - logged for future sync'],
        ]);

        return ['success' => true, 'placeholder' => true];
    }

    public function sendPayment(int $contractId, array $paymentData): array
    {
        $payload = [
            'contract_id' => $contractId,
            'payment' => $paymentData,
        ];

        Log::info('[Odoo Placeholder] sendPayment', $payload);

        SyncLog::create([
            'sync_type'        => 'odoo_payment',
            'direction'        => 'outbound',
            'entity_type'      => 'contract',
            'entity_id'        => $contractId,
            'status'           => 'success',
            'request_payload'  => $payload,
            'response_payload' => ['placeholder' => true, 'message' => 'Odoo integration pending - logged for future sync'],
        ]);

        return ['success' => true, 'placeholder' => true];
    }

    public function sendContract(int $contractId): array
    {
        $payload = [
            'contract_id' => $contractId,
        ];

        Log::info('[Odoo Placeholder] sendContract', $payload);

        SyncLog::create([
            'sync_type'        => 'odoo_contract',
            'direction'        => 'outbound',
            'entity_type'      => 'contract',
            'entity_id'        => $contractId,
            'status'           => 'success',
            'request_payload'  => $payload,
            'response_payload' => ['placeholder' => true, 'message' => 'Odoo integration pending - logged for future sync'],
        ]);

        return ['success' => true, 'placeholder' => true];
    }

    public function checkDebtExists(string $externalRef): bool
    {
        Log::info("[Odoo Placeholder] checkDebtExists: {$externalRef}");
        return false;
    }
}