@@ -164,6 +164,67 @@ public async Task Can_Create_Merchant_Account_Eur_Payment()
164164 hppUri . Should ( ) . NotBeNullOrWhiteSpace ( ) ;
165165 }
166166
167+ [ Fact ]
168+ public async Task Can_Create_Payment_With_SubMerchants_BusinessDivision ( )
169+ {
170+ var subMerchants = new SubMerchants ( new SubMerchants . BusinessDivision (
171+ id : Guid . NewGuid ( ) . ToString ( ) ,
172+ name : "Test Division" ) ) ;
173+
174+ var paymentRequest = CreateTestPaymentRequest (
175+ new Provider . UserSelected
176+ {
177+ Filter = new ProviderFilter { ProviderIds = [ "mock-payments-gb-redirect" ] } ,
178+ SchemeSelection = new SchemeSelection . InstantOnly { AllowRemitterFee = true } ,
179+ } ,
180+ subMerchants : subMerchants ) ;
181+
182+ var response = await _fixture . TlClients [ 0 ] . Payments . CreatePayment (
183+ paymentRequest , idempotencyKey : Guid . NewGuid ( ) . ToString ( ) ) ;
184+
185+ response . StatusCode . Should ( ) . Be ( HttpStatusCode . Created ) ;
186+ var authorizationRequired = response . Data . AsT0 ;
187+
188+ authorizationRequired . Id . Should ( ) . NotBeNullOrWhiteSpace ( ) ;
189+ authorizationRequired . ResourceToken . Should ( ) . NotBeNullOrWhiteSpace ( ) ;
190+ authorizationRequired . User . Should ( ) . NotBeNull ( ) ;
191+ authorizationRequired . User . Id . Should ( ) . NotBeNullOrWhiteSpace ( ) ;
192+ authorizationRequired . Status . Should ( ) . Be ( "authorization_required" ) ;
193+ }
194+
195+ [ Fact ]
196+ public async Task Can_Create_Payment_With_SubMerchants_BusinessClient ( )
197+ {
198+ var address = new Address ( "London" , "England" , "EC1R 4RB" , "GB" , "1 Hardwick St" ) ;
199+ var subMerchants = new SubMerchants ( new SubMerchants . BusinessClient (
200+ tradingName : "Test Trading Company" ,
201+ commercialName : "Test Commercial Name" ,
202+ url : "https://example.com" ,
203+ mcc : "1234" ,
204+ registrationNumber : "REG123456" ,
205+ address : address ) ) ;
206+
207+ var paymentRequest = CreateTestPaymentRequest (
208+ new Provider . UserSelected
209+ {
210+ Filter = new ProviderFilter { ProviderIds = [ "mock-payments-gb-redirect" ] } ,
211+ SchemeSelection = new SchemeSelection . InstantOnly { AllowRemitterFee = true } ,
212+ } ,
213+ subMerchants : subMerchants ) ;
214+
215+ var response = await _fixture . TlClients [ 0 ] . Payments . CreatePayment (
216+ paymentRequest , idempotencyKey : Guid . NewGuid ( ) . ToString ( ) ) ;
217+
218+ response . StatusCode . Should ( ) . Be ( HttpStatusCode . Created ) ;
219+ var authorizationRequired = response . Data . AsT0 ;
220+
221+ authorizationRequired . Id . Should ( ) . NotBeNullOrWhiteSpace ( ) ;
222+ authorizationRequired . ResourceToken . Should ( ) . NotBeNullOrWhiteSpace ( ) ;
223+ authorizationRequired . User . Should ( ) . NotBeNull ( ) ;
224+ authorizationRequired . User . Id . Should ( ) . NotBeNullOrWhiteSpace ( ) ;
225+ authorizationRequired . Status . Should ( ) . Be ( "authorization_required" ) ;
226+ }
227+
167228 [ Fact ]
168229 public async Task Can_Create_Payment_With_Auth_Flow ( )
169230 {
@@ -530,7 +591,8 @@ private static CreatePaymentRequest CreateTestPaymentRequest(
530591 RelatedProducts ? relatedProducts = null ,
531592 BeneficiaryUnion ? beneficiary = null ,
532593 Retry . BaseRetry ? retry = null ,
533- bool initAuthorizationFlow = false )
594+ bool initAuthorizationFlow = false ,
595+ SubMerchants ? subMerchants = null )
534596 {
535597 accountIdentifier ??= new AccountIdentifier . SortCodeAccountNumber ( "567890" , "12345678" ) ;
536598 providerSelection ??= new Provider . Preselected ( "mock-payments-gb-redirect" ,
@@ -568,7 +630,8 @@ private static CreatePaymentRequest CreateTestPaymentRequest(
568630 [ "test-key-1" ] = "test-value-1" ,
569631 [ "test-key-2" ] = "test-value-2" ,
570632 } ,
571- riskAssessment : new RiskAssessment ( "test" )
633+ riskAssessment : new RiskAssessment ( "test" ) ,
634+ subMerchants : subMerchants
572635 ) ;
573636 }
574637
0 commit comments