public void CallingForm(MerchantProfile merchantProfile, bool blnNewProfile, BankcardService bcs, ElectronicCheckingService ecks, StoredValueService svas, string serviceId, DataGenerator dg)
        {
            _bcs          = bcs;
            _ecks         = ecks;
            _svas         = svas;
            _strServiceID = serviceId;
            _dg           = dg;

            hideAllFields();
            //Since MerchantProfile is saved at the serviceId level, display serviceId.
            //txtMerchantProfileServiceId.Text = merchantProfile.ServiceId;

            if (serviceId.Length < 1)
            {
                txtMerchantProfileServiceId.Text = "ServiceId not selected in calling form";
            }
            else
            {
                txtMerchantProfileServiceId.Text = serviceId;
            }

            //Populate combo boxes with the Enumeration
            cboCountryCode.Sorted       = true;
            cboCountryCode.DataSource   = Enum.GetValues(typeof(TypeISOCountryCodeA3));
            cboCountryCode.SelectedItem = TypeISOCountryCodeA3.NotSet;

            cboLanguage.Sorted       = true;
            cboLanguage.DataSource   = Enum.GetValues(typeof(TypeISOLanguageCodeA3));
            cboLanguage.SelectedItem = TypeISOLanguageCodeA3.NotSet;

            cboCurrencyCode.Sorted       = true;
            cboCurrencyCode.DataSource   = Enum.GetValues(typeof(TypeISOCurrencyCodeA3));
            cboCurrencyCode.SelectedItem = TypeISOCurrencyCodeA3.NotSet;


            cboCustomerPresent.Sorted       = true;
            cboCustomerPresent.DataSource   = Enum.GetValues(typeof(CustomerPresent));
            cboCustomerPresent.SelectedItem = CustomerPresent.NotSet;

            cboRequestACI.Sorted       = true;
            cboRequestACI.DataSource   = Enum.GetValues(typeof(RequestACI));
            cboRequestACI.SelectedItem = RequestACI.IsCPSMeritCapable;

            cboEntryMode.Sorted       = true;
            cboEntryMode.DataSource   = Enum.GetValues(typeof(EntryMode));
            cboEntryMode.SelectedItem = EntryMode.NotSet;

            cboMerchantIndustryType.Sorted       = true;
            cboMerchantIndustryType.DataSource   = Enum.GetValues(typeof(IndustryType));
            cboMerchantIndustryType.SelectedItem = IndustryType.NotSet;

            if (_bcs != null)
            {
                if (_strServiceID == "C82ED00001" || _strServiceID == "71C8700001" ||
                    _strServiceID == "88D9300001" || _strServiceID == "B447F00001" ||
                    _strServiceID == "D806000001" || _strServiceID == "E88FD00001")
                {
                    showBCPExpandedFields();
                }
                else if (_strServiceID == "168511300C" || _strServiceID == "9999999999")
                {
                    showBCPExpandedFields();
                }
                else
                {
                    showBCPFields();
                }
            }

            if (_ecks != null)
            {
                showECKFields();
            }
            if (_svas != null)
            {
                showSVAFields();
            }
        }
