Timo Wipay API
API Application menggunakan Slim Framework 4 - Migrasi dari CodeIgniter
Requirements
- PHP 8.1 atau lebih tinggi
- Composer
- MySQL Database:
timo(sama dengan database timo.wipay.id)
Installation
- Install dependencies:
composer install
- Setup environment:
cp .env.example .env
Edit file .env dan sesuaikan konfigurasi database jika diperlukan.
- Generate autoload:
composer dump-autoload
Konfigurasi Database
File .env sudah dikonfigurasi untuk menggunakan database yang sama dengan timo.wipay.id:
- Host: localhost
- Database: timo
- User: root
- Password: dodolgarut
Menjalankan Aplikasi
Development Server
composer start
atau
php -S localhost:8000 -t public
Aplikasi akan berjalan di http://localhost:8000
Struktur Folder
timo.wipay.id_api/
├── public/ # Web root (entry point)
│ ├── index.php # Application bootstrap & routing
│ └── .htaccess # Apache rewrite rules
├── src/
│ ├── Config/ # Configuration files
│ │ └── Database.php
│ ├── Controllers/ # API Controllers
│ │ ├── AuthController.php
│ │ ├── SLController.php
│ │ └── TagihanController.php
│ ├── Models/ # Database Models
│ │ ├── UserModel.php
│ │ └── SLModel.php
│ ├── Services/ # Business Logic Services
│ ├── Helpers/ # Helper functions
│ │ ├── ResponseHelper.php
│ │ ├── HttpHelper.php
│ │ └── functions.php
│ └── Middleware/ # Middleware (jika diperlukan)
├── logs/ # Application logs
├── vendor/ # Composer dependencies
├── .env # Environment configuration
├── .env.example # Environment template
└── composer.json # Dependencies configuration
Endpoints yang Tersedia
Authentication
POST /timo/daftar- Registrasi user baruPOST /timo/login- Login dengan username & passwordPOST /timo/login_token- Login dengan password sudah di-hashPOST /timo/update_akun- Update data akunPOST /timo/update_password- Update password
SL (Service Line) Management
POST /timo/cek_sl- Cek validitas nomor SLPOST /timo/confirm_sl- Konfirmasi dan daftarkan SLPOST /timo/hapus_sl- Hapus SL dari akun
Tagihan
GET /timo/history/{sl}/{periode}- History tagihanGET /timo/tagihan/{sl}- Data tagihan berdasarkan SL
Pembayaran
POST /timo/request_pembayaran- Request pembayaran tagihanPOST /timo/cek_pembayaran- Cek status pembayaranPOST /timo/cek_transfer- Cek transfer pembayaranPOST /timo/batal_pembayaran- Batalkan pembayaranPOST /timo/confirm_pembayaran- Konfirmasi pembayaranPOST /timo/history_bayar- History pembayaran (status DIBAYAR)
Laporan
POST /timo/jenis_laporan- Daftar jenis laporan gangguanPOST /timo/history_gangguan- History laporan gangguan user
WIPAY
POST /timo/cek_wipay- Cek saldo WIPAY
Reset Password
POST /timo/buat_kode- Buat kode verifikasi reset passwordPOST /timo/cek_kode- Cek validitas kode verifikasiPOST /timo/reset_kode- Reset password dengan kode verifikasi
Upload
POST /timo/upload_catat_meter- Upload foto catat meter (base64)POST /timo/upload_pp- Upload foto profil (base64)POST /timo/hapus_pp- Hapus foto profilPOST /timo/upload_gangguan- Upload laporan gangguan (base64)POST /timo/upload_pasang_baru- Upload permintaan pasang baru (base64)POST /timo/upload_bukti_transfer- Upload bukti transfer (base64)POST /timo/upload_baca_mandiri- Upload hasil baca mandiri
Lainnya
POST /timo/promo- Daftar promo aktifPOST /timo/riwayat_pasang- Riwayat pasang baruPOST /timo/jadwal_catat_meter- Jadwal catat meterPOST /timo/request_order_baca_mandiri- Request order baca mandiri
Utility
GET /- Welcome message dengan daftar endpointsGET /health- Health check endpoint
Format Response
Success Response
{
"status": 200,
"pesan": "Message (optional)",
"data": {}
}
Error Response
{
"status": 404,
"pesan": "Error message"
}
Contoh Penggunaan
Login
curl -X POST http://localhost:8000/timo/login \
-H "Content-Type: application/json" \
-d '{
"username": "testuser",
"password": "password123",
"fcm_token": "optional_fcm_token"
}'
Cek SL
curl -X POST http://localhost:8000/timo/cek_sl \
-H "Content-Type: application/json" \
-d '{
"token": "user_id",
"no_sl": "123456"
}'
Get Tagihan
curl http://localhost:8000/timo/tagihan/123456
Catatan
- API ini menggunakan database yang sama dengan
timo.wipay.id - Semua endpoint menggunakan format JSON
- CORS sudah diaktifkan untuk cross-origin requests
- Log aplikasi tersimpan di folder
logs/app.log
Development
Untuk menambahkan endpoint baru:
- Buat Controller di
src/Controllers/ - Buat Model jika diperlukan di
src/Models/ - Tambahkan route di
public/index.php - Update dokumentasi ini
Migration Status
✅ Authentication endpoints (daftar, login, login_token, update_akun, update_password) ✅ SL Management endpoints (cek_sl, confirm_sl, hapus_sl) ✅ Tagihan endpoints (history, tagihan) ✅ Pembayaran endpoints (request_pembayaran, cek_pembayaran, cek_transfer, batal_pembayaran, confirm_pembayaran, history_bayar) ✅ Laporan endpoints (jenis_laporan, history_gangguan) ✅ WIPAY endpoints (cek_wipay) ✅ Reset Password endpoints (buat_kode, cek_kode, reset_kode) ✅ Other endpoints (promo, riwayat_pasang, jadwal_catat_meter, request_order_baca_mandiri) ✅ Upload endpoints (upload_catat_meter, upload_pp, hapus_pp, upload_gangguan, upload_pasang_baru, upload_bukti_transfer, upload_baca_mandiri)