다양화: 530개 online/batch 프로그램을 모듈별 고유 실업무 로직으로 재작성
- 템플릿 클론(정규화 후 0줄 상이) → 전 코퍼스 530/530 고유 바디 - 11개 모듈(mg/au/ac/rc/vl/st/py/lg/mm/cm/cl) 각 파일이 distinct한 매입·대사·정산·수수료·지급·원장·마감·마스터·정합성·전문게이트웨이·공통 업무 - TxCore(ATMI 유사) + ECPG(EXEC SQL) 관용구, 프레임워크/헤더/DBIO API/파일ID·경로 유지 - 전체 docker make -j4 = EXIT 0, 958 오브젝트, 데모 바이너리 링크 - inventory.json loc 실측 갱신 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
b96cf702ee
commit
c3a0259e95
1027 changed files with 68915 additions and 40962 deletions
|
|
@ -6,12 +6,14 @@
|
|||
/* End of automatic include section */
|
||||
|
||||
#line 1 "app/online/mg_ol_0018.pgc"
|
||||
/* @tier easy @module mg @transform msg-gateway-online */
|
||||
/* @tier medium @module mg @transform msg-gateway-online */
|
||||
/*
|
||||
* mg_ol_0018.pgc - 전문게이트웨이 온라인 서비스 (MG_OL_0018) [tier=easy]
|
||||
* mg_ol_0018.pgc - 전문게이트웨이 응답전문 생성 서비스 (MG_OL_0018) [tier=medium]
|
||||
*
|
||||
* TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 mg 표준 DBIO 를
|
||||
* 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응)
|
||||
* 승인처리 결과(승인/거절/사유코드)와 원거래 식별정보를 받아 응답전문
|
||||
* (0210)을 조립한다. 승인이면 resp_code=0000, 거절이면 요청 사유코드를
|
||||
* 반영(미지정시 9001)하며, 승인번호가 없으면 채번규칙으로 생성한다.
|
||||
* 완성된 전문을 msg_pack 으로 고정길이 직렬화하여 RAWMSG 로 반환한다.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
|
@ -89,37 +91,80 @@ struct sqlca_t *ECPGget_sqlca(void);
|
|||
|
||||
#endif
|
||||
|
||||
#line 15 "app/online/mg_ol_0018.pgc"
|
||||
#line 17 "app/online/mg_ol_0018.pgc"
|
||||
|
||||
|
||||
TX_SERVICE(MG_OL_0018, ctx)
|
||||
{
|
||||
mg_rec_t rec;
|
||||
char key[16];
|
||||
int rc;
|
||||
acq_msg_t resp;
|
||||
char outraw[MSG_ACQ_LEN + 1];
|
||||
char merch[16], card[20], trans[8], approval[12], reason[8];
|
||||
char apnbuf[12];
|
||||
long amount = 0;
|
||||
long approved = 0;
|
||||
const char *rcode;
|
||||
|
||||
tx_log(TX_LOG_INFO, "[MG_OL_0018] 전문게이트웨이 단건조회 서비스 진입");
|
||||
tx_log(TX_LOG_INFO, "[MG_OL_0018] 응답전문 생성 서비스 진입");
|
||||
|
||||
if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) {
|
||||
tx_log(TX_LOG_ERROR, "[MG_OL_0018] KEY 누락");
|
||||
if (tx_buf_get(ctx->in, "MERCHID", merch, sizeof(merch)) != TX_OK ||
|
||||
tx_buf_get(ctx->in, "CARDNO", card, sizeof(card)) != TX_OK) {
|
||||
tx_log(TX_LOG_ERROR, "[MG_OL_0018] 필수 필드 누락(MERCHID/CARDNO)");
|
||||
tx_return(ctx, TX_EINVAL, ctx->out);
|
||||
return;
|
||||
}
|
||||
tx_buf_getlong(ctx->in, "AMOUNT", &amount);
|
||||
tx_buf_getlong(ctx->in, "APPROVED", &approved);
|
||||
|
||||
memset(&rec, 0, sizeof(rec));
|
||||
rc = mg_rec_select(key, &rec);
|
||||
if (rc != TX_OK) {
|
||||
tx_log(TX_LOG_WARN, "[MG_OL_0018] 조회 실패 key=%s rc=%d(%s)",
|
||||
key, rc, tx_strerror(rc));
|
||||
tx_return(ctx, rc, ctx->out);
|
||||
if (tx_buf_get(ctx->in, "TRANSCODE", trans, sizeof(trans)) != TX_OK)
|
||||
strcpy(trans, "000000");
|
||||
if (tx_buf_get(ctx->in, "REASON", reason, sizeof(reason)) != TX_OK)
|
||||
reason[0] = '\0';
|
||||
|
||||
/* 승인/거절에 따른 응답코드 결정 */
|
||||
if (approved != 0) {
|
||||
rcode = RESP_OK;
|
||||
} else if (reason[0] != '\0') {
|
||||
rcode = reason; /* 요청이 지정한 거절사유 */
|
||||
} else {
|
||||
rcode = RESP_INVALID; /* 사유 미지정 기본 거절 */
|
||||
}
|
||||
|
||||
/* 승인번호: 요청값 우선, 없으면 가맹점+금액 기반 채번 */
|
||||
if (tx_buf_get(ctx->in, "APPROVAL", approval, sizeof(approval)) != TX_OK ||
|
||||
approval[0] == '\0') {
|
||||
snprintf(apnbuf, sizeof(apnbuf), "%08ld", (amount % 100000000L));
|
||||
} else {
|
||||
strncpy(apnbuf, approval, sizeof(apnbuf) - 1);
|
||||
apnbuf[sizeof(apnbuf) - 1] = '\0';
|
||||
}
|
||||
|
||||
/* 응답전문(0210) 필드 세팅 (고정길이 우측공백/좌측영 규칙은 유틸 준수) */
|
||||
memset(&resp, 0, sizeof(resp));
|
||||
msg_field_set(resp.msg_type, MSG_TYPE_RESP, FLD_MSG_TYPE_LEN);
|
||||
msg_field_set(resp.trans_code, trans, FLD_TRANS_CODE_LEN);
|
||||
msg_field_set(resp.merch_id, merch, FLD_MERCH_ID_LEN);
|
||||
msg_field_set(resp.card_no, card, FLD_CARD_NO_LEN);
|
||||
msg_field_set(resp.approval_no, apnbuf, FLD_APPROVAL_LEN);
|
||||
{
|
||||
char amtstr[16];
|
||||
snprintf(amtstr, sizeof(amtstr), "%ld", (amount < 0) ? 0 : amount);
|
||||
msg_field_set_num(resp.amount, amtstr, FLD_AMOUNT_LEN);
|
||||
}
|
||||
msg_field_set(resp.resp_code, rcode, FLD_RESP_LEN);
|
||||
|
||||
memset(outraw, 0, sizeof(outraw));
|
||||
if (msg_pack(&resp, outraw, MSG_ACQ_LEN) != 0) {
|
||||
tx_log(TX_LOG_ERROR, "[MG_OL_0018] 응답전문 패킹 실패");
|
||||
tx_return(ctx, TX_FAIL, ctx->out);
|
||||
return;
|
||||
}
|
||||
|
||||
tx_buf_reset(ctx->out);
|
||||
tx_buf_sets(ctx->out, "KEY", rec.key);
|
||||
tx_buf_sets(ctx->out, "MERCHID", rec.merch_id);
|
||||
tx_buf_setlong(ctx->out, "AMOUNT", rec.amount);
|
||||
tx_buf_sets(ctx->out, "STATUS", rec.status);
|
||||
tx_log(TX_LOG_INFO, "[MG_OL_0018] 조회완료 key=%s amount=%ld", key, rec.amount);
|
||||
tx_buf_sets(ctx->out, "RESPCODE", rcode);
|
||||
tx_buf_sets(ctx->out, "RAWMSG", outraw);
|
||||
tx_buf_sets(ctx->out, "APPROVAL", apnbuf);
|
||||
tx_buf_setlong(ctx->out, "APPROVED", approved);
|
||||
tx_log(TX_LOG_INFO, "[MG_OL_0018] 응답전문 생성완료 rcode=%s apn=%s approved=%ld",
|
||||
rcode, apnbuf, approved);
|
||||
tx_return(ctx, TX_OK, ctx->out);
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue