码迷,mamicode.com
首页 > 其他好文 > 详细

IC卡写卡操作流程

时间:2016-01-05 12:13:35      阅读:180      评论:0      收藏:0      [点我收藏+]

标签:

var icData = new ICData(); var deviceResult = crd.CRDICPowerOn(); if (!deviceResult.IsSuccess) return null; var result = crd.CRDPBOCInit(); if (!result.IsSuccess) return null; var pseResult = crd.CRDPBOCGetPSEAID("1PAY.SYS.DDF01"); if (!pseResult.IsSuccess) return null; var selectADFResult = crd.CRDPBOCSelectADF(pseResult.Result.AId); if (!selectADFResult.IsSuccess) return null; var afl = crd.CRDPBOCGetProOption(0, 0); if (!afl.IsSuccess) return null; var readAppdata = crd.CRDPBOCReadAppData(afl.Result); if (!readAppdata.IsSuccess) return null; var readTrackInfo = crd.CRDPBOCGetTrack2Data(); if (!readTrackInfo.IsSuccess) return null; var cardNumber = crd.CRDPBOCGetICInfo(BaseInfoType.CardNo); if (!cardNumber.IsSuccess) return null; var initForLoad = crd.CRDPBOCInitForLoad(); if (!initForLoad.IsSuccess) return null; var trackInfo = readTrackInfo.Result.Track2Data.Split(‘=‘); icData.凭证代号 = trackInfo.Count() == 2 ? "26" + trackInfo[1].Substring(10, 7) : ""; icData.卡号 = cardNumber.Result.CardNo; icData.卡号序号 = cardNumber.Result.CardNoIndex; icData.安全认证信息 = crd.CRDPBOCReadIcTLV(initForLoad.Result.CardNoAndIndex, initForLoad.Result.ARQCRawData, initForLoad.Result.ARQCData); .....发送报文获取IC卡写卡脚本 根据行内返回脚本能需要调用外部认证(SS_CRD_PBOCExternalAuth) 也可能在执行脚本方法做认证(不需要交易调用外部认证方法) var exeScirpt = crd.CRDPBOCExecScirpt(response.脚本); TradeLogger.DebugFormat("ExecScirpt结果:{0}", exeScirpt.Result); if (!exeScirpt.IsSuccess) { writeCardIsSuccess = false; } var finishLoad = crd.CRDPBOCFinishLoad(); TradeLogger.DebugFormat("FinishLoad结果:{0}", finishLoad.Result); if (!finishLoad.IsSuccess) { writeCardIsSuccess = false; } var close = crd.CRDPBOCClose(); TradeLogger.DebugFormat("PBOCClose结果:{0}", close.Result); if (!close.IsSuccess) { writeCardIsSuccess = false; } var powerOff = crd.CRDICPowerOff(); TradeLogger.DebugFormat("PowerOff结果:{0}", powerOff.Result); if (!powerOff.IsSuccess) { writeCardIsSuccess = false; }

IC卡写卡操作流程

标签:

原文地址:http://www.cnblogs.com/guanglin/p/5101579.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!