Storefront untuk produk digital. Merchant membangun halaman dengan page builder, publish, dan customer membeli langsung. Setelah pembayaran, link produk dikirim otomatis via WhatsApp.
File kunci
| File | Baris | Peran |
|---|---|---|
app/Services/DigitalStoreService.php | 2.012 | Logic utama: setting, page builder, publish, CNAME/nginx |
app/Services/DigitalProductService.php | 313 | Kirim link produk digital via WA setelah order dibayar |
app/Http/Controllers/DigitalStoreController.php | 824 | Thin controller — delegasi ke service |
app/Models/DigitalStore.php | 27 | Model dokumen toko (draft/publish) |
app/Models/DigitalStorePage.php | 25 | Model halaman toko |
app/Models/PreviewDigitalStore.php | 32 | Token preview terbatas (SHA-256, 30 menit) |
app/Models/DraftStoresDigital.php | 26 | Orphan — tidak dipakai, warisan refactor |
Model
DigitalStore
Field: user_id, store_id, type ('draft' | 'publish'), sections (array), setting (embed: transaction{logo}, site{fav_icon,domain}, payment_method[], shipping[]), published_at.
DigitalStorePage
Field: user_id, store_id, type ('draft'|'publish'), pagesType ('Halaman Utama'|'Sub Halaman'), parent_page_id, pageIndex, sections[] (tiap section: section_type 'product'/'content', product_type, status, index).
PreviewDigitalStore
Token SHA-256 per (storeId, userEmail, IP). Default expired 30 menit. Untuk preview draft sebelum publish.
Alur publish
DigitalStoreService::publishStore — validasi minimal 1 payment_method aktif → validasi produk digital wajib non-COD → DB transaction copy draft ke record type='publish' (store + pages), dedup shipping by code, handle S3 image.
Pengiriman link produk digital
DigitalProductService::sendProductLink(Order) — dipicu dari OrderObserver saat payment_status → paid. Validasi: semua item digital + payment_method='instant_payment' + payment_status='paid'. Ambil attachment_link dari produk, susun pesan, kirim via POST {url_api}send_message (backend Go).
Route
Web (routes/web.php:210)
| Method | Path | Fungsi |
|---|---|---|
| GET | /digital-store | Halaman utama |
| GET | /digital-store/settings | Pengaturan |
| GET | /digital-store/settings/pages/{id} | Editor halaman |
API (routes/api.php:250)
Prefix /digital-store:
| Method | Path | Fungsi |
|---|---|---|
| POST | /digital-store | Store/update draft |
| POST | /digital-store/publish | Publish |
| POST | /digital-store/pages | CRUD halaman |
| POST | /digital-store/pages-content | Update section |
| DELETE | /digital-store/pages-content/{id} | Hapus section |
| POST | /digital-store/pages-content-move | Sortir section |
| PATCH | /digital-store/checkout | Update config checkout |
| PATCH | /digital-store | Update setting |
Integrasi
| Service | Endpoint | Untuk |
|---|---|---|
Backend Go (url_api) | POST /v1/send_message | Kirim link produk digital |
| AWS S3 | Storage::disk('s3') | Upload logo/fav_icon/file |
| DNS/Nginx | dns_get_record, generateConfig | Verifikasi CNAME + nginx config untuk custom domain |
Temuan
DraftStoresDigitalorphan — model tidak dipakai, pola draft→publish via fieldtypediDigitalStoreensurePaymentMethodshardcode 4 method — tambah metode baru wajib edit kode, bukan config- Typo di nama method —
cpyyImageIfExist,formatePublishedDate. Sudah dipakai internal, jangan rename tanpa audit