[매입] mg_recv_svc → 전문수신 @Service (ACM-MG-004)

This commit is contained in:
forge-bot 2026-07-18 11:17:51 +00:00
parent d9946e31ff
commit 03aec59479

View file

@ -0,0 +1,70 @@
package com.klaro.acquirecore.acquiring.repository;
import com.klaro.acquirecore.acquiring.dto.TxMessage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Repository;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* Stub implementation of TxRepository.
* In-memory storage for development/testing.
*/
@Repository
public class TxRepositoryStub implements TxRepository {
private static final Logger log = LoggerFactory.getLogger(TxRepositoryStub.class);
private final Map<String, TxMessage> transactions = new ConcurrentHashMap<>();
private final Map<String, Boolean> activeMerchants = new ConcurrentHashMap<>();
private final Map<String, Boolean> activeTerminals = new ConcurrentHashMap<>();
public TxRepositoryStub() {
// Initialize with test data
activeMerchants.put("M001", true);
activeMerchants.put("M002", true);
activeTerminals.put("M001|T001", true);
activeTerminals.put("M001|T002", true);
activeTerminals.put("M002|T001", true);
}
@Override
public boolean isMerchantActive(String merchantId) {
return activeMerchants.getOrDefault(merchantId, true);
}
@Override
public boolean isTerminalActive(String merchantId, String terminalId) {
return activeTerminals.getOrDefault(merchantId + "|" + terminalId, true);
}
@Override
public void saveTransaction(TxMessage msg) {
if (msg.getTxId() != null) {
transactions.put(msg.getTxId(), msg);
log.debug("Saved transaction: {}", msg.getTxId());
}
}
@Override
public boolean transactionExists(String txId) {
return transactions.containsKey(txId);
}
@Override
public String getTransactionStatus(String txId) {
TxMessage msg = transactions.get(txId);
return msg != null ? msg.getStatus() : null;
}
@Override
public void updateTransactionStatus(String txId, String status) {
TxMessage msg = transactions.get(txId);
if (msg != null) {
msg.setStatus(status);
log.debug("Updated transaction {} status to {}", txId, status);
}
}
}