feat: implement BankFlow loan workflow API endpoints

This commit is contained in:
m.ebrahimi committed 2026-07-22 17:31:18 +03:30
1 parent 56a52be180
commit 7824e8f015
43 files changed
+1403 -10

No files matched your search

+28
View File
@@ -0,0 +1,28 @@
<?php
use Database\Seeders\BankFlowSeeder;
beforeEach(function () {
$this->seed(BankFlowSeeder::class);
});
it('returns unwrapped history in deterministic chronological order', function () {
$loanId = $this->postJson('/api/v1/loans', validLoanPayload())->json('loanId');
$this->postJson("/api/v1/loans/{$loanId}/process")->assertSuccessful();
$this->getJson("/api/v1/loans/{$loanId}/history")
->assertSuccessful()
->assertJsonCount(3)
->assertJsonPath('0.stage', 'VALIDATION')
->assertJsonPath('1.stage', 'FRAUD_CHECK')
->assertJsonPath('2.stage', 'CREDIT_CHECK')
->assertJsonStructure([
'*' => ['stage', 'result', 'timestamp', 'reason'],
]);
});
it('returns the documented error for an unknown loan', function () {
$this->getJson('/api/v1/loans/L-UNKNOWN/history')
->assertNotFound()
->assertExactJson(['error' => 'LOAN_NOT_FOUND']);
});