Ejemplo n.º 1
0
    $result = InvestmentProfiles::getAssetMatchingInvestmentProfiles($id);
    if ($result) {
        $response->json(Result::success('', $result));
    } else {
        $response->json(Result::error('Asset not found'));
    }
});
$this->respond(['GET', 'POST'], '/match/asset-and-investment-profile', function ($request, $response, $service, $app) {
    $assetID = $request->param('assetID');
    $investmentProfileID = $request->param('investmentProfileID');
    $reasons = $request->param('reasons');
    $isMatching = $request->param('isMatching');
    if (Logs::isLogAlreadyConnectedToInvestor($assetID, $investmentProfileID)) {
        $response->json(Result::error('קיים כבר לוג בין המשקיע לנכס'));
    } else {
        $result = Logs::matchAssetAndInvestmentProfile($assetID, $investmentProfileID, $reasons, $isMatching);
        if ($result) {
            $response->json(Result::success('Matched.', $result));
        } else {
            $response->json(Result::error('Error trying to match'));
        }
    }
});
$this->respond(['GET', 'POST'], '/cancel/asset-and-investment-profile', function ($request, $response, $service, $app) {
    $logID = $request->param('logID');
    $result = Logs::cancelMatchAssetAndInvestmentProfile($logID);
    if ($result > 0) {
        $response->json(Result::success('Canceled'));
    } else {
        $response->json(Result::error('Error trying to cancel'));
    }