public Payment(Client client)
     : base(client)
 {
     _authorise     = new Authorise(this);
     _authorise3D   = new Authorise3D(this);
     _authorise3DS2 = new Authorise3DS2(this);
 }
示例#2
0
 public Payment(Client client)
     : base(client)
 {
     _authorise               = new Authorise(this);
     _authorise3D             = new Authorise3D(this);
     _authorise3DS2           = new Authorise3DS2(this);
     _getAuthenticationResult = new GetAuthenticationResult(this);
 }
示例#3
0
        public static void Authenticate(string username, string password)
        {
            Authorise authorise = null;

            if (HttpContext.Current != null && HttpContext.Current.Session["LoggedUser"] == null)
            {
                HttpContext.Current.Session["LoggedUser"] = new Authorise();
            }

            authorise = (Authorise)HttpContext.Current.Session["LoggedUser"];
            authorise.Authenticate(username, password);
        }
        public static void Authenticate(string email, string password)
        {
            Authorise authorise = null;

            if (HttpContext.Current != null && HttpContext.Current.Session["LoggedEmployee"] == null)
            {
                HttpContext.Current.Session["LoggedEmployee"] = new Authorise();
            }

            authorise = (Authorise)HttpContext.Current.Session["LoggedEmployee"];
            authorise.Authenticate(email, password);
        }
示例#5
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            Authorise.EnforceAuthorisation(eSystemPortion.KPI);

            if (!IsPostBack)
            {
                m_drivers = new Entities.DriverCollection();
                ViewState[C_DRIVER_COLLECTION] = m_drivers;
                BindDrivers();

                cboTrendPeriod.DataSource = Utilities.UnCamelCase(Enum.GetNames(typeof(eKPITrendPeriod)));
                cboTrendPeriod.DataBind();
            }
            else
            {
                m_drivers = (Entities.DriverCollection)ViewState[C_DRIVER_COLLECTION];
            }
        }
示例#6
0
        public async Task SendDataToPie(MessageCommand messageCommand, string ZapOrderId,
                                        int pumpId             = 0, decimal authoriseLimit = 0,
                                        string transactionId   = "", string webhook_start  = "",
                                        string webhook_success = "", string webhook_error  = "")
        {
            var dataByte = new byte[1];

            byte[] buffer = dataByte;
            string dataBuffer;

            try
            {
                switch (messageCommand)
                {
                case MessageCommand.RequestPumpStatus:
                    //return;
                    buffer = new PumpStatusRequest().GetBytes();
                    break;

                case MessageCommand.Reserve:
                    if (PiePumps.Pumps[pumpId - 1].CurrentStatus == PumpStatus.Idle)
                    {
                        PiePumps.Pumps[pumpId - 1].Request           = RequestPumpStatus.RequestReserve;
                        PiePumps.Pumps[pumpId - 1].ZapOrderId        = ZapOrderId;
                        PiePumps.Pumps[pumpId - 1].RequestTriedCount = 0;

                        PiePumps.Pumps[pumpId].UnexectedPumpDispenseCompletedFlag = false;

                        buffer = new Reserve(pumpId, ZapOrderId).GetBytes();
                    }
                    else
                    {
                        // straight away to reject it
                        ReservePump(pumpId, false);
                    }
                    break;

                case MessageCommand.Authorize:
                    if (PiePumps.Pumps[pumpId - 1].Request != RequestPumpStatus.RequestAutorise)
                    {
                        Debug.WriteLine("Failed. Pump is not in RequestAutorise state");
                        AuthorizePump(pumpId, false);
                        break;
                    }

                    PiePumps.Pumps[pumpId - 1].RequestTriedCount        = 0;
                    PiePumps.Pumps[pumpId - 1].BosTransactionId         = transactionId;
                    PiePumps.Pumps[pumpId - 1].WebhookStartDispense     = webhook_start;
                    PiePumps.Pumps[pumpId - 1].WebhookCompletedDispense = webhook_success;
                    PiePumps.Pumps[pumpId - 1].WebhookError             = webhook_error;

                    buffer = new Authorise(pumpId, authoriseLimit).GetBytes();
                    break;

                case MessageCommand.GetFinalization:
                    PiePumps.Pumps[pumpId - 1].Request           = RequestPumpStatus.RequestFinalize;
                    PiePumps.Pumps[pumpId - 1].RequestTriedCount = 0;

                    buffer = new GetFinalization(pumpId).GetBytes();
                    break;

                case MessageCommand.PumpCancel2:
                    PiePumps.Pumps[pumpId - 1].PreviousRequest = PiePumps.Pumps[pumpId - 1].Request;        // probably cancel request is failed

                    if (PiePumps.Pumps[pumpId - 1].CurrentStatus == PumpStatus.Reserved ||
                        PiePumps.Pumps[pumpId - 1].CurrentStatus == PumpStatus.Authorized)
                    {
                        bool okProceed = true;
                        if (ZapOrderId != "")
                        {
                            if (PiePumps.Pumps[pumpId - 1].ZapOrderId != ZapOrderId)                                        // make sure the same order id)
                            {
                                okProceed = false;
                            }
                        }

                        if (okProceed)
                        {
                            PiePumps.Pumps[pumpId - 1].RequestTriedCount = 0;
                            PiePumps.Pumps[pumpId - 1].Request           = RequestPumpStatus.RequestCancel;
                            buffer = new CancelPump(pumpId).GetBytes();

                            break;
                        }
                    }

                    PiePumps.Pumps[pumpId - 1].RequestTriedCount = 9999;                                   // terus cancel
                    processCancel(pumpId - 1, ZapOrderId);
                    return;
                }

                if (messageCommand != MessageCommand.RequestPumpStatus)
                {
                    dataBuffer = Encoding.UTF8.GetString(buffer, 0, buffer.Length);
                    SystemLogs.LogBankServer(dataBuffer, "POS", messageCommand.ToString("G"));
                }
                await Write(buffer);

                if (DEBUG_MODE)
                {
                    if (messageCommand != MessageCommand.RequestPumpStatus)
                    {
                        Debug.WriteLine("--------> Request to Pie for " + messageCommand.ToString("G") + " Pump No:" + pumpId +
                                        " Data:" + Encoding.UTF8.GetString(buffer, 0, buffer.Length));
                    }
                }
            }
            catch (Exception ex)
            {
                dataBuffer = Encoding.UTF8.GetString(buffer, 0, buffer.Length);
                SystemLogs.LogError("SendDataToBankServer Exception", "Error Message: " + ex.Message,
                                    "Buffer:" + dataBuffer);
            }
        }
示例#7
0
 public AuthoriseService(Client client)
     : base(client)
 {
     this._authorise = new Authorise(this);
 }
 protected void Page_Load(object sender, System.EventArgs e)
 {
     Authorise.EnforceAuthorisation(eSystemPortion.KPI);
 }