IC卡写卡操作流程
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; }
本文来自博客园,作者:广林,转载请注明原文链接:https://www.cnblogs.com/guanglin/p/5101579.html