コード例 #1
0
 public JsonResult GetCardPaymentAcceptUrl()
 {
     try
     {
         var response = this.PaymentManager.GetPaymentServiceUrl(CommerceUserContext.Current.UserId);
         var result   = new CardPaymentAcceptUrlApiModel(response.ServiceProviderResult);
         return(Json(result, JsonRequestBehavior.AllowGet));
     }
     catch (Sitecore.Commerce.OpenIDConnectionClosedUnexpectedlyException e)
     {
         return(Json(new ErrorApiModel("Login", e), JsonRequestBehavior.AllowGet));
     }
     catch (Exception e)
     {
         return(Json(new ErrorApiModel("GetCardPaymentAcceptUrl", e), JsonRequestBehavior.AllowGet));
     }
 }
コード例 #2
0
        private void InitPaymentUrl(CheckoutViewModel model)
        {
            if (!String.IsNullOrEmpty(model.PaymentUrl))
            {
                return;
            }

            var response = this.PaymentManager.GetPaymentServiceUrl(CommerceUserContext.Current.UserId);
            var result   = new CardPaymentAcceptUrlApiModel(response.ServiceProviderResult);

            if (!response.ServiceProviderResult.Success || response.Result == null)
            {
                return;
            }

            model.PaymentUrl    = result.ServiceUrl;
            model.MessageOrigin = result.MessageOrigin;
        }