/// <summary>
        /// 計算運費
        /// </summary>
        /// <param name="deliveryItem">宅配資料</param>
        /// <returns>運費</returns>
        public double Calculate(DeliveryEntity deliveryItem)
        {
            if (deliveryItem == null)
            {
                throw new ArgumentException("請檢查 deliveryItem 參數");
            }

            ICalculateFeeService calculateFeeService =
                this._calculateFeeDictionary.FirstOrDefault(x => x.Key(deliveryItem.DeliveryType)).Value;

            return(calculateFeeService.CalculateFee(deliveryItem));
        }
        public FeeChargePreExecutionPlugin(IHostSmartContractBridgeContextService contextService,
                                           IPrimaryTokenSymbolProvider primaryTokenSymbolProvider,
                                           ITransactionSizeFeeUnitPriceProvider transactionSizeFeeUnitPriceProvider,
                                           ITransactionFeeExemptionService transactionFeeExemptionService,
                                           ICalculateFeeService calService)
        {
            _contextService                      = contextService;
            _primaryTokenSymbolProvider          = primaryTokenSymbolProvider;
            _transactionSizeFeeUnitPriceProvider = transactionSizeFeeUnitPriceProvider;
            _calService = calService;
            _transactionFeeExemptionService = transactionFeeExemptionService;

            Logger = NullLogger <FeeChargePreExecutionPlugin> .Instance;
        }
 public ResourceConsumptionPostExecutionPlugin(IHostSmartContractBridgeContextService contextService,
                                               ICalculateFeeService calService)
 {
     _contextService = contextService;
     _calService     = calService;
 }
Beispiel #4
0
 public TranfersController(ICalculateFeeService calculateFeeService)
 {
     _calculateFeeService = calculateFeeService ?? throw new ArgumentNullException(nameof(calculateFeeService));
 }