610 lines
46 KiB
PHP
610 lines
46 KiB
PHP
<?php
|
|
|
|
use App\Enums\PurchasingRole;
|
|
use App\Http\Controllers\AuditMetadataController;
|
|
use App\Http\Controllers\ConflictDeclarationController;
|
|
use App\Models\ConflictDeclaration;
|
|
use App\Models\CostCenter;
|
|
use App\Models\User;
|
|
use App\Services\CommonBudget;
|
|
use App\Services\ComparisonPolicy;
|
|
use App\Services\ConflictGuard;
|
|
use App\Services\ConflictReleases;
|
|
use App\Services\ImportBankSupport;
|
|
use App\Services\ImportLegalReferenceDrafts;
|
|
use App\Services\ImportLegalRules;
|
|
use App\Services\OperationalOrders;
|
|
use App\Services\OrderCancellationPolicyWorkflow;
|
|
use App\Services\OrderCancellationWorkflow;
|
|
use App\Services\PrivateAuditAccess;
|
|
use App\Services\ProposalComparison;
|
|
use App\Services\PurchaseControlPolicyWorkflow;
|
|
use App\Services\QuotationParticipation;
|
|
use App\Services\RequisitionAccountAssignments;
|
|
use App\Services\RequisitionCatalogue;
|
|
use App\Services\RequisitionExpiry;
|
|
use App\Services\RequisitionWorkflow;
|
|
use App\Services\SupplierEvaluationWorkflow;
|
|
use App\Services\SupplierImprovementWorkflow;
|
|
use App\Services\SupplierResponseWorkflow;
|
|
use App\Services\SupplyPlanning;
|
|
use App\Services\UrgentRequisitionReviews;
|
|
use App\Services\WarehouseFulfilment;
|
|
use App\Services\WarehouseRequests;
|
|
use Brick\Math\BigDecimal;
|
|
use Carbon\CarbonImmutable;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\UploadedFile;
|
|
use Illuminate\Support\Carbon;
|
|
use Illuminate\Support\Facades\DB;
|
|
use Illuminate\Support\Str;
|
|
use Tempo\Finance\GeneralLedger\LedgerSchema;
|
|
|
|
/** Strictly guarded native synthetic composition; no real identities, source data or grants. */
|
|
function requisitionAccountsNativeReviewFixture(bool $integrated = false, bool $officeJourney = false, bool $legalReference = false, bool $printPagination = false): array
|
|
{
|
|
LedgerSchema::install(DB::connection());
|
|
$composition = null;
|
|
if ($integrated) {
|
|
require_once __DIR__.'/IntegratedPurchasingQaSchema.php';
|
|
$composition = integratedPurchasingQaSchema();
|
|
} else {
|
|
(require __DIR__.'/../../database/qa-migrations/2026_11_27_000001_add_requisition_cycles.php')->up();
|
|
}
|
|
$f = receiptFixture(categories: $printPagination
|
|
? array_map(fn (int $line) => 'Categoria sintética de paginação '.str_pad((string) $line, 2, '0', STR_PAD_LEFT), range(1, 50))
|
|
: ['Material']);
|
|
$f['tenant']->update(['name' => 'QA isolada de Compras — contas e urgências']);
|
|
config(['requisition-expiry.qa_enabled' => true, 'urgent-reviews.qa_enabled' => true, 'requisition-accounts.qa_enabled' => true,
|
|
'agreement_order_limits.qa_enabled' => true, 'procurement_search.supply_metadata_enabled' => true,
|
|
'procurement_search.warehouse_requests_metadata_enabled' => true]);
|
|
$people = [];
|
|
$profiles = [];
|
|
$functions = ['reviewer' => ['admin', 'procurement', 'requester', 'supply_prepare', 'warehouse_request_prepare', 'audit_metadata_read'], 'requester' => ['requester'],
|
|
'head' => ['department_head', 'supply_review', 'warehouse_request_review'], 'finance' => ['finance'], 'auditor' => ['audit_metadata_read']];
|
|
$functions['private_auditor'] = array_column(PrivateAuditAccess::FAMILIES, 'permission');
|
|
if (getenv('RQ01_QA_ORDER_CANCELLATION') === '1') {
|
|
$functions['cancellation_admin_a'] = ['admin'];
|
|
$functions['cancellation_admin_b'] = ['admin'];
|
|
}
|
|
if (getenv('RQ01_QA_URGENT_STOCK') === '1') {
|
|
$functions['stock_cataloguer'] = ['warehouse'];
|
|
}
|
|
if (getenv('RQ01_QA_CONFLICT_RELEASE') === '1') {
|
|
config(['conflict-releases.qa_enabled' => true]);
|
|
$functions['direction'] = ['conflict_release_authorise'];
|
|
}
|
|
if ($legalReference) {
|
|
$functions['reviewer'][] = 'import_customs';
|
|
}
|
|
if (getenv('RQ01_QA_IMPORT_DOCUMENTARY') === '1') {
|
|
$functions['reviewer'][] = 'import_prepare';
|
|
}
|
|
if ($officeJourney) {
|
|
$functions += ['office_requester' => ['requester'], 'office_finance_reviewer' => ['finance'], 'office_warehouse' => ['warehouse'],
|
|
'office_procurement_reviewer' => ['procurement']];
|
|
}
|
|
foreach ($functions as $key => $permissions) {
|
|
$people[$key] = User::factory()->create(['tenant_id' => $f['tenant']->id, 'department_id' => $f['department']->id,
|
|
'purchasing_role' => PurchasingRole::Configured, 'name' => 'QA '.$key, 'email' => 'qa-'.$key.'@example.invalid']);
|
|
$profiles[$key] = DB::table('organization_profiles')->insertGetId(['tenant_id' => $f['tenant']->id, 'name' => 'QA '.$key,
|
|
'permissions' => json_encode($permissions), 'work_contexts' => json_encode(['procurement.internal']), 'version' => 1]);
|
|
DB::table('organization_memberships')->insert(['tenant_id' => $f['tenant']->id, 'user_id' => $people[$key]->id,
|
|
'profile_id' => $profiles[$key], 'maintenance' => false]);
|
|
}
|
|
DB::table('organization_access')->insert(['tenant_id' => $f['tenant']->id, 'active' => true, 'version' => 1]);
|
|
foreach (['QA-100' => 'Materiais de ensaio', 'QA-200' => 'Outras necessidades de ensaio'] as $code => $label) {
|
|
DB::table('gl_accounts')->insert(['tenant_id' => $f['tenant']->id, 'company_id' => 0, 'unit_id' => 0,
|
|
'code' => $code, 'label' => $label, 'currency' => 'MZN', 'is_movement' => true]);
|
|
}
|
|
auth()->guard()->setUser($people['finance']);
|
|
$budget = app(CommonBudget::class)->for($people['finance'])->create(['cost_center_id' => $f['r']->cost_center_id, 'year' => (int) now()->year,
|
|
'kind' => 'operating', 'includes_tax' => true, 'amount_minor' => 100000, 'reason' => 'Dotação inteiramente fictícia da revisão nativa isolada']);
|
|
auth()->guard()->setUser($people['reviewer']);
|
|
app(CommonBudget::class)->for($people['reviewer'])->approve($budget);
|
|
app(PurchaseControlPolicyWorkflow::class)->propose($people['reviewer'], ['previous_id' => 0, 'mode' => 'unissued_award',
|
|
'enabled' => false, 'valid_from' => today()->toDateString(), 'valid_until' => today()->addMonth()->toDateString(),
|
|
'reason' => 'Proposta exclusivamente sintética e desactivada para conferir o isolamento de consulta; sem aprovação ou publicação']);
|
|
app(RequisitionExpiry::class)->savePolicy($people['reviewer'], ['operation_key' => (string) Str::uuid(), 'version' => 0, 'enabled' => true,
|
|
'levels' => [['role' => 'department_head', 'expire_minutes' => 30, 'reminder_minutes' => 10, 'escalation_minutes' => null, 'profile_ids' => [],
|
|
'urgent_expire_minutes' => 5, 'urgent_reminder_minutes' => 1, 'urgent_escalation_minutes' => null]],
|
|
'reason' => 'Prazos explicitamente sintéticos para revisão de apresentação e gravação']);
|
|
app(UrgentRequisitionReviews::class)->savePolicy($people['reviewer'], ['operation_key' => (string) Str::uuid(), 'version' => 0,
|
|
'enabled' => true, 'profile_ids' => [$profiles['reviewer']], 'reason' => 'Designação de identidade inteiramente sintética para a revisão nativa']);
|
|
$workflow = app(RequisitionWorkflow::class);
|
|
$make = function (User $owner, string $priority, string $description, string $price = '100.00') use ($f, $workflow): array {
|
|
auth()->guard()->setUser($owner);
|
|
$input = ['operation_key' => (string) Str::uuid(), 'cost_center_id' => $f['r']->cost_center_id, 'priority' => $priority,
|
|
'needed_by' => today()->addWeek()->toDateString(), 'justification' => 'Dados inteiramente sintéticos para conferência local do percurso de Compras',
|
|
'items' => [['description' => $description, 'category' => 'Material', 'purchase_type' => 'consumable', 'quantity' => '1.000', 'unit' => 'un',
|
|
'unit_price' => $price, 'tax_rate' => '0.00', 'procurement_category' => 'other', 'category_reason' => 'Texto livre exclusivamente sintético para ensaio de apresentação']]];
|
|
|
|
return [$workflow->save($owner, $input), $input];
|
|
};
|
|
$assign = function (User $owner, $request): void {
|
|
auth()->guard()->setUser($owner);
|
|
$service = app(RequisitionAccountAssignments::class);
|
|
$space = $service->workspace($owner, $request);
|
|
$line = $space['items'][0];
|
|
$account = $space['accounts']['data'][0];
|
|
$service->save($owner, $request, ['operation_key' => (string) Str::uuid(), 'version' => 0, 'item_id' => $line['id'],
|
|
'basis_hash' => $line['basis_hash'], 'reason' => 'Imputação fictícia confirmada antes da submissão nativa',
|
|
'allocations' => [['account_id' => $account['id'], 'source_hash' => $account['source_hash'],
|
|
'subtotal' => (string) BigDecimal::of($line['subtotal_minor'])->dividedBy(100, 2),
|
|
'total' => (string) BigDecimal::of($line['total_minor'])->dividedBy(100, 2)]]]);
|
|
};
|
|
[$draft] = $make($people['reviewer'], 'normal', 'Material para conferir a atribuição de contas');
|
|
[$approved] = $make($people['requester'], 'urgent', 'Urgência sintética aprovada');
|
|
$assign($people['requester'], $approved);
|
|
$workflow->submit($people['requester'], $approved, (string) Str::uuid(), $approved->process_version);
|
|
$approved->refresh();
|
|
auth()->guard()->setUser($people['head']);
|
|
$workflow->decide($people['head'], $approved, 'approved', 'Decisão fictícia pelo aprovador independente', (string) Str::uuid(), $approved->process_version);
|
|
[$expired, $revision] = $make($people['requester'], 'urgent', 'Urgência original que será expirada');
|
|
$assign($people['requester'], $expired);
|
|
$workflow->submit($people['requester'], $expired, (string) Str::uuid(), $expired->process_version);
|
|
$expired->refresh();
|
|
// Fixed synthetic clock keeps this native visual fixture stable across requests.
|
|
CarbonImmutable::setTestNow(CarbonImmutable::now()->addMinutes(6));
|
|
Carbon::setTestNow(CarbonImmutable::now());
|
|
$deadline = app(RequisitionExpiry::class)->deadline($expired);
|
|
$workflow->expire($people['requester'], $expired, $deadline['basis_hash'], (string) Str::uuid(), $expired->process_version);
|
|
$expired->refresh();
|
|
$revision['operation_key'] = (string) Str::uuid();
|
|
$revision['process_version'] = $expired->process_version;
|
|
$revision['priority'] = 'normal';
|
|
$revision['items'][0]['description'] = 'Nova preparação depois da expiração — 120 MZN';
|
|
$revision['items'][0]['unit_price'] = '120.00';
|
|
$expired = $workflow->save($people['requester'], $revision, $expired);
|
|
$assign($people['requester'], $expired);
|
|
$workflow->submit($people['requester'], $expired, (string) Str::uuid(), $expired->process_version);
|
|
// Separate normal-cycle example: a real first decision remains visible after the second level expires.
|
|
auth()->guard()->setUser($people['reviewer']);
|
|
$f['tenant']->update(['first_limit_minor' => 5000, 'second_limit_minor' => 20000]);
|
|
app(RequisitionExpiry::class)->savePolicy($people['reviewer'], ['operation_key' => (string) Str::uuid(), 'version' => 1, 'enabled' => true,
|
|
'levels' => array_map(fn ($role) => ['role' => $role, 'expire_minutes' => 30, 'reminder_minutes' => 10,
|
|
'escalation_minutes' => null, 'profile_ids' => [], 'urgent_expire_minutes' => 5,
|
|
'urgent_reminder_minutes' => 1, 'urgent_escalation_minutes' => null], ['department_head', 'procurement']),
|
|
'reason' => 'Configuração exclusivamente sintética para conferir autoria e documento dos ciclos anteriores']);
|
|
[$historyRequest, $historyInput] = $make($people['requester'], 'normal', 'Documento original do ciclo — 100 MZN');
|
|
$assign($people['requester'], $historyRequest);
|
|
$workflow->submit($people['requester'], $historyRequest, (string) Str::uuid(), $historyRequest->process_version);
|
|
auth()->guard()->setUser($people['head']);
|
|
$workflow->decide($people['head'], $historyRequest->fresh(), 'approved', 'Fundamento original da chefia — conferência inteiramente sintética',
|
|
(string) Str::uuid(), $historyRequest->fresh()->process_version);
|
|
CarbonImmutable::setTestNow(CarbonImmutable::now()->addMinutes(31));
|
|
Carbon::setTestNow(CarbonImmutable::now());
|
|
auth()->guard()->setUser($people['requester']);
|
|
$historyRequest->refresh();
|
|
$deadline = app(RequisitionExpiry::class)->deadline($historyRequest);
|
|
$workflow->expire($people['requester'], $historyRequest, $deadline['basis_hash'], (string) Str::uuid(), $historyRequest->process_version);
|
|
$historyInput['operation_key'] = (string) Str::uuid();
|
|
$historyInput['process_version'] = $historyRequest->fresh()->process_version;
|
|
$historyInput['items'][0]['description'] = 'Documento da nova submissão — 120 MZN';
|
|
$historyInput['items'][0]['unit_price'] = '120.00';
|
|
$historyRequest = $workflow->save($people['requester'], $historyInput, $historyRequest->fresh());
|
|
$assign($people['requester'], $historyRequest);
|
|
$workflow->submit($people['requester'], $historyRequest, (string) Str::uuid(), $historyRequest->process_version);
|
|
[$pending] = $make($people['requester'], 'urgent', 'Urgência para conferir os prazos próprios');
|
|
$assign($people['requester'], $pending);
|
|
$workflow->submit($people['requester'], $pending, (string) Str::uuid(), $pending->process_version);
|
|
|
|
require_once __DIR__.'/SupplyFixture.php';
|
|
auth()->guard()->setUser($people['reviewer']);
|
|
$planning = app(SupplyPlanning::class);
|
|
$agreement = $planning->save($people['reviewer'], 'agreement', supplyInput([
|
|
'stock_item_id' => $f['stock']->id, 'warehouse_id' => $f['warehouse']->id, 'supplier_id' => $f['order']->supplier_id,
|
|
'habitual' => false, 'valid_from' => today()->toDateString(), 'valid_until' => today()->addYear()->toDateString(),
|
|
'origin' => 'local', 'currency' => 'MZN', 'price_minor' => 10000, 'lead_days' => 4, 'reference' => 'QA-VISUAL-AGREEMENT']));
|
|
$contract = $planning->save($people['reviewer'], 'contract', supplyInput([
|
|
'supplier_id' => $f['order']->supplier_id, 'reference' => 'QA-VISUAL-CONTRACT', 'currency' => 'MZN',
|
|
'valid_from' => today()->toDateString(), 'valid_until' => today()->addYear()->toDateString(),
|
|
'periodicity_days' => 30, 'order_limit_amount' => '100.00', 'lead_days' => 3]));
|
|
auth()->guard()->setUser($people['head']);
|
|
$agreement = $planning->save($people['head'], 'agreement', supplyInput([], 'approve', $agreement));
|
|
$contract = $planning->save($people['head'], 'contract', supplyInput([], 'approve', $contract));
|
|
auth()->guard()->setUser($people['reviewer']);
|
|
$internal = app(WarehouseRequests::class)->draft($people['reviewer'], ['operation_key' => (string) Str::uuid(),
|
|
'warehouse_id' => $f['warehouse']->id, 'cost_center_id' => $f['r']->cost_center_id,
|
|
'destination' => 'QA-VISUAL-INTERNAL — destino exclusivamente sintético', 'reason' => 'Ensaio de pesquisa e leitura sem entrega física', 'priority' => 'normal',
|
|
'lines' => [['stock_item_id' => $f['stock']->id, 'quantity' => '1.000', 'use' => 'internal', 'equipment_id' => null]]]);
|
|
$fulfilment = app(WarehouseFulfilment::class);
|
|
$fulfilment->command($people['reviewer'], $internal->id, ['operation_key' => (string) Str::uuid(),
|
|
'version' => $fulfilment->progress($internal)['version'], 'action' => 'submit', 'reason' => 'Pedido sintético para conferir a projecção da pesquisa']);
|
|
if ($agreement->state !== 'approved' || $contract->state !== 'approved' || $fulfilment->progress($internal)['state'] !== 'submitted') {
|
|
throw new LogicException('Native search review fixture did not reach its required states.');
|
|
}
|
|
$historical = app(RequisitionExpiry::class)->workspace($people['reviewer'], $historyRequest->fresh());
|
|
$frozen = $historical['history']->getCollection()->first();
|
|
if ($frozen['request']['total_minor'] !== 10000 || $frozen['approval_amount_minor'] !== 10000
|
|
|| $frozen['steps'][0]['approver_id'] !== $people['head']->id || $frozen['rules']['first_limit_minor'] !== 5000
|
|
|| $historyRequest->fresh()->total_minor !== 12000 || $historical['canExpire']) {
|
|
throw new LogicException('Native historical decision fixture did not preserve its original document and independent new cycle.');
|
|
}
|
|
if (DB::transactionLevel() !== 0) {
|
|
throw new LogicException('Audit native review requires top-level native readonly transactions.');
|
|
}
|
|
$readonlyTransactions = 0;
|
|
DB::listen(function ($query) use (&$readonlyTransactions) {
|
|
if (str_starts_with($query->sql, 'SET TRANSACTION ISOLATION LEVEL REPEATABLE READ READ ONLY')
|
|
&& DB::selectOne('SHOW transaction_read_only')->transaction_read_only === 'on') {
|
|
$readonlyTransactions++;
|
|
}
|
|
});
|
|
$auditReadBefore = [];
|
|
foreach (['audit_logs', 'requisitions', 'approval_steps', 'supply_records', 'budget_entries', 'stock_movements', 'users', 'organization_profiles', 'organization_memberships'] as $table) {
|
|
$auditReadBefore[$table] = DB::table($table)->orderBy('id')->get()->toJson();
|
|
}
|
|
foreach (['reviewer' => true, 'auditor' => false] as $key => $canOpen) {
|
|
auth()->guard()->setUser($people[$key]);
|
|
$query = Request::create('/auditoria/eventos', 'GET', ['request_reference' => $historyRequest->number]);
|
|
$query->setUserResolver(fn () => $people[$key]);
|
|
$query->headers->set('X-Inertia', 'true');
|
|
$response = app(AuditMetadataController::class)->index($query);
|
|
$page = json_decode($response->getContent(), true, 64, JSON_THROW_ON_ERROR);
|
|
if (($page['props']['requestContext'] !== null) !== $canOpen || $page['props']['events']['total'] < 1) {
|
|
throw new LogicException('Audit metadata and native process scope were not kept independent.');
|
|
}
|
|
foreach ($page['props']['events']['data'] as $event) {
|
|
if (array_keys($event) !== ['id', 'created_at', 'action', 'user_id']) {
|
|
throw new LogicException('Audit metadata review exposed fields outside its native scope.');
|
|
}
|
|
}
|
|
}
|
|
$csvQuery = Request::create('/auditoria/eventos.csv', 'GET', ['request_reference' => $historyRequest->number]);
|
|
$csvQuery->setUserResolver(fn () => $people['auditor']);
|
|
ob_start();
|
|
try {
|
|
app(AuditMetadataController::class)->csv($csvQuery)->sendContent();
|
|
$csv = ob_get_contents();
|
|
} finally {
|
|
ob_end_clean();
|
|
}
|
|
if (! is_string($csv) || ! str_contains($csv, $historyRequest->number) || $readonlyTransactions !== 3 || DB::transactionLevel() !== 0) {
|
|
throw new LogicException('Native audit page/CSV did not complete three readonly transactions.');
|
|
}
|
|
foreach ($auditReadBefore as $table => $rows) {
|
|
if (DB::table($table)->orderBy('id')->get()->toJson() !== $rows) {
|
|
throw new LogicException('Native audit consultation changed its source rows.');
|
|
}
|
|
}
|
|
auth()->guard()->setUser($people['reviewer']);
|
|
|
|
$office = null;
|
|
if ($officeJourney) {
|
|
$centre = CostCenter::query()->create(['tenant_id' => $f['tenant']->id, 'department_id' => $f['department']->id,
|
|
'code' => 'HTTP-OFFICE-QA', 'name' => 'Centro exclusivamente sintético do percurso HTTP']);
|
|
foreach ([$people['finance'], $people['office_finance_reviewer']] as $reader) {
|
|
DB::table('pa_access')->insert(['tenant_id' => $f['tenant']->id, 'company_id' => 0, 'unit_id' => 0,
|
|
'user_id' => $reader->id, 'person' => 'http-office-qa-'.$reader->id, 'action' => 'view']);
|
|
}
|
|
$office = ['cost_center_id' => $centre->id, 'warehouse_id' => $f['warehouse']->id, 'category' => 'Escritório QA HTTP',
|
|
'source_instance' => 'native-http-office-qa', 'actors' => []];
|
|
if (getenv('RQ01_QA_CAPITAL_SEARCH') === '1') {
|
|
$office['capital_register'] = ['department_id' => $f['department']->id, 'code' => 'HTTP-PROJECT-QA'];
|
|
}
|
|
foreach (['owner' => 'office_requester', 'buyer' => 'reviewer', 'head' => 'head', 'finance' => 'finance',
|
|
'reviewer' => 'office_finance_reviewer', 'warehouse' => 'office_warehouse', 'procurement_reviewer' => 'office_procurement_reviewer'] as $function => $key) {
|
|
$office['actors'][$function] = ['id' => $people[$key]->id, 'email' => $people[$key]->email];
|
|
}
|
|
}
|
|
|
|
$legalReferenceRoute = null;
|
|
$vatSourceId = null;
|
|
$specificRateRule = null;
|
|
if ($legalReference) {
|
|
$path = 'C:/Mac/Home/Documents/TEMPO/Portal Tempo/Legislacao/novas/BR_248_I_SERIE_SUPLEMENTO_2025.pdf';
|
|
if (! $integrated || ! is_file($path) || hash_file('sha256', $path) !== ImportLegalReferenceDrafts::EDITION_SHA256) {
|
|
throw new LogicException('The owned legal preview requires the exact supplied official edition and integrated synthetic schema.');
|
|
}
|
|
config(['import-legal.qa_enabled' => true, 'import-tariffs.qa_enabled' => true]);
|
|
auth()->guard()->setUser($people['reviewer']);
|
|
app(ImportLegalRules::class)->save($people['reviewer'], ['operation_key' => (string) Str::uuid(), 'action' => 'source', 'version' => 0,
|
|
'official_reference' => 'BR I Série 248, suplemento, 29/12/2025 — Lei 8/2025',
|
|
'reason' => 'Exemplar oficial partilhado para consulta e preparação em ambiente exclusivamente QA sintético; nenhuma regra publicada.'],
|
|
new UploadedFile($path, basename($path), 'application/pdf', UPLOAD_ERR_OK, true));
|
|
$legalReferenceRoute = '/requisicoes/'.$f['r']->id.'/base-legal';
|
|
if (getenv('RQ01_QA_VAT_REFERENCE') === '1') {
|
|
$vatPath = 'C:/Mac/Home/Documents/TEMPO/Portal Tempo/Legislacao/alteracao CIVA 2023.pdf';
|
|
if (! is_file($vatPath) || hash_file('sha256', $vatPath) !== ImportLegalReferenceDrafts::VAT_EDITION_SHA256) {
|
|
throw new LogicException('VAT preview requires the exact supplied BR250 edition.');
|
|
}
|
|
$vatSource = app(ImportLegalRules::class)->save($people['reviewer'], ['operation_key' => (string) Str::uuid(), 'action' => 'source', 'version' => 0,
|
|
'official_reference' => 'Lei 22/2022; BR I Série 250, 28/12/2022, exemplar partilhado',
|
|
'reason' => 'Consulta e preparação em QA sintético; a fonte não publica nem activa uma regra fiscal.'],
|
|
new UploadedFile($vatPath, basename($vatPath), 'application/pdf', UPLOAD_ERR_OK, true));
|
|
$vatSourceId = $vatSource->id;
|
|
}
|
|
if (getenv('RQ01_QA_ICE_REFERENCE') === '1') {
|
|
$icePath = base_path('tmp/pdfs/import-legal-source-review-20261128/law7-2025-official-second-supplement.pdf');
|
|
if (! is_file($icePath) || hash_file('sha256', $icePath) !== ImportLegalReferenceDrafts::ICE_EDITION_SHA256) {
|
|
throw new LogicException('The ICE preview requires the exact retained official second supplement.');
|
|
}
|
|
app(ImportLegalRules::class)->save($people['reviewer'], ['operation_key' => (string) Str::uuid(), 'action' => 'source', 'version' => 0,
|
|
'official_reference' => 'Lei 7/2025, BR I Série 248, 2.º suplemento, 29/12/2025, páginas 2180-(21 a 22)',
|
|
'official_url' => 'https://www.at.gov.mz/api/webdav?path=%2FLEGISLA%C3%87%C3%83O%2FLEGISLA%C3%87%C3%83O+ADUANEIRA%2FLEI%2FBR_248_I_SERIE_2%C2%BA+SUPLEMENTO_2025_260116_124640.pdf',
|
|
'reason' => 'Consulta do original oficial em QA descartável; nenhuma regra publicada ou taxa real activada.'],
|
|
new UploadedFile($icePath, basename($icePath), 'application/pdf', UPLOAD_ERR_OK, true));
|
|
}
|
|
if (getenv('RQ01_QA_SPECIFIC_RATE') === '1') {
|
|
require_once __DIR__.'/ImportLegalQaFixture.php';
|
|
$specificSource = app(ImportLegalRules::class)->save($people['reviewer'], ['operation_key' => (string) Str::uuid(), 'action' => 'source', 'version' => 0,
|
|
'official_reference' => 'Exemplar sintético QA — sem diploma ou validade fiscal',
|
|
'reason' => 'Fonte sintética separada, registada pelo serviço nativo apenas para conferir precisão decimal; nenhuma taxa publicada.'], importLegalQaFile());
|
|
$specificDraft = app(ImportLegalRules::class)->save($people['reviewer'], importLegalQaInput([
|
|
'source_id' => $specificSource->id, 'title' => 'QA — coeficiente específico sem validade fiscal',
|
|
'official_reference' => $specificSource->data['official_reference'], 'official_url' => null,
|
|
'citation' => 'Exemplar exclusivamente sintético para conferir a preparação decimal, sem regra fiscal real.',
|
|
'charges' => [[...importLegalQaCharge(), 'label' => 'Coeficiente específico sintético', 'method' => 'specific',
|
|
'rate_percent' => null, 'specific_minor' => '0.99', 'quantity_unit' => 'g',
|
|
'basis_reference' => 'Base estritamente sintética para testar a preparação; nenhuma taxa publicada ou cálculo activado.']],
|
|
]));
|
|
$specificRateRule = $specificDraft->only(['id', 'record_key', 'version', 'state']);
|
|
}
|
|
}
|
|
|
|
$operationalSearchReference = null;
|
|
if (getenv('RQ01_QA_OPERATIONAL_SEARCH') === '1') {
|
|
config(['operational-orders.qa_enabled' => true]);
|
|
auth()->guard()->setUser($people['reviewer']);
|
|
$orders = app(OperationalOrders::class);
|
|
$policy = $orders->configure($people['reviewer'], ['operation_key' => (string) Str::uuid(), 'version' => 0,
|
|
'mode' => 'procurement', 'reason' => 'Configuração exclusivamente sintética do percurso de pesquisa, sem locais reais abrangidos.']);
|
|
$source = $orders->save($people['reviewer'], ['operation_key' => (string) Str::uuid(), 'policy_version' => $policy->version,
|
|
'type' => 'production', 'reference' => 'QA-SEARCH-OP-20261128', 'department_id' => $f['department']->id,
|
|
'utilisation_location' => 'Linha exclusivamente sintética QA', 'description' => 'Ordem de origem fictícia para conferir pesquisa e abertura directa do registo.',
|
|
'reason' => 'Fixture nativa descartável; sem produção, compra ou movimento físico real.']);
|
|
$operationalSearchReference = $source->data['reference'];
|
|
}
|
|
|
|
$documentary = null;
|
|
if (getenv('RQ01_QA_IMPORT_DOCUMENTARY') === '1') {
|
|
config(['import-dossier.qa_enabled' => true, 'import-bank-support.qa_enabled' => true]);
|
|
auth()->guard()->setUser($people['reviewer']);
|
|
$import = $planning->save($people['reviewer'], 'import', supplyInput([
|
|
'purchase_order_id' => $f['order']->id, 'purpose' => 'internal', 'jurisdiction' => 'QA documental sem operação real',
|
|
'origin_country' => 'Origem sintética', 'dispatch_country' => 'Expedição sintética', 'regime' => 'Regime exclusivamente sintético',
|
|
]));
|
|
require_once __DIR__.'/ImportBankQaFixture.php';
|
|
$bankFixture = importBankQaFixture($people['reviewer'], $import);
|
|
$bank = app(ImportBankSupport::class)->save($people['reviewer'], $import, $bankFixture['input']);
|
|
$documentary = ['import_id' => $import->id, 'bank_id' => $bank->id,
|
|
'dossier_route' => '/compras/importacoes/'.$import->id.'/documentos',
|
|
'bank_route' => '/compras/importacoes/'.$import->id.'/suporte-bancario',
|
|
'synthetic_only' => true, 'document_count' => count($bankFixture['documents'])];
|
|
}
|
|
|
|
$supplierReview = null;
|
|
if (getenv('RQ01_QA_SUPPLIER_REVIEW') === '1') {
|
|
$evaluations = app(SupplierEvaluationWorkflow::class);
|
|
auth()->guard()->setUser($people['reviewer']);
|
|
$evaluation = $evaluations->create($people['reviewer'], $f['order']->supplier_id, (string) Str::uuid(), [
|
|
'title' => 'Avaliação exclusivamente sintética QA', 'nature' => 'goods',
|
|
'scope' => 'Conferência visual do relatório e do histórico, sem avaliação de fornecedor real.',
|
|
'period_start' => $f['order']->issued_at->toDateString(), 'period_end' => $f['order']->issued_at->toDateString(), 'order_ids' => [$f['order']->id],
|
|
'criteria' => [['label' => 'Conformidade documental sintética', 'result' => 'observed',
|
|
'reason' => 'Artigos e condições do exemplo QA conferidos.', 'evidence' => 'Referência estritamente sintética: ordem QA'],
|
|
['label' => 'Serviço pós-venda', 'result' => 'not_applicable',
|
|
'reason' => 'Fora do âmbito deste exemplo sintético.', 'evidence' => '']],
|
|
'conclusion' => 'Conclusão qualitativa sintética; não certifica desempenho ou elegibilidade real.',
|
|
'critical_occurrences' => '', 'critical_evidence' => '',
|
|
]);
|
|
$evaluation = $evaluations->transition($people['reviewer'], $evaluation->id, $evaluation->version, 'submit', null);
|
|
auth()->guard()->setUser($people['finance']);
|
|
$evaluation = $evaluations->transition($people['finance'], $evaluation->id, $evaluation->version, 'approve',
|
|
'Revisão independente exclusivamente sintética para conferir apresentação.');
|
|
if ($evaluation->status !== 'approved' || $people['reviewer']->id === $people['finance']->id) {
|
|
throw new LogicException('Synthetic evaluation did not preserve independent approval.');
|
|
}
|
|
$issuedOn = $f['order']->issued_at->toDateString();
|
|
if ($evaluation->payload['period_start'] > $issuedOn || $evaluation->payload['period_end'] < $issuedOn) {
|
|
throw new LogicException('Synthetic evaluation period must include its issued order.');
|
|
}
|
|
$approvedOriginal = $evaluation->fresh()->getAttributes();
|
|
auth()->guard()->setUser($people['reviewer']);
|
|
$measures = app(SupplierImprovementWorkflow::class);
|
|
$measure = $measures->execute($people['reviewer'], $evaluation->id, null, 'create', [
|
|
'operation_key' => (string) Str::uuid(), 'title' => 'Conferência sintética da identificação dos volumes',
|
|
'description' => 'Conservar a referência da ordem nos volumes do exemplo QA.',
|
|
'responsible_id' => $people['head']->id, 'due_on' => today()->addWeek()->toDateString(),
|
|
]);
|
|
auth()->guard()->setUser($people['head']);
|
|
$measure = $measures->execute($people['head'], $evaluation->id, $measure->id, 'submit', [
|
|
'version' => $measure->version, 'result' => 'Identificação sintética conferida no ensaio.',
|
|
'evidence' => 'Referência fictícia QA-VOLUMES, sem documento ou fornecedor real.',
|
|
]);
|
|
auth()->guard()->setUser($people['finance']);
|
|
$measure = $measures->execute($people['finance'], $evaluation->id, $measure->id, 'close', [
|
|
'version' => $measure->version, 'reason' => 'Conferência independente exclusivamente sintética do resultado e referência.',
|
|
]);
|
|
$responses = app(SupplierResponseWorkflow::class);
|
|
auth()->guard()->setUser($people['reviewer']);
|
|
$response = $responses->execute($people['reviewer'], $evaluation->id, null, 'create', [
|
|
'operation_key' => (string) Str::uuid(), 'payload' => [
|
|
'title' => 'Argumentos exclusivamente sintéticos sobre a identificação dos volumes',
|
|
'received_on' => today()->toDateString(), 'source_reference' => 'QA-ARGUMENTOS-1, referência fictícia',
|
|
'statement' => 'O exemplo solicita esclarecimento documental; não representa argumentos de um fornecedor real.',
|
|
],
|
|
]);
|
|
$response = $responses->execute($people['reviewer'], $evaluation->id, $response->id, 'submit', ['version' => $response->version]);
|
|
auth()->guard()->setUser($people['finance']);
|
|
$response = $responses->execute($people['finance'], $evaluation->id, $response->id, 'decide', [
|
|
'version' => $response->version, 'outcome' => 'accepted',
|
|
'reason' => 'Argumentos do exemplo conferidos independentemente, sem decisão sobre fornecedor real.',
|
|
'follow_up' => 'Conservar os esclarecimentos; qualquer rectificação exige uma nova revisão própria.',
|
|
'response_reference' => 'QA-MINUTA-1, sem comunicação externa',
|
|
]);
|
|
if ($measure->status !== 'closed' || $response->status !== 'decided'
|
|
|| $evaluation->fresh()->getAttributes() !== $approvedOriginal) {
|
|
throw new LogicException('Synthetic follow-up must preserve the approved evaluation.');
|
|
}
|
|
auth()->guard()->setUser($people['reviewer']);
|
|
$pendingResponse = $responses->execute($people['reviewer'], $evaluation->id, null, 'create', [
|
|
'operation_key' => (string) Str::uuid(), 'payload' => [
|
|
'title' => 'Contraditório exclusivamente sintético para conclusão nativa',
|
|
'received_on' => today()->toDateString(), 'source_reference' => 'QA-DECISAO-NATIVA, documento fictício',
|
|
'statement' => 'Argumentos fictícios para verificar conclusão independente e seguimento, sem fornecedor real ou envio externo.',
|
|
],
|
|
]);
|
|
$pendingResponse = $responses->execute($people['reviewer'], $evaluation->id, $pendingResponse->id, 'submit', ['version' => $pendingResponse->version]);
|
|
if ($pendingResponse->status !== 'review' || $evaluation->fresh()->getAttributes() !== $approvedOriginal) {
|
|
throw new LogicException('Synthetic pending response must preserve the approved evaluation.');
|
|
}
|
|
$draftRevision = $evaluations->revise($people['reviewer'], $evaluation->id, $evaluation->version);
|
|
$pendingEvaluation = $evaluations->create($people['reviewer'], $f['order']->supplier_id, (string) Str::uuid(), [
|
|
...$evaluation->payload, 'title' => 'Avaliação QA separada para conferir preparação da decisão',
|
|
]);
|
|
$pendingEvaluation = $evaluations->transition($people['reviewer'], $pendingEvaluation->id, $pendingEvaluation->version, 'submit', null);
|
|
if ($draftRevision->status !== 'draft' || $pendingEvaluation->status !== 'review'
|
|
|| $evaluation->fresh()->getAttributes() !== $approvedOriginal) {
|
|
throw new LogicException('Synthetic review preparations must preserve their independent original.');
|
|
}
|
|
$supplierReview = ['evaluation_id' => $evaluation->id, 'version' => $evaluation->version,
|
|
'route' => '/fornecedores/avaliacoes/'.$evaluation->id,
|
|
'report_route' => '/fornecedores/avaliacoes/'.$evaluation->id.'/relatorio',
|
|
'synthetic_only' => true, 'native_service_transitions' => true,
|
|
'period_contains_issued_order' => true, 'order_issued_on' => $issuedOn,
|
|
'measure_id' => $measure->id, 'measure_state' => $measure->status,
|
|
'response_id' => $response->id, 'response_state' => $response->status,
|
|
'pending_response_id' => $pendingResponse->id,
|
|
'pending_response_route' => '/fornecedores/avaliacoes/'.$evaluation->id.'#contraditorio-'.$pendingResponse->id,
|
|
'approved_evaluation_preserved' => true,
|
|
'draft_revision_route' => '/fornecedores/avaliacoes/'.$draftRevision->id,
|
|
'pending_review_route' => '/fornecedores/avaliacoes/'.$pendingEvaluation->id,
|
|
'independent_reviewer_login' => $people['finance']->email];
|
|
}
|
|
|
|
$conflictReview = null;
|
|
if (getenv('RQ01_QA_CONFLICT_RELEASE') === '1') {
|
|
auth()->guard()->setUser($people['reviewer']);
|
|
$controller = app(ConflictDeclarationController::class);
|
|
$guard = app(ConflictGuard::class);
|
|
foreach (['supplier', 'process_supplier'] as $scope) {
|
|
$query = Request::create('/conflitos', 'POST', ['scope' => $scope, 'supplier_id' => $f['order']->supplier_id,
|
|
'requisition_id' => $scope === 'supplier' ? null : $f['r']->id,
|
|
'has_conflict' => true, 'known_since' => today()->toDateString(),
|
|
'reason' => 'Declaração exclusivamente sintética para conferir o levantamento pela direcção, sem conflito real.']);
|
|
$query->setUserResolver(fn () => $people['reviewer']);
|
|
$controller->store($query, $guard, app(RequisitionWorkflow::class));
|
|
}
|
|
$declarations = ConflictDeclaration::query()->where('user_id', $people['reviewer']->id)->orderBy('id')->get();
|
|
if ($declarations->count() !== 2 || ! $guard->hasConflict($people['reviewer']->id, $f['order']->supplier_id, $f['r']->id)
|
|
|| app(ConflictReleases::class)->canAuthorise($people['reviewer'])) {
|
|
throw new LogicException('Conflict QA must keep two impediments and exclude automatic Admin authority.');
|
|
}
|
|
auth()->guard()->setUser($people['direction']);
|
|
if (! app(ConflictReleases::class)->canAuthorise($people['direction'])) {
|
|
throw new LogicException('Conflict QA direction must have its express own authority.');
|
|
}
|
|
$frames = [];
|
|
foreach (['gl_accounts', 'gl_journals', 'gl_lines', 'requisitions', 'requisition_items', 'invoices', 'invoice_items', 'external_payments', 'budget_entries', 'stock_movements', 'users', 'organization_profiles', 'organization_memberships'] as $table) {
|
|
$rows = DB::table($table)->when($table === 'users', fn ($query) => $query->select(['id', 'tenant_id', 'department_id', 'purchasing_role']))->orderBy('id')->get();
|
|
$frames[$table] = hash('sha256', $rows->toJson());
|
|
}
|
|
$conflictReview = ['author_id' => $people['reviewer']->id, 'direction_id' => $people['direction']->id,
|
|
'direction_login' => $people['direction']->email, 'supplier_id' => $f['order']->supplier_id, 'requisition_id' => $f['r']->id,
|
|
'declaration_id' => $declarations[0]->id, 'other_declaration_id' => $declarations[1]->id,
|
|
'route' => '/conflitos/'.$declarations[0]->id, 'other_route' => '/conflitos/'.$declarations[1]->id,
|
|
'originals_sha256' => hash('sha256', $declarations->toJson()), 'protected_frames' => $frames, 'synthetic_only' => true];
|
|
}
|
|
|
|
$urgentStockReview = null;
|
|
if (getenv('RQ01_QA_URGENT_STOCK') === '1') {
|
|
config(['urgent-quotations.qa_enabled' => true]);
|
|
$catalogue = app(RequisitionCatalogue::class);
|
|
auth()->guard()->setUser($people['stock_cataloguer']);
|
|
$catalogue->save($people['stock_cataloguer'], $f['stock']->id, ['version' => 0, 'stock_basis' => $catalogue->basis($f['stock']),
|
|
'category' => 'Material', 'purchase_type' => 'consumable', 'published' => true, 'reason' => 'Catálogo inteiramente sintético para conferir a origem do mínimo urgente.']);
|
|
$entry = DB::table('requisition_catalogue')->where('stock_item_id', $f['stock']->id)->sole();
|
|
$f['tenant']->update(['comparison_policy' => app(ComparisonPolicy::class)->checked([
|
|
...ComparisonPolicy::DEFAULTS, 'configured' => true, 'revision' => 1, 'urgent_minimum_proposals' => 1])]);
|
|
[$urgentStockRequest, $urgentInput] = $make($people['requester'], 'urgent', 'Artigo de catálogo para conferência sintética do mínimo');
|
|
$urgentInput['operation_key'] = (string) Str::uuid();
|
|
$urgentInput['process_version'] = $urgentStockRequest->process_version;
|
|
$urgentInput['items'][0]['catalogue_entry_id'] = $entry->id;
|
|
$urgentInput['items'][0]['catalogue_version'] = $entry->version;
|
|
$urgentStockRequest = $workflow->save($people['requester'], $urgentInput, $urgentStockRequest);
|
|
$assign($people['requester'], $urgentStockRequest);
|
|
$workflow->submit($people['requester'], $urgentStockRequest, (string) Str::uuid(), $urgentStockRequest->process_version);
|
|
auth()->guard()->setUser($people['head']);
|
|
$urgentStockRequest->refresh();
|
|
$workflow->decide($people['head'], $urgentStockRequest, 'approved', 'Aprovação independente exclusivamente sintética para a revisão do mínimo.', (string) Str::uuid(), $urgentStockRequest->process_version);
|
|
foreach ([$people['reviewer'], $people['finance']] as $approver) {
|
|
$urgentStockRequest->refresh();
|
|
if ($urgentStockRequest->canDecide($approver)) {
|
|
auth()->guard()->setUser($approver);
|
|
$workflow->decide($approver, $urgentStockRequest, 'approved', 'Etapa independente inteiramente sintética para a conferência do mínimo.', (string) Str::uuid(), $urgentStockRequest->process_version);
|
|
}
|
|
}
|
|
auth()->guard()->setUser($people['reviewer']);
|
|
$urgentStockRequest->refresh();
|
|
if ($urgentStockRequest->status !== 'approved' || ! app(QuotationParticipation::class)->canPrepare($people['reviewer'], $urgentStockRequest)) {
|
|
throw new LogicException('Urgent preview requires completed native approvals and an authorised quotation preparer.');
|
|
}
|
|
$policy = $planning->save($people['reviewer'], 'policy', supplyInput([...supplyPolicy($f), 'safety_milli' => 0,
|
|
'minimum_stock_milli' => 20000, 'usage_context' => 'Natureza e utilização fictícias: insumo de consumo diário na produção.']));
|
|
auth()->guard()->setUser($people['head']);
|
|
$policy = $planning->save($people['head'], 'policy', supplyInput([], 'approve', $policy));
|
|
$urgentStockRequest->refresh();
|
|
if (app(ProposalComparison::class)->inspect($urgentStockRequest)['policy']['minimum_proposals'] !== 3) {
|
|
throw new LogicException('Urgent preview must retain the normal count before an explicit stock conference.');
|
|
}
|
|
$urgentStockReview = ['route' => '/requisicoes/'.$urgentStockRequest->id.'/urgencia-stock', 'request_id' => $urgentStockRequest->id,
|
|
'actor_id' => $people['reviewer']->id,
|
|
'policy_id' => $policy->id, 'minimum_stock_milli' => 20000, 'normal_count_before_conference' => 3, 'configured_urgent_count' => 1,
|
|
'native_submission_and_independent_approval' => true, 'synthetic_only' => true];
|
|
$urgentStockReview['protected_frames'] = [];
|
|
foreach (['gl_accounts', 'gl_journals', 'gl_lines', 'requisitions', 'requisition_items', 'invoices', 'invoice_items', 'external_payments', 'budget_entries', 'stock_movements', 'users', 'organization_profiles', 'organization_memberships'] as $table) {
|
|
$rows = DB::table($table)->when($table === 'users', fn ($query) => $query->select(['id', 'tenant_id', 'department_id', 'purchasing_role']))->orderBy('id')->get();
|
|
$urgentStockReview['protected_frames'][$table] = hash('sha256', $rows->toJson());
|
|
}
|
|
}
|
|
|
|
$cancellationReview = null;
|
|
if (getenv('RQ01_QA_ORDER_CANCELLATION') === '1') {
|
|
config(['order_cancellation.enabled' => true]);
|
|
$policyFlow = app(OrderCancellationPolicyWorkflow::class);
|
|
auth()->guard()->setUser($people['reviewer']);
|
|
$policy = $policyFlow->propose($people['reviewer'], ['previous_id' => 0, 'mode' => 'issued_order', 'enabled' => true,
|
|
'valid_from' => today()->toDateString(), 'valid_until' => today()->addWeek()->toDateString(),
|
|
'reason' => 'Política inteiramente sintética para revisão nativa do cancelamento; sem activação operacional.']);
|
|
foreach ([$people['cancellation_admin_a'], $people['cancellation_admin_b']] as $admin) {
|
|
auth()->guard()->setUser($admin);
|
|
$policyFlow->review($admin, $policy, 'approved', 'Conferência independente da política inteiramente fictícia.');
|
|
}
|
|
auth()->guard()->setUser($people['reviewer']);
|
|
if (! app(OrderCancellationWorkflow::class)->canRequest($people['reviewer'], $f['order'])) {
|
|
throw new LogicException('Cancellation preview requires an eligible independent buyer and published synthetic policy.');
|
|
}
|
|
$cancellationReview = ['order_id' => $f['order']->id, 'request_id' => $f['r']->id, 'author_id' => $people['reviewer']->id,
|
|
'finance_id' => $people['finance']->id, 'route' => '/ordens/'.$f['order']->id,
|
|
'finance_login' => $people['finance']->email, 'source_is_explicit_uncontrolled_legacy_fixture' => true,
|
|
'original_order_sha256' => hash('sha256', json_encode($f['order']->fresh()->getAttributes(), JSON_THROW_ON_ERROR)),
|
|
'original_request' => $f['r']->fresh()->getAttributes(), 'protected_frames' => [], 'synthetic_only' => true];
|
|
foreach (['purchase_order_items', 'purchase_awards', 'approval_steps', 'gl_accounts', 'gl_journals', 'gl_lines', 'requisition_items', 'invoices', 'invoice_items', 'external_payments', 'budget_entries', 'stock_movements', 'users', 'organization_profiles', 'organization_memberships'] as $table) {
|
|
$rows = DB::table($table)->when($table === 'users', fn ($query) => $query->select(['id', 'tenant_id', 'department_id', 'purchasing_role']))->orderBy('id')->get();
|
|
$cancellationReview['protected_frames'][$table] = hash('sha256', $rows->toJson());
|
|
}
|
|
}
|
|
|
|
return ['tenant_id' => $f['tenant']->id, 'synthetic_login' => $people['reviewer']->email,
|
|
'cancellation_review' => $cancellationReview,
|
|
'urgent_stock_review' => $urgentStockReview,
|
|
'conflict_review' => $conflictReview,
|
|
'supplier_review' => $supplierReview,
|
|
'import_documentary' => $documentary,
|
|
'operational_search_reference' => $operationalSearchReference,
|
|
'print_pagination' => $printPagination ? ['order_route' => '/ordens/'.$f['order']->id.'/imprimir', 'lines' => 50, 'total_minor' => 10000, 'fixture_only_not_native_issuance' => true] : null,
|
|
'legal_reference_route' => $legalReferenceRoute,
|
|
'vat_source_id' => $vatSourceId,
|
|
'specific_rate_rule' => $specificRateRule,
|
|
'office_journey' => $office,
|
|
'integrated_optional_schema' => $composition,
|
|
'synthetic_private_audit_login' => $people['private_auditor']->email, 'synthetic_metadata_login' => $people['auditor']->email, 'synthetic_requester_login' => $people['requester']->email,
|
|
'audit_request_reference' => $historyRequest->number, 'audit_native_readonly_transactions' => $readonlyTransactions,
|
|
'search_agreement' => $agreement->id, 'search_contract' => $contract->id, 'warehouse_search_request' => $internal->id,
|
|
'historical_decision_request' => $historyRequest->id, 'historical_decision_verified' => true,
|
|
'draft_request' => $draft->id, 'approved_request' => $approved->id, 'expired_request' => $expired->id,
|
|
'urgent_pending_request' => $pending->id, 'clock' => CarbonImmutable::now()->toIso8601String(), 'synthetic_only' => true];
|
|
}
|