public PaymentResult Pay(PaymentRequest request) { var paymentMethod = _context.Database.Repository<Core.PaymentMethod>().Find(request.PaymentMethodId); var payment = new Kooboo.Commerce.Payments.Payment(request.OrderId, request.Amount, paymentMethod, request.Description); var paymentService = new Core.PaymentService(_context.Instance); paymentService.Create(payment); // TODO: Consider move ProcessPayment to PaymentService var processor = _paymentProcessorProvider.FindByName(paymentMethod.ProcessorName); object config = null; if (processor.ConfigType != null) { config = paymentMethod.LoadProcessorConfig(processor.ConfigType); } var processResult = processor.Process(new Kooboo.Commerce.Payments.PaymentProcessingContext(payment, config) { CurrencyCode = request.CurrencyCode, ReturnUrl = request.ReturnUrl, Parameters = request.Parameters }); paymentService.AcceptProcessResult(payment, processResult); return new PaymentResult { Message = processResult.Message, PaymentId = payment.Id, PaymentStatus = (Kooboo.Commerce.Api.Payments.PaymentStatus)(int)processResult.PaymentStatus, RedirectUrl = processResult.RedirectUrl }; }
public PaymentResult Pay(PaymentRequest request) { var paymentMethod = _context.Database.Repository <Core.PaymentMethod>().Find(request.PaymentMethodId); var payment = new Kooboo.Commerce.Payments.Payment(request.OrderId, request.Amount, paymentMethod, request.Description); var paymentService = new Core.PaymentService(_context.Instance); paymentService.Create(payment); // TODO: Consider move ProcessPayment to PaymentService var processor = _paymentProcessorProvider.FindByName(paymentMethod.ProcessorName); object config = null; if (processor.ConfigType != null) { config = paymentMethod.LoadProcessorConfig(processor.ConfigType); } var processResult = processor.Process(new Kooboo.Commerce.Payments.PaymentProcessingContext(payment, config) { CurrencyCode = request.CurrencyCode, ReturnUrl = request.ReturnUrl, Parameters = request.Parameters }); paymentService.AcceptProcessResult(payment, processResult); return(new PaymentResult { Message = processResult.Message, PaymentId = payment.Id, PaymentStatus = (Kooboo.Commerce.Api.Payments.PaymentStatus)(int) processResult.PaymentStatus, RedirectUrl = processResult.RedirectUrl }); }
public iDealController( SettingService keyValueService, PaymentService paymentService, PaymentMethodService paymentMethodService) { _keyValueService = keyValueService; _paymentService = paymentService; _paymentMethodService = paymentMethodService; }
public BuckarooController(PaymentService paymentService, PaymentMethodService paymentMethodService) { _paymentService = paymentService; _paymentMethodService = paymentMethodService; }
public HomeController(PaymentService paymentService, PaymentMethodService paymentMethodService) { _paymentService = paymentService; _paymentMethodService = paymentMethodService; }