@@ -68,7 +68,7 @@ def wrapper(*args: Any, **kwargs: Any) -> Any:
6868
6969class ConsumerTestClient :
7070
71- def __init__ (self , config : ClientConfig ):
71+ def __init__ (self , config : ClientConfig , use_v2 : bool = False ):
7272 self .config = config
7373 self .api_url = f"{ self .config .base_url } consumer{ self .config .api_path } "
7474
@@ -78,17 +78,26 @@ def __init__(self, config: ClientConfig):
7878 }
7979
8080 if self .config .client_cert :
81- connection_metadata = self .config .connection_metadata .model_dump (
82- by_alias = True
83- )
84- client_rp_details = connection_metadata .pop ("client_rp_details" )
85- self .request_headers .update (
86- {
87- "NHSD-Connection-Metadata" : json .dumps (connection_metadata ),
88- "NHSD-Client-RP-Details" : json .dumps (client_rp_details ),
89- "NHSD-Correlation-Id" : "test-correlation-id" ,
90- }
91- )
81+ if use_v2 :
82+ self .request_headers .update (
83+ {
84+ "NHSD-End-User-Organisation-ODS" : self .config .connection_metadata .ods_code ,
85+ "NHSD-NRL-App-Id" : self .config .connection_metadata .nrl_app_id ,
86+ "NHSD-Correlation-Id" : "test-correlation-id" ,
87+ }
88+ )
89+ else :
90+ connection_metadata = self .config .connection_metadata .model_dump (
91+ by_alias = True
92+ )
93+ client_rp_details = connection_metadata .pop ("client_rp_details" )
94+ self .request_headers .update (
95+ {
96+ "NHSD-Connection-Metadata" : json .dumps (connection_metadata ),
97+ "NHSD-Client-RP-Details" : json .dumps (client_rp_details ),
98+ "NHSD-Correlation-Id" : "test-correlation-id" ,
99+ }
100+ )
92101
93102 self .request_headers .update (self .config .custom_headers )
94103
@@ -210,7 +219,7 @@ def read_capability_statement(self) -> Response:
210219
211220
212221class ProducerTestClient :
213- def __init__ (self , config : ClientConfig ):
222+ def __init__ (self , config : ClientConfig , use_v2 : bool = False ):
214223 self .config = config
215224 self .api_url = f"{ self .config .base_url } producer{ self .config .api_path } "
216225
@@ -220,17 +229,26 @@ def __init__(self, config: ClientConfig):
220229 }
221230
222231 if self .config .client_cert :
223- connection_metadata = self .config .connection_metadata .model_dump (
224- by_alias = True
225- )
226- client_rp_details = connection_metadata .pop ("client_rp_details" )
227- self .request_headers .update (
228- {
229- "NHSD-Connection-Metadata" : json .dumps (connection_metadata ),
230- "NHSD-Client-RP-Details" : json .dumps (client_rp_details ),
231- "NHSD-Correlation-Id" : "test-correlation-id" ,
232- }
233- )
232+ if use_v2 :
233+ self .request_headers .update (
234+ {
235+ "NHSD-End-User-Organisation-ODS" : self .config .connection_metadata .ods_code ,
236+ "NHSD-NRL-App-Id" : self .config .connection_metadata .nrl_app_id ,
237+ "NHSD-Correlation-Id" : "test-correlation-id" ,
238+ }
239+ )
240+ else :
241+ connection_metadata = self .config .connection_metadata .model_dump (
242+ by_alias = True
243+ )
244+ client_rp_details = connection_metadata .pop ("client_rp_details" )
245+ self .request_headers .update (
246+ {
247+ "NHSD-Connection-Metadata" : json .dumps (connection_metadata ),
248+ "NHSD-Client-RP-Details" : json .dumps (client_rp_details ),
249+ "NHSD-Correlation-Id" : "test-correlation-id" ,
250+ }
251+ )
234252
235253 self .request_headers .update (self .config .custom_headers )
236254
0 commit comments