feat: 인앱 결제(Google Play) 스캐폴드 + 멤버십 만료 처리

- member.plan_expires_at + iap_purchase 테이블(중복 결제 방지)
- POST /api/billing/google/verify: 구매 검증 후 PREMIUM 부여/갱신(만료 연장), 세션 plan 즉시 동기화
- GET /api/billing/products: 구독 상품(월간/연간)
- 테스트 모드(billing.test-mode=true): test- 토큰 검증 없이 승인 → 전 과정 테스트 가능
- GooglePlayVerifier 인터페이스 + 스텁(실연동 지점), 실연동 시 구현체 교체
- 관리자 수동 plan 변경은 만료일 없이(영구), 결제는 만료일 부여
- 만료 자동 강등 스케줄러(매시), MemberResponse.planExpiresAt 노출

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
ByungCheol
2026-06-28 15:12:45 +09:00
co-authored by Claude Opus 4.8
parent d1c13e7cc1
commit 1e93280140
21 changed files with 421 additions and 4 deletions
@@ -0,0 +1,27 @@
package com.sb.web.billing;
import com.sb.web.auth.mapper.MemberMapper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
/**
* 만료된 유료 멤버십 자동 강등. 매시간 실행.
* (만료일이 NULL 인 관리자 영구 부여는 강등되지 않음)
*/
@Slf4j
@Component
@RequiredArgsConstructor
public class PremiumExpiryScheduler {
private final MemberMapper memberMapper;
@Scheduled(cron = "0 5 * * * *") // 매시 5분
public void downgradeExpired() {
int n = memberMapper.downgradeExpired();
if (n > 0) {
log.info("[billing] 만료 멤버십 강등: {}건", n);
}
}
}