protected override byte[] OnGetData() { if (this.Result == ResponseCode.Success && !BadDeals.Check(BatchNo, SerialNo, ShopName, PosName)) { ShopNameTo = (ShopNameTo ?? "").Trim(); lock (string.Intern(string.IsNullOrWhiteSpace(ShopNameTo) ? ShopName : ShopNameTo)) { string accountName = this.AccountName.Substring(0, AccountNameLength); string token = GetToken(); _i8583.settabx_data(1, accountName); // KeysEntry key = GetCurrentKey(); var PosKey = Context.AccountDealService.GetPosKey(ShopName, PosName); KeysEntry key = PosKey == null ? null : new KeysEntry() { Key1 = PosKey.Key1, Key2 = PosKey.Key2, PosName = PosName, ShopName = ShopName }; if (Result == ResponseCode.Success) { var seriaNo = BatchNo + SerialNo; string passwrod = ""; if (this.AccountName.IndexOf("d") > -1) { passwrod = GetPassword(accountName);//磁条卡 } else { passwrod = GetPassword(this.AccountName);//IC卡 } //string passwrod = GetPassword(this.AccountName);//IC卡 var rsp = GetResponse(token, seriaNo, passwrod, accountName); Result = rsp.Code; if (Result == ResponseCode.Success) { SerialServerNo = rsp.SerialServerNo; Amount = rsp.Amount; //返回余额 DealAmount = rsp.DealAmount; //返回实际交易金额(不能大于上送的交易金额) var theCode = GetTheCode(); base.SetAccount(theCode, rsp.ThisTimePoint, 0, rsp.Point); var i8583 = _i8583.Clone(); i8583.settabx_data(63, ""); var data = i8583.Pack8583("0210"); string mac = LCDES.MACEncrypt(data, key.Key2, 2); mac = Helper.WrapMac("deal", mac); _i8583.settabx_data(63, mac); } } } } return(_i8583.Pack8583("0210")); }
protected override byte[] OnGetData() { if (Result == ResponseCode.Success && !BadDeals.Check(BatchNo, SerialNo, ShopName, PosName)) { string accountName = AccountName.Substring(0, AccountNameLength); string token = GetToken(); _i8583.settabx_data(1, accountName); //KeysEntry key = GetCurrentKey(); var PosKey = Context.AccountDealService.GetPosKey(ShopName, PosName); KeysEntry key = PosKey == null ? null : new KeysEntry() { Key1 = PosKey.Key1, Key2 = PosKey.Key2, PosName = PosName, ShopName = ShopName }; if (Result == ResponseCode.Success) { string passwrod = ""; if (this.AccountName.IndexOf("d") > -1) { passwrod = GetPassword(accountName);//´ÅÌõ¿¨ } else { passwrod = GetPassword(this.AccountName);//IC¿¨ } string seriaNo = _i8583.gettabx_data(60); if (seriaNo.Length > 12) { seriaNo = seriaNo.Substring(0, 12); } AccountServiceResponse rsp = Context.AccountDealService.CancelDonePrePay(new CancelPayRequest(accountName, passwrod, PosName, DealAmount, BatchNo + SerialNo, seriaNo, token, ShopName)); Result = rsp.Code; //this._i8583.settabx_data(37, rsp.DealCode); if (Result == ResponseCode.Success) { this._i8583.settabx_data(37, SerialNo); SerialServerNo = rsp.SerialServerNo.PadLeft(12, '0'); Amount = rsp.Amount; var i8583 = _i8583.Clone(); i8583.settabx_data(63, ""); var data = i8583.Pack8583("0210"); string mac = LCDES.MACEncrypt(data, key.Key2, 2); mac = Helper.WrapMac("cancel_done_prepay", mac); _i8583.settabx_data(63, mac); } } } return(_i8583.Pack8583("0210")); }
protected override byte[] OnGetData() { if (this.Result == ResponseCode.Success && !BadDeals.Check(BatchNo, SerialNo, ShopName, PosName)) { string accountName = this.AccountName.Substring(0, AccountNameLength); string token = GetToken(); _i8583.settabx_data(1, accountName); //KeysEntry key = GetCurrentKey(); var PosKey = Context.AccountDealService.GetPosKey(ShopName, PosName); KeysEntry key = PosKey == null ? null : new KeysEntry() { Key1 = PosKey.Key1, Key2 = PosKey.Key2, PosName = PosName, ShopName = ShopName }; if (Result == ResponseCode.Success) { var seriaNo = BatchNo + SerialNo; string passwrod = ""; if (this.AccountName.IndexOf("d") > -1) { passwrod = GetPassword(accountName);//´ÅÌõ¿¨ } else { passwrod = GetPassword(this.AccountName);//IC¿¨ } //var pos = _posRepository.GetPosByName(PosName); AccountServiceResponse rsp = Context.AccountDealService.DonePrePay(new Ecard.Infrastructure.PrePayRequest(BatchNo + this.OldSerialNo, this.OldPayDate, accountName, passwrod, PosName, DealAmount, seriaNo, token, ShopName)); //rsp = _accountService.Pay(pos, ShopName, accountName, passwrod, DealAmount, dealItem, token); Result = rsp.Code; if (Result == ResponseCode.Success) { this._i8583.settabx_data(37, SerialNo); SerialServerNo = rsp.SerialServerNo.PadLeft(12, '0'); Amount = rsp.Amount; var i8583 = _i8583.Clone(); i8583.settabx_data(63, ""); var data = i8583.Pack8583("0210"); string mac = LCDES.MACEncrypt(data, key.Key2, 2); mac = Helper.WrapMac("done_prepay", mac); _i8583.settabx_data(63, mac); } } } return(_i8583.Pack8583("0210")); }
protected override byte[] OnGetData() { if (this.Result == ResponseCode.Success && !BadDeals.Check(BatchNo, SerialNo, ShopName, PosName)) { string accountName = this.AccountName.Substring(0, AccountNameLength); string token = GetToken(); _i8583.settabx_data(1, accountName); // KeysEntry key = GetCurrentKey(); var PosKey = Context.AccountDealService.GetPosKey(ShopName, PosName); KeysEntry key = PosKey == null ? null : new KeysEntry() { Key1 = PosKey.Key1, Key2 = PosKey.Key2, PosName = PosName, ShopName = ShopName }; if (Result == ResponseCode.Success) { lock (string.Intern(string.IsNullOrWhiteSpace(ShopNameTo) ? ShopName : ShopNameTo)) { string passwrod = ""; if (this.AccountName.IndexOf("d") > -1) { passwrod = GetPassword(accountName);//磁条卡 } else { passwrod = GetPassword(this.AccountName);//IC卡 } var rsp = Context.AccountDealService.PrePay(new PayRequest(accountName, passwrod, PosName, DealAmount, BatchNo + SerialNo, token, ShopName, ShopName)); Result = rsp.Code; this._i8583.settabx_data(37, SerialNo); if (Result == ResponseCode.Success) { SerialServerNo = rsp.SerialServerNo.PadLeft(12, '0'); Amount = rsp.Amount; var i8583 = _i8583.Clone(); i8583.settabx_data(63, ""); var data = i8583.Pack8583("0110"); string mac = LCDES.MACEncrypt(data, key.Key2, 2); mac = Helper.WrapMac("prepay", mac); _i8583.settabx_data(63, mac); } } } } return(_i8583.Pack8583("0110")); }