Exemplo n.º 1
0
        public ProcessPaymentRequest CreateProcessPaymentRequest(string shoppingCartId, double price, string token, string tokenNumber)
        {
            var shop = WSPayConfiguration.TokenShop;

            var formattedPrice = WSPayHelpers.FormatPrice(price);
            var signature      = signatureFactory.GenerateFormRequestSignature(WSPayConfiguration.TokenShop, shoppingCartId,
                                                                               price);

            return(new ProcessPaymentRequest
            {
                ShopId = shop.ShopId,
                ShoppingCartId = shoppingCartId,
                TotalAmount = formattedPrice,
                Signature = signature,
                Token = token,
                TokenNumber = tokenNumber,
                DateTime = timeProvider.Get().ToString("yyyyMMddHHmmss")
            });
        }
        public void GenerateFormRequestSignature()
        {
            var actual = signatureFactory.GenerateFormRequestSignature(RegularShop, "testCartId", 15.25);

            actual.Should().Be("9a2235f5a4ef2e0d4a5036e9647a2522");
        }