Files
2021-01-12 22:04:24 +08:00

315 lines
11 KiB
XML

<?xml version='1.0' encoding='UTF-8'?>
<FrontTab>
<Macro name="Init_CAP01" desc="交易的初始化">
<Exec func="PUB:InitGWA" /> <!--交易初始化-->
<Set>AC_DT=$GWA.AC_DT</Set>
<Set>TXN_TM=GETDATETIME()</Set>
<Set>CRE_TM=SUBSTR($TXN_TM,9,6)</Set> <!--交易时间-->
<Set>CRE_DT=SUBSTR($TXN_TM,1,8)</Set> <!--交易日期-->
<Exec func="PUB:IsExistNode" error="IGNORE">
<Arg name="FieldName" value="ORD_DT_TM" />
</Exec>
<If condition="INTCMP(~RetCod,3,1)">
<Set>ORD_TM=SUBSTR($ORD_DT_TM,9,6)</Set> <!--订单交易时间-->
<Set>ORD_DT=SUBSTR($ORD_DT_TM,1,8)</Set> <!--订单交易日期-->
</If>
</Macro>
<Macro name="GET_JRN_NO" desc="取交易流水号">
<!--Set>JRN_NO=SUBSTR($GWA.JRN_NO,3,16)</Set-->
<!-- 取交易流水号 BEGIN-->
<Exec func="PUB:GetUniqueNo">
<Arg name="Name" value="jrn_nextval" />
<Arg name="SeqNam" value="jrn_no_sequence" />
<Arg name="Len" value="10" />
</Exec>
<If condition="~RetCod!=0">
<Set>Rsp_Cd=2040901</Set>
<Set>Rsp_Msg=平台取流水号失败</Set>
<Return />
</If>
<Set>JRN_NO=STRCAT(SUBSTR($AC_DT,3,6),$jrn_nextval)</Set>
<Delete>jrn_nextval</Delete>
</Macro>
<Macro name="SQL_RcvConfirm" desc="初始化及接入认证检查配套SQL语句">
<DynSentence name="QryMercInf"> <!--查询商户基本信息-->
<Sentence>
SELECT MERC_STS,MERC_TRD_CLS,MERC_TYP, MERC_CNM MERC_NAM
FROM URMTMINF
WHERE MERC_ID = ? AND MERC_TYP = '12'
</Sentence>
<Fields>MERC_ID|</Fields>
</DynSentence>
<DynSentence name="QryBnkInf"> <!--查询合作机构信息-->
<Sentence>
SELECT ENB_FLG,CORG_NM CORG_NO_NM,OUT_MERC_ID CORG_MERC_ID FROM CMMTORGN WHERE CORP_ORG=?
</Sentence>
<Fields>CORG_NO|</Fields>
</DynSentence>
<DynSentence name="QryCOP_BUS_TYP"> <!--查询合作机构接口信息-->
<Sentence>
SELECT BUS_OPN_FLG FROM CMMTBUSI WHERE CORP_ORG=? AND COP_BUS_TYP=?
</Sentence>
<Fields>CORG_NO|COP_BUS_TYP|</Fields>
</DynSentence>
<DynSentence name="TRspCdCSWRspCd"> <!--第三方返回码转换为本地错误码-->
<Sentence>
SELECT RSP_CD,SHOW_TEXT RSP_MSG FROM CAPERRCSW WHERE CORP_ORG=? AND TRSP_CD=?
</Sentence>
<Fields>CORG_NO|TRSP_CD|</Fields>
</DynSentence>
</Macro>
<Macro name="ChkRcvInf" desc="商户接入认证检查">
<Exec func="PUB:ReadRecord" error="IGNORE">
<Arg name="SqlCmd" value="QryMercInf"/>
</Exec>
<If condition="~RetCod=2">
<Set>Rsp_Cd=2040301</Set>
<Set>Rsp_Msg=该商户不存在</Set>
<Return/>
</If>
<ElseIf condition="~RetCod!=0">
<Set>Rsp_Cd=80</Set>
<Set>Rsp_Msg=查询数据库失败</Set>
<Return/>
</ElseIf>
<If condition="INTCMP($MERC_STS,4,0)">
<Set>Rsp_Cd=31</Set>
<Set>Rsp_Msg=该商户状态不正常</Set>
<Return/>
</If>
</Macro>
<Macro name="TRspCdCSWRspCd" desc="第三方返回码转换为本地错误码">
<Exec func="PUB:ReadRecord" error="IGNORE">
<Arg name="SqlCmd" value="TRspCdCSWRspCd"/>
</Exec>
<If condition="~RetCod!=0">
<Set>Rsp_Cd=80</Set>
<Set>Rsp_Msg=内部错误</Set>
</If>
</Macro>
<Macro name="GET_CAP_ORD_NO" desc="取银联订单号">
<!-- 获取银联序列号 BEGIN-->
<Exec func="PUB:GetUniqueNo">
<Arg name="Name" value="nextval" />
<Arg name="SeqNam" value="upop_sequence" />
<Arg name="Len" value="8" />
</Exec>
<If condition="~RetCod!=0">
<Set>Rsp_Cd=80</Set>
<Set>Rsp_Msg=内部错误</Set>
<Return />
</If>
<Set>CAP_ORD_NO=STRCAT(SUBSTR($CORG_MERC_ID,4,4),SUBSTR($CORG_MERC_ID,12,4),$nextval)</Set>
<Delete>nextval</Delete>
</Macro>
<Macro name="GET_CUP_BAT_NO" desc="取银联批次号">
<!-- 取银联批次号 BEGIN-->
<Exec func="PUB:GetUniqueNo">
<Arg name="Name" value="nextbatno" />
<Arg name="SeqNam" value="upop_batno_sequence" />
<Arg name="Len" value="4" />
</Exec>
<If condition="~RetCod!=0">
<Set>Rsp_Cd=80</Set>
<Set>Rsp_Msg=内部错误</Set>
<Return />
</If>
<Set>CORG_DSK_NO=$nextbatno</Set>
<Delete>nextbatno</Delete>
</Macro>
<Macro name="GetBnkInf" desc="查询合作机构信息及合作机构开通那些接口">
<Exec func="PUB:ReadRecord" error="IGNORE">
<Arg name="SqlCmd" value="QryBnkInf"/>
</Exec>
<If condition="~RetCod=2">
<Set>Rsp_Cd=31</Set>
<Set>Rsp_Msg=该合作机构不存在</Set>
<Return/>
</If>
<ElseIf condition="~RetCod!=0">
<Set>Rsp_Cd=80</Set>
<Set>Rsp_Msg=查询数据库失败</Set>
<Return/>
</ElseIf>
<If condition="INTCMP($ENB_FLG,4,1)">
<Set>Rsp_Cd=31</Set>
<Set>Rsp_Msg=该合作机构未启用</Set>
<Return/>
</If>
<Exec func="PUB:ReadRecord" error="IGNORE">
<Arg name="SqlCmd" value="QryCOP_BUS_TYP"/>
</Exec>
<If condition="~RetCod=2">
<Set>Rsp_Cd=31</Set>
<Set>Rsp_Msg=合作机构的接口信息未开通</Set>
<Return/>
</If>
<ElseIf condition="~RetCod!=0">
<Set>Rsp_Cd=80</Set>
<Set>Rsp_Msg=查询数据库失败</Set>
<Return/>
</ElseIf>
<If condition="INTCMP($BUS_OPN_FLG,4,0)">
<Set>Rsp_Cd=31</Set>
<Set>Rsp_Msg=合作机构的接口信息未开通</Set>
<Return/>
</If>
</Macro>
<!--更新流水记录状态-->
<Macro name="UptJournal">
<!--更新流水记录-->
<Exec func="PUB:ExecSql" error="IGNORE">
<Arg name="SqlCmd" value="UpdTXNJNL"/>
</Exec>
<If condition="~RetCod != 0">
<Set>Rsp_Cd=80</Set>
<Set>Rsp_Msg=更新流水表失败</Set>
<Return/>
</If>
</Macro>
<!--更新系统清分控制表状态-->
<Macro name="UptDayCtl">
<Exec func="PUB:ExecSql" error="IGNORE">
<Arg name="SqlCmd" value="UpdDayCtl"/>
</Exec>
<If condition="~RetCod != 0">
<Set>Rsp_Cd=80</Set>
<Set>Rsp_Msg=更新系统清分控制表失败</Set>
<Return/>
</If>
</Macro>
<!--更新系统清分控制表状态-->
<Macro name="UptDayCtl_END">
<Exec func="PUB:ExecSql" error="IGNORE">
<Arg name="SqlCmd" value="UpdDayCtl_END"/>
</Exec>
<If condition="~RetCod != 0">
<Set>Rsp_Cd=80</Set>
<Set>Rsp_Msg=更新系统清分控制表失败</Set>
<Return/>
</If>
</Macro>
<!--删除关键域避免重复-->
<Macro name="DltFields">
<Delete>MERC_ID</Delete>
<Delete>ORG_MERC_ID</Delete>
<Delete>AGT_ORG</Delete>
<Delete>TXN_AMT</Delete>
</Macro>
<!--删除关键域避免重复-->
<Macro name="DltMercFields">
<Delete>MERC_ID</Delete>
<Delete>MERC_TYP</Delete>
<Delete>MERC_NAM</Delete>
</Macro>
<!--到银联查询代收订单状态的宏-->
<Macro name="QueryOrdSts_CUP">
<!-- 预留增加动态路由选择 -->
<Set>RTR_SVR=$ORTR_SVR</Set>
<Set>RTR_COD=4040</Set>
<!--发送银行或者银联进行交易状态查询-->
<!--Exec func="PUB:CallThirdComm" error="IGNORE">
<Arg name="TTxnCd" value="$RTR_COD"/>
<Arg name="ObjSvr" value="$RTR_SVR"/>
</Exec-->
<!--test 信息开始-->
<Set>~RetCod=0</Set>
<Set>TTxn_St=S</Set>
<Set>Txn_Sts=S</Set>
<Set>TTXN_CD=3010</Set>
<Set>TRSP_CD=000000</Set>
<Set>ORN_TRSP_CD=000000</Set>
<Set>TRSP_MSG=交易成功</Set>
<!--test 信息结束-->
<If condition="~RetCod!=0">
<Set>Rsp_Cd=00</Set>
<Set>ORsp_Cd=83</Set>
<Set>OSTATUS=503</Set>
<Set>Rsp_Msg=原交易状态未知</Set>
<Return/>
</If>
<Else>
<If condition="IS_EQUAL_STRING($ORN_TRSP_CD,000000)">
<If condition="IS_EQUAL_STRING($OTXN_CD,2040310)">
<Set>Rsp_Cd=00</Set>
<Set>ORsp_Cd=00</Set>
<Set>OSTATUS=000</Set>
<Set>Rsp_Msg=交易成功</Set>
<Exec func="PUB:ExecSql" error="IGNORE">
<Arg name="SqlCmd" value="UpdOTxn_STS"/>
</Exec>
<If condition="~RetCod != 0">
<Set>Rsp_Cd=80</Set>
<Set>Rsp_Msg=更新原流水状态失败</Set>
<Return/>
</If>
<Return/>
</If>
<ElseIf condition="IS_EQUAL_STRING($OTXN_CD,2040311)">
<Set>Rsp_Cd=00</Set>
<Set>ORsp_Cd=00</Set>
<Set>OSTATUS=103</Set>
<Set>Rsp_Msg=交易已冲正/撤销</Set>
<Exec func="PUB:ExecSql" error="IGNORE">
<Arg name="SqlCmd" value="UpdOTxn_STS"/>
</Exec>
<If condition="~RetCod != 0">
<Set>Rsp_Cd=80</Set>
<Set>Rsp_Msg=更新原流水状态失败</Set>
<Return/>
</If>
<Return/>
</ElseIf>
</If>
<Else>
<Set>Rsp_Cd=00</Set>
<Set>ORsp_Cd=00</Set>
<Set>OSTATUS=102</Set>
<Set>Rsp_Msg=原交易状态未知</Set>
<Return/>
</Else>
</Else>
</Macro>
<!--更新订单状态-->
<Macro name="UPD_CAP_ORD_NO">
<Exec func="PUB:ExecSql" error="IGNORE">
<Arg name="SqlCmd" value="UPD_CAP_ORD_NO"/>
</Exec>
<If condition="~RetCod != 0">
<Set>Rsp_Cd=80</Set>
<Set>Rsp_Msg=更新流水表失败</Set>
<Return/>
</If>
</Macro>
</FrontTab>