Tests for payments

This commit is contained in:
David Bomba 2023-09-17 19:24:15 +10:00
parent 21862adbae
commit f5dfb69776

View File

@ -62,6 +62,40 @@ class PaymentTest extends TestCase
);
}
public function testCompletedPaymentLogic()
{
$payment = Payment::factory()->create([
'company_id' => $this->company->id,
'user_id' => $this->user->id,
'client_id' => $this->client->id,
'status_id' => Payment::STATUS_COMPLETED,
'amount' => 100
]);
$data = [
'amount' => $this->invoice->amount,
'client_id' => $this->client->hashed_id,
'invoices' => [
[
'invoice_id' => $this->invoice->hashed_id,
'amount' => $this->invoice->amount,
],
],
'date' => '2020/12/11',
'idempotency_key' => 'dsjafhajklsfhlaksjdhlkajsdjdfjdfljasdfhkjlsafhljfkfhsjlfhiuwayerfiuwaskjgbzmvnjzxnjcbgfkjhdgfoiwwrasdfasdfkashjdfkaskfjdasfda'
];
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->putJson('/api/v1/payments/'.$payment->hashed_id, $data);
$response->assertStatus(200);
}
public function testPendingPaymentLogic()
{
$payment = Payment::factory()->create([
@ -95,9 +129,6 @@ class PaymentTest extends TestCase
}
public function testPaymentGetBetweenQuery1()
{
$response = $this->withHeaders([