@@ -143,41 +143,44 @@ public async Task<IActionResult> GetStoreTronUSDtLikePaymentMethod(EditTronUSDtP
143143
144144 if ( string . IsNullOrEmpty ( viewModel . Address ) == false )
145145 {
146- // if (TronUSDtAddressHelper.IsValid(viewModel.Address) == false)
147- // {
148- // TempData.SetStatusMessageModel(new StatusMessageModel
149- // {
150- // Message = $"{viewModel.Address} is not a TRON address (Base58 format expected).",
151- // Severity = StatusMessageModel.StatusSeverity.Error
152- // });
153- //
154- //
155- // return RedirectToAction("GetStoreTronUSDtLikePaymentMethod", new { storeId = store.Id, cryptoCode });
156- // }
157-
158- //todo check tron format
159- if ( currentPaymentMethodConfig . Addresses . Contains ( viewModel . Address ) )
146+ var addresses = viewModel . Address . Split ( [ ',' , ';' , ' ' , '\r ' , '\n ' ] , StringSplitOptions . RemoveEmptyEntries )
147+ . Where ( TronUSDtAddressHelper . IsValid )
148+ . Where ( s => currentPaymentMethodConfig . Addresses . Contains ( s ) == false ) . ToArray ( ) ;
149+
150+ if ( addresses . Any ( ) == false )
160151 {
161152 TempData . SetStatusMessageModel ( new StatusMessageModel
162153 {
163- Message = $ " { viewModel . Address } is already configured to being tracked for { paymentMethodId } .",
154+ Message = "No addresses were added. Please make sure the addresses are valid and not already being tracked .",
164155 Severity = StatusMessageModel . StatusSeverity . Error
165156 } ) ;
166157
167158 return RedirectToAction ( "GetStoreTronUSDtLikePaymentMethod" , new { storeId = store . Id , paymentMethodId = paymentMethodId } ) ;
168159 }
169-
160+
170161 currentPaymentMethodConfig . Addresses =
171162 [
172163 .. currentPaymentMethodConfig . Addresses ,
173- .. new [ ] { viewModel . Address }
164+ .. addresses
174165 ] ;
175166
176- TempData . SetStatusMessageModel ( new StatusMessageModel
167+
168+ if ( addresses . Length == 1 )
177169 {
178- Message = $ "{ viewModel . Address } is now being tracked for { paymentMethodId } ",
179- Severity = StatusMessageModel . StatusSeverity . Success
180- } ) ;
170+ TempData . SetStatusMessageModel ( new StatusMessageModel
171+ {
172+ Message = $ "{ addresses [ 0 ] } is now being tracked for { paymentMethodId } ",
173+ Severity = StatusMessageModel . StatusSeverity . Success
174+ } ) ;
175+ }
176+ else
177+ {
178+ TempData . SetStatusMessageModel ( new StatusMessageModel
179+ {
180+ Message = $ "{ addresses . Length } addresses were added to { paymentMethodId } ",
181+ Severity = StatusMessageModel . StatusSeverity . Success
182+ } ) ;
183+ }
181184 }
182185 else if ( viewModel . Enabled == blob . IsExcluded ( paymentMethodId ) )
183186 {
0 commit comments