public void simpleAuthWithApplepayAndSecondaryAmountAndWallet()
        {
            authorization authorization = new authorization();

            authorization.reportGroup     = "Planets";
            authorization.orderId         = "123456";
            authorization.amount          = 110;
            authorization.secondaryAmount = 50;
            authorization.orderSource     = orderSourceType.applepay;
            applepayType       applepay           = new applepayType();
            applepayHeaderType applepayHeaderType = new applepayHeaderType();

            applepayHeaderType.applicationData    = "454657413164";
            applepayHeaderType.ephemeralPublicKey = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
            applepayHeaderType.publicKeyHash      = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
            applepayHeaderType.transactionId      = "1234";
            applepay.header        = applepayHeaderType;
            applepay.data          = "user";
            applepay.signature     = "sign";
            applepay.version       = "1";
            authorization.applepay = applepay;

            wallet wallet = new wallet();

            wallet.walletSourceTypeId = "123";
            wallet.walletSourceType   = walletWalletSourceType.MasterPass;
            authorization.wallet      = wallet;

            authorizationResponse response = litle.Authorize(authorization);

            Assert.AreEqual("Insufficient Funds", response.message);
            Assert.AreEqual("110", response.applepayResponse.transactionAmount);
        }
        public void SimpleSaleWithApplepayAndSecondaryAmountAndWallet()
        {
            var saleObj = new sale();
            saleObj.amount = 110;
            saleObj.secondaryAmount = 50;
            saleObj.litleTxnId = 123456;
            saleObj.orderId = "12344";
            saleObj.orderSource = orderSourceType.ecommerce;
            var applepay = new applepayType();
            var applepayHeaderType = new applepayHeaderType();
            applepayHeaderType.applicationData = "454657413164";
            applepayHeaderType.ephemeralPublicKey = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
            applepayHeaderType.publicKeyHash = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
            applepayHeaderType.transactionId = "1234";
            applepay.header = applepayHeaderType;
            applepay.data = "user";
            applepay.signature = "sign";
            applepay.version = "1";
            saleObj.applepay = applepay;
            var wallet = new wallet();
            wallet.walletSourceTypeId = "123";
            wallet.walletSourceType = walletWalletSourceType.MasterPass;
            saleObj.wallet = wallet;

            var responseObj = litle.Sale(saleObj);
            Assert.AreEqual("Insufficient Funds", responseObj.message);
            Assert.AreEqual("110", responseObj.applepayResponse.transactionAmount);
        }
        public void TestSimpleRequestWithApplepay()
        {
            registerTokenRequestType register = new registerTokenRequestType();

            register.orderId = "12344";
            applepayType       applepay           = new applepayType();
            applepayHeaderType applepayHeaderType = new applepayHeaderType();

            applepayHeaderType.applicationData    = "454657413164";
            applepayHeaderType.ephemeralPublicKey = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
            applepayHeaderType.publicKeyHash      = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
            applepayHeaderType.transactionId      = "1234";
            applepay.header    = applepayHeaderType;
            applepay.data      = "user";
            applepay.signature = "sign";
            applepay.version   = "1";
            register.applepay  = applepay;

            var mock = new Mock <Communications>();

            mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*<registerTokenRequest.*<applepay>.*?<data>user</data>.*?</applepay>.*?</registerTokenRequest>.*", RegexOptions.Singleline)))
            .Returns("<cnpOnlineResponse version='8.14' response='0' message='Valid Format' xmlns='http://www.vantivcnp.com/schema'><registerTokenResponse><cnpTxnId>4</cnpTxnId><response>801</response><message>Token Successfully Registered</message><responseTime>2012-10-10T10:17:03</responseTime></registerTokenResponse></cnpOnlineResponse>");

            Communications mockedCommunication = mock.Object;

            cnp.SetCommunication(mockedCommunication);
            cnp.RegisterToken(register);
        }
        public void SimpleSaleWithApplepayAndSecondaryAmountAndWallet()
        {
            sale saleObj = new sale();

            saleObj.amount          = 110;
            saleObj.secondaryAmount = 50;
            saleObj.litleTxnId      = 123456;
            saleObj.orderId         = "12344";
            saleObj.orderSource     = orderSourceType.ecommerce;
            applepayType       applepay           = new applepayType();
            applepayHeaderType applepayHeaderType = new applepayHeaderType();

            applepayHeaderType.applicationData    = "454657413164";
            applepayHeaderType.ephemeralPublicKey = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
            applepayHeaderType.publicKeyHash      = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
            applepayHeaderType.transactionId      = "1234";
            applepay.header    = applepayHeaderType;
            applepay.data      = "user";
            applepay.signature = "sign";
            applepay.version   = "1";
            saleObj.applepay   = applepay;
            wallet wallet = new Sdk.wallet();

            wallet.walletSourceTypeId = "123";
            wallet.walletSourceType   = walletWalletSourceType.MasterPass;
            saleObj.wallet            = wallet;

            saleResponse responseObj = litle.Sale(saleObj);

            Assert.AreEqual("Insufficient Funds", responseObj.message);
            Assert.AreEqual("110", responseObj.applepayResponse.transactionAmount);
        }
        public void TestSimpleRequestWithApplepay()
        {
            var register = new registerTokenRequestType();
            register.orderId = "12344";
            var applepay = new applepayType();
            var applepayHeaderType = new applepayHeaderType();
            applepayHeaderType.applicationData = "454657413164";
            applepayHeaderType.ephemeralPublicKey = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
            applepayHeaderType.publicKeyHash = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
            applepayHeaderType.transactionId = "1234";
            applepay.header = applepayHeaderType;
            applepay.data = "user";
            applepay.signature = "sign";
            applepay.version = "1";
            register.applepay = applepay;

            var mock = new Mock<Communications>(_memoryStreams);

            mock.Setup(
                Communications =>
                    Communications.HttpPost(
                        It.IsRegex(
                            ".*<registerTokenRequest.*<applepay>.*?<data>user</data>.*?</applepay>.*?</registerTokenRequest>.*",
                            RegexOptions.Singleline), It.IsAny<Dictionary<string, string>>()))
                .Returns(
                    "<litleOnlineResponse version='8.14' response='0' message='Valid Format' xmlns='http://www.litle.com/schema'><registerTokenResponse><litleTxnId>4</litleTxnId><response>801</response><message>Token Successfully Registered</message><responseTime>2012-10-10T10:17:03</responseTime></registerTokenResponse></litleOnlineResponse>");

            var mockedCommunication = mock.Object;
            litle.setCommunication(mockedCommunication);
            litle.RegisterToken(register);
        }
        public void TestMethodOfPaymentApplepayAndWallet()
        {
            var auth = new authorization();

            auth.orderId     = "12344";
            auth.amount      = 2;
            auth.orderSource = orderSourceType.applepay;
            auth.reportGroup = "Planets";
            var applepay           = new applepayType();
            var applepayHeaderType = new applepayHeaderType();

            applepayHeaderType.applicationData    = "454657413164";
            applepayHeaderType.ephemeralPublicKey = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
            applepayHeaderType.publicKeyHash      = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
            applepayHeaderType.transactionId      = "1234";
            applepay.header    = applepayHeaderType;
            applepay.data      = "user";
            applepay.signature = "sign";
            applepay.version   = "1";
            auth.applepay      = applepay;

            var wallet = new wallet();

            wallet.walletSourceTypeId = "123";
            auth.wallet = wallet;

            var mock = new Mock <Communications>(_memoryStreams);

            mock.Setup(
                Communications =>
                Communications.HttpPost(
                    It.IsRegex(
                        ".*?<litleOnlineRequest.*?<authorization.*?<orderSource>applepay</orderSource>.*?<applepay>.*?<data>user</data>.*?</applepay>.*?<wallet>.*?<walletSourceTypeId>123</walletSourceTypeId>.*?</wallet>.*?</authorization>.*?",
                        RegexOptions.Singleline), It.IsAny <Dictionary <string, string> >()))
            .Returns(
                "<litleOnlineResponse version='8.10' response='0' message='Valid Format' xmlns='http://www.litle.com/schema'><authorizationResponse><litleTxnId>123</litleTxnId></authorizationResponse></litleOnlineResponse>");

            var mockedCommunication = mock.Object;

            litle.setCommunication(mockedCommunication);
            var authorizationResponse = litle.Authorize(auth);

            Assert.NotNull(authorizationResponse);
            Assert.AreEqual(123, authorizationResponse.litleTxnId);
        }
 public void SimpleTokenWithApplepay()
 {
     var registerTokenRequest = new registerTokenRequestType();
     registerTokenRequest.orderId = "12344";
     registerTokenRequest.reportGroup = "Planets";
     var applepay = new applepayType();
     var applepayHeaderType = new applepayHeaderType();
     applepayHeaderType.applicationData = "454657413164";
     applepayHeaderType.ephemeralPublicKey = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
     applepayHeaderType.publicKeyHash = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
     applepayHeaderType.transactionId = "1234";
     applepay.header = applepayHeaderType;
     applepay.data = "user";
     applepay.signature = "sign";
     applepay.version = "1";
     registerTokenRequest.applepay = applepay;
     var rtokenResponse = litle.RegisterToken(registerTokenRequest);
     StringAssert.AreEqualIgnoringCase("Account number was successfully registered", rtokenResponse.message);
     Assert.AreEqual("0", rtokenResponse.applepayResponse.transactionAmount);
 }
        public void SimpleTokenWithApplepay()
        {
            registerTokenRequestType registerTokenRequest = new registerTokenRequestType();

            registerTokenRequest.orderId     = "12344";
            registerTokenRequest.reportGroup = "Planets";
            applepayType       applepay           = new applepayType();
            applepayHeaderType applepayHeaderType = new applepayHeaderType();

            applepayHeaderType.applicationData    = "454657413164";
            applepayHeaderType.ephemeralPublicKey = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
            applepayHeaderType.publicKeyHash      = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
            applepayHeaderType.transactionId      = "1234";
            applepay.header               = applepayHeaderType;
            applepay.data                 = "user";
            applepay.signature            = "sign";
            applepay.version              = "1";
            registerTokenRequest.applepay = applepay;
            registerTokenResponse rtokenResponse = litle.RegisterToken(registerTokenRequest);

            StringAssert.AreEqualIgnoringCase("Account number was successfully registered", rtokenResponse.message);
            Assert.AreEqual("0", rtokenResponse.applepayResponse.transactionAmount);
        }
        public void simpleAuthWithApplepayAndSecondaryAmountAndWallet()
        {
            var authorization = new authorization();
            authorization.reportGroup = "Planets";
            authorization.orderId = "123456";
            authorization.amount = 110;
            authorization.secondaryAmount = 50;
            authorization.orderSource = orderSourceType.applepay;
            var applepay = new applepayType();
            var applepayHeaderType = new applepayHeaderType();
            applepayHeaderType.applicationData = "454657413164";
            applepayHeaderType.ephemeralPublicKey = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
            applepayHeaderType.publicKeyHash = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
            applepayHeaderType.transactionId = "1234";
            applepay.header = applepayHeaderType;
            applepay.data = "user";
            applepay.signature = "sign";
            applepay.version = "1";
            authorization.applepay = applepay;

            var wallet = new wallet();
            wallet.walletSourceTypeId = "123";
            wallet.walletSourceType = walletWalletSourceType.MasterPass;
            authorization.wallet = wallet;

            var response = litle.Authorize(authorization);
            Assert.AreEqual("Insufficient Funds", response.message);
            Assert.AreEqual("110", response.applepayResponse.transactionAmount);
        }
        public void TestMethodOfPaymentApplepayAndWallet()
        {
            var auth = new authorization();
            auth.orderId = "12344";
            auth.amount = 2;
            auth.orderSource = orderSourceType.applepay;
            auth.reportGroup = "Planets";
            var applepay = new applepayType();
            var applepayHeaderType = new applepayHeaderType();
            applepayHeaderType.applicationData = "454657413164";
            applepayHeaderType.ephemeralPublicKey = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
            applepayHeaderType.publicKeyHash = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
            applepayHeaderType.transactionId = "1234";
            applepay.header = applepayHeaderType;
            applepay.data = "user";
            applepay.signature = "sign";
            applepay.version = "1";
            auth.applepay = applepay;

            var wallet = new wallet();
            wallet.walletSourceTypeId = "123";
            auth.wallet = wallet;

            var mock = new Mock<Communications>(_memoryStreams);

            mock.Setup(
                Communications =>
                    Communications.HttpPost(
                        It.IsRegex(
                            ".*?<litleOnlineRequest.*?<authorization.*?<orderSource>applepay</orderSource>.*?<applepay>.*?<data>user</data>.*?</applepay>.*?<wallet>.*?<walletSourceTypeId>123</walletSourceTypeId>.*?</wallet>.*?</authorization>.*?",
                            RegexOptions.Singleline), It.IsAny<Dictionary<string, string>>()))
                .Returns(
                    "<litleOnlineResponse version='8.10' response='0' message='Valid Format' xmlns='http://www.litle.com/schema'><authorizationResponse><litleTxnId>123</litleTxnId></authorizationResponse></litleOnlineResponse>");

            var mockedCommunication = mock.Object;
            litle.setCommunication(mockedCommunication);
            var authorizationResponse = litle.Authorize(auth);

            Assert.NotNull(authorizationResponse);
            Assert.AreEqual(123, authorizationResponse.litleTxnId);
        }