示例#1
0
    /// <summary>
    /// Processes the specified arguments.
    /// </summary>
    /// <param name="args">The arguments.</param>
    public virtual void Process(PipelineArgs args)
    {
      Assert.ArgumentNotNull(args, "args");

      ShoppingCart shoppingCart = Context.Entity.GetInstance<ShoppingCart>();
      PaymentProvider paymentProvider = Context.Entity.Resolve<PaymentProvider>(shoppingCart.PaymentSystem.Code);

      PaymentUrlResolver paymentUrlResolver = new PaymentUrlResolver();
      PaymentArgs paymentArgs = new PaymentArgs
      {
        ShoppingCart = shoppingCart,
        PaymentUrls = paymentUrlResolver.Resolve(),
      };

      StringBuilder description = new StringBuilder();
      foreach (ShoppingCartLine shoppingCartLine in shoppingCart.ShoppingCartLines)
      {
        description.Append(shoppingCartLine.Product.Title);
        description.Append(", ");
      }

      paymentArgs.Description = description.ToString().Trim().TrimEnd(',');

      paymentProvider.Invoke(shoppingCart.PaymentSystem, paymentArgs);

      args.AbortPipeline();
    }
        public override void InvokePayment()
        {
            PaymentUrlResolver paymentUrlResolver = new PaymentUrlResolver();
            PaymentArgs        paymentArgs        = new PaymentArgs
            {
                PaymentUrls  = paymentUrlResolver.Resolve(),
                ShoppingCart = this.ShoppingCart,
                Description  = this.Description
            };

            this.Invoke(this.PaymentSystem, paymentArgs);
        }
        public virtual void ProcessPaymentCallBack([NotNull] HttpRequest request)
        {
            Assert.ArgumentNotNull(request, "request");

            Assert.IsNotNull(this.ShoppingCart, "Shopping cart is null");

            PaymentUrlResolver paymentUrlResolver = new PaymentUrlResolver();
            PaymentArgs        paymentArgs        = new PaymentArgs
            {
                PaymentUrls  = paymentUrlResolver.Resolve(),
                ShoppingCart = this.ShoppingCart,
                Description  = this.Description
            };

            this.ProcessCallback(this.PaymentSystem, paymentArgs);
        }