Fix for ezypay payment import

This commit is contained in:
Deon George 2022-06-13 16:44:24 +10:00
parent 49a4830d89
commit 28438c6423
2 changed files with 5 additions and 3 deletions

View File

@ -30,8 +30,8 @@ class Ezypay extends Payments
$api_remain = Arr::get($result->getHeader('X-RateLimit-Remaining'),0);
$api_reset = Arr::get($result->getHeader('X-RateLimit-Reset'),0);
if ($api_remain == 0) {
Log::error('API Throttle.',['m'=>__METHOD__]);
if ($api_remain === 0) {
Log::error('API Throttle.',['m'=>__METHOD__,'api_reset'=>$api_reset]);
Cache::put('api_throttle',$api_reset,now()->addSeconds($api_reset));
}

View File

@ -57,7 +57,7 @@ final class PaymentsImport implements ShouldQueue
}
// Find the last payment logged
$last = Carbon::createFromTimestamp(Payment::whereIN('checkout_id',$cos)->where('account_id',$ao->id)->max('paid_at'));
$last = Carbon::create(Payment::whereIN('checkout_id',$cos)->where('account_id',$ao->id)->max('paid_at'));
$o = $this->o->getDebits([
'customerId'=>$c->Id,
@ -66,6 +66,8 @@ final class PaymentsImport implements ShouldQueue
'pageSize'=>100,
]);
Log::info(sprintf('%s:Loaded [%d] payments for account: [%s]',self::LOGKEY,$o->count(),$ao->id));
// Load the payments
if ($o->count()) {
foreach ($o->reverse() as $p) {