using System;
namespace TKS.OutGame
{
///
/// 결제 창구(PD 2026-11-26 요청서 2절 3) — 기기 세이브 모드 = 시험 결제(화면이 확인 팝업 「시험 결제」를 띄운 뒤 바로 성공) ·
/// 구글 플레이 결제 = 인터페이스만(실제 연결 = 플레이 콘솔 상품 등록 뒤 · 범위 밖 · 상품 id = tks_<s_id> · 소모성 = 보옥 · 패키지 · 월정액 · 성장 패스 / 비소모성 = 광고 제거).
///
public interface ITradeStore
{
/// 시험 결제(돈이 나가지 않음 · 화면에 「시험 결제」 표시).
bool IsTest { get; }
/// 결제 요청 → done(성공, 실패 사유). 지급은 부르는 쪽(OutGameSession.TradePurchase)이 한다.
void Purchase(string productId, int krw, Action done);
/// 비소모성 구매 복원(광고 제거 · 기기를 바꿨을 때) → done(복원할 상품 id 목록).
void Restore(Action done);
}
/// 기기 세이브 모드의 시험 결제 — 확인 팝업은 화면이 띄우고 여기서는 바로 성공.
public class TestTradeStore : ITradeStore
{
public bool IsTest { get { return true; } }
public void Purchase(string productId, int krw, Action done)
{
done(true, null);
}
public void Restore(Action done)
{
done(new string[0]);
}
}
/// 구글 플레이 결제(Play Billing) — 인터페이스만 · 연결 전 = 실패(플레이 콘솔 상품 등록 · 결제 라이브러리 연결 = 후속).
public class GooglePlayTradeStore : ITradeStore
{
public bool IsTest { get { return false; } }
public void Purchase(string productId, int krw, Action done)
{
done(false, TradeText.T("trade_store_not_linked"));
}
public void Restore(Action done)
{
done(new string[0]);
}
}
public static class TradeStore
{
/// 지금 결제 창구(기본 = 시험 결제 · 구글 플레이 연결 뒤 GooglePlayTradeStore 로 바꿈).
public static ITradeStore Current = new TestTradeStore();
}
}