示例#1
0
        public PrismaInterfaceExtApp(IExecutionContext context)
            : base(context)
        {
            try
            {
                this.OpsInitEvent              += OnOpsInitEvent;
                this.OpsTmedPreviewEvent       += OnOpsTmedPreviewEvent;
                this.OpsTransactionCancelEvent += OnOpsTransactionCancelEvent;
                this.OpsErrorMessageEvent      += OnOpsErrorMessageEvent;

                string path = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().ManifestModule.FullyQualifiedName) + "\\";
                ConfigMgr.Instance.Initialize(path + "\\bp.payment.config");

                if (ConfigMgr.Instance.ShowIFCVersion)
                {
                    OpsContext.ShowMessage("PRISMA PAYMENT Version: " + this.GetType().Assembly.GetName().Version.ToString());
                }

                LOG.Info("{Message}", "PRISMA PAYMENT Version: " + this.GetType().Assembly.GetName().Version.ToString());

                mCardPlanMap = GetCCPlanDef();

                IntegratedPOS.SetPortParameters(
                    new COM_PARAMS()
                {
                    COMName  = "COM" + ConfigMgr.Instance.LAPOSSerialPortNumber,
                    BaudRate = UInt16.Parse(ConfigMgr.Instance.LAPOSSerialPortBaudRate),
                    Parity   = (byte)(ConfigMgr.Instance.LAPOSSerialPortParity.Length == 1 ? ConfigMgr.Instance.LAPOSSerialPortParity[0] : 'N'),
                    ByteSize = UInt16.Parse(ConfigMgr.Instance.LAPOSSerialPortByteSize),
                    StopBits = UInt16.Parse(ConfigMgr.Instance.LAPOSSerialPortStopBits),
                });

                string errMsg = "";
                if (IntegratedPOS.GetIssuer(out mCardDefList, ref errMsg) != VPI_ERROR_CODE.VPI_OK)
                {
                    LOG.Error("{Message}", $"Error reading card list from POS\r\n{errMsg}");
                }

                //LOG.Instance.LogEvent("MP QR PAYMENT Version: " + this.GetType().Assembly.GetName().Version.ToString(), TWS.Log.Logger.VERBOSITY_LEVEL.INFO);

                /* FOR FUTURE USE
                 * //licensing
                 * LicenseMgr.Instance.Initialize(path, path, "TWS.Simphony.MP.Payment.dll", false);
                 *
                 * mHardID =   HardwareIdReader.GetHash(OpsContext.Product + "_" +
                 *          OpsContext.LocationId + "_" +
                 *          OpsContext.PropertyID + "_" +
                 *          OpsContext.WorkstationID);
                 *
                 * mLicensed = LicenseMgr.Instance.ValidateLicense("TWS.Simphony.MP.Payment.dll", mHardID, true);*/
            }
            catch (Exception ex)
            {
                OpsContext.ShowException(ex, "Exception creating MPQRInterfaceExtApp");
                throw ex;
            }
        }