mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-26 18:42:49 +00:00
fix(cbe): update response for settled transactions to indicate Already paid
This commit is contained in:
@@ -129,7 +129,6 @@ describe("CBE Unified Bill (payment service as biller)", () => {
|
||||
});
|
||||
|
||||
let settleBody: Record<string, string>;
|
||||
let settledTxnRef: string;
|
||||
|
||||
it("settles the freight invoice when CBE reports the debit", async () => {
|
||||
const invoice = await currentInvoice(invoiceId);
|
||||
@@ -147,7 +146,6 @@ describe("CBE Unified Bill (payment service as biller)", () => {
|
||||
const res = await cbe(token, "/cbe/payment", settleBody);
|
||||
expect(res.status).toBe(200);
|
||||
expect(res.body.Response_Code).toBe("0");
|
||||
settledTxnRef = res.body.Destination_Txn_Ref;
|
||||
|
||||
const paid = await poll<{ status: string }>(
|
||||
"invoice PAID via CBE bill",
|
||||
@@ -159,22 +157,22 @@ describe("CBE Unified Bill (payment service as biller)", () => {
|
||||
expect(paid.status).toBe("PAID");
|
||||
});
|
||||
|
||||
it("replays the stored success when CBE retries the same attempt verbatim", async () => {
|
||||
it("answers 'Already paid' when the settled attempt is sent again verbatim", async () => {
|
||||
const res = await cbe(token, "/cbe/payment", settleBody);
|
||||
expect(res.status).toBe(200);
|
||||
expect(res.body.Response_Code).toBe("0");
|
||||
// The stored body, not a re-settlement — same order id as the first answer.
|
||||
expect(res.body.Destination_Txn_Ref).toBe(settledTxnRef);
|
||||
expect(res.body.Status).toBe("FAILED");
|
||||
expect(res.body.Response_Code).toBe("2");
|
||||
expect(res.body.Response_Description).toBe("Already paid");
|
||||
});
|
||||
|
||||
it("rejects a settled End_To_End_Txn_Id reused with a different amount", async () => {
|
||||
it("answers 'Already paid' when the settled End_To_End_Txn_Id is reused with a different amount", async () => {
|
||||
const res = await cbe(token, "/cbe/payment", {
|
||||
...settleBody,
|
||||
Amount: "1.00",
|
||||
});
|
||||
expect(res.status).toBe(200);
|
||||
expect(res.body.Response_Code).toBe("2");
|
||||
expect(res.body.Response_Description).toBe("Duplicate End_To_End_Txn_Id");
|
||||
expect(res.body.Response_Description).toBe("Already paid");
|
||||
});
|
||||
|
||||
it("rejects a second debit on the same bill", async () => {
|
||||
|
||||
Reference in New Issue
Block a user