コード例 #1
0
        public ActionResult ProcessPayment(FormCollection form)
        {
            string requestId = _paymentProvider.GenerateUniqueIdentifier();

            this.Session["RequestId"] = requestId;


            var xfer = new GeneralisedPaymentTransfer()
            {
                Amount        = decimal.Parse(form["Amount"]), // -> "AMOUNT"
                ReturnUrl     = "http://localhost:59412" + Url.Action("ProviderCallback", "Capita"),
                TransactionId = requestId
            };

            PaymentProviderConfiguration providerConfig = new PaymentProviderConfiguration()
            {
                AccountIdentifer = this._capitaMerchantid,
                SharedSecret     = this._capitaSecretKey,
                SubAccountNumber = this._capitaScpid
            };

            xfer.Account           = this._capitaScpid;
            xfer.VariableReference = "164 Wandsworth Borough Council";
            xfer.Comment1          = "Activity : After school club";
            xfer.Comment2          = "PS56789/456";
            xfer.CustomerNumber    = "50939";
            xfer.GeneralLedgerCode = "WE333292049,WE330192071,WE333592049,WE333792049";
            xfer.IsMediated        = false;
            xfer.ProductId         = "56789";
            //xfer.VatCode = CapitaVatCode.StandardRate;
            //xfer.VatRate = 20;
            xfer.VatCode = CapitaVatCode.ZeroRate;
            xfer.VatRate = 0;
            //xfer.SaveCard = new SaveCard()
            //{
            //    PayerReference = "s12u34"
            //};
            xfer.LineItems = new System.Collections.Generic.List <CivicaLineItem>()
            {
                new CivicaLineItem()
                {
                    Amount    = decimal.Parse(form["Amount"]),
                    FundCode  = "16",
                    Narrative = "Play Service booking MULTI_153997_112816_138579",
                    Reference = "56789"
                }
            };

            var result = _paymentProvider.SendToPaymentProvider(providerConfig, xfer, SaveProviderReference);

            string rawHtml = PaymentFrameworkUtility.DescribeActionResultForLogging(result);

            System.Diagnostics.Trace.WriteLine(rawHtml);
            System.Diagnostics.Trace.WriteLine("Provider Reference: " + this.Session["ProviderReference"]);

            return(result);
        }
コード例 #2
0
        public ActionResult ProcessPayment(FormCollection form)
        {
            var xfer = new GeneralisedPaymentTransfer()
            {
                Amount            = decimal.Parse(form["Amount"]),               // -> "AMOUNT"
                ReturnUrl         = "http://localhost:59412" + Url.Action("ProviderCallback", "Default"),
                TransactionId     = _paymentProvider.GenerateUniqueIdentifier(), // -> "ORDER_ID"
                GeneralLedgerCode = "SOMECIVICACODE"
            };

            PaymentProviderConfiguration providerConfig = new PaymentProviderConfiguration()
            {
                AccountIdentifer = _realExMerchantid,
                SharedSecret     = _realExSecretKey
            };

            xfer.Account           = "";
            xfer.VariableReference = "";
            xfer.Comment1          = "";
            xfer.Comment2          = "";
            xfer.LineItems.Add(new CivicaLineItem()
            {
                Reference = "LINEREF",
                Amount    = 10.00m,
                Narrative = "Stuff paid for",
                FundCode  = "FUND"
            });

            var result = _paymentProvider.SendToPaymentProvider(providerConfig, xfer, null);

            string rawHtml = PaymentFrameworkUtility.DescribeActionResultForLogging(result);

            System.Diagnostics.Trace.WriteLine(rawHtml);

            return(result);
        }