Пример #1
0
<?php

$this->respond(['GET', 'POST'], '/get/matching-assets/[i:id]', function ($request, $response, $service, $app) {
    $id = $request->param('id');
    // assets Matching given InvestmentProfile
    $result = Assets::getInvestmentProfileMatchingAssets($id);
    if ($result) {
        $response->json(Result::success('', $result));
    } else {
        $response->json(Result::error('InvestmentProfile not found'));
    }
});
$this->respond(['GET', 'POST'], '/get/matching-investment-profiles/[i:id]', function ($request, $response, $service, $app) {
    $id = $request->param('id');
    // InvestmentProfiles Matching given asset
    $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);