Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ private static Account buildInstallmentAccount(int userOrdinal, Long userId,
Account account = baseAccount(userOrdinal, userId, connection, bank, 2, referenceDate);
account.setAccountGroup(AccountGroup.DEPOSIT_TRUST);
account.setDepositTypeCode("12");
account.setAccountName(bank.getDisplayName() + " 가상 적금");
account.setAccountName("청년희망적금");
account.setBalance(BigDecimal.ZERO);
account.setOverdraftYn(null);
account.setNextPaymentDate(DefaultPaymentSchedule.nextAfter(referenceDate));
Expand All @@ -254,7 +254,7 @@ private static Account buildLoanAccount(int userOrdinal, Long userId,
Account account = baseAccount(userOrdinal, userId, connection, bank, 3, referenceDate);
account.setAccountGroup(AccountGroup.LOAN);
account.setDepositTypeCode("40");
account.setAccountName(bank.getDisplayName() + " 가상 대출");
account.setAccountName("주택담보대출");
account.setBalance(BigDecimal.ZERO);
account.setOverdraftYn(null);
account.setNextPaymentDate(DefaultPaymentSchedule.nextAfter(referenceDate));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,14 @@ public class VirtualFinancialTransactionGenerator {
private static final BigDecimal ZERO = BigDecimal.ZERO;

/**
* 가상 소득 입금 거래에 사용할 정산 주체명.
* 가상 소득 입금 거래에 사용할 정산 주체명. 시연용으로 메인 직업(배달: 우아한청년들·쿠팡이츠정산·위대한상상)과
* 서브 직업(대리: 카카오모빌리티, 펫시터: 펫피플)의 정산처만 고정한다(#225).
* work-service의 PLATFORM.deposit_name 확정 시드 데이터(services/work-service/src/main/resources/db/work-service-seed.sql,
* docs/financial-diagnosis-mvp-spec.md §3.6)와 동일한 값을 써야 한다. 두 서비스는 별도 모듈이라 자동 동기화되지 않으니,
* 시드 데이터가 바뀌면 이 배열도 함께 수정할 것.
* docs/financial-diagnosis-mvp-spec.md §3.6)에 실재하는 값의 부분집합이어야 한다. 두 서비스는 별도 모듈이라
* 자동 동기화되지 않으니, 시드 데이터에서 해당 값이 바뀌거나 제거되면 이 배열도 함께 수정할 것.
*/
private static final String[] INCOME_COUNTERPARTY_NAMES = {
"우아한청년들", "쿠팡이츠정산", "위대한상상", "카카오모빌리티", "GOOGLE",
"쿠팡-용역비", "티맵모빌리티", "CJ대한통운", "로젠택배", "생활연구소",
"유한회사미소", "케어닥", "펫피플", "PAYPAL", "네이버"
"우아한청년들", "쿠팡이츠정산", "위대한상상", "카카오모빌리티", "펫피플"
};
public static final int INCOME_COUNTERPARTY_COUNT = INCOME_COUNTERPARTY_NAMES.length;

Expand All @@ -57,13 +56,10 @@ public class VirtualFinancialTransactionGenerator {
fixedExpense("네이버클라우드", 5_000L, 5_000L)
};

/** 시연용으로 보험 상품 2종만 고정한다(#225). */
private static final InsuranceProduct[] INSURANCE_PRODUCTS = {
insurance("삼성생명", "삼성생명 실손보험", 45_000L, 80_000L),
insurance("현대해상", "현대해상 건강보험", 60_000L, 120_000L),
insurance("DB손해보험", "DB손해보험 운전자보험", 20_000L, 40_000L),
insurance("KB손해보험", "KB손해보험 암보험", 40_000L, 90_000L),
insurance("교보생명", "교보생명 종신보험", 120_000L, 250_000L),
insurance("한화생명", "한화생명 연금보험", 100_000L, 300_000L)
insurance("KB손해보험", "KB 이륜차 운전자보험", 20_000L, 40_000L)
};

private static final String[] BRANCHES = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.ntropy.account.integration.virtual;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assumptions.assumeTrue;

import java.time.Clock;
Expand Down Expand Up @@ -157,25 +156,22 @@ SELECT COUNT(DISTINCT REPLACE(transaction_row.desc3, '홈)', ''))
JOIN USERS seeded_user ON seeded_user.user_id = account_row.user_id
WHERE seeded_user.provider = ?
AND REPLACE(transaction_row.desc3, '홈)', '') IN (
'우아한청년들', '쿠팡이츠정산', '위대한상상', '카카오모빌리티', 'GOOGLE',
'쿠팡-용역비', '티맵모빌리티', 'CJ대한통운', '로젠택배', '생활연구소',
'유한회사미소', '케어닥', '펫피플', 'PAYPAL', '네이버'
'우아한청년들', '쿠팡이츠정산', '위대한상상', '카카오모빌리티', '펫피플'
)
""", VIRTUAL_TEST_PROVIDER);
// 소득 정산처 15종 전체가 등장하려면 사용자 수가 충분해야 한다(기본 50명 기준).
assertTrue(distinctIncomeCounterparties > 0 && distinctIncomeCounterparties <= 15);
// 소득 정산처 5종 전체가 등장하려면 사용자 수가 충분해야 한다(기본 50명 기준).
assertEquals(5, distinctIncomeCounterparties);
int distinctInsuranceProducts = count(jdbc, """
SELECT COUNT(DISTINCT REPLACE(transaction_row.desc3, '홈)', ''))
FROM ACCOUNT_TRANSACTION transaction_row
JOIN ACCOUNT account_row ON account_row.account_id = transaction_row.account_id
JOIN USERS seeded_user ON seeded_user.user_id = account_row.user_id
WHERE seeded_user.provider = ?
AND REPLACE(transaction_row.desc3, '홈)', '') IN (
'삼성생명 실손보험', '현대해상 건강보험', 'DB손해보험 운전자보험',
'KB손해보험 암보험', '교보생명 종신보험', '한화생명 연금보험'
'삼성생명 실손보험', 'KB 이륜차 운전자보험'
)
""", VIRTUAL_TEST_PROVIDER);
assertTrue(distinctInsuranceProducts > 0 && distinctInsuranceProducts <= 6);
assertEquals(2, distinctInsuranceProducts);

System.out.println("VIRTUAL_FINANCIAL_USERS=" + first.users());
System.out.println("VIRTUAL_FINANCIAL_ACCOUNTS=" + first.accounts());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ void generatesExpectedDatasetAndIsIdempotent() {

assertEquals(50, first.users());
assertEquals(150, first.accounts());
assertEquals(15, first.incomeCounterparties());
assertEquals(5, first.incomeCounterparties());
assertEquals(15_300, first.transactions());
assertEquals(first, second);
assertEquals(50, connectionMapper.store.size());
Expand All @@ -95,6 +95,7 @@ void generatesExpectedDatasetAndIsIdempotent() {
&& "12".equals(account.getDepositTypeCode()))
.findFirst().orElseThrow();
assertEquals(null, installmentAccount.getLoanContractPrincipal());
assertEquals("청년희망적금", installmentAccount.getAccountName());
assertEquals(java.math.BigDecimal.valueOf(230, 2), installmentAccount.getInterestRate());
assertEquals(LocalDate.of(2028, 6, 30), installmentAccount.getMaturityDate());
assertEquals(LocalDate.of(2026, 7, 25), installmentAccount.getNextPaymentDate());
Expand All @@ -104,6 +105,7 @@ void generatesExpectedDatasetAndIsIdempotent() {
.filter(account -> account.getUserId() == userIdFor(1)
&& account.getAccountGroup() == com.ntropy.account.domain.AccountGroup.LOAN)
.findFirst().orElseThrow();
assertEquals("주택담보대출", loanAccount.getAccountName());
assertEquals(java.math.BigDecimal.valueOf(55_000_000L), loanAccount.getLoanContractPrincipal());
assertEquals(java.math.BigDecimal.valueOf(340, 2), loanAccount.getInterestRate());
assertEquals(LocalDate.of(2036, 6, 30), loanAccount.getMaturityDate());
Expand Down Expand Up @@ -178,11 +180,17 @@ void usesCurrentMonthTwentyFifthBeforeDefaultPaymentDay() {

service.generateForUser(9_000_046_001L, com.ntropy.account.domain.PersonalBank.NH_BANK);

Account secondaryAccount = accountMapper.store.values().stream()
.filter(account -> account.getNextPaymentDate() != null)
Account installmentAccount = accountMapper.store.values().stream()
.filter(account -> "12".equals(account.getDepositTypeCode()))
.findFirst().orElseThrow();
assertEquals("청년희망적금", installmentAccount.getAccountName());
assertEquals(LocalDate.of(2026, 6, 25), installmentAccount.getNextPaymentDate());
assertEquals(lastTransactionDate(transactionMapper, installmentAccount), installmentAccount.getLastTranDate());

Account loanAccount = accountMapper.store.values().stream()
.filter(account -> account.getAccountGroup() == AccountGroup.LOAN)
.findFirst().orElseThrow();
assertEquals(LocalDate.of(2026, 6, 25), secondaryAccount.getNextPaymentDate());
assertEquals(lastTransactionDate(transactionMapper, secondaryAccount), secondaryAccount.getLastTranDate());
assertEquals("주택담보대출", loanAccount.getAccountName());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,10 @@
class VirtualFinancialTransactionGeneratorTest {

private static final Set<String> INSURANCE_PRODUCTS = Set.of(
"삼성생명 실손보험", "현대해상 건강보험", "DB손해보험 운전자보험",
"KB손해보험 암보험", "교보생명 종신보험", "한화생명 연금보험"
"삼성생명 실손보험", "KB 이륜차 운전자보험"
);
private static final Set<String> INCOME_COUNTERPARTY_NAMES = Set.of(
"우아한청년들", "쿠팡이츠정산", "위대한상상", "카카오모빌리티", "GOOGLE",
"쿠팡-용역비", "티맵모빌리티", "CJ대한통운", "로젠택배", "생활연구소",
"유한회사미소", "케어닥", "펫피플", "PAYPAL", "네이버"
"우아한청년들", "쿠팡이츠정산", "위대한상상", "카카오모빌리티", "펫피플"
);
// work-service PLATFORM.platform_name 시드값 중 deposit_name과 다른 것들.
// (로젠택배·케어닥은 platform_name==deposit_name이라 제외, 미소는 platform_name "미소"가
Expand Down
Loading