ShopPlatform.Web 1.0.0.0
농산물, 소프트웨어 라이선스와 개발 용역을 직접 판매하는 CodeMaru 직영 쇼핑몰입니다.
로딩중...
검색중...
일치하는것 없음
ShopSeeder.cs
이 파일의 문서화 페이지로 가기
3
5
14public static class ShopSeeder
15{
24 private const string DemoClientKey = "test_gck_docs_Ovk5rk1EwkEbP0W43n07xlzm";
33 private const string DemoSecretKey = "test_gsk_docs_OaPz8L5KdmQXkzRz3y47BMw6";
34
75 public static async Task SeedCodemaruAsync(
76 TenantDbContextFactory dbFactory,
77 IShopTenantStore tenantStore,
78 PaymentKeyProtector keyProtector)
79 {
80 // 결제 키 설정 (config.json 업데이트)
81 var config = await tenantStore.GetAsync("codemaru");
82 if (config != null && !config.Payment.IsEnabled)
83 {
84 config.Payment.IsEnabled = true;
85 config.Payment.IsTestMode = true;
86 config.Payment.TossClientKey = DemoClientKey;
87 config.Payment.TossSecretKeyEncrypted = keyProtector.Protect(DemoSecretKey);
88 config.Payment.SuccessReturnUrl = string.Empty; // CheckoutPage에서 동적 생성
89 config.Payment.FailReturnUrl = string.Empty;
90 await tenantStore.SaveAsync(config);
91 }
92
93 // 상품 시드
94 using var db = dbFactory.Create("codemaru");
95 if (db.Products.Any()) return;
96
97 db.Products.AddRange(
98 new Product
99 {
100 Name = "청양 햇고추",
101 Description = "국내산 청양 햇고추 500g. 매콤하고 신선한 고추를 직배송합니다.",
102 Price = 15_000m,
103 Stock = 100,
104 IsActive = true,
105 ImagePath = null
106 },
107 new Product
108 {
109 Name = "Dreamine MVVM FullKit",
110 Description = "WPF/MAUI 개발자를 위한 완성형 MVVM 프레임워크 라이선스. 소스코드 포함.",
111 Price = 59_000m,
112 Stock = 999,
113 IsActive = true,
114 ImagePath = null
115 },
116 new Product
117 {
118 Name = "개발자 머그컵",
119 Description = "코드마루 로고가 새겨진 도자기 머그컵 350ml.",
120 Price = 12_000m,
121 Stock = 50,
122 IsActive = true,
123 ImagePath = null
124 }
125 );
126 db.SaveChanges();
127 }
128}
static async Task SeedCodemaruAsync(TenantDbContextFactory dbFactory, IShopTenantStore tenantStore, PaymentKeyProtector keyProtector)
Definition ShopSeeder.cs:75
Task SaveAsync(ShopConfig config)
Task< ShopConfig?> GetAsync(string slug)