feat: qualify treaty interest under governmental financing agreements
tests / ci (push) Canceled after 0s
tests / ci (push) Canceled after 0s
This commit is contained in:
@@ -1,5 +1,16 @@
|
|||||||
# Rastreabilidade, utilização e formação
|
# Rastreabilidade, utilização e formação
|
||||||
|
|
||||||
|
## 10/11/2026 — b10b35f3 instalado; acordo institucional PT–MZ em QA
|
||||||
|
|
||||||
|
**Homologação: `b10b35f30830922dae00afde50ac2bdb0e8cef6f`**, promovida às12:15:13UTC e conferida às12:16:31UTC (14:16 locais). Revisão HTTPS e16hashes Git iguais, quatro entradasHTTP200; configuração preservada, zero migrations/importações. Backup/restauro190tabelas com contagens/checksums iguais e369ficheiros/configuração conferidos;60b52fc8 disponível para reversão. Recibos `outputs/government-fraction-delivery-20261110/{backup,restore,files-restore,verification}.json`. Sessão SSH mantida aberta para continuação autenticada, sem credencial em disco. Isenção por devedor público11(3)a e fracções económicas L6 deixam de ser pendências de instalação; as anotações anteriores QA são históricas nesses recortes.
|
||||||
|
|
||||||
|
**Delta posterior QA, ainda não instalado:** correspondência11(3)b para instituição/organismo beneficiário corrente que concedeu o financiamento no âmbito de acordo concluído entre os governos PT–MZ. Beneficiário, financiamento ligado aos juros e acordo/cláusula aplicável exigem suporte próprio. País, nome da entidade ou qualificação institucional isolada não activam isenção. Fundamento distinto do devedor público11(3)a; limpar/trocar a escolha invalida a decisão corrente, sem apagar resultado histórico nem reutilizar campos ocultos como nova decisão.
|
||||||
|
|
||||||
|
Cálculo → gravação/GET pela API existente no QA55441 com rollback → recuperação → HTML/dossier demonstrados. Exemplo sintético: juros brutos60, imposto pago10 e fracção nacional8, com acordo qualificado → limite convencional0/crédito0/saldo708 MZN; sem reembolso, transporte ou consumo oficial e sem alterar L6. Relatório conserva instituição, financiamento e acordo. Prova `outputs/irpc-pt-mz-agreement-20261110/verification.json`; tipos/lint/Pint/build QA aprovados e provas anteriores reutilizadas.
|
||||||
|
|
||||||
|
Pacote `outputs/entrega-cdt-acordo-20261110.zip`, base exactab10b35f3, aplicação/reversão conferidas; entrega seguinte expressamente autorizada durante esta continuação, ainda sem instalação nesta entrada. Restantes beneficiários/regimes11(3)b, EP, relações especiais e demais CDT/benefícios/obrigações conservam correspondência própria; saldo L1–L7/restanteL8/L9–L16 preservado. Conferência visual continua pendente no mesmo registo; portal não integral.
|
||||||
|
|
||||||
|
|
||||||
## 10/11/2026 — CDT instalada; isenção governamental e precisão económica em QA
|
## 10/11/2026 — CDT instalada; isenção governamental e precisão económica em QA
|
||||||
|
|
||||||
**Homologação: `60b52fc8c7446cbbee904a4411eca8ad284aa7ad`**, promovida às11:49:26UTC e conferida às11:50:11UTC (13:50 locais). Delta13hashes Git e revisão HTTPS iguais; portal/login/up/revision HTTP200, .env preservado, zero migrations/importações. Backup fresco/restauro190tabelas com contagens/checksums iguais e369ficheiros/configuração extraídos/conferidos; ac67f9c1 disponível para reversão. Recibos `outputs/cdt-pt-delivery-20261110/{backup,restore,files-restore,verification}.json`. Sessão SSH encerrada, credencial não guardada. Royalties/dividendos/juros ordinários PT–MZ deste recorte deixam de ser pendência de instalação; não reabrir provas aceites.
|
**Homologação: `60b52fc8c7446cbbee904a4411eca8ad284aa7ad`**, promovida às11:49:26UTC e conferida às11:50:11UTC (13:50 locais). Delta13hashes Git e revisão HTTPS iguais; portal/login/up/revision HTTP200, .env preservado, zero migrations/importações. Backup fresco/restauro190tabelas com contagens/checksums iguais e369ficheiros/configuração extraídos/conferidos; ac67f9c1 disponível para reversão. Recibos `outputs/cdt-pt-delivery-20261110/{backup,restore,files-restore,verification}.json`. Sessão SSH encerrada, credencial não guardada. Royalties/dividendos/juros ordinários PT–MZ deste recorte deixam de ser pendência de instalação; não reabrir provas aceites.
|
||||||
|
|||||||
@@ -1,3 +1,13 @@
|
|||||||
|
## 10/11/2026 — b10b35f3 instalado; acordo institucional PT–MZ em QA
|
||||||
|
|
||||||
|
**Homologação: `b10b35f30830922dae00afde50ac2bdb0e8cef6f`**, promovida às12:15:13UTC e conferida às12:16:31UTC (14:16 locais). Revisão HTTPS e16hashes Git iguais, quatro entradasHTTP200; configuração preservada, zero migrations/importações. Backup/restauro190tabelas com contagens/checksums iguais e369ficheiros/configuração conferidos;60b52fc8 disponível para reversão. Recibos `outputs/government-fraction-delivery-20261110/{backup,restore,files-restore,verification}.json`. Sessão SSH mantida aberta para continuação autenticada, sem credencial em disco. Isenção por devedor público11(3)a e fracções económicas L6 deixam de ser pendências de instalação; as anotações anteriores QA são históricas nesses recortes.
|
||||||
|
|
||||||
|
**Delta posterior QA, ainda não instalado:** correspondência11(3)b para instituição/organismo beneficiário corrente que concedeu o financiamento no âmbito de acordo concluído entre os governos PT–MZ. Beneficiário, financiamento ligado aos juros e acordo/cláusula aplicável exigem suporte próprio. País, nome da entidade ou qualificação institucional isolada não activam isenção. Fundamento distinto do devedor público11(3)a; limpar/trocar a escolha invalida a decisão corrente, sem apagar resultado histórico nem reutilizar campos ocultos como nova decisão.
|
||||||
|
|
||||||
|
Cálculo → gravação/GET pela API existente no QA55441 com rollback → recuperação → HTML/dossier demonstrados. Exemplo sintético: juros brutos60, imposto pago10 e fracção nacional8, com acordo qualificado → limite convencional0/crédito0/saldo708 MZN; sem reembolso, transporte ou consumo oficial e sem alterar L6. Relatório conserva instituição, financiamento e acordo. Prova `outputs/irpc-pt-mz-agreement-20261110/verification.json`; tipos/lint/Pint/build QA aprovados e provas anteriores reutilizadas.
|
||||||
|
|
||||||
|
Pacote `outputs/entrega-cdt-acordo-20261110.zip`, base exactab10b35f3, aplicação/reversão conferidas; entrega seguinte expressamente autorizada durante esta continuação, ainda sem instalação nesta entrada. Restantes beneficiários/regimes11(3)b, EP, relações especiais e demais CDT/benefícios/obrigações conservam correspondência própria; saldo L1–L7/restanteL8/L9–L16 preservado. Conferência visual continua pendente no mesmo registo; portal não integral.
|
||||||
|
|
||||||
## 10/11/2026 — CDT instalada; isenção governamental e precisão económica em QA
|
## 10/11/2026 — CDT instalada; isenção governamental e precisão económica em QA
|
||||||
|
|
||||||
**Homologação: `60b52fc8c7446cbbee904a4411eca8ad284aa7ad`**, promovida às11:49:26UTC e conferida às11:50:11UTC (13:50 locais). Delta13hashes Git e revisão HTTPS iguais; portal/login/up/revision HTTP200, .env preservado, zero migrations/importações. Backup fresco/restauro190tabelas com contagens/checksums iguais e369ficheiros/configuração extraídos/conferidos; ac67f9c1 disponível para reversão. Recibos `outputs/cdt-pt-delivery-20261110/{backup,restore,files-restore,verification}.json`. Sessão SSH encerrada, credencial não guardada. Royalties/dividendos/juros ordinários PT–MZ deste recorte deixam de ser pendência de instalação; não reabrir provas aceites.
|
**Homologação: `60b52fc8c7446cbbee904a4411eca8ad284aa7ad`**, promovida às11:49:26UTC e conferida às11:50:11UTC (13:50 locais). Delta13hashes Git e revisão HTTPS iguais; portal/login/up/revision HTTP200, .env preservado, zero migrations/importações. Backup fresco/restauro190tabelas com contagens/checksums iguais e369ficheiros/configuração extraídos/conferidos; ac67f9c1 disponível para reversão. Recibos `outputs/cdt-pt-delivery-20261110/{backup,restore,files-restore,verification}.json`. Sessão SSH encerrada, credencial não guardada. Royalties/dividendos/juros ordinários PT–MZ deste recorte deixam de ser pendência de instalação; não reabrir provas aceites.
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -1,3 +1,13 @@
|
|||||||
|
## 10/11/2026 — b10b35f3 instalado; acordo institucional PT–MZ em QA
|
||||||
|
|
||||||
|
**Homologação: `b10b35f30830922dae00afde50ac2bdb0e8cef6f`**, promovida às12:15:13UTC e conferida às12:16:31UTC (14:16 locais). Revisão HTTPS e16hashes Git iguais, quatro entradasHTTP200; configuração preservada, zero migrations/importações. Backup/restauro190tabelas com contagens/checksums iguais e369ficheiros/configuração conferidos;60b52fc8 disponível para reversão. Recibos `outputs/government-fraction-delivery-20261110/{backup,restore,files-restore,verification}.json`. Sessão SSH mantida aberta para continuação autenticada, sem credencial em disco. Isenção por devedor público11(3)a e fracções económicas L6 deixam de ser pendências de instalação; as anotações anteriores QA são históricas nesses recortes.
|
||||||
|
|
||||||
|
**Delta posterior QA, ainda não instalado:** correspondência11(3)b para instituição/organismo beneficiário corrente que concedeu o financiamento no âmbito de acordo concluído entre os governos PT–MZ. Beneficiário, financiamento ligado aos juros e acordo/cláusula aplicável exigem suporte próprio. País, nome da entidade ou qualificação institucional isolada não activam isenção. Fundamento distinto do devedor público11(3)a; limpar/trocar a escolha invalida a decisão corrente, sem apagar resultado histórico nem reutilizar campos ocultos como nova decisão.
|
||||||
|
|
||||||
|
Cálculo → gravação/GET pela API existente no QA55441 com rollback → recuperação → HTML/dossier demonstrados. Exemplo sintético: juros brutos60, imposto pago10 e fracção nacional8, com acordo qualificado → limite convencional0/crédito0/saldo708 MZN; sem reembolso, transporte ou consumo oficial e sem alterar L6. Relatório conserva instituição, financiamento e acordo. Prova `outputs/irpc-pt-mz-agreement-20261110/verification.json`; tipos/lint/Pint/build QA aprovados e provas anteriores reutilizadas.
|
||||||
|
|
||||||
|
Pacote `outputs/entrega-cdt-acordo-20261110.zip`, base exactab10b35f3, aplicação/reversão conferidas; entrega seguinte expressamente autorizada durante esta continuação, ainda sem instalação nesta entrada. Restantes beneficiários/regimes11(3)b, EP, relações especiais e demais CDT/benefícios/obrigações conservam correspondência própria; saldo L1–L7/restanteL8/L9–L16 preservado. Conferência visual continua pendente no mesmo registo; portal não integral.
|
||||||
|
|
||||||
## 10/11/2026 — CDT instalada; isenção governamental e precisão económica em QA
|
## 10/11/2026 — CDT instalada; isenção governamental e precisão económica em QA
|
||||||
|
|
||||||
**Homologação: `60b52fc8c7446cbbee904a4411eca8ad284aa7ad`**, promovida às11:49:26UTC e conferida às11:50:11UTC (13:50 locais). Delta13hashes Git e revisão HTTPS iguais; portal/login/up/revision HTTP200, .env preservado, zero migrations/importações. Backup fresco/restauro190tabelas com contagens/checksums iguais e369ficheiros/configuração extraídos/conferidos; ac67f9c1 disponível para reversão. Recibos `outputs/cdt-pt-delivery-20261110/{backup,restore,files-restore,verification}.json`. Sessão SSH encerrada, credencial não guardada. Royalties/dividendos/juros ordinários PT–MZ deste recorte deixam de ser pendência de instalação; não reabrir provas aceites.
|
**Homologação: `60b52fc8c7446cbbee904a4411eca8ad284aa7ad`**, promovida às11:49:26UTC e conferida às11:50:11UTC (13:50 locais). Delta13hashes Git e revisão HTTPS iguais; portal/login/up/revision HTTP200, .env preservado, zero migrations/importações. Backup fresco/restauro190tabelas com contagens/checksums iguais e369ficheiros/configuração extraídos/conferidos; ac67f9c1 disponível para reversão. Recibos `outputs/cdt-pt-delivery-20261110/{backup,restore,files-restore,verification}.json`. Sessão SSH encerrada, credencial não guardada. Royalties/dividendos/juros ordinários PT–MZ deste recorte deixam de ser pendência de instalação; não reabrir provas aceites.
|
||||||
|
|||||||
@@ -86,59 +86,176 @@ export function SimulationIrpcPtCdt({
|
|||||||
))}
|
))}
|
||||||
{p.treatyMethod === 'ptMzInterest' &&
|
{p.treatyMethod === 'ptMzInterest' &&
|
||||||
p.treatyPreparation?.governmentInterestExemption === 'yes' && (
|
p.treatyPreparation?.governmentInterestExemption === 'yes' && (
|
||||||
<fieldset className="rounded border p-3">
|
<fieldset className="space-y-2 rounded border p-3">
|
||||||
<legend>
|
<legend>
|
||||||
Isenção por devedor público português — art.11(3)a
|
Fundamento da isenção dos juros — art.11(3)
|
||||||
</legend>
|
</legend>
|
||||||
<p>
|
|
||||||
Escolha a qualificação documentada do devedor.
|
|
||||||
Beneficiários públicos e acordos entre governos do
|
|
||||||
art.11(3)b exigem correspondência própria. A isenção
|
|
||||||
na fonte não gera reembolso de imposto pago pelo
|
|
||||||
portal.
|
|
||||||
</p>
|
|
||||||
<label className="block">
|
<label className="block">
|
||||||
Devedor dos juros
|
Fundamento
|
||||||
<select
|
<select
|
||||||
aria-label={
|
aria-label={
|
||||||
prefix + 'Devedor público português'
|
prefix +
|
||||||
|
'Fundamento da isenção governamental'
|
||||||
}
|
}
|
||||||
value={
|
value={
|
||||||
p.treatyPreparation.governmentPayer ?? ''
|
p.treatyPreparation.governmentBasis ??
|
||||||
|
(p.treatyPreparation.governmentPayer
|
||||||
|
? 'payer'
|
||||||
|
: '')
|
||||||
}
|
}
|
||||||
onChange={(e) =>
|
onChange={(e) =>
|
||||||
change('governmentPayer', e.target.value)
|
change('governmentBasis', e.target.value)
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<option value="">Por documentar</option>
|
<option value="">Escolha o fundamento</option>
|
||||||
<option value="state">Estado português</option>
|
<option value="payer">
|
||||||
<option value="subdivision">
|
Devedor público português —11(3)a
|
||||||
Subdivisão política ou administrativa
|
|
||||||
portuguesa
|
|
||||||
</option>
|
</option>
|
||||||
<option value="local">
|
<option value="agreement">
|
||||||
Autarquia portuguesa
|
Instituição/organismo e financiamento sob
|
||||||
|
acordo PT–MZ —11(3)b
|
||||||
</option>
|
</option>
|
||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
<label className="block">
|
{p.treatyPreparation.governmentBasis === 'agreement' ? (
|
||||||
Suporte da qualificação do devedor
|
<>
|
||||||
<input
|
<p>
|
||||||
aria-label={
|
O beneficiário é o sujeito corrente:{' '}
|
||||||
prefix + 'Suporte do devedor público'
|
{p.subjectNuit}. Confirme a
|
||||||
}
|
instituição/organismo, o financiamento por
|
||||||
value={
|
ela concedido e o acordo entre os governos
|
||||||
p.treatyPreparation
|
de Portugal e Moçambique. A isenção não é
|
||||||
.governmentPayerReference ?? ''
|
inferida pelo nome; outros
|
||||||
}
|
beneficiários/regimes conservam
|
||||||
onChange={(e) =>
|
correspondência própria.
|
||||||
change(
|
</p>
|
||||||
'governmentPayerReference',
|
{(
|
||||||
e.target.value,
|
[
|
||||||
)
|
[
|
||||||
}
|
'institutionRecipient',
|
||||||
/>
|
'Beneficiário corrente qualificado como instituição/organismo11(3)b',
|
||||||
</label>
|
],
|
||||||
|
[
|
||||||
|
'financingGranted',
|
||||||
|
'Juros resultam de financiamento concedido por esse beneficiário',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'bilateralAgreement',
|
||||||
|
'Financiamento no âmbito de acordo concluído entre os governos PT–MZ',
|
||||||
|
],
|
||||||
|
] as const
|
||||||
|
).map(([key, label]) => (
|
||||||
|
<label key={key} className="block">
|
||||||
|
{label}
|
||||||
|
<select
|
||||||
|
aria-label={prefix + label}
|
||||||
|
value={
|
||||||
|
p.treatyPreparation?.[key] ?? ''
|
||||||
|
}
|
||||||
|
onChange={(e) =>
|
||||||
|
change(key, e.target.value)
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<option value="">
|
||||||
|
Informação em falta
|
||||||
|
</option>
|
||||||
|
<option value="yes">
|
||||||
|
Sim — documentado
|
||||||
|
</option>
|
||||||
|
<option value="no">
|
||||||
|
Não — documentado
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
))}
|
||||||
|
{(
|
||||||
|
[
|
||||||
|
[
|
||||||
|
'institutionReference',
|
||||||
|
'Suporte da qualificação do beneficiário corrente',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'financingReference',
|
||||||
|
'Suporte do financiamento e ligação aos juros',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'agreementReference',
|
||||||
|
'Acordo PT–MZ e cláusula aplicável a este financiamento',
|
||||||
|
],
|
||||||
|
] as const
|
||||||
|
).map(([key, label]) => (
|
||||||
|
<label key={key} className="block">
|
||||||
|
{label}
|
||||||
|
<input
|
||||||
|
aria-label={prefix + label}
|
||||||
|
value={
|
||||||
|
p.treatyPreparation?.[key] ?? ''
|
||||||
|
}
|
||||||
|
onChange={(e) =>
|
||||||
|
change(key, e.target.value)
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
))}
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
|
<p>
|
||||||
|
Qualifique o devedor público português com
|
||||||
|
suporte próprio. A isenção na fonte não
|
||||||
|
gera, no portal, reembolso do imposto pago.
|
||||||
|
</p>
|
||||||
|
<label className="block">
|
||||||
|
Devedor dos juros
|
||||||
|
<select
|
||||||
|
aria-label={
|
||||||
|
prefix + 'Devedor público português'
|
||||||
|
}
|
||||||
|
value={
|
||||||
|
p.treatyPreparation
|
||||||
|
.governmentPayer ?? ''
|
||||||
|
}
|
||||||
|
onChange={(e) =>
|
||||||
|
change(
|
||||||
|
'governmentPayer',
|
||||||
|
e.target.value,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<option value="">Por documentar</option>
|
||||||
|
<option value="state">
|
||||||
|
Estado português
|
||||||
|
</option>
|
||||||
|
<option value="subdivision">
|
||||||
|
Subdivisão política/administrativa
|
||||||
|
portuguesa
|
||||||
|
</option>
|
||||||
|
<option value="local">
|
||||||
|
Autarquia portuguesa
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
<label className="block">
|
||||||
|
Suporte da qualificação do devedor
|
||||||
|
<input
|
||||||
|
aria-label={
|
||||||
|
prefix +
|
||||||
|
'Suporte do devedor público'
|
||||||
|
}
|
||||||
|
value={
|
||||||
|
p.treatyPreparation
|
||||||
|
.governmentPayerReference ?? ''
|
||||||
|
}
|
||||||
|
onChange={(e) =>
|
||||||
|
change(
|
||||||
|
'governmentPayerReference',
|
||||||
|
e.target.value,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</fieldset>
|
</fieldset>
|
||||||
)}
|
)}
|
||||||
{facts.map(([key, label]) => (
|
{facts.map(([key, label]) => (
|
||||||
|
|||||||
@@ -27,6 +27,14 @@ export type InternationalTaxProof = AnnualPpc & {
|
|||||||
exerciseReference: string;
|
exerciseReference: string;
|
||||||
};
|
};
|
||||||
export type PtMzRoyaltyPreparation = {
|
export type PtMzRoyaltyPreparation = {
|
||||||
|
governmentBasis?: '' | 'payer' | 'agreement';
|
||||||
|
institutionRecipient?: '' | 'yes' | 'no';
|
||||||
|
financingGranted?: '' | 'yes' | 'no';
|
||||||
|
bilateralAgreement?: '' | 'yes' | 'no';
|
||||||
|
institutionReference?: string;
|
||||||
|
financingReference?: string;
|
||||||
|
agreementReference?: string;
|
||||||
|
|
||||||
governmentPayer?: '' | 'state' | 'subdivision' | 'local';
|
governmentPayer?: '' | 'state' | 'subdivision' | 'local';
|
||||||
governmentPayerReference?: string;
|
governmentPayerReference?: string;
|
||||||
capitalDefinition?: '' | 'yes' | 'no';
|
capitalDefinition?: '' | 'yes' | 'no';
|
||||||
@@ -253,6 +261,41 @@ export function validateInternational(c: InternationalCredits) {
|
|||||||
(p.treatyPreparation?.governmentPayerReference !== undefined &&
|
(p.treatyPreparation?.governmentPayerReference !== undefined &&
|
||||||
typeof p.treatyPreparation.governmentPayerReference !==
|
typeof p.treatyPreparation.governmentPayerReference !==
|
||||||
'string') ||
|
'string') ||
|
||||||
|
(p.treatyPreparation?.governmentBasis !== undefined &&
|
||||||
|
!['', 'payer', 'agreement'].includes(
|
||||||
|
p.treatyPreparation.governmentBasis,
|
||||||
|
)) ||
|
||||||
|
(p.treatyPreparation &&
|
||||||
|
[
|
||||||
|
'institutionRecipient',
|
||||||
|
'financingGranted',
|
||||||
|
'bilateralAgreement',
|
||||||
|
].some((k) => {
|
||||||
|
const v = (
|
||||||
|
p.treatyPreparation as unknown as Record<
|
||||||
|
string,
|
||||||
|
unknown
|
||||||
|
>
|
||||||
|
)[k];
|
||||||
|
return (
|
||||||
|
v !== undefined &&
|
||||||
|
(typeof v !== 'string' || !yesNo.includes(v))
|
||||||
|
);
|
||||||
|
})) ||
|
||||||
|
(p.treatyPreparation &&
|
||||||
|
[
|
||||||
|
'institutionReference',
|
||||||
|
'financingReference',
|
||||||
|
'agreementReference',
|
||||||
|
].some((k) => {
|
||||||
|
const v = (
|
||||||
|
p.treatyPreparation as unknown as Record<
|
||||||
|
string,
|
||||||
|
unknown
|
||||||
|
>
|
||||||
|
)[k];
|
||||||
|
return v !== undefined && typeof v !== 'string';
|
||||||
|
})) ||
|
||||||
!evidenceValid(p.previousUse) ||
|
!evidenceValid(p.previousUse) ||
|
||||||
!Array.isArray(p.payments)
|
!Array.isArray(p.payments)
|
||||||
)
|
)
|
||||||
@@ -417,20 +460,53 @@ export function ptMzTreatyLimit(p: InternationalPosition) {
|
|||||||
throw Error(
|
throw Error(
|
||||||
'Definição convencional de dividendos/juros por documentar.',
|
'Definição convencional de dividendos/juros por documentar.',
|
||||||
);
|
);
|
||||||
let governmentExemption: {
|
let governmentExemption:
|
||||||
payer: 'state' | 'subdivision' | 'local';
|
| { payer: 'state' | 'subdivision' | 'local'; reference: string }
|
||||||
reference: string;
|
| {
|
||||||
} | null = null;
|
basis: 'agreement';
|
||||||
|
recipient: 'institution';
|
||||||
|
reference: string;
|
||||||
|
financingReference: string;
|
||||||
|
agreementReference: string;
|
||||||
|
}
|
||||||
|
| null = null;
|
||||||
if (p.treatyMethod === 'ptMzInterest') {
|
if (p.treatyMethod === 'ptMzInterest') {
|
||||||
if (q.governmentInterestExemption === 'yes') {
|
if (q.governmentInterestExemption === 'yes') {
|
||||||
if (!q.governmentPayer || !q.governmentPayerReference?.trim())
|
if (q.governmentBasis === 'agreement') {
|
||||||
|
if (
|
||||||
|
q.institutionRecipient !== 'yes' ||
|
||||||
|
q.financingGranted !== 'yes' ||
|
||||||
|
q.bilateralAgreement !== 'yes' ||
|
||||||
|
!q.institutionReference?.trim() ||
|
||||||
|
!q.financingReference?.trim() ||
|
||||||
|
!q.agreementReference?.trim()
|
||||||
|
)
|
||||||
|
throw Error(
|
||||||
|
'Art11(3)b: instituição/organismo beneficiário corrente, financiamento por ele concedido e acordo entre os governos PT–MZ exigem correspondência documental própria.',
|
||||||
|
);
|
||||||
|
governmentExemption = {
|
||||||
|
basis: 'agreement',
|
||||||
|
recipient: 'institution',
|
||||||
|
reference: q.institutionReference,
|
||||||
|
financingReference: q.financingReference,
|
||||||
|
agreementReference: q.agreementReference,
|
||||||
|
};
|
||||||
|
} else if (
|
||||||
|
q.governmentBasis === undefined ||
|
||||||
|
q.governmentBasis === 'payer'
|
||||||
|
) {
|
||||||
|
if (!q.governmentPayer || !q.governmentPayerReference?.trim())
|
||||||
|
throw Error(
|
||||||
|
'Isenção11(3)a exige devedor Estado português/subdivisão/autarquia documentado; para11(3)b escolha e documente o fundamento próprio.',
|
||||||
|
);
|
||||||
|
governmentExemption = {
|
||||||
|
payer: q.governmentPayer,
|
||||||
|
reference: q.governmentPayerReference,
|
||||||
|
};
|
||||||
|
} else
|
||||||
throw Error(
|
throw Error(
|
||||||
'Isenção11(3)a exige devedor documentado: Estado português, subdivisão política/administrativa ou autarquia; beneficiários/acordos11(3)b permanecem separados.',
|
'Escolha o fundamento da isenção; uma selecção limpa não reutiliza a decisão anterior.',
|
||||||
);
|
);
|
||||||
governmentExemption = {
|
|
||||||
payer: q.governmentPayer,
|
|
||||||
reference: q.governmentPayerReference,
|
|
||||||
};
|
|
||||||
} else if (q.governmentInterestExemption !== 'no')
|
} else if (q.governmentInterestExemption !== 'no')
|
||||||
throw Error(
|
throw Error(
|
||||||
'Corresponda a aplicação ou não aplicação da isenção11(3); desconhecido não significa limite ordinário10%.',
|
'Corresponda a aplicação ou não aplicação da isenção11(3); desconhecido não significa limite ordinário10%.',
|
||||||
@@ -455,7 +531,9 @@ export function ptMzTreatyLimit(p: InternationalPosition) {
|
|||||||
);
|
);
|
||||||
return {
|
return {
|
||||||
version: governmentExemption
|
version: governmentExemption
|
||||||
? 'IRPC-PT-MZ-government-interest/1'
|
? 'basis' in governmentExemption
|
||||||
|
? 'IRPC-PT-MZ-agreement-interest/1'
|
||||||
|
: 'IRPC-PT-MZ-government-interest/1'
|
||||||
: p.treatyMethod === 'ptMzRoyalty'
|
: p.treatyMethod === 'ptMzRoyalty'
|
||||||
? 'IRPC-PT-MZ-royalty-credit/1'
|
? 'IRPC-PT-MZ-royalty-credit/1'
|
||||||
: 'IRPC-PT-MZ-capital-credit/1',
|
: 'IRPC-PT-MZ-capital-credit/1',
|
||||||
@@ -473,13 +551,22 @@ export function ptMzTreatyLimit(p: InternationalPosition) {
|
|||||||
to: q.to,
|
to: q.to,
|
||||||
reference: governmentExemption
|
reference: governmentExemption
|
||||||
? q.reference +
|
? q.reference +
|
||||||
'; devedor ' +
|
('payer' in governmentExemption
|
||||||
governmentExemption.payer +
|
? '; devedor ' +
|
||||||
'; ' +
|
governmentExemption.payer +
|
||||||
governmentExemption.reference
|
'; ' +
|
||||||
|
governmentExemption.reference
|
||||||
|
: '; instituição ' +
|
||||||
|
governmentExemption.reference +
|
||||||
|
'; financiamento ' +
|
||||||
|
governmentExemption.financingReference +
|
||||||
|
'; acordo PT–MZ ' +
|
||||||
|
governmentExemption.agreementReference)
|
||||||
: q.reference,
|
: q.reference,
|
||||||
source: governmentExemption
|
source: governmentExemption
|
||||||
? 'CDT PT–MZ, RAR36/1992 art11(3)a,PDF11, e23(3)a,PDF21; CIRPC65(2). Devedor Estado português/subdivisão/autarquia documentado. Juros isentos no Estado da fonte; limite convencional zero, sem crédito ou reembolso do imposto indevidamente pago pelo portal. Art11(3)b e demais situações permanecem separados.'
|
? 'basis' in governmentExemption
|
||||||
|
? 'CDT PT–MZ, RAR36/1992 art11(3)b,PDF11, e23(3)a,PDF21; CIRPC65(2). Instituição/organismo beneficiário corrente, financiamento por ele concedido no âmbito de acordo entre governos PT–MZ documentados. Juros isentos na fonte, limite0; não gera crédito ou reembolso no portal de imposto pago em desconformidade. Outros beneficiários/regimes mantêm correspondência própria.'
|
||||||
|
: 'CDT PT–MZ, RAR36/1992 art11(3)a,PDF11, e23(3)a,PDF21; CIRPC65(2). Devedor Estado português/subdivisão/autarquia documentado. Juros isentos no Estado da fonte; limite convencional zero, sem crédito ou reembolso do imposto indevidamente pago pelo portal. Art11(3)b e demais situações permanecem separados.'
|
||||||
: p.treatyMethod === 'ptMzRoyalty'
|
: p.treatyMethod === 'ptMzRoyalty'
|
||||||
? 'CDT PT–MZ, RAR36/1992 art12(2/4–6),PDF13–14 e23(3)a,PDF21; Protocolo RAR36/2009 arts1/7,PDF1–2; CIRPC65(2). Royalties ordinárias não digitais, sem EP/instalação fixa ligada nem excesso por relações especiais. Não confundir com retenção L5 paga por devedor moçambicano; sem isenção ou tax sparing presumidos.'
|
? 'CDT PT–MZ, RAR36/1992 art12(2/4–6),PDF13–14 e23(3)a,PDF21; Protocolo RAR36/2009 arts1/7,PDF1–2; CIRPC65(2). Royalties ordinárias não digitais, sem EP/instalação fixa ligada nem excesso por relações especiais. Não confundir com retenção L5 paga por devedor moçambicano; sem isenção ou tax sparing presumidos.'
|
||||||
: 'CDT PT–MZ, RAR36/1992 art23(3)a,PDF21; CIRPC65(2). ' +
|
: 'CDT PT–MZ, RAR36/1992 art23(3)a,PDF21; CIRPC65(2). ' +
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Feature;
|
||||||
|
|
||||||
|
use App\Models\User;
|
||||||
|
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
use Tests\TestCase;
|
||||||
|
|
||||||
|
final class IrpcPtMzAgreementDraftTest extends TestCase
|
||||||
|
{
|
||||||
|
use DatabaseTransactions;
|
||||||
|
|
||||||
|
public function test_agreement_pt_mz_credit_uses_the_existing_private_draft_writer(): void
|
||||||
|
{
|
||||||
|
$target = DB::selectOne('select current_database() as name,inet_server_port() as port');
|
||||||
|
$this->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));
|
||||||
|
$d = json_decode(file_get_contents(base_path('outputs/irpc-pt-mz-agreement-20261110/fixture.json')), true, flags: JSON_THROW_ON_ERROR);
|
||||||
|
$personal = ['person_type' => $d['person_type']];
|
||||||
|
unset($d['person_type']);
|
||||||
|
$id = $this->postJson('/api/v1/simulation-drafts', ['personal_snapshot' => $personal, 'economic_snapshot' => $d], ['Idempotency-Key' => (string) Str::uuid()])->assertCreated()->json('data.id');
|
||||||
|
$back = $this->getJson('/api/v1/simulation-drafts/'.$id)->assertOk()->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('ptMzInterest', $b['internationalCredits']['positions'][0]['treatyMethod']);
|
||||||
|
$this->assertSame(['numerator' => '0', 'denominator' => '1'], $b['result']['model']['internationalCredit']['positions'][0]['treatyLimit']);
|
||||||
|
$this->assertSame(['numerator' => '708', 'denominator' => '1'], $b['result']['model']['arithmeticBalance']);
|
||||||
|
$this->assertSame('agreement', $b['result']['model']['internationalCredit']['positions'][0]['treatyDerivation']['governmentExemption']['basis']);
|
||||||
|
file_put_contents(base_path('outputs/irpc-pt-mz-agreement-20261110/recovered.json'), json_encode($back, JSON_THROW_ON_ERROR | JSON_UNESCAPED_UNICODE));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,127 @@
|
|||||||
|
import test from 'node:test';
|
||||||
|
import assert from 'node:assert/strict';
|
||||||
|
import { internationalCase } from './helpers/irpc-international-case.mjs';
|
||||||
|
import { newPtMzRoyaltyPreparation } from '../../resources/js/lib/irpc-international-credit.ts';
|
||||||
|
import {
|
||||||
|
calculateAnnual,
|
||||||
|
recordAnnual,
|
||||||
|
saveAnnualBook,
|
||||||
|
annualBook,
|
||||||
|
annualCurrent,
|
||||||
|
annualHtml,
|
||||||
|
} from '../../resources/js/lib/irpc-annual-settlement.ts';
|
||||||
|
import { createProjectDossierReport } from '../../resources/js/lib/project-dossier-report.ts';
|
||||||
|
function agreementCase() {
|
||||||
|
const c = internationalCase();
|
||||||
|
Object.assign(c.b.internationalCredits.positions[0], {
|
||||||
|
country: 'PT',
|
||||||
|
qualificationCountry: 'PT',
|
||||||
|
incomeAmount: '40',
|
||||||
|
treaty: 'yes',
|
||||||
|
treatyMethod: 'ptMzInterest',
|
||||||
|
treatyReference: 'SYNTHETIC QA explicit PT-MZ11(3)b/23(3)a scope',
|
||||||
|
treatyPreparation: {
|
||||||
|
...newPtMzRoyaltyPreparation(),
|
||||||
|
gross: '60',
|
||||||
|
from: '2026-01-01',
|
||||||
|
to: '2026-12-31',
|
||||||
|
reference: 'SYNTHETIC residence and interest contract conditions',
|
||||||
|
residentMz: 'yes',
|
||||||
|
beneficialOwner: 'yes',
|
||||||
|
sourcePortugal: 'yes',
|
||||||
|
payerResidentPt: 'yes',
|
||||||
|
noLinkedEstablishment: 'yes',
|
||||||
|
armLength: 'yes',
|
||||||
|
capitalDefinition: 'yes',
|
||||||
|
governmentInterestExemption: 'yes',
|
||||||
|
governmentBasis: 'agreement',
|
||||||
|
institutionRecipient: 'yes',
|
||||||
|
financingGranted: 'yes',
|
||||||
|
bilateralAgreement: 'yes',
|
||||||
|
institutionReference:
|
||||||
|
'SYNTHETIC current subject123456789 is qualifying institution',
|
||||||
|
financingReference:
|
||||||
|
'SYNTHETIC financing granted by this institution and linked to interest',
|
||||||
|
agreementReference:
|
||||||
|
'SYNTHETIC PT-MZ intergovernmental agreement and applicable financing clause',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
void test('qualified institution financing under a PT-MZ governmental agreement gives zero source tax cap without altering L6', () => {
|
||||||
|
const c = agreementCase(),
|
||||||
|
before = c.d.modelo_a_snapshot,
|
||||||
|
m = calculateAnnual(c.d, c.b),
|
||||||
|
p = m.internationalCredit.positions[0];
|
||||||
|
assert.deepEqual(m.pending, []);
|
||||||
|
assert.deepEqual(p.treatyLimit, { numerator: '0', denominator: '1' });
|
||||||
|
assert.equal(p.treatyDerivation.governmentExemption.basis, 'agreement');
|
||||||
|
assert.deepEqual(p.aboveLimit, { numerator: '10', denominator: '1' });
|
||||||
|
assert.deepEqual(m.arithmeticBalance, {
|
||||||
|
numerator: '708',
|
||||||
|
denominator: '1',
|
||||||
|
});
|
||||||
|
assert.equal(m.internationalCredit.officialBalancesConsumed, false);
|
||||||
|
assert.equal(c.d.modelo_a_snapshot, before);
|
||||||
|
});
|
||||||
|
void test('institution identity alone does not prove a qualifying financing or governmental agreement', () => {
|
||||||
|
for (const patch of [
|
||||||
|
{ institutionRecipient: '' },
|
||||||
|
{ financingGranted: '' },
|
||||||
|
{ bilateralAgreement: 'no' },
|
||||||
|
{ institutionReference: '' },
|
||||||
|
{ financingReference: '' },
|
||||||
|
{ agreementReference: '' },
|
||||||
|
{ governmentBasis: '' },
|
||||||
|
]) {
|
||||||
|
const c = agreementCase();
|
||||||
|
Object.assign(
|
||||||
|
c.b.internationalCredits.positions[0].treatyPreparation,
|
||||||
|
patch,
|
||||||
|
);
|
||||||
|
assert.equal(calculateAnnual(c.d, c.b).arithmeticBalance, null);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
void test('changing or clearing the basis preserves the old result but cannot reuse the former exemption', () => {
|
||||||
|
const c = agreementCase(),
|
||||||
|
book = recordAnnual(c.d, c.b, '2026-11-10T18:20:00+02:00'),
|
||||||
|
old = structuredClone(book.result);
|
||||||
|
Object.assign(book.internationalCredits.positions[0].treatyPreparation, {
|
||||||
|
governmentBasis: '',
|
||||||
|
governmentPayer: 'state',
|
||||||
|
governmentPayerReference:
|
||||||
|
'SYNTHETIC previous public-payer classification',
|
||||||
|
});
|
||||||
|
assert.equal(annualCurrent(c.d, book), false);
|
||||||
|
assert.equal(calculateAnnual(c.d, book).arithmeticBalance, null);
|
||||||
|
assert.deepEqual(book.result, old);
|
||||||
|
});
|
||||||
|
void test('agreement qualification and both documentary links survive recovery and reach both report consumers', () => {
|
||||||
|
const c = agreementCase(),
|
||||||
|
book = recordAnnual(c.d, c.b, '2026-11-10T18:20:00+02:00'),
|
||||||
|
d = JSON.parse(
|
||||||
|
JSON.stringify({
|
||||||
|
...c.d,
|
||||||
|
modelo_a_snapshot: saveAnnualBook(c.d, book),
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
back = annualBook(d);
|
||||||
|
assert.equal(annualCurrent(d, back), true);
|
||||||
|
assert.deepEqual(
|
||||||
|
calculateAnnual(d, back).internationalCredit,
|
||||||
|
back.result.model.internationalCredit,
|
||||||
|
);
|
||||||
|
const html = annualHtml(d);
|
||||||
|
assert.match(html, /IRPC-PT-MZ-agreement-interest\/1/);
|
||||||
|
assert.match(html, /SYNTHETIC financing granted/);
|
||||||
|
assert.match(html, /SYNTHETIC PT-MZ intergovernmental agreement/);
|
||||||
|
assert.match(
|
||||||
|
JSON.stringify(
|
||||||
|
createProjectDossierReport(d, {
|
||||||
|
selectedSections: new Set(['finance']),
|
||||||
|
generatedAt: '2026-11-10T18:20:00+02:00',
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
/IRPC-PT-MZ-agreement-interest\/1/,
|
||||||
|
);
|
||||||
|
});
|
||||||
@@ -18,7 +18,7 @@ $identity = $pdo->query('select current_database() as name,inet_server_port() as
|
|||||||
if ($identity['name'] !== 'proactive_investment_20261027_test' || (int) $identity['port'] !== 55441) {
|
if ($identity['name'] !== 'proactive_investment_20261027_test' || (int) $identity['port'] !== 55441) {
|
||||||
throw new RuntimeException('Isolated QA identity required.');
|
throw new RuntimeException('Isolated QA identity required.');
|
||||||
}
|
}
|
||||||
$case = ['quota' => 'IrpcEconomicQuotaDraftTest', 'inclusion' => 'IrpcEconomicInclusionDraftTest', 'liquidation' => 'IrpcEconomicLiquidationDraftTest', 'association' => 'IrpcEconomicAssociationDraftTest', 'special-inclusion' => 'IrpcEconomicSpecialInclusionDraftTest', 'pt-royalty' => 'IrpcPtMzCreditDraftTest', 'pt-capital' => 'IrpcPtMzCapitalDraftTest', 'pt-government' => 'IrpcPtMzGovernmentDraftTest', 'economic-fraction' => 'IrpcEconomicFractionDraftTest'][$argv[2] ?? ''] ?? throw new RuntimeException('Choose an explicit supported QA case.');
|
$case = ['quota' => 'IrpcEconomicQuotaDraftTest', 'inclusion' => 'IrpcEconomicInclusionDraftTest', 'liquidation' => 'IrpcEconomicLiquidationDraftTest', 'association' => 'IrpcEconomicAssociationDraftTest', 'special-inclusion' => 'IrpcEconomicSpecialInclusionDraftTest', 'pt-royalty' => 'IrpcPtMzCreditDraftTest', 'pt-capital' => 'IrpcPtMzCapitalDraftTest', 'pt-government' => 'IrpcPtMzGovernmentDraftTest', 'economic-fraction' => 'IrpcEconomicFractionDraftTest', 'pt-agreement' => 'IrpcPtMzAgreementDraftTest'][$argv[2] ?? ''] ?? throw new RuntimeException('Choose an explicit supported QA case.');
|
||||||
$argv = ['phpunit', '-c', 'phpunit.investmoz.xml', '--do-not-cache-result', 'tests/Feature/'.$case.'.php'];
|
$argv = ['phpunit', '-c', 'phpunit.investmoz.xml', '--do-not-cache-result', 'tests/Feature/'.$case.'.php'];
|
||||||
$argc = count($argv);
|
$argc = count($argv);
|
||||||
$_SERVER['argv'] = $argv;
|
$_SERVER['argv'] = $argv;
|
||||||
|
|||||||
@@ -3,17 +3,18 @@ import fs from 'node:fs';
|
|||||||
import { internationalCase } from '../tests/frontend/helpers/irpc-international-case.mjs';
|
import { internationalCase } from '../tests/frontend/helpers/irpc-international-case.mjs';
|
||||||
import { recordAnnual, saveAnnualBook, annualBook, calculateAnnual, annualHtml } from '../resources/js/lib/irpc-annual-settlement.ts';
|
import { recordAnnual, saveAnnualBook, annualBook, calculateAnnual, annualHtml } from '../resources/js/lib/irpc-annual-settlement.ts';
|
||||||
import assert from 'node:assert/strict';
|
import assert from 'node:assert/strict';
|
||||||
const government = process.argv.includes('government');
|
const agreement = process.argv.includes('agreement');
|
||||||
|
const government = agreement || process.argv.includes('government');
|
||||||
const capital = government ? 'interest' : ['dividend','interest'].find(k=>process.argv.includes(k));
|
const capital = government ? 'interest' : ['dividend','interest'].find(k=>process.argv.includes(k));
|
||||||
const out = new URL(government ? '../outputs/irpc-pt-mz-government-20261110/' : capital ? '../outputs/irpc-pt-mz-'+capital+'-20261110/' : '../outputs/irpc-pt-mz-credit-20261110/', import.meta.url);
|
const out = new URL(agreement ? '../outputs/irpc-pt-mz-agreement-20261110/' : government ? '../outputs/irpc-pt-mz-government-20261110/' : capital ? '../outputs/irpc-pt-mz-'+capital+'-20261110/' : '../outputs/irpc-pt-mz-credit-20261110/', import.meta.url);
|
||||||
fs.mkdirSync(out, { recursive: true });
|
fs.mkdirSync(out, { recursive: true });
|
||||||
if (process.argv[2] === 'recovered') {
|
if (process.argv[2] === 'recovered') {
|
||||||
const d = JSON.parse(fs.readFileSync(new URL('recovered.json', out), 'utf8'));
|
const d = JSON.parse(fs.readFileSync(new URL('recovered.json', out), 'utf8'));
|
||||||
const b = annualBook(d), m = b.result.model;
|
const b = annualBook(d), m = b.result.model;
|
||||||
assert.deepEqual(calculateAnnual(d, b).internationalCredit, m.internationalCredit);
|
assert.deepEqual(calculateAnnual(d, b).internationalCredit, m.internationalCredit);
|
||||||
const html = annualHtml(d);assert.match(html, /IRPC-PT-MZ-(royalty-credit|capital-credit|government-interest)\/1/);
|
const html = annualHtml(d);assert.match(html, /IRPC-PT-MZ-(royalty-credit|capital-credit|government-interest|agreement-interest)\/1/);
|
||||||
const report=createProjectDossierReport(d,{selectedSections:new Set(['finance']),generatedAt:'2026-11-10T17:10:00+02:00'});
|
const report=createProjectDossierReport(d,{selectedSections:new Set(['finance']),generatedAt:'2026-11-10T17:10:00+02:00'});
|
||||||
assert.match(JSON.stringify(report),/IRPC-PT-MZ-(royalty-credit|capital-credit|government-interest)\/1/);
|
assert.match(JSON.stringify(report),/IRPC-PT-MZ-(royalty-credit|capital-credit|government-interest|agreement-interest)\/1/);
|
||||||
fs.writeFileSync(new URL('report.html', out), html);
|
fs.writeFileSync(new URL('report.html', out), html);
|
||||||
fs.writeFileSync(new URL('verification.json', out), JSON.stringify({ synthetic: true, apiRecovered: true, dossierReport: true, currentRecalculation: true, html: true, quota: m.internationalCredit.positions[0].treatyLimit, balance: m.arithmeticBalance, activeChanged: false }, null, 2));
|
fs.writeFileSync(new URL('verification.json', out), JSON.stringify({ synthetic: true, apiRecovered: true, dossierReport: true, currentRecalculation: true, html: true, quota: m.internationalCredit.positions[0].treatyLimit, balance: m.arithmeticBalance, activeChanged: false }, null, 2));
|
||||||
} else {
|
} else {
|
||||||
@@ -21,6 +22,7 @@ if (process.argv[2] === 'recovered') {
|
|||||||
Object.assign(c.b.internationalCredits.positions[0],{country:'PT',qualificationCountry:'PT',incomeAmount:'40',treaty:'yes',treatyMethod:'ptMzRoyalty',treatyReference:'SYNTHETIC QA qualified PT-MZ12/23(3)a ordinary royalties',treatyPreparation:{gross:'60',from:'2026-01-01',to:'2026-12-31',reference:'SYNTHETIC QA residence certificate and royalty agreement covering conditions',residentMz:'yes',beneficialOwner:'yes',sourcePortugal:'yes',payerResidentPt:'yes',noLinkedEstablishment:'yes',armLength:'yes',royaltyDefinition:'yes',nonDigital:'yes'}});
|
Object.assign(c.b.internationalCredits.positions[0],{country:'PT',qualificationCountry:'PT',incomeAmount:'40',treaty:'yes',treatyMethod:'ptMzRoyalty',treatyReference:'SYNTHETIC QA qualified PT-MZ12/23(3)a ordinary royalties',treatyPreparation:{gross:'60',from:'2026-01-01',to:'2026-12-31',reference:'SYNTHETIC QA residence certificate and royalty agreement covering conditions',residentMz:'yes',beneficialOwner:'yes',sourcePortugal:'yes',payerResidentPt:'yes',noLinkedEstablishment:'yes',armLength:'yes',royaltyDefinition:'yes',nonDigital:'yes'}});
|
||||||
if(capital) {const p=c.b.internationalCredits.positions[0];p.treatyMethod=capital==='dividend'?'ptMzDividend':'ptMzInterest';p.treatyReference='SYNTHETIC QA explicit PT-MZ article'+(capital==='dividend'?'10 updated2009':'11 ordinary non-governmental')+'/23(3)a qualification';p.treatyPreparation.reference='SYNTHETIC QA residence certificate and '+capital+' contract, source and conditions documented';Object.assign(p.treatyPreparation,{capitalDefinition:'yes',governmentInterestExemption:'no'});}
|
if(capital) {const p=c.b.internationalCredits.positions[0];p.treatyMethod=capital==='dividend'?'ptMzDividend':'ptMzInterest';p.treatyReference='SYNTHETIC QA explicit PT-MZ article'+(capital==='dividend'?'10 updated2009':'11 ordinary non-governmental')+'/23(3)a qualification';p.treatyPreparation.reference='SYNTHETIC QA residence certificate and '+capital+' contract, source and conditions documented';Object.assign(p.treatyPreparation,{capitalDefinition:'yes',governmentInterestExemption:'no'});}
|
||||||
if(government){const p=c.b.internationalCredits.positions[0];p.treatyReference='SYNTHETIC QA PT-MZ11(3)a and23(3)a';Object.assign(p.treatyPreparation,{governmentInterestExemption:'yes',governmentPayer:'state',governmentPayerReference:'SYNTHETIC Portuguese state is actual payer of documented interest'});}
|
if(government){const p=c.b.internationalCredits.positions[0];p.treatyReference='SYNTHETIC QA PT-MZ11(3)a and23(3)a';Object.assign(p.treatyPreparation,{governmentInterestExemption:'yes',governmentPayer:'state',governmentPayerReference:'SYNTHETIC Portuguese state is actual payer of documented interest'});}
|
||||||
|
if(agreement){const p=c.b.internationalCredits.positions[0];p.treatyReference='SYNTHETIC QA explicit PT-MZ11(3)b/23(3)a';Object.assign(p.treatyPreparation,{governmentBasis:'agreement',governmentPayer:'',governmentPayerReference:'',institutionRecipient:'yes',financingGranted:'yes',bilateralAgreement:'yes',institutionReference:'SYNTHETIC current subject123456789 qualifying institution',financingReference:'SYNTHETIC financing granted by this institution, linked to interest',agreementReference:'SYNTHETIC PT-MZ governmental agreement and financing clause'});}
|
||||||
const b = recordAnnual(c.d, c.b, '2026-11-10T14:00:00+02:00');
|
const b = recordAnnual(c.d, c.b, '2026-11-10T14:00:00+02:00');
|
||||||
fs.writeFileSync(new URL('fixture.json', out), JSON.stringify({ ...c.d, modelo_a_snapshot: saveAnnualBook(c.d, b) }));
|
fs.writeFileSync(new URL('fixture.json', out), JSON.stringify({ ...c.d, modelo_a_snapshot: saveAnnualBook(c.d, b) }));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user