2020
2121namespace BTCPayServer . Plugins . USDt . Controllers ;
2222
23- [ Route ( "stores/{storeId}/ethErc20like " ) ]
23+ [ Route ( "stores/{storeId}/EthUSDtlike " ) ]
2424[ Authorize ( AuthenticationSchemes = AuthenticationSchemes . Cookie ) ]
2525[ Authorize ( Policy = Policies . CanModifyStoreSettings , AuthenticationSchemes = AuthenticationSchemes . Cookie ) ]
26- public class UIEthErc20LikeStoreController (
26+ public class UIEthUSDtLikeStoreController (
2727 StoreRepository storeRepository ,
28- EthErc20RPCProvider ethErc20RpcProvider ,
28+ EthUSDtRPCProvider EthUSDtRpcProvider ,
2929 PaymentMethodHandlerDictionary handlers ,
3030 InvoiceRepository invoiceRepository ,
3131 DisplayFormatter displayFormatter ,
@@ -34,23 +34,23 @@ public class UIEthErc20LikeStoreController(
3434 private StoreData StoreData => HttpContext . GetStoreData ( ) ;
3535
3636 [ HttpGet ]
37- public IActionResult GetStoreEthErc20LikePaymentMethods ( )
37+ public IActionResult GetStoreEthUSDtLikePaymentMethods ( )
3838 {
3939 var vm = GetVM ( StoreData ) ;
4040 return View ( vm ) ;
4141 }
4242
4343 [ NonAction ]
44- public ViewEthErc20StoreOptionsViewModel GetVM ( StoreData storeData )
44+ public ViewUSDtStoreOptionsViewModel GetVM ( StoreData storeData )
4545 {
4646 var excludeFilters = storeData . GetStoreBlob ( ) . GetExcludedPaymentMethods ( ) ;
4747
48- var vm = new ViewEthErc20StoreOptionsViewModel ( ) ;
49- foreach ( var item in pluginConfiguration . EthereumErc20LikeConfigurationItems . Values )
48+ var vm = new ViewUSDtStoreOptionsViewModel ( ) ;
49+ foreach ( var item in pluginConfiguration . EthereumUSDtLikeConfigurationItems . Values )
5050 {
5151 var pmi = item . GetPaymentMethodId ( ) ;
52- var matchedPaymentMethod = storeData . GetPaymentMethodConfig < EthErc20PaymentMethodConfig > ( pmi , handlers ) ;
53- vm . Items . Add ( new ViewEthErc20StoreOptionItemViewModel
52+ var matchedPaymentMethod = storeData . GetPaymentMethodConfig < EthUSDtPaymentMethodConfig > ( pmi , handlers ) ;
53+ vm . Items . Add ( new ViewUSDtStoreOptionItemViewModel
5454 {
5555 PaymentMethodId = pmi ,
5656 DisplayName = item . DisplayName ,
@@ -63,31 +63,31 @@ public ViewEthErc20StoreOptionsViewModel GetVM(StoreData storeData)
6363 }
6464
6565 [ HttpGet ( "{paymentMethodId}" ) ]
66- public async Task < IActionResult > GetStoreEthErc20LikePaymentMethod ( PaymentMethodId paymentMethodId )
66+ public async Task < IActionResult > GetStoreEthUSDtLikePaymentMethod ( PaymentMethodId paymentMethodId )
6767 {
68- if ( pluginConfiguration . EthereumErc20LikeConfigurationItems . ContainsKey ( paymentMethodId ) == false )
68+ if ( pluginConfiguration . EthereumUSDtLikeConfigurationItems . ContainsKey ( paymentMethodId ) == false )
6969 return NotFound ( ) ;
7070
7171 var excludeFilters = StoreData . GetStoreBlob ( ) . GetExcludedPaymentMethods ( ) ;
72- var matchedPaymentMethodConfig = StoreData . GetPaymentMethodConfig < EthErc20PaymentMethodConfig > ( paymentMethodId , handlers ) ;
72+ var matchedPaymentMethodConfig = StoreData . GetPaymentMethodConfig < EthUSDtPaymentMethodConfig > ( paymentMethodId , handlers ) ;
7373
7474 if ( matchedPaymentMethodConfig == null )
75- return View ( new EditEthErc20PaymentMethodViewModel
75+ return View ( new EditEthUSDtPaymentMethodViewModel
7676 {
7777 Enabled = false
7878 } ) ;
7979
8080 var balances =
81- await ethErc20RpcProvider . GetBalances ( paymentMethodId , [ .. matchedPaymentMethodConfig . Addresses ] ) ;
81+ await EthUSDtRpcProvider . GetBalances ( paymentMethodId , [ .. matchedPaymentMethodConfig . Addresses ] ) ;
8282 var reservedAddresses =
83- await EthErc20PaymentMethodConfig . GetReservedAddresses ( paymentMethodId , invoiceRepository ) ;
83+ await EthUSDtPaymentMethodConfig . GetReservedAddresses ( paymentMethodId , invoiceRepository ) ;
8484
85- return View ( new EditEthErc20PaymentMethodViewModel
85+ return View ( new EditEthUSDtPaymentMethodViewModel
8686 {
8787 Enabled = ! excludeFilters . Match ( paymentMethodId ) ,
8888 Address = "" ,
8989 Addresses = matchedPaymentMethodConfig . Addresses . Select ( s =>
90- new EditEthErc20PaymentMethodViewModel . EditEthErc20PaymentMethodAddressViewModel
90+ new EditEthUSDtPaymentMethodViewModel . EditEthUSDtPaymentMethodAddressViewModel
9191 {
9292 Available = reservedAddresses . Contains ( s ) == false ,
9393 Balance = balances . Single ( x => x . Item1 == s ) . Item2 == null
@@ -102,13 +102,13 @@ public async Task<IActionResult> GetStoreEthErc20LikePaymentMethod(PaymentMethod
102102 [ Authorize ( Policy = Policies . CanModifyStoreSettings , AuthenticationSchemes = AuthenticationSchemes . Cookie ) ]
103103 public async Task < IActionResult > DeleteAddress ( string storeId , PaymentMethodId paymentMethodId , string address )
104104 {
105- if ( pluginConfiguration . EthereumErc20LikeConfigurationItems . ContainsKey ( paymentMethodId ) == false )
105+ if ( pluginConfiguration . EthereumUSDtLikeConfigurationItems . ContainsKey ( paymentMethodId ) == false )
106106 return NotFound ( ) ;
107107
108108 var store = StoreData ;
109109 var blob = StoreData . GetStoreBlob ( ) ;
110110 var currentPaymentMethodConfig =
111- StoreData . GetPaymentMethodConfig < EthErc20PaymentMethodConfig > ( paymentMethodId , handlers ) ;
111+ StoreData . GetPaymentMethodConfig < EthUSDtPaymentMethodConfig > ( paymentMethodId , handlers ) ;
112112 if ( currentPaymentMethodConfig is null ) return NotFound ( ) ;
113113
114114 currentPaymentMethodConfig . Addresses = currentPaymentMethodConfig . Addresses . Except ( new [ ] { address } ) . ToArray ( ) ;
@@ -122,21 +122,21 @@ public async Task<IActionResult> DeleteAddress(string storeId, PaymentMethodId p
122122 Severity = StatusMessageModel . StatusSeverity . Success
123123 } ) ;
124124
125- return RedirectToAction ( nameof ( GetStoreEthErc20LikePaymentMethod ) , new { storeId , paymentMethodId } ) ;
125+ return RedirectToAction ( nameof ( GetStoreEthUSDtLikePaymentMethod ) , new { storeId , paymentMethodId } ) ;
126126 }
127127
128128 [ HttpPost ( "{paymentMethodId}" ) ]
129129 [ DisableRequestSizeLimit ]
130- public async Task < IActionResult > GetStoreEthErc20LikePaymentMethod ( EditEthErc20PaymentMethodViewModel viewModel ,
130+ public async Task < IActionResult > GetStoreEthUSDtLikePaymentMethod ( EditEthUSDtPaymentMethodViewModel viewModel ,
131131 PaymentMethodId paymentMethodId )
132132 {
133- if ( pluginConfiguration . EthereumErc20LikeConfigurationItems . ContainsKey ( paymentMethodId ) == false )
133+ if ( pluginConfiguration . EthereumUSDtLikeConfigurationItems . ContainsKey ( paymentMethodId ) == false )
134134 return NotFound ( ) ;
135135
136136 var store = StoreData ;
137137 var blob = StoreData . GetStoreBlob ( ) ;
138- var currentPaymentMethodConfig = StoreData . GetPaymentMethodConfig < EthErc20PaymentMethodConfig > ( paymentMethodId , handlers ) ;
139- currentPaymentMethodConfig ??= new EthErc20PaymentMethodConfig ( ) ;
138+ var currentPaymentMethodConfig = StoreData . GetPaymentMethodConfig < EthUSDtPaymentMethodConfig > ( paymentMethodId , handlers ) ;
139+ currentPaymentMethodConfig ??= new EthUSDtPaymentMethodConfig ( ) ;
140140
141141 if ( string . IsNullOrEmpty ( viewModel . Address ) == false )
142142 {
@@ -153,7 +153,7 @@ public async Task<IActionResult> GetStoreEthErc20LikePaymentMethod(EditEthErc20P
153153 Severity = StatusMessageModel . StatusSeverity . Error
154154 } ) ;
155155
156- return RedirectToAction ( "GetStoreEthErc20LikePaymentMethod " , new { storeId = store . Id , paymentMethodId = paymentMethodId } ) ;
156+ return RedirectToAction ( "GetStoreEthUSDtLikePaymentMethod " , new { storeId = store . Id , paymentMethodId = paymentMethodId } ) ;
157157 }
158158
159159 currentPaymentMethodConfig . Addresses =
@@ -194,6 +194,6 @@ .. addresses
194194 store . SetStoreBlob ( blob ) ;
195195 await storeRepository . UpdateStore ( store ) ;
196196
197- return RedirectToAction ( "GetStoreEthErc20LikePaymentMethod " , new { storeId = store . Id , paymentMethodId } ) ;
197+ return RedirectToAction ( "GetStoreEthUSDtLikePaymentMethod " , new { storeId = store . Id , paymentMethodId } ) ;
198198 }
199199}
0 commit comments