Add paypal payments

This commit is contained in:
Deon George
2020-07-27 14:49:59 +10:00
parent 9887996da8
commit 1242dffa20
18 changed files with 1483 additions and 433 deletions

View File

@@ -13,4 +13,31 @@ class Checkout extends Model
{
return $this->hasMany(Payment::class);
}
/** SCOPES **/
/**
* Search for a record
*
* @param $query
* @param string $term
* @return
*/
public function scopeActive($query)
{
return $query->where('active',TRUE);
}
/** FUNCTIONS **/
public function fee(float $amt,int $items=1): float
{
if (! $this->fee_passon OR ! $items)
return 0;
$fee = $amt+$this->fee_fixed/$items;
$fee /= (1-$this->fee_variable);
return round($fee-$amt,2);
}
}