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

  1. Install dependencies:
composer install
  1. Setup environment:
cp .env.example .env

Edit file .env dan sesuaikan konfigurasi database jika diperlukan.

  1. 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 baru
  • POST /timo/login - Login dengan username & password
  • POST /timo/login_token - Login dengan password sudah di-hash
  • POST /timo/update_akun - Update data akun
  • POST /timo/update_password - Update password

SL (Service Line) Management

  • POST /timo/cek_sl - Cek validitas nomor SL
  • POST /timo/confirm_sl - Konfirmasi dan daftarkan SL
  • POST /timo/hapus_sl - Hapus SL dari akun

Tagihan

  • GET /timo/history/{sl}/{periode} - History tagihan
  • GET /timo/tagihan/{sl} - Data tagihan berdasarkan SL

Pembayaran

  • POST /timo/request_pembayaran - Request pembayaran tagihan
  • POST /timo/cek_pembayaran - Cek status pembayaran
  • POST /timo/cek_transfer - Cek transfer pembayaran
  • POST /timo/batal_pembayaran - Batalkan pembayaran
  • POST /timo/confirm_pembayaran - Konfirmasi pembayaran
  • POST /timo/history_bayar - History pembayaran (status DIBAYAR)

Laporan

  • POST /timo/jenis_laporan - Daftar jenis laporan gangguan
  • POST /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 password
  • POST /timo/cek_kode - Cek validitas kode verifikasi
  • POST /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 profil
  • POST /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 aktif
  • POST /timo/riwayat_pasang - Riwayat pasang baru
  • POST /timo/jadwal_catat_meter - Jadwal catat meter
  • POST /timo/request_order_baca_mandiri - Request order baca mandiri

Utility

  • GET / - Welcome message dengan daftar endpoints
  • GET /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:

  1. Buat Controller di src/Controllers/
  2. Buat Model jika diperlukan di src/Models/
  3. Tambahkan route di public/index.php
  4. 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)

Description
No description provided
Readme 190 KiB
Languages
PHP 98.8%
Shell 1.2%