Conferir no ano novo pagamentos do exercício anterior
Decisão de 01/12/2026: o registo e a conferência de pagamentos externos aceitam o exercício actual ou o anterior, mantendo a data original. Pagamentos mais antigos continuam recusados. Sem efeito no orçamento. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -68,7 +68,7 @@ test('invalid dates amounts and bank versions cannot register a payment', functi
|
||||
'negative' => $this->data['amount'] = '-1.00',
|
||||
'future' => $this->data['paid_on'] = today()->addDay()->format('Y-m-d'),
|
||||
'before_invoice' => $this->data['paid_on'] = today()->subDay()->format('Y-m-d'),
|
||||
'old_year' => $this->data['paid_on'] = today()->subYear()->format('Y-m-d'),
|
||||
'old_year' => $this->data['paid_on'] = today()->subYears(2)->format('Y-m-d'),
|
||||
'bank' => $this->data['supplier_bank_detail_id'] = PHP_INT_MAX,
|
||||
'reference' => $this->data['external_reference'] = ' ',
|
||||
'evidence' => $this->data['evidence_reference'] = ' ',
|
||||
@@ -113,6 +113,28 @@ test('loss of reviewer eligibility or supplier eligibility blocks confirmation',
|
||||
expect(fn () => confirmTestPayment($this, $payment))->toThrow(ValidationException::class);
|
||||
})->with(['reviewer', 'supplier']);
|
||||
|
||||
test('a payment from the previous year can still be registered and confirmed in the new year', function () {
|
||||
$payment = registerTestPayment($this);
|
||||
$paidOn = $this->data['paid_on'];
|
||||
$this->travelTo(now()->addYear()->startOfYear()->addDay());
|
||||
confirmTestPayment($this, $payment);
|
||||
expect($payment->refresh()->status)->toBe('confirmed')->and((string) $payment->paid_on)->toStartWith($paidOn);
|
||||
|
||||
$this->data['external_reference'] = 'TEST-EXT-NOVO-ANO';
|
||||
$this->data['amount'] = '10.00';
|
||||
$late = registerTestPayment($this);
|
||||
confirmTestPayment($this, $late);
|
||||
expect($late->refresh()->status)->toBe('confirmed')
|
||||
->and(app(ExternalPaymentWorkflow::class)->outstanding($this->f['invoice']->refresh()))->toBe(1000);
|
||||
});
|
||||
|
||||
test('payments older than the previous year cannot be confirmed', function () {
|
||||
$payment = registerTestPayment($this);
|
||||
$this->travelTo(now()->addYears(2)->startOfYear());
|
||||
expect(fn () => confirmTestPayment($this, $payment))->toThrow(ValidationException::class);
|
||||
expect($payment->refresh()->status)->toBe('pending');
|
||||
});
|
||||
|
||||
test('rejected evidence leaves invoice outstanding and decision cannot be changed', function () {
|
||||
$payment = registerTestPayment($this);
|
||||
confirmTestPayment($this, $payment, 'rejected');
|
||||
|
||||
Reference in New Issue
Block a user