Rework payment tables, enable payment editing

This commit is contained in:
Deon George
2021-07-23 17:25:26 +10:00
parent fa62a47680
commit d463239b17
19 changed files with 352 additions and 116 deletions

View File

@@ -66,7 +66,7 @@ class PaymentsEzypayImport extends Command
}
// Find the last payment logged
$last = Carbon::createFromTimestamp(Payment::whereIN('checkout_id',$cos)->where('account_id',$ao->id)->max('date_payment'));
$last = Carbon::createFromTimestamp(Payment::whereIN('checkout_id',$cos)->where('account_id',$ao->id)->max('payment_date'));
$o = $poo->getDebits([
'customerId'=>$c->Id,
@@ -87,13 +87,13 @@ class PaymentsEzypayImport extends Command
$pd = Carbon::createFromFormat('Y-m-d?H:i:s.u',$p->Date);
$lp = $ao->payments->last();
if ($lp AND (($pd == $lp->date_payment) OR ($p->Id == $lp->checkout_data)))
if ($lp AND (($pd == $lp->payment_date) OR ($p->Id == $lp->checkout_data)))
continue;
// New Payment
$po = new Payment;
$po->site_id = 1; // @todo
$po->date_payment = $pd;
$po->payment_date = $pd;
$po->checkout_id = '999'; // @todo
$po->checkout_data = $p->Id;
$po->total_amt = $p->Amount;