add bitcoin shop config and payment method enablement
This commit is contained in:
@@ -17,6 +17,7 @@ import { NodeEnv } from '../types/NodeEnv';
|
||||
import { ShopFiatCurrency } from '../types/ShopFiatCurrency';
|
||||
import { PaymentMethod } from '../modules/payment/types/PaymentMethod';
|
||||
import { SimplexConfig } from '../types/SimplexConfig';
|
||||
import { parseEnabledPaymentMethods } from '../utils/payment/parseEnabledPaymentMethods';
|
||||
|
||||
const env = (key: string): string => process.env[key] || '';
|
||||
|
||||
@@ -177,8 +178,12 @@ export const getEncryptionConfig = (): EncryptionConfig => ({
|
||||
export const getShopSettingsConfig = (): ShopSettingsConfig => ({
|
||||
shopName: env('SHOP_NAME'),
|
||||
shopFiatCurrency: env('SHOP_FIAT_CURRENCY') as ShopFiatCurrency,
|
||||
enabledPaymentMethods: parseEnabledPaymentMethods(env('PAYMENT_METHODS_ENABLED')),
|
||||
monero: {
|
||||
confirmationTiers: JSON.parse(env('MONERO_CONFIRMATION_TIERS')) as ConfirmationTier[]
|
||||
},
|
||||
bitcoin: {
|
||||
confirmationTiers: JSON.parse(env('BITCOIN_CONFIRMATION_TIERS')) as ConfirmationTier[]
|
||||
}
|
||||
});
|
||||
|
||||
@@ -192,7 +197,7 @@ export const getOrderConfig = (): OrderConfig => ({
|
||||
export const getInvoiceConfig = (): InvoiceConfig => ({
|
||||
minByMethod: {
|
||||
[PaymentMethod.Xmr]: String(envInt('MONERO_MIN_INCOMING_ATOMIC')),
|
||||
[PaymentMethod.Btc]: String(envInt('BTC_MIN_INCOMING_ATOMIC'))
|
||||
[PaymentMethod.Btc]: String(envInt('BITCOIN_MIN_INCOMING_ATOMIC'))
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import { NodeEnv } from '../types/NodeEnv';
|
||||
import { ShopFiatCurrency } from '../types/ShopFiatCurrency';
|
||||
import { IsBase64 } from '../validation/decorators/isBase64';
|
||||
import { IsConfirmationTiers } from '../validation/decorators/isConfirmationTiers';
|
||||
import { IsEnabledPaymentMethods } from '../validation/decorators/isEnabledPaymentMethods';
|
||||
import { MoneroNetwork } from '../types/MoneroNetwork';
|
||||
|
||||
class EnvironmentVariables {
|
||||
@@ -268,6 +269,16 @@ class EnvironmentVariables {
|
||||
@IsConfirmationTiers()
|
||||
MONERO_CONFIRMATION_TIERS: string;
|
||||
|
||||
@IsNotEmpty()
|
||||
@IsString()
|
||||
@IsConfirmationTiers()
|
||||
BITCOIN_CONFIRMATION_TIERS: string;
|
||||
|
||||
@IsNotEmpty()
|
||||
@IsString()
|
||||
@IsEnabledPaymentMethods()
|
||||
PAYMENT_METHODS_ENABLED: string;
|
||||
|
||||
@IsNotEmpty()
|
||||
@IsNumber()
|
||||
@Min(60000)
|
||||
@@ -294,6 +305,12 @@ class EnvironmentVariables {
|
||||
@Max(Number.MAX_SAFE_INTEGER)
|
||||
MONERO_MIN_INCOMING_ATOMIC: number;
|
||||
|
||||
@IsNotEmpty()
|
||||
@IsNumber()
|
||||
@Min(0)
|
||||
@Max(Number.MAX_SAFE_INTEGER)
|
||||
BITCOIN_MIN_INCOMING_ATOMIC: number;
|
||||
|
||||
@IsNotEmpty()
|
||||
@IsString()
|
||||
MONERO_DAEMON_ADDRESS: string;
|
||||
|
||||
Reference in New Issue
Block a user