public void Entity_TicketPrinted_G2H()
        {
            FFMsg_G2H msg = FreeformEntityFactory.CreateEntity<FFMsg_G2H>(FF_FlowDirection.G2H,
                new FFCreateEntityRequest_G2H()
                {
                    MessageType = FF_AppId_G2H_MessageTypes.FreeForm,
                    Command = FF_AppId_G2H_Commands.ResponseRequest,
                    SessionID = FF_AppId_SessionIds.Tickets,
                    TransactionID = 1,
                });

            FFTgt_B2B_TicketInfo tgt = new FFTgt_B2B_TicketInfo();
            msg.AddTarget(tgt);

            FFTgt_G2H_Ticket_Printed_Request tgt2 = new FFTgt_G2H_Ticket_Printed_Request();
            tgt.AddTarget(tgt2);

            tgt2.BarCode = "100000000078789098";
            tgt2.Amount = 9976;
            tgt2.Type = FF_AppId_TicketTypes.Cashable;

            byte[] buffer = FreeformEntityFactory.CreateBuffer(FF_FlowDirection.G2H, msg);
            string sBuffer = buffer.GetConvertBytesToHexString(string.Empty);
            Assert.AreEqual(sBuffer,
                "[05][A2][BC][8A][01][00][01][00][01][00][11][0A][0F][01][10][00][00][00][00][78][78][90][98][00][00][99][76][00][AE]");
        }
 internal override IFreeformEntity ParseBufferInternal(ref IFreeformEntity entity, IFreeformEntity rootEntity, int id, byte[] buffer)
 {
     FFTgt_B2B_TicketInfo tgt = new FFTgt_B2B_TicketInfo();
     entity = tgt;
     this.ParseBuffer(tgt, rootEntity, buffer, 0, buffer.Length);
     return tgt;
 }
        public void Entity_TicketVoid_G2H()
        {
            FFMsg_G2H msg = FreeformEntityFactory.CreateEntity<FFMsg_G2H>(FF_FlowDirection.G2H,
                new FFCreateEntityRequest_G2H()
                {
                    MessageType = FF_AppId_G2H_MessageTypes.FreeForm,
                    Command = FF_AppId_G2H_Commands.ResponseRequest,
                    SessionID = FF_AppId_SessionIds.Tickets,
                    TransactionID = 1,
                });

            FFTgt_B2B_TicketInfo tgt = new FFTgt_B2B_TicketInfo();
            msg.AddTarget(tgt);

            FFTgt_G2H_Ticket_Void tgt2 = new FFTgt_G2H_Ticket_Void();
            tgt.AddTarget(tgt2);

            tgt2.Barcode = "100000000078789098";
            tgt2.Error = FF_AppId_TicketPrintStatus.PaperOut;

            byte[] buffer = FreeformEntityFactory.CreateBuffer(FF_FlowDirection.G2H, msg);
            string sBuffer = buffer.GetConvertBytesToHexString(string.Empty);
            Assert.AreEqual(sBuffer,
                "[05][A2][BC][8A][01][00][01][00][01][00][0D][0A][0B][02][10][00][00][00][00][78][78][90][98][01][C3]");
        }
 protected override IFreeformEntity_MsgTgt CreateFreeformTarget(IMonitorEntity parent, IMonitorEntity_MsgTgt request)
 {
     MonTgt_H2G_Ticket_Printed_Response tgtSrc = request as MonTgt_H2G_Ticket_Printed_Response;
     if (tgtSrc != null)
     {
         FFTgt_B2B_TicketInfo tgtDest = new FFTgt_B2B_TicketInfo()
         {
             SubTargetData = new FFTgt_H2G_Ticket_Printed_Response()
             {
                 Status = tgtSrc.Status,
             }
         };
         return tgtDest;
     }
     return null;
 }
 protected override IFreeformEntity_MsgTgt CreateFreeformTarget(IMonitorEntity parent, IMonitorEntity_MsgTgt request)
 {
     MonTgt_H2G_Ticket_Redemption_Response tgtSrc = request as MonTgt_H2G_Ticket_Redemption_Response;
     if (tgtSrc != null)
     {
         FFTgt_B2B_TicketInfo tgtDest = new FFTgt_B2B_TicketInfo()
         {
             SubTargetData = new FFTgt_H2G_Ticket_Redemption_Response()
             {
                 Barcode = tgtSrc.Barcode,
                 Amount = tgtSrc.Amount,
                 Type = tgtSrc.Type
             }
         };
         return tgtDest;
     }
     return null;
 }
        public void Entity_TicketRedeem_Start_H2G()
        {
            FFMsg_H2G msg = FreeformEntityFactory.CreateEntity<FFMsg_H2G>(FF_FlowDirection.H2G,
                new FFCreateEntityRequest_H2G()
                {
                    PollCode = FF_AppId_H2G_PollCodes.FreeformResponse,
                    SessionID = FF_AppId_SessionIds.Tickets,
                    TransactionID = 1,
                });

            FFTgt_B2B_TicketInfo tgt = new FFTgt_B2B_TicketInfo();
            msg.AddTarget(tgt);

            FFTgt_H2G_Ticket_Redemption_Response tgt2 = new FFTgt_H2G_Ticket_Redemption_Response();
            tgt.AddTarget(tgt2);

            tgt2.Barcode = "100000000078789098";
            tgt2.Amount = 9976;
            tgt2.Type = FF_AppId_TicketTypes.Cashable;

            byte[] buffer = FreeformEntityFactory.CreateBuffer(FF_FlowDirection.H2G, msg);
            string sBuffer = buffer.GetConvertBytesToHexString(string.Empty);
            Assert.AreEqual(sBuffer,
                "[05][FB][8A][01][00][01][00][01][00][11][0A][0F][03][10][00][00][00][00][78][78][90][98][00][00][99][76][00][0F]");
        }
        public void Entity_TicketRedeem_End_H2G()
        {
            FFMsg_H2G msg = FreeformEntityFactory.CreateEntity<FFMsg_H2G>(FF_FlowDirection.H2G,
                new FFCreateEntityRequest_H2G()
                {
                    PollCode = FF_AppId_H2G_PollCodes.FreeformResponse,
                    SessionID = FF_AppId_SessionIds.Tickets,
                    TransactionID = 1,
                });

            FFTgt_B2B_TicketInfo tgt = new FFTgt_B2B_TicketInfo();
            msg.AddTarget(tgt);

            FFTgt_H2G_Ticket_Redemption_Close tgt2 = new FFTgt_H2G_Ticket_Redemption_Close();
            tgt.AddTarget(tgt2);

            tgt2.Status = FF_AppId_ResponseStatus_Types.Fail;

            byte[] buffer = FreeformEntityFactory.CreateBuffer(FF_FlowDirection.H2G, msg);
            string sBuffer = buffer.GetConvertBytesToHexString(string.Empty);
            Assert.AreEqual(sBuffer,
                "[05][FB][8A][01][00][01][00][01][00][04][0A][02][04][00][5F]");
        }