Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Browser/Reseller/WalletTest.php
<?php | <?php | ||||
namespace Tests\Browser\Reseller; | namespace Tests\Browser\Reseller; | ||||
use App\Payment; | use App\Payment; | ||||
use App\Providers\PaymentProvider; | |||||
use App\Transaction; | use App\Transaction; | ||||
use App\Wallet; | use App\Wallet; | ||||
use Carbon\Carbon; | use Carbon\Carbon; | ||||
use Tests\Browser; | use Tests\Browser; | ||||
use Tests\Browser\Pages\Dashboard; | use Tests\Browser\Pages\Dashboard; | ||||
use Tests\Browser\Pages\Home; | use Tests\Browser\Pages\Home; | ||||
use Tests\Browser\Pages\Wallet as WalletPage; | use Tests\Browser\Pages\Wallet as WalletPage; | ||||
use Tests\TestCaseDusk; | use Tests\TestCaseDusk; | ||||
▲ Show 20 Lines • Show All 112 Lines • ▼ Show 20 Lines | public function testReceipts(): void | ||||
}); | }); | ||||
}); | }); | ||||
// Create some sample payments | // Create some sample payments | ||||
$receipts = []; | $receipts = []; | ||||
$date = Carbon::create(intval(date('Y')) - 1, 3, 30); | $date = Carbon::create(intval(date('Y')) - 1, 3, 30); | ||||
$payment = Payment::create([ | $payment = Payment::create([ | ||||
'id' => 'AAA1', | 'id' => 'AAA1', | ||||
'status' => PaymentProvider::STATUS_PAID, | 'status' => Payment::STATUS_PAID, | ||||
'type' => PaymentProvider::TYPE_ONEOFF, | 'type' => Payment::TYPE_ONEOFF, | ||||
'description' => 'Paid in March', | 'description' => 'Paid in March', | ||||
'wallet_id' => $wallet->id, | 'wallet_id' => $wallet->id, | ||||
'provider' => 'stripe', | 'provider' => 'stripe', | ||||
'amount' => 1111, | 'amount' => 1111, | ||||
'credit_amount' => 1111, | 'credit_amount' => 1111, | ||||
'currency_amount' => 1111, | 'currency_amount' => 1111, | ||||
'currency' => 'CHF', | 'currency' => 'CHF', | ||||
]); | ]); | ||||
$payment->updated_at = $date; | $payment->updated_at = $date; | ||||
$payment->save(); | $payment->save(); | ||||
$receipts[] = $date->format('Y-m'); | $receipts[] = $date->format('Y-m'); | ||||
$date = Carbon::create(intval(date('Y')) - 1, 4, 30); | $date = Carbon::create(intval(date('Y')) - 1, 4, 30); | ||||
$payment = Payment::create([ | $payment = Payment::create([ | ||||
'id' => 'AAA2', | 'id' => 'AAA2', | ||||
'status' => PaymentProvider::STATUS_PAID, | 'status' => Payment::STATUS_PAID, | ||||
'type' => PaymentProvider::TYPE_ONEOFF, | 'type' => Payment::TYPE_ONEOFF, | ||||
'description' => 'Paid in April', | 'description' => 'Paid in April', | ||||
'wallet_id' => $wallet->id, | 'wallet_id' => $wallet->id, | ||||
'provider' => 'stripe', | 'provider' => 'stripe', | ||||
'amount' => 1111, | 'amount' => 1111, | ||||
'credit_amount' => 1111, | 'credit_amount' => 1111, | ||||
'currency_amount' => 1111, | 'currency_amount' => 1111, | ||||
'currency' => 'CHF', | 'currency' => 'CHF', | ||||
]); | ]); | ||||
▲ Show 20 Lines • Show All 93 Lines • Show Last 20 Lines |