# Split Endpoint PyPOS ke Folder Baru (Tanpa Ganggu POS Lama)

Tanggal: 2026-04-21  
Scope: `existing_production_project_for_pypos` + source `Python POS`

## Tujuan
- Memisahkan jalur endpoint PyPOS dari endpoint legacy POS lama.
- Menjaga endpoint lama tetap aktif untuk operasional existing.
- Menurunkan risiko regresi saat maintenance endpoint PyPOS.

## Implementasi

### 1) Controller PyPOS baru (wrapper tipis)
Lokasi: `application/controllers/eusvc/pypos/`

1. `Sync.php`
2. `Device.php`
3. `Upload.php`
4. `Auth.php`
5. `Preorder.php`
6. `Promo.php`

Lokasi modul penjualan:
1. `application/modules/penjualan/controllers/Pypos.php`

Semua controller di atas memanggil method existing (parent) agar kontrak response dan business logic tidak berubah.

### 2) Mapping endpoint PyPOS
Lokasi: `application/controllers/eusvc/pypos/map/endpoint_inventory.php`

Berisi:
- URL PyPOS baru
- pasangan URL legacy
- domain endpoint

### 3) Default endpoint source PyPOS diarahkan ke jalur baru
File:
1. `Python POS/config.json`
2. `Python POS/pypos/core/utils/config_utils.py`

## Daftar Route PyPOS Baru

1. `/eusvc/pypos/Sync/doSync_auto`
2. `/eusvc/pypos/Sync/publicBranchLookup`
3. `/eusvc/pypos/Sync/serverSync`
4. `/eusvc/pypos/Sync/uiAssets`
5. `/eusvc/pypos/Device/postDeviceRegistrasi`
6. `/eusvc/pypos/Device/checkDevRegisV2`
7. `/eusvc/pypos/Device/server_CheckUpdate`
8. `/eusvc/pypos/Upload/setUploadStream`
9. `/eusvc/pypos/Upload/getUploadCompileStatus`
10. `/eusvc/pypos/Auth/issueJwt`
11. `/eusvc/pypos/Auth/refreshJwt`
12. `/eusvc/pypos/Preorder/get_preorder`
13. `/eusvc/pypos/Preorder/use_preorder`
14. `/eusvc/pypos/Promo/saveFreeProduk`
15. `/eusvc/pypos/Promo/checkFreeProdukQuota`
16. `/penjualan/Pypos/settlement`

## Dampak ke POS Lama
- Tidak ada perubahan endpoint lama.
- Tidak ada perubahan kontrak endpoint legacy.
- POS lama tetap memakai jalur existing.

## Verifikasi teknis
1. `php -l` seluruh file controller baru: lulus.
2. `php -l` file mapping endpoint: lulus.
3. Cek default endpoint source PyPOS: sudah menunjuk route baru.

## Rollback cepat (jika diperlukan)
1. Kembalikan endpoint PyPOS ke URL lama pada:
   - `Python POS/config.json`
   - `Python POS/pypos/core/utils/config_utils.py`
2. Controller wrapper PyPOS boleh dibiarkan (non-intrusive) atau di-nonaktifkan saat deploy.

## Catatan fase lanjutan
1. Refactor berikutnya: pindah logic PyPOS ke service/library terpisah (bukan hanya wrapper).
2. Setelah stabil, baru dipertimbangkan versioning kontrak (`/v1`) untuk endpoint PyPOS.
