fix: preserve KOOP identity and payment eligibility when using a single API

This commit is contained in:
nurafrinaalimi16
2026-09-23 11:01:07 +08:00
parent 63231a23af
commit bdce66bae5
3 changed files with 79 additions and 1 deletions
+11 -1
View File
@@ -2,6 +2,7 @@
namespace App\Services;
use App\Models\CompanyStatus;
use Illuminate\Support\Facades\Http;
class CustomerInfoService
@@ -26,6 +27,15 @@ class CustomerInfoService
return $requests;
});
return [$responses[0]->json(), isset($responses[1]) ? $responses[1]->json() : []];
$customer = $responses[0]->json();
if ($pkbUrl === $koopUrl) {
// Preserve the source company: payment rules depend on this identity.
return config('api.company') == CompanyStatus::COM_KOOPPKB
? [[], $customer]
: [$customer, []];
}
return [$customer, $responses[1]->json()];
}
}