Пример #1
0
        public void Create_EmptyObjects_ValidString()
        {
            var configuration = new KassaConfiguration();
            var request       = new PaymentRequest();

            var result = DataString.Create(configuration, request);

            Assert.AreEqual("merchantId=|keyVersion=1|amount=0|currencyCode=000|normalReturnUrl=|transactionReference=", result);
        }
Пример #2
0
        public void Create_CurrencyCodeIsSetToCanadianDollar_ValidString()
        {
            var configuration = new KassaConfiguration();
            var request       = new PaymentRequest()
            {
                CurrencyCode = CurrencyCode.CanadianDollar
            };

            var result = DataString.Create(configuration, request);

            Assert.AreEqual("merchantId=|keyVersion=1|amount=0|currencyCode=124|normalReturnUrl=|transactionReference=", result);
        }
Пример #3
0
        public void Create_CaptureModeIsSet_ValidString()
        {
            var configuration = new KassaConfiguration();
            var request       = new PaymentRequest()
            {
                CaptureMode = "VALIDATION"
            };

            var result = DataString.Create(configuration, request);

            Assert.AreEqual("merchantId=|keyVersion=1|amount=0|currencyCode=000|normalReturnUrl=|transactionReference=|captureMode=VALIDATION", result);
        }
Пример #4
0
        public void Create_ExpirationDateIsSet_ValidString()
        {
            var configuration = new KassaConfiguration();
            var request       = new PaymentRequest()
            {
                ExpirationDate = new DateTime(2010, 5, 10, 16, 10, 15)
            };

            var result = DataString.Create(configuration, request);

            Assert.AreEqual("merchantId=|keyVersion=1|amount=0|currencyCode=000|normalReturnUrl=|transactionReference=|expirationDate=2010-05-10T16:10:15", result);
        }
Пример #5
0
        public void Create_PaymentBrandsIsSetWithMultipleValues_ValidString()
        {
            var configuration = new KassaConfiguration();
            var request       = new PaymentRequest()
            {
                PaymentBrands = new PaymentBrand[] { PaymentBrand.IDEAL, PaymentBrand.MASTERCARD, PaymentBrand.VISA }
            };

            var result = DataString.Create(configuration, request);

            Assert.AreEqual("merchantId=|keyVersion=1|amount=0|currencyCode=000|normalReturnUrl=|transactionReference=|paymentMeanBrandList=IDEAL,MASTERCARD,VISA", result);
        }
Пример #6
0
        public void Create_LanguageIsSet_ValidString()
        {
            var configuration = new KassaConfiguration();
            var request       = new PaymentRequest()
            {
                Language = LanguageCode.CS
            };

            var result = DataString.Create(configuration, request);

            Assert.AreEqual("merchantId=|keyVersion=1|amount=0|currencyCode=000|normalReturnUrl=|transactionReference=|customerLanguage=CS", result);
        }
Пример #7
0
        public void Create_AutomaticResponseUrlIsSet_ValidString()
        {
            var configuration = new KassaConfiguration();
            var request       = new PaymentRequest()
            {
                AutomaticResponseUrl = new Uri("https://www.github.com")
            };

            var result = DataString.Create(configuration, request);

            Assert.AreEqual("merchantId=|keyVersion=1|amount=0|currencyCode=000|normalReturnUrl=|transactionReference=|automaticResponseUrl=https://www.github.com/", result);
        }
Пример #8
0
        private IPaymentPostData CreatePostData(IPaymentRequest request)
        {
            PaymentRequestValidator.Validate(request);

            string data = DataString.Create(Configuration, request);
            string seal = Seal.Create(data, Configuration.SecretKey);

            return(new PaymentPostData()
            {
                Data = data,
                Seal = seal,
            });
        }