Exemplo n.º 1
0
        public ChangeTransactionStatusRequest CreateChangeTransactionStatusRequest(Shop shop, string wsPayOrderId, string stan, string approvalCode, double price)
        {
            var formattedPrice = WSPayHelpers.FormatPrice(price);
            var signature      =
                signatureFactory.GenerateChangeTransactionStatusSignature(shop, wsPayOrderId, stan,
                                                                          approvalCode, price);

            return(new ChangeTransactionStatusRequest
            {
                WSPayOrderId = wsPayOrderId,
                ShopId = shop.ShopId,
                Amount = formattedPrice,
                Stan = stan,
                ApprovalCode = approvalCode,
                Signature = signature
            });
        }
Exemplo n.º 2
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 FormatPrice()
        {
            var actual = WSPayHelpers.FormatPrice(15.25);

            actual.Should().Be("1525");
        }
        public void FormatPrice_WithRounding()
        {
            var actual = WSPayHelpers.FormatPrice(15.257);

            actual.Should().Be("1526");
        }