private static DataModel.Store CreateInitialStoreForPortal(PortalSettings portalSettings)
        {
            //--- Create the Store for this Portal
            DataModel.Store newStore = new DataModel.Store();
            newStore.PortalId = portalSettings.PortalId;
            newStore.Name     = portalSettings.PortalName;
            newStore.Save();

            //--- Set some sensible default settings
            newStore.UpdateSetting(StoreSettingNames.OrderCompletedEmailRecipient, portalSettings.Email);
            newStore.UpdateSetting(StoreSettingNames.CustomerServiceEmailAddress, portalSettings.Email);

            //--- Copy over the default email templates
            newStore.AddMissingEmailTemplates();

            //--- Set the default payment processor to 'CardCaptureOnly'
            CardCaptureOnlyPaymentProvider cardCapturePaymentProvider = new CardCaptureOnlyPaymentProvider(newStore.GetPaymentProviderConfig(PaymentProviderName.CardCaptureOnly));

            cardCapturePaymentProvider.IsEnabled = true;
            newStore.UpdatePaymentProviderConfig(cardCapturePaymentProvider.GetConfiguration());


            //--- Add a default shipping service and rate type
            var newShippingService = new DataModel.ShippingService();

            newShippingService.StoreId = newStore.Id.Value;
            newShippingService.ShippingProviderType = (short)ShippingProviderType.CustomShipping;
            newShippingService.Save();
            Dictionary <string, string> settings = newShippingService.GetSettingsDictionary();

            settings["IsEnabled"] = true.ToString();
            newShippingService.UpdateSettingsDictionary(settings);
            var newRateType = new DataModel.ShippingServiceRateType();

            newRateType.ShippingServiceId = newShippingService.Id.Value;
            newRateType.Name        = "Standard";
            newRateType.DisplayName = "Standard";
            newRateType.Save();

            var fedexService = new DataModel.ShippingService();

            fedexService.StoreId = newStore.Id.Value;
            fedexService.ShippingProviderType = (short)ShippingProviderType.FedEx;
            fedexService.Save();
            Dictionary <string, string> fedexSettings = fedexService.GetSettingsDictionary();

            fedexSettings["IsEnabled"] = false.ToString();
            fedexService.UpdateSettingsDictionary(fedexSettings);

            return(newStore);
        }
Beispiel #2
0
        internal void MarkAsPaid()
        {
            Store store = this.UpToStoreByStoreId;

            if (this.GetPaymentProviderName().ToLower() == "paylater")
            {
                PayLaterPaymentProvider payLaterProvider = new PayLaterPaymentProvider(store.GetPaymentProviderConfig(PaymentProviderName.PayLater));
                payLaterProvider.MarkOrderAsPaid(this.Id.Value);
            }
            else
            {
                CardCaptureOnlyPaymentProvider cardCaptureOnlyPaymentProvider = new CardCaptureOnlyPaymentProvider(store.GetPaymentProviderConfig(PaymentProviderName.CardCaptureOnly));
                cardCaptureOnlyPaymentProvider.MarkOrderAsPaid(this.Id.Value);
            }

            PostCheckoutController.AddUserToDnnRoles(this);
        }