Esempio n. 1
0
        public void SerializationTest()
        {
            SaleToAcquirerData saleToAcquirerData = new SaleToAcquirerData
            {
                Metadata = new Dictionary <string, string> {
                    { "key", "value" }
                },
                ShopperEmail          = "*****@*****.**",
                ShopperReference      = "13164308",
                RecurringContract     = "RECURRING,ONECLICK",
                ShopperStatement      = "YOUR SHOPPER STATEMENT",
                RecurringDetailName   = "VALUE",
                RecurringTokenService = "VALUE",
                Store             = "store value",
                MerchantAccount   = "merchantAccount",
                Currency          = "EUR",
                AuthorisationType = "PreAuth"
            };
            var applicationInfo  = new ApplicationInfo();
            var externalPlatform = new ExternalPlatform
            {
                Integrator = "externalPlatformIntegrator",
                Name       = "externalPlatformName",
                Version    = "2.0.0"
            };

            applicationInfo.ExternalPlatform = externalPlatform;
            var merchantDevice = new MerchantDevice
            {
                Os        = "merchantDeviceOS",
                OsVersion = "10.12.6",
                Reference = "4c32759faaa7"
            };

            applicationInfo.MerchantDevice     = merchantDevice;
            saleToAcquirerData.ApplicationInfo = applicationInfo;
            saleToAcquirerData.TenderOption    = "ReceiptHandler,AllowPartialAuthorisation,AskGratuity";
            var additionalData = new Dictionary <string, string> {
                { "key.key", "value" }, { "key.keyTwo", "value2" }
            };

            saleToAcquirerData.AdditionalData = additionalData;
            Assert.AreEqual(saleToAcquirerData.ToBase64(), JsonToBase64());
        }
        public void PaymentRequestAppInfoExternalTest()
        {
            var externalPlatform    = new ExternalPlatform();
            var merchantApplication = new CommonField();

            externalPlatform.Integrator = "TestExternalPlatformIntegration";
            externalPlatform.Name       = "TestExternalPlatformName";
            externalPlatform.Version    = "TestExternalPlatformVersion";
            merchantApplication.Name    = "MerchantApplicationName";
            merchantApplication.Version = "MerchantApplicationVersion";
            var paymentRequest = CreatePaymentRequestCheckout();

            paymentRequest.ApplicationInfo.ExternalPlatform    = externalPlatform;
            paymentRequest.ApplicationInfo.MerchantApplication = merchantApplication;
            Assert.AreEqual(paymentRequest.ApplicationInfo.ExternalPlatform.Integrator, "TestExternalPlatformIntegration");
            Assert.AreEqual(paymentRequest.ApplicationInfo.ExternalPlatform.Name, "TestExternalPlatformName");
            Assert.AreEqual(paymentRequest.ApplicationInfo.ExternalPlatform.Version, "TestExternalPlatformVersion");
            Assert.AreEqual(paymentRequest.ApplicationInfo.MerchantApplication.Name, "MerchantApplicationName");
            Assert.AreEqual(paymentRequest.ApplicationInfo.MerchantApplication.Version, "MerchantApplicationVersion");
        }