assertSame('simulator_fiscal_delta_20261021_test', $identity->name); $this->assertSame(55441, (int) $identity->port); config(['investor-path.enabled' => true, 'suitecrm.enabled' => false]); $this->actingAs(User::factory()->create(['email_verified_at' => now()])); $path = getenv('IVA_RATIONAL_INPUT') ?: base_path('tests/frontend/fixtures/iva-rational.json'); $draft = json_decode(file_get_contents($path), true, flags: JSON_THROW_ON_ERROR); $store = json_decode($draft['modelo_a_snapshot'], true, flags: JSON_THROW_ON_ERROR); $first = $store['salesOperations']['opportunity:309']; $id = $this->postJson('/api/v1/simulation-drafts', ['personal_snapshot' => [], 'economic_snapshot' => $draft], ['Idempotency-Key' => (string) Str::uuid()])->assertCreated()->json('data.id'); $economic = $this->getJson('/api/v1/simulation-drafts/'.$id)->assertOk()->json('data.economic_snapshot'); $this->assertSame($draft['modelo_a_snapshot'], $economic['modelo_a_snapshot']); $saved = json_decode($economic['modelo_a_snapshot'], true, flags: JSON_THROW_ON_ERROR); $this->assertSame($first, $saved['salesOperations']['opportunity:309']); $second = $saved['salesOperations']['opportunity:310']['result']; $this->assertSame('iva-operations-l1/2', $second['version']); $this->assertSame(['numerator' => '20', 'denominator' => '21'], $second['rows'][0]['exact']['net']); $this->assertSame(['numerator' => '1', 'denominator' => '21'], $second['rows'][0]['exact']['vat']); $this->assertSame('0.047619', $second['rows'][0]['vat']); if (getenv('IVA_RATIONAL_RECOVERED')) { file_put_contents(getenv('IVA_RATIONAL_RECOVERED'), json_encode($economic, JSON_THROW_ON_ERROR | JSON_UNESCAPED_UNICODE)); } } }