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]");
        }
Пример #2
0
        protected override bool OnProcessMessageH2GExternal_SIM(FFTgtExecutionContext context, IFreeformEntity_MsgTgt target)
        {
            FFTgt_H2G_Ticket_Redemption_Response   tgtSrc = target as FFTgt_H2G_Ticket_Redemption_Response;
            FF_AppId_TicketRedemption_Close_Status status = (tgtSrc.Amount > 0 ? FF_AppId_TicketRedemption_Close_Status.Success : FF_AppId_TicketRedemption_Close_Status.CouponRejectedbySystem);

            context.FreeformTargets.Add(TicketsHelper.RedeemTicketComplete(context.SourceMessage.IpAddress,
                                                                           tgtSrc.Barcode, tgtSrc.Amount, tgtSrc.Type, status));
            return(true);
        }