add controllers, servoices
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Services\Payments;
|
||||
|
||||
use App\Services\Payments\PaypalTransactionsService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Tests\TestCase;
|
||||
|
||||
class PaypalTransactionsServiceTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_list_all_filters_by_keyword(): void
|
||||
{
|
||||
DB::table('paypal_payments')->insert([
|
||||
'id' => 1,
|
||||
'transaction_id' => 'TXN-ABC',
|
||||
'payer_email' => 'payer@example.com',
|
||||
'event_type' => 'PAYMENT',
|
||||
'order_id' => 'ORDER-1',
|
||||
'parent_school_id' => 'P1',
|
||||
'amount' => 50,
|
||||
'currency' => 'USD',
|
||||
'created_at' => '2025-01-01 00:00:00',
|
||||
]);
|
||||
|
||||
DB::table('paypal_payments')->insert([
|
||||
'id' => 2,
|
||||
'transaction_id' => 'TXN-DEF',
|
||||
'payer_email' => 'other@example.com',
|
||||
'event_type' => 'REFUND',
|
||||
'order_id' => 'ORDER-2',
|
||||
'parent_school_id' => 'P2',
|
||||
'amount' => 75,
|
||||
'currency' => 'USD',
|
||||
'created_at' => '2025-01-02 00:00:00',
|
||||
]);
|
||||
|
||||
$service = new PaypalTransactionsService();
|
||||
$results = $service->listAll('ABC');
|
||||
|
||||
$this->assertCount(1, $results);
|
||||
$this->assertStringContainsString('TXN-ABC', json_encode($results));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user