Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ join application in applicationsQuery on submission.ApplicationId equals applica
dto.Payments.AddRange(paymentDetails.Select(p => new PaymentInfoItemDto
{
Id = p.Id,
PaymentNumber = p.PaymentNumber ?? string.Empty,
PaymentNumber = p.InvoiceNumber,
ReferenceNo = applicationLookup.TryGetValue(p.CorrelationId, out var refNo) ? refNo : string.Empty,
Amount = p.Amount,
PaymentDate = p.PaymentDate,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ private static Application CreateApplication(Guid id, string referenceNo = "")
return entity;
}

private static PaymentRequest CreatePaymentRequest(Guid correlationId, decimal amount = 1000m)
private static PaymentRequest CreatePaymentRequest(Guid correlationId, decimal amount = 1000m, string invoiceNumber = "INV-001")
{
var siteId = Guid.NewGuid();
var dto = new CreatePaymentRequestDto
{
InvoiceNumber = "INV-001",
InvoiceNumber = invoiceNumber,
Amount = amount,
PayeeName = "Test Payee",
ContractNumber = "C-001",
Expand Down Expand Up @@ -169,7 +169,6 @@ public async Task GetDataAsync_ShouldMapPaymentFields()
var applicationId = Guid.NewGuid();

var payment = CreatePaymentRequest(applicationId, 5000m);
payment.SetPaymentNumber("PAY-100");
payment.SetPaymentDate("15-Jan-2025");
payment.SetPaymentRequestStatus(PaymentRequestStatus.Paid);

Expand All @@ -184,7 +183,7 @@ public async Task GetDataAsync_ShouldMapPaymentFields()
dto.Payments.Count.ShouldBe(1);

var item = dto.Payments[0];
item.PaymentNumber.ShouldBe("PAY-100");
item.PaymentNumber.ShouldBe("INV-001");
item.ReferenceNo.ShouldBe("REF-001");
item.Amount.ShouldBe(5000m);
item.PaymentDate.ShouldBe("2025-01-15");
Expand Down Expand Up @@ -277,12 +276,12 @@ public async Task GetDataAsync_ShouldNotReturnPaymentsForOtherSubjects()
}

[Fact]
public async Task GetDataAsync_ShouldHandleNullPaymentNumber()
public async Task GetDataAsync_ShouldHandleEmptyInvoiceNumber()
{
var request = CreateRequest();
var applicationId = Guid.NewGuid();

var payment = CreatePaymentRequest(applicationId);
var payment = CreatePaymentRequest(applicationId, invoiceNumber: string.Empty);

SetupQueryables(
[CreateSubmission(applicationId, "TESTUSER")],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ flowchart LR
| DTO Field | Source | Type | Description |
|-----------|--------|------|-------------|
| `Id` | `PaymentRequest.Id` | `Guid` | Payment request identifier |
| `PaymentNumber` | `PaymentRequest.PaymentNumber` | `string` | CAS payment number (empty string if null) |
| `PaymentNumber` | `PaymentRequest.InvoiceNumber` | `string` | CAS invoice number (empty string if null) |
Comment thread
AndreGAot marked this conversation as resolved.
| `ReferenceNo` | `Application.ReferenceNo` | `string` | Application reference number, resolved via `CorrelationId → Application` lookup |
| `Amount` | `PaymentRequest.Amount` | `decimal` | Requested payment amount |
| `PaymentDate` | `PaymentRequest.PaymentDate` | `string?` | Date string populated during CAS reconciliation |
Expand Down
Loading