Example #1
0
        public virtual PayPalDoExpressCheckoutPaymentResult DoExpressCheckoutPayment(PayPalDoExpressCheckoutPaymentOperation operation)
        {
            // reference:
            // https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_DoExpressCheckoutPayment

            // sample code:
            // None!

            return(ApiCall <PayPalDoExpressCheckoutPaymentApiResult>(operation));
        }
Example #2
0
        public ActionResult PayPalConfirm(PayPalExpressCheckoutConfirmation data)
        {
            var operation = new PayPalDoExpressCheckoutPaymentOperation
            {
                PayerId = data.PayerId,
                Token   = data.Token,
            };

            this.FillOperationDetails(operation, true);

            this.DoExpressCheckoutPayment(operation);

            return(this.RedirectToAction("PaymentConfirmed"));
        }
        public static PayPalDoExpressCheckoutPaymentResult DoExpressCheckoutPayment(this Controller controller, PayPalDoExpressCheckoutPaymentOperation operation)
        {
            // Calling the PayPal API, and returning the result.
            var settings = DependencyResolver.Current.GetService <IPayPalApiSettings>();
            var api      = new PayPalApiConfigurable(settings ?? new PayPalApiSettingsFromConfigurationManager());
            var response = api.DoExpressCheckoutPayment(operation);

            return(response);
        }
        public ActionResult PayPalConfirm(string practice, PayPalExpressCheckoutConfirmation data)
        {
            var mainContract = dbPractice.AccountContract;

            var billing = db.Billings.Single(b => b.PracticeId == dbPractice.Id
                && b.MainAccountContractId == dbPractice.ActiveAccountContractId
                && b.ReferenceDate == null);

            var utcNow = this.GetUtcNow();

            dbPractice.VerificationDate = utcNow;
            dbPractice.VerificationMethod = "PAYMENT";
            mainContract.StartDate = utcNow;
            mainContract.IsPartialBillingInfo = false;
            billing.ReferenceDate = utcNow;
            if (mainContract.BillingPeriodType == "M" && mainContract.BillingPeriodSize.HasValue)
                billing.ReferenceDateEnd = utcNow.AddMonths(mainContract.BillingPeriodSize.Value);
            else
                throw new NotImplementedException();

            this.db.SaveChanges();

            var operation = new PayPalDoExpressCheckoutPaymentOperation
            {
                PayerId = data.PayerId,
                Token = data.Token,
            };
            ConfigAccountController.FillOperationDetails(operation, dbPractice, mainContract, billing);

            this.DoExpressCheckoutPayment(operation);

            return this.RedirectToAction("PayPalConfirmed", new { practice });
        }
Example #5
0
        public override PayPalDoExpressCheckoutPaymentResult DoExpressCheckoutPayment(PayPalDoExpressCheckoutPaymentOperation operation)
        {
            var operationToUse = operation;

            SetupCredential(operation, ref operationToUse);

            SetupDefaultCurrencyCode(operation, ref operationToUse);

            return(base.DoExpressCheckoutPayment(operationToUse));
        }
        /// <summary>
        /// Action that termitates the payment process, and then redirects to PaymentConfirmed action.
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public ActionResult PayPalConfirm(PayPalExpressCheckoutConfirmation data)
        {
            var operation = new PayPalDoExpressCheckoutPaymentOperation
            {
                PayerId = data.PayerId,
                Token = data.Token,
            };
            FillOperationDetails(operation, null, null, null);

            this.DoExpressCheckoutPayment(operation);

            return this.RedirectToAction("PaymentConfirmed");
        }