Exemplo n.º 1
0
        internal override void Validate()
        {
            base.Validate();

            if (AcceptorConfig == null)
            {
                throw new ConfigurationException("You must provide a valid AcceptorConfig.");
            }
            else
            {
                AcceptorConfig.Validate(Target.Transit);
            }

            if (string.IsNullOrEmpty(DeviceId))
            {
                throw new ConfigurationException("DeviceId cannot be null.");
            }

            if (string.IsNullOrEmpty(MerchantId))
            {
                throw new ConfigurationException("MerchantId cannot be null.");
            }

            if (string.IsNullOrEmpty(TransactionKey))
            {
                throw new ConfigurationException("TransactionKey cannot be null. Use TransitService.GenerateTransactionKey(...) to generate a transaction key for the config.");
            }
        }
Exemplo n.º 2
0
        internal override void ConfigureContainer(ConfiguredServices services)
        {
            if (_gatewayType == NetworkGatewayType.NWS)
            {
                gateway = new NWSConnector();
            }
            //else if(_gatewayType == NetworkGatewayType.VAPS) {
            //    gateway = new VapsConnector();
            //}
            // connection fields
            gateway.PrimaryEndpoint     = ServiceUrl;
            gateway.PrimaryPort         = PrimaryPort;
            gateway.SecondaryEndpoint   = SecondaryEndpoint;
            gateway.SecondaryPort       = SecondaryPort;
            gateway.Timeout             = Timeout;
            gateway.EnableLogging       = EnableLogging;
            gateway.ForceGatewayTimeout = ForceGatewayTimeout;

            // other fields
            gateway.CompanyId          = CompanyId;
            gateway.ConnectionType     = connectionType;
            gateway.MessageType        = messageType;
            gateway.NodeIdentification = NodeIdentification;
            gateway.ProtocolType       = protocolType;
            gateway.TerminalId         = TerminalId;
            gateway.MerchantType       = MerchantType;
            gateway.EWICMerchantId     = EWICMerchantID;
            gateway.UniqueDeviceId     = UniqueDeviceId;

            // acceptor config
            if (AcceptorConfig == null)
            {
                AcceptorConfig = new AcceptorConfig();
            }
            gateway.AcceptorConfig = AcceptorConfig;

            // stan provider
            gateway.StanProvider = StanProvider;

            // batch provider
            gateway.BatchProvider = BatchProvider;

            services.GatewayConnector = gateway;
        }