📄 saffile.c
字号:
#include <stdio.h>
#include <math.h>
#include "mytools.h"
#include "public.h"
/*======================================================
添加saflog文件
ENTRY: PUBLIC *pc
RETURN: -1 FAIL
0 SUCC
======================================================*/
int saffile ( pc )
PUBLIC *pc;
{
FILE *fp;
char buf[30];
double amt;
fp = fopen( (char *)getfname(WORKDIR, "/prt/saflog"), "a" );
if ( fp == NULL ){
errcall(ERROR,"打开 saflog 错");
return(-1);
}
fprintf(fp,"\n------ 请冲正如下交易 ------\n");
fprintf(fp,"交易日期=[%s]\t", pc->Local_sys_date);
fprintf(fp,"交易时间=[%s]\n", pc->Local_sys_time);
fprintf(fp,"收单行=[%s(%s)]\t",
pc->Acq_bank_id,
pc->Acq_host_id);
fprintf(fp,"发卡行=[%s]\n", pc->Iss_bank_id);
fprintf(fp,"POS终端号[%s]\t", pc->Terminal_id);
fprintf(fp,"特约单位号[%s]\n", pc->Merchant_id);
fprintf(fp,"交易卡号[%s]\t有效期[%s]\n",
pc->Card_no,
pc->Exp_date);
type2buf( pc->Void_tran_type, buf );
fprintf(fp,"交易类型[%s]\t", buf);
amt = atol( pc->Tran_amount ) / 100.;
fprintf(fp,"发生额[%12.2lf]\n", amt );
fprintf(fp,"授权号[%6s]\t", pc->Auth_no);
fprintf(fp,"交易返回码[%s]\n", pc->Resp_code);
fprintf(fp,"票据号[%6d]\t", pc->Invoice_no);
fprintf(fp,"主机流水号[%6d]\t", pc->Host_tran_ls);
fprintf(fp,"冲正票据号[%6d]\n", pc->Void_invoice_no);
fprintf(fp,"流水号[%6d]\t", pc->Trace_no);
fprintf(fp,"批次号[%6d]\t", pc->Batch_no);
fprintf(fp,"受款卡号[%s]\n", pc->Trans_card_no);
fprintf(fp,"证件类型[%c]\t", pc->Person_id_type);
fprintf(fp,"证件号[%s]\n", pc->Person_id);
fprintf(fp,"交易响应行[%s]\t", pc->Resp_bank_id);
fprintf(fp,"交易响应主机号[%s]\n\n", pc->Resp_host_id);
fclose(fp);
return(0);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -