public void UpdateTo(PaymentMethod method)
 {
     method.Name = Name;
     method.UserKey = UserKey;
     method.ProcessorName = ProcessorName;
     method.AdditionalFeeChargeMode = AdditionalFeeChargeMode;
     method.AdditionalFeeAmount = AdditionalFeeAmount;
     method.AdditionalFeePercent = AdditionalFeePercent;
 }
Esempio n. 2
0
        public bool Enable(PaymentMethod method)
        {
            if (method.MarkEnabled())
            {
                _repository.Database.SaveChanges();
                Event.Raise(new PaymentMethodEnabled(method), _instance);
                return true;
            }

            return false;
        }
Esempio n. 3
0
 public Payment(int orderId, decimal amount, PaymentMethod method, string description)
 {
     OrderId = orderId;
     Amount = amount;
     PaymentMethodId = method.Id;
     PaymentMethodName = method.Name;
     PaymentProcessorName = method.ProcessorName;
     PaymentMethodCost = method.GetPaymentMethodCost(amount);
     Description = description;
     CreatedAtUtc = DateTime.UtcNow;
 }
Esempio n. 4
0
        public PaymentMethodRowModel(PaymentMethod method)
        {
            Id = method.Id;
            DisplayName = method.Name;
            PaymentProcessorName = method.ProcessorName;
            IsEnabled = method.IsEnabled;
            CreatedAt = method.CreatedAtUtc.ToLocalTime();

            if (method.AdditionalFeeChargeMode == PaymentMethodFeeChargeMode.ByPercent)
            {
                AdditionalFee = method.AdditionalFeePercent.ToString("#.##") + "%";
            }
            else
            {
                AdditionalFee = method.AdditionalFeeAmount.ToString("f2");
            }
        }
        public ActionResult BasicInfo(PaymentMethodEditorModel model, string @return)
        {
            PaymentMethod method = null;

            if (model.Id > 0)
            {
                method = _paymentMethodService.Find(model.Id);
                model.UpdateTo(method);
            }
            else
            {
                method = new PaymentMethod();
                model.UpdateTo(method);
                _paymentMethodService.Create(method);
            }

            if (model.Id > 0)
            {
                CurrentInstance.Database.SaveChanges();
            }

            string redirectUrl = null;
            var processor = _processorProvider.FindByName(method.ProcessorName);

            var editor = processor as IHasCustomPaymentProcessorConfigEditor;
            if (editor != null || processor.ConfigType != null)
            {
                redirectUrl = Url.Action("Processor", RouteValues.From(Request.QueryString).Merge("id", method.Id));
            }
            else
            {
                redirectUrl = Url.Action("Complete", RouteValues.From(Request.QueryString).Merge("id", method.Id));
            }

            return AjaxForm().RedirectTo(redirectUrl);
        }
Esempio n. 6
0
 public PaymentMethodInfo(PaymentMethod method)
 {
     Id = method.Id;
     Name = method.Name;
     ProcessorName = method.ProcessorName;
 }
Esempio n. 7
0
 public PaymentMethodCreated(PaymentMethod method)
 {
     PaymentMethodId = method.Id;
 }
Esempio n. 8
0
 public PaymentMethodDeleted(PaymentMethod method)
 {
     PaymentMethodId = method.Id;
     PaymentMethodName = method.Name;
 }
Esempio n. 9
0
 public PaymentMethodUpdated(PaymentMethod method)
 {
     PaymentMethodId = method.Id;
 }
Esempio n. 10
0
 public PaymentMethodDisabled(PaymentMethod method)
 {
     PaymentMethodId = method.Id;
 }
Esempio n. 11
0
 public void Delete(PaymentMethod method)
 {
     _repository.Delete(method);
 }
Esempio n. 12
0
 public void Create(PaymentMethod method)
 {
     _repository.Insert(method);
 }
Esempio n. 13
0
 public void Delete(PaymentMethod method)
 {
     _repository.Delete(method);
 }
Esempio n. 14
0
 public void Create(PaymentMethod method)
 {
     _repository.Insert(method);
 }