public string GetPaymentServiceUrl() { var cart = this._cartService.GetCart(); var billingAddress = this._cartService.GetBillingAddress(); var request = new GetPaymentServiceUrlRequest() { AllowPartialAuthorization = false, AllowVoiceAuthorization = false, CardType = CardType.AllCardTypes, City = billingAddress.City, ColumnNumber = 1, Country = billingAddress.Country, CurrencyCode = cart.CurrencyCode, DisabledTextBackgroundColor = "#E4E4E4", FontFamily = "\"Helvetica Neue\", Helvetica, Arial, sans-serif", FontSize = "14px", IndustryType = "Ecommerce", LabelColor = "black", Locale = Context.Culture.Name, PageBackgroundColor = "white", PageWidth = "429px", PostalCode = billingAddress.ZipPostalCode, PurchaseLevel = PurchaseLevel.Level1, ShowSameAsShippingAddress = false, State = billingAddress.State, StreetAddress = billingAddress.Address1, SupportCardSwipe = false, SupportCardTokenization = true, TextBackgroundColor = "white", TextColor = "black", TransactionType = TransactionType.Authorize, }; if (HttpContext.Current != null && HttpContext.Current.Request != null) { request.HostPageOrigin = string.Format( System.Globalization.CultureInfo.InvariantCulture, "{0}://{1}", HttpContext.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Authority); } if (!string.IsNullOrWhiteSpace(billingAddress.Address2)) { request.StreetAddress = request.StreetAddress + Environment.NewLine + billingAddress.Address2; } if (string.IsNullOrWhiteSpace(request.CurrencyCode)) { request.CurrencyCode = "USD"; } var result = this._paymentServiceProvider.GetPaymentServiceUrl(request); return(result.Url ?? string.Empty); }
/// <summary> /// Gets the payment service URL. /// </summary> /// <returns>PaymentService Url</returns> public ManagerResponse <GetPaymentServiceUrlResult, string> GetPaymentServiceUrl(string userId) { var request = new GetPaymentServiceUrlRequest(); if (HttpContext.Current != null && HttpContext.Current.Request != null) { request.HostPageOrigin = string.Format( System.Globalization.CultureInfo.InvariantCulture, "{0}://{1}", HttpContext.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Authority); } if (!Context.User.IsAuthenticated) { request.Properties["CartId"] = userId; } var result = this.PaymentServiceProvider.GetPaymentServiceUrl(request); result.WriteToSitecoreLog(); return(new ManagerResponse <GetPaymentServiceUrlResult, string>(result, result.Url ?? string.Empty)); }
private string GetBasePaymentServiceUrl(GetPaymentServiceUrlRequest request, GetPaymentServiceUrlResult result, List <PaymentProperty> serviceRequestProperties) { var getPaymentAcceptPointResponse = this.ExecutePaymentServiceRequest( serviceRequestProperties, GetPaymentAcceptPointRelativeUri, request.Locale, result.SystemMessages); if (getPaymentAcceptPointResponse != null) { var getPaymentAcceptPointResponseProperties = PaymentProperty.ConvertToHashtable(getPaymentAcceptPointResponse.Properties); var paymentAcceptUrl = string.Empty; PaymentProperty.GetPropertyValue( getPaymentAcceptPointResponseProperties, GenericNamespace.TransactionData, TransactionDataProperties.PaymentAcceptUrl, out paymentAcceptUrl); return(paymentAcceptUrl); } return(string.Empty); }