Skip to content

Commit ae7cace

Browse files
CCM-13752 Added specificationBillingId
1 parent ebf8c67 commit ae7cace

14 files changed

Lines changed: 66 additions & 11 deletions

File tree

internal/datastore/src/__test__/letter-repository.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ function createLetter(
3030
source: "/data-plane/letter-rendering/pdf",
3131
subject: `client/1/letter-request/${letterId}`,
3232
billingRef: "specification1",
33+
specificationBillingId: "specification1",
3334
};
3435
}
3536

internal/datastore/src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export const LetterSchema = LetterSchemaBase.extend({
5353
source: z.string(),
5454
subject: z.string(),
5555
billingRef: z.string(),
56+
specificationBillingId: z.string(),
5657
}).describe("Letter");
5758

5859
/**

lambdas/api-handler/src/mappers/__tests__/letter-mapper.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ describe("letter-mapper", () => {
2828
ttl: 123,
2929
source: "/data-plane/letter-rendering/pdf",
3030
subject: "letter-rendering/source/letter/letter-id",
31+
specificationBillingId: "billing123",
3132
};
3233

3334
const result: PatchLetterResponse = mapToPatchLetterResponse(letter);
@@ -64,6 +65,7 @@ describe("letter-mapper", () => {
6465
reasonText: "Reason text",
6566
source: "/data-plane/letter-rendering/pdf",
6667
subject: "letter-rendering/source/letter/letter-id",
68+
specificationBillingId: "billing123",
6769
};
6870

6971
const result: PatchLetterResponse = mapToPatchLetterResponse(letter);
@@ -100,6 +102,7 @@ describe("letter-mapper", () => {
100102
ttl: 123,
101103
source: "/data-plane/letter-rendering/pdf",
102104
subject: "letter-rendering/source/letter/letter-id",
105+
specificationBillingId: "billing123",
103106
};
104107

105108
const result: GetLetterResponse = mapToGetLetterResponse(letter);
@@ -136,6 +139,7 @@ describe("letter-mapper", () => {
136139
reasonText: "Reason text",
137140
source: "/data-plane/letter-rendering/pdf",
138141
subject: "letter-rendering/source/letter/letter-id",
142+
specificationBillingId: "billing123",
139143
};
140144

141145
const result: GetLetterResponse = mapToGetLetterResponse(letter);
@@ -174,6 +178,7 @@ describe("letter-mapper", () => {
174178
reasonText: "Reason text",
175179
source: "/data-plane/letter-rendering/pdf",
176180
subject: "letter-rendering/source/letter/letter-id",
181+
specificationBillingId: "billing123",
177182
};
178183

179184
const result: GetLettersResponse = mapToGetLettersResponse([

lambdas/api-handler/src/services/__tests__/letter-operations.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ function makeLetter(id: string, status: Letter["status"]): Letter {
4141
reasonText: "Reason text",
4242
source: "/data-plane/letter-rendering/pdf",
4343
subject: "letter-rendering/source/letter/letter-id",
44+
specificationBillingId: "billing123",
4445
};
4546
}
4647

lambdas/letter-updates-transformer/src/__tests__/letter-updates-transformer.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,7 @@ function generateLetter(status: LetterStatus, id?: string): Letter {
339339
supplierStatus: `supplier1#${status}`,
340340
supplierStatusSk: "2025-12-10T11:12:54Z#1",
341341
ttl: 1_234_567_890,
342+
specificationBillingId: "billing1",
342343
};
343344
}
344345

lambdas/supplier-allocator/src/config/__tests__/env.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ describe("lambdaEnv", () => {
1919
process.env.VARIANT_MAP = `{
2020
"lv1": {
2121
"supplierId": "supplier1",
22-
"specId": "spec1"
22+
"specId": "spec1",
23+
"billingId": "billing1"
2324
}
2425
}`;
2526

@@ -31,6 +32,7 @@ describe("lambdaEnv", () => {
3132
lv1: {
3233
supplierId: "supplier1",
3334
specId: "spec1",
35+
billingId: "billing1",
3436
},
3537
},
3638
});

lambdas/supplier-allocator/src/config/env.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const LetterVariantSchema = z.record(
55
z.object({
66
supplierId: z.string(),
77
specId: z.string(),
8+
billingId: z.string(),
89
}),
910
);
1011
export type LetterVariant = z.infer<typeof LetterVariantSchema>;

lambdas/supplier-allocator/src/handler/__tests__/allocate-handler.test.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,16 @@ function makeDeps(overrides: Partial<Deps> = {}): Deps {
2626

2727
const env = {
2828
VARIANT_MAP: {
29-
"variant-1": { supplierId: "supplier-1", specId: "spec-1" },
30-
"variant-2": { supplierId: "supplier-2", specId: "spec-2" },
29+
"variant-1": {
30+
supplierId: "supplier-1",
31+
specId: "spec-1",
32+
billingId: "billing-1",
33+
},
34+
"variant-2": {
35+
supplierId: "supplier-2",
36+
specId: "spec-2",
37+
billingId: "billing-2",
38+
},
3139
},
3240
};
3341

@@ -87,6 +95,7 @@ function setupDefaultMocks() {
8795
(supplierConfig.getSupplierDetails as jest.Mock).mockResolvedValue({
8896
supplierId: "supplier-1",
8997
specId: "spec-1",
98+
billingId: "billing-1",
9099
});
91100
}
92101

lambdas/supplier-allocator/src/handler/allocate-handler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
} from "../services/supplier-config";
1818
import { Deps } from "../config/deps";
1919

20-
type SupplierSpec = { supplierId: string; specId: string };
20+
type SupplierSpec = { supplierId: string; specId: string; billingId: string };
2121
type PreparedEvents = LetterRequestPreparedEventV2 | LetterRequestPreparedEvent;
2222

2323
// small envelope that must exist in all inputs

lambdas/update-letter-queue/src/__tests__/update-letter-queue.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ function generateLetter(status: LetterStatus, id?: string): Letter {
4646
source: "test-source",
4747
subject: "test-subject",
4848
billingRef: "billing-ref-1",
49+
specificationBillingId: "billing1",
4950
};
5051
}
5152

0 commit comments

Comments
 (0)