<?php

namespace App\Controllers;
use CodeIgniter\Files\File;
use Aws\S3\S3Client;
use CodeIgniter\RESTful\ResourceController;

class Api extends ResourceController
{
    public function postData()
    {
        $data = $this->request->getJSON();

        if (!$data) {
            return $this->respond(['error' => 'Invalid JSON'], 400);
        }

        return $this->respond(['message' => 'Data received', 'data' => $data], 200);
    }

    public function lembur()
    {
        $request = $this->request;

        $order_id = $request->getPost('id');
        $paid_status = $request->getPost('paid_status');
        $payment_amount =$request->getPost('payment_amount');

        $data = [
            'bill_no' => $order_id,
            'paid_status' => $paid_status,
            'payment_amount' => $payment_amount,
            
         ];

         return $this->respond([
            'message' => 'Data received',
            'data' => $data
        ], 200);
    }
}
