@@ -107,6 +107,14 @@ public async Task WhenICreateTheFollowingMerchants(Table table)
107107 {
108108 foreach ( TableRow tableRow in table . Rows )
109109 {
110+ // lookup the estate id based on the name in the table
111+ EstateDetails estateDetails = this . TestingContext . GetEstateDetails ( tableRow ) ;
112+ String token = this . TestingContext . AccessToken ;
113+ if ( String . IsNullOrEmpty ( estateDetails . AccessToken ) == false )
114+ {
115+ token = estateDetails . AccessToken ;
116+ }
117+
110118 String merchantName = SpecflowTableHelper . GetStringRowValue ( tableRow , "MerchantName" ) ;
111119 CreateMerchantRequest createMerchantRequest = new CreateMerchantRequest
112120 {
@@ -124,12 +132,9 @@ public async Task WhenICreateTheFollowingMerchants(Table table)
124132 Country = SpecflowTableHelper . GetStringRowValue ( tableRow , "Country" )
125133 }
126134 } ;
127-
128- // lookup the estate id based on the name in the table
129- EstateDetails estateDetails = this . TestingContext . GetEstateDetails ( tableRow ) ;
130-
135+
131136 CreateMerchantResponse response = await this . TestingContext . DockerHelper . EstateClient
132- . CreateMerchant ( String . Empty , estateDetails . EstateId , createMerchantRequest , CancellationToken . None ) . ConfigureAwait ( false ) ;
137+ . CreateMerchant ( token , estateDetails . EstateId , createMerchantRequest , CancellationToken . None ) . ConfigureAwait ( false ) ;
133138
134139 response . ShouldNotBeNull ( ) ;
135140 response . EstateId . ShouldBe ( estateDetails . EstateId ) ;
@@ -149,7 +154,13 @@ public async Task WhenICreateTheFollowingMerchants(Table table)
149154
150155 Guid merchantId = estateDetails . GetMerchantId ( merchantName ) ;
151156
152- MerchantResponse merchant = await this . TestingContext . DockerHelper . EstateClient . GetMerchant ( String . Empty , estateDetails . EstateId , merchantId , CancellationToken . None ) . ConfigureAwait ( false ) ;
157+ String token = this . TestingContext . AccessToken ;
158+ if ( String . IsNullOrEmpty ( estateDetails . AccessToken ) == false )
159+ {
160+ token = estateDetails . AccessToken ;
161+ }
162+
163+ MerchantResponse merchant = await this . TestingContext . DockerHelper . EstateClient . GetMerchant ( token , estateDetails . EstateId , merchantId , CancellationToken . None ) . ConfigureAwait ( false ) ;
153164
154165 merchant . MerchantName . ShouldBe ( merchantName ) ;
155166 }
@@ -162,6 +173,12 @@ public async Task WhenIAssignTheFollowingOperatorToTheMerchants(Table table)
162173 {
163174 EstateDetails estateDetails = this . TestingContext . GetEstateDetails ( tableRow ) ;
164175
176+ String token = this . TestingContext . AccessToken ;
177+ if ( String . IsNullOrEmpty ( estateDetails . AccessToken ) == false )
178+ {
179+ token = estateDetails . AccessToken ;
180+ }
181+
165182 // Lookup the merchant id
166183 String merchantName = SpecflowTableHelper . GetStringRowValue ( tableRow , "MerchantName" ) ;
167184 Guid merchantId = estateDetails . GetMerchantId ( merchantName ) ;
@@ -177,7 +194,7 @@ public async Task WhenIAssignTheFollowingOperatorToTheMerchants(Table table)
177194 TerminalNumber = SpecflowTableHelper . GetStringRowValue ( tableRow , "TerminalNumber" ) ,
178195 } ;
179196
180- AssignOperatorResponse assignOperatorResponse = await this . TestingContext . DockerHelper . EstateClient . AssignOperatorToMerchant ( String . Empty , estateDetails . EstateId , merchantId , assignOperatorRequest , CancellationToken . None ) . ConfigureAwait ( false ) ;
197+ AssignOperatorResponse assignOperatorResponse = await this . TestingContext . DockerHelper . EstateClient . AssignOperatorToMerchant ( token , estateDetails . EstateId , merchantId , assignOperatorRequest , CancellationToken . None ) . ConfigureAwait ( false ) ;
181198
182199 assignOperatorResponse . EstateId . ShouldBe ( estateDetails . EstateId ) ;
183200 assignOperatorResponse . MerchantId . ShouldBe ( merchantId ) ;
@@ -195,7 +212,7 @@ public async Task WhenICreateTheFollowingSecurityUsers(Table table)
195212 {
196213 // lookup the estate id based on the name in the table
197214 EstateDetails estateDetails = this . TestingContext . GetEstateDetails ( tableRow ) ;
198-
215+
199216 if ( tableRow . ContainsKey ( "EstateName" ) && tableRow . ContainsKey ( "MerchantName" ) == false )
200217 {
201218 // Creating an Estate User
@@ -221,7 +238,11 @@ public async Task WhenICreateTheFollowingSecurityUsers(Table table)
221238 else if ( tableRow . ContainsKey ( "MerchantName" ) )
222239 {
223240 // Creating a merchant user
224-
241+ String token = this . TestingContext . AccessToken ;
242+ if ( String . IsNullOrEmpty ( estateDetails . AccessToken ) == false )
243+ {
244+ token = estateDetails . AccessToken ;
245+ }
225246 // lookup the merchant id based on the name in the table
226247 String merchantName = SpecflowTableHelper . GetStringRowValue ( tableRow , "MerchantName" ) ;
227248 Guid merchantId = estateDetails . GetMerchantId ( merchantName ) ;
@@ -236,7 +257,7 @@ public async Task WhenICreateTheFollowingSecurityUsers(Table table)
236257 } ;
237258
238259 CreateMerchantUserResponse createMerchantUserResponse =
239- await this . TestingContext . DockerHelper . EstateClient . CreateMerchantUser ( String . Empty , estateDetails . EstateId , merchantId , createMerchantUserRequest , CancellationToken . None ) ;
260+ await this . TestingContext . DockerHelper . EstateClient . CreateMerchantUser ( token , estateDetails . EstateId , merchantId , createMerchantUserRequest , CancellationToken . None ) ;
240261
241262 createMerchantUserResponse . EstateId . ShouldBe ( estateDetails . EstateId ) ;
242263 createMerchantUserResponse . MerchantId . ShouldBe ( merchantId ) ;
0 commit comments