Example #1
0
        public IResponse GetResponse()
        {
            var mac = this.Mac;
            // var key = Globals.GetKeyEntry(ShopName, PosName);
            var       PosKey = Context.AccountDealService.GetPosKey(ShopName, PosName);
            KeysEntry key    = PosKey == null ? null : new KeysEntry()
            {
                Key1 = PosKey.Key1, Key2 = PosKey.Key2, PosName = PosName, ShopName = ShopName
            };
            var rsp = base.GetResponse <DealResponse_>(2, 3, 11, 12, 13, 14, 25, 32, 41, 42, 44, 49, 53, 54, 60, 64);

            rsp.Result = ResponseCode.Success;
            if (key == null)
            {
                rsp.Result = ResponseCode.NeedSignIn;
            }
            else
            {
                if (!LCDES.MACDecrypt(_data.ToArray(), key.Key2, mac))
                {
                    rsp.Result = ResponseCode.MacError;
                }
                else
                {
                    //rsp.AccountName = AccountName;
                    rsp.DealAmount = DealAmount;
                }
            }

            return(rsp);
        }
Example #2
0
        public IResponse GetResponse()
        {
            var mac = this.Mac;
            // var key = Globals.GetKeyEntry(ShopName, PosName);
            var       PosKey = Context.AccountDealService.GetPosKey(ShopName, PosName);
            KeysEntry key    = PosKey == null ? null : new KeysEntry()
            {
                Key1 = PosKey.Key1, Key2 = PosKey.Key2, PosName = PosName, ShopName = ShopName
            };
            ResponseBase rsp      = null;
            string       dealType = _i8583.gettabx_data(2);

            if (dealType.StartsWith("31"))
            {
                rsp = base.GetResponse <QueryShopResponse>(3, 4, 11, 22, 25, 26, 35, 36, 41, 42, 49, 52, 53, 60, 61, 64);
            }
            if (dealType.StartsWith("03"))
            {
                rsp = base.GetResponse <PrePayResponse>(3, 4, 11, 22, 25, 26, 35, 36, 41, 42, 49, 52, 53, 60, 61, 64);

                rsp.DealAmount = DealAmount;
                if (DealAmount <= 0)
                {
                    rsp.Result = ResponseCode.InvalidateAmount;
                }
            }
            else if (dealType.StartsWith("20"))
            {
                rsp = base.GetResponse <PrePayCancelResponse>(2, 3, 4, 11, 25, 41, 42, 49, 52, 53, 60, 61, 64);
                //rsp = base.GetResponse<PrePayCancelResponse>(ids.ToArray());

                rsp.DealAmount = DealAmount;
                if (DealAmount <= 0)
                {
                    rsp.Result = ResponseCode.InvalidateAmount;
                }
            }
            rsp.Result = ResponseCode.Success;
            if (key == null)
            {
                rsp.Result = ResponseCode.NeedSignIn;
            }
            else
            {
                if (!LCDES.MACDecrypt(_data.ToArray(), key.Key2, mac))
                {
                    rsp.Result = ResponseCode.MacError;
                }
                else
                {
                    rsp.Password    = Password;
                    rsp.AccountName = AccountName;
                    rsp.ShopNameTo  = ShopNameTo;
                }
            }

            return(rsp);
        }
Example #3
0
        public IResponse GetResponse()
        {
            var mac = this.Mac;
            // var key = Globals.GetKeyEntry(ShopName, PosName);
            var       PosKey = Context.AccountDealService.GetPosKey(ShopName, PosName);
            KeysEntry key    = PosKey == null ? null : new KeysEntry()
            {
                Key1 = PosKey.Key1, Key2 = PosKey.Key2, PosName = PosName, ShopName = ShopName
            };                                                                                                                              //Globals.GetKeyEntry(ShopName, PosName);
            ResponseBase rsp      = null;
            string       dealType = _i8583.gettabx_data(2);

            // 查询
            if (dealType.StartsWith("31"))
            {
                rsp = base.GetResponse <QueryResponse>(2, 3, 4, 11, 12, 13, 14, 25, 32, 39, 41, 42, 44, 49, 53, 54, 60, 61, 62, 64);
                //rsp = base.GetResponse<QueryResponse>(2, 3, 11, 12, 13, 14, 25, 32, 39, 41, 42, 44, 49, 53, 54, 60, 61, 62, 64);
                byte[] by = ConvertFrom(NewPassword, NewPassword.Length % 2);
                rsp.NewPassword = System.Text.Encoding.Default.GetString(by);
            }
            // 交易
            else if (dealType.StartsWith("00"))
            {
                //rsp = base.GetResponse<DealResponse>(2, 3, 11, 12, 13, 14, 25, 32, 39, 41, 42, 44, 49, 53, 54, 60, 61, 62, 64);
                if (string.IsNullOrEmpty(this._i8583.gettabx_data(59)) || this._i8583.gettabx_data(59).Substring(0, 2) == "22")
                {
                    rsp = base.GetResponse <DealResponse>(2, 3, 11, 12, 13, 14, 25, 32, 38, 39, 41, 42, 44, 49, 53, 54, 60, 61, 62, 64);
                }

                else if (this._i8583.gettabx_data(59).Substring(0, 2) == "20")
                {
                    rsp = base.GetResponse <PrePayDoneResponse>(2, 3, 11, 12, 13, 14, 25, 32, 38, 39, 41, 42, 44, 49, 53, 54, 60, 61, 62, 64);
                }

                rsp.DealAmount = DealAmount;
                if (DealAmount <= 0)
                {
                    rsp.Result = ResponseCode.InvalidateAmount;
                }
            }
            else if (dealType.StartsWith("20"))
            {
                // rsp = base.GetResponse<DealCancelResponse>(2, 3, 11, 12, 13, 14, 25, 32, 39, 41, 42, 44, 49, 53, 54, 60, 61, 62, 64);
                if (this._i8583.gettabx_data(59).Substring(0, 2) == "23")
                {
                    rsp = base.GetResponse <DealCancelResponse>(2, 3, 11, 12, 13, 14, 25, 32, 38, 39, 41, 42, 44, 49, 53, 54, 60, 61, 62, 64);
                }

                if (this._i8583.gettabx_data(59).Substring(0, 2) == "21")
                {
                    rsp = base.GetResponse <PrePayDoneCancelResponse>(2, 3, 4, 11, 25, 38, 41, 42, 49, 52, 53, 60, 61, 62, 64);
                }
                rsp.DealAmount = DealAmount;
                if (DealAmount <= 0)
                {
                    rsp.Result = ResponseCode.InvalidateAmount;
                }
            }
            var s = Custom1;

            rsp.Result = ResponseCode.Success;
            if (key == null)
            {
                rsp.Result = ResponseCode.NeedSignIn;
            }
            else
            {
                if (!LCDES.MACDecrypt(_data.ToArray(), key.Key2, mac))
                {
                    rsp.Result = ResponseCode.MacError;
                }
                else
                {
                    rsp.Password    = Password;
                    rsp.AccountName = AccountName;
                    rsp.ShopNameTo  = ShopNameTo;
                }
            }

            return(rsp);
        }