assertSame('proactive_investment_20261027_test', $target->name); $this->assertSame(55441, (int) $target->port); config(['investor-path.enabled' => true, 'suitecrm.enabled' => false]); $this->actingAs(User::findOrFail(1021)); $id = null; $etag = null; foreach (['dividend', 'interest'] as $kind) { $d = json_decode(file_get_contents(base_path('outputs/irpc-pt-mz-'.$kind.'-20261110/fixture.json')), true, flags: JSON_THROW_ON_ERROR); $personal = ['person_type' => $d['person_type']]; unset($d['person_type']); $payload = ['personal_snapshot' => $personal, 'economic_snapshot' => $d]; if ($id === null) { $id = $this->postJson('/api/v1/simulation-drafts', $payload, ['Idempotency-Key' => (string) Str::uuid()])->assertCreated()->json('data.id'); } else { $this->putJson('/api/v1/simulation-drafts/'.$id, $payload, ['If-Match' => $etag])->assertOk(); } $response = $this->getJson('/api/v1/simulation-drafts/'.$id)->assertOk(); $etag = $response->headers->get('ETag'); $back = $response->json('data.economic_snapshot'); $this->assertSame($d['modelo_a_snapshot'], $back['modelo_a_snapshot']); $this->assertSame($d['business_plan_snapshot'], $back['business_plan_snapshot']); $b = json_decode($back['modelo_a_snapshot'], true, flags: JSON_THROW_ON_ERROR)['irpcAnnual'][$d['context_opportunity']]; $this->assertSame($kind === 'dividend' ? 'ptMzDividend' : 'ptMzInterest', $b['internationalCredits']['positions'][0]['treatyMethod']); $this->assertSame(['numerator' => '6', 'denominator' => '1'], $b['result']['model']['internationalCredit']['positions'][0]['treatyLimit']); $this->assertSame(['numerator' => '702', 'denominator' => '1'], $b['result']['model']['arithmeticBalance']); file_put_contents(base_path('outputs/irpc-pt-mz-'.$kind.'-20261110/recovered.json'), json_encode($back, JSON_THROW_ON_ERROR | JSON_UNESCAPED_UNICODE)); } } }