Ejemplo n.º 1
0
        /// <summary>
        /// Calculate payment method fee
        /// </summary>
        /// <param name="paymentMethod">Payment method</param>
        /// <param name="subscriptionTotalCalculationService">Subscription total calculation service</param>
        /// <param name="cart">Shopping cart</param>
        /// <param name="fee">Fee value</param>
        /// <param name="usePercentage">Is fee amount specified as percentage or fixed value?</param>
        /// <returns>Result</returns>
        public static decimal CalculateAdditionalFee(this IPaymentMethod paymentMethod,
                                                     ISubscriptionTotalCalculationService subscriptionTotalCalculationService, IList <ShoppingCartItem> cart,
                                                     decimal fee, bool usePercentage)
        {
            if (paymentMethod == null)
            {
                throw new ArgumentNullException("paymentMethod");
            }
            if (fee <= 0)
            {
                return(fee);
            }

            decimal result;

            if (usePercentage)
            {
                //percentage
                var subscriptionTotalWithoutPaymentFee = subscriptionTotalCalculationService.GetShoppingCartTotal(cart, usePaymentMethodAdditionalFee: false);
                result = (decimal)((((float)subscriptionTotalWithoutPaymentFee) * ((float)fee)) / 100f);
            }
            else
            {
                //fixed value
                result = fee;
            }
            return(result);
        }
Ejemplo n.º 2
0
        public SubscriptionModelFactory(IAddressModelFactory addressModelFactory,
                                        ISubscriptionService subscriptionService,
                                        IWorkContext workContext,
                                        ICurrencyService currencyService,
                                        IPriceFormatter priceFormatter,
                                        ISubscriptionProcessingService subscriptionProcessingService,
                                        IDateTimeHelper dateTimeHelper,
                                        IPaymentService paymentService,
                                        ILocalizationService localizationService,
                                        ICountryService countryService,
                                        IArticleAttributeParser articleAttributeParser,
                                        IDownloadService downloadService,
                                        IStoreContext storeContext,
                                        ISubscriptionTotalCalculationService subscriptionTotalCalculationService,
                                        IRewardPointService rewardPointService,
                                        CatalogSettings catalogSettings,
                                        SubscriptionSettings subscriptionSettings,
                                        TaxSettings taxSettings,
                                        AddressSettings addressSettings,
                                        RewardPointsSettings rewardPointsSettings,
                                        PdfSettings pdfSettings)
        {
            this._addressModelFactory                 = addressModelFactory;
            this._subscriptionService                 = subscriptionService;
            this._workContext                         = workContext;
            this._currencyService                     = currencyService;
            this._priceFormatter                      = priceFormatter;
            this._subscriptionProcessingService       = subscriptionProcessingService;
            this._dateTimeHelper                      = dateTimeHelper;
            this._paymentService                      = paymentService;
            this._localizationService                 = localizationService;
            this._countryService                      = countryService;
            this._articleAttributeParser              = articleAttributeParser;
            this._downloadService                     = downloadService;
            this._storeContext                        = storeContext;
            this._subscriptionTotalCalculationService = subscriptionTotalCalculationService;
            this._rewardPointService                  = rewardPointService;

            this._catalogSettings      = catalogSettings;
            this._subscriptionSettings = subscriptionSettings;
            this._taxSettings          = taxSettings;
            this._addressSettings      = addressSettings;
            this._rewardPointsSettings = rewardPointsSettings;
            this._pdfSettings          = pdfSettings;
        }
Ejemplo n.º 3
0
        public CheckoutModelFactory(IAddressModelFactory addressModelFactory,
                                    IWorkContext workContext,
                                    IStoreContext storeContext,
                                    IStoreMappingService storeMappingService,
                                    ILocalizationService localizationService,
                                    ITaxService taxService,
                                    ICurrencyService currencyService,
                                    IPriceFormatter priceFormatter,
                                    ISubscriptionProcessingService subscriptionProcessingService,
                                    IGenericAttributeService genericAttributeService,
                                    ICountryService countryService,
                                    IStateProvinceService stateProvinceService,
                                    IPaymentService paymentService,
                                    ISubscriptionTotalCalculationService subscriptionTotalCalculationService,
                                    IRewardPointService rewardPointService,
                                    IWebHelper webHelper,
                                    SubscriptionSettings subscriptionSettings,
                                    RewardPointsSettings rewardPointsSettings,
                                    PaymentSettings paymentSettings,
                                    AddressSettings addressSettings)
        {
            this._addressModelFactory                 = addressModelFactory;
            this._workContext                         = workContext;
            this._storeContext                        = storeContext;
            this._storeMappingService                 = storeMappingService;
            this._localizationService                 = localizationService;
            this._taxService                          = taxService;
            this._currencyService                     = currencyService;
            this._priceFormatter                      = priceFormatter;
            this._subscriptionProcessingService       = subscriptionProcessingService;
            this._genericAttributeService             = genericAttributeService;
            this._countryService                      = countryService;
            this._stateProvinceService                = stateProvinceService;
            this._paymentService                      = paymentService;
            this._subscriptionTotalCalculationService = subscriptionTotalCalculationService;
            this._rewardPointService                  = rewardPointService;
            this._webHelper = webHelper;

            this._subscriptionSettings = subscriptionSettings;
            this._rewardPointsSettings = rewardPointsSettings;
            this._paymentSettings      = paymentSettings;
            this._addressSettings      = addressSettings;
        }