⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.239
Server IP:
13.127.59.50
Server:
Linux ip-172-31-46-210 5.15.0-1033-aws #37~20.04.1-Ubuntu SMP Fri Mar 17 11:39:30 UTC 2023 x86_64
Server Software:
Apache/2.4.41 (Ubuntu)
PHP Version:
7.4.3-4ubuntu2.29
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
home
/
ubuntu
/
vendor
/
razorpay
/
razorpay
/
tests
/
View File Name :
InvoiceTest.php
<?php namespace Razorpay\Tests; use Razorpay\Api\Request; class InvoiceTest extends TestCase { private $invoiceId = 'inv_IEjVoNaeZj3jhw'; private $customerId = 'cust_IEfAt3ruD4OEzo'; public function setUp() { parent::setUp(); } /** * Create Invoice */ public function testCreateInvoice() { $data = $this->api->invoice->create(array ('type' => 'invoice', 'date' => time(), 'customer_id'=> $this->customerId, 'line_items'=>array(array("name"=> "Master Cloud Computing in 30 Days", "amount"=>10000, "currency" => "INR", "quantity"=> 1)))); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('invoice_number',$data->toArray())); } /** * Fetch all invoices */ public function testFetchAllInvoice() { $data = $this->api->invoice->fetch($this->invoiceId); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('invoice_number',$data->toArray())); } /** * Update invoice */ public function testUpdateInvoice() { $data = $this->api->invoice->fetch($this->invoiceId)->edit(array('notes' => array('updated-key' => 'An updated note.'))); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('invoice_number',$data->toArray())); } /** * Send notification */ public function testSendNotification() { $data = $this->api->invoice->fetch($this->invoiceId)->notifyBy('email'); $this->assertTrue(is_array($data)); } /** * Issue an invoice */ public function testInvoiceIssue() { $invoice = $this->api->invoice->create(array ('type' => 'invoice', 'draft'=> true , 'date' => time(), 'customer_id'=> $this->customerId, 'line_items'=>array(array("name"=> "Master Cloud Computing in 30 Days", "amount"=>10000, "currency" => "INR", "quantity"=> 1)))); $data = $this->api->invoice->fetch($invoice->id)->issue(); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('invoice_number',$data->toArray())); } /** * Delete an invoice */ public function testDeleteInvoice() { $invoice = $this->api->invoice->create(array ('type' => 'invoice', 'draft'=> true , 'date' => time(), 'customer_id'=> $this->customerId, 'line_items'=>array(array("name"=> "Master Cloud Computing in 30 Days", "amount"=>10000, "currency" => "INR", "quantity"=> 1)))); $data = $this->api->invoice->fetch($invoice->id)->delete(); $this->assertTrue(is_array($data)); } /** * Cancel an invoice */ public function testCancelInvoice() { $invoice = $this->api->invoice->create(array ('type' => 'invoice', 'draft'=> true , 'date' => time(), 'customer_id'=> $this->customerId, 'line_items'=>array(array("name"=> "Master Cloud Computing in 30 Days", "amount"=>10000, "currency" => "INR", "quantity"=> 1)))); $data = $this->api->invoice->fetch($invoice->id)->cancel(); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('invoice_number',$data->toArray())); } }