Separated Checkout and Payment controllers, updates to checkout and payments

This commit is contained in:
2024-08-10 10:14:47 +10:00
parent 06f25d5d4d
commit efbb3d091f
23 changed files with 512 additions and 603 deletions

View File

@@ -7,8 +7,7 @@ use Illuminate\Support\Facades\DB;
use Leenooks\Traits\ScopeActive;
use App\Interfaces\IDs;
use App\Traits\ProviderRef;
use App\Traits\PushNew;
use App\Traits\{ProviderRef,PushNew,SiteID};
/**
* Class Payment
@@ -25,7 +24,7 @@ use App\Traits\PushNew;
*/
class Payment extends Model implements IDs
{
use PushNew,ScopeActive,ProviderRef;
use PushNew,ScopeActive,ProviderRef,SiteID;
protected $casts = [
'paid_at'=>'datetime:Y-m-d',
@@ -106,7 +105,7 @@ class Payment extends Model implements IDs
->select(['payments.id','paid_at','account_id','checkout_id','total_amt',DB::raw("SUM(ABS(amount)) as allocated")])
->leftJoin('payment_items',['payment_items.payment_id'=>'payments.id'])
->groupBy(['payments.id','paid_at','total_amt','account_id','checkout_id'])
->having(DB::raw('ROUND(total_amt-IFNULL(allocated,0),2)'),'>',self::threshold);
->having(DB::raw('ROUND(CAST(total_amt-COALESCE(SUM(ABS(amount)),0) AS NUMERIC),2)'),'>',self::threshold);
}
/* ATTRIBUTES */