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

            return false;
        }
Example #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;
 }
        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);
        }
Example #6
0
 public PaymentMethodInfo(PaymentMethod method)
 {
     Id = method.Id;
     Name = method.Name;
     ProcessorName = method.ProcessorName;
 }
Example #7
0
 public PaymentMethodCreated(PaymentMethod method)
 {
     PaymentMethodId = method.Id;
 }
Example #8
0
 public PaymentMethodDeleted(PaymentMethod method)
 {
     PaymentMethodId = method.Id;
     PaymentMethodName = method.Name;
 }
Example #9
0
 public PaymentMethodUpdated(PaymentMethod method)
 {
     PaymentMethodId = method.Id;
 }
Example #10
0
 public PaymentMethodDisabled(PaymentMethod method)
 {
     PaymentMethodId = method.Id;
 }
Example #11
0
 public void Delete(PaymentMethod method)
 {
     _repository.Delete(method);
 }
Example #12
0
 public void Create(PaymentMethod method)
 {
     _repository.Insert(method);
 }
Example #13
0
 public void Delete(PaymentMethod method)
 {
     _repository.Delete(method);
 }
Example #14
0
 public void Create(PaymentMethod method)
 {
     _repository.Insert(method);
 }