Penambahn P1 Dev
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\P1Dev;
|
||||
|
||||
class P1DawaiPaymentComparison
|
||||
{
|
||||
public static function reference(?array $dawai, array $local): ?array
|
||||
{
|
||||
if ($dawai === null) {
|
||||
return null;
|
||||
}
|
||||
// Use the newest payment ID regardless of whether older amounts match locally.
|
||||
$latest = null;
|
||||
foreach ($dawai['riwayat_pembayaran'] ?? [] as $payment) {
|
||||
if ($latest === null || (int) ($payment['id'] ?? 0) > (int) ($latest['id'] ?? 0)) {
|
||||
$latest = $payment;
|
||||
}
|
||||
}
|
||||
|
||||
return $latest ?? $dawai;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user