📄 stock_0213.ec
字号:
retcode = 55; strcpy ( send_net_0213.retcode, "8005" ); strcpy ( send_net_0213.errmsg,"密码不符"); break; case 89: case 115: retcode = 4; strcpy ( send_net_0213.retcode, "8005" ); strcpy ( send_net_0213.errmsg,"主机无此商户"); break; default: retcode = 12; strcpy ( send_net_0213.retcode, "8005" ); strcpy ( send_net_0213.errmsg,"无效交易"); break; } } return( 0 );}int inq_acc_0213_out ( sendstr,sendlen )int *sendlen;unsigned char *sendstr; { int recvlen,net_err,retcode,loop,length, i; char sideinfo[9] = "SAVCICSB",str[100] ; unsigned char recvstr[512]; if ( pack_host_0213_out(sendstr, &sendlen ) ) { WriteLog ( LOGFILE,"pack_host_0213_out err!"); return ( -1 ); } retcode = LUFunction(LU_ALLOC, sideinfo, NULL, NULL); WriteLog ( LOGFILE,"检查LU连路结束!"); if (retcode != 0) { strcpy ( send_net_0213.retcode, "8999" ); strcpy ( send_net_0213.errmsg,"系统错误"); WriteLog ( LOGFILE,"LU_ALLOC err:[%d]",retcode); return(-1); } retcode = LUFunction(LU_SEND, &sendlen, sendstr); WriteLog ( LOGFILE,"向9000发送数据结束!"); if (retcode != 0) { LUFunction(LU_FREE); strcpy ( send_net_0213.retcode, "8999" ); strcpy ( send_net_0213.errmsg,"系统错误"); WriteLog ( LOGFILE,"LU_SEND err:[%d]",retcode); return(-1); } length = MAX_BUFFERSIZE; retcode = LUFunction(LU_RECEIVE, &length, recvstr); WriteLog ( LOGFILE,"接收9000返回数据结束!"); if (retcode != 0) { LUFunction(LU_FREE); strcpy ( send_net_0213.retcode, "8999" ); strcpy ( send_net_0213.errmsg,"系统错误"); WriteLog ( LOGFILE,"LU_RECEIVE err:[%d]",retcode); return(-1); } sendlen = 1; strcpy(sendstr,"1"); retcode = LUFunction(LU_SENDTRUE, &sendlen, sendstr); WriteLog ( LOGFILE,"向9000发送确认数据结束!"); if (retcode != 0) { LUFunction(LU_FREE); strcpy ( send_net_0213.retcode, "8999" ); strcpy ( send_net_0213.errmsg,"系统错误"); WriteLog ( LOGFILE,"LU_SEND err:[%d]",retcode); return(-1); } LUFunction(LU_FREE); unpk_host_0213_out(recvstr,length); return(0);}int pack_host_0213_out(sendbuf, sendlen)int *sendlen;unsigned char *sendbuf;{ int len, i,t,iLen; char tmp[256],amount_p1[15],amount_p2[3],t_amount[15]; char merchant_id[10],*t1,*t2,*tmp1; char worker_4[5], active[2]; char amount[13]; char tmp_pan2[4]; char host_ls[7]; struct head hd; strcpy(hd.jym, "2603"); strcpy(hd.gzh,wk->worker_4); strcpy(hd.sqjb, "000000"); strcpy(hd.bz, "0"); strcpy( hd.sqyh, hd.gzh ); if (get_host_trace(host_ls) <0) { WriteLog(LOGFILE, "get_host_trace error!\n"); return (-1); } hd.lsh = atoi ( host_ls ); memcpy( sendbuf, headstr( hd ), 27 ); /*卡号 16 19位卡的后16位 */ memcpy( tmp,&recv_net_0213.account[3],13); /* 16位卡 */ tmp[13] = '\0'; len = Hmeg( sendbuf, 27, tmp, 0x41 ); /* 卡号1 */ /*转出金额 15 金额 */ t1 = t2 = recv_net_0213.amount; for (t = 0 ; strncmp (t1,".",1) != 0; ) { *t1 ++; t++; } memcpy( amount_p1, t2, t ); amount_p1 [ t ] = '\0'; *t1 ++; memcpy( amount_p2, t1, 2 ); amount_p2 [ 2 ] = '\0'; printf("amount_p1 is [%s]\n",amount_p1); printf("amount_p2 is [%s]\n",amount_p2); memset(t_amount,0x00,sizeof(t_amount)); t1 = t_amount; for(i = 0; i<(15-t-2);i++) { memcpy(t1,"0",1); * t1 ++; } memcpy( t1, amount_p1, t ); for(i = 0; i < t;i++) *t1 ++; memcpy( t1, amount_p2, 2 ); t_amount[15] = '\0'; memcpy( tmp,&t_amount,15); tmp[15] = '\0'; len = Hmeg( sendbuf,len, tmp, 0x42 ); /*现金 15 0 */ len = Hmeg( sendbuf,len, "000000000000000", 0x43 ); /*卡号二 3 19位卡的前三位,即"436" */ memcpy( tmp,&recv_net_0213.account[16],3); /* 16位卡 */ tmp[3] = '\0'; len = Hmeg( sendbuf, len, tmp, 0x4a ); /*VOUCH号 7 VOUCH号 */ memcpy(tmp,&recv_net_0213.repeal_ls,6 ); tmp[6] = '\0'; len = Hmeg( sendbuf, len, tmp, 0x4b ); /*摘要 3 "039"转出 */ len = Hmeg( sendbuf, len, "039", 0x4c ); /*日期 9 当前日期 */ len = Hmeg( sendbuf, len, "000000000", 0x4d ); /*特约商户编号 9 空 8*/ len = Hmeg( sendbuf, len, "000000000", 0x4e ); sendbuf[ len++ ] = 0xff; /* 结束标志 */ *sendlen = len; return (0);}int unpk_host_0213_out(recvbuf, recvlen )short recvlen;unsigned char *recvbuf;{ int flag,i, j, result, retcode; char err1[10], err2[10]; char xm[10],js[16],ye[16]; result = 1; /* packet format error */ if ( recvbuf[ 0 ] != 0x03 || recvbuf[ 1 ] != 0x00 || recvbuf[ 2 ] < 0x00 || recvbuf[ 2 ] > 0x09 && recvbuf[ 2 ] != 0x0f ) { strcpy ( send_net_0213.retcode, "8005" ); strcpy ( send_net_0213.errmsg,"系统错误"); return( -1 ); } /* Accept by host */ if ( recvbuf[ 2 ] == 0x09 ) { result = 0; strcpy ( send_net_0213.retcode, "0000" ); strcpy ( send_net_0213.errmsg,"交易成功"); } /* Reject by host */ else { result = -1; for( i = 7, j = 0; i < 11; i++, j++ ) err1[ j ] = recvbuf[ i ]; asc( err1, 4, err2 ); result = atoi( err2 ); if( result >= 41 && result <= 47 ) result = 34; switch( result ) { case 18: case 84: case 25: retcode = 14; strcpy ( send_net_0213.retcode, "8005" ); strcpy ( send_net_0213.errmsg,"无此卡帐户"); break; case 53: retcode = 57; strcpy ( send_net_0213.retcode, "8005" ); strcpy ( send_net_0213.errmsg,"卡帐户"); break; case 37 : case 70: case 112: retcode = 58; strcpy ( send_net_0213.retcode, "8005" ); strcpy ( send_net_0213.errmsg,"卡帐户"); break; case 31: retcode = 15; strcpy ( send_net_0213.retcode, "8005" ); strcpy ( send_net_0213.errmsg,"卡帐户"); break; case 59: case 60: case 39: retcode = 41; strcpy ( send_net_0213.retcode, "8005" ); strcpy ( send_net_0213.errmsg,"卡在黑名单中"); break; case 50: retcode = 34; strcpy ( send_net_0213.retcode, "8005" ); strcpy ( send_net_0213.errmsg,"非本行卡"); break; case 54: retcode = 14; strcpy ( send_net_0213.retcode, "8005" ); strcpy ( send_net_0213.errmsg,"无此卡号"); break; case 51: retcode = 14; strcpy ( send_net_0213.retcode, "8005" ); strcpy ( send_net_0213.errmsg,"无此卡号"); break; case 49: retcode = 62; strcpy ( send_net_0213.retcode, "8005" ); strcpy ( send_net_0213.errmsg,"交易超限额"); break; case 62: retcode = 13; strcpy ( send_net_0213.retcode, "8005" ); strcpy ( send_net_0213.errmsg,"交易超限额"); break; case 63: retcode = 12; strcpy ( send_net_0213.retcode, "8005" ); strcpy ( send_net_0213.errmsg,"无效交易"); break; case 64: retcode = 41; strcpy ( send_net_0213.retcode, "8005" ); strcpy ( send_net_0213.errmsg,"卡在黑名单中"); break; case 65: retcode = 34; strcpy ( send_net_0213.retcode, "8005" ); strcpy ( send_net_0213.errmsg,"非本行卡"); break; case 66: retcode = 14; strcpy ( send_net_0213.retcode, "8005" ); strcpy ( send_net_0213.errmsg,"无此卡号"); break; case 75: case 130: case 55: retcode = 51; strcpy ( send_net_0213.retcode, "8005" ); strcpy (send_net_0213.errmsg,"取现超信用额度"); break; case 104: case 87: retcode = 40; strcpy ( send_net_0213.retcode, "8005" ); strcpy ( send_net_0213.errmsg,"主机无此交易"); break; case 24: retcode = 12; strcpy ( send_net_0213.retcode, "8005" ); strcpy ( send_net_0213.errmsg,"无效交易"); break; case 68: retcode = 55; strcpy ( send_net_0213.retcode, "8005" ); strcpy ( send_net_0213.errmsg,"密码不符"); break; case 89: case 115: retcode = 4; strcpy ( send_net_0213.retcode, "8005" ); strcpy ( send_net_0213.errmsg,"主机无此商户"); break; default: retcode = 12; strcpy ( send_net_0213.retcode, "8005" ); strcpy ( send_net_0213.errmsg,"无效交易"); break; } } return( 0 );}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -