Ejemplo n.º 1
0
        public Form1()
        {
            InitializeComponent();
            Cursor.Hide();

            if (!GoogleVasLicense.AutoLoad())
            {
                Logger.Info("No Google VAS license file");
            }

            if (!AppleVasLicense.AutoLoad())
            {
                Logger.Info("No Apple VAS license file");
            }

            readerList   = new List <string>();
            googleConfig = GoogleVasConfig.SpringCardDemo();

            const string TestMerchantName = "pass.com.springcard.springblue.generic";
            const string TestKeyPrivate   = "MHcCAQEEICp+PT7K8FQSOi2HED1Ar5RqxxN2EkiKJMCSfaL4htYNoAoGCCqGSM49AwEHoUQDQgAE9RCZaHxXUIjQFQnwKmq6+cVqFBNO6ZKQmekosMQRZmutPs8szUsiLokILdaiT/7F5qUl8qSfEvlocYy6z98jIw==";
            string       json             = $@"{{
                ""P2"" : ""FullVAS"",
                ""Capabilities"": ""SingleMode"",
	            ""Merchants"" : [
		            {{
			            ""Name"" : ""{TestMerchantName}"",
			            ""PrivateKey"" : ""{TestKeyPrivate}"",
			            ""Url"": ""https://springpass.springcard.com""
                    }}
	            ],
	            ""Description"" : ""FullVAS, DualMode, 2 merchant IDs with 2nd matching, merchants have an URL""
            }}";

            appleConfig = AppleVasTerminalConfig.LoadFromJson(json);

            LoadReaders();



            if (readerList.Count > 0)
            {
                string reader = readerList[0];
                Logger.Trace("Starting...");

                resetUiEvent();

                activeReader = new SCardReader(reader);
                activeReader.StartWaitCard(new SCardReader.CardConnectedCallback(CardConnectedCallback), new SCardReader.CardRemovedCallback(CardRemovedCallback));
            }
            else
            {
                ShowResult("No reader found");
            }
        }
Ejemplo n.º 2
0
        public AppleVasTerminalConfig GetConfig()
        {
            eMerchant1Name.Text = AppConfig.ReadSettingString("MerchantName");
            ePrivateKey1.Text   = AppConfig.ReadSettingString("PrivateKey");

            eMerchant2Name.Text = AppConfig.ReadSettingString("MerchantName2");
            ePrivateKey2.Text   = AppConfig.ReadSettingString("PrivateKey2");

            string json = $@"{{
                ""P2"" : ""FullVAS"",
                ""Capabilities"": ""SingleMode"",
	            ""Merchants"" : ["    ;

            if ((eMerchant1Name.Text == "") && (ePrivateKey1.Text == ""))
            {
                lkSetDefault_LinkClicked(null, null);
            }

            json += $@"
		            {{
			            ""Name"" : ""{eMerchant1Name.Text}"",
			            ""PrivateKey"" : ""{ePrivateKey1.Text}"",
			            ""Url"": ""https://springpass.springcard.com""
                    }}";


            if ((eMerchant2Name.Text != "") && (ePrivateKey2.Text != ""))
            {
                json += $@",
		            {{
			            ""Name"" : ""{eMerchant2Name.Text}"",
			            ""PrivateKey"" : ""{ePrivateKey2.Text}"",
			            ""Url"": """"
                    }}";
            }

            json += $@"
              ],
	            ""Description"" : ""FullVAS, DualMode, 2 merchant IDs with 2nd matching, merchants have an URL""
               }}";

            AppleVasTerminalConfig config = AppleVasTerminalConfig.LoadFromJson(json);

            return(config);
        }