public void AddOptions(CheckoutShoppingCartRequest request, CheckoutOptions options) { request.EditCartUrl = options.EditCartUrl; request.ContinueShoppingUrl = options.ContinueShoppingUrl; request.RequestBuyerPhoneNumber = options.RequestBuyerPhoneNumber; request.AnalyticsData = options.AnalyticsData; }
public GoogleCheckoutRedirect RequestCheckout(ShoppingCart shoppingCart, CheckoutOptions options = null, IEnumerable<ShippingMethod> shippingMethods = null) { if (shoppingCart == null) throw new ArgumentNullException("shoppingCart"); _logger.Log("RequestCheckout.Request", shoppingCart); var request = _requestBuilder.CreateRequest(shoppingCart); if (options != null) _requestBuilder.AddOptions(request, options); if (shippingMethods != null) _requestBuilder.AddShippingMethods(request, shippingMethods); var response = request.Send(); _logger.Log("RequestCheckout.Response", response); var redirect = new GoogleCheckoutRedirect { GoogleResponse = response.ResponseXml, RedirectUrl = response.RedirectUrl, Status = response.IsGood ? PaymentStatus.Pending : PaymentStatus.Failed }; if (!response.IsGood) { redirect.IsSystemFailure = true; redirect.FailureMessage = response.ErrorMessage; } return redirect; }
public GoogleCheckoutRedirect RequestCheckout(ShoppingCart shoppingCart, CheckoutOptions options = null, IEnumerable <ShippingMethod> shippingMethods = null) { if (shoppingCart == null) { throw new ArgumentNullException("shoppingCart"); } _logger.Log("RequestCheckout.Request", shoppingCart); var request = _requestBuilder.CreateRequest(shoppingCart); if (options != null) { _requestBuilder.AddOptions(request, options); } if (shippingMethods != null) { _requestBuilder.AddShippingMethods(request, shippingMethods); } var response = request.Send(); _logger.Log("RequestCheckout.Response", response); var redirect = new GoogleCheckoutRedirect { GoogleResponse = response.ResponseXml, RedirectUrl = response.RedirectUrl, Status = response.IsGood ? PaymentStatus.Pending : PaymentStatus.Failed }; if (!response.IsGood) { redirect.IsSystemFailure = true; redirect.FailureMessage = response.ErrorMessage; } return(redirect); }