/// <summary>
        /// Set express checkout
        /// </summary>
        /// <param name="controller"></param>
        /// <param name="operation"></param>
        /// <returns></returns>
        public static PayPalSetExpressCheckoutResult SetExpressCheckout(this Controller controller, PayPalSetExpressCheckoutOperation operation, [AspMvcAction] string confirmAction, [AspMvcAction] string cancelAction, object routeData = null)
        {
            if (controller == null)
            {
                throw new ArgumentNullException("controller");
            }

            if (operation == null)
            {
                throw new ArgumentNullException("request");
            }

            var operationToUse = operation;

            if (string.IsNullOrWhiteSpace(operationToUse.CancelURL) || string.IsNullOrWhiteSpace(operationToUse.ReturnURL))
            {
                // Need to clone to avoid side effect on passed object.
                if (operationToUse == operation)
                {
                    operationToUse = operation.Clone();
                }

                SetupExpressCheckoutUrls(controller, operationToUse, confirmAction, cancelAction, routeData);
            }

            // Calling the PayPal API, and returning the result.
            var settings = DependencyResolver.Current.GetService <IPayPalApiSettings>();
            var api      = new PayPalApiConfigurable(settings ?? new PayPalApiSettingsFromConfigurationManager());
            var response = api.SetExpressCheckout(operationToUse);

            return(response);
        }
        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);
        }