Created
February 9, 2023 13:30
-
-
Save cesarockstar1985/1b1348e0f822169a08dd0361dc71dba9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function selectSurety($requestData, Quote $quote, BestMatchingSuretyResult $bestMatchingSurety): Quote | |
{ | |
$data = [ | |
'surety_id' => $requestData['surety_id'] ?? null, | |
'surety_rate' => $requestData['surety_rate'] ?? null, | |
'agent_id' => $requestData['agent_id'] ?? null, | |
'amount' => $requestData['amount'] ?? $quote->bond->bond_amount, | |
]; | |
$quote = $this->patchEntity($quote, $data); | |
$suggested = $bestMatchingSurety->found; | |
$quote->suggested_surety_id = $suggested ? $bestMatchingSurety->best_surety->id : null; | |
$quote->suggested_surety_rate = $suggested ? $bestMatchingSurety->best_commission : null; | |
$this->saveOrFail($quote); | |
return $quote; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment