public ActionResult AttachPayPal()
        {
            try
            {
                var callback = Url.Action("Success", "PaymentAccounts", new { Area = "Customer" }, "https");
                var response = PayPalServiceHelper.GetRequestPermissionsUrl(callback);

                return(Redirect(response.Url));
            }
            catch (Exception e)
            {
                Log.Warn("Adding paypal failed", e);
                return(View("PPAttachError"));
            }
        }
 public JsonResult GetRequestPermissionsUrl()
 {
     try
     {
         var callback = Url.Action("Success", "PaymentAccounts", new { Area = "Customer" }, "https");
         var url      = PayPalServiceHelper.GetRequestPermissionsUrl(callback);
         return(Json(new { url = url }, JsonRequestBehavior.AllowGet));
     }
     catch (PayPalException ex)
     {
         return(Json(new { error = ex.ErrorDetails }, JsonRequestBehavior.AllowGet));
     }
     catch (Exception ex)
     {
         return(Json(new { error = ex.Message }, JsonRequestBehavior.AllowGet));
     }
 }