Exemplo n.º 1
0
        protected internal override void stageExecute(SalePostContext context)
        {
            Sale   dispatchSale = context.getSale();
            Scheme dispatchScheme;
            SchemeAuthorisationResultOrResponse schemeAuthResultOrResp;

            dispatchScheme = context.getScheme();
            //Logger.info("Dispatching sale: " + dispatchSale.Id + " to scheme: " + dispatchScheme.AuthScheme);

            schemeAuthResultOrResp = dispatchScheme.authoriseSale(dispatchSale, null);
            context.responseBuilder().AuthorisationResult.SchemeAuthCode = schemeAuthResultOrResp.AuthResult.SchemeAuthCode;
            context.responseBuilder().ResponseCode = schemeAuthResultOrResp.ResponseCode;
        }
        public override void stageExecute(SalePostContext context)
        {
            if (AuthScheme.AMEX.Equals(context.getScheme().AuthScheme))
            {
                AmexServiceEstablishmentEntity entity = serviceEstablishmentDao.findByCurrency(context.Request.getCurrency().ToString());
                //AmexServiceEstablishmentEntity entity = serviceEstablishmentDao.findByCurrency(context.Request.Currency.CurrencyCode);
                if (entity == null)
                {
                    // throw new EndpointException(string.Format("Invalid Amex Currency: '{0}'", context.Request.Currency.CurrencyCode));
                }
            }

            nextStage(context);
        }
Exemplo n.º 3
0
        protected internal override void stageExecute(SalePostContext context)
        {
            long?  stan;
            Scheme scheme = context.getScheme();

            if (scheme == null)
            {
                //throw new EndpointException("Context Scheme not yet defined");
            }
            stan = scheme.createStan(context.saleBuild().Timestamp);
            //Logger.info("STAN generated for sale: " + stan);
            context.saleBuild().setSTAN(scheme.AuthScheme, stan);
            nextStg(context);
        }
Exemplo n.º 4
0
        protected internal override void stageExecute(SalePostContext context)
        {
            Terminal_Lock @lock = null;

            try
            {
                Sale     sale     = context.saleBuild().createdSale();
                Terminal terminal = sale.Terminal;
                @lock = terminal.@lock(sale.Id.ToString(), sale.Card, context.getScheme().AuthScheme);
                if (@lock != null)
                {
                    // Have the lock.. continue on.
                    //Logger.info("Locked terminal");
                    context.setTerminalStatistics(@lock.CardStatistics, @lock.SchemeStatistics);
                    nextStg(context);
                }
                else
                {
                    // Cannot get lock - Not an error - Already locked, so indicate undesired
                    // concurrency.
                    //Logger.warn("Failed to lock terminal");

                    context.responseBuilder().ResponseCode = ResponseCode.CONCURRENT_AUTHS;
                }
            }
            finally
            {
                if (@lock != null)
                {
                    Action       action;
                    ResponseCode responseCode;

                    responseCode = context.responseBuilder().ResponseCode;
                    if (responseCode != null)
                    {
                        //action = responseCode.Action;
                        action = Action.APPROVE;
                    }
                    else
                    {
                        //Logger.warn("No scheme result");
                        action = Action.DO_NOT_ACCEPT;
                    }
                    //Logger.info("Unlocking, recording Action: {}", action.name());
                    @lock.unlock(action);
                }
            }
        }