Exemple #2
0
        static void Main(string[] args)
        {
            #region Preparing the Application to Transact

            #region Setup Clients

            // setup service information client from service reference generated code
            var svcClient = new CWSServiceInformationClient();

            // setup transaction client from service reference generated code
            var txnClient = new CwsTransactionProcessingClient(new BasicHttpsBinding(),
                                                               new EndpointAddress("https://api.cert.nabcommerce.com/2.0.18/Txn"));

            #endregion

            #region SignOnWithToken

            // test identity token for global host capture
            string identityToken = "PHNhbWw6QXNzZXJ0aW9uIE1ham9yVmVyc2lvbj0iMSIgTWlub3JWZXJzaW9uPSIxIiBBc3NlcnRpb25JRD0iXzhhYTA2NDAxLTFlYzAtNDg1ZS1hYzNjLTRjYjEwZTdkNTE1MyIgSXNzdWVyPSJJcGNBdXRoZW50aWNhdGlvbiIgSXNzdWVJbnN0YW50PSIyMDE0LTA4LTAxVDE4OjQ3OjEyLjkyN1oiIHhtbG5zOnNhbWw9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjEuMDphc3NlcnRpb24iPjxzYW1sOkNvbmRpdGlvbnMgTm90QmVmb3JlPSIyMDE0LTA4LTAxVDE4OjQ3OjEyLjkyN1oiIE5vdE9uT3JBZnRlcj0iMjAxNy0wOC0wMVQxODo0NzoxMi45MjdaIj48L3NhbWw6Q29uZGl0aW9ucz48c2FtbDpBZHZpY2U+PC9zYW1sOkFkdmljZT48c2FtbDpBdHRyaWJ1dGVTdGF0ZW1lbnQ+PHNhbWw6U3ViamVjdD48c2FtbDpOYW1lSWRlbnRpZmllcj4yM0EzMzY3OTE2NjAwMDAxPC9zYW1sOk5hbWVJZGVudGlmaWVyPjwvc2FtbDpTdWJqZWN0PjxzYW1sOkF0dHJpYnV0ZSBBdHRyaWJ1dGVOYW1lPSJTQUsiIEF0dHJpYnV0ZU5hbWVzcGFjZT0iaHR0cDovL3NjaGVtYXMuaXBjb21tZXJjZS5jb20vSWRlbnRpdHkiPjxzYW1sOkF0dHJpYnV0ZVZhbHVlPjIzQTMzNjc5MTY2MDAwMDE8L3NhbWw6QXR0cmlidXRlVmFsdWU+PC9zYW1sOkF0dHJpYnV0ZT48c2FtbDpBdHRyaWJ1dGUgQXR0cmlidXRlTmFtZT0iU2VyaWFsIiBBdHRyaWJ1dGVOYW1lc3BhY2U9Imh0dHA6Ly9zY2hlbWFzLmlwY29tbWVyY2UuY29tL0lkZW50aXR5Ij48c2FtbDpBdHRyaWJ1dGVWYWx1ZT5mYTEzZjVmNS04N2IyLTQ5YzctOGIyZS1iOGE2NTY2ZTNlY2U8L3NhbWw6QXR0cmlidXRlVmFsdWU+PC9zYW1sOkF0dHJpYnV0ZT48c2FtbDpBdHRyaWJ1dGUgQXR0cmlidXRlTmFtZT0ibmFtZSIgQXR0cmlidXRlTmFtZXNwYWNlPSJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcyI+PHNhbWw6QXR0cmlidXRlVmFsdWU+MjNBMzM2NzkxNjYwMDAwMTwvc2FtbDpBdHRyaWJ1dGVWYWx1ZT48L3NhbWw6QXR0cmlidXRlPjwvc2FtbDpBdHRyaWJ1dGVTdGF0ZW1lbnQ+PFNpZ25hdHVyZSB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC8wOS94bWxkc2lnIyI+PFNpZ25lZEluZm8+PENhbm9uaWNhbGl6YXRpb25NZXRob2QgQWxnb3JpdGhtPSJodHRwOi8vd3d3LnczLm9yZy8yMDAxLzEwL3htbC1leGMtYzE0biMiPjwvQ2Fub25pY2FsaXphdGlvbk1ldGhvZD48U2lnbmF0dXJlTWV0aG9kIEFsZ29yaXRobT0iaHR0cDovL3d3dy53My5vcmcvMjAwMC8wOS94bWxkc2lnI3JzYS1zaGExIj48L1NpZ25hdHVyZU1ldGhvZD48UmVmZXJlbmNlIFVSST0iI184YWEwNjQwMS0xZWMwLTQ4NWUtYWMzYy00Y2IxMGU3ZDUxNTMiPjxUcmFuc2Zvcm1zPjxUcmFuc2Zvcm0gQWxnb3JpdGhtPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwLzA5L3htbGRzaWcjZW52ZWxvcGVkLXNpZ25hdHVyZSI+PC9UcmFuc2Zvcm0+PFRyYW5zZm9ybSBBbGdvcml0aG09Imh0dHA6Ly93d3cudzMub3JnLzIwMDEvMTAveG1sLWV4Yy1jMTRuIyI+PC9UcmFuc2Zvcm0+PC9UcmFuc2Zvcm1zPjxEaWdlc3RNZXRob2QgQWxnb3JpdGhtPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwLzA5L3htbGRzaWcjc2hhMSI+PC9EaWdlc3RNZXRob2Q+PERpZ2VzdFZhbHVlPjVvTTlwTjdQYlpIYjBVRDVmV0tVb0RmemN3RT08L0RpZ2VzdFZhbHVlPjwvUmVmZXJlbmNlPjwvU2lnbmVkSW5mbz48U2lnbmF0dXJlVmFsdWU+S0grYlJhc04zQmFUeVFhaEE5UDFJQWtXVjg3bG84RDBibXNvZVhzeEU1Z3NjZHVOczFDQ25qVXowOHBkSE1TbXlpODJTQVJYcmZoQStWTHF2UkZoM3hPcTYyc1ltWGtET0NzUGJ3dnRIUGwrUmV4NEdPc3dKSDlyR3pDbU51NVZ2U0VYTEIva2NuaG1EU1VuTTl1RE4wWXE5dXIxZG1NZTZMZzBxOExzNCtyaDJvbEk0QW0reDRPTEdOVVlpRXAvSzFQTWw3TGtOSmo1aVA3dTFVeE4rUVhQbDlsRWJucExiWExGRkJJUktER1dmaDJZcG9ZM0JFbXI0TXRMYUNoUW13bnVJTDlNbmozRGdYMVQ3RHJiMFBBS1FRV211bGFMZG41a1pCTXJ3eENwWk1tR0JCOFExMnAzQVhYZjVZOGxHNUtJL1djQnNFeG95YkFUTm1ZenlnPT08L1NpZ25hdHVyZVZhbHVlPjxLZXlJbmZvPjxvOlNlY3VyaXR5VG9rZW5SZWZlcmVuY2UgeG1sbnM6bz0iaHR0cDovL2RvY3Mub2FzaXMtb3Blbi5vcmcvd3NzLzIwMDQvMDEvb2FzaXMtMjAwNDAxLXdzcy13c3NlY3VyaXR5LXNlY2V4dC0xLjAueHNkIj48bzpLZXlJZGVudGlmaWVyIFZhbHVlVHlwZT0iaHR0cDovL2RvY3Mub2FzaXMtb3Blbi5vcmcvd3NzL29hc2lzLXdzcy1zb2FwLW1lc3NhZ2Utc2VjdXJpdHktMS4xI1RodW1icHJpbnRTSEExIj5ZREJlRFNGM0Z4R2dmd3pSLzBwck11OTZoQ2M9PC9vOktleUlkZW50aWZpZXI+PC9vOlNlY3VyaXR5VG9rZW5SZWZlcmVuY2U+PC9LZXlJbmZvPjwvU2lnbmF0dXJlPjwvc2FtbDpBc3NlcnRpb24+";
            // test identity token for global term capture
            //string identityToken = "PHNhbWw6QXNzZXJ0aW9uIE1ham9yVmVyc2lvbj0iMSIgTWlub3JWZXJzaW9uPSIxIiBBc3NlcnRpb25JRD0iX2ZiNWZjOWM4LTM3YTUtNDQ0MC05Mzc5LWU4OGE0ZDA5ZWI3OSIgSXNzdWVyPSJJcGNBdXRoZW50aWNhdGlvbiIgSXNzdWVJbnN0YW50PSIyMDE0LTA4LTAxVDIzOjQ3OjQwLjA3NVoiIHhtbG5zOnNhbWw9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjEuMDphc3NlcnRpb24iPjxzYW1sOkNvbmRpdGlvbnMgTm90QmVmb3JlPSIyMDE0LTA4LTAxVDIzOjQ3OjQwLjA3NVoiIE5vdE9uT3JBZnRlcj0iMjAxNy0wOC0wMVQyMzo0Nzo0MC4wNzVaIj48L3NhbWw6Q29uZGl0aW9ucz48c2FtbDpBZHZpY2U+PC9zYW1sOkFkdmljZT48c2FtbDpBdHRyaWJ1dGVTdGF0ZW1lbnQ+PHNhbWw6U3ViamVjdD48c2FtbDpOYW1lSWRlbnRpZmllcj4zQjhGQjVEQTA4MTAwMDAxPC9zYW1sOk5hbWVJZGVudGlmaWVyPjwvc2FtbDpTdWJqZWN0PjxzYW1sOkF0dHJpYnV0ZSBBdHRyaWJ1dGVOYW1lPSJTQUsiIEF0dHJpYnV0ZU5hbWVzcGFjZT0iaHR0cDovL3NjaGVtYXMuaXBjb21tZXJjZS5jb20vSWRlbnRpdHkiPjxzYW1sOkF0dHJpYnV0ZVZhbHVlPjNCOEZCNURBMDgxMDAwMDE8L3NhbWw6QXR0cmlidXRlVmFsdWU+PC9zYW1sOkF0dHJpYnV0ZT48c2FtbDpBdHRyaWJ1dGUgQXR0cmlidXRlTmFtZT0iU2VyaWFsIiBBdHRyaWJ1dGVOYW1lc3BhY2U9Imh0dHA6Ly9zY2hlbWFzLmlwY29tbWVyY2UuY29tL0lkZW50aXR5Ij48c2FtbDpBdHRyaWJ1dGVWYWx1ZT5kOGY5ZTNhYS1kMzI1LTQ4ODItYTIwMi1lNzBlNmRiMmZjZGI8L3NhbWw6QXR0cmlidXRlVmFsdWU+PC9zYW1sOkF0dHJpYnV0ZT48c2FtbDpBdHRyaWJ1dGUgQXR0cmlidXRlTmFtZT0ibmFtZSIgQXR0cmlidXRlTmFtZXNwYWNlPSJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcyI+PHNhbWw6QXR0cmlidXRlVmFsdWU+M0I4RkI1REEwODEwMDAwMTwvc2FtbDpBdHRyaWJ1dGVWYWx1ZT48L3NhbWw6QXR0cmlidXRlPjwvc2FtbDpBdHRyaWJ1dGVTdGF0ZW1lbnQ+PFNpZ25hdHVyZSB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC8wOS94bWxkc2lnIyI+PFNpZ25lZEluZm8+PENhbm9uaWNhbGl6YXRpb25NZXRob2QgQWxnb3JpdGhtPSJodHRwOi8vd3d3LnczLm9yZy8yMDAxLzEwL3htbC1leGMtYzE0biMiPjwvQ2Fub25pY2FsaXphdGlvbk1ldGhvZD48U2lnbmF0dXJlTWV0aG9kIEFsZ29yaXRobT0iaHR0cDovL3d3dy53My5vcmcvMjAwMC8wOS94bWxkc2lnI3JzYS1zaGExIj48L1NpZ25hdHVyZU1ldGhvZD48UmVmZXJlbmNlIFVSST0iI19mYjVmYzljOC0zN2E1LTQ0NDAtOTM3OS1lODhhNGQwOWViNzkiPjxUcmFuc2Zvcm1zPjxUcmFuc2Zvcm0gQWxnb3JpdGhtPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwLzA5L3htbGRzaWcjZW52ZWxvcGVkLXNpZ25hdHVyZSI+PC9UcmFuc2Zvcm0+PFRyYW5zZm9ybSBBbGdvcml0aG09Imh0dHA6Ly93d3cudzMub3JnLzIwMDEvMTAveG1sLWV4Yy1jMTRuIyI+PC9UcmFuc2Zvcm0+PC9UcmFuc2Zvcm1zPjxEaWdlc3RNZXRob2QgQWxnb3JpdGhtPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwLzA5L3htbGRzaWcjc2hhMSI+PC9EaWdlc3RNZXRob2Q+PERpZ2VzdFZhbHVlPkE3dCsrWExYMXpZQzVzMHhoSlZnR3ZXRUV4ST08L0RpZ2VzdFZhbHVlPjwvUmVmZXJlbmNlPjwvU2lnbmVkSW5mbz48U2lnbmF0dXJlVmFsdWU+aFMvWU8zelloVk1lQ3JRZU1PZVFFVnZrMVdVTjZCbzY1dGpmQVlIeVArZE1tRkVKa0hnSW1qa1BKTHN6ZU1HYjVNZmU3U2dWcWt6MmkvTGpzNFp4ZFlpL3VFTGY1L3pNbE44OXQ3MjR1cEtCRXhJdFZMc0R1eFVTY3Zob1VqcGZWLzFyZjQrR0YzQjJWNkp2clhjaTlTaDB5eHFkTXY1WUNDMlZmSEJxMkx1bHovd0tvSi9na3FmRnd5MEJHS05oMUxpVEJEcVV6SkYxcWs2U25zYXdkVE5VaEpsU2V0QzBvNmcrd3FUc0pZRHBLM1pFNGdyaWVoaXZ1U0FaTnpLSzlxSHJxeUtYOGtWT1Mvei80cEI2QTR5d0xCTDJMYTgvYW45bzFUcmFnZ1NrREJURURCTW85WExLMmUyQlVZNExwM2VaYkpaMzV2bU9VaHZ5OVNMV0hBPT08L1NpZ25hdHVyZVZhbHVlPjxLZXlJbmZvPjxvOlNlY3VyaXR5VG9rZW5SZWZlcmVuY2UgeG1sbnM6bz0iaHR0cDovL2RvY3Mub2FzaXMtb3Blbi5vcmcvd3NzLzIwMDQvMDEvb2FzaXMtMjAwNDAxLXdzcy13c3NlY3VyaXR5LXNlY2V4dC0xLjAueHNkIj48bzpLZXlJZGVudGlmaWVyIFZhbHVlVHlwZT0iaHR0cDovL2RvY3Mub2FzaXMtb3Blbi5vcmcvd3NzL29hc2lzLXdzcy1zb2FwLW1lc3NhZ2Utc2VjdXJpdHktMS4xI1RodW1icHJpbnRTSEExIj5ZREJlRFNGM0Z4R2dmd3pSLzBwck11OTZoQ2M9PC9vOktleUlkZW50aWZpZXI+PC9vOlNlY3VyaXR5VG9rZW5SZWZlcmVuY2U+PC9LZXlJbmZvPjwvU2lnbmF0dXJlPjwvc2FtbDpBc3NlcnRpb24+";

            string sessionToken = svcClient.SignOnWithToken(identityToken);

            #endregion

            #region SaveApplicationData

            var applicationData = new ApplicationData()
            {
                ApplicationAttended = false,
                ApplicationLocation = NabVelocity.Svc.ApplicationLocation.OffPremises,
                ApplicationName     = "MyTestApp",
                EncryptionType      = NabVelocity.Svc.EncryptionType.NotSet,
                HardwareType        = NabVelocity.Svc.HardwareType.PC,
                PINCapability       = NabVelocity.Svc.PINCapability.PINNotSupported,
                PTLSSocketId        = "MIIFCzCCA/OgAwIBAgICAoEwDQYJKoZIhvcNAQEFBQAwgbExNDAyBgNVBAMTK0lQIFBheW1lbnRzIEZyYW1ld29yayBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkxCzAJBgNVBAYTAlVTMREwDwYDVQQIEwhDb2xvcmFkbzEPMA0GA1UEBxMGRGVudmVyMRowGAYDVQQKExFJUCBDb21tZXJjZSwgSW5jLjEsMCoGCSqGSIb3DQEJARYdYWRtaW5AaXBwYXltZW50c2ZyYW1ld29yay5jb20wHhcNMTMwODI2MTcxMDI3WhcNMjMwODI0MTcxMDI3WjCBjDELMAkGA1UEBhMCVVMxETAPBgNVBAgTCENvbG9yYWRvMQ8wDQYDVQQHEwZEZW52ZXIxGjAYBgNVBAoTEUlQIENvbW1lcmNlLCBJbmMuMT0wOwYDVQQDEzR0ZHNwM25TZ0FJQUFBUDhBSCtDWUFBQUVBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUE9MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtn6ILI78EaOLcWrmI9RZf8Vj+3P/WcrDLimSyJJH/8LnIBbXNkiKcZSMg/KHqNLAtq/ncYqZcicgAfaoSbj9FxKGIXTDEICriv/i8sQIGFhIwW/V6H02E8SpWjdCQO9EUUaFPUVMhHfiabwJ3B0VODsQfVuG7mbrAvD/wAqiUVR2Q0rpgHkToCkytdhMlkXiFtnfy4nnoFnI6c5cmsQU7AZgI6Zr08pDMN9y3uSRGSJIzdcTohBA1qb8C4+ZVRCmwCfQZiBHxjC8c5DTiGlPQVEDfRjKXm6ffqBKCttX7qCeB0s57iob0Q7ucz8NfoWtY8dZVzMhYH8obU/dSXaZ6wIDAQABo4IBTjCCAUowCQYDVR0TBAIwADAdBgNVHQ4EFgQUJ64+T3k9d5nWfplPlxVZsN382XUwgeYGA1UdIwSB3jCB24AU3+ASnJQimuunAZqQDgNcnO2HuHShgbekgbQwgbExNDAyBgNVBAMTK0lQIFBheW1lbnRzIEZyYW1ld29yayBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkxCzAJBgNVBAYTAlVTMREwDwYDVQQIEwhDb2xvcmFkbzEPMA0GA1UEBxMGRGVudmVyMRowGAYDVQQKExFJUCBDb21tZXJjZSwgSW5jLjEsMCoGCSqGSIb3DQEJARYdYWRtaW5AaXBwYXltZW50c2ZyYW1ld29yay5jb22CCQD/yDY5hYVsVzA1BgNVHR8ELjAsMCqgKKAmhiRodHRwOi8vY3JsLmlwY29tbWVyY2UuY29tL2NhLWNybC5jcmwwDQYJKoZIhvcNAQEFBQADggEBAJrku2QD0T/0aT+jfFJA947Vf7Vu/6S1OxUGhMipx6z/izXZ+o4fK/Nsg0G39KvfxippFG/3MUo621dwXwtqq9SM72zy9ry9E0ptmEiG8X8bSVOyGj4MqyExCPs9LgloV5GgewqYRgq2hmbXOv8Gw7EeXGCfnQ+eROxGu1+p3ZWUnGMQnBbayg43npcHYfyLFHOzd57pj6ncYoxY3kun5GLMLr6tJXKpPNvbM5lAOzcAmKviPMCM2T53UzJlsRdVvCbnkrc5cYqN4l01elqr3MSsj6BJ+JqIqViFrYYkD34THKO8c+wZGb8IN+NJAVre9YOvt5+Cvbbd5ik0UQ+YQNM=",
                ReadCapability      = NabVelocity.Svc.ReadCapability.KeyOnly,
                SerialNumber        = "208093707",
                SoftwareVersion     = "1.0",
                SoftwareVersionDate = new DateTime(2014, 12, 4),
            };

            string applicationProfileId = "";

            try
            {
                // an application identified is returned and passed in on every transaction
                applicationProfileId = svcClient.SaveApplicationData(sessionToken, applicationData);
            }
            catch (FaultException <NabVelocity.Svc.CWSValidationResultFault> ex)
            {
                foreach (var validationError in ex.Detail.Errors)
                {
                    Console.WriteLine(string.Format("Validatior error: {0} - {1}",
                                                    validationError.RuleLocationKey, validationError.RuleMessage));
                }
            }

            #endregion

            #region GetApplicationData

            ApplicationData appData = svcClient.GetApplicationData(sessionToken, applicationProfileId);

            #endregion

            #region GetServiceInformation

            ServiceInformation serviceInfo = svcClient.GetServiceInformation(sessionToken);
            string             serviceId   = "";

            bool imageTransactions = true;
            if (serviceInfo.ElectronicCheckingServices.Count() > 0)
            {
                if (serviceInfo.ElectronicCheckingServices.First().ServiceName.Contains("GETI"))
                {
                    imageTransactions = true;
                }

                serviceId = serviceInfo.ElectronicCheckingServices.First().ServiceId;
            }

            bool serviceIsHostCapture = false;
            bool serviceIsTermCapture = false;

            if (serviceInfo.BankcardServices.Count() > 0)
            {
                BankcardService service = serviceInfo.BankcardServices.First();
                //// the serviceId represents the payment processor (global, firstdata, chase, etc.)
                serviceId = service.ServiceId;
                // if Capture is supported, the service is host capture
                serviceIsHostCapture = service.Operations.Capture;
                // if CaptureAll is supprted, the service is terminal capture
                serviceIsTermCapture = service.Operations.CaptureAll;
            }
            #endregion

            #region SaveMerchantProfiles

            string merchantProfileId = "Joe's Online Crab Shack";
            var    merchantProfile   = new MerchantProfile()
            {
                ProfileId    = merchantProfileId,
                ServiceId    = serviceId,
                MerchantData = new MerchantProfileMerchantData()
                {
                    MerchantId           = "689035621266620",
                    Name                 = "Joe's Online Crab Shack",
                    Phone                = "(555) 555-5555",
                    CustomerServicePhone = "(555) 555-5555",
                    Address              = new NabVelocity.Svc.AddressInfo()
                    {
                        Street1    = "100 Rampart Lane",
                        City       = "Denver",
                        PostalCode = "80220",
                    },
                    BankcardMerchantData = new BankcardMerchantData()
                    {
                        IndustryType = NabVelocity.Svc.IndustryType.Ecommerce,
                        AgentBank    = "000000",
                    },
                },
            };

            try
            {
                // merchant profiles follow the processor, so always use the serviceId (not the workflowId)
                svcClient.SaveMerchantProfiles(sessionToken, serviceId, TenderType.Credit,
                                               new MerchantProfile[] { merchantProfile });
            }
            catch (FaultException <NabVelocity.Svc.CWSValidationResultFault> ex)
            {
                foreach (var validationError in ex.Detail.Errors)
                {
                    Console.WriteLine(string.Format("Validatior error: {0} - {1}",
                                                    validationError.RuleLocationKey, validationError.RuleMessage));
                }
            }

            #endregion

            #region GetMerchantProfiles

            MerchantProfile[] merchantProfiles = svcClient.GetMerchantProfiles(sessionToken, serviceId, TenderType.Credit);

            #endregion

            #endregion

            #region Transacting

            if (serviceInfo.ElectronicCheckingServices.Count() > 0)
            {
                string filePathName   = @"..\..\..\tifBackSample.tif";
                byte[] rawImgData     = File.ReadAllBytes(filePathName);
                char[] base64CharData = new char[getB64Length(rawImgData.Length)];
                Convert.ToBase64CharArray(rawImgData, 0, rawImgData.Length, base64CharData, 0);
                byte[] backImageData = Encoding.ASCII.GetBytes(base64CharData);

                filePathName   = @"..\..\..\tifFrontSample.tif";
                rawImgData     = File.ReadAllBytes(filePathName);
                base64CharData = new char[getB64Length(rawImgData.Length)];
                Convert.ToBase64CharArray(rawImgData, 0, rawImgData.Length, base64CharData, 0);
                byte[] frontImageData = Encoding.ASCII.GetBytes(base64CharData);

                var debitRequest = new ElectronicCheckingTransaction
                {
                    CustomerData = new ElectronicCheckingCustomerData()
                    {
                        BillingData = new CustomerInfo()
                        {
                            Address = new NabVelocity.Txn.AddressInfo()
                            {
                                Street1       = "123 N Central",
                                City          = "Thornton",
                                PostalCode    = "12345",
                                StateProvince = "CO",
                                CountryCode   = NabVelocity.Txn.TypeISOCountryCodeA3.USA
                            },
                            Name = new NameInfo
                            {
                                First = "Bob",
                                Last  = "Dillan",
                            },
                            Phone = "3213211234"
                        },
                    },
                    TenderData = new ElectronicCheckingTenderData
                    {
                        CheckData = new CheckData
                        {
                            AccountNumber    = "12345678",
                            RoutingNumber    = "490000018",
                            CheckCountryCode = CheckCountryCode.US,
                            CheckNumber      = "1234",
                            OwnerType        = OwnerType.Personal,
                            UseType          = UseType.Checking,
                            RawMICRLine      = "toad"
                        },
                        SocketLocation = new SocketLocation
                        {
                            SocketCity  = "Denver",
                            SocketState = "CO"
                        },
                        BackCheckImage = new CheckImage
                        {
                            CompressionType = ImgCompressionType.Group_4,
                            DocType         = DocType.Check,
                            FormatType      = ImgFormatType.TIFF_6,
                            ImgData         = backImageData,
                            ImgSize         = backImageData.Length,
                        },
                        FrontCheckImage = new CheckImage
                        {
                            CompressionType = ImgCompressionType.Group_4,
                            DocType         = DocType.Check,
                            FormatType      = ImgFormatType.TIFF_6,
                            ImgData         = frontImageData,
                            ImgSize         = frontImageData.Length,
                        }
                    },
                    TransactionData = new ElectronicCheckingTransactionData
                    {
                        Amount          = 25.00m,
                        SECCode         = SECCode.POP,
                        TransactionType = TransactionType.Debit,
                        CurrencyCode    = NabVelocity.Txn.TypeISOCurrencyCodeA3.USD,
                        EffectiveDate   = DateTime.Now,
                        IsRecurring     = false,
                        PayeeId         = "Some Data",
                        ServiceType     = ServiceType.ACH,
                        TxnCodeType     = TxnCodeType.Conversion,
                    }
                };

                try
                {
                    var debitResponse =
                        (ElectronicCheckingTransactionResponse)
                        txnClient.Authorize(sessionToken, debitRequest, applicationProfileId, merchantProfileId, serviceId);

                    Console.WriteLine("(Debit) Status: " + debitResponse.Status + "\r\n");
                }
                catch (FaultException <NabVelocity.Txn.CWSValidationResultFault> ex)
                {
                    foreach (var validationError in ex.Detail.Errors)
                    {
                        Console.WriteLine(string.Format("Validatior error: {0} - {1}", validationError.RuleLocationKey,
                                                        validationError.RuleMessage));
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }

            if (serviceIsHostCapture)
            {
                #region Host Capture workflow

                try
                {
                    #region Verify

                    var verifyRequest = new BankcardTransaction()
                    {
                        TenderData = new BankcardTenderData()
                        {
                            CardData = new CardData()
                            {
                                CardType = TypeCardType.Visa,
                                PAN      = "5100000000000016",
                                Expire   = "1215",
                            },
                            CardSecurityData = new CardSecurityData()
                            {
                                AVSData = new AVSData()
                                {
                                    Street        = "123 Rain Road",
                                    City          = "Aurora",
                                    StateProvince = "CO",
                                    PostalCode    = "80080",
                                },
                                CVData         = "383",
                                CVDataProvided = CVDataProvided.Provided,
                            },
                        },
                        TransactionData = new BankcardTransactionData()
                        {
                            Amount       = 0.00M,
                            EntryMode    = NabVelocity.Txn.EntryMode.Keyed,
                            IndustryType = NabVelocity.Txn.IndustryType.Ecommerce,
                        },
                        CustomerData = new TransactionCustomerData()
                        {
                        }
                    };

                    var verifyResponse = (BankcardTransactionResponse)txnClient.Verify(sessionToken, verifyRequest,
                                                                                       applicationProfileId, merchantProfileId, serviceId);

                    Console.WriteLine("(Verify) Status: " + verifyResponse.Status + "\r\n"
                                      + "CV Result: " + verifyResponse.CVResult + "\r\n"
                                      + "AVS Postal Result: " + verifyResponse.AVSResult.PostalCodeResult + "\r\n");

                    #endregion

                    #region Authorize

                    var authRequest = new BankcardTransaction()
                    {
                        TenderData = new BankcardTenderData()
                        {
                            CardData = new CardData()
                            {
                                CardType = TypeCardType.Visa,
                                PAN      = "5100000000000016",
                                Expire   = "1215",
                            },
                            CardSecurityData = new CardSecurityData()
                            {
                                AVSData = new AVSData()
                                {
                                    Street        = "123 Rain Road",
                                    City          = "Aurora",
                                    StateProvince = "CO",
                                    PostalCode    = "80080",
                                },
                                CVData         = "383",
                                CVDataProvided = CVDataProvided.Provided,
                            },
                        },
                        TransactionData = new BankcardTransactionData()
                        {
                            CurrencyCode = NabVelocity.Txn.TypeISOCurrencyCodeA3.USD,
                            OrderNumber  = "123456",
                            Amount       = 15.00M,
                            EntryMode    = NabVelocity.Txn.EntryMode.Keyed,
                            IndustryType = NabVelocity.Txn.IndustryType.Ecommerce,
                        },
                    };

                    var authResponse = (BankcardTransactionResponse)txnClient.Authorize(sessionToken, authRequest,
                                                                                        applicationProfileId, merchantProfileId, serviceId);

                    Console.WriteLine("(Authorize) Status: " + authResponse.Status + "\r\n"
                                      + "Amount: " + authResponse.Amount + "\r\n"
                                      + "ApprovalCode: " + authResponse.ApprovalCode + "\r\n"
                                      + "TransactionId: " + authResponse.TransactionId + "\r\n");

                    #endregion

                    #region Capture

                    var captureDifferenceData = new BankcardCapture()
                    {
                        TransactionId = authResponse.TransactionId,
                        Amount        = authResponse.Amount + 1.00M,
                    };

                    var captureResponse = (BankcardCaptureResponse)txnClient.Capture(sessionToken, captureDifferenceData,
                                                                                     applicationProfileId, serviceId);

                    Console.WriteLine("(Capture) Status: " + captureResponse.Status + "\r\n"
                                      + "Amount: " + captureResponse.TransactionSummaryData.NetTotals.NetAmount + "\r\n"
                                      + "TransactionId: " + captureResponse.TransactionId + "\r\n");

                    #endregion

                    #region AuthAndCapture

                    var authAndCaptureRequest = new BankcardTransaction()
                    {
                        TenderData = new BankcardTenderData()
                        {
                            CardData = new CardData()
                            {
                                CardType = TypeCardType.Visa,
                                PAN      = "5100000000000016",
                                Expire   = "1215",
                            },
                            CardSecurityData = new CardSecurityData()
                            {
                                AVSData = new AVSData()
                                {
                                    Street        = "123 Rain Road",
                                    City          = "Aurora",
                                    StateProvince = "CO",
                                    PostalCode    = "80080",
                                },
                                CVData         = "383",
                                CVDataProvided = CVDataProvided.Provided,
                            },
                        },
                        TransactionData = new BankcardTransactionData()
                        {
                            CurrencyCode = NabVelocity.Txn.TypeISOCurrencyCodeA3.USD,
                            OrderNumber  = "123456",
                            Amount       = 15.00M,
                            EntryMode    = NabVelocity.Txn.EntryMode.Keyed,
                            IndustryType = NabVelocity.Txn.IndustryType.Ecommerce,
                        },
                    };

                    var authAndCapResponse = (BankcardTransactionResponse)txnClient.AuthorizeAndCapture(sessionToken, authAndCaptureRequest,
                                                                                                        applicationProfileId, merchantProfileId, serviceId);

                    Console.WriteLine("(AuthAndCapture) Status: " + authAndCapResponse.Status + "\r\n"
                                      + "Amount: " + authAndCapResponse.Amount + "\r\n"
                                      + "ApprovalCode: " + authAndCapResponse.ApprovalCode + "\r\n"
                                      + "TransactionId: " + authAndCapResponse.TransactionId + "\r\n");

                    #endregion

                    #region ReturnById

                    var returnByIdRequest = new BankcardReturn()
                    {
                        TransactionId       = authAndCapResponse.TransactionId,
                        TransactionDateTime = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss.fffzzz"),
                    };

                    var returnByIdResponse = (BankcardTransactionResponse)txnClient.ReturnById(sessionToken, returnByIdRequest,
                                                                                               applicationProfileId, serviceId);

                    Console.WriteLine("(ReturnById) Status: " + returnByIdResponse.Status + "\r\n"
                                      + "Amount: " + returnByIdResponse.Amount + "\r\n"
                                      + "ApprovalCode: " + returnByIdResponse.ApprovalCode + "\r\n"
                                      + "TransactionId: " + returnByIdResponse.TransactionId + "\r\n");

                    #endregion

                    #region ReturnUnlinked

                    var returnRequest = new BankcardTransaction()
                    {
                        TenderData = new BankcardTenderData()
                        {
                            CardData = new CardData()
                            {
                                CardType = TypeCardType.Visa,
                                PAN      = "5100000000000016",
                                Expire   = "1215",
                            },
                        },
                        TransactionData = new BankcardTransactionData()
                        {
                            CurrencyCode = NabVelocity.Txn.TypeISOCurrencyCodeA3.USD,
                            OrderNumber  = "123456",
                            Amount       = 15.00M,
                            EntryMode    = NabVelocity.Txn.EntryMode.Keyed,
                            IndustryType = NabVelocity.Txn.IndustryType.Ecommerce,
                        },
                    };

                    var returnUnlinkedResponse = (BankcardTransactionResponse)txnClient.ReturnUnlinked(sessionToken, returnRequest,
                                                                                                       applicationProfileId, merchantProfileId, serviceId);

                    Console.WriteLine("(ReturnUnlinked) Status: " + returnUnlinkedResponse.Status + "\r\n"
                                      + "Amount: " + returnUnlinkedResponse.Amount + "\r\n"
                                      + "ApprovalCode: " + returnUnlinkedResponse.ApprovalCode + "\r\n"
                                      + "TransactionId: " + returnUnlinkedResponse.TransactionId + "\r\n");

                    #endregion

                    #region Tokenized Transactions

                    // build a transaction
                    var tokenizedRequest = new BankcardTransaction()
                    {
                        TenderData = new BankcardTenderData()
                        {
                            // we only need to use a token in the tender data now
                            PaymentAccountDataToken = verifyResponse.PaymentAccountDataToken
                        },
                        TransactionData = new BankcardTransactionData()
                        {
                            CurrencyCode = NabVelocity.Txn.TypeISOCurrencyCodeA3.USD,
                            OrderNumber  = "123456",
                            Amount       = 15.00M,
                            EntryMode    = NabVelocity.Txn.EntryMode.Keyed,
                            IndustryType = NabVelocity.Txn.IndustryType.Ecommerce,
                        },
                    };

                    authResponse = (BankcardTransactionResponse)txnClient.Authorize(sessionToken, tokenizedRequest,
                                                                                    applicationProfileId, merchantProfileId, serviceId);
                    authAndCapResponse = (BankcardTransactionResponse)txnClient.AuthorizeAndCapture(sessionToken, tokenizedRequest,
                                                                                                    applicationProfileId, merchantProfileId, serviceId);
                    returnUnlinkedResponse = (BankcardTransactionResponse)txnClient.ReturnUnlinked(sessionToken, tokenizedRequest,
                                                                                                   applicationProfileId, merchantProfileId, serviceId);

                    #endregion

                    #region Adjust

                    var adjustReq = new Adjust()
                    {
                        Amount        = 1.00M,
                        TransactionId = authAndCapResponse.TransactionId,
                    };

                    Response adjustResponse = txnClient.Adjust(sessionToken, adjustReq, applicationProfileId, serviceId);

                    Console.WriteLine("(Adjust) Status: " + adjustResponse.Status + "\r\n"
                                      + "StatusMessage: " + adjustResponse.StatusMessage + "\r\n"
                                      + "TransactionId: " + adjustResponse.TransactionId + "\r\n");

                    #endregion

                    #region Undo

                    var undoRequest = new BankcardUndo()
                    {
                        TransactionId = authResponse.TransactionId,
                    };

                    Response undoResponse = txnClient.Undo(sessionToken, undoRequest, applicationProfileId, serviceId);

                    Console.WriteLine("(Undo) Status: " + undoResponse.Status + "\r\n"
                                      + "StatusMessage: " + undoResponse.StatusMessage + "\r\n"
                                      + "TransactionId: " + undoResponse.TransactionId + "\r\n");

                    #endregion
                }
                catch (FaultException <NabVelocity.Txn.CWSValidationResultFault> ex)
                {
                    foreach (var validationError in ex.Detail.Errors)
                    {
                        Console.WriteLine(string.Format("Validatior error: {0} - {1}",
                                                        validationError.RuleLocationKey, validationError.RuleMessage));
                    }
                }

                #endregion
            }

            if (serviceIsTermCapture)
            {
                #region Term Capture Workflow

                try
                {
                    #region Verify

                    var verifyRequest = new BankcardTransaction()
                    {
                        TenderData = new BankcardTenderData()
                        {
                            CardData = new CardData()
                            {
                                CardType = TypeCardType.Visa,
                                PAN      = "4111111111111111",
                                Expire   = "1215",
                            },
                            CardSecurityData = new CardSecurityData()
                            {
                                AVSData = new AVSData()
                                {
                                    Street        = "123 Rain Road",
                                    City          = "Aurora",
                                    StateProvince = "CO",
                                    PostalCode    = "80080",
                                },
                                CVData         = "123",
                                CVDataProvided = CVDataProvided.Provided,
                            },
                        },
                        TransactionData = new BankcardTransactionData()
                        {
                            Amount       = 0.00M,
                            EntryMode    = NabVelocity.Txn.EntryMode.Keyed,
                            IndustryType = NabVelocity.Txn.IndustryType.Ecommerce,
                        },
                        CustomerData = new TransactionCustomerData()
                        {
                        }
                    };

                    var verifyResponse = (BankcardTransactionResponse)txnClient.Verify(sessionToken, verifyRequest,
                                                                                       applicationProfileId, merchantProfileId, serviceId);

                    Console.WriteLine("(Verify) Status: " + verifyResponse.Status + "\r\n"
                                      + "CV Result: " + verifyResponse.CVResult + "\r\n"
                                      + "AVS Postal Result: " + verifyResponse.AVSResult.PostalCodeResult + "\r\n");

                    #endregion

                    #region Authorize

                    var authRequest = new BankcardTransaction()
                    {
                        TenderData = new BankcardTenderData()
                        {
                            CardData = new CardData()
                            {
                                CardType = TypeCardType.Visa,
                                PAN      = "4111111111111111",
                                Expire   = "1215",
                            },
                            CardSecurityData = new CardSecurityData()
                            {
                                AVSData = new AVSData()
                                {
                                    Street        = "123 Rain Road",
                                    City          = "Aurora",
                                    StateProvince = "CO",
                                    PostalCode    = "80080",
                                },
                                CVData         = "123",
                                CVDataProvided = CVDataProvided.Provided,
                            },
                        },
                        TransactionData = new BankcardTransactionData()
                        {
                            CurrencyCode = NabVelocity.Txn.TypeISOCurrencyCodeA3.USD,
                            OrderNumber  = "123456",
                            Amount       = 15.00M,
                            EntryMode    = NabVelocity.Txn.EntryMode.Keyed,
                            IndustryType = NabVelocity.Txn.IndustryType.Ecommerce,
                        },
                    };

                    var authResponse = (BankcardTransactionResponse)txnClient.Authorize(sessionToken, authRequest,
                                                                                        applicationProfileId, merchantProfileId, serviceId);

                    Console.WriteLine("(Authorize) Status: " + authResponse.Status + "\r\n"
                                      + "Amount: " + authResponse.Amount + "\r\n"
                                      + "ApprovalCode: " + authResponse.ApprovalCode + "\r\n"
                                      + "TransactionId: " + authResponse.TransactionId + "\r\n");

                    #endregion

                    #region Capture Selective

                    var captureSelectiveDifferenceData = new BankcardCapture()
                    {
                        TransactionId = authResponse.TransactionId,
                        Amount        = authResponse.Amount + 1.00M,
                    };

                    Response[] captureSelectiveResponses = txnClient.CaptureSelective(sessionToken, new[] { authResponse.TransactionId },
                                                                                      new[] { captureSelectiveDifferenceData }, applicationProfileId, serviceId);

                    foreach (var response in captureSelectiveResponses)
                    {
                        if (response.Status == Status.Failure)
                        {
                            Console.WriteLine("(Capture Selective) Status: " + response.Status + "\r\n"
                                              + "StatusMessage: " + response.StatusMessage + "\r\n"
                                              + "TransactionId: " + response.TransactionId + "\r\n");
                        }
                        else
                        {
                            var captureResponse = (BankcardCaptureResponse)response;

                            Console.WriteLine("(Capture Selective) Status: " + captureResponse.Status + "\r\n"
                                              + "Industry: " + captureResponse.IndustryType + "\r\n"
                                              + "Sales Count: " + captureResponse.TransactionSummaryData.SaleTotals.Count + "\r\n"
                                              + "Sales Amount: " + captureResponse.TransactionSummaryData.SaleTotals.NetAmount + "\r\n"
                                              + "Return Count: " + captureResponse.TransactionSummaryData.ReturnTotals.Count + "\r\n"
                                              + "Return Amount: " + captureResponse.TransactionSummaryData.ReturnTotals.NetAmount + "\r\n"
                                              + "TransactionId: " + captureResponse.TransactionId + "\r\n");
                        }
                    }

                    #endregion

                    #region ReturnById

                    var returnByIdRequest = new BankcardReturn()
                    {
                        TransactionId       = authResponse.TransactionId,
                        TransactionDateTime = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss.fffzzz"),
                    };

                    var returnByIdResponse = (BankcardTransactionResponse)txnClient.ReturnById(sessionToken, returnByIdRequest,
                                                                                               applicationProfileId, serviceId);

                    Console.WriteLine("(ReturnById) Status: " + returnByIdResponse.Status + "\r\n"
                                      + "Amount: " + returnByIdResponse.Amount + "\r\n"
                                      + "ApprovalCode: " + returnByIdResponse.ApprovalCode + "\r\n"
                                      + "TransactionId: " + returnByIdResponse.TransactionId + "\r\n");

                    #endregion

                    #region ReturnUnlinked

                    var returnRequest = new BankcardTransaction()
                    {
                        TenderData = new BankcardTenderData()
                        {
                            CardData = new CardData()
                            {
                                CardType = TypeCardType.Visa,
                                PAN      = "4111111111111111",
                                Expire   = "1215",
                            },
                        },
                        TransactionData = new BankcardTransactionData()
                        {
                            CurrencyCode = NabVelocity.Txn.TypeISOCurrencyCodeA3.USD,
                            OrderNumber  = "123456",
                            Amount       = 15.00M,
                            EntryMode    = NabVelocity.Txn.EntryMode.Keyed,
                            IndustryType = NabVelocity.Txn.IndustryType.Ecommerce,
                        },
                    };

                    var returnUnlinkedResponse = (BankcardTransactionResponse)txnClient.ReturnUnlinked(sessionToken, returnRequest,
                                                                                                       applicationProfileId, merchantProfileId, serviceId);

                    Console.WriteLine("(ReturnUnlinked) Status: " + returnUnlinkedResponse.Status + "\r\n"
                                      + "Amount: " + returnUnlinkedResponse.Amount + "\r\n"
                                      + "ApprovalCode: " + returnUnlinkedResponse.ApprovalCode + "\r\n"
                                      + "TransactionId: " + returnUnlinkedResponse.TransactionId + "\r\n");

                    #endregion

                    #region Tokenized Transactions

                    // build a transaction
                    var tokenizedRequest = new BankcardTransaction()
                    {
                        TenderData = new BankcardTenderData()
                        {
                            // we only need to use a token in the tender data now
                            PaymentAccountDataToken = verifyResponse.PaymentAccountDataToken
                        },
                        TransactionData = new BankcardTransactionData()
                        {
                            CurrencyCode = NabVelocity.Txn.TypeISOCurrencyCodeA3.USD,
                            OrderNumber  = "123456",
                            Amount       = 15.00M,
                            EntryMode    = NabVelocity.Txn.EntryMode.Keyed,
                            IndustryType = NabVelocity.Txn.IndustryType.Ecommerce,
                        },
                    };

                    authResponse = (BankcardTransactionResponse)txnClient.Authorize(sessionToken, tokenizedRequest,
                                                                                    applicationProfileId, merchantProfileId, serviceId);
                    returnUnlinkedResponse = (BankcardTransactionResponse)txnClient.ReturnUnlinked(sessionToken, tokenizedRequest,
                                                                                                   applicationProfileId, merchantProfileId, serviceId);

                    #endregion

                    #region Adjust

                    var adjustReq = new Adjust()
                    {
                        Amount        = 1.00M,
                        TransactionId = authResponse.TransactionId,
                    };

                    Response adjustResponse = txnClient.Adjust(sessionToken, adjustReq, applicationProfileId, serviceId);

                    Console.WriteLine("(Adjust) Status: " + adjustResponse.Status + "\r\n"
                                      + "StatusMessage: " + adjustResponse.StatusMessage + "\r\n"
                                      + "TransactionId: " + adjustResponse.TransactionId + "\r\n");

                    #endregion

                    #region Undo

                    var undoRequest = new BankcardUndo()
                    {
                        TransactionId = adjustResponse.TransactionId,
                    };

                    Response undoResponse = txnClient.Undo(sessionToken, undoRequest, applicationProfileId, serviceId);

                    Console.WriteLine("(Undo) Status: " + undoResponse.Status + "\r\n"
                                      + "StatusMessage: " + undoResponse.StatusMessage + "\r\n"
                                      + "TransactionId: " + undoResponse.TransactionId + "\r\n");

                    #endregion

                    #region Capture All

                    Response[] captureAllResponses = txnClient.CaptureAll(sessionToken, null,
                                                                          null, applicationProfileId, merchantProfileId, serviceId);

                    foreach (var response in captureAllResponses)
                    {
                        if (response.Status == Status.Failure)
                        {
                            Console.WriteLine("(Capture All) Status: " + response.Status + "\r\n"
                                              + "StatusMessage: " + response.StatusMessage + "\r\n"
                                              + "TransactionId: " + response.TransactionId + "\r\n");
                        }
                        else
                        {
                            var captureResponse = (BankcardCaptureResponse)response;

                            Console.WriteLine("(Capture All) Status: " + captureResponse.Status + "\r\n"
                                              + "Industry: " + captureResponse.IndustryType + "\r\n"
                                              + "Sales Count: " + captureResponse.TransactionSummaryData.SaleTotals.Count + "\r\n"
                                              + "Sales Amount: " + captureResponse.TransactionSummaryData.SaleTotals.NetAmount + "\r\n"
                                              + "Return Count: " + captureResponse.TransactionSummaryData.ReturnTotals.Count + "\r\n"
                                              + "Return Amount: " + captureResponse.TransactionSummaryData.ReturnTotals.NetAmount + "\r\n"
                                              + "TransactionId: " + captureResponse.TransactionId + "\r\n");
                        }
                    }

                    #endregion
                }
                catch (FaultException <NabVelocity.Txn.CWSValidationResultFault> ex)
                {
                    foreach (var validationError in ex.Detail.Errors)
                    {
                        Console.WriteLine(string.Format("Validatior error: {0} - {1}",
                                                        validationError.RuleLocationKey, validationError.RuleMessage));
                    }
                }

                #endregion
            }

            #endregion

            #region Querying for Transactions

            var tmsClient = new NabVelocity.Tms.TMSOperationsClient();

            var queryParams = new NabVelocity.Tms.QueryTransactionsParameters()
            {
                Amounts              = new[] { 16.00M },
                CardTypes            = new[] { NabVelocity.Tms.TypeCardType.Visa },
                CaptureStates        = new[] { NabVelocity.Tms.CaptureState.Captured },
                MerchantProfileIds   = new[] { "My Test App" },
                TransactionDateRange = new NabVelocity.Tms.DateRange()
                {
                    StartDateTime = DateTime.Now.AddDays(-2), EndDateTime = DateTime.Now
                },
                TransactionClassTypePairs = new[] {
                    new NabVelocity.Tms.TransactionClassTypePair()
                    {
                        TransactionClass = "BCP", TransactionType = "AUTH"
                    }
                },
            };

            var pagingParams = new NabVelocity.Tms.PagingParameters()
            {
                Page = 0, PageSize = 10
            };

            var txnsSummary = tmsClient.QueryTransactionsSummary(sessionToken, queryParams, false, pagingParams);

            var txnsDetail = tmsClient.QueryTransactionsDetail(sessionToken, queryParams, NabVelocity.Tms.TransactionDetailFormat.CWSTransaction, false, pagingParams);

            var txnsFamilies = tmsClient.QueryTransactionFamilies(sessionToken, queryParams, pagingParams);

            #endregion
        }
        public string TranslateServiceIdToFriendlyName(BankcardService bankcardService)
        {
            //Sandbox
            if (bankcardService.ServiceId == "214DF00001") return "Chase Paymentech Orbital - Tampa";
            if (bankcardService.ServiceId == "B51E100001") return "Chase Paymentech Orbital - Salem";
            if (bankcardService.ServiceId == "7B62B00001") return "First Data - Nashville";
            if (bankcardService.ServiceId == "786F400001") return "Chase Paymentech Orbital - Tampa Retail";
            if (bankcardService.ServiceId == "A656D00001") return "First Data - Nashville US";
            if (bankcardService.ServiceId == "4CACF00001") return "Chase Tampa Direct TCS";
            if (bankcardService.ServiceId == "3E2DE00001") return "RBS Global Gateway";
            if (bankcardService.ServiceId == "832E400001") return "RBS Worldpay";
            if (bankcardService.ServiceId == "C82ED00001") return "TSYS Sierra";
            if (bankcardService.ServiceId == "5A38100001") return "Tampa - Canada";
            if (bankcardService.ServiceId == "71C8700001") return "TSYS Sierra Canada";
            if (bankcardService.ServiceId == "8335000001") return "TSYS Summit";
            if (bankcardService.ServiceId == "A4F2B00001") return "Salem Direct";
            if (bankcardService.ServiceId == "E4FB800001") return "First Data - Nashville";
            if (bankcardService.ServiceId == "16E5800001") return "Intuit QBMS";
            if (bankcardService.ServiceId == "A8CFF00001") return "First Data BUYPASS";
            if (bankcardService.ServiceId == "36EBE00001") return "Tampa TCS for Canada";
            if (bankcardService.ServiceId == "6429C00001") return "Intuit QBMS Inline Tokenization";
            if (bankcardService.ServiceId == "8046100001") return "Intuit QBMS No Tokenization";
            if (bankcardService.ServiceId == "207CE00001") return "Adaptive Payments";
            if (bankcardService.ServiceId == "88D9300001") return "Vantiv FTPS";
            if (bankcardService.ServiceId == "8077500001") return "Intuit QBMS Inline Tokenization";
            if (bankcardService.ServiceId == "B447F00001") return "Vantiv IBM FTPS";
            if (bankcardService.ServiceId == "D806000001") return "Vantiv IBM FTPS";
            if (bankcardService.ServiceId == "9B0C200001") return "Intuit QBMS No Tokenization";
            if (bankcardService.ServiceId == "4365400001") return "Vantiv Tandem HC FTPS";
            if (bankcardService.ServiceId == "2C36000001") return "RBS Worldpay";
            if (bankcardService.ServiceId == "E88FD00001") return "TSYS Summit";
            if (bankcardService.ServiceId == "F061C00001") return "First Data - Nashville";

            //Production
            if (bankcardService.ServiceId == "C97EF1300C") return "Chase Paymentech Orbital - Tampa";
            if (bankcardService.ServiceId == "8A4B91300C") return "Chase Paymentech Orbital - Salem";
            if (bankcardService.ServiceId == "19F161300C") return "First Data - Nashville";
            if (bankcardService.ServiceId == "3257B1300C") return "Chase Paymentech Orbital - Tampa Retail";
            if (bankcardService.ServiceId == "859AC1300C") return "First Data - Nashville US";
            if (bankcardService.ServiceId == "633511300C") return "Chase Tampa Direct TCS";
            if (bankcardService.ServiceId == "355931300C") return "RBS Global Gateway";
            if (bankcardService.ServiceId == "8CEA11300C") return "RBS Worldpay";
            if (bankcardService.ServiceId == "168511300C") return "TSYS Sierra";
            if (bankcardService.ServiceId == "852BB1300C") return "Tampa - Canada";
            if (bankcardService.ServiceId == "507BF1300C") return "TSYS Sierra Canada";
            if (bankcardService.ServiceId == "55C3C1300C") return "TSYS Summit";
            if (bankcardService.ServiceId == "D1DDF1300C") return "Salem Direct";
            if (bankcardService.ServiceId == "D917B1300C") return "First Data - Nashville";
            if (bankcardService.ServiceId == "7AC431300C") return "Intuit QBMS";
            if (bankcardService.ServiceId == "7B4DD1300C") return "First Data BUYPASS";
            if (bankcardService.ServiceId == "9461F1300C") return "Tampa TCS for Canada";
            if (bankcardService.ServiceId == "CE4AE1300C") return "Intuit QBMS Inline Tokenization";
            if (bankcardService.ServiceId == "E7DFB1300C") return "Intuit QBMS No Tokenization";
            if (bankcardService.ServiceId == "CAFF61300C") return "Adaptive Payments";
            if (bankcardService.ServiceId == "9999999999") return "Vantiv FTPS";//NOTE : Placeholder

            return bankcardService.ServiceName;//Match was not found so pass back the name in the service.
        }
        private void GetServiceInformation()
        {
            //Clean up any previous retrievals
            cboAvailableServices.Items.Clear();//Reset The Services Dropdown
            cboAvailableServices.Text = "";

            CboWorkFlowIdsByServiceId.Items.Clear();//Reset The Workflow Dropdown
            CboWorkFlowIdsByServiceId.Text = "";

            if(!_blnPersistedConfigExists)
                Helper.ServiceID = "";
            cboAvailableProfiles.Items.Clear();//Reset The Profiles Dropdown
            cboAvailableProfiles.Text = "";
            if (!_blnPersistedConfigExists) 
                Helper.MerchantProfileId = "";
            lblIsProfileInitialized.Text = "";
            txtAboutTheService.Text = "";

            //Reset previously selected services
            _bcs = null;
            _ecks = null;
            _svas = null;

            //The GetServiceInformation() operation provides information about the services that are available to a specific Service Key. 
            //This operation should be automatically invoked during initial application configuration, and manually by an application 
            //administrator if/when available services are updated.

            _si = Helper.Cwssic.GetServiceInformation(Helper.SessionToken);
            
            if (_si.BankcardServices != null)
            {
                foreach (BankcardService BCS in _si.BankcardServices)
                {
                    cboAvailableServices.Items.Add(new Item(BCS.ServiceId + "-BCS-" + Helper.TranslateServiceIdToFriendlyName(BCS), BCS.ServiceId, ""));
                }
            }
            if (_si.ElectronicCheckingServices != null)
            {
                foreach (ElectronicCheckingService ECKS in _si.ElectronicCheckingServices)
                {
                    cboAvailableServices.Items.Add(new Item(ECKS.ServiceId + "-ECK-" + Helper.TranslateServiceIdToFriendlyName(ECKS), ECKS.ServiceId, ""));
                }
            }
            if (_si.StoredValueServices != null)
            {
                foreach (StoredValueService SVAS in _si.StoredValueServices)
                {
                    cboAvailableServices.Items.Add(new Item(SVAS.ServiceId + "-SVAS-" + Helper.TranslateServiceIdToFriendlyName(SVAS), SVAS.ServiceId, ""));
                }
            }
            txtPersistedAndCached.Text = "ApplicationProfileId : " + Helper.ApplicationProfileId + "\r\nServiceId : " + Helper.ServiceID + "\r\nMerchantProfileId : " + Helper.MerchantProfileId;
        }
        private void cboAvailableServices_SelectedIndexChanged(object sender, EventArgs e)
        {
            bool blnMatch = false;
            Item item = (Item)cboAvailableServices.SelectedItem;
            Helper.ServiceID = item.Value1;
            if (!_blnPersistedConfigExists)
                Helper.MerchantProfileId = "";

            CboWorkFlowIdsByServiceId.Items.Clear();
            CboWorkFlowIdsByServiceId.Text = "";

            txtAboutTheService.Text = "";

            //Note : Since the sample application only show one class or the other, reset to null and initialize below.
            _bcs = null;
            _ecks = null;
            _svas = null;
            
            #region BankcardService
            if (_si.BankcardServices != null)
            {
                foreach (BankcardService BCS in _si.BankcardServices)
                {
                    if (BCS.ServiceId == Helper.ServiceID)
                    {
                        _bcs = BCS; //Set the BankCard Service to be used

                        SupportedTxnTypes = BCS.Operations;
                        //Toggle the buttons to match supported transaction types.
                        if (!AvailableTxnTypes(SupportedTxnTypes))
                        {
                            MessageBox.Show("This Service is not supported with CWS");
                            return;
                        }

                        blnMatch = true;

                        // Determine if it's possible to send more than one capture             
                        if (BCS.MultiplePartialCapture)
                            ChkMultiplePartialCapture.Enabled = true;

                        txtAboutTheService.Text = "ServiceId : " + BCS.ServiceId
                                                  //Unique identifier for available services. These values change from sandbox to production.
                                                  + "\r\nService Name : " + Helper.TranslateServiceIdToFriendlyName(BCS)
                                                  + "\r\nAlternative Merchant Data : " + BCS.AlternativeMerchantData
                                                  //Indicates whether the service supports the display of AlternativeMerchantData on accountholder statements. Subject to issuer discretion.
                                                  + "\r\nAutoSettle Supported : " + BCS.AutoBatch
                                                  //Indicates whether AutoBatch is supported.
                                                  + "\r\n\r\nAVSData Fields Required: "
                                                  + "\r\n - CardHolderName: " + BCS.AVSData.CardholderName
                                                  + "\r\n - Street: " + BCS.AVSData.Street
                                                  + "\r\n - City: " + BCS.AVSData.City
                                                  + "\r\n - State: " + BCS.AVSData.StateProvince
                                                  + "\r\n - PostalCode: " + BCS.AVSData.PostalCode
                                                  + "\r\n - Phone: " + BCS.AVSData.Phone
                                                  + "\r\n - Country: " + BCS.AVSData.Country
                                                  + "\r\nCutoffTime : " + BCS.CutoffTime
                                                  //If the service supports AutoBatch, this is the cutoff time for new transactions to be included in the daily automated batch. 
                                                  //+ "\r\nEncryptionKey : " + BCS.EncryptionKey //Public key used for encrypting payment account data.
                                                  + "\r\nManagedBilling : " + BCS.ManagedBilling
                                                  //Indicates whether the service supports Service Provider managed billing.
                                                  + "\r\nMaximumBatchItems : " + BCS.MaximumBatchItems
                                                  //Maximum number of items included in a single batch.
                                                  + "\r\nMaximumLineItems : " + BCS.MaximumLineItems
                                                  //Maximum number of line items that may be provided when providing Level 3 line item data.
                                                  + "\r\nMultiplePartialCapture : " + BCS.MultiplePartialCapture
                                                  //Indicates whether the service supports multiple partial captures of a single authorization.
                                                  + "\r\n\r\nOperations Supported:"
                                                  //Specifies which operations are supported for the service.
                                                  + "\r\n - Adjust : " + BCS.Operations.Adjust
                                                  + "\r\n - AuthAndCapture : " + BCS.Operations.AuthAndCapture
                                                  + "\r\n - Authorize : " + BCS.Operations.Authorize
                                                  + "\r\n - Capture : " + BCS.Operations.Capture
                                                  + "\r\n - CaptureAll : " + BCS.Operations.CaptureAll
                                                  + "\r\n - CaptureSelective : " + BCS.Operations.CaptureSelective
                                                  + "\r\n - CloseBatch : " + BCS.Operations.CloseBatch
                                                  + "\r\n - QueryAccount : " + BCS.Operations.QueryAccount
                                                  + "\r\n - ReturnById : " + BCS.Operations.ReturnById
                                                  + "\r\n - ReturnUnlinked : " + BCS.Operations.ReturnUnlinked
                                                  + "\r\n - Undo : " + BCS.Operations.Undo
                                                  + "\r\n - Verify : " + BCS.Operations.Verify
                                                  + "\r\nPurchaseCardLevel : " + BCS.PurchaseCardLevel
                                                  //Specifies highest level of purchase card support. Level 3 support implies support for Level 2 as well.
                                                  + "\r\n\r\nTender Information:"
                                                  //Contains specific information about the supported payment tenders.
                                                  + "\r\n - BatchAssignmentSupport : " +
                                                  BCS.Tenders.BatchAssignmentSupport
                                                  //Indicates level of BatchAssignment supported by the service. Required.
                                                  + "\r\n - Credit : " + BCS.Tenders.Credit
                                                  //Indicates support for the Credit Card tender. Required.
                                                  + "\r\n - CreditAuthorizeSupport : " +
                                                  BCS.Tenders.CreditAuthorizeSupport
                                                  //Indicates the level of credit authorization support on a service. Required. Maps to the CreditAuthorizeSupportType enumeration.
                                                  + "\r\n - PINDebit : " + BCS.Tenders.PINDebit
                                                  //Indicates support for the PIN Debit tender. Required.
                                                  + "\r\n - PINDebitReturnSupportType : " +
                                                  BCS.Tenders.PINDebitReturnSupportType
                                                  //Indicates if Return is supported by the service for PIN Debit transactions. Required. Maps to the PinDebitReturnSupportType enumeration. Defaults to 'Standalone'.
                                                  + "\r\n - PinDebitUndoSupport : " + BCS.Tenders.PinDebitUndoSupport
                                                  //Indicates if Undo is supported by the service for PIN Debit transactions. Required. Maps to the PINDebitUndoSupportType enumeration.
                                                  + "\r\n - PINDebitUndoTenderDataRequired : " +
                                                  BCS.Tenders.PINDebitUndoTenderDataRequired
                                                  //Specifies whether a new card swipe is required when performing an Undo on a PIN Debit card. Required.
                                                  + "\r\n - PINlessDebit : " + BCS.Tenders.PINlessDebit
                                                  //Indicates support for PINless Debit. Required.
                                                  + "\r\n - QueryRejectedSupport : " + BCS.Tenders.QueryRejectedSupport
                            //Indicates if date ranges are supported for QueryRejected on a service. Required. Maps to the QueryRejectedSupportType enumeration.
                            ;

                        //show the arrow to indicate service information
                        picArrow.Visible = true;
                        tmrServiceArrow.Interval = 2000;
                        tmrServiceArrow.Start();
                        tmrServiceArrow.Enabled = true;
                        tmrServiceArrow.Tick += new EventHandler(OnTimedEvent);

                        //Enable Purchase Card buttons depending on the Servie returned
                        if (BCS.PurchaseCardLevel == PurchaseCardLevel.Level2)
                        {
                            cmdPurchaseCardL2.Enabled = true;
                            chkL2AuthAndCapture.Enabled = true;
                            cmdPurchaseCardL3.Enabled = false;
                            chkL3AuthAndCapture.Enabled = false;
                        }
                        if (BCS.PurchaseCardLevel == PurchaseCardLevel.Level3)
                        {
                            cmdPurchaseCardL2.Enabled = true;
                            chkL2AuthAndCapture.Enabled = true;
                            cmdPurchaseCardL3.Enabled = true;
                            chkL3AuthAndCapture.Enabled = true;
                        }

                        //Check to see if AuthorizeAndCapture supported
                        ChkMagensaAuthorizeAndCapture.Enabled = (BCS.Tenders.CreditAuthorizeSupport == CreditAuthorizeSupportType.Both ? true : false);

                        //Check to see if PINDebit supported
                        chkProcessAsPINDebitTxn.Enabled = (BCS.Tenders.PINDebit ? true : false);

                        //Check to see if PINLess Debit supported
                        ChkProcessAsPINLessDebit.Enabled = (BCS.Tenders.PINlessDebit ? true : false);
                        
                        //Some service providers require Username and Password.
                        if (Helper.CredentialRequired())
                        {
                            txtCredUserName.Enabled = true;
                            txtCredPassword.Enabled = true;
                        }
                        else
                        {
                            txtCredUserName.Enabled = false;
                            txtCredPassword.Enabled = false;
                        }

                        //We now have something to persiste
                        cmdPersistConfig.Enabled = true;
                        cmdDeletePersistCached.Enabled = true;

                        //List the current service selected
                        if (Helper.ServiceID.Length > 0)
                        {
                            lblCurrentService.Text = @"Processing as Service : " +
                                                     Helper.TranslateServiceIdToFriendlyName(BCS) + @" - " +
                                                     BCS.ServiceId;
                            lblCurrentServiceClass.Text = @"Service Class : BCP - Bank Card Processing";
                        }
                    }
                }
            }

            #endregion END BankcardService

            #region ElectronicCheckingService
            if (_si.ElectronicCheckingServices != null)
            {
                foreach (ElectronicCheckingService ECKS in _si.ElectronicCheckingServices)
                {
                    if (ECKS.ServiceId == Helper.ServiceID)
                    {
                        _ecks = ECKS; //Set the BankCard Service to be used

                        SupportedTxnTypes = ECKS.Operations;
                        //Toggle the buttons to match supported transaction types.
                        if (!AvailableTxnTypes(SupportedTxnTypes))
                        {
                            MessageBox.Show("This Service is not supported with CWS");
                            return;
                        }

                        blnMatch = true;

                        txtAboutTheService.Text = "ServiceId : " + ECKS.ServiceId
                                                  //Unique identifier for available services. These values change from sandbox to production.
                                                  + "\r\nService Name : " +
                                                  Helper.TranslateServiceIdToFriendlyName(ECKS)
                                                  //Operations Supported
                                                  + "\r\n\r\nOperations Supported:"
                                                  //Specifies which operations are supported for the service.
                                                  + "\r\n - Adjust : " + ECKS.Operations.Adjust
                                                  + "\r\n - AuthAndCapture : " + ECKS.Operations.AuthAndCapture
                                                  + "\r\n - Authorize : " + ECKS.Operations.Authorize
                                                  + "\r\n - Capture : " + ECKS.Operations.Capture
                                                  + "\r\n - CaptureAll : " + ECKS.Operations.CaptureAll
                                                  + "\r\n - CaptureSelective : " + ECKS.Operations.CaptureSelective
                                                  + "\r\n - CloseBatch : " + ECKS.Operations.CloseBatch
                                                  + "\r\n - QueryAccount : " + ECKS.Operations.QueryAccount
                                                  + "\r\n - ReturnById : " + ECKS.Operations.ReturnById
                                                  + "\r\n - ReturnUnlinked : " + ECKS.Operations.ReturnUnlinked
                                                  + "\r\n - Undo : " + ECKS.Operations.Undo
                                                  + "\r\n - Verify : " + ECKS.Operations.Verify
                                                  + "\r\n\r\nTender Information:"
                                                  //Contains specific information about the supported payment tenders.
                                                  + "\r\n - BatchAssignmentSupport : " +
                                                  ECKS.Tenders.BatchAssignmentSupport
                                                  //Indicates level of BatchAssignment supported by the service. Required.
                                                  + "\r\n - Credit : " + ECKS.Tenders.Credit
                                                  //Indicates support for the Credit Card tender. Required.
                                                  + "\r\n - CreditAuthorizeSupport : " +
                                                  ECKS.Tenders.CreditAuthorizeSupport
                                                  //Indicates the level of credit authorization support on a service. Required. Maps to the CreditAuthorizeSupportType enumeration.
                                                  + "\r\n - PINDebit : " + ECKS.Tenders.PINDebit
                                                  //Indicates support for the PIN Debit tender. Required.
                                                  + "\r\n - PINDebitReturnSupportType : " +
                                                  ECKS.Tenders.PINDebitReturnSupportType
                                                  //Indicates if Return is supported by the service for PIN Debit transactions. Required. Maps to the PinDebitReturnSupportType enumeration. Defaults to 'Standalone'.
                                                  + "\r\n - PinDebitUndoSupport : " + ECKS.Tenders.PinDebitUndoSupport
                                                  //Indicates if Undo is supported by the service for PIN Debit transactions. Required. Maps to the PINDebitUndoSupportType enumeration.
                                                  + "\r\n - PINDebitUndoTenderDataRequired : " +
                                                  ECKS.Tenders.PINDebitUndoTenderDataRequired
                                                  //Specifies whether a new card swipe is required when performing an Undo on a PIN Debit card. Required.
                                                  + "\r\n - PINlessDebit : " + ECKS.Tenders.PINlessDebit
                                                  //Indicates support for PINless Debit. Required.
                                                  + "\r\n - QueryRejectedSupport : " + ECKS.Tenders.QueryRejectedSupport
                            //Indicates if date ranges are supported for QueryRejected on a service. Required. Maps to the QueryRejectedSupportType enumeration.
                            ;

                        //show the arrow to indicate service information
                        picArrow.Visible = true;
                        tmrServiceArrow.Interval = 2000;
                        tmrServiceArrow.Start();
                        tmrServiceArrow.Enabled = true;
                        tmrServiceArrow.Tick += new EventHandler(OnTimedEvent);

                        //Some service providers require Username and Password.
                        if (Helper.CredentialRequired())
                        {
                            txtCredUserName.Enabled = true;
                            txtCredPassword.Enabled = true;
                        }
                        else
                        {
                            txtCredUserName.Enabled = false;
                            txtCredPassword.Enabled = false;
                        }

                        //We now have something to persiste
                        cmdPersistConfig.Enabled = true;
                        cmdDeletePersistCached.Enabled = true;

                        //List the current service selected
                        if (Helper.ServiceID.Length > 0)
                        {
                            lblCurrentService.Text = @"Processing as Service : " +
                                                     Helper.TranslateServiceIdToFriendlyName(ECKS) + @" - " +
                                                     ECKS.ServiceId;
                            lblCurrentServiceClass.Text = @"Service Class : ECK - Electronic Check Processing";
                        }
                    }
                }
            }

            #endregion END ElectronicCheckingService

            #region StoredValueService
            if (_si.StoredValueServices != null)
            {
                foreach (StoredValueService SVAS in _si.StoredValueServices)
                {
                    if (SVAS.ServiceId == Helper.ServiceID)
                    {
                        _svas = SVAS; //Set the Stored Value Service to be used

                        SupportedTxnTypes = SVAS.Operations;
                        //Toggle the buttons to match supported transaction types.
                        if (!AvailableTxnTypes(SupportedTxnTypes))
                        {
                            MessageBox.Show("This Service is not supported with CWS");
                            return;
                        }

                        blnMatch = true;

                        txtAboutTheService.Text = "ServiceId : " + SVAS.ServiceId
                                                  //Unique identifier for available services. These values change from sandbox to production.
                                                  + "\r\nService Name : " +
                                                  Helper.TranslateServiceIdToFriendlyName(SVAS)
                                                  //Operations Supported
                                                  + "\r\n\r\nOperations Supported:"
                                                  //Specifies which operations are supported for the service.
                                                  + "\r\n - Adjust : " + SVAS.Operations.Adjust
                                                  + "\r\n - AuthAndCapture : " + SVAS.Operations.AuthAndCapture
                                                  + "\r\n - Authorize : " + SVAS.Operations.Authorize
                                                  + "\r\n - Capture : " + SVAS.Operations.Capture
                                                  + "\r\n - CaptureAll : " + SVAS.Operations.CaptureAll
                                                  + "\r\n - CaptureSelective : " + SVAS.Operations.CaptureSelective
                                                  + "\r\n - CloseBatch : " + SVAS.Operations.CloseBatch
                                                  + "\r\n - QueryAccount : " + SVAS.Operations.QueryAccount
                                                  + "\r\n - ReturnById : " + SVAS.Operations.ReturnById
                                                  + "\r\n - ReturnUnlinked : " + SVAS.Operations.ReturnUnlinked
                                                  + "\r\n - Undo : " + SVAS.Operations.Undo
                                                  + "\r\n - Verify : " + SVAS.Operations.Verify
                                                  + "\r\n\r\nTender Information:"
                                                  //Contains specific information about the supported payment tenders.
                                                  + "\r\n - BatchAssignmentSupport : " +
                                                  SVAS.Tenders.BatchAssignmentSupport
                                                  //Indicates level of BatchAssignment supported by the service. Required.
                                                  + "\r\n - Credit : " + SVAS.Tenders.Credit
                                                  //Indicates support for the Credit Card tender. Required.
                                                  + "\r\n - CreditAuthorizeSupport : " +
                                                  SVAS.Tenders.CreditAuthorizeSupport
                                                  //Indicates the level of credit authorization support on a service. Required. Maps to the CreditAuthorizeSupportType enumeration.
                                                  + "\r\n - PINDebit : " + SVAS.Tenders.PINDebit
                                                  //Indicates support for the PIN Debit tender. Required.
                                                  + "\r\n - PINDebitReturnSupportType : " +
                                                  SVAS.Tenders.PINDebitReturnSupportType
                                                  //Indicates if Return is supported by the service for PIN Debit transactions. Required. Maps to the PinDebitReturnSupportType enumeration. Defaults to 'Standalone'.
                                                  + "\r\n - PinDebitUndoSupport : " + SVAS.Tenders.PinDebitUndoSupport
                                                  //Indicates if Undo is supported by the service for PIN Debit transactions. Required. Maps to the PINDebitUndoSupportType enumeration.
                                                  + "\r\n - PINDebitUndoTenderDataRequired : " +
                                                  SVAS.Tenders.PINDebitUndoTenderDataRequired
                                                  //Specifies whether a new card swipe is required when performing an Undo on a PIN Debit card. Required.
                                                  + "\r\n - PINlessDebit : " + SVAS.Tenders.PINlessDebit
                                                  //Indicates support for PINless Debit. Required.
                                                  + "\r\n - QueryRejectedSupport : " + SVAS.Tenders.QueryRejectedSupport
                            //Indicates if date ranges are supported for QueryRejected on a service. Required. Maps to the QueryRejectedSupportType enumeration.
                            ;

                        //show the arrow to indicate service information
                        picArrow.Visible = true;
                        tmrServiceArrow.Interval = 2000;
                        tmrServiceArrow.Start();
                        tmrServiceArrow.Enabled = true;
                        tmrServiceArrow.Tick += new EventHandler(OnTimedEvent);

                        //Some service providers require Username and Password.
                        if (Helper.CredentialRequired())
                        {
                            txtCredUserName.Enabled = true;
                            txtCredPassword.Enabled = true;
                        }
                        else
                        {
                            txtCredUserName.Enabled = false;
                            txtCredPassword.Enabled = false;
                        }

                        //We now have something to persiste
                        cmdPersistConfig.Enabled = true;
                        cmdDeletePersistCached.Enabled = true;

                        //List the current service selected
                        if (Helper.ServiceID.Length > 0)
                        {
                            lblCurrentService.Text = @"Processing as Service : " +
                                                     Helper.TranslateServiceIdToFriendlyName(SVAS) + @" - " +
                                                     SVAS.ServiceId;
                            lblCurrentServiceClass.Text = @"Service Class : SVA - Stored Value Processing";
                        }
                    }
                }
            }

            #endregion END StoredValueService

            #region WorkflowId
            foreach (Workflow WF in _si.Workflows)
            {
                if (WF.ServiceId == Helper.ServiceID)
                {
                    //CboWorkFlowIdsByServiceId
                    CboWorkFlowIdsByServiceId.Items.Add(new Item("["+ WF.WorkflowId + "] " + WF.Name, WF.WorkflowId, ""));
                    //CboWorkFlowIds.Items.Add(new item("[" + node["WorkflowId"].InnerText + "] " + node["Name"].InnerXml, node["WorkflowId"].InnerText));
                }
            }
            #endregion END WorkflowId


            //List the current service selected
            if (Helper.ServiceID.Length > 0 && _bcs != null)
            {
                lblCurrentService.Text = @"Processing as Service : " + Helper.TranslateServiceIdToFriendlyName(_bcs) + @" - " + _bcs.ServiceId;
            }
            if (Helper.ServiceID.Length > 0 && _ecks != null)
            {
                lblCurrentService.Text = @"Processing as Service : " + Helper.TranslateServiceIdToFriendlyName(_ecks) + @" - " + _ecks.ServiceId;
            }
            GetMerchantProfileIds();
            cmdAddNewProfile.Enabled = true; //At this point we have valid profiles to update
            
            if (!blnMatch) MessageBox.Show(@"ServiceId did not contain a match");
        }
        public void CallingForm(MerchantProfile merchantProfile, bool blnNewProfile, BankcardService bcs, ElectronicCheckingService ecks, StoredValueService svas, string serviceId)
        {
            _bcs = bcs;
            _ecks = ecks;
            _svas = svas;
            _strServiceID = serviceId;

            hideAllFields();
            //Since MerchantProfile is saved at the serviceId level, display serviceId.
            txtMerchantProfileServiceId.Text = merchantProfile.ServiceId;
            
            if(blnNewProfile)
            {//New profile to add to CWS
                cmdAddUpdate.Text = "Add";

                //Populate combo boxes with the Enumeration
                cboCountryCode.Sorted = true;
                cboCountryCode.DataSource = Enum.GetValues(typeof(TypeISOCountryCodeA3));
                cboCountryCode.SelectedItem = TypeISOCountryCodeA3.NotSet;

                cboLanguage.Sorted = true;
                cboLanguage.DataSource = Enum.GetValues(typeof(TypeISOLanguageCodeA3));
                cboLanguage.SelectedItem = TypeISOLanguageCodeA3.NotSet;

                cboCurrencyCode.Sorted = true;
                cboCurrencyCode.DataSource = Enum.GetValues(typeof(TypeISOCurrencyCodeA3));
                cboCurrencyCode.SelectedItem = TypeISOCurrencyCodeA3.NotSet;


                cboCustomerPresent.Sorted = true;
                cboCustomerPresent.DataSource = Enum.GetValues(typeof(CustomerPresent));
                cboCustomerPresent.SelectedItem = CustomerPresent.NotSet;

                cboRequestACI.Sorted = true;
                cboRequestACI.DataSource = Enum.GetValues(typeof(RequestACI));
                cboRequestACI.SelectedItem = RequestACI.IsCPSMeritCapable;

                cboEntryMode.Sorted = true;
                cboEntryMode.DataSource = Enum.GetValues(typeof(EntryMode));
                cboEntryMode.SelectedItem = EntryMode.NotSet;

                cboMerchantIndustryType.Sorted = true;
                cboMerchantIndustryType.DataSource = Enum.GetValues(typeof(IndustryType));
                cboMerchantIndustryType.SelectedItem = IndustryType.NotSet;
            }
            else
            {//Existing Profile to Update;
                //Note : items commented out are not use so no need to wire up a text box as well as add to 'SaveMerchantInformation()'
                txtProfileId.Text = merchantProfile.ProfileId;
                txtProfileId.ReadOnly = true;
                lblLastUpdated.Text = "Last Updated : " + merchantProfile.LastUpdated;
                //MerchantData
                //MerchantData.Address
                txtCity.Text = merchantProfile.MerchantData.Address.City;
                txtPostalCode.Text = merchantProfile.MerchantData.Address.PostalCode;
                txtStateProvince.Text = merchantProfile.MerchantData.Address.StateProvince.ToString();
                txtStreetAddress1.Text = merchantProfile.MerchantData.Address.Street1;
                txtStreetAddress2.Text = merchantProfile.MerchantData.Address.Street2;

                txtCustomerServiceInternet.Text = merchantProfile.MerchantData.CustomerServiceInternet;
                txtCustomerServicePhone.Text = merchantProfile.MerchantData.CustomerServicePhone;
                txtMerchantId.Text = merchantProfile.MerchantData.MerchantId;
                txtName.Text = merchantProfile.MerchantData.Name;
                txtPhone.Text = merchantProfile.MerchantData.Phone;
                txtTaxId.Text = merchantProfile.MerchantData.TaxId;
                if (_bcs != null)
                {
		                //MerchantData.BankcardMerchantData
		                txtABANumber.Text = merchantProfile.MerchantData.BankcardMerchantData.ABANumber;
		                txtAcquirerBIN.Text = merchantProfile.MerchantData.BankcardMerchantData.AcquirerBIN;
		                txtAgentBank.Text = merchantProfile.MerchantData.BankcardMerchantData.AgentBank;
		                txtAgentChain.Text = merchantProfile.MerchantData.BankcardMerchantData.AgentChain;
		                txtClientNum.Text = merchantProfile.MerchantData.BankcardMerchantData.ClientNumber;
		                txtLocation.Text = merchantProfile.MerchantData.BankcardMerchantData.Location;
		                //txtTBD.Text = _MerchantProfile.MerchantData.BankcardMerchantData.PrintCustomerServicePhone == "";
		                txtSecondaryTerminalId.Text = merchantProfile.MerchantData.BankcardMerchantData.SecondaryTerminalId;
		                txtSettlementAgent.Text = merchantProfile.MerchantData.BankcardMerchantData.SettlementAgent;
		                txtSharingGroup.Text = merchantProfile.MerchantData.BankcardMerchantData.SharingGroup;
		                txtSIC.Text = merchantProfile.MerchantData.BankcardMerchantData.SIC;
		                txtStoreId.Text = merchantProfile.MerchantData.BankcardMerchantData.StoreId;
		                txtSocketNum.Text = merchantProfile.MerchantData.BankcardMerchantData.TerminalId;
		                txtTimeZoneDifferential.Text = merchantProfile.MerchantData.BankcardMerchantData.TimeZoneDifferential;
		                txtReimbursementAttribute.Text = merchantProfile.MerchantData.BankcardMerchantData.ReimbursementAttribute;
              	}
              	if (_svas != null)
              	{
              			//MerchantData.StoredValueMerchantData
		                txtAgentChain.Text = merchantProfile.MerchantData.StoredValueMerchantData.AgentChain;
		                txtClientNum.Text = merchantProfile.MerchantData.StoredValueMerchantData.ClientNumber;
		                txtSIC.Text = merchantProfile.MerchantData.StoredValueMerchantData.SIC;
		                txtStoreId.Text = merchantProfile.MerchantData.StoredValueMerchantData.StoreId;
		                txtSocketNum.Text = merchantProfile.MerchantData.StoredValueMerchantData.TerminalId;
		                _MerchantIndustryType = merchantProfile.MerchantData.StoredValueMerchantData.IndustryType;
		            }
                    if (_ecks != null)
                    {
                        //MerchantData.ElectronicCheckingMerchantData
                        txtMerchantId.Text = merchantProfile.MerchantData.ElectronicCheckingMerchantData.OrginatorId;
                        txtStoreId.Text = merchantProfile.MerchantData.ElectronicCheckingMerchantData.SiteId;
                        txtSocketNum.Text = merchantProfile.MerchantData.ElectronicCheckingMerchantData.ProductId;
                    }

                //First Populate with the Enumeration
                cboCountryCode.DataSource = Enum.GetValues(typeof(TypeISOCountryCodeA3));
                //Now select the index that matches
                if (merchantProfile.MerchantData.Address.CountryCode.ToString().Length > 0)
                {
                    cboCountryCode.SelectedItem = merchantProfile.MerchantData.Address.CountryCode;
                    _CountryCode = (TypeISOCountryCodeA3)cboCountryCode.SelectedItem;
                }
                //First Populate with the Enumeration
                cboLanguage.DataSource = Enum.GetValues(typeof(TypeISOLanguageCodeA3));
                //Now select the index that matches
                if (merchantProfile.MerchantData.Language.ToString().Length > 0)
                {
                    cboLanguage.SelectedItem = merchantProfile.MerchantData.Language;
                    _Language = (TypeISOLanguageCodeA3)cboLanguage.SelectedItem;
                }
                //First Populate with the Enumeration
                cboCurrencyCode.DataSource = Enum.GetValues(typeof(TypeISOCurrencyCodeA3));
                //Now select the index that matches
                if (merchantProfile.MerchantData.Language.ToString().Length > 0)
                {
                    cboCurrencyCode.SelectedItem = merchantProfile.TransactionData.BankcardTransactionDataDefaults.CurrencyCode;
                    _CurrencyCode = (TypeISOCurrencyCodeA3)cboCurrencyCode.SelectedItem;
                }

                //First Populate with the Enumeration
                cboCustomerPresent.DataSource = Enum.GetValues(typeof(CustomerPresent));
                //Now select the index that matches
                if (merchantProfile.TransactionData.BankcardTransactionDataDefaults.CustomerPresent.ToString().Length > 0)
                {
                    cboCustomerPresent.SelectedItem = merchantProfile.TransactionData.BankcardTransactionDataDefaults.CustomerPresent;
                    _CustomerPresent = (CustomerPresent)cboCustomerPresent.SelectedItem;
                }

                //First Populate with the Enumeration
                cboRequestACI.DataSource = Enum.GetValues(typeof(RequestACI));
                //Now select the index that matches
                if (merchantProfile.TransactionData.BankcardTransactionDataDefaults.RequestACI.ToString().Length > 0)
                {
                    cboRequestACI.SelectedItem = merchantProfile.TransactionData.BankcardTransactionDataDefaults.RequestACI;
                    _RequestACI = (RequestACI)cboRequestACI.SelectedItem;
                }

                //First Populate with the Enumeration
                cboMerchantIndustryType.DataSource = Enum.GetValues(typeof(IndustryType));
                if (merchantProfile.MerchantData.BankcardMerchantData.IndustryType.ToString().Length > 0)
                {
                    cboMerchantIndustryType.SelectedItem = merchantProfile.MerchantData.BankcardMerchantData.IndustryType;
                    _MerchantIndustryType = (IndustryType)cboMerchantIndustryType.SelectedItem;
                }

                //First Populate with the Enumeration
                cboEntryMode.DataSource = Enum.GetValues(typeof(EntryMode));
                if (merchantProfile.TransactionData.BankcardTransactionDataDefaults.EntryMode.ToString().Length > 0)
                {
                    cboEntryMode.SelectedItem = merchantProfile.TransactionData.BankcardTransactionDataDefaults.EntryMode;
                    _EntryMode = (EntryMode)cboEntryMode.SelectedItem;
                }

                _Add = false; //In this case it's an update and not an add
                cmdAddUpdate.Text = "Update";
            }
            

            if (_bcs != null)
            {
                if (_strServiceID == "C82ED00001" || _strServiceID == "71C8700001" ||
                    _strServiceID == "88D9300001" || _strServiceID == "B447F00001" ||
                    _strServiceID == "D806000001" || _strServiceID == "E88FD00001")
                    showBCPExpandedFields();
                else if (_strServiceID == "168511300C" || _strServiceID == "9999999999")
                    showBCPExpandedFields();
                else
                {
                    showBCPFields();
                }
            }

            if (_ecks != null)
            {
                showECKFields();
            }
            if (_svas != null)
            {
                showSVAFields();
            }
        }
        public void CallingForm(MerchantProfile merchantProfile, bool blnNewProfile, BankcardService bcs, ElectronicCheckingService ecks, StoredValueService svas, string serviceId)
        {
            _bcs = bcs;
            _ecks = ecks;
            _svas = svas;
            _strServiceID = serviceId;

            hideAllFields();
            //Since MerchantProfile is saved at the serviceId level, display serviceId.
            //txtMerchantProfileServiceId.Text = merchantProfile.ServiceId;

            if (serviceId.Length < 1)
                txtMerchantProfileServiceId.Text = "ServiceId not selected in calling form";
            else
                txtMerchantProfileServiceId.Text = serviceId;

            //Populate combo boxes with the Enumeration
            cboCountryCode.Sorted = true;
            cboCountryCode.DataSource = Enum.GetValues(typeof(TypeISOCountryCodeA3));
            cboCountryCode.SelectedItem = TypeISOCountryCodeA3.NotSet;

            cboLanguage.Sorted = true;
            cboLanguage.DataSource = Enum.GetValues(typeof(TypeISOLanguageCodeA3));
            cboLanguage.SelectedItem = TypeISOLanguageCodeA3.NotSet;

            cboCurrencyCode.Sorted = true;
            cboCurrencyCode.DataSource = Enum.GetValues(typeof(TypeISOCurrencyCodeA3));
            cboCurrencyCode.SelectedItem = TypeISOCurrencyCodeA3.NotSet;

            cboCustomerPresent.Sorted = true;
            cboCustomerPresent.DataSource = Enum.GetValues(typeof(CustomerPresent));
            cboCustomerPresent.SelectedItem = CustomerPresent.NotSet;

            cboRequestACI.Sorted = true;
            cboRequestACI.DataSource = Enum.GetValues(typeof(RequestACI));
            cboRequestACI.SelectedItem = RequestACI.IsCPSMeritCapable;

            cboEntryMode.Sorted = true;
            cboEntryMode.DataSource = Enum.GetValues(typeof(EntryMode));
            cboEntryMode.SelectedItem = EntryMode.NotSet;

            cboMerchantIndustryType.Sorted = true;
            cboMerchantIndustryType.DataSource = Enum.GetValues(typeof(IndustryType));
            cboMerchantIndustryType.SelectedItem = IndustryType.NotSet;

            if (_bcs != null)
            {
                if (_strServiceID == "C82ED00001" || _strServiceID == "71C8700001" ||
                    _strServiceID == "88D9300001" || _strServiceID == "B447F00001" ||
                    _strServiceID == "D806000001" || _strServiceID == "E88FD00001")
                    showBCPExpandedFields();
                else if (_strServiceID == "168511300C" || _strServiceID == "9999999999")
                    showBCPExpandedFields();
                else
                {
                    showBCPFields();
                }
            }

            if (_ecks != null)
            {
                showECKFields();
            }
            if (_svas != null)
            {
                showSVAFields();
            }
        }
Exemple #8
0
        public void CallingForm(MerchantProfile merchantProfile, bool blnNewProfile, BankcardService bcs, ElectronicCheckingService ecks, StoredValueService svas, string serviceId)
        {
            _bcs          = bcs;
            _ecks         = ecks;
            _svas         = svas;
            _strServiceID = serviceId;

            hideAllFields();
            //Since MerchantProfile is saved at the serviceId level, display serviceId.
            txtMerchantProfileServiceId.Text = merchantProfile.ServiceId;

            if (blnNewProfile)
            {//New profile to add to CWS
                cmdAddUpdate.Text = "Add";

                //Populate combo boxes with the Enumeration
                cboCountryCode.Sorted       = true;
                cboCountryCode.DataSource   = Enum.GetValues(typeof(TypeISOCountryCodeA3));
                cboCountryCode.SelectedItem = TypeISOCountryCodeA3.NotSet;

                cboLanguage.Sorted       = true;
                cboLanguage.DataSource   = Enum.GetValues(typeof(TypeISOLanguageCodeA3));
                cboLanguage.SelectedItem = TypeISOLanguageCodeA3.NotSet;

                cboCurrencyCode.Sorted       = true;
                cboCurrencyCode.DataSource   = Enum.GetValues(typeof(TypeISOCurrencyCodeA3));
                cboCurrencyCode.SelectedItem = TypeISOCurrencyCodeA3.NotSet;


                cboCustomerPresent.Sorted       = true;
                cboCustomerPresent.DataSource   = Enum.GetValues(typeof(CustomerPresent));
                cboCustomerPresent.SelectedItem = CustomerPresent.NotSet;

                cboRequestACI.Sorted       = true;
                cboRequestACI.DataSource   = Enum.GetValues(typeof(RequestACI));
                cboRequestACI.SelectedItem = RequestACI.IsCPSMeritCapable;

                cboEntryMode.Sorted       = true;
                cboEntryMode.DataSource   = Enum.GetValues(typeof(EntryMode));
                cboEntryMode.SelectedItem = EntryMode.NotSet;

                cboMerchantIndustryType.Sorted       = true;
                cboMerchantIndustryType.DataSource   = Enum.GetValues(typeof(IndustryType));
                cboMerchantIndustryType.SelectedItem = IndustryType.NotSet;
            }
            else
            {//Existing Profile to Update;
                //Note : items commented out are not use so no need to wire up a text box as well as add to 'SaveMerchantInformation()'
                txtProfileId.Text     = merchantProfile.ProfileId;
                txtProfileId.ReadOnly = true;
                lblLastUpdated.Text   = "Last Updated : " + merchantProfile.LastUpdated;
                //MerchantData
                //MerchantData.Address
                txtCity.Text           = merchantProfile.MerchantData.Address.City;
                txtPostalCode.Text     = merchantProfile.MerchantData.Address.PostalCode;
                txtStateProvince.Text  = merchantProfile.MerchantData.Address.StateProvince.ToString();
                txtStreetAddress1.Text = merchantProfile.MerchantData.Address.Street1;
                txtStreetAddress2.Text = merchantProfile.MerchantData.Address.Street2;

                txtCustomerServiceInternet.Text = merchantProfile.MerchantData.CustomerServiceInternet;
                txtCustomerServicePhone.Text    = merchantProfile.MerchantData.CustomerServicePhone;
                txtMerchantId.Text = merchantProfile.MerchantData.MerchantId;
                txtName.Text       = merchantProfile.MerchantData.Name;
                txtPhone.Text      = merchantProfile.MerchantData.Phone;
                txtTaxId.Text      = merchantProfile.MerchantData.TaxId;
                if (_bcs != null)
                {
                    //MerchantData.BankcardMerchantData
                    txtABANumber.Text   = merchantProfile.MerchantData.BankcardMerchantData.ABANumber;
                    txtAcquirerBIN.Text = merchantProfile.MerchantData.BankcardMerchantData.AcquirerBIN;
                    txtAgentBank.Text   = merchantProfile.MerchantData.BankcardMerchantData.AgentBank;
                    txtAgentChain.Text  = merchantProfile.MerchantData.BankcardMerchantData.AgentChain;
                    txtClientNum.Text   = merchantProfile.MerchantData.BankcardMerchantData.ClientNumber;
                    txtLocation.Text    = merchantProfile.MerchantData.BankcardMerchantData.Location;
                    //txtTBD.Text = _MerchantProfile.MerchantData.BankcardMerchantData.PrintCustomerServicePhone == "";
                    txtSecondaryTerminalId.Text = merchantProfile.MerchantData.BankcardMerchantData.SecondaryTerminalId;
                    txtSettlementAgent.Text     = merchantProfile.MerchantData.BankcardMerchantData.SettlementAgent;
                    txtSharingGroup.Text        = merchantProfile.MerchantData.BankcardMerchantData.SharingGroup;
                    txtSIC.Text                    = merchantProfile.MerchantData.BankcardMerchantData.SIC;
                    txtStoreId.Text                = merchantProfile.MerchantData.BankcardMerchantData.StoreId;
                    txtSocketNum.Text              = merchantProfile.MerchantData.BankcardMerchantData.TerminalId;
                    txtTimeZoneDifferential.Text   = merchantProfile.MerchantData.BankcardMerchantData.TimeZoneDifferential;
                    txtReimbursementAttribute.Text = merchantProfile.MerchantData.BankcardMerchantData.ReimbursementAttribute;
                }
                if (_svas != null)
                {
                    //MerchantData.StoredValueMerchantData
                    txtAgentChain.Text    = merchantProfile.MerchantData.StoredValueMerchantData.AgentChain;
                    txtClientNum.Text     = merchantProfile.MerchantData.StoredValueMerchantData.ClientNumber;
                    txtSIC.Text           = merchantProfile.MerchantData.StoredValueMerchantData.SIC;
                    txtStoreId.Text       = merchantProfile.MerchantData.StoredValueMerchantData.StoreId;
                    txtSocketNum.Text     = merchantProfile.MerchantData.StoredValueMerchantData.TerminalId;
                    _MerchantIndustryType = merchantProfile.MerchantData.StoredValueMerchantData.IndustryType;
                }
                if (_ecks != null)
                {
                    //MerchantData.ElectronicCheckingMerchantData
                    txtMerchantId.Text = merchantProfile.MerchantData.ElectronicCheckingMerchantData.OrginatorId;
                    txtStoreId.Text    = merchantProfile.MerchantData.ElectronicCheckingMerchantData.SiteId;
                    txtSocketNum.Text  = merchantProfile.MerchantData.ElectronicCheckingMerchantData.ProductId;
                }

                //First Populate with the Enumeration
                cboCountryCode.DataSource = Enum.GetValues(typeof(TypeISOCountryCodeA3));
                //Now select the index that matches
                if (merchantProfile.MerchantData.Address.CountryCode.ToString().Length > 0)
                {
                    cboCountryCode.SelectedItem = merchantProfile.MerchantData.Address.CountryCode;
                    _CountryCode = (TypeISOCountryCodeA3)cboCountryCode.SelectedItem;
                }
                //First Populate with the Enumeration
                cboLanguage.DataSource = Enum.GetValues(typeof(TypeISOLanguageCodeA3));
                //Now select the index that matches
                if (merchantProfile.MerchantData.Language.ToString().Length > 0)
                {
                    cboLanguage.SelectedItem = merchantProfile.MerchantData.Language;
                    _Language = (TypeISOLanguageCodeA3)cboLanguage.SelectedItem;
                }
                //First Populate with the Enumeration
                cboCurrencyCode.DataSource = Enum.GetValues(typeof(TypeISOCurrencyCodeA3));
                //Now select the index that matches
                if (merchantProfile.MerchantData.Language.ToString().Length > 0)
                {
                    cboCurrencyCode.SelectedItem = merchantProfile.TransactionData.BankcardTransactionDataDefaults.CurrencyCode;
                    _CurrencyCode = (TypeISOCurrencyCodeA3)cboCurrencyCode.SelectedItem;
                }

                //First Populate with the Enumeration
                cboCustomerPresent.DataSource = Enum.GetValues(typeof(CustomerPresent));
                //Now select the index that matches
                if (merchantProfile.TransactionData.BankcardTransactionDataDefaults.CustomerPresent.ToString().Length > 0)
                {
                    cboCustomerPresent.SelectedItem = merchantProfile.TransactionData.BankcardTransactionDataDefaults.CustomerPresent;
                    _CustomerPresent = (CustomerPresent)cboCustomerPresent.SelectedItem;
                }

                //First Populate with the Enumeration
                cboRequestACI.DataSource = Enum.GetValues(typeof(RequestACI));
                //Now select the index that matches
                if (merchantProfile.TransactionData.BankcardTransactionDataDefaults.RequestACI.ToString().Length > 0)
                {
                    cboRequestACI.SelectedItem = merchantProfile.TransactionData.BankcardTransactionDataDefaults.RequestACI;
                    _RequestACI = (RequestACI)cboRequestACI.SelectedItem;
                }

                //First Populate with the Enumeration
                cboMerchantIndustryType.DataSource = Enum.GetValues(typeof(IndustryType));
                if (merchantProfile.MerchantData.BankcardMerchantData.IndustryType.ToString().Length > 0)
                {
                    cboMerchantIndustryType.SelectedItem = merchantProfile.MerchantData.BankcardMerchantData.IndustryType;
                    _MerchantIndustryType = (IndustryType)cboMerchantIndustryType.SelectedItem;
                }

                //First Populate with the Enumeration
                cboEntryMode.DataSource = Enum.GetValues(typeof(EntryMode));
                if (merchantProfile.TransactionData.BankcardTransactionDataDefaults.EntryMode.ToString().Length > 0)
                {
                    cboEntryMode.SelectedItem = merchantProfile.TransactionData.BankcardTransactionDataDefaults.EntryMode;
                    _EntryMode = (EntryMode)cboEntryMode.SelectedItem;
                }

                _Add = false; //In this case it's an update and not an add
                cmdAddUpdate.Text = "Update";
            }


            if (_bcs != null)
            {
                if (_strServiceID == "C82ED00001" || _strServiceID == "71C8700001" ||
                    _strServiceID == "88D9300001" || _strServiceID == "B447F00001" ||
                    _strServiceID == "D806000001" || _strServiceID == "E88FD00001")
                {
                    showBCPExpandedFields();
                }
                else if (_strServiceID == "168511300C" || _strServiceID == "9999999999")
                {
                    showBCPExpandedFields();
                }
                else
                {
                    showBCPFields();
                }
            }

            if (_ecks != null)
            {
                showECKFields();
            }
            if (_svas != null)
            {
                showSVAFields();
            }
        }
Exemple #9
0
        static void Main(string[] args)
        {
            #region Preparing the Application to Transact

            #region Setup Clients

            bool certification = bool.Parse(ConfigurationManager.AppSettings["certification"]);

            // setup service information client from service reference generated code
            var svcClient = new CWSServiceInformationClient(new BasicHttpsBinding()
            {
                MaxReceivedMessageSize = 20000000
            },
                                                            new EndpointAddress("https://api" + (certification ? ".cert." : ".") + "nabcommerce.com/2.0.18/SvcInfo"));

            // setup transaction client from service reference generated code
            var txnClient = new CwsTransactionProcessingClient(new BasicHttpsBinding(),
                                                               new EndpointAddress("https://api" + (certification ? ".cert." : ".") + "nabcommerce.com/2.0.18/Txn"));

            string applicationProfileId = ConfigurationManager.AppSettings["applicationProfileId"];
            string merchantProfileId    = ConfigurationManager.AppSettings["merchantProfileId"];;

            #endregion

            #region SignOnWithToken

            string identityToken = ConfigurationManager.AppSettings["identityToken"];

            string sessionToken = svcClient.SignOnWithToken(identityToken);

            #endregion

            #region GetServiceInformation

            ServiceInformation serviceInfo = svcClient.GetServiceInformation(sessionToken);

            BankcardService service = serviceInfo.BankcardServices.First();
            //// the serviceId represents the payment processor (global, firstdata, chase, etc.)
            string serviceId = service.ServiceId;
            // if Capture is supported, the service is host capture
            bool serviceIsHostCapture = service.Operations.Capture;
            // if CaptureAll is supprted, the service is terminal capture
            bool serviceIsTermCapture = service.Operations.CaptureAll;

            #endregion

            #endregion

            #region Transacting

            if (serviceIsHostCapture)
            {
                #region Host Capture workflow

                try
                {
                    #region Verify

                    var verifyRequest = new BankcardTransaction()
                    {
                        TenderData = new BankcardTenderData()
                        {
                            CardData = new CardData1()
                            {
                                CardType = TypeCardType.Visa,
                                PAN      = "5100000000000016",
                                Expire   = "1224",
                            },
                            CardSecurityData = new CardSecurityData1()
                            {
                                AVSData = new AVSData()
                                {
                                    Street        = "123 Rain Road",
                                    City          = "Aurora",
                                    StateProvince = "CO",
                                    PostalCode    = "80080",
                                },
                                CVData         = "383",
                                CVDataProvided = CVDataProvided.Provided,
                            },
                        },
                        TransactionData = new BankcardTransactionData()
                        {
                            Amount       = 0.00M,
                            EntryMode    = NabVelocity.Txn.EntryMode.Keyed,
                            IndustryType = NabVelocity.Txn.IndustryType.Ecommerce,
                        },
                        CustomerData = new TransactionCustomerData()
                        {
                        }
                    };

                    var verifyResponse = (BankcardTransactionResponse)txnClient.Verify(sessionToken, verifyRequest,
                                                                                       applicationProfileId, merchantProfileId, serviceId);

                    Console.WriteLine("(Verify) Status: " + verifyResponse.Status + "\r\n"
                                      + "CV Result: " + verifyResponse.CVResult + "\r\n"
                                      + "AVS Postal Result: " + verifyResponse.AVSResult.PostalCodeResult + "\r\n");

                    #endregion

                    #region Authorize

                    var authRequest = new BankcardTransaction()
                    {
                        TenderData = new BankcardTenderData()
                        {
                            CardData = new CardData1()
                            {
                                CardType = TypeCardType.Visa,
                                PAN      = "5100000000000016",
                                Expire   = "1224",
                            },
                            CardSecurityData = new CardSecurityData1()
                            {
                                AVSData = new AVSData()
                                {
                                    Street        = "123 Rain Road",
                                    City          = "Aurora",
                                    StateProvince = "CO",
                                    PostalCode    = "80080",
                                },
                                CVData         = "383",
                                CVDataProvided = CVDataProvided.Provided,
                            },
                        },
                        TransactionData = new BankcardTransactionData()
                        {
                            CurrencyCode = NabVelocity.Txn.TypeISOCurrencyCodeA3.USD,
                            OrderNumber  = "123456",
                            Amount       = 15.00M,
                            EntryMode    = NabVelocity.Txn.EntryMode.Keyed,
                            IndustryType = NabVelocity.Txn.IndustryType.Ecommerce,
                        },
                    };

                    var authResponse = (BankcardTransactionResponse)txnClient.Authorize(sessionToken, authRequest,
                                                                                        applicationProfileId, merchantProfileId, serviceId);

                    Console.WriteLine("(Authorize) Status: " + authResponse.Status + "\r\n"
                                      + "Amount: " + authResponse.Amount + "\r\n"
                                      + "ApprovalCode: " + authResponse.ApprovalCode + "\r\n"
                                      + "TransactionId: " + authResponse.TransactionId + "\r\n");

                    #endregion

                    #region Capture

                    var captureDifferenceData = new BankcardCapture()
                    {
                        TransactionId = authResponse.TransactionId,
                        Amount        = authResponse.Amount + 1.00M,
                    };

                    var captureResponse = (BankcardCaptureResponse)txnClient.Capture(sessionToken, captureDifferenceData,
                                                                                     applicationProfileId, serviceId);

                    Console.WriteLine("(Capture) Status: " + captureResponse.Status + "\r\n"
                                      + "Amount: " + captureResponse.TransactionSummaryData.NetTotals.NetAmount + "\r\n"
                                      + "TransactionId: " + captureResponse.TransactionId + "\r\n");

                    #endregion

                    #region AuthAndCapture

                    var authAndCaptureRequest = new BankcardTransaction()
                    {
                        TenderData = new BankcardTenderData()
                        {
                            CardData = new CardData1()
                            {
                                CardType = TypeCardType.Visa,
                                PAN      = "5100000000000016",
                                Expire   = "1224",
                            },
                            CardSecurityData = new CardSecurityData1()
                            {
                                AVSData = new AVSData()
                                {
                                    Street        = "123 Rain Road",
                                    City          = "Aurora",
                                    StateProvince = "CO",
                                    PostalCode    = "80080",
                                },
                                CVData         = "383",
                                CVDataProvided = CVDataProvided.Provided,
                            },
                        },
                        TransactionData = new BankcardTransactionData()
                        {
                            CurrencyCode = NabVelocity.Txn.TypeISOCurrencyCodeA3.USD,
                            OrderNumber  = "123456",
                            Amount       = 15.00M,
                            EntryMode    = NabVelocity.Txn.EntryMode.Keyed,
                            IndustryType = NabVelocity.Txn.IndustryType.Ecommerce,
                        },
                    };

                    var authAndCapResponse = (BankcardTransactionResponse)txnClient.AuthorizeAndCapture(sessionToken, authAndCaptureRequest,
                                                                                                        applicationProfileId, merchantProfileId, serviceId);

                    Console.WriteLine("(AuthAndCapture) Status: " + authAndCapResponse.Status + "\r\n"
                                      + "Amount: " + authAndCapResponse.Amount + "\r\n"
                                      + "ApprovalCode: " + authAndCapResponse.ApprovalCode + "\r\n"
                                      + "TransactionId: " + authAndCapResponse.TransactionId + "\r\n");

                    #endregion

                    #region ReturnById

                    var returnByIdRequest = new BankcardReturn()
                    {
                        TransactionId       = authAndCapResponse.TransactionId,
                        TransactionDateTime = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss.fffzzz"),
                    };

                    var returnByIdResponse = (BankcardTransactionResponse)txnClient.ReturnById(sessionToken, returnByIdRequest,
                                                                                               applicationProfileId, serviceId);

                    Console.WriteLine("(ReturnById) Status: " + returnByIdResponse.Status + "\r\n"
                                      + "Amount: " + returnByIdResponse.Amount + "\r\n"
                                      + "ApprovalCode: " + returnByIdResponse.ApprovalCode + "\r\n"
                                      + "TransactionId: " + returnByIdResponse.TransactionId + "\r\n");

                    #endregion

                    #region ReturnUnlinked

                    var returnRequest = new BankcardTransaction()
                    {
                        TenderData = new BankcardTenderData()
                        {
                            CardData = new CardData1()
                            {
                                CardType = TypeCardType.Visa,
                                PAN      = "5100000000000016",
                                Expire   = "1224",
                            },
                        },
                        TransactionData = new BankcardTransactionData()
                        {
                            CurrencyCode = NabVelocity.Txn.TypeISOCurrencyCodeA3.USD,
                            OrderNumber  = "123456",
                            Amount       = 15.00M,
                            EntryMode    = NabVelocity.Txn.EntryMode.Keyed,
                            IndustryType = NabVelocity.Txn.IndustryType.Ecommerce,
                        },
                    };

                    var returnUnlinkedResponse = (BankcardTransactionResponse)txnClient.ReturnUnlinked(sessionToken, returnRequest,
                                                                                                       applicationProfileId, merchantProfileId, serviceId);

                    Console.WriteLine("(ReturnUnlinked) Status: " + returnUnlinkedResponse.Status + "\r\n"
                                      + "Amount: " + returnUnlinkedResponse.Amount + "\r\n"
                                      + "ApprovalCode: " + returnUnlinkedResponse.ApprovalCode + "\r\n"
                                      + "TransactionId: " + returnUnlinkedResponse.TransactionId + "\r\n");

                    #endregion

                    #region Tokenized Transactions

                    // build a transaction
                    var tokenizedRequest = new BankcardTransaction()
                    {
                        TenderData = new BankcardTenderData()
                        {
                            // we only need to use a token in the tender data now
                            PaymentAccountDataToken = verifyResponse.PaymentAccountDataToken
                        },
                        TransactionData = new BankcardTransactionData()
                        {
                            CurrencyCode = NabVelocity.Txn.TypeISOCurrencyCodeA3.USD,
                            OrderNumber  = "123456",
                            Amount       = 15.00M,
                            EntryMode    = NabVelocity.Txn.EntryMode.Keyed,
                            IndustryType = NabVelocity.Txn.IndustryType.Ecommerce,
                        },
                    };

                    authResponse = (BankcardTransactionResponse)txnClient.Authorize(sessionToken, tokenizedRequest,
                                                                                    applicationProfileId, merchantProfileId, serviceId);
                    authAndCapResponse = (BankcardTransactionResponse)txnClient.AuthorizeAndCapture(sessionToken, tokenizedRequest,
                                                                                                    applicationProfileId, merchantProfileId, serviceId);
                    returnUnlinkedResponse = (BankcardTransactionResponse)txnClient.ReturnUnlinked(sessionToken, tokenizedRequest,
                                                                                                   applicationProfileId, merchantProfileId, serviceId);

                    #endregion

                    #region Adjust

                    var adjustReq = new Adjust()
                    {
                        Amount        = 1.00M,
                        TransactionId = authAndCapResponse.TransactionId,
                    };

                    Response adjustResponse = txnClient.Adjust(sessionToken, adjustReq, applicationProfileId, serviceId);

                    Console.WriteLine("(Adjust) Status: " + adjustResponse.Status + "\r\n"
                                      + "StatusMessage: " + adjustResponse.StatusMessage + "\r\n"
                                      + "TransactionId: " + adjustResponse.TransactionId + "\r\n");

                    #endregion

                    #region Undo

                    var undoRequest = new BankcardUndo()
                    {
                        TransactionId = authResponse.TransactionId,
                    };

                    Response undoResponse = txnClient.Undo(sessionToken, undoRequest, applicationProfileId, serviceId);

                    Console.WriteLine("(Undo) Status: " + undoResponse.Status + "\r\n"
                                      + "StatusMessage: " + undoResponse.StatusMessage + "\r\n"
                                      + "TransactionId: " + undoResponse.TransactionId + "\r\n");

                    #endregion
                }
                catch (FaultException <NabVelocity.Txn.CWSValidationResultFault> ex)
                {
                    foreach (var validationError in ex.Detail.Errors)
                    {
                        Console.WriteLine(string.Format("Validatior error: {0} - {1}",
                                                        validationError.RuleLocationKey, validationError.RuleMessage));
                    }
                }

                #endregion
            }

            if (serviceIsTermCapture)
            {
                #region Term Capture Workflow

                try
                {
                    #region Verify

                    var verifyRequest = new BankcardTransaction()
                    {
                        TenderData = new BankcardTenderData()
                        {
                            CardData = new CardData1()
                            {
                                CardType = TypeCardType.Visa,
                                PAN      = "4111111111111111",
                                Expire   = "1224",
                            },
                            CardSecurityData = new CardSecurityData1()
                            {
                                AVSData = new AVSData()
                                {
                                    Street        = "123 Rain Road",
                                    City          = "Aurora",
                                    StateProvince = "CO",
                                    PostalCode    = "80080",
                                },
                                CVData         = "123",
                                CVDataProvided = CVDataProvided.Provided,
                            },
                        },
                        TransactionData = new BankcardTransactionData()
                        {
                            Amount       = 0.00M,
                            EntryMode    = NabVelocity.Txn.EntryMode.Keyed,
                            IndustryType = NabVelocity.Txn.IndustryType.Ecommerce,
                        },
                        CustomerData = new TransactionCustomerData()
                        {
                        }
                    };

                    var verifyResponse = (BankcardTransactionResponse)txnClient.Verify(sessionToken, verifyRequest,
                                                                                       applicationProfileId, merchantProfileId, serviceId);

                    Console.WriteLine("(Verify) Status: " + verifyResponse.Status + "\r\n"
                                      + "CV Result: " + verifyResponse.CVResult + "\r\n"
                                      + "AVS Postal Result: " + verifyResponse.AVSResult.PostalCodeResult + "\r\n");

                    #endregion

                    #region Authorize

                    var authRequest = new BankcardTransaction()
                    {
                        TenderData = new BankcardTenderData()
                        {
                            CardData = new CardData1()
                            {
                                CardType = TypeCardType.Visa,
                                PAN      = "4111111111111111",
                                Expire   = "1224",
                            },
                            CardSecurityData = new CardSecurityData1()
                            {
                                AVSData = new AVSData()
                                {
                                    Street        = "123 Rain Road",
                                    City          = "Aurora",
                                    StateProvince = "CO",
                                    PostalCode    = "80080",
                                },
                                CVData         = "123",
                                CVDataProvided = CVDataProvided.Provided,
                            },
                        },
                        TransactionData = new BankcardTransactionData()
                        {
                            CurrencyCode = NabVelocity.Txn.TypeISOCurrencyCodeA3.USD,
                            OrderNumber  = "123456",
                            Amount       = 15.00M,
                            EntryMode    = NabVelocity.Txn.EntryMode.Keyed,
                            IndustryType = NabVelocity.Txn.IndustryType.Ecommerce,
                        },
                    };

                    var authResponse = (BankcardTransactionResponse)txnClient.Authorize(sessionToken, authRequest,
                                                                                        applicationProfileId, merchantProfileId, serviceId);

                    Console.WriteLine("(Authorize) Status: " + authResponse.Status + "\r\n"
                                      + "Amount: " + authResponse.Amount + "\r\n"
                                      + "ApprovalCode: " + authResponse.ApprovalCode + "\r\n"
                                      + "TransactionId: " + authResponse.TransactionId + "\r\n");

                    #endregion

                    #region Capture Selective

                    var captureSelectiveDifferenceData = new BankcardCapture()
                    {
                        TransactionId = authResponse.TransactionId,
                        Amount        = authResponse.Amount + 1.00M,
                    };

                    Response[] captureSelectiveResponses = txnClient.CaptureSelective(sessionToken, new[] { authResponse.TransactionId },
                                                                                      new[] { captureSelectiveDifferenceData }, applicationProfileId, serviceId);

                    foreach (var response in captureSelectiveResponses)
                    {
                        if (response.Status == Status.Failure)
                        {
                            Console.WriteLine("(Capture Selective) Status: " + response.Status + "\r\n"
                                              + "StatusMessage: " + response.StatusMessage + "\r\n"
                                              + "TransactionId: " + response.TransactionId + "\r\n");
                        }
                        else
                        {
                            var captureResponse = (BankcardCaptureResponse)response;

                            Console.WriteLine("(Capture Selective) Status: " + captureResponse.Status + "\r\n"
                                              + "Industry: " + captureResponse.IndustryType + "\r\n"
                                              + "Sales Count: " + captureResponse.TransactionSummaryData.SaleTotals.Count + "\r\n"
                                              + "Sales Amount: " + captureResponse.TransactionSummaryData.SaleTotals.NetAmount + "\r\n"
                                              + "Return Count: " + captureResponse.TransactionSummaryData.ReturnTotals.Count + "\r\n"
                                              + "Return Amount: " + captureResponse.TransactionSummaryData.ReturnTotals.NetAmount + "\r\n"
                                              + "TransactionId: " + captureResponse.TransactionId + "\r\n");
                        }
                    }

                    #endregion

                    #region ReturnById

                    var returnByIdRequest = new BankcardReturn()
                    {
                        TransactionId       = authResponse.TransactionId,
                        TransactionDateTime = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss.fffzzz"),
                    };

                    var returnByIdResponse = (BankcardTransactionResponse)txnClient.ReturnById(sessionToken, returnByIdRequest,
                                                                                               applicationProfileId, serviceId);

                    Console.WriteLine("(ReturnById) Status: " + returnByIdResponse.Status + "\r\n"
                                      + "Amount: " + returnByIdResponse.Amount + "\r\n"
                                      + "ApprovalCode: " + returnByIdResponse.ApprovalCode + "\r\n"
                                      + "TransactionId: " + returnByIdResponse.TransactionId + "\r\n");

                    #endregion

                    #region ReturnUnlinked

                    var returnRequest = new BankcardTransaction()
                    {
                        TenderData = new BankcardTenderData()
                        {
                            CardData = new CardData1()
                            {
                                CardType = TypeCardType.Visa,
                                PAN      = "4111111111111111",
                                Expire   = "1224",
                            },
                        },
                        TransactionData = new BankcardTransactionData()
                        {
                            CurrencyCode = NabVelocity.Txn.TypeISOCurrencyCodeA3.USD,
                            OrderNumber  = "123456",
                            Amount       = 15.00M,
                            EntryMode    = NabVelocity.Txn.EntryMode.Keyed,
                            IndustryType = NabVelocity.Txn.IndustryType.Ecommerce,
                        },
                    };

                    var returnUnlinkedResponse = (BankcardTransactionResponse)txnClient.ReturnUnlinked(sessionToken, returnRequest,
                                                                                                       applicationProfileId, merchantProfileId, serviceId);

                    Console.WriteLine("(ReturnUnlinked) Status: " + returnUnlinkedResponse.Status + "\r\n"
                                      + "Amount: " + returnUnlinkedResponse.Amount + "\r\n"
                                      + "ApprovalCode: " + returnUnlinkedResponse.ApprovalCode + "\r\n"
                                      + "TransactionId: " + returnUnlinkedResponse.TransactionId + "\r\n");

                    #endregion

                    #region Tokenized Transactions

                    // build a transaction
                    var tokenizedRequest = new BankcardTransaction()
                    {
                        TenderData = new BankcardTenderData()
                        {
                            // we only need to use a token in the tender data now
                            PaymentAccountDataToken = verifyResponse.PaymentAccountDataToken
                        },
                        TransactionData = new BankcardTransactionData()
                        {
                            CurrencyCode = NabVelocity.Txn.TypeISOCurrencyCodeA3.USD,
                            OrderNumber  = "123456",
                            Amount       = 15.00M,
                            EntryMode    = NabVelocity.Txn.EntryMode.Keyed,
                            IndustryType = NabVelocity.Txn.IndustryType.Ecommerce,
                        },
                    };

                    authResponse = (BankcardTransactionResponse)txnClient.Authorize(sessionToken, tokenizedRequest,
                                                                                    applicationProfileId, merchantProfileId, serviceId);
                    returnUnlinkedResponse = (BankcardTransactionResponse)txnClient.ReturnUnlinked(sessionToken, tokenizedRequest,
                                                                                                   applicationProfileId, merchantProfileId, serviceId);

                    #endregion

                    #region Adjust

                    var adjustReq = new Adjust()
                    {
                        Amount        = 1.00M,
                        TransactionId = authResponse.TransactionId,
                    };

                    Response adjustResponse = txnClient.Adjust(sessionToken, adjustReq, applicationProfileId, serviceId);

                    Console.WriteLine("(Adjust) Status: " + adjustResponse.Status + "\r\n"
                                      + "StatusMessage: " + adjustResponse.StatusMessage + "\r\n"
                                      + "TransactionId: " + adjustResponse.TransactionId + "\r\n");

                    #endregion

                    #region Undo

                    var undoRequest = new BankcardUndo()
                    {
                        TransactionId = adjustResponse.TransactionId,
                    };

                    Response undoResponse = txnClient.Undo(sessionToken, undoRequest, applicationProfileId, serviceId);

                    Console.WriteLine("(Undo) Status: " + undoResponse.Status + "\r\n"
                                      + "StatusMessage: " + undoResponse.StatusMessage + "\r\n"
                                      + "TransactionId: " + undoResponse.TransactionId + "\r\n");

                    #endregion

                    #region Capture All

                    Response[] captureAllResponses = txnClient.CaptureAll(sessionToken, null,
                                                                          null, applicationProfileId, merchantProfileId, serviceId);

                    foreach (var response in captureAllResponses)
                    {
                        if (response.Status == Status.Failure)
                        {
                            Console.WriteLine("(Capture All) Status: " + response.Status + "\r\n"
                                              + "StatusMessage: " + response.StatusMessage + "\r\n"
                                              + "TransactionId: " + response.TransactionId + "\r\n");
                        }
                        else
                        {
                            var captureResponse = (BankcardCaptureResponse)response;

                            Console.WriteLine("(Capture All) Status: " + captureResponse.Status + "\r\n"
                                              + "Industry: " + captureResponse.IndustryType + "\r\n"
                                              + "Sales Count: " + captureResponse.TransactionSummaryData.SaleTotals.Count + "\r\n"
                                              + "Sales Amount: " + captureResponse.TransactionSummaryData.SaleTotals.NetAmount + "\r\n"
                                              + "Return Count: " + captureResponse.TransactionSummaryData.ReturnTotals.Count + "\r\n"
                                              + "Return Amount: " + captureResponse.TransactionSummaryData.ReturnTotals.NetAmount + "\r\n"
                                              + "TransactionId: " + captureResponse.TransactionId + "\r\n");
                        }
                    }

                    #endregion
                }
                catch (FaultException <NabVelocity.Txn.CWSValidationResultFault> ex)
                {
                    foreach (var validationError in ex.Detail.Errors)
                    {
                        Console.WriteLine(string.Format("Validatior error: {0} - {1}",
                                                        validationError.RuleLocationKey, validationError.RuleMessage));
                    }
                }

                #endregion
            }

            #endregion
        }
        private void GetServiceInformation()
        {
            if (!_blnPersistedConfigExists)
                Helper.ServiceID = "";

            if (!_blnPersistedConfigExists)
                Helper.MerchantProfileId = "";

            //Reset previously selected services
            _bcs = null;
            _ecks = null;
            _svas = null;

            //The GetServiceInformation() operation provides information about the services that are available to a specific Service Key.
            //This operation should be automatically invoked during initial application configuration, and manually by an application
            //administrator if/when available services are updated.

            _si = Helper.Cwssic.GetServiceInformation(Helper.SessionToken);
        }