static public void Delete(System.Int32 storeId, System.Int16 paymentProviderId, esSqlAccessType sqlAccessType)
        {
            var obj = new StorePaymentProvider();

            obj.StoreId           = storeId;
            obj.PaymentProviderId = paymentProviderId;
            obj.AcceptChanges();
            obj.MarkAsDeleted();
            obj.Save(sqlAccessType);
        }
示例#2
0
        public void UpdatePaymentProviderConfig(ProviderConfig config)
        {
            int storeId = this.Id.Value;

            PaymentProvider provider = PaymentProvider.Get(config.ProviderId.GetValueOrDefault(-1));

            StorePaymentProvider storePaymentProvider = StorePaymentProvider.GetOrCreate(storeId, provider.Id.Value);

            //storePaymentProvider.IsEnabled = config.IsEnabled;
            storePaymentProvider.Save();

            StorePaymentProviderSettingCollection.UpdateSettingsDictionary(storeId, provider.Id.Value, config.Settings);
        }
        public static StorePaymentProvider GetOrCreate(int storeId, short providerId)
        {
            // check if the StorePaymentProvider exists...if not, create it
            StorePaymentProviderQuery q = new StorePaymentProviderQuery();

            q.Where(q.StoreId == storeId, q.PaymentProviderId == providerId);

            StorePaymentProvider storeProvider = new StorePaymentProvider();

            if (!storeProvider.Load(q))
            {
                storeProvider.StoreId           = storeId;
                storeProvider.PaymentProviderId = providerId;
                storeProvider.Save();
            }

            return(storeProvider);
        }