public function testCreateInvoice() { $key = getenv('TUNAI_APP_KEY'); $secret = getenv('TUNAI_APP_SEC'); $invoice = new Invoice($key, $secret, getenv('TUNAI_ROOT_URL')); // Generate current invoice refId $currentInvoiceRefId = (string) time(); // Prepare a dummy data $customer = array('name' => 'Joni Iskandar', 'address' => 'Jalan Senandung Bahagia No. 1 Bandung', 'phone' => '08122097788'); $item = array('itemId' => '1234567890', 'price' => 2000, 'quantity' => 1, 'description' => 'Sepatu Warna Merah Jambu'); $items = array(); array_push($items, $item); $currentInvoiceData = array('refId' => $currentInvoiceRefId, 'amount' => 2000, 'expired' => (string) time() + 24 * 60 * 60 . '000', 'customer' => $customer, 'items' => $items); $res = $invoice->create($currentInvoiceData); $json = $res->getBody(); $obj = json_decode($json); $this->assertEquals($res->getStatusCode(), 200); $currentInvoiceId = $obj->token; $this->assertNotEmpty($currentInvoiceId); $ret = array('currentInvoiceId' => $currentInvoiceId, 'currentInvoiceRefId' => $currentInvoiceRefId, 'currentInvoiceData' => $currentInvoiceData); return $ret; }