Some checks failed
ci / build (push) Failing after 2s
TxCore/ECPG legacy 매입·정산 C 슬라이스(빌드검증) + Spring Boot 멀티모듈 골격(mvn test green) + MIGRATION.md 전환룰 + CI(boot 빌드).
47 lines
1.7 KiB
C
47 lines
1.7 KiB
C
/*
|
|
* purchase_dbio.h - 매입/정산 DBIO 인터페이스
|
|
*
|
|
* 서비스/배치 코드는 SQL 을 직접 다루지 않고 이 함수들을 호출한다.
|
|
* 구현은 app/dbio/purchase_dbio.pgc (ECPG).
|
|
*/
|
|
#ifndef PURCHASE_DBIO_H
|
|
#define PURCHASE_DBIO_H
|
|
|
|
/* 매입 상태 코드 */
|
|
#define PUR_ST_RECV "R" /* 접수(수신) */
|
|
#define PUR_ST_MATCHED "M" /* 대사완료 */
|
|
#define PUR_ST_UNMATCH "U" /* 대사불일치 */
|
|
#define PUR_ST_SETTLED "S" /* 정산완료 */
|
|
|
|
/* 매입 레코드 (purchase 테이블 1행) */
|
|
typedef struct {
|
|
char appr_no[10]; /* 승인번호 PK */
|
|
char merch_id[16]; /* 가맹점번호 */
|
|
char card_no[17]; /* 카드번호 */
|
|
long amount; /* 거래금액(원) */
|
|
char txn_date[9]; /* 거래일자 YYYYMMDD */
|
|
char status[2]; /* 상태코드 */
|
|
} purchase_rec_t;
|
|
|
|
/* DB 연결/해제 (배치/데몬 기동 시). target 은 "db@host" 또는 NULL */
|
|
int dbio_connect(const char *target);
|
|
int dbio_disconnect(void);
|
|
|
|
/* 매입 접수 INSERT. 0=성공 */
|
|
int purchase_insert(const purchase_rec_t *rec);
|
|
/* 승인번호로 단건 조회. 0=성공, TX_ENOENT=없음 */
|
|
int purchase_select_by_appr(const char *appr_no, purchase_rec_t *out);
|
|
/* 상태 갱신. 0=성공 */
|
|
int purchase_update_status(const char *appr_no, const char *status);
|
|
|
|
/*
|
|
* 승인원장(approval) 에서 승인번호+금액 일치 여부 확인.
|
|
* 0=일치, TX_ENOENT=불일치/없음.
|
|
*/
|
|
int approval_match(const char *appr_no, long amount);
|
|
|
|
/* 정산집계(settlement) upsert. 가맹점/일자별 금액 누적. 0=성공 */
|
|
int settlement_accumulate(const char *merch_id, const char *biz_date,
|
|
long amount);
|
|
|
|
#endif /* PURCHASE_DBIO_H */
|