internal static PosResponse DoTransaction(IHpsServicesConfig config, PosRequestVer10Transaction transaction,
                                                  long?clientTransactionId = null)
        {
            var req = new PosRequest {
                Ver10 = new PosRequestVer10 {
                    Header = new PosRequestVer10Header {
                        SecretAPIKey = config.SecretApiKey,
                        LicenseId    = config.LicenseId,
                        SiteId       = config.SiteId,
                        DeviceId     = config.DeviceId,
                        VersionNbr   = config.VersionNumber,
                        UserName     = config.UserName,
                        Password     = config.Password,
                        DeveloperID  = config.DeveloperId,
                        SiteTrace    = config.SiteTrace
                    },
                    Transaction = transaction
                }
            };

            if (clientTransactionId.HasValue)
            {
                req.Ver10.Header.ClientTxnId          = clientTransactionId.Value;
                req.Ver10.Header.ClientTxnIdSpecified = true;
            }

            using (var client = new PosGatewayService {
                Url = HpsConfiguration.SoapServiceUri
            }) {
                return(client.DoTransaction(req));
            }
        }
        internal PosResponse DoTransaction(PosRequestVer10Transaction transaction, long?clientTransactionId = null)
        {
            // Check for a valid config.
            if (IsConfigInvalid())
            {
                throw new HpsAuthenticationException(HpsExceptionCodes.InvalidConfiguration, Resource.Exception_Message_InvalidConfig);
            }

            var req = new PosRequest {
                Ver10 = new PosRequestVer10 {
                    Header = new PosRequestVer10Header {
                        SecretAPIKey = ServicesConfig.SecretApiKey,
                        LicenseId    = ServicesConfig.LicenseId,
                        SiteId       = ServicesConfig.SiteId,
                        DeviceId     = ServicesConfig.DeviceId,
                        VersionNbr   = ServicesConfig.VersionNumber,
                        UserName     = ServicesConfig.UserName,
                        Password     = ServicesConfig.Password,
                        DeveloperID  = ServicesConfig.DeveloperId,
                        SiteTrace    = ServicesConfig.SiteTrace
                    },
                    Transaction = transaction
                }
            };

            if (clientTransactionId.HasValue)
            {
                req.Ver10.Header.ClientTxnId          = clientTransactionId.Value;
                req.Ver10.Header.ClientTxnIdSpecified = true;
            }

            using (var client = new PosGatewayService {
                Url = ServicesConfig.ServiceUrl
            }) {
                return(client.DoTransaction(req));
            }
        }