public FormRequest CreateFormRequest(string shoppingCartId, double price, Customer customer, PaymentType paymentType, IReturnUrlProvider returnUrlProvider) { var shop = WSPayConfiguration.RegularShop; var formattedPriceForRegularForm = WSPayHelpers.FormatAmountForRegularShopForm(price); return(new FormRequest { Url = WSPayConfiguration.FormUrl.ToString(), ShopId = shop.ShopId, ShoppingCartID = shoppingCartId, Amount = formattedPriceForRegularForm, Signature = signatureFactory.GenerateFormRequestSignature(shop, shoppingCartId, price), CustomerFirstName = customer?.FirstName, CustomerSurname = customer?.LastName, CustomerEmail = customer?.Email, CustomerAddress = customer?.Address, CustomerPhone = customer?.Phone, IsTokenRequest = paymentType.IsNewTokenRequest, Token = paymentType.Token, TokenNumber = paymentType.TokenNumber, FormattedDateTime = timeProvider.Get().ToString("yyyyMMddHHmmss"), ReturnUrl = returnUrlProvider.GetReturnUrl(), CancelUrl = returnUrlProvider.GetCancelUrl(shoppingCartId), ErrorUrl = returnUrlProvider.GetErrorUrl() }); }
public void FormatAmountForRegularShopForm_Rounded() { var actual = WSPayHelpers.FormatAmountForRegularShopForm(15); actual.Should().Be("15,00"); }
public void FormatAmountForRegularShopForm_WithRounding() { var actual = WSPayHelpers.FormatAmountForRegularShopForm(15.257); actual.Should().Be("15,26"); }
public void FormatAmountForRegularShopForm() { var actual = WSPayHelpers.FormatAmountForRegularShopForm(15.25); actual.Should().Be("15,25"); }