Compare commits
1 Commits
v1.11.1
...
renamebitp
Author | SHA1 | Date | |
---|---|---|---|
83b8dcd7c6 |
.circleci
.editorconfig.github
ISSUE_TEMPLATE
codeql
workflows
.vscode
BTCPayServer.Abstractions
BTCPayServer.Abstractions.csprojCamelCaseSerializerSettings.cs
Configuration
Constants
Contracts
BaseDbContextFactory.csIBTCPayServerClientFactory.csIBTCPayServerPlugin.csIFileService.csINotificationHandler.csIPluginHookAction.csIPluginHookFilter.csIPluginHookService.csIScopeProvider.csISettingsRepository.csIStoreRepository.csIStoredFile.csISwaggerProvider.csISyncSummaryProvider.csIUIExtension.csIUTXOLocker.cs
Converters
Custodians
Client
AssetQuoteResult.cs
ICanDeposit.csICanTrade.csICanWithdraw.csICustodian.csException
AssetBalancesUnavailableException.csAssetQuoteUnavailableException.csBadConfigException.csCannotWithdrawException.csCustodianApiException.csCustodianFeatureNotImplementedException.csDepositsUnavailableException.csInsufficientFundsException.csInvalidWithdrawalTargetException.csPermissionDeniedCustodianApiException.csTradeNotFoundException.csWithdrawalNotFoundException.csWrongTradingPairException.cs
MarketTradeResult.csSimulateWithdrawalResult.csWithdrawResult.csExtensions
CustodianExtensions.csGreenfieldExtensions.csHttpRequestExtensions.csITempDataDictionaryExtensions.csStringExtensions.csViewsRazor.cs
Form
Models
PushNuget.ps1Security
Services
TagHelpers
CSPA.csCSPEventTagHelper.csCSPInlineScriptTagHelper.csCSPTemplate.csPermissionTagHelper.csSVGUse.csSrvModel.csUrlResolutionTagHelper2.cs
icon.pngBTCPayServer.Client
BTCPayServer.Client.csprojBTCPayServerClient.APIKeys.csBTCPayServerClient.Apps.csBTCPayServerClient.Authorization.csBTCPayServerClient.CustodianAccounts.csBTCPayServerClient.Custodians.csBTCPayServerClient.Invoices.csBTCPayServerClient.LNURLPayPaymentMethods.csBTCPayServerClient.Lightning.Internal.csBTCPayServerClient.Lightning.Store.csBTCPayServerClient.LightningAddresses.csBTCPayServerClient.LightningNetworkPaymentMethods.csBTCPayServerClient.Misc.csBTCPayServerClient.Notifications.csBTCPayServerClient.OnChainPaymentMethods.csBTCPayServerClient.OnChainWallet.Objects.csBTCPayServerClient.OnChainWallet.csBTCPayServerClient.PaymentRequests.csBTCPayServerClient.PayoutProcessors.csBTCPayServerClient.PullPayments.csBTCPayServerClient.ServerInfo.csBTCPayServerClient.StoreEmail.csBTCPayServerClient.StorePaymentMethods.csBTCPayServerClient.StorePayoutProcessors.csBTCPayServerClient.StoreRatesConfiguration.csBTCPayServerClient.StoreUsers.csBTCPayServerClient.Users.csBTCPayServerClient.Webhooks.csBTCPayServerClient.csGreenFieldAPIException.csGreenFieldValidationException.cs
JsonConverters
MnemonicJsonConverter.csNodeUriJsonConverter.csNumericStringJsonConverter.csTimeSpanJsonConverter.csTradeQuantityJsonConverter.csWordcountJsonConverter.csWordlistJsonConverter.cs
Models
AddCustomerEmailRequest.csApplicationUserData.csAssetPairData.csCreateAppRequest.csCreateCustodianAccountRequest.csCreateInvoiceRequest.csCreateLightningInvoiceRequest.csCreateOnChainTransactionRequest.csCreatePayoutThroughStoreRequest.csCreatePullPaymentRequest.csCustodianAccountBaseData.csCustodianAccountData.csCustodianAccountResponse.csCustodianData.csDepositAddressData.csEmailSettingsData.csGenerateOnChainWalletRequest.csGenericPaymentMethodData.csGreenfieldAPIError.csGreenfieldPermissionAPIError.csInvoiceData.csInvoiceExceptionStatus.csInvoicePaymentMethodDataModel.csInvoiceStatus.csLNURLPayPaymentMethodBaseData.csLNURLPayPaymentMethodData.csLabelData.csLanguage.csLedgerEntryData.csLightningAddressData.csLightningAutomatedPayoutSettings.csLightningInvoiceData.csLightningNetworkPaymentMethodBaseData.csLightningNetworkPaymentMethodData.csLightningNodeBalanceData.csLightningNodeInformationData.csLightningPaymentData.csLockUserRequest.csMarkPayoutRequest.csMarketTradeResponseData.csNotificationData.csOnChainAutomatedPayoutSettings.csOnChainPaymentMethodBaseData.csOnChainPaymentMethodData.csOnChainPaymentMethodDataWithSensitiveData.csOnChainPaymentMethodPreviewResultData.csOnChainWalletAddressData.csOnChainWalletFeeRateData.csOnChainWalletOverviewData.csOnChainWalletTransactionData.csOnChainWalletUTXOData.csOpenLightningChannelRequest.csPatchOnChainTransactionRequest.csPayLightningInvoiceRequest.csPayPaymentRequestRequest.csPaymentMethodCriteriaData.csPaymentRequestBaseData.csPaymentRequestData.csPayoutData.csPayoutProcessorData.csPermissionMetadata.csPointOfSaleAppData.csPullPaymentBaseData.csPullPaymentLNURL.csRateSource.csRefundInvoiceRequest.csSendEmailRequest.csServerInfoData.csStoreBaseData.csStoreData.csStoreRateConfiguration.csStoreRateResult.csStoreReportRequest.csStoreReportsResponse.csStoreWebhookData.csTradeQuoteResponseData.csTradeRequestData.csTransactionStatus.csUpdateInvoiceRequest.csUpdateLightningNetworkPaymentMethodRequest.csUpdateNotification.csUpdateOnChainPaymentMethodRequest.csWebhookDeliveryData.csWebhookDeliveryStatus.csWebhookEvent.csWebhookEventType.csWebhookInvoiceEvent.csWithdrawRequestData.csWithdrawalBaseResponseData.csWithdrawalResponseData.csWithdrawalSimulationResponseData.cs
Permissions.csBTCPayServer.Common
Altcoins
BTCPayNetworkProvider.Althash.csBTCPayNetworkProvider.Argoneum.csBTCPayNetworkProvider.BPlus.csBTCPayNetworkProvider.BitcoinGold.csBTCPayNetworkProvider.Bitcoinplus.csBTCPayNetworkProvider.Bitcore.csBTCPayNetworkProvider.Chaincoin.csBTCPayNetworkProvider.Dash.csBTCPayNetworkProvider.Dogecoin.csBTCPayNetworkProvider.Feathercoin.csBTCPayNetworkProvider.Groestlcoin.csBTCPayNetworkProvider.Litecoin.csBTCPayNetworkProvider.Monacoin.csBTCPayNetworkProvider.MonetaryUnit.csBTCPayNetworkProvider.Polis.csBTCPayNetworkProvider.Ufo.csBTCPayNetworkProvider.Viacoin.cs
BTCPayNetwork.csBTCPayNetworkProvider.Bitcoin.csBTCPayNetworkProvider.csBTCPayServer.Common.csprojExtensions.csIExplorerClientProvider.csEthereum
Liquid
Monero
Zcash
BTCPayNetworkProvider.Zcash.cs
RPC
JsonRpcClient.cs
Models
CreateAccountRequest.csCreateAccountResponse.csCreateAddressRequest.csCreateAddressResponse.csGetAccountsRequest.csGetAccountsResponse.csGetFeeEstimateRequest.csGetFeeEstimateResponse.csGetHeightResponse.csGetTransferByTransactionIdRequest.csGetTransferByTransactionIdResponse.csGetTransfersRequest.csGetTransfersResponse.csInfo.csMakeUriRequest.csMakeUriResponse.csParseStringConverter.csPeer.csSubaddrIndex.csSubaddressAccount.csSyncInfoResponse.cs
Utils
ZcashLikeSpecificBtcPayNetwork.csLogging
MultiProcessingQueue.csPaymentUrlBuilder.csZipUtils.csBTCPayServer.Data
ApplicationDbContextFactory.csBTCPayServer.Data.csproj
Data
APIKeyData.csAddressInvoiceData.csAppData.csApplicationDbContext.csApplicationDbContextFactory.csApplicationUser.csCustodianAccountData.csFido2Credential.csFormData.csHistoricalAddressInvoiceData.csIHasBlob.csInvoiceData.csInvoiceEventData.csInvoiceSearchData.csInvoiceWebhookDeliveryData.csLightingAddressData.csNotificationData.csPairedSINData.csPairingCodeData.csPaymentData.csPaymentRequestData.csPayoutData.csPayoutProcessorData.csPendingInvoiceData.csPlannedTransaction.csPullPaymentData.csRefundData.csSettingData.csStoreData.csStoreRole.csStoreSettingData.csStoreWebhookData.csStoredFile.csTradeResultData.csU2FDevice.csUserStore.csWalletData.csWalletObjectData.csWalletObjectLinkData.csWalletTransactionData.csWebhookData.csWebhookDeliveryData.cs
Migrations
20200625064111_refundnotificationpullpayments.cs20200901161733_AddInvoiceEventLogSeverity.cs20201002145033_AddCreateDateToUser.cs20201007090617_u2fDeviceCascade.cs20201015151438_AddDisabledNotificationsToUser.cs20201108054749_webhooks.cs20201208054211_invoicesorderindex.cs20201228225040_AddingInvoiceSearchesTable.cs20210314092253_Fido2Credentials.cs20211021085011_RemovePayoutDestinationConstraint.cs20211125081400_AddUserBlob.cs20220115184620_AddCustodianAccountData.cs20220311135252_AddPayoutProcessors.cs20220414132313_AddLightningAddress.cs20220518061525_invoice_created_idx.cs20220523022603_remove_historical_addresses.cs20220610090843_AddSettingsToStore.cs20220929132704_label.cs20221128062447_jsonb.cs20230123062447_migrateoldratesource.cs20230125085242_AddForms.cs20230130040047_blob2.cs20230130062447_jsonb2.cs20230315062447_fixmaxlength.cs20230504125505_StoreRoles.cs20230529135505_WebhookDeliveriesCleanup.csApplicationDbContextModelSnapshot.cs
BTCPayServer.PluginPacker
BTCPayServer.Rating
AvailableRateProvider.csBTCPayServer.Rating.csprojCurrencies.jsonCurrencyNameTable.csCurrencyPair.csExchangeRates.csExtensions.cs
Providers
ArgoneumRateProvider.csBTCTurkRateProvider.csBackgroundFetcherRateProvider.csBitbankRateProvider.csBitflyerRateProvider.csBitpayRateProvider.csBudaRateProvider.csByllsRateProvider.csCoinGeckoRateProvider.csCryptoMarketExchangeRateProvider.csExchangeRateHostRateProvider.csExchangeSharpRateProvider.csFallbackRateProvider.csFreeCurrencyRatesRateProvider.csHitBTCRateProvider.csHttpClientRequestMaker.csIRateProvider.csKrakenExchangeRateProvider.csNullRateProvider.csPolisRateProvider.csRipioExchangeProvider.csYadioRateProvider.cs
RateRules.csRateSourceInfo.csServices
BTCPayServer.Tests
AltcoinTests
ApiKeysTests.csBTCPayServer.Tests.csprojBTCPayServerTester.csCheckoutUITests.csCheckoutv2Tests.csCoinSwitchTests.csCollectionDefinitions.csCrowdfundTests.csCustomerHttpServer.csDockerfileExtensions.csFactWithSecretAttribute.csFakeServer.csFastTests.csFormTests.csGreenfieldAPITests.csLanguageServiceTests.csLnd
Logging
MockCustodian
Mocks
POSTests.csPSBTTests.csPayJoinTests.csPaymentRequestTests.csProcessLauncher.csREADME.mdRateRulesTest.csSeleniumTester.csSeleniumTests.csServerTester.csStorageTests.csTestAccount.csTestData
TestUtils.csThirdPartyTests.csU2FTests.csUnitTest1.csUnitTestBase.csUtilitiesTests.csUtils.csdocker-bitcoin-generate.shdocker-bitcoin-multisig-setup.shdocker-compose.altcoins.ymldocker-compose.ymldocker-customer-lncli-holdinvoice.shdocker-customer-lncli.shdocker-entrypoint.shdocker-lightning-channel-setup.shdocker-lightning-channel-teardown.shdocker-merchant-lncli.shxunit.runner.jsonBTCPayServer
BTCPayServer.csprojBufferizedFormFile.csColorPalette.csPayjoinClient.csSocks5HttpClientHandler.csStorePolicies.csUserManagerExtensions.csWalletId.csWebSocketHelper.csWebsocketExtensions.csWellKnownTempData.csZoneLimits.cs_ViewImports.cshtmlbundleconfig.json
Components
AppSales
AppTopItems
Icon
LabelManager
MainLogo
MainNav
Notifications
NotificationsDropdown
Pager
QRCode
StoreLightningBalance
StoreLightningServices
StoreNumbers
StoreRecentInvoices
StoreRecentTransactions
Default.cshtmlStoreRecentTransactionViewModel.csStoreRecentTransactions.csStoreRecentTransactionsViewModel.cs
StoreSelector
StoreWalletBalance
ThemeSwitch
TruncateCenter
UiExtensionPoint
WalletNav
Configuration
BTCPayServerOptions.csConfigurationExtensions.csDefaultConfiguration.csExternalConnectionString.csExternalService.csExternalServicesOptions.csLightningNetworkOptions.csNBXplorerConnectionSetting.csNBXplorerOptions.cs
Contracts
Controllers
AccessTokenController.csAccountController.csAppsController.Crowdfund.csAppsController.PointOfSale.csAppsController.csAppsPublicController.csBitpayInvoiceController.csErrorController.cs
CurrencyValue.csGreenField
ApiKeysController.csGreenFieldUtils.csGreenfieldAppsController.csGreenfieldCustodianAccountController.csGreenfieldCustodianController.csGreenfieldInvoiceController.csGreenfieldLightningNodeApiController.Internal.csGreenfieldLightningNodeApiController.Store.csGreenfieldLightningNodeApiController.csGreenfieldNotificationsController.csGreenfieldPaymentRequestsController.csGreenfieldPayoutProcessorsController.csGreenfieldPullPaymentController.csGreenfieldReportsController.csGreenfieldServerInfoController.csGreenfieldServerRolesController.csGreenfieldStoreAutomatedLightningPayoutProcessorsController.csGreenfieldStoreAutomatedOnChainPayoutProcessorsController.csGreenfieldStoreEmailController.csGreenfieldStoreLNURLPayPaymentMethodsController.csGreenfieldStoreLightningAddressesController.csGreenfieldStoreLightningNetworkPaymentMethodsController.csGreenfieldStoreOnChainPaymentMethodsController.WalletGeneration.csGreenfieldStoreOnChainPaymentMethodsController.csGreenfieldStoreOnChainWalletsController.csGreenfieldStorePaymentMethodsController.csGreenfieldStorePayoutProcessorsController.csGreenfieldStoreRatesConfigurationController.csGreenfieldStoreRatesController.csGreenfieldStoreRolesController.csGreenfieldStoreUsersController.csGreenfieldStoreWebhooksController.csHealthController.csInvoiceController.csLightningNodeApiController.Internal.csLightningNodeApiController.Store.csLightningNodeApiController.csLocalBTCPayServerClient.csPaymentRequestsController.csPullPaymentController.csServerInfoController.csStoresController.csTestApiKeyController.csUsersController.cs
HomeController.csInvoiceController.API.csInvoiceController.UI.csInvoiceController.csLightningAddressService.csLnurlAuthService.csMacaroons.csManageController.2FA.csManageController.APIKeys.csManageController.U2F.csManageController.csNotificationsController.csPaymentRequestController.csPublicController.csPublicLightningNodeInfoController.csPullPaymentController.csRateController.csServerController.Storage.csServerController.Users.csServerController.csStorageController.csStoresController.BTCLike.csStoresController.CoinSwitch.csStoresController.Email.csStoresController.Integrations.csStoresController.LightningLike.csStoresController.csUIAppsController.Dashboard.csUIAppsController.csUICustodianAccountsController.csUIHomeController.csUIInvoiceController.Testing.csUIInvoiceController.UI.csUIInvoiceController.csUILNURLAuthController.csUILNURLController.csUIManageController.LoginCodes.csUIManageController.Notifications.csUIPaymentRequestController.csUIPublicController.csUIPullPaymentController.csUIReportsController.CheatMode.csUIReportsController.csUIServerController.Plugins.csUIServerController.Roles.csUIServerController.Users.csUIStorePullPaymentsController.PullPayments.csUIStoresController.Dashboard.csUIStoresController.Email.csUIStoresController.Integrations.csUIStoresController.LightningLike.csUIStoresController.Onchain.csUIStoresController.Roles.csUIUserStoresController.csUIWalletsController.csUserStoresController.csVaultController.csWalletsController.PSBT.csWalletsController.PullPayments.csWalletsController.csData
APIKeyDataExtensions.csAddressInvoiceDataExtensions.csCustodianAccountDataExtensions.csHistoricalAddressInvoiceDataExtensions.csIHasBlobExtensions.csInvoiceDataExtensions.csPaymentDataExtensions.csPaymentRequestDataExtensions.cs
DerivationSchemeParser.csDerivationSchemeSettings.csEventAggregator.csPayouts
BitcoinLike
AddressClaimDestination.csBitcoinLikePayoutHandler.csIBitcoinLikeClaimDestination.csPayoutTransactionOnChainBlob.csUriClaimDestination.cs
IClaimDestination.csIPayoutHandler.csIPayoutProof.csLightningLike
BoltInvoiceClaimDestination.csILightningLikeLikeClaimDestination.csLNURLPayClaimDestinaton.csLightningLikePayoutHandler.csPayoutLightningBlob.csUILightningLikePayoutController.cs
ManualPayoutProof.csPayoutBlob.csPayoutExtensions.csPullPayments
PullPaymentsExtensions.csStoreBlob.csStoreDataExtensions.csWalletDataExtensions.csWalletTransactionDataExtensions.csWalletTransactionInfo.csWebhookDataExtensions.csEvents
IHasInvoiceId.csInvoiceDataChangedEvent.csInvoiceEvent.csInvoiceIPNEvent.csInvoiceNeedUpdateEvent.csInvoicePaymentMethodActivated.csInvoiceStopWatchedEvent.csSettingsChanged.csStoreRemovedEvent.csWalletChangedEvent.cs
ExplorerClientProvider.csExtensions.csExtensions
ActionLogicExtensions.csAuthorizationExtensions.csControllerBaseExtensions.csEmailSenderExtensions.csEnumExtensions.csModelStateExtensions.csMoneyExtensions.csPSBTExtensions.csSSHClientExtensions.csServiceCollectionExtensions.csStoreExtensions.csStringExtensions.csUrlHelperExtensions.csUserExtensions.csUserPrefsCookie.csWebHostExtensions.cs
Fido2
Fido2Service.csFidoExtensions.cs
FileTypeDetector.csModels
AddFido2CredentialViewModel.csFido2AuthenticationViewModel.csFido2CredentialBlob.csLoginWithFido2ViewModel.cs
UIFido2Controller.csUserLoginCodeService.csFilters
CheatModeRouteAttribute.csContentSecurityPolicyAttribute.csDomainMappingConstraintAttribute.csExperimentalRouteAttribute.csJsonHttpExceptionFilter.csJsonObjectExceptionFilter.csOnlyIfSupportAttribute.csXFrameOptionsAttribute.cs
Forms
FieldValueMirror.csFormComponentProviders.csFormDataExtensions.csFormDataService.csHtmlFieldsetFormProvider.csHtmlInputFormProvider.csHtmlSelectFormProvider.csHtmlTextareaFormProvider.csIFormComponentProvider.cs
GitCommitAttribute.csModels
ModifyForm.csUIFormsController.csHostedServices
AppInventoryUpdaterHostedService.csBackgroundJobSchedulerHostedService.csBaseAsyncService.csCheckConfigurationHostedService.csCleanupWebhookDeliveriesTask.csCssThemeManager.csDbMigrationsHostedService.csDelayedTransactionBroadcasterHostedService.csDynamicDnsHostedService.csEventHostedServiceBase.csIPeriodicTask.csInvoiceEventSaverService.csInvoiceNotificationManager.csInvoiceWatcher.csNBXplorerWaiter.csNewVersionCheckerHostedService.csPeriodicTaskLauncherHostedService.csPullPaymentHostedService.csRatesHostedService.csScheduledTask.csSocks5HttpProxyServer.csStoreEmailRuleProcessorSender.csTorServicesHostedService.csTransactionLabelMarkerHostedService.csUserEventHostedService.csWalletReceiveCacheUpdater.csWebhookSender.cs
Hosting
BTCPayServerServices.csBTCpayMiddleware.csBlockExplorerLinkStartupTask.csGreenfieldMiddleware.csIStartupTask.csLowercaseTransformer.csMigrationStartupTask.csResourceBundleProvider.csSkippableObjectValidatorProvider.csStartup.csToPostgresMigrationStartupTask.csValidateControllerNameTransformer.cs
IHasAdditionalData.csJsonConverters
JsonHttpException.csLogging
ModelBinders
BitpayDateTimeOffsetModelBinder.csDateTimeOffsetModelBinder.csDefaultModelBinderProvider.csDerivationSchemeModelBinder.csInvariantDecimalModelBinder.csPaymentMethodIdModelBinder.csWalletIdModelBinder.cs
Models
AccountViewModels
AdditionalServiceViewModel.csAppViewModels
CreateAppViewModel.csListAppsViewModel.csUpdateCrowdfundViewModel.csUpdatePointOfSaleViewModel.csViewCrowdfundViewModel.csViewPointOfSaleViewModel.cs
BasePagingViewModel.csBitpayCreateInvoiceRequest.csBitpayTranslatorViewModel.csConfirmModel.csCustodianAccountViewModels
AssetBalanceInfo.csCreateCustodianAccountViewModel.csDepositPrepareViewModel.csEditCustodianAccountViewModel.csTradePrepareViewModel.csViewCustodianAccountBalancesViewModel.csViewCustodianAccountViewModel.csWithdrawalPrepareViewModel.cs
GetTokensResponse.csHomeViewModel.csInvoiceResponse.csInvoicingModels
CreateInvoiceModel.csInvoiceDetailsModel.csInvoiceReceiptViewModel.csInvoicesModel.csPaymentModel.csRefundModel.csUpdateCustomerModel.cs
ManageViewModels
NotificationViewModels
PaymentRequestViewModels
PostRedictViewModel.csServerViewModels
DynamicDnsViewModel.csEmailsViewModel.csLndServicesViewModel.csServicesViewModel.csUserViewModel.csUsersViewModel.csViewFilesViewModel.cs
StatusMessageModel.csStoreReportsViewModels
StoreViewModels
CheckoutAppearanceViewModel.csCheckoutExperienceViewModel.csCreateStoreViewModel.csDerivationSchemeViewModel.csEditWebhookViewModel.csGeneralSettingsViewModel.csIntegrationsViewModel.csLightningNodeViewModel.csLightningSettingsViewModel.csLightningViewModel.csPayButtonViewModel.csPaymentMethodOptionViewModel.csPaymentViewModel.csPluginsViewModel.csRatesViewModel.csRecoverySeedBackupViewModel.csStoreDashboardViewModel.csStoreDerivationScheme.csStoreLightningNode.csStoreUsersViewModel.csStoreViewModel.csStoresViewModel.csTestWebhookViewModel.csTokensViewModel.csUpdateCoinSwitchSettingsViewModel.csWalletSettingsViewModel.csWalletSetupRequest.csWalletSetupViewModel.csWebhooksViewModel.cs
ViewPullPaymentModel.csWalletViewModels
ListTransactionsViewModel.csListWalletsViewModel.csPayoutsModel.csPullPaymentsModel.csSignWithSeedViewModel.csTransactionTagModel.csWalletPSBTCombineViewModel.csWalletPSBTReadyViewModel.csWalletPSBTViewModel.csWalletSendModel.csWalletSendVaultModel.csWalletSettingsViewModel.csWalletSigningOptionsModel.cs
PaymentRequest
Payments
Bitcoin
BitcoinLikeOnChainPaymentMethod.csBitcoinLikePaymentData.csBitcoinLikePaymentHandler.csNBXplorerListener.cs
Coinswitch
IPaymentFilter.csIPaymentMethodDetails.csIPaymentMethodHandler.csLNURLPay
LNURLPayPaymentHandler.csLNURLPayPaymentMethodDetails.csLNURLPaySupportedPaymentMethod.csPaymentTypes.LNURL.cs
Lightning
LightningExtensions.csLightningLikePaymentData.csLightningLikePaymentHandler.csLightningLikePaymentMethodDetails.csLightningListener.csLightningPendingPayoutListener.csLightningSupportedPaymentMethod.cs
PayJoin
PaymentMethodId.csPaymentTypes.Bitcoin.csPaymentTypes.Lightning.csPaymentTypes.csPayoutProcessors
AfterPayoutActionData.csBaseAutomatedPayoutProcessor.csBeforePayoutActionData.csIPayoutProcessorFactory.cs
Lightning
LightningAutomatedPayoutBlob.csLightningAutomatedPayoutProcessor.csLightningAutomatedPayoutSenderFactory.csUILightningAutomatedPayoutProcessorsController.cs
OnChain
OnChainAutomatedPayoutBlob.csOnChainAutomatedPayoutProcessor.csOnChainAutomatedPayoutSenderFactory.csUIOnChainAutomatedPayoutProcessorsController.cs
PayoutProcessorService.csPayoutProcessorsExtensions.csUIPayoutProcessorsController.csPlugins
BTCPayServerPlugin.cs
Program.csCrowdfund
FakeCustodian
NFC
PayButton
PluginBuilderClient.csPluginHookService.csPluginManager.csPluginService.csPointOfSale
Shopify
Properties
Roles.csSSH
SearchString.csSecurity
AuthenticationExtensions.csAuthenticationSchemes.cs
Bitpay
ContentSecurityPolicies.csCookieAuthorizationHandler.csGreenField
APIKeyExtensions.csAPIKeyRepository.csAPIKeysAuthenticationHandler.csBasicAuthenticationHandler.csGreenFieldAuthenticationOptions.csGreenFieldAuthorizationHandler.csGreenFieldConstants.cs
PolicyRequirement.csSecurityExtensions.csServices
Altcoins
Ethereum
Configuration
EthereumLikeExtensions.csEthereumStoreNavExtension.csFilters
Payments
EthereumLikeOnChainPaymentMethodDetails.csEthereumLikePaymentData.csEthereumLikePaymentMethodHandler.csEthereumPaymentType.csEthereumSupportedPaymentMethod.cs
Services
UI
Monero
Configuration
MoneroLikeExtensions.csMoneroStoreNavExtension.csPayments
MoneroLikeOnChainPaymentMethodDetails.csMoneroLikePaymentData.csMoneroLikePaymentMethodHandler.csMoneroPaymentType.csMoneroSupportedPaymentMethod.cs
Services
MoneroLikeSummaryUpdaterHostedService.csMoneroListener.csMoneroRPCProvider.csMoneroSyncSummaryProvider.cs
UI
Zcash
Apps
Attachment.csBTCPayNetworkJsonSerializerSettings.csBTCPayServerEnvironment.csCheater.csCustodian
DefaultSwaggerProvider.csDelayedTransactionBroadcaster.csDisplayFormatter.csFees
ISettingsAccessor.csInvoiceActivator.csInvoices
Amounts.cs
Export
InvoiceEntity.csInvoiceRepository.csPaymentMethodDictionary.csPaymentService.csPosAppData.csLabels
LanguageService.csLightningClientFactoryService.csMails
EmailSender.csEmailSenderFactory.csEmailSettings.csIEmailSender.csServerEmailSender.csStoreEmailSender.cs
MigrationSettings.csNBXSyncSummaryProvider.csNBXplorerConnectionFactory.csNotifications
Blobs
ExternalPayoutTransactionNotification.csInvoiceEventNotification.csJunkNotification.csNewVersionNotification.csPayoutNotification.cs
INotificationHandler.csNotificationManager.csNotificationScopes.csNotificationSender.csPaymentRequests
PoliciesSettings.csReportService.csReporting
OnChainWalletReportProvider.csPaymentsReportProvider.csProductsReportProvider.csQueryContext.csReportProvider.csViewDefinition.cs
Safe.csSettingsRepository.csShopify
ApiModels
CreateScriptResponse.csCreateWebhookResponse.cs
DataHolders
OrdersCountResp.csShopifyOrder.csShopifyTransaction.csTransactionsCreateReq.csTransactionsCreateResp.csTransactionsListResp.csModels
OrderTransactionRegisterLogic.csShopifyApiClient.csShopifyApiException.csShopifyExtensions.csShopifyOrderMarkerHostedService.csStores
ThemesSettings.csTorServices.csUserService.csWalletRepository.csWallets
Storage
Models
Services
FileService.cs
StorageExtensions.csProviders
StoredFileRepository.csViewModels
TagHelpers
U2F
Models
AddU2FDeviceViewModel.csLoginWithU2FViewModel.csServerChallenge.csServerRegisterResponse.csU2FAuthenticationViewModel.csU2FDeviceAuthenticationRequest.cs
U2FService.csValidation
Views
Account
AccessDenied.cshtmlForgotPassword.cshtmlForgotPasswordConfirmation.cshtmlLockout.cshtmlLogin.cshtmlLoginWith2fa.cshtmlLoginWithRecoveryCode.cshtmlLoginWithU2F.cshtmlRegister.cshtmlSecondaryLogin.cshtmlSetPassword.cshtmlSignedOut.cshtml
Apps
CreateApp.cshtmlListApps.cshtmlTemplateEditor.cshtmlUpdateCrowdfund.cshtmlUpdatePointOfSale.cshtml_ViewImports.cshtml_ViewStart.cshtml
AppsPublic
Error
EthereumLikeStore
Home
Invoice
Checkout-Body.cshtmlCheckout-Spinner.cshtmlCheckout.cshtmlCheckoutNoScript.cshtmlCreateInvoice.cshtmlInvoice.cshtmlListInvoices.cshtmlListInvoicesPaymentsPartial.cshtmlPosData.cshtmlRefund.cshtml_ViewImports.cshtml
Manage
APIKeys.cshtmlAddApiKey.cshtmlAddU2FDevice.cshtmlAuthorizeAPIKey.cshtmlChangePassword.cshtmlConfirmAPIKey.cshtmlEnableAuthenticator.cshtmlGenerateRecoveryCodes.cshtmlIndex.cshtmlManageNavPages.csSetPassword.cshtmlTwoFactorAuthentication.cshtmlU2FAuthentication.cshtml_Nav.cshtml_ViewImports.cshtml_ViewStart.cshtml
MoneroLikeStore
Notifications
PaymentRequest
EditPaymentRequest.cshtmlGetPaymentRequests.cshtmlMinimalPaymentRequest.cshtmlViewPaymentRequest.cshtml
Public
PublicLightningNodeInfo
PullPayment
Server
CLightningRestServices.cshtmlConfiguratorService.cshtmlCreateTemporaryFileUrl.cshtmlCreateUser.cshtmlDynamicDnsService.cshtmlDynamicDnsServices.cshtmlEditAmazonS3StorageProvider.cshtmlEditAzureBlobStorageStorageProvider.cshtmlEditFilesystemStorageProvider.cshtmlEditGoogleCloudStorageStorageProvider.cshtmlEmails.cshtmlFiles.cshtmlLightningChargeServices.cshtmlLightningWalletServices.cshtmlListUsers.cshtmlLndSeedBackup.cshtmlLndServices.cshtmlLogs.cshtmlMaintenance.cshtmlP2PService.cshtmlPolicies.cshtmlRPCService.cshtmlSSHService.cshtmlServerNavPages.csServices.cshtmlStorage.cshtmlTheme.cshtmlUser.cshtml_Nav.cshtml_ViewImports.cshtml_ViewStart.cshtml
Shared
Bitcoin
BitcoinLikeMethodCheckout-v2.cshtmlBitcoinLikeMethodCheckout.cshtmlBitcoinLikeMethodCheckoutNoScript.cshtmlViewBitcoinLikePaymentData.cshtml
Bitcoin_Lightning_LikeMethodCheckout.cshtmlBitcoin_Lightning_LikeMethodCheckoutNoScript.cshtmlCameraScanner.cshtmlConfirm.cshtmlConfirmModal.cshtmlCreateOrEditRole.cshtmlCrowdfund
EmailsBody.cshtmlEthereum
ETHSyncSummary.cshtmlEthereumLikeMethodCheckout.cshtmlStoreNavEthereumExtension.cshtmlUpdateChainConfig.cshtmlViewEthereumLikePaymentData.cshtml
Forms
Header.cshtmlLNURL
LayoutFoot.cshtmlLayoutHead.cshtmlLayoutHeadStoreBranding.cshtmlLayoutHeadTheme.cshtmlLayoutPartials
Lightning
LightningLikeMethodCheckout-v2.cshtmlLightningLikeMethodCheckout.cshtmlViewLightningLikePaymentData.cshtml
ListRoles.cshtmlMonero
MoneroSyncSummary.cshtmlStoreNavMoneroExtension.cshtmlStoreWalletsNavMoneroExtension.cshtmlViewMoneroLikePaymentData.cshtml
NBXSyncSummary.cshtmlNFC
NotificationEmailWarning.cshtmlPayButton
PointOfSale
PosData.cshtmlPostRedirect.cshtmlShopify
ShowQR.cshtmlTemplateEditor.cshtmlVaultElements.cshtmlViewBitcoinLikePaymentData.cshtmlViewLightningLikePaymentData.cshtmlZcash
_BTCPaySupporters.cshtml_Confirm.cshtml_Footer.cshtml_Form.cshtml_FormTopMessages.cshtml_FormWrap.cshtml_Layout.cshtml_LayoutPos.cshtml_LayoutSignedOut.cshtml_LayoutSimple.cshtml_LayoutWizard.cshtml_NavLayout.cshtml_StatusMessage.cshtml_StoreFooterLogo.cshtml_StoreHeader.cshtml_ValidationScriptsPartial.cshtmlStores
AddDerivationScheme.cshtmlAddDerivationSchemes_HardwareWalletDialogs.cshtmlAddDerivationSchemes_NBXWalletGenerate.cshtmlAddLightningNode.cshtmlCheckoutExperience.cshtmlCreateToken.cshtmlEmails.cshtmlIntegrations.cshtml
Integrations
ListTokens.cshtmlPayButton.cshtmlPayButtonEnable.cshtmlRates.cshtmlRequestPairing.cshtmlShowToken.cshtmlStoreNavPages.csStoreUsers.cshtmlUpdateCoinSwitchSettings.cshtmlUpdateStore.cshtml_Nav.cshtml_ViewImports.cshtml_ViewStart.cshtmlUIAccount
CheatPermissions.cshtmlForgotPassword.cshtmlForgotPasswordConfirmation.cshtmlLockout.cshtmlLogin.cshtmlLoginWith2fa.cshtmlLoginWithFido2.cshtmlLoginWithLNURLAuth.cshtmlLoginWithRecoveryCode.cshtmlRegister.cshtmlSecondaryLogin.cshtmlSetPassword.cshtml
UIApps
UICustodianAccounts
CreateCustodianAccount.cshtmlCustodianAccountsNavPages.csEditCustodianAccount.cshtmlViewCustodianAccount.cshtml
UIError
403.cshtml404.cshtml406.cshtml417.cshtml429.cshtml500.cshtml502.cshtmlHandle.cshtml_LayoutError.cshtml
UIFido2
UIForms
UIHome
UIInvoice
Checkout-Cheating.cshtmlCheckout-Testing.cshtmlCheckoutV2.cshtmlCreateInvoice.cshtmlInvoice.cshtmlInvoiceNavPages.csInvoiceReceipt.cshtmlInvoiceReceiptPrint.cshtmlInvoiceStatusChangePartial.cshtmlListInvoices.cshtmlListInvoicesPaymentsPartial.cshtml_RefundModal.cshtml_ViewImports.cshtml_ViewStart.cshtml
UILNURL
UILNURLAuth
UILightning
UILightningAutomatedPayoutProcessors
UILightningLikePayout
UIManage
APIKeys.cshtmlAddApiKey.cshtmlAuthorizeAPIKey.cshtmlConfirmAPIKey.cshtmlEnableAuthenticator.cshtmlIndex.cshtmlLoginCodes.cshtmlManageNavPages.csNotificationSettings.cshtmlTwoFactorAuthentication.cshtml_Nav.cshtml_ViewImports.cshtml_ViewStart.cshtml
UINotifications
UIOnChainAutomatedPayoutProcessors
UIPaymentRequest
EditPaymentRequest.cshtmlGetPaymentRequests.cshtmlPaymentRequestsNavPages.csViewPaymentRequest.cshtml_ViewImports.cshtml_ViewStart.cshtml
UIPayoutProcessors
UIPublic
UIPublicLightningNodeInfo
UIPullPayment
UIReports
UIServer
CLightningRestServices.cshtmlConfiguratorService.cshtmlCreateTemporaryFileUrl.cshtmlDynamicDnsService.cshtmlDynamicDnsServices.cshtmlEditAzureBlobStorageStorageProvider.cshtmlEditGoogleCloudStorageStorageProvider.cshtmlEmails.cshtmlFiles.cshtmlLightningChargeServices.cshtmlListPlugins.cshtmlListUsers.cshtmlLndSeedBackup.cshtmlLndServices.cshtmlMaintenance.cshtmlP2PService.cshtmlPolicies.cshtmlRPCService.cshtmlSSHService.cshtmlServices.cshtmlStorage.cshtmlTheme.cshtmlUser.cshtml_Nav.cshtml_ViewImports.cshtml_ViewStart.cshtml
UIShopify
UIStorePullPayments
UIStores
CheckoutAppearance.cshtmlDashboard.cshtmlGeneralSettings.cshtmlGenerateWallet.cshtmlGenerateWalletOptions.cshtml
ImportWallet
ImportWalletOptions.cshtmlLightning.cshtmlLightningSettings.cshtmlListTokens.cshtmlModifyWebhook.cshtmlRates.cshtmlRequestPairing.cshtmlSetupLightningNode.cshtmlSetupWallet.cshtmlStoreEmailSettings.cshtmlStoreEmailSettings.cshtml~refs/remotes/Kukks
StoreEmails.cshtmlStoreNavPages.csStoreUsers.cshtmlTestWebhook.cshtmlWalletSettings.cshtmlWebhooks.cshtml_GenerateWalletForm.cshtml_LayoutWalletSetup.cshtml_Nav.cshtml_ViewImports.cshtml_ViewStart.cshtmlUIUserStores
UIWallets
CoinSelection.cshtmlListWallets.cshtmlSignWithSeed.cshtmlWalletPSBT.cshtmlWalletPSBTCombine.cshtmlWalletPSBTDecoded.cshtmlWalletReceive.cshtmlWalletSend.cshtmlWalletSendVault.cshtmlWalletSigningOptions.cshtmlWalletTransactions.cshtml_Nav.cshtml_PSBTInfo.cshtml_ViewImports.cshtml_ViewStart.cshtml_WalletTransactionsList.cshtml
UIZcashLikeStore
UserStores
ViewsRazor.csWallets
CoinSelection.cshtmlListWallets.cshtmlNewPullPayment.cshtmlPayouts.cshtmlPullPayments.cshtmlSignWithSeed.cshtmlSigningContext.cshtmlWalletCameraScanner.cshtmlWalletPSBT.cshtmlWalletPSBTCombine.cshtmlWalletPSBTReady.cshtmlWalletReceive.cshtmlWalletRescan.cshtmlWalletSend.cshtmlWalletSendVault.cshtmlWalletSettings.cshtmlWalletSigningMenu.cshtmlWalletTransactions.cshtmlWalletsNavPages.cs_Nav.cshtml_ViewImports.cshtml_ViewStart.cshtml
wwwroot
_bootstrap_kitchensink.htmlmanifest.json
bundles
cart
checkout-v2
checkout
crowdfund-admin
crowdfund
img
acinq-logo.svgalby.pngbg.pngbtse.svgdglab.svg
errorpages
github.pnggithub.svgheader.jpgicon-sprite.svgkraken.svgledger-help-xpub.pnglightningterminal.pnglock-logo.pnglogo.svglunanode.svgmattermost.pngmattermost.svgmoney-logo.pngnomics.svgokcoin.svgpaybutton
pebblewallet.jpgpos-sample
qr-logo.pngreadme
supporter.svgsupporter_acinq.svgsupporter_bailliegifford.svgsupporter_coincards.svgsupporter_esc.svgsupporter_hrf.svgsupporter_ivpn.svgsupporter_kraken.svgsupporter_lunanode.svgsupporter_opensats.svgsupporter_pnxbet.svgsupporter_spiral.svgsupporter_strike.svgsupporter_walletofsatoshi.svg
rtl.pngslack.pngslack.svgspark.pngspecter.pngsquarecrypto.svgsupporter-sprite.svgthunderhub.pngtorq.pngtwitter.pngtwitter.svgwalletofsatoshi.svgyoutube.pngimlegacy
js
StoreAddDerivationScheme.jscopy-to-clipboard.jscustodian-account.jsdatatable.jsform-editor.jsstore-reports.jstheme-switch.jstoggle-password.jsvaultbridge.jsvaultbridge.ui.js
wallet
webauthn
light-pos
locales
am-ET.jsonar.jsonaz.jsonbg-BG.jsonbs-BA.jsonca-ES.json
checkout
am-ET.jsonar.jsonaz.jsonbg-BG.jsonbs-BA.jsonca-ES.jsoncs-CZ.jsonda-DK.jsonde-DE.jsonel-GR.jsonen.jsones-ES.jsonfa.jsonfi-FI.jsonfr-FR.jsonhe.jsonhi.jsonhr-HR.jsonhu-HU.jsonhy.jsonid.jsonis-IS.jsonit-IT.jsonja-JP.jsonka.jsonkk-KZ.jsonko.jsonlv.jsonnl-NL.jsonno.jsonnp-NP.jsonpl.jsonpt-BR.jsonpt-PT.jsonro.jsonru-RU.jsonsk-SK.jsonsl-SI.jsonsr.jsonsv.jsonth-TH.jsontr.jsonuk-UA.jsonvi-VN.jsonzh-SG.jsonzh-SP.jsonzh-TW.jsonzu.json
cs-CZ.jsonda-DK.jsonde-DE.jsonel-GR.jsonen.jsones-ES.jsonfa.jsonfi-FI.jsonfr-FR.jsonhe.jsonhi.jsonhr-HR.jsonhu-HU.jsonhy.jsonid.jsonis-IS.jsonit-IT.jsonja-JP.jsonka.jsonkk-KZ.jsonko.jsonlv.jsonnl-NL.jsonno.jsonnp-NP.jsonpl.jsonpt-BR.jsonpt-PT.jsonro.jsonru-RU.jsonsk-SK.jsonsl-SI.jsonsr.jsonsv.jsonth-TH.jsontr.jsonuk-UA.jsonvi-VN.jsonzh-SG.jsonzh-SP.jsonzh-TW.jsonzu.jsonmain
bootstrap
bootstrap4-creativestart
fonts
layout.cssqrcode.csssite.csssite.jstemplate-editor.cssthemes
utils.jswizard.cssmodal
paybutton
payment-request-admin
payment-request
pos-admin
pos
shopify
swagger/v1
swagger.template.api-keys.jsonswagger.template.apps.jsonswagger.template.authorization.jsonswagger.template.custodians.jsonswagger.template.health.jsonswagger.template.invoices.jsonswagger.template.jsonswagger.template.lightning.common.jsonswagger.template.lightning.internal.jsonswagger.template.lightning.store.jsonswagger.template.misc.jsonswagger.template.notifications.jsonswagger.template.payment-requests.jsonswagger.template.payout-processors.jsonswagger.template.pull-payments.jsonswagger.template.serverinfo.jsonswagger.template.stores-email.jsonswagger.template.stores-lightning-addresses.jsonswagger.template.stores-payment-methods.jsonswagger.template.stores-payment-methods.lightning-network.jsonswagger.template.stores-payment-methods.lnurl.jsonswagger.template.stores-payment-methods.on-chain.jsonswagger.template.stores-rates-config.jsonswagger.template.stores-rates.jsonswagger.template.stores-users.jsonswagger.template.stores-wallet.on-chain.jsonswagger.template.stores-wallet.on-chain.objects.jsonswagger.template.stores.jsonswagger.template.users.jsonswagger.template.webhooks.json
tests
vendor
FileSaver
babel-polyfill
bootstrap-vue
bootstrap-vue.cssbootstrap-vue.jsbootstrap-vue.min.cssbootstrap-vue.min.jsbootstrap-vue.min.min.css.mapbootstrap-vue.min.min.js.map
bootstrap
chartist
clipboard.js
dom-confetti
flatpickr
highlightjs
i18next
jquery-easing
jquery-prettydropdowns
jquery
magnific-popup
papaparse
popper
scrollreveal
signalr
summernote
font
summernote-bs4.csssummernote-bs4.jssummernote-bs4.js.mapsummernote-bs4.min.csssummernote-bs4.min.jssummernote-bs4.min.js.LICENSE.txtsummernote-bs4.min.js.mapsummernote-bs5.csstom-select
u2f
ur-registry
vex/css
vue-qrcode-reader
vue-qrcode
vue-sanitize-directive
vue-sortable
vuejs
Build
Changelog.mdLICENSEREADME.mdSECURITY.mdamd64.Dockerfilearm32v7.Dockerfilearm64v8.Dockerfilebtcpayserver.slnbtcpayserver.sln.DotSettingsbuild.ps1build.shdocker-entrypoint.shdocs
publish-docker.ps1run.ps1run.sh@ -2,15 +2,15 @@ version: 2
|
|||||||
jobs:
|
jobs:
|
||||||
fast_tests:
|
fast_tests:
|
||||||
machine:
|
machine:
|
||||||
image: ubuntu-2004:202111-02
|
enabled: true
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- run:
|
- run:
|
||||||
command: |
|
command: |
|
||||||
cd .circleci && ./run-tests.sh "Fast=Fast|ThirdParty=ThirdParty" && ./can-build.sh
|
cd .circleci && ./run-tests.sh "Fast=Fast" && ./can-build.sh
|
||||||
selenium_tests:
|
selenium_tests:
|
||||||
machine:
|
machine:
|
||||||
image: ubuntu-2004:202111-02
|
enabled: true
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- run:
|
- run:
|
||||||
@ -18,77 +18,85 @@ jobs:
|
|||||||
cd .circleci && ./run-tests.sh "Selenium=Selenium"
|
cd .circleci && ./run-tests.sh "Selenium=Selenium"
|
||||||
integration_tests:
|
integration_tests:
|
||||||
machine:
|
machine:
|
||||||
image: ubuntu-2004:202111-02
|
enabled: true
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- run:
|
- run:
|
||||||
command: |
|
command: |
|
||||||
cd .circleci && ./run-tests.sh "Integration=Integration"
|
cd .circleci && ./run-tests.sh "Integration=Integration"
|
||||||
trigger_docs_build:
|
external_tests:
|
||||||
machine:
|
machine:
|
||||||
image: ubuntu-2004:202111-02
|
enabled: true
|
||||||
steps:
|
|
||||||
- run:
|
|
||||||
command: |
|
|
||||||
curl -X POST -H "Authorization: token $GH_PAT" -H "Accept: application/vnd.github.everest-preview+json" -H "Content-Type: application/json" https://api.github.com/repos/btcpayserver/btcpayserver-doc/dispatches --data '{"event_type": "build_docs"}'
|
|
||||||
|
|
||||||
# publish jobs require $DOCKERHUB_REPO, $DOCKERHUB_USER, $DOCKERHUB_PASS defined
|
|
||||||
amd64:
|
|
||||||
machine:
|
|
||||||
image: ubuntu-2004:202111-02
|
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
|
- run:
|
||||||
|
command: |
|
||||||
|
if [ "$CIRCLE_PROJECT_USERNAME" == "btcpayserver" ] && [ "$CIRCLE_PROJECT_REPONAME" == "btcpayserver" ]; then
|
||||||
|
cd .circleci && ./run-tests.sh "ExternalIntegration=ExternalIntegration"
|
||||||
|
else
|
||||||
|
echo "Skipping running ExternalIntegration tests outside of context of main user and repository that have access to secrets"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# publish jobs require $DOCKERHUB_REPO, $DOCKERHUB_USER, $DOCKERHUB_PASS defined
|
||||||
|
amd64:
|
||||||
|
machine:
|
||||||
|
enabled: true
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
- run:
|
- run:
|
||||||
command: |
|
command: |
|
||||||
LATEST_TAG=${CIRCLE_TAG:1} #trim v from tag
|
LATEST_TAG=${CIRCLE_TAG:1} #trim v from tag
|
||||||
GIT_COMMIT=$(git rev-parse HEAD)
|
|
||||||
#
|
#
|
||||||
sudo docker build --build-arg GIT_COMMIT=${GIT_COMMIT} --pull -t $DOCKERHUB_REPO:$LATEST_TAG-amd64 -f amd64.Dockerfile .
|
sudo docker build --pull -t $DOCKERHUB_REPO:$LATEST_TAG-amd64 -f amd64.Dockerfile .
|
||||||
sudo docker build --build-arg GIT_COMMIT=${GIT_COMMIT} --pull --build-arg CONFIGURATION_NAME=Altcoins-Release -t $DOCKERHUB_REPO:$LATEST_TAG-altcoins-amd64 -f amd64.Dockerfile .
|
sudo docker build --pull --build-arg CONFIGURATION_NAME=Altcoins-Release -t $DOCKERHUB_REPO:$LATEST_TAG-altcoins-amd64 -f amd64.Dockerfile .
|
||||||
sudo docker login --username=$DOCKERHUB_USER --password=$DOCKERHUB_PASS
|
sudo docker login --username=$DOCKERHUB_USER --password=$DOCKERHUB_PASS
|
||||||
sudo docker push $DOCKERHUB_REPO:$LATEST_TAG-amd64
|
sudo docker push $DOCKERHUB_REPO:$LATEST_TAG-amd64
|
||||||
sudo docker push $DOCKERHUB_REPO:$LATEST_TAG-altcoins-amd64
|
sudo docker push $DOCKERHUB_REPO:$LATEST_TAG-altcoins-amd64
|
||||||
|
|
||||||
arm32v7:
|
arm32v7:
|
||||||
machine:
|
machine:
|
||||||
image: ubuntu-2004:202111-02
|
enabled: true
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- run:
|
- run:
|
||||||
command: |
|
command: |
|
||||||
sudo docker run --rm --privileged multiarch/qemu-user-static:register --reset
|
sudo docker run --rm --privileged multiarch/qemu-user-static:register --reset
|
||||||
LATEST_TAG=${CIRCLE_TAG:1} #trim v from tag
|
LATEST_TAG=${CIRCLE_TAG:1} #trim v from tag
|
||||||
GIT_COMMIT=$(git rev-parse HEAD)
|
|
||||||
#
|
#
|
||||||
sudo docker build --build-arg GIT_COMMIT=${GIT_COMMIT} --pull -t $DOCKERHUB_REPO:$LATEST_TAG-arm32v7 -f arm32v7.Dockerfile .
|
sudo docker build --pull -t $DOCKERHUB_REPO:$LATEST_TAG-arm32v7 -f arm32v7.Dockerfile .
|
||||||
sudo docker build --build-arg GIT_COMMIT=${GIT_COMMIT} --pull --build-arg CONFIGURATION_NAME=Altcoins-Release -t $DOCKERHUB_REPO:$LATEST_TAG-altcoins-arm32v7 -f arm32v7.Dockerfile .
|
sudo docker build --pull --build-arg CONFIGURATION_NAME=Altcoins-Release -t $DOCKERHUB_REPO:$LATEST_TAG-altcoins-arm32v7 -f arm32v7.Dockerfile .
|
||||||
sudo docker login --username=$DOCKERHUB_USER --password=$DOCKERHUB_PASS
|
sudo docker login --username=$DOCKERHUB_USER --password=$DOCKERHUB_PASS
|
||||||
sudo docker push $DOCKERHUB_REPO:$LATEST_TAG-arm32v7
|
sudo docker push $DOCKERHUB_REPO:$LATEST_TAG-arm32v7
|
||||||
sudo docker push $DOCKERHUB_REPO:$LATEST_TAG-altcoins-arm32v7
|
sudo docker push $DOCKERHUB_REPO:$LATEST_TAG-altcoins-arm32v7
|
||||||
|
|
||||||
arm64v8:
|
arm64v8:
|
||||||
machine:
|
machine:
|
||||||
image: ubuntu-2004:202111-02
|
enabled: true
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- run:
|
- run:
|
||||||
command: |
|
command: |
|
||||||
sudo docker run --rm --privileged multiarch/qemu-user-static:register --reset
|
sudo docker run --rm --privileged multiarch/qemu-user-static:register --reset
|
||||||
LATEST_TAG=${CIRCLE_TAG:1} #trim v from tag
|
LATEST_TAG=${CIRCLE_TAG:1} #trim v from tag
|
||||||
GIT_COMMIT=$(git rev-parse HEAD)
|
|
||||||
#
|
#
|
||||||
sudo docker build --build-arg GIT_COMMIT=${GIT_COMMIT} --pull -t $DOCKERHUB_REPO:$LATEST_TAG-arm64v8 -f arm64v8.Dockerfile .
|
sudo docker build --pull -t $DOCKERHUB_REPO:$LATEST_TAG-arm64v8 -f arm64v8.Dockerfile .
|
||||||
sudo docker build --build-arg GIT_COMMIT=${GIT_COMMIT} --build-arg CONFIGURATION_NAME=Altcoins-Release --pull -t $DOCKERHUB_REPO:$LATEST_TAG-altcoins-arm64v8 -f arm64v8.Dockerfile .
|
sudo docker build --build-arg CONFIGURATION_NAME=Altcoins-Release --pull -t $DOCKERHUB_REPO:$LATEST_TAG-altcoins-arm64v8 -f arm64v8.Dockerfile .
|
||||||
sudo docker login --username=$DOCKERHUB_USER --password=$DOCKERHUB_PASS
|
sudo docker login --username=$DOCKERHUB_USER --password=$DOCKERHUB_PASS
|
||||||
sudo docker push $DOCKERHUB_REPO:$LATEST_TAG-arm64v8
|
sudo docker push $DOCKERHUB_REPO:$LATEST_TAG-arm64v8
|
||||||
sudo docker push $DOCKERHUB_REPO:$LATEST_TAG-altcoins-arm64v8
|
sudo docker push $DOCKERHUB_REPO:$LATEST_TAG-altcoins-arm64v8
|
||||||
|
|
||||||
multiarch:
|
multiarch:
|
||||||
machine:
|
machine:
|
||||||
image: ubuntu-2004:202201-02
|
enabled: true
|
||||||
|
image: circleci/classic:201808-01
|
||||||
steps:
|
steps:
|
||||||
- run:
|
- run:
|
||||||
command: |
|
command: |
|
||||||
|
# Turn on Experimental features
|
||||||
|
sudo mkdir $HOME/.docker
|
||||||
|
sudo sh -c 'echo "{ \"experimental\": \"enabled\" }" >> $HOME/.docker/config.json'
|
||||||
|
#
|
||||||
sudo docker login --username=$DOCKERHUB_USER --password=$DOCKERHUB_PASS
|
sudo docker login --username=$DOCKERHUB_USER --password=$DOCKERHUB_PASS
|
||||||
#
|
#
|
||||||
LATEST_TAG=${CIRCLE_TAG:1} #trim v from tag
|
LATEST_TAG=${CIRCLE_TAG:1} #trim v from tag
|
||||||
@ -97,7 +105,8 @@ jobs:
|
|||||||
sudo docker manifest annotate $DOCKERHUB_REPO:$LATEST_TAG $DOCKERHUB_REPO:$LATEST_TAG-arm32v7 --os linux --arch arm --variant v7
|
sudo docker manifest annotate $DOCKERHUB_REPO:$LATEST_TAG $DOCKERHUB_REPO:$LATEST_TAG-arm32v7 --os linux --arch arm --variant v7
|
||||||
sudo docker manifest annotate $DOCKERHUB_REPO:$LATEST_TAG $DOCKERHUB_REPO:$LATEST_TAG-arm64v8 --os linux --arch arm64 --variant v8
|
sudo docker manifest annotate $DOCKERHUB_REPO:$LATEST_TAG $DOCKERHUB_REPO:$LATEST_TAG-arm64v8 --os linux --arch arm64 --variant v8
|
||||||
sudo docker manifest push $DOCKERHUB_REPO:$LATEST_TAG -p
|
sudo docker manifest push $DOCKERHUB_REPO:$LATEST_TAG -p
|
||||||
|
|
||||||
|
|
||||||
sudo docker manifest create --amend $DOCKERHUB_REPO:$LATEST_TAG-altcoins $DOCKERHUB_REPO:$LATEST_TAG-altcoins-amd64 $DOCKERHUB_REPO:$LATEST_TAG-altcoins-arm32v7 $DOCKERHUB_REPO:$LATEST_TAG-altcoins-arm64v8
|
sudo docker manifest create --amend $DOCKERHUB_REPO:$LATEST_TAG-altcoins $DOCKERHUB_REPO:$LATEST_TAG-altcoins-amd64 $DOCKERHUB_REPO:$LATEST_TAG-altcoins-arm32v7 $DOCKERHUB_REPO:$LATEST_TAG-altcoins-arm64v8
|
||||||
sudo docker manifest annotate $DOCKERHUB_REPO:$LATEST_TAG-altcoins $DOCKERHUB_REPO:$LATEST_TAG-altcoins-amd64 --os linux --arch amd64
|
sudo docker manifest annotate $DOCKERHUB_REPO:$LATEST_TAG-altcoins $DOCKERHUB_REPO:$LATEST_TAG-altcoins-amd64 --os linux --arch amd64
|
||||||
sudo docker manifest annotate $DOCKERHUB_REPO:$LATEST_TAG-altcoins $DOCKERHUB_REPO:$LATEST_TAG-altcoins-arm32v7 --os linux --arch arm --variant v7
|
sudo docker manifest annotate $DOCKERHUB_REPO:$LATEST_TAG-altcoins $DOCKERHUB_REPO:$LATEST_TAG-altcoins-arm32v7 --os linux --arch arm --variant v7
|
||||||
@ -111,15 +120,12 @@ workflows:
|
|||||||
- fast_tests
|
- fast_tests
|
||||||
- selenium_tests
|
- selenium_tests
|
||||||
- integration_tests
|
- integration_tests
|
||||||
publish:
|
- external_tests:
|
||||||
jobs:
|
|
||||||
- trigger_docs_build:
|
|
||||||
filters:
|
filters:
|
||||||
branches:
|
branches:
|
||||||
ignore: /.*/
|
only: master
|
||||||
# only act on version tags
|
publish:
|
||||||
tags:
|
jobs:
|
||||||
only: /(v[1-9]+(\.[0-9]+)*(-[a-z0-9-]+)?)|(v[a-z0-9-]+)/
|
|
||||||
- amd64:
|
- amd64:
|
||||||
filters:
|
filters:
|
||||||
# ignore any commit on any branch by default
|
# ignore any commit on any branch by default
|
||||||
@ -129,6 +135,7 @@ workflows:
|
|||||||
# OR feature tags like vlndseedbackup
|
# OR feature tags like vlndseedbackup
|
||||||
# OR features on specific versions like v1.0.0.88-lndseedbackup-1
|
# OR features on specific versions like v1.0.0.88-lndseedbackup-1
|
||||||
tags:
|
tags:
|
||||||
|
|
||||||
only: /(v[1-9]+(\.[0-9]+)*(-[a-z0-9-]+)?)|(v[a-z0-9-]+)/
|
only: /(v[1-9]+(\.[0-9]+)*(-[a-z0-9-]+)?)|(v[a-z0-9-]+)/
|
||||||
- arm32v7:
|
- arm32v7:
|
||||||
filters:
|
filters:
|
||||||
|
@ -4,15 +4,6 @@ set -e
|
|||||||
cd ../BTCPayServer.Tests
|
cd ../BTCPayServer.Tests
|
||||||
docker-compose -v
|
docker-compose -v
|
||||||
docker-compose -f "docker-compose.altcoins.yml" down --v
|
docker-compose -f "docker-compose.altcoins.yml" down --v
|
||||||
|
docker-compose -f "docker-compose.altcoins.yml" pull
|
||||||
# For some reason, docker-compose pull fails time to time, so we try several times
|
|
||||||
n=0
|
|
||||||
until [ "$n" -ge 10 ]
|
|
||||||
do
|
|
||||||
docker-compose -f "docker-compose.altcoins.yml" pull && break
|
|
||||||
n=$((n+1))
|
|
||||||
sleep 5
|
|
||||||
done
|
|
||||||
|
|
||||||
docker-compose -f "docker-compose.altcoins.yml" build
|
docker-compose -f "docker-compose.altcoins.yml" build
|
||||||
docker-compose -f "docker-compose.altcoins.yml" run -e "TEST_FILTERS=$1" tests
|
docker-compose -f "docker-compose.altcoins.yml" run -e "TEST_FILTERS=$1" tests
|
||||||
|
@ -11,14 +11,10 @@ insert_final_newline = true
|
|||||||
indent_style = space
|
indent_style = space
|
||||||
indent_size = 4
|
indent_size = 4
|
||||||
charset = utf-8
|
charset = utf-8
|
||||||
space_before_self_closing = true
|
|
||||||
|
|
||||||
[*.json]
|
[launchSettings.json]
|
||||||
indent_size = 2
|
indent_size = 2
|
||||||
|
|
||||||
[swagger*.json]
|
|
||||||
indent_size = 4
|
|
||||||
|
|
||||||
# C# files
|
# C# files
|
||||||
[*.cs]
|
[*.cs]
|
||||||
# New line preferences
|
# New line preferences
|
||||||
@ -71,7 +67,7 @@ dotnet_naming_symbols.private_internal_fields.applicable_kinds = field
|
|||||||
dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal
|
dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal
|
||||||
|
|
||||||
dotnet_naming_style.camel_case_underscore_style.required_prefix = _
|
dotnet_naming_style.camel_case_underscore_style.required_prefix = _
|
||||||
dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case
|
dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case
|
||||||
|
|
||||||
# Code style defaults
|
# Code style defaults
|
||||||
dotnet_sort_system_directives_first = true
|
dotnet_sort_system_directives_first = true
|
||||||
@ -125,11 +121,8 @@ csharp_space_between_method_declaration_name_and_open_parenthesis = false
|
|||||||
csharp_space_between_method_declaration_parameter_list_parentheses = false
|
csharp_space_between_method_declaration_parameter_list_parentheses = false
|
||||||
csharp_space_between_parentheses = false
|
csharp_space_between_parentheses = false
|
||||||
csharp_space_between_square_brackets = false
|
csharp_space_between_square_brackets = false
|
||||||
csharp_style_prefer_null_check_over_type_check = true:warning
|
|
||||||
csharp_prefer_simple_using_statement = true:warning
|
|
||||||
|
|
||||||
# C++ Files
|
# C++ Files
|
||||||
|
|
||||||
[*.{cpp,h,in}]
|
[*.{cpp,h,in}]
|
||||||
curly_bracket_next_line = true
|
curly_bracket_next_line = true
|
||||||
indent_brace_style = Allman
|
indent_brace_style = Allman
|
||||||
|
38
.github/ISSUE_TEMPLATE/bug-report.md
vendored
Normal file
38
.github/ISSUE_TEMPLATE/bug-report.md
vendored
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
---
|
||||||
|
name: Bug report
|
||||||
|
about: File a bug report
|
||||||
|
title: ''
|
||||||
|
labels: ''
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Describe the bug**
|
||||||
|
A clear and concise description of what the bug is.
|
||||||
|
|
||||||
|
**To Reproduce**
|
||||||
|
Steps to reproduce the behavior:
|
||||||
|
1. Go to '...'
|
||||||
|
2. Click on '....'
|
||||||
|
3. Scroll down to '....'
|
||||||
|
4. See error
|
||||||
|
|
||||||
|
**Expected behavior**
|
||||||
|
A clear and concise description of what you expected to happen.
|
||||||
|
|
||||||
|
**Screenshots**
|
||||||
|
If applicable, add screenshots to help explain your problem.
|
||||||
|
|
||||||
|
**Your BTCPay Environment (please complete the following information):**
|
||||||
|
- BTCPay Server Version [available in the right bottom corner of footer]
|
||||||
|
- Deployment Method: [e.g. Docker, Manual, Third-Party-hoist]
|
||||||
|
- Browser [e.g. chrome, safari]
|
||||||
|
|
||||||
|
**Logs (if applicable)**
|
||||||
|
Basic logs can be found in Server Settings > Logs. More logs https://docs.btcpayserver.org/Troubleshooting/#2-looking-through-the-logs
|
||||||
|
|
||||||
|
**Setup Parameters**
|
||||||
|
If you're reporting a deployment issue run `. btcpay-setup.sh -i` and paste your the parameters by obscuring private information.
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
Add any other context about the problem here.
|
68
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
68
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
@ -1,68 +0,0 @@
|
|||||||
name: 🐛 Bug Report
|
|
||||||
description: File a bug report
|
|
||||||
title: "[Bug]: "
|
|
||||||
labels: ["bug"]
|
|
||||||
body:
|
|
||||||
- type: markdown
|
|
||||||
attributes:
|
|
||||||
value: |
|
|
||||||
Thanks for taking the time to fill out this bug report! Please provide as much information as you can. It helps us better understand the problem and fix it faster.
|
|
||||||
- type: textarea
|
|
||||||
id: version
|
|
||||||
attributes:
|
|
||||||
label: What is your BTCPay version?
|
|
||||||
description: You can see the version in the footer's bottom right corner
|
|
||||||
placeholder: I'm running BTCPay v1.X.X.X
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: textarea
|
|
||||||
id: deployment
|
|
||||||
attributes:
|
|
||||||
label: How did you deploy BTCPay Server?
|
|
||||||
description: Docker, manual, third-party host? Read more on deployment methods [here](https://docs.btcpayserver.org/Deployment/)
|
|
||||||
placeholder: I'm running BTCPay Server on a...
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: textarea
|
|
||||||
id: what-happened
|
|
||||||
attributes:
|
|
||||||
label: What happened?
|
|
||||||
description: A clear and concise description of what the bug is.
|
|
||||||
placeholder: Tell us what you see!
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: textarea
|
|
||||||
id: reproduce
|
|
||||||
attributes:
|
|
||||||
label: How did you encounter this bug?
|
|
||||||
description: Step by step describe how did you encounter the bug?
|
|
||||||
placeholder: 1. I clicked X 2. Then I clicked Y 3. See error
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: textarea
|
|
||||||
id: logoutput
|
|
||||||
attributes:
|
|
||||||
label: Relevant log output
|
|
||||||
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks. Logs can be found in Server Settings > Logs. Here's how you can [troubleshoot an issue](https://docs.btcpayserver.org/Troubleshooting/)
|
|
||||||
render: shell
|
|
||||||
- type: textarea
|
|
||||||
id: browser
|
|
||||||
attributes:
|
|
||||||
label: What browser do you use?
|
|
||||||
description: Provide your browser and it's version. If you replicated issues on multiple browsers, let us know which ones.
|
|
||||||
placeholder: For example Safari 15.00, Chrome 10.0, Tor, Edge, etc
|
|
||||||
validations:
|
|
||||||
required: false
|
|
||||||
- type: textarea
|
|
||||||
id: additonal
|
|
||||||
attributes:
|
|
||||||
label: Additional information
|
|
||||||
description: Feel free to provide additional information. Screenshots are always helpful.
|
|
||||||
- type: checkboxes
|
|
||||||
id: terms
|
|
||||||
attributes:
|
|
||||||
label: Are you sure this is a bug report?
|
|
||||||
description: By submitting this report, you agree that this is not a support or a feature request. For general questions please read our [documentation](https://docs.btcpayserver.org). You can ask questions in [discussions](https://github.com/btcpayserver/btcpayserver/discussions) and [on our community chat](https://chat.btcpayserver.org)
|
|
||||||
options:
|
|
||||||
- label: I confirm this is a bug report
|
|
||||||
required: true
|
|
18
.github/ISSUE_TEMPLATE/config.yml
vendored
18
.github/ISSUE_TEMPLATE/config.yml
vendored
@ -1,17 +1,5 @@
|
|||||||
blank_issues_enabled: true
|
blank_issues_enabled: false
|
||||||
contact_links:
|
contact_links:
|
||||||
- name: 💡 Request a feature
|
- name: Community Support Chat
|
||||||
url: https://github.com/btcpayserver/btcpayserver/discussions/categories/ideas-feature-requests
|
|
||||||
about: Submit a feature request or vote on ideas posted by others. Features with most upvotes become roadmap candidates
|
|
||||||
- name: 🧑💻 Ask a technical question
|
|
||||||
url: https://github.com/btcpayserver/btcpayserver/discussions/new?category=technical-support
|
|
||||||
about: If you're experiencing a technical problem post it to our community support forum
|
|
||||||
- name: 🔌 Report a problem with a plugin
|
|
||||||
url: https://github.com/btcpayserver/btcpayserver/discussions/new?category=plugins-integrations
|
|
||||||
about: Experiencing a problem with a third-party plugin? Post it here and we will tag their developers to assist
|
|
||||||
- name: 📝 Official Documentation
|
|
||||||
url: https://docs.btcpayserver.org
|
|
||||||
about: Check our documentation for answers to common questions
|
|
||||||
- name: 💬 Community Support Chat
|
|
||||||
url: https://chat.btcpayserver.org/
|
url: https://chat.btcpayserver.org/
|
||||||
about: Ask general questions and get community support in real-time
|
about: Ask general questions and get community support in real-time.
|
||||||
|
23
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
23
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
---
|
||||||
|
name: Feature request
|
||||||
|
about: Suggest a new feature or enhancement
|
||||||
|
title: ''
|
||||||
|
labels: ''
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Is your feature request related to a problem? Please describe.**
|
||||||
|
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||||
|
|
||||||
|
**Describe the solution you'd like**
|
||||||
|
A clear and concise description of what you want to happen.
|
||||||
|
|
||||||
|
**Sketch/Image/Wireframe/Mockup**
|
||||||
|
If applicable provide examples, wireframes, sketches or images to better explain your idea.
|
||||||
|
|
||||||
|
**Describe alternatives you've considered**
|
||||||
|
A clear and concise description of any alternative solutions or features you've considered.
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
Add any other context or screenshots about the feature request here.
|
2
.github/codeql/codeql-config.yml
vendored
2
.github/codeql/codeql-config.yml
vendored
@ -1,2 +0,0 @@
|
|||||||
paths-ignore:
|
|
||||||
- 'BTCPayServer/wwwroot/vendor/**/*.js'
|
|
80
.github/workflows/codeql.yml
vendored
80
.github/workflows/codeql.yml
vendored
@ -1,80 +0,0 @@
|
|||||||
# For most projects, this workflow file will not need changing; you simply need
|
|
||||||
# to commit it to your repository.
|
|
||||||
#
|
|
||||||
# You may wish to alter this file to override the set of languages analyzed,
|
|
||||||
# or to provide custom queries or build logic.
|
|
||||||
#
|
|
||||||
# ******** NOTE ********
|
|
||||||
# We have attempted to detect the languages in your repository. Please check
|
|
||||||
# the `language` matrix defined below to confirm you have the correct set of
|
|
||||||
# supported CodeQL languages.
|
|
||||||
#
|
|
||||||
name: "CodeQL"
|
|
||||||
|
|
||||||
on:
|
|
||||||
# Allow running tests manually. Usefull if scan failure, or need to rescan before next scheduled date.
|
|
||||||
workflow_dispatch:
|
|
||||||
# We scan only on a schedule for now, can uncomment the following to scan on commit or PR merge later on if deemed appropriate.
|
|
||||||
# push:
|
|
||||||
# branches: [ "master" ]
|
|
||||||
# pull_request:
|
|
||||||
# branches: [ "master" ]
|
|
||||||
schedule:
|
|
||||||
# Scan every Monday 06:00 UTC.
|
|
||||||
- cron: '0 6 * * 1'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
analyze:
|
|
||||||
name: Analyze
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
permissions:
|
|
||||||
actions: read
|
|
||||||
contents: read
|
|
||||||
security-events: write
|
|
||||||
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
language: [ 'javascript', 'csharp' ]
|
|
||||||
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
|
|
||||||
# Use only 'java' to analyze code written in Java, Kotlin or both
|
|
||||||
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
|
|
||||||
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
# Initializes the CodeQL tools for scanning.
|
|
||||||
- name: Initialize CodeQL
|
|
||||||
uses: github/codeql-action/init@v2
|
|
||||||
with:
|
|
||||||
languages: ${{ matrix.language }}
|
|
||||||
config-file: ./.github/codeql/codeql-config.yml
|
|
||||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
|
||||||
# By default, queries listed here will override any specified in a config file.
|
|
||||||
# Prefix the list here with "+" to use these queries and those in the config file.
|
|
||||||
|
|
||||||
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
|
|
||||||
# queries: security-extended,security-and-quality
|
|
||||||
|
|
||||||
|
|
||||||
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
|
|
||||||
# If this step fails, then you should remove it and run the build manually (see below)
|
|
||||||
- name: Autobuild
|
|
||||||
uses: github/codeql-action/autobuild@v2
|
|
||||||
|
|
||||||
# ℹ️ Command-line programs to run using the OS shell.
|
|
||||||
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
|
|
||||||
|
|
||||||
# If the Autobuild fails above, remove it and uncomment the following three lines.
|
|
||||||
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
|
|
||||||
|
|
||||||
# - run: |
|
|
||||||
# echo "Run, Build Application using script"
|
|
||||||
# ./location_of_script_within_repo/buildscript.sh
|
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
|
||||||
uses: github/codeql-action/analyze@v2
|
|
||||||
with:
|
|
||||||
category: "/language:${{matrix.language}}"
|
|
9
.gitignore
vendored
9
.gitignore
vendored
@ -288,14 +288,13 @@ __pycache__/
|
|||||||
*.xsd.cs
|
*.xsd.cs
|
||||||
/BTCPayServer/Build/dockerfiles
|
/BTCPayServer/Build/dockerfiles
|
||||||
|
|
||||||
|
# Bundling JS/CSS
|
||||||
|
BTCPayServer/wwwroot/bundles/*
|
||||||
|
!BTCPayServer/wwwroot/bundles/.gitignore
|
||||||
|
|
||||||
.vscode/*
|
.vscode/*
|
||||||
!.vscode/launch.json
|
!.vscode/launch.json
|
||||||
!.vscode/tasks.json
|
!.vscode/tasks.json
|
||||||
!.vscode/extensions.json
|
!.vscode/extensions.json
|
||||||
BTCPayServer/testpwd
|
BTCPayServer/testpwd
|
||||||
.DS_Store
|
.DS_Store
|
||||||
Packed Plugins
|
|
||||||
Plugins/packed
|
|
||||||
|
|
||||||
BTCPayServer/wwwroot/swagger/v1/openapi.json
|
|
||||||
BTCPayServer/appsettings.dev.json
|
|
4
.vscode/launch.json
vendored
4
.vscode/launch.json
vendored
@ -10,14 +10,14 @@
|
|||||||
"request": "launch",
|
"request": "launch",
|
||||||
"preLaunchTask": "build",
|
"preLaunchTask": "build",
|
||||||
// If you have changed target frameworks, make sure to update the program path.
|
// If you have changed target frameworks, make sure to update the program path.
|
||||||
"program": "${workspaceFolder}/BTCPayServer/bin/Debug/net6.0/BTCPayServer.dll",
|
"program": "${workspaceFolder}/BTCPayServer/bin/Debug/netcoreapp3.1/BTCPayServer.dll",
|
||||||
"args": [],
|
"args": [],
|
||||||
"cwd": "${workspaceFolder}/BTCPayServer",
|
"cwd": "${workspaceFolder}/BTCPayServer",
|
||||||
"stopAtEntry": false,
|
"stopAtEntry": false,
|
||||||
// Enable launching a web browser when ASP.NET Core starts. For more information: https://aka.ms/VSCode-CS-LaunchJson-WebBrowser
|
// Enable launching a web browser when ASP.NET Core starts. For more information: https://aka.ms/VSCode-CS-LaunchJson-WebBrowser
|
||||||
"serverReadyAction": {
|
"serverReadyAction": {
|
||||||
"action": "openExternally",
|
"action": "openExternally",
|
||||||
"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
|
"pattern": "\\bListening on\\s+(https?://\\S+)"
|
||||||
},
|
},
|
||||||
"env": {
|
"env": {
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
|
@ -1,43 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
<Import Project="../Build/Version.csproj" Condition="Exists('../Build/Version.csproj')" />
|
|
||||||
<Import Project="../Build/Common.csproj" />
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<Company>BTCPay Server</Company>
|
|
||||||
<Copyright>Copyright © BTCPay Server 2020</Copyright>
|
|
||||||
<Description>A library for BTCPay Server plugin development</Description>
|
|
||||||
<PackageIcon>icon.png</PackageIcon>
|
|
||||||
<PackageTags>btcpay,btcpayserver</PackageTags>
|
|
||||||
<PackageProjectUrl>https://github.com/btcpayserver/btcpayserver/tree/master/BTCPayServer.Abstractions</PackageProjectUrl>
|
|
||||||
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
|
||||||
<RepositoryUrl>https://github.com/btcpayserver/btcpayserver</RepositoryUrl>
|
|
||||||
<RepositoryType>git</RepositoryType>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
|
||||||
<PublishRepositoryUrl>true</PublishRepositoryUrl>
|
|
||||||
<EmbedUntrackedSources>true</EmbedUntrackedSources>
|
|
||||||
<DebugType>portable</DebugType>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
<NoWarn>1591;1573;1572;1584;1570;3021</NoWarn>
|
|
||||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup Condition=" '$(Configuration)' == 'Release' ">
|
|
||||||
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<FrameworkReference Include="Microsoft.AspNetCore.App" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="icon.png" Pack="true" PackagePath="\" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="HtmlSanitizer" Version="5.0.372" />
|
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.9" />
|
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.9" />
|
|
||||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="6.0.7" />
|
|
||||||
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="6.0.1" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\BTCPayServer.Client\BTCPayServer.Client.csproj" />
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
|
@ -1,18 +0,0 @@
|
|||||||
using Newtonsoft.Json;
|
|
||||||
|
|
||||||
namespace BTCPayServer.Abstractions
|
|
||||||
{
|
|
||||||
public class CamelCaseSerializerSettings
|
|
||||||
{
|
|
||||||
static CamelCaseSerializerSettings()
|
|
||||||
{
|
|
||||||
Settings = new JsonSerializerSettings()
|
|
||||||
{
|
|
||||||
ContractResolver = new Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver()
|
|
||||||
};
|
|
||||||
Serializer = JsonSerializer.Create(Settings);
|
|
||||||
}
|
|
||||||
public static readonly JsonSerializerSettings Settings;
|
|
||||||
public static readonly JsonSerializer Serializer;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,20 +0,0 @@
|
|||||||
using System.IO;
|
|
||||||
|
|
||||||
namespace BTCPayServer.Configuration
|
|
||||||
{
|
|
||||||
public class DataDirectories
|
|
||||||
{
|
|
||||||
public string DataDir { get; set; }
|
|
||||||
public string PluginDir { get; set; }
|
|
||||||
public string TempStorageDir { get; set; }
|
|
||||||
public string StorageDir { get; set; }
|
|
||||||
public string TempDir { get; set; }
|
|
||||||
|
|
||||||
public string ToDatadirFullPath(string path)
|
|
||||||
{
|
|
||||||
if (Path.IsPathRooted(path))
|
|
||||||
return path;
|
|
||||||
return Path.Combine(DataDir, path);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,7 +0,0 @@
|
|||||||
namespace BTCPayServer.Abstractions.Constants;
|
|
||||||
|
|
||||||
public class WellKnownTempData
|
|
||||||
{
|
|
||||||
public const string SuccessMessage = nameof(SuccessMessage);
|
|
||||||
public const string ErrorMessage = nameof(ErrorMessage);
|
|
||||||
}
|
|
@ -1,111 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Data.Common;
|
|
||||||
using BTCPayServer.Abstractions.Models;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.EntityFrameworkCore.Metadata;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
using Microsoft.Extensions.Options;
|
|
||||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Migrations;
|
|
||||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Migrations.Operations;
|
|
||||||
|
|
||||||
namespace BTCPayServer.Abstractions.Contracts
|
|
||||||
{
|
|
||||||
public abstract class BaseDbContextFactory<T> where T : DbContext
|
|
||||||
{
|
|
||||||
private readonly IOptions<DatabaseOptions> _options;
|
|
||||||
private readonly string _schemaPrefix;
|
|
||||||
|
|
||||||
public BaseDbContextFactory(IOptions<DatabaseOptions> options, string schemaPrefix)
|
|
||||||
{
|
|
||||||
_options = options;
|
|
||||||
_schemaPrefix = schemaPrefix;
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract T CreateContext();
|
|
||||||
class CustomNpgsqlMigrationsSqlGenerator : NpgsqlMigrationsSqlGenerator
|
|
||||||
{
|
|
||||||
#pragma warning disable EF1001 // Internal EF Core API usage.
|
|
||||||
public CustomNpgsqlMigrationsSqlGenerator(MigrationsSqlGeneratorDependencies dependencies, Npgsql.EntityFrameworkCore.PostgreSQL.Infrastructure.Internal.INpgsqlSingletonOptions opts) : base(dependencies, opts)
|
|
||||||
#pragma warning restore EF1001 // Internal EF Core API usage.
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Generate(NpgsqlCreateDatabaseOperation operation, IModel model, MigrationCommandListBuilder builder)
|
|
||||||
{
|
|
||||||
builder
|
|
||||||
.Append("CREATE DATABASE ")
|
|
||||||
.Append(Dependencies.SqlGenerationHelper.DelimitIdentifier(operation.Name));
|
|
||||||
|
|
||||||
// POSTGRES gotcha: Indexed Text column (even if PK) are not used if we are not using C locale
|
|
||||||
builder
|
|
||||||
.Append(" TEMPLATE ")
|
|
||||||
.Append(Dependencies.SqlGenerationHelper.DelimitIdentifier("template0"));
|
|
||||||
|
|
||||||
builder
|
|
||||||
.Append(" LC_CTYPE ")
|
|
||||||
.Append(Dependencies.SqlGenerationHelper.DelimitIdentifier("C"));
|
|
||||||
|
|
||||||
builder
|
|
||||||
.Append(" LC_COLLATE ")
|
|
||||||
.Append(Dependencies.SqlGenerationHelper.DelimitIdentifier("C"));
|
|
||||||
|
|
||||||
builder
|
|
||||||
.Append(" ENCODING ")
|
|
||||||
.Append(Dependencies.SqlGenerationHelper.DelimitIdentifier("UTF8"));
|
|
||||||
|
|
||||||
if (operation.Tablespace != null)
|
|
||||||
{
|
|
||||||
builder
|
|
||||||
.Append(" TABLESPACE ")
|
|
||||||
.Append(Dependencies.SqlGenerationHelper.DelimitIdentifier(operation.Tablespace));
|
|
||||||
}
|
|
||||||
|
|
||||||
builder.AppendLine(Dependencies.SqlGenerationHelper.StatementTerminator);
|
|
||||||
|
|
||||||
EndStatement(builder, suppressTransaction: true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ConfigureBuilder(DbContextOptionsBuilder builder)
|
|
||||||
{
|
|
||||||
switch (_options.Value.DatabaseType)
|
|
||||||
{
|
|
||||||
case DatabaseType.Sqlite:
|
|
||||||
builder.UseSqlite(_options.Value.ConnectionString, o =>
|
|
||||||
{
|
|
||||||
if (!string.IsNullOrEmpty(_schemaPrefix))
|
|
||||||
{
|
|
||||||
o.MigrationsHistoryTable(_schemaPrefix);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
case DatabaseType.Postgres:
|
|
||||||
builder
|
|
||||||
.UseNpgsql(_options.Value.ConnectionString, o =>
|
|
||||||
{
|
|
||||||
o.EnableRetryOnFailure(10);
|
|
||||||
if (!string.IsNullOrEmpty(_schemaPrefix))
|
|
||||||
{
|
|
||||||
o.MigrationsHistoryTable(_schemaPrefix);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.ReplaceService<IMigrationsSqlGenerator, CustomNpgsqlMigrationsSqlGenerator>();
|
|
||||||
break;
|
|
||||||
case DatabaseType.MySQL:
|
|
||||||
builder.UseMySql(_options.Value.ConnectionString, ServerVersion.AutoDetect(_options.Value.ConnectionString), o =>
|
|
||||||
{
|
|
||||||
o.EnableRetryOnFailure(10);
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(_schemaPrefix))
|
|
||||||
{
|
|
||||||
o.MigrationsHistoryTable(_schemaPrefix);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new ArgumentOutOfRangeException();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
using System.Threading.Tasks;
|
|
||||||
using BTCPayServer.Client;
|
|
||||||
using Microsoft.AspNetCore.Http;
|
|
||||||
|
|
||||||
namespace BTCPayServer.Abstractions.Contracts
|
|
||||||
{
|
|
||||||
public interface IBTCPayServerClientFactory
|
|
||||||
{
|
|
||||||
Task<BTCPayServerClient> Create(string userId, params string[] storeIds);
|
|
||||||
Task<BTCPayServerClient> Create(string userId, string[] storeIds, HttpContext httpRequest);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,32 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Text.Json.Serialization;
|
|
||||||
using BTCPayServer.Abstractions.Converters;
|
|
||||||
using Microsoft.AspNetCore.Builder;
|
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
|
||||||
|
|
||||||
namespace BTCPayServer.Abstractions.Contracts
|
|
||||||
{
|
|
||||||
public interface IBTCPayServerPlugin
|
|
||||||
{
|
|
||||||
public string Identifier { get; }
|
|
||||||
string Name { get; }
|
|
||||||
[JsonConverter(typeof(VersionConverter))]
|
|
||||||
Version Version { get; }
|
|
||||||
string Description { get; }
|
|
||||||
bool SystemPlugin { get; set; }
|
|
||||||
PluginDependency[] Dependencies { get; }
|
|
||||||
void Execute(IApplicationBuilder applicationBuilder, IServiceProvider applicationBuilderApplicationServices);
|
|
||||||
void Execute(IServiceCollection applicationBuilder);
|
|
||||||
|
|
||||||
public class PluginDependency
|
|
||||||
{
|
|
||||||
public string Identifier { get; set; }
|
|
||||||
public string Condition { get; set; }
|
|
||||||
public override string ToString()
|
|
||||||
{
|
|
||||||
return $"{Identifier}: {Condition}";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
#nullable enable
|
|
||||||
using System;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Microsoft.AspNetCore.Http;
|
|
||||||
|
|
||||||
namespace BTCPayServer.Abstractions.Contracts;
|
|
||||||
|
|
||||||
public interface IFileService
|
|
||||||
{
|
|
||||||
Task<bool> IsAvailable();
|
|
||||||
Task<IStoredFile> AddFile(IFormFile file, string userId);
|
|
||||||
Task<IStoredFile> AddFile(Uri file, string userId);
|
|
||||||
Task<string?> GetFileUrl(Uri baseUri, string fileId);
|
|
||||||
Task<string?> GetTemporaryFileUrl(Uri baseUri, string fileId, DateTimeOffset expiry,
|
|
||||||
bool isDownload);
|
|
||||||
Task RemoveFile(string fileId, string userId);
|
|
||||||
}
|
|
@ -1,29 +0,0 @@
|
|||||||
using System;
|
|
||||||
|
|
||||||
namespace BTCPayServer.Abstractions.Contracts
|
|
||||||
{
|
|
||||||
public abstract class BaseNotification
|
|
||||||
{
|
|
||||||
public abstract string Identifier { get; }
|
|
||||||
public abstract string NotificationType { get; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface INotificationHandler
|
|
||||||
{
|
|
||||||
string NotificationType { get; }
|
|
||||||
Type NotificationBlobType { get; }
|
|
||||||
public (string identifier, string name)[] Meta { get; }
|
|
||||||
void FillViewModel(object notification, NotificationViewModel vm);
|
|
||||||
}
|
|
||||||
|
|
||||||
public class NotificationViewModel
|
|
||||||
{
|
|
||||||
public string Id { get; set; }
|
|
||||||
public string Identifier { get; set; }
|
|
||||||
public string Type { get; set; }
|
|
||||||
public DateTimeOffset Created { get; set; }
|
|
||||||
public string Body { get; set; }
|
|
||||||
public string ActionLink { get; set; }
|
|
||||||
public bool Seen { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,10 +0,0 @@
|
|||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace BTCPayServer.Abstractions.Contracts
|
|
||||||
{
|
|
||||||
public interface IPluginHookAction
|
|
||||||
{
|
|
||||||
public string Hook { get; }
|
|
||||||
Task Execute(object args);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace BTCPayServer.Abstractions.Contracts
|
|
||||||
{
|
|
||||||
public interface IPluginHookFilter
|
|
||||||
{
|
|
||||||
public string Hook { get; }
|
|
||||||
|
|
||||||
Task<object> Execute(object args);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,14 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace BTCPayServer.Abstractions.Contracts
|
|
||||||
{
|
|
||||||
public interface IPluginHookService
|
|
||||||
{
|
|
||||||
Task ApplyAction(string hook, object args);
|
|
||||||
Task<object> ApplyFilter(string hook, object args);
|
|
||||||
|
|
||||||
event EventHandler<(string hook, object args)> ActionInvoked;
|
|
||||||
event EventHandler<(string hook, object args)> FilterInvoked;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,7 +0,0 @@
|
|||||||
#nullable enable
|
|
||||||
namespace BTCPayServer.Abstractions.Contracts;
|
|
||||||
|
|
||||||
public interface IScopeProvider
|
|
||||||
{
|
|
||||||
string? GetCurrentStoreId();
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
#nullable enable
|
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace BTCPayServer.Abstractions.Contracts
|
|
||||||
{
|
|
||||||
public interface ISettingsRepository
|
|
||||||
{
|
|
||||||
Task<T?> GetSettingAsync<T>(string? name = null) where T : class;
|
|
||||||
Task UpdateSetting<T>(T obj, string? name = null) where T : class;
|
|
||||||
Task<T> WaitSettingsChanged<T>(CancellationToken cancellationToken = default) where T : class;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
#nullable enable
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace BTCPayServer.Abstractions.Contracts;
|
|
||||||
|
|
||||||
public interface IStoreRepository
|
|
||||||
{
|
|
||||||
Task<T?> GetSettingAsync<T>(string storeId, string name) where T : class;
|
|
||||||
Task<Dictionary<string, T?>> GetSettingsAsync<T>(string name) where T : class;
|
|
||||||
Task UpdateSetting<T>(string storeId, string name, T obj) where T : class;
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
using System;
|
|
||||||
|
|
||||||
namespace BTCPayServer.Abstractions.Contracts;
|
|
||||||
|
|
||||||
public interface IStoredFile
|
|
||||||
{
|
|
||||||
string Id { get; set; }
|
|
||||||
string FileName { get; set; }
|
|
||||||
string StorageFileName { get; set; }
|
|
||||||
DateTime Timestamp { get; set; }
|
|
||||||
string ApplicationUserId { get; set; }
|
|
||||||
}
|
|
@ -1,9 +0,0 @@
|
|||||||
using System.Threading.Tasks;
|
|
||||||
using Newtonsoft.Json.Linq;
|
|
||||||
|
|
||||||
namespace BTCPayServer.Abstractions.Contracts;
|
|
||||||
|
|
||||||
public interface ISwaggerProvider
|
|
||||||
{
|
|
||||||
Task<JObject> Fetch();
|
|
||||||
}
|
|
@ -1,18 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace BTCPayServer.Abstractions.Contracts
|
|
||||||
{
|
|
||||||
public interface ISyncSummaryProvider
|
|
||||||
{
|
|
||||||
bool AllAvailable();
|
|
||||||
|
|
||||||
string Partial { get; }
|
|
||||||
IEnumerable<ISyncStatus> GetStatuses();
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface ISyncStatus
|
|
||||||
{
|
|
||||||
public string CryptoCode { get; set; }
|
|
||||||
public bool Available { get; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,9 +0,0 @@
|
|||||||
namespace BTCPayServer.Abstractions.Contracts
|
|
||||||
{
|
|
||||||
public interface IUIExtension
|
|
||||||
{
|
|
||||||
string Partial { get; }
|
|
||||||
|
|
||||||
string Location { get; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using NBitcoin;
|
|
||||||
|
|
||||||
namespace BTCPayServer.Payments.PayJoin;
|
|
||||||
|
|
||||||
public interface IUTXOLocker
|
|
||||||
{
|
|
||||||
Task<bool> TryLock(OutPoint outpoint);
|
|
||||||
Task<bool> TryUnlock(params OutPoint[] outPoints);
|
|
||||||
Task<bool> TryLockInputs(OutPoint[] outPoints);
|
|
||||||
Task<HashSet<OutPoint>> FindLocks(OutPoint[] outpoints);
|
|
||||||
}
|
|
@ -1,19 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Text.Json;
|
|
||||||
using System.Text.Json.Serialization;
|
|
||||||
|
|
||||||
namespace BTCPayServer.Abstractions.Converters
|
|
||||||
{
|
|
||||||
public class VersionConverter : JsonConverter<Version>
|
|
||||||
{
|
|
||||||
public override Version Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
|
||||||
{
|
|
||||||
return Version.Parse(reader.GetString());
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Write(Utf8JsonWriter writer, Version value, JsonSerializerOptions options)
|
|
||||||
{
|
|
||||||
writer.WriteStringValue(value.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,19 +0,0 @@
|
|||||||
namespace BTCPayServer.Abstractions.Custodians.Client;
|
|
||||||
|
|
||||||
public class AssetQuoteResult
|
|
||||||
{
|
|
||||||
public string FromAsset { get; set; }
|
|
||||||
public string ToAsset { get; set; }
|
|
||||||
public decimal Bid { get; set; }
|
|
||||||
public decimal Ask { get; set; }
|
|
||||||
|
|
||||||
public AssetQuoteResult() { }
|
|
||||||
|
|
||||||
public AssetQuoteResult(string fromAsset, string toAsset, decimal bid, decimal ask)
|
|
||||||
{
|
|
||||||
FromAsset = fromAsset;
|
|
||||||
ToAsset = toAsset;
|
|
||||||
Bid = bid;
|
|
||||||
Ask = ask;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
namespace BTCPayServer.Abstractions.Custodians;
|
|
||||||
|
|
||||||
public class AssetBalancesUnavailableException : CustodianApiException
|
|
||||||
{
|
|
||||||
public AssetBalancesUnavailableException(System.Exception e) : base(500, "asset-balances-unavailable", $"Cannot fetch the asset balances: {e.Message}", e)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public AssetBalancesUnavailableException(string errorMsg) : base(500, "asset-balances-unavailable", $"Cannot fetch the asset balances: {errorMsg}")
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
using BTCPayServer.Client.Models;
|
|
||||||
|
|
||||||
namespace BTCPayServer.Abstractions.Custodians;
|
|
||||||
|
|
||||||
public class AssetQuoteUnavailableException : CustodianApiException
|
|
||||||
{
|
|
||||||
public AssetPairData AssetPair { get; }
|
|
||||||
|
|
||||||
public AssetQuoteUnavailableException(AssetPairData assetPair) : base(400, "asset-price-unavailable", "Cannot find a quote for pair " + assetPair)
|
|
||||||
{
|
|
||||||
this.AssetPair = assetPair;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
using System;
|
|
||||||
|
|
||||||
namespace BTCPayServer.Abstractions.Custodians;
|
|
||||||
|
|
||||||
public class BadConfigException : CustodianApiException
|
|
||||||
{
|
|
||||||
public string[] BadConfigKeys { get; set; }
|
|
||||||
|
|
||||||
public BadConfigException(string[] badConfigKeys) : base(500, "bad-custodian-account-config", "Wrong config values: " + String.Join(", ", badConfigKeys))
|
|
||||||
{
|
|
||||||
this.BadConfigKeys = badConfigKeys;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
namespace BTCPayServer.Abstractions.Custodians;
|
|
||||||
|
|
||||||
public class CannotWithdrawException : CustodianApiException
|
|
||||||
|
|
||||||
{
|
|
||||||
public CannotWithdrawException(ICustodian custodian, string paymentMethod, string message) : base(403, "cannot-withdraw", message)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public CannotWithdrawException(ICustodian custodian, string paymentMethod, string targetAddress, CustodianApiException originalException) : base(403, "cannot-withdraw", $"{custodian.Name} cannot withdraw {paymentMethod} to '{targetAddress}': {originalException.Message}")
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,18 +0,0 @@
|
|||||||
using System;
|
|
||||||
namespace BTCPayServer.Abstractions.Custodians;
|
|
||||||
public class CustodianApiException : Exception
|
|
||||||
{
|
|
||||||
public int HttpStatus { get; }
|
|
||||||
public string Code { get; }
|
|
||||||
|
|
||||||
public CustodianApiException(int httpStatus, string code, string message, System.Exception ex) : base(message, ex)
|
|
||||||
{
|
|
||||||
HttpStatus = httpStatus;
|
|
||||||
Code = code;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CustodianApiException(int httpStatus, string code, string message) : this(httpStatus, code, message, null)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
|||||||
namespace BTCPayServer.Abstractions.Custodians;
|
|
||||||
|
|
||||||
public class CustodianFeatureNotImplementedException : CustodianApiException
|
|
||||||
{
|
|
||||||
public CustodianFeatureNotImplementedException(string message) : base(400, "not-implemented", message)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,8 +0,0 @@
|
|||||||
namespace BTCPayServer.Abstractions.Custodians;
|
|
||||||
|
|
||||||
public class DepositsUnavailableException : CustodianApiException
|
|
||||||
{
|
|
||||||
public DepositsUnavailableException(string message) : base(404, "deposits-unavailable", message)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,8 +0,0 @@
|
|||||||
namespace BTCPayServer.Abstractions.Custodians;
|
|
||||||
|
|
||||||
public class InsufficientFundsException : CustodianApiException
|
|
||||||
{
|
|
||||||
public InsufficientFundsException(string message) : base(400, "insufficient-funds", message)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,9 +0,0 @@
|
|||||||
namespace BTCPayServer.Abstractions.Custodians;
|
|
||||||
|
|
||||||
public class InvalidWithdrawalTargetException : CustodianApiException
|
|
||||||
|
|
||||||
{
|
|
||||||
public InvalidWithdrawalTargetException(ICustodian custodian, string paymentMethod, string targetAddress, CustodianApiException originalException) : base(403, "invalid-withdrawal-target", $"{custodian.Name} cannot withdraw {paymentMethod} to '{targetAddress}': {originalException.Message}")
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,9 +0,0 @@
|
|||||||
namespace BTCPayServer.Abstractions.Custodians;
|
|
||||||
|
|
||||||
public class PermissionDeniedCustodianApiException : CustodianApiException
|
|
||||||
|
|
||||||
{
|
|
||||||
public PermissionDeniedCustodianApiException(ICustodian custodian) : base(403, "custodian-api-permission-denied", $"{custodian.Name}'s API reported that you don't have permission.")
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
namespace BTCPayServer.Abstractions.Custodians;
|
|
||||||
|
|
||||||
public class TradeNotFoundException : CustodianApiException
|
|
||||||
{
|
|
||||||
private string tradeId { get; }
|
|
||||||
|
|
||||||
public TradeNotFoundException(string tradeId) : base(404, "trade-not-found", "Could not find trade ID " + tradeId)
|
|
||||||
{
|
|
||||||
this.tradeId = tradeId;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
namespace BTCPayServer.Abstractions.Custodians;
|
|
||||||
|
|
||||||
public class WithdrawalNotFoundException : CustodianApiException
|
|
||||||
{
|
|
||||||
private string WithdrawalId { get; }
|
|
||||||
|
|
||||||
public WithdrawalNotFoundException(string withdrawalId) : base(404, "withdrawal-not-found", $"Could not find withdrawal ID {withdrawalId}.")
|
|
||||||
{
|
|
||||||
WithdrawalId = withdrawalId;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,9 +0,0 @@
|
|||||||
namespace BTCPayServer.Abstractions.Custodians;
|
|
||||||
|
|
||||||
public class WrongTradingPairException : CustodianApiException
|
|
||||||
{
|
|
||||||
public const int HttpCode = 404;
|
|
||||||
public WrongTradingPairException(string fromAsset, string toAsset) : base(HttpCode, "wrong-trading-pair", $"Cannot find a trading pair for converting {fromAsset} into {toAsset}.")
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,29 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using BTCPayServer.Client.Models;
|
|
||||||
|
|
||||||
namespace BTCPayServer.Abstractions.Custodians.Client;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The result of a market trade. Used as a return type for custodians implementing ICanTrade
|
|
||||||
*/
|
|
||||||
public class MarketTradeResult
|
|
||||||
{
|
|
||||||
public string FromAsset { get; }
|
|
||||||
public string ToAsset { get; }
|
|
||||||
/**
|
|
||||||
* The ledger entries that show the balances that were affected by the trade.
|
|
||||||
*/
|
|
||||||
public List<LedgerEntryData> LedgerEntries { get; }
|
|
||||||
/**
|
|
||||||
* The unique ID of the trade that was executed.
|
|
||||||
*/
|
|
||||||
public string TradeId { get; }
|
|
||||||
|
|
||||||
public MarketTradeResult(string fromAsset, string toAsset, List<LedgerEntryData> ledgerEntries, string tradeId)
|
|
||||||
{
|
|
||||||
this.FromAsset = fromAsset;
|
|
||||||
this.ToAsset = toAsset;
|
|
||||||
this.LedgerEntries = ledgerEntries;
|
|
||||||
this.TradeId = tradeId;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,28 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using BTCPayServer.Client.Models;
|
|
||||||
using BTCPayServer.JsonConverters;
|
|
||||||
|
|
||||||
namespace BTCPayServer.Abstractions.Custodians.Client;
|
|
||||||
|
|
||||||
public class SimulateWithdrawalResult
|
|
||||||
{
|
|
||||||
public string PaymentMethod { get; }
|
|
||||||
public string Asset { get; }
|
|
||||||
public decimal MinQty { get; }
|
|
||||||
public decimal MaxQty { get; }
|
|
||||||
|
|
||||||
public List<LedgerEntryData> LedgerEntries { get; }
|
|
||||||
|
|
||||||
// Fee can be NULL if unknown.
|
|
||||||
public decimal? Fee { get; }
|
|
||||||
|
|
||||||
public SimulateWithdrawalResult(string paymentMethod, string asset, List<LedgerEntryData> ledgerEntries,
|
|
||||||
decimal minQty, decimal maxQty)
|
|
||||||
{
|
|
||||||
PaymentMethod = paymentMethod;
|
|
||||||
Asset = asset;
|
|
||||||
LedgerEntries = ledgerEntries;
|
|
||||||
MinQty = minQty;
|
|
||||||
MaxQty = maxQty;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,29 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using BTCPayServer.Client.Models;
|
|
||||||
|
|
||||||
namespace BTCPayServer.Abstractions.Custodians.Client;
|
|
||||||
|
|
||||||
public class WithdrawResult
|
|
||||||
{
|
|
||||||
public string PaymentMethod { get; }
|
|
||||||
public string Asset { get; set; }
|
|
||||||
public List<LedgerEntryData> LedgerEntries { get; }
|
|
||||||
public string WithdrawalId { get; }
|
|
||||||
public WithdrawalResponseData.WithdrawalStatus Status { get; }
|
|
||||||
public DateTimeOffset CreatedTime { get; }
|
|
||||||
public string TargetAddress { get; }
|
|
||||||
public string TransactionId { get; }
|
|
||||||
|
|
||||||
public WithdrawResult(string paymentMethod, string asset, List<LedgerEntryData> ledgerEntries, string withdrawalId, WithdrawalResponseData.WithdrawalStatus status, DateTimeOffset createdTime, string targetAddress, string transactionId)
|
|
||||||
{
|
|
||||||
PaymentMethod = paymentMethod;
|
|
||||||
Asset = asset;
|
|
||||||
LedgerEntries = ledgerEntries;
|
|
||||||
WithdrawalId = withdrawalId;
|
|
||||||
CreatedTime = createdTime;
|
|
||||||
Status = status;
|
|
||||||
TargetAddress = targetAddress;
|
|
||||||
TransactionId = transactionId;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using BTCPayServer.Client.Models;
|
|
||||||
using Newtonsoft.Json.Linq;
|
|
||||||
|
|
||||||
namespace BTCPayServer.Abstractions.Custodians;
|
|
||||||
|
|
||||||
public interface ICanDeposit
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Get the address where we can deposit for the chosen payment method (crypto code + network).
|
|
||||||
* The result can be a string in different formats like a bitcoin address or even a LN invoice.
|
|
||||||
*/
|
|
||||||
public Task<DepositAddressData> GetDepositAddressAsync(string paymentMethod, JObject config, CancellationToken cancellationToken);
|
|
||||||
|
|
||||||
public string[] GetDepositablePaymentMethods();
|
|
||||||
}
|
|
@ -1,31 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using BTCPayServer.Abstractions.Custodians.Client;
|
|
||||||
using BTCPayServer.Client.Models;
|
|
||||||
using Newtonsoft.Json.Linq;
|
|
||||||
|
|
||||||
namespace BTCPayServer.Abstractions.Custodians;
|
|
||||||
|
|
||||||
public interface ICanTrade
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* A list of tradable asset pairs, or NULL if the custodian cannot trade/convert assets. if thr asset pair contains fiat, fiat is always put last. If both assets are a cyrptocode or both are fiat, the pair is written alphabetically. Always in uppercase. Example: ["BTC/EUR","BTC/USD", "EUR/USD", "BTC/ETH",...]
|
|
||||||
*/
|
|
||||||
public List<AssetPairData> GetTradableAssetPairs();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Execute a market order right now.
|
|
||||||
*/
|
|
||||||
public Task<MarketTradeResult> TradeMarketAsync(string fromAsset, string toAsset, decimal qty, JObject config, CancellationToken cancellationToken);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the details about a previous market trade.
|
|
||||||
*/
|
|
||||||
public Task<MarketTradeResult> GetTradeInfoAsync(string tradeId, JObject config, CancellationToken cancellationToken);
|
|
||||||
|
|
||||||
public Task<AssetQuoteResult> GetQuoteForAssetAsync(string fromAsset, string toAsset, JObject config, CancellationToken cancellationToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
|||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using BTCPayServer.Abstractions.Custodians.Client;
|
|
||||||
using Newtonsoft.Json.Linq;
|
|
||||||
|
|
||||||
namespace BTCPayServer.Abstractions.Custodians;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Interface for custodians that can move funds to the store wallet.
|
|
||||||
/// </summary>
|
|
||||||
public interface ICanWithdraw
|
|
||||||
{
|
|
||||||
public Task<WithdrawResult> WithdrawToStoreWalletAsync(string paymentMethod, decimal amount, JObject config, CancellationToken cancellationToken);
|
|
||||||
|
|
||||||
public Task<SimulateWithdrawalResult> SimulateWithdrawalAsync(string paymentMethod, decimal qty, JObject config, CancellationToken cancellationToken);
|
|
||||||
|
|
||||||
public Task<WithdrawResult> GetWithdrawalInfoAsync(string paymentMethod, string withdrawalId, JObject config, CancellationToken cancellationToken);
|
|
||||||
|
|
||||||
public string[] GetWithdrawablePaymentMethods();
|
|
||||||
}
|
|
@ -1,26 +0,0 @@
|
|||||||
#nullable enable
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using BTCPayServer.Client.Models;
|
|
||||||
using Newtonsoft.Json.Linq;
|
|
||||||
|
|
||||||
namespace BTCPayServer.Abstractions.Custodians;
|
|
||||||
|
|
||||||
public interface ICustodian
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Get the unique code that identifies this custodian.
|
|
||||||
*/
|
|
||||||
string Code { get; }
|
|
||||||
|
|
||||||
string Name { get; }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a list of assets and their qty in custody.
|
|
||||||
*/
|
|
||||||
Task<Dictionary<string, decimal>> GetAssetBalancesAsync(JObject config, CancellationToken cancellationToken);
|
|
||||||
|
|
||||||
public Task<Form.Form> GetConfigForm(JObject config, CancellationToken cancellationToken = default);
|
|
||||||
|
|
||||||
}
|
|
@ -1,14 +0,0 @@
|
|||||||
#nullable enable
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using BTCPayServer.Abstractions.Custodians;
|
|
||||||
|
|
||||||
namespace BTCPayServer.Abstractions.Extensions;
|
|
||||||
|
|
||||||
public static class CustodianExtensions
|
|
||||||
{
|
|
||||||
public static ICustodian? GetCustodianByCode(this IEnumerable<ICustodian> custodians, string code)
|
|
||||||
{
|
|
||||||
return custodians.FirstOrDefault(custodian => custodian.Code == code);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,47 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using BTCPayServer.Client.Models;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using Microsoft.AspNetCore.Mvc.ModelBinding;
|
|
||||||
|
|
||||||
namespace BTCPayServer.Abstractions.Extensions;
|
|
||||||
|
|
||||||
public static class GreenfieldExtensions
|
|
||||||
{
|
|
||||||
public static IActionResult UserNotFound(this ControllerBase ctrl)
|
|
||||||
{
|
|
||||||
return ctrl.CreateAPIError(404, "user-not-found", "The user was not found");
|
|
||||||
}
|
|
||||||
public static IActionResult CreateValidationError(this ControllerBase controller, ModelStateDictionary modelState)
|
|
||||||
{
|
|
||||||
return controller.UnprocessableEntity(modelState.ToGreenfieldValidationError());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static List<GreenfieldValidationError> ToGreenfieldValidationError(this ModelStateDictionary modelState)
|
|
||||||
{
|
|
||||||
List<GreenfieldValidationError> errors = new List<GreenfieldValidationError>();
|
|
||||||
foreach (var error in modelState)
|
|
||||||
{
|
|
||||||
foreach (var errorMessage in error.Value.Errors)
|
|
||||||
{
|
|
||||||
errors.Add(new GreenfieldValidationError(error.Key, errorMessage.ErrorMessage));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return errors;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IActionResult CreateAPIError(this ControllerBase controller, string errorCode, string errorMessage)
|
|
||||||
{
|
|
||||||
return controller.BadRequest(new GreenfieldAPIError(errorCode, errorMessage));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IActionResult CreateAPIError(this ControllerBase controller, int httpCode, string errorCode, string errorMessage)
|
|
||||||
{
|
|
||||||
return controller.StatusCode(httpCode, new GreenfieldAPIError(errorCode, errorMessage));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IActionResult CreateAPIPermissionError(this ControllerBase controller, string missingPermission, string message = null)
|
|
||||||
{
|
|
||||||
return controller.StatusCode(403, new GreenfieldPermissionAPIError(missingPermission, message));
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,120 +0,0 @@
|
|||||||
using System;
|
|
||||||
using Microsoft.AspNetCore.Http;
|
|
||||||
|
|
||||||
namespace BTCPayServer.Abstractions.Extensions;
|
|
||||||
|
|
||||||
public static class HttpRequestExtensions
|
|
||||||
{
|
|
||||||
public static bool IsOnion(this HttpRequest request)
|
|
||||||
{
|
|
||||||
if (request?.Host.Host == null)
|
|
||||||
return false;
|
|
||||||
return request.Host.Host.EndsWith(".onion", StringComparison.OrdinalIgnoreCase);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string GetAbsoluteRoot(this HttpRequest request)
|
|
||||||
{
|
|
||||||
return string.Concat(
|
|
||||||
request.Scheme,
|
|
||||||
"://",
|
|
||||||
request.Host.ToUriComponent(),
|
|
||||||
request.PathBase.ToUriComponent());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Uri GetAbsoluteRootUri(this HttpRequest request)
|
|
||||||
{
|
|
||||||
return new Uri(request.GetAbsoluteRoot());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string GetCurrentUrl(this HttpRequest request)
|
|
||||||
{
|
|
||||||
return string.Concat(
|
|
||||||
request.Scheme,
|
|
||||||
"://",
|
|
||||||
request.Host.ToUriComponent(),
|
|
||||||
request.PathBase.ToUriComponent(),
|
|
||||||
request.Path.ToUriComponent());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string GetCurrentPath(this HttpRequest request)
|
|
||||||
{
|
|
||||||
return string.Concat(
|
|
||||||
request.PathBase.ToUriComponent(),
|
|
||||||
request.Path.ToUriComponent());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string GetCurrentPathWithQueryString(this HttpRequest request)
|
|
||||||
{
|
|
||||||
return request.PathBase + request.Path + request.QueryString;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// If 'toto' and RootPath is 'rootpath' returns '/rootpath/toto'
|
|
||||||
/// If 'toto' and RootPath is empty returns '/toto'
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="request"></param>
|
|
||||||
/// <param name="path"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static string GetRelativePath(this HttpRequest request, string path)
|
|
||||||
{
|
|
||||||
if (path.Length > 0 && path[0] != '/')
|
|
||||||
path = $"/{path}";
|
|
||||||
return string.Concat(
|
|
||||||
request.PathBase.ToUriComponent(),
|
|
||||||
path);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// If 'https://example.com/toto' returns 'https://example.com/toto'
|
|
||||||
/// If 'toto' and RootPath is 'rootpath' returns '/rootpath/toto'
|
|
||||||
/// If 'toto' and RootPath is empty returns '/toto'
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="request"></param>
|
|
||||||
/// <param name="path"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static string GetRelativePathOrAbsolute(this HttpRequest request, string path)
|
|
||||||
{
|
|
||||||
if (!Uri.TryCreate(path, UriKind.RelativeOrAbsolute, out var uri) ||
|
|
||||||
uri.IsAbsoluteUri)
|
|
||||||
return path;
|
|
||||||
|
|
||||||
if (path.Length > 0 && path[0] != '/')
|
|
||||||
path = $"/{path}";
|
|
||||||
return string.Concat(
|
|
||||||
request.PathBase.ToUriComponent(),
|
|
||||||
path);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string GetAbsoluteUri(this HttpRequest request, string redirectUrl)
|
|
||||||
{
|
|
||||||
bool isRelative =
|
|
||||||
(redirectUrl.Length > 0 && redirectUrl[0] == '/')
|
|
||||||
|| !new Uri(redirectUrl, UriKind.RelativeOrAbsolute).IsAbsoluteUri;
|
|
||||||
return isRelative ? request.GetAbsoluteRoot() + redirectUrl : redirectUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Will return an absolute URL.
|
|
||||||
/// If `relativeOrAsbolute` is absolute, returns it.
|
|
||||||
/// If `relativeOrAsbolute` is relative, send absolute url based on the HOST of this request (without PathBase)
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="request"></param>
|
|
||||||
/// <param name="relativeOrAbsolte"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static Uri GetAbsoluteUriNoPathBase(this HttpRequest request, Uri relativeOrAbsolute = null)
|
|
||||||
{
|
|
||||||
if (relativeOrAbsolute == null)
|
|
||||||
{
|
|
||||||
return new Uri(string.Concat(
|
|
||||||
request.Scheme,
|
|
||||||
"://",
|
|
||||||
request.Host.ToUriComponent()), UriKind.Absolute);
|
|
||||||
}
|
|
||||||
if (relativeOrAbsolute.IsAbsoluteUri)
|
|
||||||
return relativeOrAbsolute;
|
|
||||||
return new Uri(string.Concat(
|
|
||||||
request.Scheme,
|
|
||||||
"://",
|
|
||||||
request.Host.ToUriComponent()) + relativeOrAbsolute.ToString().WithStartingSlash(), UriKind.Absolute);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,59 +0,0 @@
|
|||||||
using System.Text.Json;
|
|
||||||
using BTCPayServer.Abstractions.Constants;
|
|
||||||
using BTCPayServer.Abstractions.Models;
|
|
||||||
using Microsoft.AspNetCore.Mvc.ViewFeatures;
|
|
||||||
using Newtonsoft.Json.Linq;
|
|
||||||
|
|
||||||
namespace BTCPayServer.Abstractions.Extensions;
|
|
||||||
|
|
||||||
public static class SetStatusMessageModelExtensions
|
|
||||||
{
|
|
||||||
public static void SetStatusMessageModel(this ITempDataDictionary tempData, StatusMessageModel statusMessage)
|
|
||||||
{
|
|
||||||
if (statusMessage == null)
|
|
||||||
{
|
|
||||||
tempData.Remove("StatusMessageModel");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
tempData["StatusMessageModel"] = JsonSerializer.Serialize(statusMessage, new JsonSerializerOptions());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static StatusMessageModel GetStatusMessageModel(this ITempDataDictionary tempData)
|
|
||||||
{
|
|
||||||
tempData.TryGetValue(WellKnownTempData.SuccessMessage, out var successMessage);
|
|
||||||
tempData.TryGetValue(WellKnownTempData.ErrorMessage, out var errorMessage);
|
|
||||||
tempData.TryGetValue("StatusMessageModel", out var model);
|
|
||||||
if (successMessage != null || errorMessage != null)
|
|
||||||
{
|
|
||||||
var parsedModel = new StatusMessageModel();
|
|
||||||
parsedModel.Message = (string)successMessage ?? (string)errorMessage;
|
|
||||||
if (successMessage != null)
|
|
||||||
{
|
|
||||||
parsedModel.Severity = StatusMessageModel.StatusSeverity.Success;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
parsedModel.Severity = StatusMessageModel.StatusSeverity.Error;
|
|
||||||
}
|
|
||||||
return parsedModel;
|
|
||||||
}
|
|
||||||
else if (model != null && model is string str)
|
|
||||||
{
|
|
||||||
return JObject.Parse(str).ToObject<StatusMessageModel>();
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool HasStatusMessage(this ITempDataDictionary tempData)
|
|
||||||
{
|
|
||||||
return (tempData.Peek(WellKnownTempData.SuccessMessage) ??
|
|
||||||
tempData.Peek(WellKnownTempData.ErrorMessage) ??
|
|
||||||
tempData.Peek("StatusMessageModel")) != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool HasErrorMessage(this ITempDataDictionary tempData)
|
|
||||||
{
|
|
||||||
return GetStatusMessageModel(tempData)?.Severity == StatusMessageModel.StatusSeverity.Error;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,43 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace BTCPayServer.Abstractions.Extensions;
|
|
||||||
|
|
||||||
public static class StringExtensions
|
|
||||||
{
|
|
||||||
public static bool IsValidFileName(this string fileName)
|
|
||||||
{
|
|
||||||
return !fileName.ToCharArray().Any(c => Path.GetInvalidFileNameChars().Contains(c)
|
|
||||||
|| c == Path.AltDirectorySeparatorChar
|
|
||||||
|| c == Path.DirectorySeparatorChar
|
|
||||||
|| c == Path.PathSeparator
|
|
||||||
|| c == '\\');
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string Truncate(this string value, int maxLength)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(value))
|
|
||||||
return value;
|
|
||||||
return value.Length <= maxLength ? value : value.Substring(0, maxLength);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string WithTrailingSlash(this string str)
|
|
||||||
{
|
|
||||||
if (str.EndsWith("/", StringComparison.InvariantCulture))
|
|
||||||
return str;
|
|
||||||
return str + "/";
|
|
||||||
}
|
|
||||||
public static string WithStartingSlash(this string str)
|
|
||||||
{
|
|
||||||
if (str.StartsWith("/", StringComparison.InvariantCulture))
|
|
||||||
return str;
|
|
||||||
return $"/{str}";
|
|
||||||
}
|
|
||||||
public static string WithoutEndingSlash(this string str)
|
|
||||||
{
|
|
||||||
if (str.EndsWith("/", StringComparison.InvariantCulture))
|
|
||||||
return str.Substring(0, str.Length - 1);
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,139 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Globalization;
|
|
||||||
using System.Linq;
|
|
||||||
using Microsoft.AspNetCore.Html;
|
|
||||||
using Microsoft.AspNetCore.Mvc.ViewFeatures;
|
|
||||||
|
|
||||||
namespace BTCPayServer.Abstractions.Extensions
|
|
||||||
{
|
|
||||||
public static class ViewsRazor
|
|
||||||
{
|
|
||||||
private const string ACTIVE_CATEGORY_KEY = "ActiveCategory";
|
|
||||||
private const string ACTIVE_PAGE_KEY = "ActivePage";
|
|
||||||
private const string ACTIVE_ID_KEY = "ActiveId";
|
|
||||||
private const string ActivePageClass = "active";
|
|
||||||
|
|
||||||
public enum DateDisplayFormat
|
|
||||||
{
|
|
||||||
Localized,
|
|
||||||
Relative
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void SetActivePage<T>(this ViewDataDictionary viewData, T activePage, string title = null, string activeId = null)
|
|
||||||
where T : IConvertible
|
|
||||||
{
|
|
||||||
SetActivePage(viewData, activePage.ToString(), activePage.GetType().ToString(), title, activeId);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void SetActivePage(this ViewDataDictionary viewData, string activePage, string category, string title = null, string activeId = null)
|
|
||||||
{
|
|
||||||
// Page Title
|
|
||||||
viewData["Title"] = title ?? activePage;
|
|
||||||
// Navigation
|
|
||||||
viewData[ACTIVE_PAGE_KEY] = activePage;
|
|
||||||
viewData[ACTIVE_ID_KEY] = activeId;
|
|
||||||
SetActiveCategory(viewData, category);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void SetActiveCategory<T>(this ViewDataDictionary viewData, T activeCategory)
|
|
||||||
{
|
|
||||||
SetActiveCategory(viewData, activeCategory.ToString());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void SetActiveCategory(this ViewDataDictionary viewData, string activeCategory)
|
|
||||||
{
|
|
||||||
viewData[ACTIVE_CATEGORY_KEY] = activeCategory;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string IsActiveCategory<T>(this ViewDataDictionary viewData, T category, object id = null)
|
|
||||||
{
|
|
||||||
return IsActiveCategory(viewData, category.ToString(), id);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string IsActiveCategory(this ViewDataDictionary viewData, string category, object id = null)
|
|
||||||
{
|
|
||||||
if (!viewData.ContainsKey(ACTIVE_CATEGORY_KEY))
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
var activeId = viewData[ACTIVE_ID_KEY];
|
|
||||||
var activeCategory = viewData[ACTIVE_CATEGORY_KEY]?.ToString();
|
|
||||||
var categoryMatch = category.Equals(activeCategory, StringComparison.InvariantCultureIgnoreCase);
|
|
||||||
var idMatch = id == null || activeId == null || id.Equals(activeId);
|
|
||||||
return categoryMatch && idMatch ? ActivePageClass : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string IsActivePage<T>(this ViewDataDictionary viewData, T page, object id = null)
|
|
||||||
where T : IConvertible
|
|
||||||
{
|
|
||||||
return IsActivePage(viewData, page.ToString(), page.GetType().ToString(), id);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string IsActivePage<T>(this ViewDataDictionary viewData, IEnumerable<T> pages, object id = null)
|
|
||||||
where T : IConvertible
|
|
||||||
{
|
|
||||||
return pages.Any(page => IsActivePage(viewData, page.ToString(), page.GetType().ToString(), id) == ActivePageClass)
|
|
||||||
? ActivePageClass
|
|
||||||
: null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string IsActivePage(this ViewDataDictionary viewData, string page, string category, object id = null)
|
|
||||||
{
|
|
||||||
if (!viewData.ContainsKey(ACTIVE_PAGE_KEY))
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
var activeId = viewData[ACTIVE_ID_KEY];
|
|
||||||
var activePage = viewData[ACTIVE_PAGE_KEY]?.ToString();
|
|
||||||
var activeCategory = viewData[ACTIVE_CATEGORY_KEY]?.ToString();
|
|
||||||
var categoryAndPageMatch = (category == null || activeCategory.Equals(category, StringComparison.InvariantCultureIgnoreCase)) && page.Equals(activePage, StringComparison.InvariantCultureIgnoreCase);
|
|
||||||
var idMatch = id == null || activeId == null || id.Equals(activeId);
|
|
||||||
return categoryAndPageMatch && idMatch ? ActivePageClass : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static HtmlString ToBrowserDate(this DateTimeOffset date, DateDisplayFormat format = DateDisplayFormat.Localized)
|
|
||||||
{
|
|
||||||
var relative = date.ToTimeAgo();
|
|
||||||
var initial = format.ToString().ToLower();
|
|
||||||
var dateTime = date.ToString("o", CultureInfo.InvariantCulture);
|
|
||||||
var displayDate = format == DateDisplayFormat.Relative ? relative : date.ToString("g", CultureInfo.InvariantCulture);
|
|
||||||
return new HtmlString($"<time datetime=\"{dateTime}\" data-relative=\"{relative}\" data-initial=\"{initial}\">{displayDate}</time>");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static HtmlString ToBrowserDate(this DateTime date, DateDisplayFormat format = DateDisplayFormat.Localized)
|
|
||||||
{
|
|
||||||
var relative = date.ToTimeAgo();
|
|
||||||
var initial = format.ToString().ToLower();
|
|
||||||
var dateTime = date.ToString("o", CultureInfo.InvariantCulture);
|
|
||||||
var displayDate = format == DateDisplayFormat.Relative ? relative : date.ToString("g", CultureInfo.InvariantCulture);
|
|
||||||
return new HtmlString($"<time datetime=\"{dateTime}\" data-relative=\"{relative}\" data-initial=\"{initial}\">{displayDate}</time>");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string ToTimeAgo(this DateTimeOffset date) => (DateTimeOffset.UtcNow - date).ToTimeAgo();
|
|
||||||
|
|
||||||
public static string ToTimeAgo(this DateTime date) => (DateTimeOffset.UtcNow - date).ToTimeAgo();
|
|
||||||
|
|
||||||
public static string ToTimeAgo(this TimeSpan diff) => diff.TotalSeconds > 0 ? $"{diff.TimeString()} ago" : $"in {diff.Negate().TimeString()}";
|
|
||||||
|
|
||||||
public static string TimeString(this TimeSpan timeSpan)
|
|
||||||
{
|
|
||||||
if (timeSpan.TotalMinutes < 1)
|
|
||||||
{
|
|
||||||
return $"{(int)timeSpan.TotalSeconds} second{Plural((int)timeSpan.TotalSeconds)}";
|
|
||||||
}
|
|
||||||
if (timeSpan.TotalHours < 1)
|
|
||||||
{
|
|
||||||
return $"{(int)timeSpan.TotalMinutes} minute{Plural((int)timeSpan.TotalMinutes)}";
|
|
||||||
}
|
|
||||||
return timeSpan.Days < 1
|
|
||||||
? $"{(int)timeSpan.TotalHours} hour{Plural((int)timeSpan.TotalHours)}"
|
|
||||||
: $"{(int)timeSpan.TotalDays} day{Plural((int)timeSpan.TotalDays)}";
|
|
||||||
}
|
|
||||||
|
|
||||||
private static string Plural(int value)
|
|
||||||
{
|
|
||||||
return value == 1 ? string.Empty : "s";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,37 +0,0 @@
|
|||||||
using Newtonsoft.Json;
|
|
||||||
using Newtonsoft.Json.Converters;
|
|
||||||
|
|
||||||
namespace BTCPayServer.Abstractions.Form;
|
|
||||||
|
|
||||||
public class AlertMessage
|
|
||||||
{
|
|
||||||
// Corresponds to the Bootstrap CSS "alert alert-xxx" messages:
|
|
||||||
// Success = green
|
|
||||||
// Warning = orange
|
|
||||||
// Danger = red
|
|
||||||
// Info = blue
|
|
||||||
public enum AlertMessageType
|
|
||||||
{
|
|
||||||
Success,
|
|
||||||
Warning,
|
|
||||||
Danger,
|
|
||||||
Info
|
|
||||||
}
|
|
||||||
|
|
||||||
[JsonConverter(typeof(StringEnumConverter))]
|
|
||||||
public AlertMessageType Type;
|
|
||||||
|
|
||||||
// The translated message to be shown to the user
|
|
||||||
public string Message;
|
|
||||||
|
|
||||||
public AlertMessage()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public AlertMessage(AlertMessageType type, string message)
|
|
||||||
{
|
|
||||||
this.Type = type;
|
|
||||||
this.Message = message;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,64 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using Microsoft.AspNetCore.Mvc.ModelBinding;
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
using Newtonsoft.Json.Linq;
|
|
||||||
|
|
||||||
namespace BTCPayServer.Abstractions.Form;
|
|
||||||
|
|
||||||
public class Field
|
|
||||||
{
|
|
||||||
public static Field Create(string label, string name, string value, bool required, string helpText, string type = "text")
|
|
||||||
{
|
|
||||||
return new Field
|
|
||||||
{
|
|
||||||
Label = label,
|
|
||||||
Name = name,
|
|
||||||
Value = value,
|
|
||||||
OriginalValue = value,
|
|
||||||
Required = required,
|
|
||||||
HelpText = helpText,
|
|
||||||
Type = type
|
|
||||||
};
|
|
||||||
}
|
|
||||||
// The name of the HTML5 node. Should be used as the key for the posted data.
|
|
||||||
public string Name;
|
|
||||||
|
|
||||||
public bool Constant;
|
|
||||||
|
|
||||||
// HTML5 compatible type string like "text", "textarea", "email", "password", etc.
|
|
||||||
public string Type;
|
|
||||||
|
|
||||||
public static Field CreateFieldset()
|
|
||||||
{
|
|
||||||
return new Field { Type = "fieldset" };
|
|
||||||
}
|
|
||||||
|
|
||||||
// The value field is what is currently in the DB or what the user entered, but possibly not saved yet due to validation errors.
|
|
||||||
// If this is the first the user sees the form, then value and original value are the same. Value changes as the user starts interacting with the form.
|
|
||||||
public string Value;
|
|
||||||
|
|
||||||
public bool Required;
|
|
||||||
|
|
||||||
// The translated label of the field.
|
|
||||||
public string Label;
|
|
||||||
|
|
||||||
// The original value is the value that is currently saved in the backend. A "reset" button can be used to revert back to this. Should only be set from the constructor.
|
|
||||||
public string OriginalValue;
|
|
||||||
|
|
||||||
// A useful note shown below the field or via a tooltip / info icon. Should be translated for the user.
|
|
||||||
public string HelpText;
|
|
||||||
|
|
||||||
[JsonExtensionData] public IDictionary<string, JToken> AdditionalData { get; set; }
|
|
||||||
public List<Field> Fields { get; set; } = new();
|
|
||||||
|
|
||||||
// The field is considered "valid" if there are no validation errors
|
|
||||||
public List<string> ValidationErrors = new();
|
|
||||||
|
|
||||||
public virtual bool IsValid()
|
|
||||||
{
|
|
||||||
return ValidationErrors.Count == 0 && Fields.All(field => field.IsValid());
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,135 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Reflection;
|
|
||||||
using Microsoft.AspNetCore.Http;
|
|
||||||
using Microsoft.Extensions.Primitives;
|
|
||||||
using Newtonsoft.Json.Linq;
|
|
||||||
using Npgsql.Internal.TypeHandlers.GeometricHandlers;
|
|
||||||
|
|
||||||
namespace BTCPayServer.Abstractions.Form;
|
|
||||||
|
|
||||||
public class Form
|
|
||||||
{
|
|
||||||
#nullable enable
|
|
||||||
public static Form Parse(string str)
|
|
||||||
{
|
|
||||||
ArgumentNullException.ThrowIfNull(str);
|
|
||||||
return JObject.Parse(str).ToObject<Form>(CamelCaseSerializerSettings.Serializer) ?? throw new InvalidOperationException("Impossible to deserialize Form");
|
|
||||||
}
|
|
||||||
public override string ToString()
|
|
||||||
{
|
|
||||||
return JObject.FromObject(this, CamelCaseSerializerSettings.Serializer).ToString(Newtonsoft.Json.Formatting.Indented);
|
|
||||||
}
|
|
||||||
#nullable restore
|
|
||||||
|
|
||||||
// Messages to be shown at the top of the form indicating user feedback like "Saved successfully" or "Please change X because of Y." or a warning, etc...
|
|
||||||
public List<AlertMessage> TopMessages { get; set; } = new();
|
|
||||||
|
|
||||||
// Groups of fields in the form
|
|
||||||
public List<Field> Fields { get; set; } = new();
|
|
||||||
|
|
||||||
// Are all the fields valid in the form?
|
|
||||||
public bool IsValid()
|
|
||||||
{
|
|
||||||
if (TopMessages?.Any(t => t.Type == AlertMessage.AlertMessageType.Danger) is true)
|
|
||||||
return false;
|
|
||||||
return Fields.Select(f => f.IsValid()).All(o => o);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Field GetFieldByFullName(string fullName)
|
|
||||||
{
|
|
||||||
foreach (var f in GetAllFields())
|
|
||||||
{
|
|
||||||
if (f.FullName == fullName)
|
|
||||||
return f.Field;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEnumerable<(string FullName, List<string> Path, Field Field)> GetAllFields()
|
|
||||||
{
|
|
||||||
HashSet<string> nameReturned = new();
|
|
||||||
foreach (var f in GetAllFieldsCore(new List<string>(), Fields))
|
|
||||||
{
|
|
||||||
var fullName = string.Join('_', f.Path.Where(s => !string.IsNullOrEmpty(s)));
|
|
||||||
if (!nameReturned.Add(fullName))
|
|
||||||
continue;
|
|
||||||
yield return (fullName, f.Path, f.Field);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool ValidateFieldNames(out List<string> errors)
|
|
||||||
{
|
|
||||||
errors = new List<string>();
|
|
||||||
HashSet<string> nameReturned = new();
|
|
||||||
foreach (var f in GetAllFieldsCore(new List<string>(), Fields))
|
|
||||||
{
|
|
||||||
var fullName = string.Join('_', f.Path.Where(s => !string.IsNullOrEmpty(s)));
|
|
||||||
if (!nameReturned.Add(fullName))
|
|
||||||
{
|
|
||||||
errors.Add($"Form contains duplicate field names '{fullName}'");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return errors.Count == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
IEnumerable<(List<string> Path, Field Field)> GetAllFieldsCore(List<string> path, List<Field> fields)
|
|
||||||
{
|
|
||||||
foreach (var field in fields)
|
|
||||||
{
|
|
||||||
List<string> thisPath = new(path.Count + 1);
|
|
||||||
thisPath.AddRange(path);
|
|
||||||
if (!string.IsNullOrEmpty(field.Name))
|
|
||||||
{
|
|
||||||
thisPath.Add(field.Name);
|
|
||||||
yield return (thisPath, field);
|
|
||||||
}
|
|
||||||
foreach (var descendant in GetAllFieldsCore(thisPath, field.Fields))
|
|
||||||
{
|
|
||||||
descendant.Field.Constant = field.Constant || descendant.Field.Constant;
|
|
||||||
yield return descendant;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ApplyValuesFromForm(IEnumerable<KeyValuePair<string, StringValues>> form)
|
|
||||||
{
|
|
||||||
var values = form.GroupBy(f => f.Key, f => f.Value).ToDictionary(g => g.Key, g => g.First());
|
|
||||||
foreach (var f in GetAllFields())
|
|
||||||
{
|
|
||||||
if (f.Field.Constant || !values.TryGetValue(f.FullName, out var val))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
f.Field.Value = val;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetValues(JObject values)
|
|
||||||
{
|
|
||||||
var fields = GetAllFields().ToDictionary(k => k.FullName, k => k.Field);
|
|
||||||
SetValues(fields, new List<string>(), values);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SetValues(Dictionary<string, Field> fields, List<string> path, JObject values)
|
|
||||||
{
|
|
||||||
foreach (var prop in values.Properties())
|
|
||||||
{
|
|
||||||
List<string> propPath = new List<string>(path.Count + 1);
|
|
||||||
propPath.AddRange(path);
|
|
||||||
propPath.Add(prop.Name);
|
|
||||||
if (prop.Value.Type == JTokenType.Object)
|
|
||||||
{
|
|
||||||
SetValues(fields, propPath, (JObject)prop.Value);
|
|
||||||
}
|
|
||||||
else if (prop.Value.Type == JTokenType.String)
|
|
||||||
{
|
|
||||||
var fullName = string.Join('_', propPath.Where(s => !string.IsNullOrEmpty(s)));
|
|
||||||
if (fields.TryGetValue(fullName, out var f) && !f.Constant)
|
|
||||||
f.Value = prop.Value.Value<string>();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,69 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Reflection;
|
|
||||||
using BTCPayServer.Abstractions.Contracts;
|
|
||||||
using Microsoft.AspNetCore.Builder;
|
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
|
||||||
|
|
||||||
namespace BTCPayServer.Abstractions.Models
|
|
||||||
{
|
|
||||||
public abstract class BaseBTCPayServerPlugin : IBTCPayServerPlugin
|
|
||||||
{
|
|
||||||
public virtual string Identifier
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return GetType().GetTypeInfo().Assembly.GetName().Name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public virtual string Name
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return GetType().GetTypeInfo().Assembly
|
|
||||||
.GetCustomAttribute<AssemblyProductAttribute>()?
|
|
||||||
.Product ?? "???";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual Version Version
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return GetVersion(GetType().GetTypeInfo().Assembly
|
|
||||||
.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?
|
|
||||||
.InformationalVersion) ??
|
|
||||||
Assembly.GetAssembly(GetType())?.GetName()?.Version ??
|
|
||||||
new Version(1, 0, 0, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Version GetVersion(string informationalVersion)
|
|
||||||
{
|
|
||||||
if (informationalVersion is null)
|
|
||||||
return null;
|
|
||||||
Version.TryParse(informationalVersion, out var r);
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual string Description
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return GetType().GetTypeInfo().Assembly
|
|
||||||
.GetCustomAttribute<AssemblyDescriptionAttribute>()?
|
|
||||||
.Description ?? string.Empty;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public bool SystemPlugin { get; set; }
|
|
||||||
public virtual IBTCPayServerPlugin.PluginDependency[] Dependencies { get; } = Array.Empty<IBTCPayServerPlugin.PluginDependency>();
|
|
||||||
|
|
||||||
public virtual void Execute(IApplicationBuilder applicationBuilder,
|
|
||||||
IServiceProvider applicationBuilderApplicationServices)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual void Execute(IServiceCollection applicationBuilder)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,34 +0,0 @@
|
|||||||
using System;
|
|
||||||
|
|
||||||
namespace BTCPayServer.Abstractions.Models
|
|
||||||
{
|
|
||||||
public class ConfirmModel
|
|
||||||
{
|
|
||||||
private const string ButtonClassDefault = "btn-danger";
|
|
||||||
|
|
||||||
public ConfirmModel() { }
|
|
||||||
|
|
||||||
public ConfirmModel(string title, string desc, string action = null, string buttonClass = ButtonClassDefault, string actionName = null, string controllerName = null)
|
|
||||||
{
|
|
||||||
Title = title;
|
|
||||||
Description = desc;
|
|
||||||
Action = action;
|
|
||||||
ActionName = actionName;
|
|
||||||
ControllerName = controllerName;
|
|
||||||
ButtonClass = buttonClass;
|
|
||||||
|
|
||||||
if (Description.Contains("<strong>", StringComparison.InvariantCultureIgnoreCase))
|
|
||||||
{
|
|
||||||
DescriptionHtml = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public string Title { get; set; }
|
|
||||||
public string Description { get; set; }
|
|
||||||
public bool DescriptionHtml { get; set; }
|
|
||||||
public string Action { get; set; }
|
|
||||||
public string ActionName { get; set; }
|
|
||||||
public string ControllerName { get; set; }
|
|
||||||
public string ButtonClass { get; set; } = ButtonClassDefault;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,8 +0,0 @@
|
|||||||
namespace BTCPayServer.Abstractions.Models
|
|
||||||
{
|
|
||||||
public class DatabaseOptions
|
|
||||||
{
|
|
||||||
public DatabaseType DatabaseType { get; set; }
|
|
||||||
public string ConnectionString { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,9 +0,0 @@
|
|||||||
namespace BTCPayServer.Abstractions.Models
|
|
||||||
{
|
|
||||||
public enum DatabaseType
|
|
||||||
{
|
|
||||||
Sqlite,
|
|
||||||
Postgres,
|
|
||||||
MySQL,
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,7 +0,0 @@
|
|||||||
rm "bin\release\" -Recurse -Force
|
|
||||||
dotnet pack --configuration Release --include-symbols -p:SymbolPackageFormat=snupkg
|
|
||||||
$package=(ls .\bin\Release\*.nupkg).FullName
|
|
||||||
dotnet nuget push $package --source "https://api.nuget.org/v3/index.json"
|
|
||||||
$ver = ((ls .\bin\release\*.nupkg)[0].Name -replace '.*(\d+\.\d+\.\d+)\.nupkg','$1')
|
|
||||||
git tag -a "BTCPayServer.Abstractions/v$ver" -m "BTCPayServer.Abstractions/$ver"
|
|
||||||
git push origin "BTCPayServer.Abstractions/v$ver"
|
|
@ -1,27 +0,0 @@
|
|||||||
using Microsoft.AspNetCore.Authorization;
|
|
||||||
using Microsoft.AspNetCore.Http;
|
|
||||||
|
|
||||||
namespace BTCPayServer.Security;
|
|
||||||
|
|
||||||
public class AuthorizationFilterHandle
|
|
||||||
{
|
|
||||||
public AuthorizationHandlerContext Context { get; }
|
|
||||||
public PolicyRequirement Requirement { get; }
|
|
||||||
public HttpContext HttpContext { get; }
|
|
||||||
public bool Success { get; private set; }
|
|
||||||
|
|
||||||
public AuthorizationFilterHandle(
|
|
||||||
AuthorizationHandlerContext context,
|
|
||||||
PolicyRequirement requirement,
|
|
||||||
HttpContext httpContext)
|
|
||||||
{
|
|
||||||
Context = context;
|
|
||||||
Requirement = requirement;
|
|
||||||
HttpContext = httpContext;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void MarkSuccessful()
|
|
||||||
{
|
|
||||||
Success = true;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
using System.Threading.Tasks;
|
|
||||||
using BTCPayServer.Abstractions.Contracts;
|
|
||||||
|
|
||||||
namespace BTCPayServer.Abstractions.Services
|
|
||||||
{
|
|
||||||
public abstract class PluginAction<T> : IPluginHookAction
|
|
||||||
{
|
|
||||||
public abstract string Hook { get; }
|
|
||||||
public Task Execute(object args)
|
|
||||||
{
|
|
||||||
return Execute(args is T args1 ? args1 : default);
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract Task Execute(T arg);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
using System.Threading.Tasks;
|
|
||||||
using BTCPayServer.Abstractions.Contracts;
|
|
||||||
|
|
||||||
namespace BTCPayServer.Abstractions.Services
|
|
||||||
{
|
|
||||||
public abstract class PluginHookFilter<T> : IPluginHookFilter
|
|
||||||
{
|
|
||||||
public abstract string Hook { get; }
|
|
||||||
|
|
||||||
public Task<object> Execute(object args)
|
|
||||||
{
|
|
||||||
return Execute(args is T args1 ? args1 : default).ContinueWith(task => task.Result as object);
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract Task<T> Execute(T arg);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
using BTCPayServer.Abstractions.Contracts;
|
|
||||||
|
|
||||||
namespace BTCPayServer.Abstractions.Services
|
|
||||||
{
|
|
||||||
public class UIExtension : IUIExtension
|
|
||||||
{
|
|
||||||
public UIExtension(string partial, string location)
|
|
||||||
{
|
|
||||||
Partial = partial;
|
|
||||||
Location = location;
|
|
||||||
}
|
|
||||||
|
|
||||||
public string Partial { get; }
|
|
||||||
public string Location { get; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,30 +0,0 @@
|
|||||||
using System;
|
|
||||||
using BTCPayServer.Security;
|
|
||||||
using Microsoft.AspNetCore.Razor.TagHelpers;
|
|
||||||
|
|
||||||
namespace BTCPayServer.Abstractions.TagHelpers;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Add sha256- to allow inline event handlers in a:href=javascript:
|
|
||||||
/// </summary>
|
|
||||||
[HtmlTargetElement("a", Attributes = "csp-allow")]
|
|
||||||
public class CSPA : TagHelper
|
|
||||||
{
|
|
||||||
private readonly ContentSecurityPolicies _csp;
|
|
||||||
public CSPA(ContentSecurityPolicies csp)
|
|
||||||
{
|
|
||||||
_csp = csp;
|
|
||||||
}
|
|
||||||
public override void Process(TagHelperContext context, TagHelperOutput output)
|
|
||||||
{
|
|
||||||
output.Attributes.RemoveAll("csp-allow");
|
|
||||||
if (output.Attributes.TryGetAttribute("href", out var attr))
|
|
||||||
{
|
|
||||||
var v = attr.Value.ToString();
|
|
||||||
if (v.StartsWith("javascript:", StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
_csp.AllowUnsafeHashes(v);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,37 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using BTCPayServer.Security;
|
|
||||||
using Microsoft.AspNetCore.Razor.TagHelpers;
|
|
||||||
|
|
||||||
namespace BTCPayServer.Abstractions.TagHelpers;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Add 'unsafe-hashes' and sha256- to allow inline event handlers in CSP
|
|
||||||
/// </summary>
|
|
||||||
[HtmlTargetElement(Attributes = "onclick")]
|
|
||||||
[HtmlTargetElement(Attributes = "onkeypress")]
|
|
||||||
[HtmlTargetElement(Attributes = "onchange")]
|
|
||||||
[HtmlTargetElement(Attributes = "onsubmit")]
|
|
||||||
public class CSPEventTagHelper : TagHelper
|
|
||||||
{
|
|
||||||
public const string EventNames = "onclick,onkeypress,onchange,onsubmit";
|
|
||||||
private readonly ContentSecurityPolicies _csp;
|
|
||||||
|
|
||||||
readonly static HashSet<string> EventSet = EventNames.Split(',')
|
|
||||||
.ToHashSet();
|
|
||||||
public CSPEventTagHelper(ContentSecurityPolicies csp)
|
|
||||||
{
|
|
||||||
_csp = csp;
|
|
||||||
}
|
|
||||||
public override void Process(TagHelperContext context, TagHelperOutput output)
|
|
||||||
{
|
|
||||||
foreach (var attr in output.Attributes)
|
|
||||||
{
|
|
||||||
var n = attr.Name.ToLowerInvariant();
|
|
||||||
if (EventSet.Contains(n))
|
|
||||||
{
|
|
||||||
_csp.AllowUnsafeHashes(attr.Value.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,33 +0,0 @@
|
|||||||
using BTCPayServer.Security;
|
|
||||||
using Microsoft.AspNetCore.Razor.TagHelpers;
|
|
||||||
using NBitcoin;
|
|
||||||
|
|
||||||
namespace BTCPayServer.Abstractions.TagHelpers;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Add a nonce-* so the inline-script can pass CSP rule when they are rendered server-side
|
|
||||||
/// </summary>
|
|
||||||
[HtmlTargetElement("script")]
|
|
||||||
public class CSPInlineScriptTagHelper : TagHelper
|
|
||||||
{
|
|
||||||
private readonly ContentSecurityPolicies _csp;
|
|
||||||
|
|
||||||
public CSPInlineScriptTagHelper(ContentSecurityPolicies csp)
|
|
||||||
{
|
|
||||||
_csp = csp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Process(TagHelperContext context, TagHelperOutput output)
|
|
||||||
{
|
|
||||||
if (output.Attributes.ContainsName("src"))
|
|
||||||
return;
|
|
||||||
if (output.Attributes.TryGetAttribute("type", out var attr))
|
|
||||||
{
|
|
||||||
if (attr.Value?.ToString() != "text/javascript")
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var nonce = RandomUtils.GetUInt256().ToString().Substring(0, 32);
|
|
||||||
output.Attributes.Add(new TagHelperAttribute("nonce", nonce));
|
|
||||||
_csp.Add("script-src", $"'nonce-{nonce}'");
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,25 +0,0 @@
|
|||||||
using System.Threading.Tasks;
|
|
||||||
using BTCPayServer.Security;
|
|
||||||
using Microsoft.AspNetCore.Razor.TagHelpers;
|
|
||||||
|
|
||||||
namespace BTCPayServer.Abstractions.TagHelpers;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Add sha256- to allow inline event handlers in CSP
|
|
||||||
/// </summary>
|
|
||||||
[HtmlTargetElement("template", Attributes = "csp-allow")]
|
|
||||||
public class CSPTemplate : TagHelper
|
|
||||||
{
|
|
||||||
private readonly ContentSecurityPolicies _csp;
|
|
||||||
public CSPTemplate(ContentSecurityPolicies csp)
|
|
||||||
{
|
|
||||||
_csp = csp;
|
|
||||||
}
|
|
||||||
public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
|
|
||||||
{
|
|
||||||
output.Attributes.RemoveAll("csp-allow");
|
|
||||||
var childContent = await output.GetChildContentAsync();
|
|
||||||
var content = childContent.GetContent();
|
|
||||||
_csp.AllowInline(content);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,50 +0,0 @@
|
|||||||
using System.Threading.Tasks;
|
|
||||||
using Microsoft.AspNetCore.Authorization;
|
|
||||||
using Microsoft.AspNetCore.Http;
|
|
||||||
using Microsoft.AspNetCore.Razor.TagHelpers;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
|
|
||||||
namespace BTCPayServer.Abstractions.TagHelpers;
|
|
||||||
|
|
||||||
[HtmlTargetElement(Attributes = "[permission]")]
|
|
||||||
[HtmlTargetElement(Attributes = "[not-permission]" )]
|
|
||||||
public class PermissionTagHelper : TagHelper
|
|
||||||
{
|
|
||||||
private readonly IAuthorizationService _authorizationService;
|
|
||||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
|
||||||
|
|
||||||
public PermissionTagHelper(IAuthorizationService authorizationService, IHttpContextAccessor httpContextAccessor)
|
|
||||||
{
|
|
||||||
_authorizationService = authorizationService;
|
|
||||||
_httpContextAccessor = httpContextAccessor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public string Permission { get; set; }
|
|
||||||
public string NotPermission { get; set; }
|
|
||||||
public string PermissionResource { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(Permission) && string.IsNullOrEmpty(NotPermission))
|
|
||||||
return;
|
|
||||||
if (_httpContextAccessor.HttpContext is null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
var expectedResult = !string.IsNullOrEmpty(Permission);
|
|
||||||
var key = $"{Permission??NotPermission}_{PermissionResource}";
|
|
||||||
if (!_httpContextAccessor.HttpContext.Items.TryGetValue(key, out var o) ||
|
|
||||||
o is not AuthorizationResult res)
|
|
||||||
{
|
|
||||||
res = await _authorizationService.AuthorizeAsync(_httpContextAccessor.HttpContext.User,
|
|
||||||
PermissionResource,
|
|
||||||
Permission);
|
|
||||||
_httpContextAccessor.HttpContext.Items.Add(key, res);
|
|
||||||
}
|
|
||||||
if (expectedResult != res.Succeeded)
|
|
||||||
{
|
|
||||||
output.SuppressOutput();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,42 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Diagnostics.CodeAnalysis;
|
|
||||||
using System.IO;
|
|
||||||
using System.Text.Encodings.Web;
|
|
||||||
using Microsoft.AspNetCore.Html;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using Microsoft.AspNetCore.Mvc.Razor.TagHelpers;
|
|
||||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
|
||||||
using Microsoft.AspNetCore.Mvc.Routing;
|
|
||||||
using Microsoft.AspNetCore.Mvc.ViewFeatures;
|
|
||||||
using Microsoft.AspNetCore.Razor.TagHelpers;
|
|
||||||
|
|
||||||
namespace BTCPayServer.Abstractions.TagHelpers;
|
|
||||||
|
|
||||||
// Make sure that <svg><use href=/ are correctly working if rootpath is present
|
|
||||||
[HtmlTargetElement("use", Attributes = "href")]
|
|
||||||
public class SVGUse : UrlResolutionTagHelper2
|
|
||||||
{
|
|
||||||
private readonly IFileVersionProvider _fileVersionProvider;
|
|
||||||
|
|
||||||
public SVGUse(IUrlHelperFactory urlHelperFactory, HtmlEncoder htmlEncoder, IFileVersionProvider fileVersionProvider) : base(urlHelperFactory, htmlEncoder)
|
|
||||||
{
|
|
||||||
_fileVersionProvider = fileVersionProvider;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Process(TagHelperContext context, TagHelperOutput output)
|
|
||||||
{
|
|
||||||
var attr = output.Attributes["href"].Value.ToString();
|
|
||||||
var symbolIndex = attr!.IndexOf("#", StringComparison.InvariantCulture);
|
|
||||||
var start = attr.IndexOf("~", StringComparison.InvariantCulture) + 1;
|
|
||||||
var length = (symbolIndex != -1 ? symbolIndex : attr.Length) - start;
|
|
||||||
var filePath = attr.Substring(start, length);
|
|
||||||
if (!string.IsNullOrEmpty(filePath))
|
|
||||||
{
|
|
||||||
var versioned = _fileVersionProvider.AddFileVersionToPath(ViewContext.HttpContext.Request.PathBase, filePath);
|
|
||||||
attr = attr.Replace(filePath, versioned);
|
|
||||||
}
|
|
||||||
output.Attributes.SetAttribute("href", attr);
|
|
||||||
base.Process(context, output);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,31 +0,0 @@
|
|||||||
using BTCPayServer.Abstractions.Services;
|
|
||||||
using BTCPayServer.Security;
|
|
||||||
using Microsoft.AspNetCore.Razor.TagHelpers;
|
|
||||||
using NBitcoin;
|
|
||||||
|
|
||||||
namespace BTCPayServer.Abstractions.TagHelpers;
|
|
||||||
|
|
||||||
[HtmlTargetElement("srv-model")]
|
|
||||||
public class SrvModel : TagHelper
|
|
||||||
{
|
|
||||||
private readonly Safe _safe;
|
|
||||||
private readonly ContentSecurityPolicies _csp;
|
|
||||||
|
|
||||||
public SrvModel(Safe safe, ContentSecurityPolicies csp)
|
|
||||||
{
|
|
||||||
_safe = safe;
|
|
||||||
_csp = csp;
|
|
||||||
}
|
|
||||||
public string VarName { get; set; } = "srvModel";
|
|
||||||
public object Model { get; set; }
|
|
||||||
public override void Process(TagHelperContext context, TagHelperOutput output)
|
|
||||||
{
|
|
||||||
output.TagName = "script";
|
|
||||||
output.TagMode = TagMode.StartTagAndEndTag;
|
|
||||||
output.Attributes.Add(new TagHelperAttribute("type", "text/javascript"));
|
|
||||||
var nonce = RandomUtils.GetUInt256().ToString().Substring(0, 32);
|
|
||||||
output.Attributes.Add(new TagHelperAttribute("nonce", nonce));
|
|
||||||
_csp.Add("script-src", $"'nonce-{nonce}'");
|
|
||||||
output.Content.SetHtmlContent($"var {VarName} = {_safe.Json(Model)};");
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,314 +0,0 @@
|
|||||||
#nullable enable
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Diagnostics.CodeAnalysis;
|
|
||||||
using System.IO;
|
|
||||||
using System.Text.Encodings.Web;
|
|
||||||
using Microsoft.AspNetCore.Html;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using Microsoft.AspNetCore.Mvc.Razor.TagHelpers;
|
|
||||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
|
||||||
using Microsoft.AspNetCore.Mvc.Routing;
|
|
||||||
using Microsoft.AspNetCore.Mvc.ViewFeatures;
|
|
||||||
using Microsoft.AspNetCore.Razor.TagHelpers;
|
|
||||||
|
|
||||||
|
|
||||||
namespace BTCPayServer.Abstractions.TagHelpers
|
|
||||||
{
|
|
||||||
// A copy of https://github.com/dotnet/aspnetcore/blob/39f0e0b8f40b4754418f81aef0de58a9204a1fe5/src/Mvc/Mvc.Razor/src/TagHelpers/UrlResolutionTagHelper.cs
|
|
||||||
// slightly modified to also work on use tag.
|
|
||||||
public class UrlResolutionTagHelper2 : TagHelper
|
|
||||||
{
|
|
||||||
// Valid whitespace characters defined by the HTML5 spec.
|
|
||||||
private static readonly char[] ValidAttributeWhitespaceChars =
|
|
||||||
new[] { '\t', '\n', '\u000C', '\r', ' ' };
|
|
||||||
private static readonly Dictionary<string, string[]> ElementAttributeLookups =
|
|
||||||
new(StringComparer.OrdinalIgnoreCase)
|
|
||||||
{
|
|
||||||
{ "use", new[] { "href" } },
|
|
||||||
{ "a", new[] { "href" } },
|
|
||||||
{ "applet", new[] { "archive" } },
|
|
||||||
{ "area", new[] { "href" } },
|
|
||||||
{ "audio", new[] { "src" } },
|
|
||||||
{ "base", new[] { "href" } },
|
|
||||||
{ "blockquote", new[] { "cite" } },
|
|
||||||
{ "button", new[] { "formaction" } },
|
|
||||||
{ "del", new[] { "cite" } },
|
|
||||||
{ "embed", new[] { "src" } },
|
|
||||||
{ "form", new[] { "action" } },
|
|
||||||
{ "html", new[] { "manifest" } },
|
|
||||||
{ "iframe", new[] { "src" } },
|
|
||||||
{ "img", new[] { "src", "srcset" } },
|
|
||||||
{ "input", new[] { "src", "formaction" } },
|
|
||||||
{ "ins", new[] { "cite" } },
|
|
||||||
{ "link", new[] { "href" } },
|
|
||||||
{ "menuitem", new[] { "icon" } },
|
|
||||||
{ "object", new[] { "archive", "data" } },
|
|
||||||
{ "q", new[] { "cite" } },
|
|
||||||
{ "script", new[] { "src" } },
|
|
||||||
{ "source", new[] { "src", "srcset" } },
|
|
||||||
{ "track", new[] { "src" } },
|
|
||||||
{ "video", new[] { "poster", "src" } },
|
|
||||||
};
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Creates a new <see cref="UrlResolutionTagHelper"/>.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="urlHelperFactory">The <see cref="IUrlHelperFactory"/>.</param>
|
|
||||||
/// <param name="htmlEncoder">The <see cref="HtmlEncoder"/>.</param>
|
|
||||||
public UrlResolutionTagHelper2(IUrlHelperFactory urlHelperFactory, HtmlEncoder htmlEncoder)
|
|
||||||
{
|
|
||||||
UrlHelperFactory = urlHelperFactory;
|
|
||||||
HtmlEncoder = htmlEncoder;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
public override int Order => -1000 - 999;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The <see cref="IUrlHelperFactory"/>.
|
|
||||||
/// </summary>
|
|
||||||
protected IUrlHelperFactory UrlHelperFactory { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The <see cref="HtmlEncoder"/>.
|
|
||||||
/// </summary>
|
|
||||||
protected HtmlEncoder HtmlEncoder { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The <see cref="ViewContext"/>.
|
|
||||||
/// </summary>
|
|
||||||
[HtmlAttributeNotBound]
|
|
||||||
[ViewContext]
|
|
||||||
public ViewContext ViewContext { get; set; } = default!;
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
public override void Process(TagHelperContext context, TagHelperOutput output)
|
|
||||||
{
|
|
||||||
ArgumentNullException.ThrowIfNull(context);
|
|
||||||
ArgumentNullException.ThrowIfNull(output);
|
|
||||||
|
|
||||||
if (output.TagName == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ElementAttributeLookups.TryGetValue(output.TagName, out var attributeNames))
|
|
||||||
{
|
|
||||||
for (var i = 0; i < attributeNames.Length; i++)
|
|
||||||
{
|
|
||||||
ProcessUrlAttribute(attributeNames[i], output);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// itemid can be present on any HTML element.
|
|
||||||
ProcessUrlAttribute("itemid", output);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Resolves and updates URL values starting with '~/' (relative to the application's 'webroot' setting) for
|
|
||||||
/// <paramref name="output"/>'s <see cref="TagHelperOutput.Attributes"/> whose
|
|
||||||
/// <see cref="TagHelperAttribute.Name"/> is <paramref name="attributeName"/>.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="attributeName">The attribute name used to lookup values to resolve.</param>
|
|
||||||
/// <param name="output">The <see cref="TagHelperOutput"/>.</param>
|
|
||||||
protected void ProcessUrlAttribute(string attributeName, TagHelperOutput output)
|
|
||||||
{
|
|
||||||
ArgumentNullException.ThrowIfNull(attributeName);
|
|
||||||
ArgumentNullException.ThrowIfNull(output);
|
|
||||||
|
|
||||||
var attributes = output.Attributes;
|
|
||||||
// Read interface .Count once rather than per iteration
|
|
||||||
var attributesCount = attributes.Count;
|
|
||||||
for (var i = 0; i < attributesCount; i++)
|
|
||||||
{
|
|
||||||
var attribute = attributes[i];
|
|
||||||
if (!string.Equals(attribute.Name, attributeName, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (attribute.Value is string stringValue)
|
|
||||||
{
|
|
||||||
if (TryResolveUrl(stringValue, resolvedUrl: out string? resolvedUrl))
|
|
||||||
{
|
|
||||||
attributes[i] = new TagHelperAttribute(
|
|
||||||
attribute.Name,
|
|
||||||
resolvedUrl,
|
|
||||||
attribute.ValueStyle);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (attribute.Value is IHtmlContent htmlContent)
|
|
||||||
{
|
|
||||||
var htmlString = htmlContent as HtmlString;
|
|
||||||
if (htmlString != null)
|
|
||||||
{
|
|
||||||
// No need for a StringWriter in this case.
|
|
||||||
stringValue = htmlString.ToString();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
using var writer = new StringWriter();
|
|
||||||
htmlContent.WriteTo(writer, HtmlEncoder);
|
|
||||||
stringValue = writer.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (TryResolveUrl(stringValue, resolvedUrl: out IHtmlContent? resolvedUrl))
|
|
||||||
{
|
|
||||||
attributes[i] = new TagHelperAttribute(
|
|
||||||
attribute.Name,
|
|
||||||
resolvedUrl,
|
|
||||||
attribute.ValueStyle);
|
|
||||||
}
|
|
||||||
else if (htmlString == null)
|
|
||||||
{
|
|
||||||
// Not a ~/ URL. Just avoid re-encoding the attribute value later.
|
|
||||||
attributes[i] = new TagHelperAttribute(
|
|
||||||
attribute.Name,
|
|
||||||
new HtmlString(stringValue),
|
|
||||||
attribute.ValueStyle);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Tries to resolve the given <paramref name="url"/> value relative to the application's 'webroot' setting.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="url">The URL to resolve.</param>
|
|
||||||
/// <param name="resolvedUrl">Absolute URL beginning with the application's virtual root. <c>null</c> if
|
|
||||||
/// <paramref name="url"/> could not be resolved.</param>
|
|
||||||
/// <returns><c>true</c> if the <paramref name="url"/> could be resolved; <c>false</c> otherwise.</returns>
|
|
||||||
protected bool TryResolveUrl(string url, out string? resolvedUrl)
|
|
||||||
{
|
|
||||||
resolvedUrl = null;
|
|
||||||
var start = FindRelativeStart(url);
|
|
||||||
if (start == -1)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
var trimmedUrl = CreateTrimmedString(url, start);
|
|
||||||
|
|
||||||
var urlHelper = UrlHelperFactory.GetUrlHelper(ViewContext);
|
|
||||||
resolvedUrl = urlHelper.Content(trimmedUrl);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Tries to resolve the given <paramref name="url"/> value relative to the application's 'webroot' setting.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="url">The URL to resolve.</param>
|
|
||||||
/// <param name="resolvedUrl">
|
|
||||||
/// Absolute URL beginning with the application's virtual root. <c>null</c> if <paramref name="url"/> could
|
|
||||||
/// not be resolved.
|
|
||||||
/// </param>
|
|
||||||
/// <returns><c>true</c> if the <paramref name="url"/> could be resolved; <c>false</c> otherwise.</returns>
|
|
||||||
protected bool TryResolveUrl(string url, [NotNullWhen(true)] out IHtmlContent? resolvedUrl)
|
|
||||||
{
|
|
||||||
resolvedUrl = null;
|
|
||||||
var start = FindRelativeStart(url);
|
|
||||||
if (start == -1)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
var trimmedUrl = CreateTrimmedString(url, start);
|
|
||||||
|
|
||||||
var urlHelper = UrlHelperFactory.GetUrlHelper(ViewContext);
|
|
||||||
var appRelativeUrl = urlHelper.Content(trimmedUrl);
|
|
||||||
var postTildeSlashUrlValue = trimmedUrl.Substring(2);
|
|
||||||
|
|
||||||
if (!appRelativeUrl.EndsWith(postTildeSlashUrlValue, StringComparison.Ordinal))
|
|
||||||
{
|
|
||||||
throw new InvalidOperationException();
|
|
||||||
}
|
|
||||||
|
|
||||||
resolvedUrl = new EncodeFirstSegmentContent(
|
|
||||||
appRelativeUrl,
|
|
||||||
appRelativeUrl.Length - postTildeSlashUrlValue.Length,
|
|
||||||
postTildeSlashUrlValue);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static int FindRelativeStart(string url)
|
|
||||||
{
|
|
||||||
if (url == null || url.Length < 2)
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
var maxTestLength = url.Length - 2;
|
|
||||||
|
|
||||||
var start = 0;
|
|
||||||
for (; start < url.Length; start++)
|
|
||||||
{
|
|
||||||
if (start > maxTestLength)
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!IsCharWhitespace(url[start]))
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Before doing more work, ensure that the URL we're looking at is app-relative.
|
|
||||||
if (url[start] != '~' || url[start + 1] != '/')
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return start;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static string CreateTrimmedString(string input, int start)
|
|
||||||
{
|
|
||||||
var end = input.Length - 1;
|
|
||||||
for (; end >= start; end--)
|
|
||||||
{
|
|
||||||
if (!IsCharWhitespace(input[end]))
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var len = end - start + 1;
|
|
||||||
|
|
||||||
// Substring returns same string if start == 0 && len == Length
|
|
||||||
return input.Substring(start, len);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static bool IsCharWhitespace(char ch)
|
|
||||||
{
|
|
||||||
return ValidAttributeWhitespaceChars.AsSpan().IndexOf(ch) != -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
private sealed class EncodeFirstSegmentContent : IHtmlContent
|
|
||||||
{
|
|
||||||
private readonly string _firstSegment;
|
|
||||||
private readonly int _firstSegmentLength;
|
|
||||||
private readonly string _secondSegment;
|
|
||||||
|
|
||||||
public EncodeFirstSegmentContent(string firstSegment, int firstSegmentLength, string secondSegment)
|
|
||||||
{
|
|
||||||
_firstSegment = firstSegment;
|
|
||||||
_firstSegmentLength = firstSegmentLength;
|
|
||||||
_secondSegment = secondSegment;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void WriteTo(TextWriter writer, HtmlEncoder encoder)
|
|
||||||
{
|
|
||||||
encoder.Encode(writer, _firstSegment, 0, _firstSegmentLength);
|
|
||||||
writer.Write(_secondSegment);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Binary file not shown.
Before ![]() (image error) Size: 29 KiB |
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netstandard2.1</TargetFramework>
|
<TargetFramework>netstandard2.1</TargetFramework>
|
||||||
<LangVersion>10.0</LangVersion>
|
|
||||||
<Company>BTCPay Server</Company>
|
<Company>BTCPay Server</Company>
|
||||||
<Copyright>Copyright © BTCPay Server 2020</Copyright>
|
<Copyright>Copyright © BTCPay Server 2020</Copyright>
|
||||||
<Description>A client library for BTCPay Server Greenfield API</Description>
|
<Description>A client library for BTCPay Server Greenfield API</Description>
|
||||||
@ -12,11 +11,9 @@
|
|||||||
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||||
<RepositoryUrl>https://github.com/btcpayserver/btcpayserver</RepositoryUrl>
|
<RepositoryUrl>https://github.com/btcpayserver/btcpayserver</RepositoryUrl>
|
||||||
<RepositoryType>git</RepositoryType>
|
<RepositoryType>git</RepositoryType>
|
||||||
<Configurations>Debug;Release;Altcoins-Debug;Altcoins-Release</Configurations>
|
|
||||||
<Platforms>AnyCPU</Platforms>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Version Condition=" '$(Version)' == '' ">1.7.2</Version>
|
<Version Condition=" '$(Version)' == '' ">1.1.0</Version>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||||
<PublishRepositoryUrl>true</PublishRepositoryUrl>
|
<PublishRepositoryUrl>true</PublishRepositoryUrl>
|
||||||
@ -30,9 +27,9 @@
|
|||||||
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
|
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="BTCPayServer.Lightning.Common" Version="1.3.21" />
|
<PackageReference Include="NBitcoin" Version="5.0.51" />
|
||||||
<PackageReference Include="NBitcoin" Version="7.0.24" />
|
<PackageReference Include="BTCPayServer.Lightning.Common" Version="1.2.0" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="icon.png" Pack="true" PackagePath="\" />
|
<None Include="icon.png" Pack="true" PackagePath="\" />
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@ -23,15 +22,6 @@ namespace BTCPayServer.Client
|
|||||||
return await HandleResponse<ApiKeyData>(response);
|
return await HandleResponse<ApiKeyData>(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual async Task<ApiKeyData> CreateAPIKey(string userId, CreateApiKeyRequest request, CancellationToken token = default)
|
|
||||||
{
|
|
||||||
if (request == null)
|
|
||||||
throw new ArgumentNullException(nameof(request));
|
|
||||||
var response = await _httpClient.SendAsync(CreateHttpRequest($"api/v1/users/{userId}/api-keys",
|
|
||||||
bodyPayload: request, method: HttpMethod.Post), token);
|
|
||||||
return await HandleResponse<ApiKeyData>(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual async Task RevokeCurrentAPIKeyInfo(CancellationToken token = default)
|
public virtual async Task RevokeCurrentAPIKeyInfo(CancellationToken token = default)
|
||||||
{
|
{
|
||||||
var response = await _httpClient.SendAsync(CreateHttpRequest("api/v1/api-keys/current", null, HttpMethod.Delete), token);
|
var response = await _httpClient.SendAsync(CreateHttpRequest("api/v1/api-keys/current", null, HttpMethod.Delete), token);
|
||||||
@ -45,14 +35,5 @@ namespace BTCPayServer.Client
|
|||||||
var response = await _httpClient.SendAsync(CreateHttpRequest($"api/v1/api-keys/{apikey}", null, HttpMethod.Delete), token);
|
var response = await _httpClient.SendAsync(CreateHttpRequest($"api/v1/api-keys/{apikey}", null, HttpMethod.Delete), token);
|
||||||
await HandleResponse(response);
|
await HandleResponse(response);
|
||||||
}
|
}
|
||||||
public virtual async Task RevokeAPIKey(string userId, string apikey, CancellationToken token = default)
|
|
||||||
{
|
|
||||||
if (apikey == null)
|
|
||||||
throw new ArgumentNullException(nameof(apikey));
|
|
||||||
if (userId is null)
|
|
||||||
throw new ArgumentNullException(nameof(userId));
|
|
||||||
var response = await _httpClient.SendAsync(CreateHttpRequest($"api/v1/users/{userId}/api-keys/{apikey}", null, HttpMethod.Delete), token);
|
|
||||||
await HandleResponse(response);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,103 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Net.Http;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using BTCPayServer.Client.Models;
|
|
||||||
|
|
||||||
namespace BTCPayServer.Client
|
|
||||||
{
|
|
||||||
public partial class BTCPayServerClient
|
|
||||||
{
|
|
||||||
|
|
||||||
public virtual async Task<PointOfSaleAppData> CreatePointOfSaleApp(string storeId,
|
|
||||||
CreatePointOfSaleAppRequest request, CancellationToken token = default)
|
|
||||||
{
|
|
||||||
if (request == null)
|
|
||||||
throw new ArgumentNullException(nameof(request));
|
|
||||||
var response = await _httpClient.SendAsync(
|
|
||||||
CreateHttpRequest($"api/v1/stores/{storeId}/apps/pos", bodyPayload: request,
|
|
||||||
method: HttpMethod.Post), token);
|
|
||||||
return await HandleResponse<PointOfSaleAppData>(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual async Task<CrowdfundAppData> CreateCrowdfundApp(string storeId,
|
|
||||||
CreateCrowdfundAppRequest request, CancellationToken token = default)
|
|
||||||
{
|
|
||||||
if (request == null)
|
|
||||||
throw new ArgumentNullException(nameof(request));
|
|
||||||
var response = await _httpClient.SendAsync(
|
|
||||||
CreateHttpRequest($"api/v1/stores/{storeId}/apps/crowdfund", bodyPayload: request,
|
|
||||||
method: HttpMethod.Post), token);
|
|
||||||
return await HandleResponse<CrowdfundAppData>(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual async Task<PointOfSaleAppData> UpdatePointOfSaleApp(string appId,
|
|
||||||
CreatePointOfSaleAppRequest request, CancellationToken token = default)
|
|
||||||
{
|
|
||||||
if (request == null)
|
|
||||||
throw new ArgumentNullException(nameof(request));
|
|
||||||
var response = await _httpClient.SendAsync(
|
|
||||||
CreateHttpRequest($"api/v1/apps/pos/{appId}", bodyPayload: request,
|
|
||||||
method: HttpMethod.Put), token);
|
|
||||||
return await HandleResponse<PointOfSaleAppData>(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual async Task<AppDataBase> GetApp(string appId, CancellationToken token = default)
|
|
||||||
{
|
|
||||||
if (appId == null)
|
|
||||||
throw new ArgumentNullException(nameof(appId));
|
|
||||||
var response = await _httpClient.SendAsync(
|
|
||||||
CreateHttpRequest($"api/v1/apps/{appId}",
|
|
||||||
method: HttpMethod.Get), token);
|
|
||||||
return await HandleResponse<AppDataBase>(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual async Task<AppDataBase[]> GetAllApps(string storeId, CancellationToken token = default)
|
|
||||||
{
|
|
||||||
if (storeId == null)
|
|
||||||
throw new ArgumentNullException(nameof(storeId));
|
|
||||||
var response = await _httpClient.SendAsync(
|
|
||||||
CreateHttpRequest($"api/v1/stores/{storeId}/apps",
|
|
||||||
method: HttpMethod.Get), token);
|
|
||||||
return await HandleResponse<AppDataBase[]>(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual async Task<AppDataBase[]> GetAllApps(CancellationToken token = default)
|
|
||||||
{
|
|
||||||
var response = await _httpClient.SendAsync(
|
|
||||||
CreateHttpRequest($"api/v1/apps",
|
|
||||||
method: HttpMethod.Get), token);
|
|
||||||
return await HandleResponse<AppDataBase[]>(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual async Task<PointOfSaleAppData> GetPosApp(string appId, CancellationToken token = default)
|
|
||||||
{
|
|
||||||
if (appId == null)
|
|
||||||
throw new ArgumentNullException(nameof(appId));
|
|
||||||
var response = await _httpClient.SendAsync(
|
|
||||||
CreateHttpRequest($"api/v1/apps/pos/{appId}",
|
|
||||||
method: HttpMethod.Get), token);
|
|
||||||
return await HandleResponse<PointOfSaleAppData>(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual async Task<CrowdfundAppData> GetCrowdfundApp(string appId, CancellationToken token = default)
|
|
||||||
{
|
|
||||||
if (appId == null)
|
|
||||||
throw new ArgumentNullException(nameof(appId));
|
|
||||||
var response = await _httpClient.SendAsync(
|
|
||||||
CreateHttpRequest($"api/v1/apps/crowdfund/{appId}",
|
|
||||||
method: HttpMethod.Get), token);
|
|
||||||
return await HandleResponse<CrowdfundAppData>(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual async Task DeleteApp(string appId, CancellationToken token = default)
|
|
||||||
{
|
|
||||||
if (appId == null)
|
|
||||||
throw new ArgumentNullException(nameof(appId));
|
|
||||||
var response = await _httpClient.SendAsync(
|
|
||||||
CreateHttpRequest($"api/v1/apps/{appId}",
|
|
||||||
method: HttpMethod.Delete), token);
|
|
||||||
await HandleResponse(response);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace BTCPayServer.Client
|
namespace BTCPayServer.Client
|
||||||
{
|
{
|
||||||
|
@ -1,102 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using System.Net.Http;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using BTCPayServer.Client.Models;
|
|
||||||
|
|
||||||
namespace BTCPayServer.Client
|
|
||||||
{
|
|
||||||
public partial class BTCPayServerClient
|
|
||||||
{
|
|
||||||
public virtual async Task<IEnumerable<CustodianAccountData>> GetCustodianAccounts(string storeId, bool includeAssetBalances = false, CancellationToken token = default)
|
|
||||||
{
|
|
||||||
var queryPayload = new Dictionary<string, object>();
|
|
||||||
if (includeAssetBalances)
|
|
||||||
{
|
|
||||||
queryPayload.Add("assetBalances", "true");
|
|
||||||
}
|
|
||||||
|
|
||||||
var response = await _httpClient.SendAsync(CreateHttpRequest($"api/v1/stores/{storeId}/custodian-accounts", queryPayload), token);
|
|
||||||
return await HandleResponse<IEnumerable<CustodianAccountData>>(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual async Task<CustodianAccountResponse> GetCustodianAccount(string storeId, string accountId, bool includeAssetBalances = false, CancellationToken token = default)
|
|
||||||
{
|
|
||||||
var queryPayload = new Dictionary<string, object>();
|
|
||||||
if (includeAssetBalances)
|
|
||||||
{
|
|
||||||
queryPayload.Add("assetBalances", "true");
|
|
||||||
}
|
|
||||||
|
|
||||||
var response = await _httpClient.SendAsync(CreateHttpRequest($"api/v1/stores/{storeId}/custodian-accounts/{accountId}", queryPayload), token);
|
|
||||||
return await HandleResponse<CustodianAccountResponse>(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual async Task<CustodianAccountData> CreateCustodianAccount(string storeId, CreateCustodianAccountRequest request, CancellationToken token = default)
|
|
||||||
{
|
|
||||||
var response = await _httpClient.SendAsync(CreateHttpRequest($"api/v1/stores/{storeId}/custodian-accounts", bodyPayload: request, method: HttpMethod.Post), token);
|
|
||||||
return await HandleResponse<CustodianAccountData>(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual async Task<CustodianAccountData> UpdateCustodianAccount(string storeId, string accountId, CreateCustodianAccountRequest request, CancellationToken token = default)
|
|
||||||
{
|
|
||||||
var response = await _httpClient.SendAsync(CreateHttpRequest($"api/v1/stores/{storeId}/custodian-accounts/{accountId}", bodyPayload: request, method: HttpMethod.Put), token);
|
|
||||||
return await HandleResponse<CustodianAccountData>(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual async Task DeleteCustodianAccount(string storeId, string accountId, CancellationToken token = default)
|
|
||||||
{
|
|
||||||
var response = await _httpClient.SendAsync(CreateHttpRequest($"api/v1/stores/{storeId}/custodian-accounts/{accountId}", method: HttpMethod.Delete), token);
|
|
||||||
await HandleResponse(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual async Task<DepositAddressData> GetCustodianAccountDepositAddress(string storeId, string accountId, string paymentMethod, CancellationToken token = default)
|
|
||||||
{
|
|
||||||
var response = await _httpClient.SendAsync(CreateHttpRequest($"api/v1/stores/{storeId}/custodian-accounts/{accountId}/addresses/{paymentMethod}"), token);
|
|
||||||
return await HandleResponse<DepositAddressData>(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual async Task<MarketTradeResponseData> MarketTradeCustodianAccountAsset(string storeId, string accountId, TradeRequestData request, CancellationToken token = default)
|
|
||||||
{
|
|
||||||
//var response = await _httpClient.SendAsync(CreateHttpRequest("api/v1/users", null, request, HttpMethod.Post), token);
|
|
||||||
//return await HandleResponse<ApplicationUserData>(response);
|
|
||||||
var internalRequest = CreateHttpRequest($"api/v1/stores/{storeId}/custodian-accounts/{accountId}/trades/market", null,
|
|
||||||
request, HttpMethod.Post);
|
|
||||||
var response = await _httpClient.SendAsync(internalRequest, token);
|
|
||||||
return await HandleResponse<MarketTradeResponseData>(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual async Task<MarketTradeResponseData> GetCustodianAccountTradeInfo(string storeId, string accountId, string tradeId, CancellationToken token = default)
|
|
||||||
{
|
|
||||||
var response = await _httpClient.SendAsync(CreateHttpRequest($"api/v1/stores/{storeId}/custodian-accounts/{accountId}/trades/{tradeId}", method: HttpMethod.Get), token);
|
|
||||||
return await HandleResponse<MarketTradeResponseData>(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual async Task<TradeQuoteResponseData> GetCustodianAccountTradeQuote(string storeId, string accountId, string fromAsset, string toAsset, CancellationToken token = default)
|
|
||||||
{
|
|
||||||
var queryPayload = new Dictionary<string, object>();
|
|
||||||
queryPayload.Add("fromAsset", fromAsset);
|
|
||||||
queryPayload.Add("toAsset", toAsset);
|
|
||||||
var response = await _httpClient.SendAsync(CreateHttpRequest($"api/v1/stores/{storeId}/custodian-accounts/{accountId}/trades/quote", queryPayload), token);
|
|
||||||
return await HandleResponse<TradeQuoteResponseData>(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual async Task<WithdrawalResponseData> CreateCustodianAccountWithdrawal(string storeId, string accountId, WithdrawRequestData request, CancellationToken token = default)
|
|
||||||
{
|
|
||||||
var response = await _httpClient.SendAsync(CreateHttpRequest($"api/v1/stores/{storeId}/custodian-accounts/{accountId}/withdrawals", bodyPayload: request, method: HttpMethod.Post), token);
|
|
||||||
return await HandleResponse<WithdrawalResponseData>(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual async Task<WithdrawalSimulationResponseData> SimulateCustodianAccountWithdrawal(string storeId, string accountId, WithdrawRequestData request, CancellationToken token = default)
|
|
||||||
{
|
|
||||||
var response = await _httpClient.SendAsync(CreateHttpRequest($"api/v1/stores/{storeId}/custodian-accounts/{accountId}/withdrawals/simulation", bodyPayload: request, method: HttpMethod.Post), token);
|
|
||||||
return await HandleResponse<WithdrawalSimulationResponseData>(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual async Task<WithdrawalResponseData> GetCustodianAccountWithdrawalInfo(string storeId, string accountId, string paymentMethod, string withdrawalId, CancellationToken token = default)
|
|
||||||
{
|
|
||||||
var response = await _httpClient.SendAsync(CreateHttpRequest($"api/v1/stores/{storeId}/custodian-accounts/{accountId}/withdrawals/{paymentMethod}/{withdrawalId}", method: HttpMethod.Get), token);
|
|
||||||
return await HandleResponse<WithdrawalResponseData>(response);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using BTCPayServer.Client.Models;
|
|
||||||
|
|
||||||
namespace BTCPayServer.Client
|
|
||||||
{
|
|
||||||
public partial class BTCPayServerClient
|
|
||||||
{
|
|
||||||
public virtual async Task<IEnumerable<CustodianData>> GetCustodians(CancellationToken token = default)
|
|
||||||
{
|
|
||||||
var response = await _httpClient.SendAsync(CreateHttpRequest("api/v1/custodians"), token);
|
|
||||||
return await HandleResponse<IEnumerable<CustodianData>>(response);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,56 +1,21 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using BTCPayServer.Client.Models;
|
using BTCPayServer.Client.Models;
|
||||||
using NBitcoin;
|
|
||||||
|
|
||||||
namespace BTCPayServer.Client
|
namespace BTCPayServer.Client
|
||||||
{
|
{
|
||||||
public partial class BTCPayServerClient
|
public partial class BTCPayServerClient
|
||||||
{
|
{
|
||||||
public virtual async Task<IEnumerable<InvoiceData>> GetInvoices(string storeId, string[] orderId = null,
|
public virtual async Task<IEnumerable<InvoiceData>> GetInvoices(string storeId, bool includeArchived = false,
|
||||||
InvoiceStatus[] status = null,
|
|
||||||
DateTimeOffset? startDate = null,
|
|
||||||
DateTimeOffset? endDate = null,
|
|
||||||
string textSearch = null,
|
|
||||||
bool includeArchived = false,
|
|
||||||
int? skip = null,
|
|
||||||
int? take = null,
|
|
||||||
CancellationToken token = default)
|
CancellationToken token = default)
|
||||||
{
|
{
|
||||||
Dictionary<string, object> queryPayload = new Dictionary<string, object>();
|
|
||||||
queryPayload.Add(nameof(includeArchived), includeArchived);
|
|
||||||
|
|
||||||
if (startDate is DateTimeOffset s)
|
|
||||||
queryPayload.Add(nameof(startDate), Utils.DateTimeToUnixTime(s));
|
|
||||||
|
|
||||||
if (endDate is DateTimeOffset e)
|
|
||||||
queryPayload.Add(nameof(endDate), Utils.DateTimeToUnixTime(e));
|
|
||||||
|
|
||||||
if (orderId != null)
|
|
||||||
queryPayload.Add(nameof(orderId), orderId);
|
|
||||||
if (textSearch != null)
|
|
||||||
queryPayload.Add(nameof(textSearch), textSearch);
|
|
||||||
if (status != null)
|
|
||||||
queryPayload.Add(nameof(status), status.Select(s => s.ToString().ToLower()).ToArray());
|
|
||||||
|
|
||||||
if (skip != null)
|
|
||||||
{
|
|
||||||
queryPayload.Add(nameof(skip), skip);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (take != null)
|
|
||||||
{
|
|
||||||
queryPayload.Add(nameof(take), take);
|
|
||||||
}
|
|
||||||
|
|
||||||
var response =
|
var response =
|
||||||
await _httpClient.SendAsync(
|
await _httpClient.SendAsync(
|
||||||
CreateHttpRequest($"api/v1/stores/{storeId}/invoices",
|
CreateHttpRequest($"api/v1/stores/{storeId}/invoices",
|
||||||
queryPayload), token);
|
new Dictionary<string, object>() {{nameof(includeArchived), includeArchived}}), token);
|
||||||
return await HandleResponse<IEnumerable<InvoiceData>>(response);
|
return await HandleResponse<IEnumerable<InvoiceData>>(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,13 +26,6 @@ namespace BTCPayServer.Client
|
|||||||
CreateHttpRequest($"api/v1/stores/{storeId}/invoices/{invoiceId}"), token);
|
CreateHttpRequest($"api/v1/stores/{storeId}/invoices/{invoiceId}"), token);
|
||||||
return await HandleResponse<InvoiceData>(response);
|
return await HandleResponse<InvoiceData>(response);
|
||||||
}
|
}
|
||||||
public virtual async Task<InvoicePaymentMethodDataModel[]> GetInvoicePaymentMethods(string storeId, string invoiceId,
|
|
||||||
CancellationToken token = default)
|
|
||||||
{
|
|
||||||
var response = await _httpClient.SendAsync(
|
|
||||||
CreateHttpRequest($"api/v1/stores/{storeId}/invoices/{invoiceId}/payment-methods"), token);
|
|
||||||
return await HandleResponse<InvoicePaymentMethodDataModel[]>(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual async Task ArchiveInvoice(string storeId, string invoiceId,
|
public virtual async Task ArchiveInvoice(string storeId, string invoiceId,
|
||||||
CancellationToken token = default)
|
CancellationToken token = default)
|
||||||
@ -89,23 +47,12 @@ namespace BTCPayServer.Client
|
|||||||
return await HandleResponse<InvoiceData>(response);
|
return await HandleResponse<InvoiceData>(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual async Task<InvoiceData> UpdateInvoice(string storeId, string invoiceId,
|
|
||||||
UpdateInvoiceRequest request, CancellationToken token = default)
|
|
||||||
{
|
|
||||||
if (request == null)
|
|
||||||
throw new ArgumentNullException(nameof(request));
|
|
||||||
var response = await _httpClient.SendAsync(
|
|
||||||
CreateHttpRequest($"api/v1/stores/{storeId}/invoices/{invoiceId}", bodyPayload: request,
|
|
||||||
method: HttpMethod.Put), token);
|
|
||||||
return await HandleResponse<InvoiceData>(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual async Task<InvoiceData> MarkInvoiceStatus(string storeId, string invoiceId,
|
public virtual async Task<InvoiceData> MarkInvoiceStatus(string storeId, string invoiceId,
|
||||||
MarkInvoiceStatusRequest request, CancellationToken token = default)
|
MarkInvoiceStatusRequest request, CancellationToken token = default)
|
||||||
{
|
{
|
||||||
if (request == null)
|
if (request == null)
|
||||||
throw new ArgumentNullException(nameof(request));
|
throw new ArgumentNullException(nameof(request));
|
||||||
if (request.Status != InvoiceStatus.Settled && request.Status != InvoiceStatus.Invalid)
|
if (request.Status!= InvoiceStatus.Complete && request.Status!= InvoiceStatus.Invalid)
|
||||||
throw new ArgumentOutOfRangeException(nameof(request.Status), "Status can only be Invalid or Complete");
|
throw new ArgumentOutOfRangeException(nameof(request.Status), "Status can only be Invalid or Complete");
|
||||||
var response = await _httpClient.SendAsync(
|
var response = await _httpClient.SendAsync(
|
||||||
CreateHttpRequest($"api/v1/stores/{storeId}/invoices/{invoiceId}/status", bodyPayload: request,
|
CreateHttpRequest($"api/v1/stores/{storeId}/invoices/{invoiceId}/status", bodyPayload: request,
|
||||||
@ -116,30 +63,9 @@ namespace BTCPayServer.Client
|
|||||||
public virtual async Task<InvoiceData> UnarchiveInvoice(string storeId, string invoiceId, CancellationToken token = default)
|
public virtual async Task<InvoiceData> UnarchiveInvoice(string storeId, string invoiceId, CancellationToken token = default)
|
||||||
{
|
{
|
||||||
var response = await _httpClient.SendAsync(
|
var response = await _httpClient.SendAsync(
|
||||||
CreateHttpRequest($"api/v1/stores/{storeId}/invoices/{invoiceId}/unarchive",
|
CreateHttpRequest($"api/v1/stores/{storeId}/invoices/{invoiceId}/unarchive",
|
||||||
method: HttpMethod.Post), token);
|
method: HttpMethod.Post), token);
|
||||||
return await HandleResponse<InvoiceData>(response);
|
return await HandleResponse<InvoiceData>(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual async Task ActivateInvoicePaymentMethod(string storeId, string invoiceId, string paymentMethod, CancellationToken token = default)
|
|
||||||
{
|
|
||||||
var response = await _httpClient.SendAsync(
|
|
||||||
CreateHttpRequest($"api/v1/stores/{storeId}/invoices/{invoiceId}/payment-methods/{paymentMethod}/activate",
|
|
||||||
method: HttpMethod.Post), token);
|
|
||||||
await HandleResponse(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual async Task<PullPaymentData> RefundInvoice(
|
|
||||||
string storeId,
|
|
||||||
string invoiceId,
|
|
||||||
RefundInvoiceRequest request,
|
|
||||||
CancellationToken token = default
|
|
||||||
)
|
|
||||||
{
|
|
||||||
var response = await _httpClient.SendAsync(
|
|
||||||
CreateHttpRequest($"api/v1/stores/{storeId}/invoices/{invoiceId}/refund", bodyPayload: request,
|
|
||||||
method: HttpMethod.Post), token);
|
|
||||||
return await HandleResponse<PullPaymentData>(response);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,59 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using System.Net.Http;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using BTCPayServer.Client.Models;
|
|
||||||
|
|
||||||
namespace BTCPayServer.Client
|
|
||||||
{
|
|
||||||
public partial class BTCPayServerClient
|
|
||||||
{
|
|
||||||
public virtual async Task<IEnumerable<LNURLPayPaymentMethodData>>
|
|
||||||
GetStoreLNURLPayPaymentMethods(string storeId, bool? enabled = null,
|
|
||||||
CancellationToken token = default)
|
|
||||||
{
|
|
||||||
var query = new Dictionary<string, object>();
|
|
||||||
if (enabled != null)
|
|
||||||
{
|
|
||||||
query.Add(nameof(enabled), enabled);
|
|
||||||
}
|
|
||||||
|
|
||||||
var response =
|
|
||||||
await _httpClient.SendAsync(
|
|
||||||
CreateHttpRequest($"api/v1/stores/{storeId}/payment-methods/LNURLPay",
|
|
||||||
query), token);
|
|
||||||
return await HandleResponse<IEnumerable<LNURLPayPaymentMethodData>>(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual async Task<LNURLPayPaymentMethodData> GetStoreLNURLPayPaymentMethod(
|
|
||||||
string storeId,
|
|
||||||
string cryptoCode, CancellationToken token = default)
|
|
||||||
{
|
|
||||||
var response =
|
|
||||||
await _httpClient.SendAsync(
|
|
||||||
CreateHttpRequest($"api/v1/stores/{storeId}/payment-methods/LNURLPay/{cryptoCode}"), token);
|
|
||||||
return await HandleResponse<LNURLPayPaymentMethodData>(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual async Task RemoveStoreLNURLPayPaymentMethod(string storeId,
|
|
||||||
string cryptoCode, CancellationToken token = default)
|
|
||||||
{
|
|
||||||
var response =
|
|
||||||
await _httpClient.SendAsync(
|
|
||||||
CreateHttpRequest($"api/v1/stores/{storeId}/payment-methods/LNURLPay/{cryptoCode}",
|
|
||||||
method: HttpMethod.Delete), token);
|
|
||||||
await HandleResponse(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual async Task<LNURLPayPaymentMethodData> UpdateStoreLNURLPayPaymentMethod(
|
|
||||||
string storeId,
|
|
||||||
string cryptoCode, LNURLPayPaymentMethodData paymentMethod,
|
|
||||||
CancellationToken token = default)
|
|
||||||
{
|
|
||||||
var response = await _httpClient.SendAsync(
|
|
||||||
CreateHttpRequest($"api/v1/stores/{storeId}/payment-methods/LNURLPay/{cryptoCode}",
|
|
||||||
bodyPayload: paymentMethod, method: HttpMethod.Put), token);
|
|
||||||
return await HandleResponse<LNURLPayPaymentMethodData>(response);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -9,7 +9,7 @@ namespace BTCPayServer.Client
|
|||||||
{
|
{
|
||||||
public partial class BTCPayServerClient
|
public partial class BTCPayServerClient
|
||||||
{
|
{
|
||||||
public virtual async Task<LightningNodeInformationData> GetLightningNodeInfo(string cryptoCode,
|
public async Task<LightningNodeInformationData> GetLightningNodeInfo(string cryptoCode,
|
||||||
CancellationToken token = default)
|
CancellationToken token = default)
|
||||||
{
|
{
|
||||||
var response = await _httpClient.SendAsync(
|
var response = await _httpClient.SendAsync(
|
||||||
@ -18,16 +18,7 @@ namespace BTCPayServer.Client
|
|||||||
return await HandleResponse<LightningNodeInformationData>(response);
|
return await HandleResponse<LightningNodeInformationData>(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual async Task<LightningNodeBalanceData> GetLightningNodeBalance(string cryptoCode,
|
public async Task ConnectToLightningNode(string cryptoCode, ConnectToNodeRequest request,
|
||||||
CancellationToken token = default)
|
|
||||||
{
|
|
||||||
var response = await _httpClient.SendAsync(
|
|
||||||
CreateHttpRequest($"api/v1/server/lightning/{cryptoCode}/balance",
|
|
||||||
method: HttpMethod.Get), token);
|
|
||||||
return await HandleResponse<LightningNodeBalanceData>(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual async Task ConnectToLightningNode(string cryptoCode, ConnectToNodeRequest request,
|
|
||||||
CancellationToken token = default)
|
CancellationToken token = default)
|
||||||
{
|
{
|
||||||
if (request == null)
|
if (request == null)
|
||||||
@ -38,7 +29,7 @@ namespace BTCPayServer.Client
|
|||||||
await HandleResponse(response);
|
await HandleResponse(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual async Task<IEnumerable<LightningChannelData>> GetLightningNodeChannels(string cryptoCode,
|
public async Task<IEnumerable<LightningChannelData>> GetLightningNodeChannels(string cryptoCode,
|
||||||
CancellationToken token = default)
|
CancellationToken token = default)
|
||||||
{
|
{
|
||||||
var response = await _httpClient.SendAsync(
|
var response = await _httpClient.SendAsync(
|
||||||
@ -47,23 +38,24 @@ namespace BTCPayServer.Client
|
|||||||
return await HandleResponse<IEnumerable<LightningChannelData>>(response);
|
return await HandleResponse<IEnumerable<LightningChannelData>>(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual async Task OpenLightningChannel(string cryptoCode, OpenLightningChannelRequest request,
|
public async Task<string> OpenLightningChannel(string cryptoCode, OpenLightningChannelRequest request,
|
||||||
CancellationToken token = default)
|
CancellationToken token = default)
|
||||||
{
|
{
|
||||||
var response = await _httpClient.SendAsync(
|
var response = await _httpClient.SendAsync(
|
||||||
CreateHttpRequest($"api/v1/server/lightning/{cryptoCode}/channels", bodyPayload: request,
|
CreateHttpRequest($"api/v1/server/lightning/{cryptoCode}/channels", bodyPayload: request,
|
||||||
method: HttpMethod.Post), token);
|
method: HttpMethod.Post), token);
|
||||||
await HandleResponse(response);
|
return await HandleResponse<string>(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual async Task<string> GetLightningDepositAddress(string cryptoCode, CancellationToken token = default)
|
public async Task<string> GetLightningDepositAddress(string cryptoCode, CancellationToken token = default)
|
||||||
{
|
{
|
||||||
var response = await _httpClient.SendAsync(
|
var response = await _httpClient.SendAsync(
|
||||||
CreateHttpRequest($"api/v1/server/lightning/{cryptoCode}/address", method: HttpMethod.Post), token);
|
CreateHttpRequest($"api/v1/server/lightning/{cryptoCode}/address", method: HttpMethod.Post), token);
|
||||||
return await HandleResponse<string>(response);
|
return await HandleResponse<string>(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual async Task<LightningPaymentData> PayLightningInvoice(string cryptoCode, PayLightningInvoiceRequest request,
|
|
||||||
|
public async Task PayLightningInvoice(string cryptoCode, PayLightningInvoiceRequest request,
|
||||||
CancellationToken token = default)
|
CancellationToken token = default)
|
||||||
{
|
{
|
||||||
if (request == null)
|
if (request == null)
|
||||||
@ -71,21 +63,10 @@ namespace BTCPayServer.Client
|
|||||||
var response = await _httpClient.SendAsync(
|
var response = await _httpClient.SendAsync(
|
||||||
CreateHttpRequest($"api/v1/server/lightning/{cryptoCode}/invoices/pay", bodyPayload: request,
|
CreateHttpRequest($"api/v1/server/lightning/{cryptoCode}/invoices/pay", bodyPayload: request,
|
||||||
method: HttpMethod.Post), token);
|
method: HttpMethod.Post), token);
|
||||||
return await HandleResponse<LightningPaymentData>(response);
|
await HandleResponse(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual async Task<LightningPaymentData> GetLightningPayment(string cryptoCode,
|
public async Task<LightningInvoiceData> GetLightningInvoice(string cryptoCode,
|
||||||
string paymentHash, CancellationToken token = default)
|
|
||||||
{
|
|
||||||
if (paymentHash == null)
|
|
||||||
throw new ArgumentNullException(nameof(paymentHash));
|
|
||||||
var response = await _httpClient.SendAsync(
|
|
||||||
CreateHttpRequest($"api/v1/server/lightning/{cryptoCode}/payments/{paymentHash}",
|
|
||||||
method: HttpMethod.Get), token);
|
|
||||||
return await HandleResponse<LightningPaymentData>(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual async Task<LightningInvoiceData> GetLightningInvoice(string cryptoCode,
|
|
||||||
string invoiceId, CancellationToken token = default)
|
string invoiceId, CancellationToken token = default)
|
||||||
{
|
{
|
||||||
if (invoiceId == null)
|
if (invoiceId == null)
|
||||||
@ -96,43 +77,7 @@ namespace BTCPayServer.Client
|
|||||||
return await HandleResponse<LightningInvoiceData>(response);
|
return await HandleResponse<LightningInvoiceData>(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual async Task<LightningInvoiceData[]> GetLightningInvoices(string cryptoCode,
|
public async Task<LightningInvoiceData> CreateLightningInvoice(string cryptoCode, CreateLightningInvoiceRequest request,
|
||||||
bool? pendingOnly = null, long? offsetIndex = null, CancellationToken token = default)
|
|
||||||
{
|
|
||||||
var queryPayload = new Dictionary<string, object>();
|
|
||||||
if (pendingOnly is bool v)
|
|
||||||
{
|
|
||||||
queryPayload.Add("pendingOnly", v.ToString());
|
|
||||||
}
|
|
||||||
if (offsetIndex is > 0)
|
|
||||||
{
|
|
||||||
queryPayload.Add("offsetIndex", offsetIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
var response = await _httpClient.SendAsync(
|
|
||||||
CreateHttpRequest($"api/v1/server/lightning/{cryptoCode}/invoices", queryPayload), token);
|
|
||||||
return await HandleResponse<LightningInvoiceData[]>(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual async Task<LightningPaymentData[]> GetLightningPayments(string cryptoCode,
|
|
||||||
bool? includePending = null, long? offsetIndex = null, CancellationToken token = default)
|
|
||||||
{
|
|
||||||
var queryPayload = new Dictionary<string, object>();
|
|
||||||
if (includePending is bool v)
|
|
||||||
{
|
|
||||||
queryPayload.Add("includePending", v.ToString());
|
|
||||||
}
|
|
||||||
if (offsetIndex is > 0)
|
|
||||||
{
|
|
||||||
queryPayload.Add("offsetIndex", offsetIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
var response = await _httpClient.SendAsync(
|
|
||||||
CreateHttpRequest($"api/v1/server/lightning/{cryptoCode}/payments", queryPayload), token);
|
|
||||||
return await HandleResponse<LightningPaymentData[]>(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual async Task<LightningInvoiceData> CreateLightningInvoice(string cryptoCode, CreateLightningInvoiceRequest request,
|
|
||||||
CancellationToken token = default)
|
CancellationToken token = default)
|
||||||
{
|
{
|
||||||
if (request == null)
|
if (request == null)
|
||||||
|
@ -9,7 +9,7 @@ namespace BTCPayServer.Client
|
|||||||
{
|
{
|
||||||
public partial class BTCPayServerClient
|
public partial class BTCPayServerClient
|
||||||
{
|
{
|
||||||
public virtual async Task<LightningNodeInformationData> GetLightningNodeInfo(string storeId, string cryptoCode,
|
public async Task<LightningNodeInformationData> GetLightningNodeInfo(string storeId, string cryptoCode,
|
||||||
CancellationToken token = default)
|
CancellationToken token = default)
|
||||||
{
|
{
|
||||||
var response = await _httpClient.SendAsync(
|
var response = await _httpClient.SendAsync(
|
||||||
@ -18,16 +18,7 @@ namespace BTCPayServer.Client
|
|||||||
return await HandleResponse<LightningNodeInformationData>(response);
|
return await HandleResponse<LightningNodeInformationData>(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual async Task<LightningNodeBalanceData> GetLightningNodeBalance(string storeId, string cryptoCode,
|
public async Task ConnectToLightningNode(string storeId, string cryptoCode, ConnectToNodeRequest request,
|
||||||
CancellationToken token = default)
|
|
||||||
{
|
|
||||||
var response = await _httpClient.SendAsync(
|
|
||||||
CreateHttpRequest($"api/v1/stores/{storeId}/lightning/{cryptoCode}/balance",
|
|
||||||
method: HttpMethod.Get), token);
|
|
||||||
return await HandleResponse<LightningNodeBalanceData>(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual async Task ConnectToLightningNode(string storeId, string cryptoCode, ConnectToNodeRequest request,
|
|
||||||
CancellationToken token = default)
|
CancellationToken token = default)
|
||||||
{
|
{
|
||||||
if (request == null)
|
if (request == null)
|
||||||
@ -38,7 +29,7 @@ namespace BTCPayServer.Client
|
|||||||
await HandleResponse(response);
|
await HandleResponse(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual async Task<IEnumerable<LightningChannelData>> GetLightningNodeChannels(string storeId, string cryptoCode,
|
public async Task<IEnumerable<LightningChannelData>> GetLightningNodeChannels(string storeId, string cryptoCode,
|
||||||
CancellationToken token = default)
|
CancellationToken token = default)
|
||||||
{
|
{
|
||||||
var response = await _httpClient.SendAsync(
|
var response = await _httpClient.SendAsync(
|
||||||
@ -47,16 +38,16 @@ namespace BTCPayServer.Client
|
|||||||
return await HandleResponse<IEnumerable<LightningChannelData>>(response);
|
return await HandleResponse<IEnumerable<LightningChannelData>>(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual async Task OpenLightningChannel(string storeId, string cryptoCode, OpenLightningChannelRequest request,
|
public async Task<string> OpenLightningChannel(string storeId, string cryptoCode, OpenLightningChannelRequest request,
|
||||||
CancellationToken token = default)
|
CancellationToken token = default)
|
||||||
{
|
{
|
||||||
var response = await _httpClient.SendAsync(
|
var response = await _httpClient.SendAsync(
|
||||||
CreateHttpRequest($"api/v1/stores/{storeId}/lightning/{cryptoCode}/channels", bodyPayload: request,
|
CreateHttpRequest($"api/v1/stores/{storeId}/lightning/{cryptoCode}/channels", bodyPayload: request,
|
||||||
method: HttpMethod.Post), token);
|
method: HttpMethod.Post), token);
|
||||||
await HandleResponse(response);
|
return await HandleResponse<string>(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual async Task<string> GetLightningDepositAddress(string storeId, string cryptoCode,
|
public async Task<string> GetLightningDepositAddress(string storeId, string cryptoCode,
|
||||||
CancellationToken token = default)
|
CancellationToken token = default)
|
||||||
{
|
{
|
||||||
var response = await _httpClient.SendAsync(
|
var response = await _httpClient.SendAsync(
|
||||||
@ -65,7 +56,7 @@ namespace BTCPayServer.Client
|
|||||||
return await HandleResponse<string>(response);
|
return await HandleResponse<string>(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual async Task<LightningPaymentData> PayLightningInvoice(string storeId, string cryptoCode, PayLightningInvoiceRequest request,
|
public async Task PayLightningInvoice(string storeId, string cryptoCode, PayLightningInvoiceRequest request,
|
||||||
CancellationToken token = default)
|
CancellationToken token = default)
|
||||||
{
|
{
|
||||||
if (request == null)
|
if (request == null)
|
||||||
@ -73,21 +64,10 @@ namespace BTCPayServer.Client
|
|||||||
var response = await _httpClient.SendAsync(
|
var response = await _httpClient.SendAsync(
|
||||||
CreateHttpRequest($"api/v1/stores/{storeId}/lightning/{cryptoCode}/invoices/pay", bodyPayload: request,
|
CreateHttpRequest($"api/v1/stores/{storeId}/lightning/{cryptoCode}/invoices/pay", bodyPayload: request,
|
||||||
method: HttpMethod.Post), token);
|
method: HttpMethod.Post), token);
|
||||||
return await HandleResponse<LightningPaymentData>(response);
|
await HandleResponse(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual async Task<LightningPaymentData> GetLightningPayment(string storeId, string cryptoCode,
|
public async Task<LightningInvoiceData> GetLightningInvoice(string storeId, string cryptoCode,
|
||||||
string paymentHash, CancellationToken token = default)
|
|
||||||
{
|
|
||||||
if (paymentHash == null)
|
|
||||||
throw new ArgumentNullException(nameof(paymentHash));
|
|
||||||
var response = await _httpClient.SendAsync(
|
|
||||||
CreateHttpRequest($"api/v1/stores/{storeId}/lightning/{cryptoCode}/payments/{paymentHash}",
|
|
||||||
method: HttpMethod.Get), token);
|
|
||||||
return await HandleResponse<LightningPaymentData>(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual async Task<LightningInvoiceData> GetLightningInvoice(string storeId, string cryptoCode,
|
|
||||||
string invoiceId, CancellationToken token = default)
|
string invoiceId, CancellationToken token = default)
|
||||||
{
|
{
|
||||||
if (invoiceId == null)
|
if (invoiceId == null)
|
||||||
@ -98,43 +78,7 @@ namespace BTCPayServer.Client
|
|||||||
return await HandleResponse<LightningInvoiceData>(response);
|
return await HandleResponse<LightningInvoiceData>(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual async Task<LightningInvoiceData[]> GetLightningInvoices(string storeId, string cryptoCode,
|
public async Task<LightningInvoiceData> CreateLightningInvoice(string storeId, string cryptoCode,
|
||||||
bool? pendingOnly = null, long? offsetIndex = null, CancellationToken token = default)
|
|
||||||
{
|
|
||||||
var queryPayload = new Dictionary<string, object>();
|
|
||||||
if (pendingOnly is bool v)
|
|
||||||
{
|
|
||||||
queryPayload.Add("pendingOnly", v.ToString());
|
|
||||||
}
|
|
||||||
if (offsetIndex is > 0)
|
|
||||||
{
|
|
||||||
queryPayload.Add("offsetIndex", offsetIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
var response = await _httpClient.SendAsync(
|
|
||||||
CreateHttpRequest($"api/v1/stores/{storeId}/lightning/{cryptoCode}/invoices", queryPayload), token);
|
|
||||||
return await HandleResponse<LightningInvoiceData[]>(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual async Task<LightningPaymentData[]> GetLightningPayments(string storeId, string cryptoCode,
|
|
||||||
bool? includePending = null, long? offsetIndex = null, CancellationToken token = default)
|
|
||||||
{
|
|
||||||
var queryPayload = new Dictionary<string, object>();
|
|
||||||
if (includePending is bool v)
|
|
||||||
{
|
|
||||||
queryPayload.Add("includePending", v.ToString());
|
|
||||||
}
|
|
||||||
if (offsetIndex is > 0)
|
|
||||||
{
|
|
||||||
queryPayload.Add("offsetIndex", offsetIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
var response = await _httpClient.SendAsync(
|
|
||||||
CreateHttpRequest($"api/v1/stores/{storeId}/lightning/{cryptoCode}/payments", queryPayload), token);
|
|
||||||
return await HandleResponse<LightningPaymentData[]>(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual async Task<LightningInvoiceData> CreateLightningInvoice(string storeId, string cryptoCode,
|
|
||||||
CreateLightningInvoiceRequest request, CancellationToken token = default)
|
CreateLightningInvoiceRequest request, CancellationToken token = default)
|
||||||
{
|
{
|
||||||
if (request == null)
|
if (request == null)
|
||||||
|
@ -1,48 +0,0 @@
|
|||||||
using System.Net.Http;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using BTCPayServer.Client.Models;
|
|
||||||
|
|
||||||
namespace BTCPayServer.Client
|
|
||||||
{
|
|
||||||
public partial class BTCPayServerClient
|
|
||||||
{
|
|
||||||
public virtual async Task<LightningAddressData[]> GetStoreLightningAddresses(string storeId,
|
|
||||||
CancellationToken token = default)
|
|
||||||
{
|
|
||||||
var response = await _httpClient.SendAsync(
|
|
||||||
CreateHttpRequest($"api/v1/stores/{storeId}/lightning-addresses",
|
|
||||||
method: HttpMethod.Get), token);
|
|
||||||
return await HandleResponse<LightningAddressData[]>(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual async Task<LightningAddressData> GetStoreLightningAddress(string storeId, string username,
|
|
||||||
CancellationToken token = default)
|
|
||||||
{
|
|
||||||
var response = await _httpClient.SendAsync(
|
|
||||||
CreateHttpRequest($"api/v1/stores/{storeId}/lightning-addresses/{username}",
|
|
||||||
method: HttpMethod.Get), token);
|
|
||||||
return await HandleResponse<LightningAddressData>(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual async Task RemoveStoreLightningAddress(string storeId, string username,
|
|
||||||
CancellationToken token = default)
|
|
||||||
{
|
|
||||||
var response = await _httpClient.SendAsync(
|
|
||||||
CreateHttpRequest($"api/v1/stores/{storeId}/lightning-addresses/{username}",
|
|
||||||
method: HttpMethod.Delete), token);
|
|
||||||
await HandleResponse(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual async Task<LightningAddressData> AddOrUpdateStoreLightningAddress(string storeId,
|
|
||||||
string username, LightningAddressData data,
|
|
||||||
CancellationToken token = default)
|
|
||||||
{
|
|
||||||
var response = await _httpClient.SendAsync(
|
|
||||||
CreateHttpRequest($"api/v1/stores/{storeId}/lightning-addresses/{username}",
|
|
||||||
method: HttpMethod.Post, bodyPayload: data), token);
|
|
||||||
|
|
||||||
return await HandleResponse<LightningAddressData>(response);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,59 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using System.Net.Http;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using BTCPayServer.Client.Models;
|
|
||||||
|
|
||||||
namespace BTCPayServer.Client
|
|
||||||
{
|
|
||||||
public partial class BTCPayServerClient
|
|
||||||
{
|
|
||||||
public virtual async Task<IEnumerable<LightningNetworkPaymentMethodData>>
|
|
||||||
GetStoreLightningNetworkPaymentMethods(string storeId, bool? enabled = null,
|
|
||||||
CancellationToken token = default)
|
|
||||||
{
|
|
||||||
var query = new Dictionary<string, object>();
|
|
||||||
if (enabled != null)
|
|
||||||
{
|
|
||||||
query.Add(nameof(enabled), enabled);
|
|
||||||
}
|
|
||||||
|
|
||||||
var response =
|
|
||||||
await _httpClient.SendAsync(
|
|
||||||
CreateHttpRequest($"api/v1/stores/{storeId}/payment-methods/LightningNetwork",
|
|
||||||
query), token);
|
|
||||||
return await HandleResponse<IEnumerable<LightningNetworkPaymentMethodData>>(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual async Task<LightningNetworkPaymentMethodData> GetStoreLightningNetworkPaymentMethod(
|
|
||||||
string storeId,
|
|
||||||
string cryptoCode, CancellationToken token = default)
|
|
||||||
{
|
|
||||||
var response =
|
|
||||||
await _httpClient.SendAsync(
|
|
||||||
CreateHttpRequest($"api/v1/stores/{storeId}/payment-methods/LightningNetwork/{cryptoCode}"), token);
|
|
||||||
return await HandleResponse<LightningNetworkPaymentMethodData>(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual async Task RemoveStoreLightningNetworkPaymentMethod(string storeId,
|
|
||||||
string cryptoCode, CancellationToken token = default)
|
|
||||||
{
|
|
||||||
var response =
|
|
||||||
await _httpClient.SendAsync(
|
|
||||||
CreateHttpRequest($"api/v1/stores/{storeId}/payment-methods/LightningNetwork/{cryptoCode}",
|
|
||||||
method: HttpMethod.Delete), token);
|
|
||||||
await HandleResponse(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual async Task<LightningNetworkPaymentMethodData> UpdateStoreLightningNetworkPaymentMethod(
|
|
||||||
string storeId,
|
|
||||||
string cryptoCode, UpdateLightningNetworkPaymentMethodRequest paymentMethod,
|
|
||||||
CancellationToken token = default)
|
|
||||||
{
|
|
||||||
var response = await _httpClient.SendAsync(
|
|
||||||
CreateHttpRequest($"api/v1/stores/{storeId}/payment-methods/LightningNetwork/{cryptoCode}",
|
|
||||||
bodyPayload: paymentMethod, method: HttpMethod.Put), token);
|
|
||||||
return await HandleResponse<LightningNetworkPaymentMethodData>(response);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,23 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using BTCPayServer.Client.Models;
|
|
||||||
|
|
||||||
namespace BTCPayServer.Client
|
|
||||||
{
|
|
||||||
public partial class BTCPayServerClient
|
|
||||||
{
|
|
||||||
public virtual async Task<PermissionMetadata[]> GetPermissionMetadata(CancellationToken token = default)
|
|
||||||
{
|
|
||||||
var response = await _httpClient.SendAsync(CreateHttpRequest("misc/permissions"), token);
|
|
||||||
return await HandleResponse<PermissionMetadata[]>(response);
|
|
||||||
}
|
|
||||||
public virtual async Task<Language[]> GetAvailableLanguages(CancellationToken token = default)
|
|
||||||
{
|
|
||||||
var response = await _httpClient.SendAsync(CreateHttpRequest("misc/lang"), token);
|
|
||||||
return await HandleResponse<Language[]>(response);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,56 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Net.Http;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using BTCPayServer.Client.Models;
|
|
||||||
|
|
||||||
namespace BTCPayServer.Client
|
|
||||||
{
|
|
||||||
public partial class BTCPayServerClient
|
|
||||||
{
|
|
||||||
public virtual async Task<IEnumerable<NotificationData>> GetNotifications(bool? seen = null, int? skip = null,
|
|
||||||
int? take = null, CancellationToken token = default)
|
|
||||||
{
|
|
||||||
Dictionary<string, object> queryPayload = new Dictionary<string, object>();
|
|
||||||
|
|
||||||
if (seen != null)
|
|
||||||
queryPayload.Add(nameof(seen), seen);
|
|
||||||
if (skip != null)
|
|
||||||
queryPayload.Add(nameof(skip), skip);
|
|
||||||
if (take != null)
|
|
||||||
queryPayload.Add(nameof(take), take);
|
|
||||||
|
|
||||||
var response = await _httpClient.SendAsync(
|
|
||||||
CreateHttpRequest($"api/v1/users/me/notifications",
|
|
||||||
queryPayload), token);
|
|
||||||
|
|
||||||
return await HandleResponse<IEnumerable<NotificationData>>(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual async Task<NotificationData> GetNotification(string notificationId,
|
|
||||||
CancellationToken token = default)
|
|
||||||
{
|
|
||||||
var response = await _httpClient.SendAsync(
|
|
||||||
CreateHttpRequest($"api/v1/users/me/notifications/{notificationId}"), token);
|
|
||||||
return await HandleResponse<NotificationData>(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual async Task<NotificationData> UpdateNotification(string notificationId, bool? seen,
|
|
||||||
CancellationToken token = default)
|
|
||||||
{
|
|
||||||
var response = await _httpClient.SendAsync(
|
|
||||||
CreateHttpRequest($"api/v1/users/me/notifications/{notificationId}",
|
|
||||||
method: HttpMethod.Put, bodyPayload: new UpdateNotification() { Seen = seen }), token);
|
|
||||||
return await HandleResponse<NotificationData>(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual async Task RemoveNotification(string notificationId, CancellationToken token = default)
|
|
||||||
{
|
|
||||||
var response = await _httpClient.SendAsync(
|
|
||||||
CreateHttpRequest($"api/v1/users/me/notifications/{notificationId}",
|
|
||||||
method: HttpMethod.Delete), token);
|
|
||||||
await HandleResponse(response);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,94 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using System.Net.Http;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using BTCPayServer.Client.Models;
|
|
||||||
|
|
||||||
namespace BTCPayServer.Client
|
|
||||||
{
|
|
||||||
public partial class BTCPayServerClient
|
|
||||||
{
|
|
||||||
public virtual async Task<IEnumerable<OnChainPaymentMethodData>> GetStoreOnChainPaymentMethods(string storeId,
|
|
||||||
bool? enabled = null,
|
|
||||||
CancellationToken token = default)
|
|
||||||
{
|
|
||||||
var query = new Dictionary<string, object>();
|
|
||||||
if (enabled != null)
|
|
||||||
{
|
|
||||||
query.Add(nameof(enabled), enabled);
|
|
||||||
}
|
|
||||||
|
|
||||||
var response =
|
|
||||||
await _httpClient.SendAsync(
|
|
||||||
CreateHttpRequest($"api/v1/stores/{storeId}/payment-methods/onchain",
|
|
||||||
query), token);
|
|
||||||
return await HandleResponse<IEnumerable<OnChainPaymentMethodData>>(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual async Task<OnChainPaymentMethodData> GetStoreOnChainPaymentMethod(string storeId,
|
|
||||||
string cryptoCode, CancellationToken token = default)
|
|
||||||
{
|
|
||||||
var response =
|
|
||||||
await _httpClient.SendAsync(
|
|
||||||
CreateHttpRequest($"api/v1/stores/{storeId}/payment-methods/onchain/{cryptoCode}"), token);
|
|
||||||
return await HandleResponse<OnChainPaymentMethodData>(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual async Task RemoveStoreOnChainPaymentMethod(string storeId,
|
|
||||||
string cryptoCode, CancellationToken token = default)
|
|
||||||
{
|
|
||||||
var response =
|
|
||||||
await _httpClient.SendAsync(
|
|
||||||
CreateHttpRequest($"api/v1/stores/{storeId}/payment-methods/onchain/{cryptoCode}",
|
|
||||||
method: HttpMethod.Delete), token);
|
|
||||||
await HandleResponse(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual async Task<OnChainPaymentMethodData> UpdateStoreOnChainPaymentMethod(string storeId,
|
|
||||||
string cryptoCode, UpdateOnChainPaymentMethodRequest paymentMethod,
|
|
||||||
CancellationToken token = default)
|
|
||||||
{
|
|
||||||
var response = await _httpClient.SendAsync(
|
|
||||||
CreateHttpRequest($"api/v1/stores/{storeId}/payment-methods/onchain/{cryptoCode}",
|
|
||||||
bodyPayload: paymentMethod, method: HttpMethod.Put), token);
|
|
||||||
return await HandleResponse<OnChainPaymentMethodData>(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual async Task<OnChainPaymentMethodPreviewResultData>
|
|
||||||
PreviewProposedStoreOnChainPaymentMethodAddresses(
|
|
||||||
string storeId, string cryptoCode, UpdateOnChainPaymentMethodRequest paymentMethod, int offset = 0,
|
|
||||||
int amount = 10,
|
|
||||||
CancellationToken token = default)
|
|
||||||
{
|
|
||||||
var response = await _httpClient.SendAsync(
|
|
||||||
CreateHttpRequest($"api/v1/stores/{storeId}/payment-methods/onchain/{cryptoCode}/preview",
|
|
||||||
bodyPayload: paymentMethod,
|
|
||||||
queryPayload: new Dictionary<string, object>() { { "offset", offset }, { "amount", amount } },
|
|
||||||
method: HttpMethod.Post), token);
|
|
||||||
return await HandleResponse<OnChainPaymentMethodPreviewResultData>(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual async Task<OnChainPaymentMethodPreviewResultData> PreviewStoreOnChainPaymentMethodAddresses(
|
|
||||||
string storeId, string cryptoCode, int offset = 0, int amount = 10,
|
|
||||||
CancellationToken token = default)
|
|
||||||
{
|
|
||||||
var response = await _httpClient.SendAsync(
|
|
||||||
CreateHttpRequest($"api/v1/stores/{storeId}/payment-methods/onchain/{cryptoCode}/preview",
|
|
||||||
queryPayload: new Dictionary<string, object>() { { "offset", offset }, { "amount", amount } },
|
|
||||||
method: HttpMethod.Get), token);
|
|
||||||
return await HandleResponse<OnChainPaymentMethodPreviewResultData>(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual async Task<OnChainPaymentMethodDataWithSensitiveData> GenerateOnChainWallet(string storeId,
|
|
||||||
string cryptoCode, GenerateOnChainWalletRequest request,
|
|
||||||
CancellationToken token = default)
|
|
||||||
{
|
|
||||||
var response = await _httpClient.SendAsync(
|
|
||||||
CreateHttpRequest($"api/v1/stores/{storeId}/payment-methods/onchain/{cryptoCode}/generate",
|
|
||||||
bodyPayload: request,
|
|
||||||
method: HttpMethod.Post), token);
|
|
||||||
return await HandleResponse<OnChainPaymentMethodDataWithSensitiveData>(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,82 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Net.Http;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using BTCPayServer.Client.Models;
|
|
||||||
using NBitcoin;
|
|
||||||
|
|
||||||
namespace BTCPayServer.Client
|
|
||||||
{
|
|
||||||
public partial class BTCPayServerClient
|
|
||||||
{
|
|
||||||
public virtual async Task<OnChainWalletObjectData> GetOnChainWalletObject(string storeId, string cryptoCode, OnChainWalletObjectId objectId, bool? includeNeighbourData = null, CancellationToken token = default)
|
|
||||||
{
|
|
||||||
Dictionary<string, object> parameters = new Dictionary<string, object>();
|
|
||||||
if (includeNeighbourData is bool v)
|
|
||||||
parameters.Add("includeNeighbourData", v);
|
|
||||||
var response =
|
|
||||||
await _httpClient.SendAsync(
|
|
||||||
CreateHttpRequest($"api/v1/stores/{storeId}/payment-methods/onchain/{cryptoCode}/wallet/objects/{objectId.Type}/{objectId.Id}", parameters, method: HttpMethod.Get), token);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return await HandleResponse<OnChainWalletObjectData>(response);
|
|
||||||
}
|
|
||||||
catch (GreenfieldAPIException err) when (err.APIError.Code == "wallet-object-not-found")
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public virtual async Task<OnChainWalletObjectData[]> GetOnChainWalletObjects(string storeId, string cryptoCode, GetWalletObjectsRequest query = null, CancellationToken token = default)
|
|
||||||
{
|
|
||||||
Dictionary<string, object> parameters = new Dictionary<string, object>();
|
|
||||||
if (query?.Type is string s)
|
|
||||||
parameters.Add("type", s);
|
|
||||||
if (query?.Ids is string[] ids)
|
|
||||||
parameters.Add("ids", ids);
|
|
||||||
if (query?.IncludeNeighbourData is bool v)
|
|
||||||
parameters.Add("includeNeighbourData", v);
|
|
||||||
var response =
|
|
||||||
await _httpClient.SendAsync(
|
|
||||||
CreateHttpRequest($"api/v1/stores/{storeId}/payment-methods/onchain/{cryptoCode}/wallet/objects", parameters, method: HttpMethod.Get), token);
|
|
||||||
return await HandleResponse<OnChainWalletObjectData[]>(response);
|
|
||||||
}
|
|
||||||
public virtual async Task RemoveOnChainWalletObject(string storeId, string cryptoCode, OnChainWalletObjectId objectId,
|
|
||||||
CancellationToken token = default)
|
|
||||||
{
|
|
||||||
var response =
|
|
||||||
await _httpClient.SendAsync(
|
|
||||||
CreateHttpRequest($"api/v1/stores/{storeId}/payment-methods/onchain/{cryptoCode}/wallet/objects/{objectId.Type}/{objectId.Id}", method: HttpMethod.Delete), token);
|
|
||||||
await HandleResponse(response);
|
|
||||||
}
|
|
||||||
public virtual async Task<OnChainWalletObjectData> AddOrUpdateOnChainWalletObject(string storeId, string cryptoCode, AddOnChainWalletObjectRequest request,
|
|
||||||
CancellationToken token = default)
|
|
||||||
{
|
|
||||||
var response =
|
|
||||||
await _httpClient.SendAsync(
|
|
||||||
CreateHttpRequest($"api/v1/stores/{storeId}/payment-methods/onchain/{cryptoCode}/wallet/objects", method: HttpMethod.Post, bodyPayload: request), token);
|
|
||||||
return await HandleResponse<OnChainWalletObjectData>(response);
|
|
||||||
}
|
|
||||||
public virtual async Task AddOrUpdateOnChainWalletLink(string storeId, string cryptoCode,
|
|
||||||
OnChainWalletObjectId objectId,
|
|
||||||
AddOnChainWalletObjectLinkRequest request = null,
|
|
||||||
CancellationToken token = default)
|
|
||||||
{
|
|
||||||
var response =
|
|
||||||
await _httpClient.SendAsync(
|
|
||||||
CreateHttpRequest($"api/v1/stores/{storeId}/payment-methods/onchain/{cryptoCode}/wallet/objects/{objectId.Type}/{objectId.Id}/links", method: HttpMethod.Post, bodyPayload: request), token);
|
|
||||||
await HandleResponse(response);
|
|
||||||
}
|
|
||||||
public virtual async Task RemoveOnChainWalletLinks(string storeId, string cryptoCode,
|
|
||||||
OnChainWalletObjectId objectId,
|
|
||||||
OnChainWalletObjectId link,
|
|
||||||
CancellationToken token = default)
|
|
||||||
{
|
|
||||||
var response =
|
|
||||||
await _httpClient.SendAsync(
|
|
||||||
CreateHttpRequest($"api/v1/stores/{storeId}/payment-methods/onchain/{cryptoCode}/wallet/objects/{objectId.Type}/{objectId.Id}/links/{link.Type}/{link.Id}", method: HttpMethod.Delete), token);
|
|
||||||
await HandleResponse(response);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,140 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Net.Http;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using BTCPayServer.Client.Models;
|
|
||||||
using NBitcoin;
|
|
||||||
|
|
||||||
namespace BTCPayServer.Client
|
|
||||||
{
|
|
||||||
public partial class BTCPayServerClient
|
|
||||||
{
|
|
||||||
public virtual async Task<OnChainWalletOverviewData> ShowOnChainWalletOverview(string storeId, string cryptoCode,
|
|
||||||
CancellationToken token = default)
|
|
||||||
{
|
|
||||||
var response =
|
|
||||||
await _httpClient.SendAsync(
|
|
||||||
CreateHttpRequest($"api/v1/stores/{storeId}/payment-methods/onchain/{cryptoCode}/wallet"), token);
|
|
||||||
return await HandleResponse<OnChainWalletOverviewData>(response);
|
|
||||||
}
|
|
||||||
public virtual async Task<OnChainWalletFeeRateData> GetOnChainFeeRate(string storeId, string cryptoCode, int? blockTarget = null,
|
|
||||||
CancellationToken token = default)
|
|
||||||
{
|
|
||||||
Dictionary<string, object> queryParams = new Dictionary<string, object>();
|
|
||||||
if (blockTarget != null)
|
|
||||||
{
|
|
||||||
queryParams.Add("blockTarget", blockTarget);
|
|
||||||
}
|
|
||||||
var response =
|
|
||||||
await _httpClient.SendAsync(
|
|
||||||
CreateHttpRequest($"api/v1/stores/{storeId}/payment-methods/onchain/{cryptoCode}/wallet/feeRate", queryParams), token);
|
|
||||||
return await HandleResponse<OnChainWalletFeeRateData>(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual async Task<OnChainWalletAddressData> GetOnChainWalletReceiveAddress(string storeId, string cryptoCode, bool forceGenerate = false,
|
|
||||||
CancellationToken token = default)
|
|
||||||
{
|
|
||||||
var response =
|
|
||||||
await _httpClient.SendAsync(
|
|
||||||
CreateHttpRequest($"api/v1/stores/{storeId}/payment-methods/onchain/{cryptoCode}/wallet/address", new Dictionary<string, object>()
|
|
||||||
{
|
|
||||||
{"forceGenerate", forceGenerate}
|
|
||||||
}), token);
|
|
||||||
return await HandleResponse<OnChainWalletAddressData>(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual async Task UnReserveOnChainWalletReceiveAddress(string storeId, string cryptoCode,
|
|
||||||
CancellationToken token = default)
|
|
||||||
{
|
|
||||||
var response =
|
|
||||||
await _httpClient.SendAsync(
|
|
||||||
CreateHttpRequest($"api/v1/stores/{storeId}/payment-methods/onchain/{cryptoCode}/wallet/address", method: HttpMethod.Delete), token);
|
|
||||||
await HandleResponse(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual async Task<IEnumerable<OnChainWalletTransactionData>> ShowOnChainWalletTransactions(
|
|
||||||
string storeId, string cryptoCode, TransactionStatus[] statusFilter = null, string labelFilter = null,
|
|
||||||
CancellationToken token = default)
|
|
||||||
{
|
|
||||||
var query = new Dictionary<string, object>();
|
|
||||||
if (statusFilter?.Any() is true)
|
|
||||||
{
|
|
||||||
query.Add(nameof(statusFilter), statusFilter);
|
|
||||||
}
|
|
||||||
if (labelFilter != null)
|
|
||||||
{
|
|
||||||
query.Add(nameof(labelFilter), labelFilter);
|
|
||||||
}
|
|
||||||
var response =
|
|
||||||
await _httpClient.SendAsync(
|
|
||||||
CreateHttpRequest($"api/v1/stores/{storeId}/payment-methods/onchain/{cryptoCode}/wallet/transactions", query), token);
|
|
||||||
return await HandleResponse<IEnumerable<OnChainWalletTransactionData>>(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual async Task<OnChainWalletTransactionData> GetOnChainWalletTransaction(
|
|
||||||
string storeId, string cryptoCode, string transactionId,
|
|
||||||
CancellationToken token = default)
|
|
||||||
{
|
|
||||||
var response =
|
|
||||||
await _httpClient.SendAsync(
|
|
||||||
CreateHttpRequest($"api/v1/stores/{storeId}/payment-methods/onchain/{cryptoCode}/wallet/transactions/{transactionId}"), token);
|
|
||||||
return await HandleResponse<OnChainWalletTransactionData>(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual async Task<OnChainWalletTransactionData> PatchOnChainWalletTransaction(
|
|
||||||
string storeId, string cryptoCode, string transactionId,
|
|
||||||
PatchOnChainTransactionRequest request,
|
|
||||||
bool force = false, CancellationToken token = default)
|
|
||||||
{
|
|
||||||
var response =
|
|
||||||
await _httpClient.SendAsync(
|
|
||||||
CreateHttpRequest($"api/v1/stores/{storeId}/payment-methods/onchain/{cryptoCode}/wallet/transactions/{transactionId}", queryPayload: new Dictionary<string, object>()
|
|
||||||
{
|
|
||||||
{"force", force}
|
|
||||||
}, bodyPayload: request, HttpMethod.Patch), token);
|
|
||||||
return await HandleResponse<OnChainWalletTransactionData>(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual async Task<IEnumerable<OnChainWalletUTXOData>> GetOnChainWalletUTXOs(string storeId,
|
|
||||||
string cryptoCode,
|
|
||||||
CancellationToken token = default)
|
|
||||||
{
|
|
||||||
var response =
|
|
||||||
await _httpClient.SendAsync(
|
|
||||||
CreateHttpRequest($"api/v1/stores/{storeId}/payment-methods/onchain/{cryptoCode}/wallet/utxos"), token);
|
|
||||||
return await HandleResponse<IEnumerable<OnChainWalletUTXOData>>(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual async Task<OnChainWalletTransactionData> CreateOnChainTransaction(string storeId,
|
|
||||||
string cryptoCode, CreateOnChainTransactionRequest request,
|
|
||||||
CancellationToken token = default)
|
|
||||||
{
|
|
||||||
if (!request.ProceedWithBroadcast)
|
|
||||||
{
|
|
||||||
throw new ArgumentOutOfRangeException(nameof(request.ProceedWithBroadcast),
|
|
||||||
"Please use CreateOnChainTransactionButDoNotBroadcast when wanting to only create the transaction");
|
|
||||||
}
|
|
||||||
var response =
|
|
||||||
await _httpClient.SendAsync(
|
|
||||||
CreateHttpRequest($"api/v1/stores/{storeId}/payment-methods/onchain/{cryptoCode}/wallet/transactions", null, request, HttpMethod.Post), token);
|
|
||||||
return await HandleResponse<OnChainWalletTransactionData>(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual async Task<Transaction> CreateOnChainTransactionButDoNotBroadcast(string storeId,
|
|
||||||
string cryptoCode, CreateOnChainTransactionRequest request, Network network,
|
|
||||||
CancellationToken token = default)
|
|
||||||
{
|
|
||||||
if (request.ProceedWithBroadcast)
|
|
||||||
{
|
|
||||||
throw new ArgumentOutOfRangeException(nameof(request.ProceedWithBroadcast),
|
|
||||||
"Please use CreateOnChainTransaction when wanting to also broadcast the transaction");
|
|
||||||
}
|
|
||||||
var response =
|
|
||||||
await _httpClient.SendAsync(
|
|
||||||
CreateHttpRequest($"api/v1/stores/{storeId}/payment-methods/onchain/{cryptoCode}/wallet/transactions", null, request, HttpMethod.Post), token);
|
|
||||||
return Transaction.Parse(await HandleResponse<string>(response), network);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -16,7 +16,7 @@ namespace BTCPayServer.Client
|
|||||||
var response =
|
var response =
|
||||||
await _httpClient.SendAsync(
|
await _httpClient.SendAsync(
|
||||||
CreateHttpRequest($"api/v1/stores/{storeId}/payment-requests",
|
CreateHttpRequest($"api/v1/stores/{storeId}/payment-requests",
|
||||||
new Dictionary<string, object>() { { nameof(includeArchived), includeArchived } }), token);
|
new Dictionary<string, object>() {{nameof(includeArchived), includeArchived}}), token);
|
||||||
return await HandleResponse<IEnumerable<PaymentRequestData>>(response);
|
return await HandleResponse<IEnumerable<PaymentRequestData>>(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,20 +37,6 @@ namespace BTCPayServer.Client
|
|||||||
await HandleResponse(response);
|
await HandleResponse(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual async Task<Client.Models.InvoiceData> PayPaymentRequest(string storeId, string paymentRequestId, PayPaymentRequestRequest request, CancellationToken token = default)
|
|
||||||
{
|
|
||||||
if (request == null)
|
|
||||||
throw new ArgumentNullException(nameof(request));
|
|
||||||
if (storeId is null)
|
|
||||||
throw new ArgumentNullException(nameof(storeId));
|
|
||||||
if (paymentRequestId is null)
|
|
||||||
throw new ArgumentNullException(nameof(paymentRequestId));
|
|
||||||
var response = await _httpClient.SendAsync(
|
|
||||||
CreateHttpRequest($"api/v1/stores/{storeId}/payment-requests/{paymentRequestId}/pay", bodyPayload: request,
|
|
||||||
method: HttpMethod.Post), token);
|
|
||||||
return await HandleResponse<Client.Models.InvoiceData>(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual async Task<PaymentRequestData> CreatePaymentRequest(string storeId,
|
public virtual async Task<PaymentRequestData> CreatePaymentRequest(string storeId,
|
||||||
CreatePaymentRequestRequest request, CancellationToken token = default)
|
CreatePaymentRequestRequest request, CancellationToken token = default)
|
||||||
{
|
{
|
||||||
|
@ -1,18 +0,0 @@
|
|||||||
#nullable enable
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using BTCPayServer.Client.Models;
|
|
||||||
|
|
||||||
namespace BTCPayServer.Client
|
|
||||||
{
|
|
||||||
public partial class BTCPayServerClient
|
|
||||||
{
|
|
||||||
public virtual async Task<IEnumerable<PayoutProcessorData>> GetPayoutProcessors(
|
|
||||||
CancellationToken token = default)
|
|
||||||
{
|
|
||||||
var response = await _httpClient.SendAsync(CreateHttpRequest("api/v1/payout-processors"), token);
|
|
||||||
return await HandleResponse<IEnumerable<PayoutProcessorData>>(response);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -9,18 +9,18 @@ namespace BTCPayServer.Client
|
|||||||
{
|
{
|
||||||
public partial class BTCPayServerClient
|
public partial class BTCPayServerClient
|
||||||
{
|
{
|
||||||
public virtual async Task<PullPaymentData> CreatePullPayment(string storeId, CreatePullPaymentRequest request, CancellationToken cancellationToken = default)
|
public async Task<PullPaymentData> CreatePullPayment(string storeId, CreatePullPaymentRequest request, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
var response = await _httpClient.SendAsync(CreateHttpRequest($"api/v1/stores/{HttpUtility.UrlEncode(storeId)}/pull-payments", bodyPayload: request, method: HttpMethod.Post), cancellationToken);
|
var response = await _httpClient.SendAsync(CreateHttpRequest($"api/v1/stores/{HttpUtility.UrlEncode(storeId)}/pull-payments", bodyPayload: request, method: HttpMethod.Post), cancellationToken);
|
||||||
return await HandleResponse<PullPaymentData>(response);
|
return await HandleResponse<PullPaymentData>(response);
|
||||||
}
|
}
|
||||||
public virtual async Task<PullPaymentData> GetPullPayment(string pullPaymentId, CancellationToken cancellationToken = default)
|
public async Task<PullPaymentData> GetPullPayment(string pullPaymentId, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
var response = await _httpClient.SendAsync(CreateHttpRequest($"api/v1/pull-payments/{HttpUtility.UrlEncode(pullPaymentId)}", method: HttpMethod.Get), cancellationToken);
|
var response = await _httpClient.SendAsync(CreateHttpRequest($"api/v1/pull-payments/{HttpUtility.UrlEncode(pullPaymentId)}", method: HttpMethod.Get), cancellationToken);
|
||||||
return await HandleResponse<PullPaymentData>(response);
|
return await HandleResponse<PullPaymentData>(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual async Task<PullPaymentData[]> GetPullPayments(string storeId, bool includeArchived = false, CancellationToken cancellationToken = default)
|
public async Task<PullPaymentData[]> GetPullPayments(string storeId, bool includeArchived = false, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
Dictionary<string, object> query = new Dictionary<string, object>();
|
Dictionary<string, object> query = new Dictionary<string, object>();
|
||||||
query.Add("includeArchived", includeArchived);
|
query.Add("includeArchived", includeArchived);
|
||||||
@ -28,84 +28,34 @@ namespace BTCPayServer.Client
|
|||||||
return await HandleResponse<PullPaymentData[]>(response);
|
return await HandleResponse<PullPaymentData[]>(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual async Task ArchivePullPayment(string storeId, string pullPaymentId, CancellationToken cancellationToken = default)
|
public async Task ArchivePullPayment(string storeId, string pullPaymentId, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
var response = await _httpClient.SendAsync(CreateHttpRequest($"api/v1/stores/{HttpUtility.UrlEncode(storeId)}/pull-payments/{HttpUtility.UrlEncode(pullPaymentId)}", method: HttpMethod.Delete), cancellationToken);
|
var response = await _httpClient.SendAsync(CreateHttpRequest($"api/v1/stores/{HttpUtility.UrlEncode(storeId)}/pull-payments/{HttpUtility.UrlEncode(pullPaymentId)}", method: HttpMethod.Delete), cancellationToken);
|
||||||
await HandleResponse(response);
|
await HandleResponse(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual async Task<PayoutData[]> GetPayouts(string pullPaymentId, bool includeCancelled = false, CancellationToken cancellationToken = default)
|
public async Task<PayoutData[]> GetPayouts(string pullPaymentId, bool includeCancelled = false, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
Dictionary<string, object> query = new Dictionary<string, object>();
|
Dictionary<string, object> query = new Dictionary<string, object>();
|
||||||
query.Add("includeCancelled", includeCancelled);
|
query.Add("includeCancelled", includeCancelled);
|
||||||
var response = await _httpClient.SendAsync(CreateHttpRequest($"api/v1/pull-payments/{HttpUtility.UrlEncode(pullPaymentId)}/payouts", queryPayload: query, method: HttpMethod.Get), cancellationToken);
|
var response = await _httpClient.SendAsync(CreateHttpRequest($"api/v1/pull-payments/{HttpUtility.UrlEncode(pullPaymentId)}/payouts", queryPayload: query, method: HttpMethod.Get), cancellationToken);
|
||||||
return await HandleResponse<PayoutData[]>(response);
|
return await HandleResponse<PayoutData[]>(response);
|
||||||
}
|
}
|
||||||
public virtual async Task<PayoutData[]> GetStorePayouts(string storeId, bool includeCancelled = false, CancellationToken cancellationToken = default)
|
public async Task<PayoutData> CreatePayout(string pullPaymentId, CreatePayoutRequest payoutRequest, CancellationToken cancellationToken = default)
|
||||||
{
|
|
||||||
Dictionary<string, object> query = new Dictionary<string, object>();
|
|
||||||
query.Add("includeCancelled", includeCancelled);
|
|
||||||
var response = await _httpClient.SendAsync(CreateHttpRequest($"api/v1/stores/{storeId}/payouts", queryPayload: query, method: HttpMethod.Get), cancellationToken);
|
|
||||||
return await HandleResponse<PayoutData[]>(response);
|
|
||||||
}
|
|
||||||
public virtual async Task<PayoutData> CreatePayout(string pullPaymentId, CreatePayoutRequest payoutRequest, CancellationToken cancellationToken = default)
|
|
||||||
{
|
{
|
||||||
var response = await _httpClient.SendAsync(CreateHttpRequest($"api/v1/pull-payments/{HttpUtility.UrlEncode(pullPaymentId)}/payouts", bodyPayload: payoutRequest, method: HttpMethod.Post), cancellationToken);
|
var response = await _httpClient.SendAsync(CreateHttpRequest($"api/v1/pull-payments/{HttpUtility.UrlEncode(pullPaymentId)}/payouts", bodyPayload: payoutRequest, method: HttpMethod.Post), cancellationToken);
|
||||||
return await HandleResponse<PayoutData>(response);
|
return await HandleResponse<PayoutData>(response);
|
||||||
}
|
}
|
||||||
public virtual async Task<PayoutData> GetPullPaymentPayout(string pullPaymentId, string payoutId, CancellationToken cancellationToken = default)
|
|
||||||
{
|
public async Task CancelPayout(string storeId, string payoutId, CancellationToken cancellationToken = default)
|
||||||
var response = await _httpClient.SendAsync(CreateHttpRequest($"api/v1/pull-payments/{HttpUtility.UrlEncode(pullPaymentId)}/payouts/{payoutId}", method: HttpMethod.Get), cancellationToken);
|
|
||||||
return await HandleResponse<PayoutData>(response);
|
|
||||||
}
|
|
||||||
public virtual async Task<PayoutData> GetStorePayout(string storeId, string payoutId, CancellationToken cancellationToken = default)
|
|
||||||
{
|
|
||||||
var response = await _httpClient.SendAsync(CreateHttpRequest($"api/v1/stores/{storeId}/payouts/{payoutId}", method: HttpMethod.Get), cancellationToken);
|
|
||||||
return await HandleResponse<PayoutData>(response);
|
|
||||||
}
|
|
||||||
public virtual async Task<PayoutData> CreatePayout(string storeId, CreatePayoutThroughStoreRequest payoutRequest, CancellationToken cancellationToken = default)
|
|
||||||
{
|
|
||||||
var response = await _httpClient.SendAsync(CreateHttpRequest($"api/v1/stores/{storeId}/payouts", bodyPayload: payoutRequest, method: HttpMethod.Post), cancellationToken);
|
|
||||||
return await HandleResponse<PayoutData>(response);
|
|
||||||
}
|
|
||||||
public virtual async Task CancelPayout(string storeId, string payoutId, CancellationToken cancellationToken = default)
|
|
||||||
{
|
{
|
||||||
var response = await _httpClient.SendAsync(CreateHttpRequest($"api/v1/stores/{HttpUtility.UrlEncode(storeId)}/payouts/{HttpUtility.UrlEncode(payoutId)}", method: HttpMethod.Delete), cancellationToken);
|
var response = await _httpClient.SendAsync(CreateHttpRequest($"api/v1/stores/{HttpUtility.UrlEncode(storeId)}/payouts/{HttpUtility.UrlEncode(payoutId)}", method: HttpMethod.Delete), cancellationToken);
|
||||||
await HandleResponse(response);
|
await HandleResponse(response);
|
||||||
}
|
}
|
||||||
public virtual async Task<PayoutData> ApprovePayout(string storeId, string payoutId, ApprovePayoutRequest request, CancellationToken cancellationToken = default)
|
public async Task<PayoutData> ApprovePayout(string storeId, string payoutId, ApprovePayoutRequest request, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
var response = await _httpClient.SendAsync(CreateHttpRequest($"api/v1/stores/{HttpUtility.UrlEncode(storeId)}/payouts/{HttpUtility.UrlEncode(payoutId)}", bodyPayload: request, method: HttpMethod.Post), cancellationToken);
|
var response = await _httpClient.SendAsync(CreateHttpRequest($"api/v1/stores/{HttpUtility.UrlEncode(storeId)}/payouts/{HttpUtility.UrlEncode(payoutId)}", bodyPayload: request, method: HttpMethod.Post), cancellationToken);
|
||||||
return await HandleResponse<PayoutData>(response);
|
return await HandleResponse<PayoutData>(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual async Task MarkPayoutPaid(string storeId, string payoutId,
|
|
||||||
CancellationToken cancellationToken = default)
|
|
||||||
{
|
|
||||||
var response = await _httpClient.SendAsync(
|
|
||||||
CreateHttpRequest(
|
|
||||||
$"api/v1/stores/{HttpUtility.UrlEncode(storeId)}/payouts/{HttpUtility.UrlEncode(payoutId)}/mark-paid",
|
|
||||||
method: HttpMethod.Post), cancellationToken);
|
|
||||||
await HandleResponse(response);
|
|
||||||
}
|
|
||||||
public virtual async Task MarkPayout(string storeId, string payoutId, MarkPayoutRequest request,
|
|
||||||
CancellationToken cancellationToken = default)
|
|
||||||
{
|
|
||||||
var response = await _httpClient.SendAsync(
|
|
||||||
CreateHttpRequest(
|
|
||||||
$"api/v1/stores/{HttpUtility.UrlEncode(storeId)}/payouts/{HttpUtility.UrlEncode(payoutId)}/mark",
|
|
||||||
method: HttpMethod.Post, bodyPayload: request), cancellationToken);
|
|
||||||
await HandleResponse(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual async Task<PullPaymentLNURL> GetPullPaymentLNURL(string pullPaymentId,
|
|
||||||
CancellationToken cancellationToken = default)
|
|
||||||
{
|
|
||||||
var response = await _httpClient.SendAsync(
|
|
||||||
CreateHttpRequest(
|
|
||||||
$"/api/v1/pull-payments/{pullPaymentId}/lnurl",
|
|
||||||
method: HttpMethod.Get), cancellationToken);
|
|
||||||
return await HandleResponse<PullPaymentLNURL>(response);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user