Created
September 24, 2024 08:53
-
-
Save adejorosam/370a9ef9d11e8f7203a68a99b0293562 to your computer and use it in GitHub Desktop.
stuff
This file has been truncated, but you can view the full file.
This file contains hidden or 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
<?php | |
use CardinalstoneRestServer\models\MutualFundModel as mutualFundModel; | |
use CardinalstoneRestServer\models\ForeignEquityModel as ForeignEquityModel; | |
use CardinalstoneRestServer\models\CustomerModel as customerModel; | |
use Carbon\Carbon; | |
use CardinalstoneRestServer\middleware\Authentication as auth; | |
use CardinalstoneRestServer\middleware\Authorization; | |
use CardinalstoneRestServer\middleware\AdminAuthorization; | |
use CardinalstoneRestServer\middleware\CheckMultifactorAuthentication; | |
use CardinalstoneRestServer\services\JWTToken; | |
use CardinalstoneRestServer\services\RandomString; | |
use Respect\Validation\Validator as V; | |
use CardinalstoneRestServer\services\mail\Mailer; | |
use CardinalstoneRestServer\middleware\RateLimitMiddleware; | |
use CardinalstoneRestServer\middleware\PartnersMiddleware; | |
use CardinalstoneRestServer\services\EncryptedDataRequest; | |
use CardinalstoneRestServer\services\MobileEncryption; | |
use GuzzleHttp\Client; | |
use CardinalstoneRestServer\services\BankOneAccountRequest; | |
/* | |
use CardinalstoneRestServer\models\MutualFundModel as mutualFundModel; | |
use CardinalstoneRestServer\models\CustomerModel as customerModel; | |
use CardinalstoneRestServer\models\MutualFund_CAMModel as mutualFund_CAMModel; | |
use CardinalstoneRestServer\middleware\Authentication; | |
use CardinalstoneRestServer\middleware\Authorization; | |
use Carbon\Carbon; | |
*/ | |
/** | |
* @OA\Info( | |
* title="Cardinalstone restserver", | |
* version="1.0.0" | |
* ) | |
*/ | |
/** | |
* @OA\SecurityScheme( | |
* securityScheme="authorization_token", | |
* type="apiKey", | |
* in="header", | |
* name="authorization" | |
* ) | |
* | |
*/ | |
/** | |
* This function returns the customer data by their Name and Password | |
* | |
* @author Ukah Ewomazino | |
* | |
* @OA\Post( | |
* path="/api/findCustomerByName", | |
* tags={"Customer"}, | |
* description="This function returns the customer data by their Name and Password", | |
* summary="This endpoint is used to login a customer", | |
* operationId="findCustomerByName", | |
* @OA\RequestBody( | |
* required=true, | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* @OA\Property( | |
* property="username", | |
* description="Username of the customer", | |
* type="string" | |
* ), | |
* @OA\Property( | |
* property="password", | |
* description="Password of the customer", | |
* type="string" | |
* ), | |
* example={"username": "DEMO1", "password": "demo1"} | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Successfully fetched results!" | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="username/password not supplied" | |
* ), | |
* @OA\Response( | |
* response=422, | |
* description="Invalid Credentials" | |
* ) | |
* ) | |
* | |
* | |
*/ | |
$app->post('/api/findCustomerByName', function ($request, $response) { | |
validate($request, [ | |
'username' => V::notBlank(), | |
'password' => V::notBlank(), | |
]); | |
$payload = $request->getParsedBody(); | |
return $response | |
->withStatus(200) | |
->withJson( | |
$this->customerModel | |
->login( | |
$payload['username'], | |
$payload['password'] | |
) | |
); | |
}) | |
->add(new RateLimitMiddleware()); | |
$app->get('/api/getTransferRecipient', function($request, $response){ | |
$status = 200; | |
validate($request, [ | |
'CustID'=> V::notBlank(), | |
]); | |
$payload = $request->getQueryParams(); | |
$transferRecipient = json_decode($this->customerModel->getTransferRecipient($payload), true); | |
$bankDetails = $this->customerModel->getCustomerBankDetails($payload['CustID']); | |
$mergedDetails = array_merge($transferRecipient, $bankDetails); | |
// Iterate through the inner arrays | |
foreach ($mergedDetails as &$mergedDetail) { | |
// Check if the specific field "name" is present in the inner array | |
if (array_key_exists("recipientCode", $mergedDetail)) { | |
// If the field is present, add the new key and value to the inner array | |
$mergedDetail["default"] = "true"; | |
}else{ | |
$mergedDetail["default"] = "false"; | |
} | |
} | |
$newArray = []; | |
foreach ($mergedDetails as $item) { | |
$icode = ($item["BankCode"] !== null) ? $this->customerModel->bankCode($item['BankCode']) : $item["BankCode"]; | |
$newArray[] = [ | |
"default" => $item["default"], | |
"accountName" => $item["accountName"] ?? $item["AccountName"], | |
"bankName" => $item["bankName"] ?? $item["BankName"], | |
"accountNumber" => $item["accountNumber"] ?? $item["AcctNumber"], | |
"bankCode" => $item["bankCode"] ?? $icode->iCode, | |
"recipientCode" => $item["recipientCode"] ?? $item["AcctNumber"] | |
]; | |
} | |
$filteredArray = filterArrayByDefault($newArray); | |
return $response | |
->withStatus($status) | |
->withJson($filteredArray); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* Find Customer by Name (Version 1) | |
* | |
* This API endpoint allows users to find a customer by their username and password. | |
* | |
* @param {string} username - The customer's username. | |
* @param {string} password - The customer's password. | |
* | |
* @return {Object} Response - JSON response containing the result of the query. | |
* | |
* @throws {Error} 400 - Bad Request: If either the username or password is missing or invalid. | |
* @throws {Error} 500 - Internal Server Error: If an unexpected error occurs. | |
* | |
* @OA\Post( | |
* path="/api/findCustomerByName_1", | |
* tags={"Customer"}, | |
* summary="Find Customer by Name (Version 1)", | |
* operationId="findCustomerByName_1", | |
* @OA\RequestBody( | |
* required=true, | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* @OA\Property(property="username", type="string"), | |
* @OA\Property(property="password", type="string") | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Successful operation", | |
* @OA\JsonContent( | |
* @OA\Property(property="data", type="object", @OA\Property(property="customer", type="object")), | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->post('/api/findCustomerByName_1', function ($request, $response) { | |
// $ipAddress = $request->getServerParam('REMOTE_ADDR'); | |
// $lockKey = "lock:laptop:" . $ipAddress; | |
// $lockTimeout = 60; // Lock timeout in seconds, adjust as needed | |
// $cache = container('cache')->fetch($lockKey); | |
// if($cache === false) | |
// { | |
// acquireLock($lockKey, $lockTimeout); | |
// } | |
// else { | |
// return ["code" => 423, "message" => "Please hold off for a bit before logging in. Thank you for your patience!"]; | |
// } | |
validate($request, [ | |
'username' => V::notBlank(), | |
'password' => V::notBlank(), | |
]); | |
$payload = $request->getParsedBody(); | |
if($payload['deviceName'] != null) | |
{ | |
$customerInfo = $this->customerModel->getCustomerDetails($payload['username']); | |
$logContext = [ | |
'deviceName' => $payload['deviceName'], | |
'CustID' => $payload['username'], | |
'deviceModel' => $payload['deviceModel'], | |
'deviceIP' => $request->getServerParam('REMOTE_ADDR'), | |
'deviceToken' => $payload['deviceToken'], | |
'lastLocation' => $payload['lastLocation'], | |
'emailAddress' => $customerInfo['emailAddress'], | |
'fullName' => $customerInfo['fullName'] | |
]; | |
// $deviceDetails = container('customerModel')->getDeviceDetails($payload); | |
// if(count($deviceDetails) < 1){ | |
container('customerModel')->deviceDetailsMobile($logContext); | |
// } | |
} | |
return $response | |
->withStatus(200) | |
->withJson( | |
$this->customerModel | |
->login_1( | |
$request->getParsedBody()['username'], | |
$request->getParsedBody()['password'] | |
) | |
); | |
}) | |
->add(new RateLimitMiddleware()); | |
//->add(new auth()); | |
// ->add(new CheckMultifactorAuthentication()); | |
$app->get('/api/updateCRMWithModifications', function ($request, $response) { | |
container('FreshsalesRequest')->periodicUpdate(); | |
}); | |
$app->get('/api/retrieveCustomerData', function ($request, $response) { | |
$result = $this->customerModel->getCustomerData(); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}) | |
->add(new RateLimitMiddleware()); | |
$app->get('/api/retrieveTradesData', function ($request, $response) { | |
validate($request, [ | |
'startDate' => V::notBlank(), | |
'endDate' => V::notBlank() | |
]); | |
$payload = $request->getParsedBody(); | |
$result = $this->customerModel->getTradesData($payload); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}) | |
->add(new RateLimitMiddleware()); | |
$app->get('/api/retrieveBirthdayData', function ($request, $response) { | |
$result = $this->customerModel->getBirthdayData(); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}) | |
->add(new RateLimitMiddleware()); | |
$app->get('/api/retrieveCAMData_1', function ($request, $response) { | |
$result = $this->customerModel->getCAMData_1(); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}) | |
->add(new RateLimitMiddleware()); | |
$app->get('/api/retrieveCAMData_2', function ($request, $response) { | |
$result = $this->customerModel->getCAMData_2(); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}) | |
->add(new RateLimitMiddleware()); | |
$app->get('/api/retrieveCAMData_3', function ($request, $response) { | |
$result = $this->customerModel->getCAMData_3(); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}) | |
->add(new RateLimitMiddleware()); | |
$app->get('/api/retrieveCAMData_4', function ($request, $response) { | |
$result = $this->customerModel->getCAMData_4(); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}) | |
->add(new RateLimitMiddleware()); | |
$app->get('/api/retrieveCAMData_5', function ($request, $response) { | |
$result = $this->customerModel->getCAMData_5(); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}) | |
->add(new RateLimitMiddleware()); | |
/** | |
* Find Customer by Name Details | |
* | |
* This API endpoint allows authorized users to find customer details based on their CustID. | |
* | |
* @param {string} CustID - The customer's ID. | |
* | |
* @return {Object} Response - JSON response containing the customer details. | |
* | |
* @throws {Error} 400 - Bad Request: If the CustID is missing or invalid. | |
* @throws {Error} 401 - Unauthorized: If the CustID in the request does not match the authenticated user's ID. | |
* @throws {Error} 500 - Internal Server Error: If an unexpected error occurs. | |
* | |
* @OA\Post( | |
* path="/api/findCustomerByNameDetails", | |
* tags={"Customer"}, | |
* summary="Find Customer by Name Details", | |
* operationId="findCustomerByNameDetails", | |
* security={{ "BearerAuth": {} }}, | |
* @OA\RequestBody( | |
* required=true, | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* @OA\Property(property="CustID", type="string") | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Successful operation", | |
* @OA\JsonContent( | |
* @OA\Property(property="data", type="object", @OA\Property(property="customer", type="object")), | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->post('/api/findCustomerByNameDetails', function ($request, $response) { | |
validate($request, [ | |
'CustID' => V::notBlank(), | |
]); | |
$payload = $request->getParsedBody(); | |
$payload["CAMID"] = $request->getAttribute('CAMID'); | |
$payload["SECID"] = $request->getAttribute('SECID'); | |
//check CustID is same as token ID | |
if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$result = $this->customerModel->findCustomerByNameDetails($payload); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
// ->add(new CheckMultifactorAuthentication()); | |
$app->post('/api/findCustomerByNameDetails_', function ($request, $response) { | |
validate($request, [ | |
'CustID' => V::notBlank(), | |
]); | |
$payload = $request->getParsedBody(); | |
$payload["CAMID"] = $request->getAttribute('CAMID'); | |
$payload["SECID"] = $request->getAttribute('SECID'); | |
//check CustID is same as token ID | |
if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$result = $this->customerModel->findCustomerByNameDetails_($payload); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
$app->post('/api/admin/findCustomerByNameDetails', function ($request, $response) { | |
validate($request, [ | |
'CustID' => V::notBlank(), | |
]); | |
$payload = $request->getParsedBody(); | |
$customerInfo = $this->customerModel->getCustomerDetails($payload['CustID']); | |
if (!$customerInfo) { | |
throw new Exception('Unable to find customer ' . $payload['CustID']); | |
} | |
$payload['SECID'] = $customerInfo['SECID']; | |
$payload['ASSETID'] = $customerInfo['ASSETID']; | |
$payload["CAMID"] = $customerInfo['CAMID']; | |
$result = $this->customerModel->findCustomerByNameDetails($payload); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
$app->post('/api/e-rights/findCustomerByNameDetails', function ($request, $response) { | |
validate($request, [ | |
'CustID' => V::notBlank(), | |
]); | |
$payload = $request->getParsedBody(); | |
$customerInfo = $this->customerModel->getCustomerDetails($payload['CustID']); | |
if (!$customerInfo) { | |
throw new Exception('Unable to find customer ' . $payload['CustID']); | |
} | |
$payload['SECID'] = $customerInfo['SECID']; | |
$payload['ASSETID'] = $customerInfo['ASSETID']; | |
$payload["CAMID"] = $customerInfo['CAMID']; | |
$result = $this->customerModel->findCustomerByNameDetails($payload); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
/** | |
* Update Customer Username | |
* | |
* This API endpoint allows authorized users to update the username of a customer based on their CustID. | |
* | |
* @param {string} username - The new username to be updated. | |
* @param {string} CustID - The customer's ID. | |
* | |
* @return {Object} Response - JSON response containing the result of the username update. | |
* | |
* @throws {Error} 400 - Bad Request: If the username or CustID is missing or invalid. | |
* @throws {Error} 401 - Unauthorized: If the CustID in the request does not match the authenticated user's ID. | |
* @throws {Error} 500 - Internal Server Error: If an unexpected error occurs. | |
* | |
* @OA\Post( | |
* path="/api/customer/updateUsername", | |
* tags={"Customer"}, | |
* summary="Update Customer Username", | |
* operationId="updateCustomerUsername", | |
* security={{ "BearerAuth": {} }}, | |
* @OA\RequestBody( | |
* required=true, | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* @OA\Property(property="username", type="string"), | |
* @OA\Property(property="CustID", type="string") | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Successful operation", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ) | |
* ) | |
*/ | |
/***************** update username **********************************/ | |
$app->post('/api/customer/updateUsername', function ($request, $response) { | |
validate($request, [ | |
'username' => V::notBlank(), | |
'CustID' => V::notBlank(), | |
]); | |
$payload = $request->getParsedBody(); | |
//check CustID is same as token ID | |
if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
// var_dump($payload); | |
$result = $this->customerModel->updateUsername($payload['username'],$payload['CustID']); | |
if($result['code'] ?? 200 == 200) | |
{ | |
return $response | |
->withStatus(200) | |
->withJson($result['message']); | |
}else | |
{ | |
return $response | |
->withStatus(400) | |
->withJson($result['message']); | |
} | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
// ->add(new CheckMultifactorAuthentication()); | |
/** | |
* Create Customer Username | |
* | |
* This API endpoint allows authorized users to create a new username for a customer based on their CustID. | |
* | |
* @param {string} username - The new username to be created. | |
* @param {string} CustID - The customer's ID. | |
* | |
* @return {Object} Response - JSON response containing the result of the username creation. | |
* | |
* @throws {Error} 400 - Bad Request: If the username or CustID is missing or invalid. | |
* @throws {Error} 401 - Unauthorized: If the CustID in the request does not match the authenticated user's ID. | |
* @throws {Error} 500 - Internal Server Error: If an unexpected error occurs. | |
* | |
* @OA\Post( | |
* path="/api/customer/createUsername", | |
* tags={"Customer"}, | |
* summary="Create Customer Username", | |
* operationId="createCustomerUsername", | |
* security={{ "BearerAuth": {} }}, | |
* @OA\RequestBody( | |
* required=true, | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* @OA\Property(property="username", type="string"), | |
* @OA\Property(property="CustID", type="string") | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Successful operation", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->post('/api/customer/createUsername', function ($request, $response) { | |
validate($request, [ | |
'username' => V::notBlank(), | |
'CustID' => V::notBlank(), | |
]); | |
$payload = $request->getParsedBody(); | |
//check CustID is same as token ID | |
if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
// var_dump($payload); | |
$result = $this->customerModel->createUsername($payload['username'],$payload['CustID']); | |
if($result['code'] ?? 200 == 200) | |
{ | |
return $response | |
->withStatus(200) | |
->withJson($result['message']); | |
}else | |
{ | |
return $response | |
->withStatus(400) | |
->withJson($result['message']); | |
} | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
// ->add(new CheckMultifactorAuthentication()); | |
/** | |
* Change Customer Username | |
* | |
* This API endpoint allows authorized users to change an existing username for a customer based on their CustID. | |
* | |
* @param {string} username - The new username to be assigned. | |
* @param {string} CustID - The customer's ID. | |
* | |
* @return {Object} Response - JSON response containing the result of the username change. | |
* | |
* @throws {Error} 400 - Bad Request: If the username or CustID is missing or invalid. | |
* @throws {Error} 401 - Unauthorized: If the CustID in the request does not match the authenticated user's ID. | |
* @throws {Error} 500 - Internal Server Error: If an unexpected error occurs. | |
* | |
* @OA\Post( | |
* path="/api/customer/changeUsername", | |
* tags={"Customer"}, | |
* summary="Change Customer Username", | |
* operationId="changeCustomerUsername", | |
* security={{ "BearerAuth": {} }}, | |
* @OA\RequestBody( | |
* required=true, | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* @OA\Property(property="username", type="string"), | |
* @OA\Property(property="CustID", type="string") | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Successful operation", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->post('/api/customer/changeUsername', function ($request, $response) { | |
validate($request, [ | |
'username' => V::notBlank(), | |
'CustID' => V::notBlank(), | |
]); | |
$payload = $request->getParsedBody(); | |
//check CustID is same as token ID | |
if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
// var_dump($payload); | |
$result = $this->customerModel->changeUsername($payload['username'],$payload['CustID']); | |
if($result['code'] ?? 200 == 200) | |
{ | |
return $response | |
->withStatus(200) | |
->withJson($result['message']); | |
}else | |
{ | |
return $response | |
->withStatus(400) | |
->withJson($result['message']); | |
} | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
// ->add(new CheckMultifactorAuthentication()); | |
/** | |
* This function allows mutual funds user login and returns the customer data | |
* | |
* @author [email protected] | |
* | |
* @OA\Post( | |
* path="/api/mutualfund/login", | |
* tags={"Customer"}, | |
* description="This function returns the customer data by their Name and Password", | |
* summary="This endpoint is used to login a customer for mutual funds", | |
* operationId="mutualfund/login", | |
* @OA\RequestBody( | |
* required=true, | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* @OA\Property( | |
* property="username", | |
* description="Username of the customer", | |
* type="string" | |
* ), | |
* @OA\Property( | |
* property="password", | |
* description="Password of the customer", | |
* type="string" | |
* ), | |
* example={"username": "DEMO1", "password": "demodemo"} | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Successfully fetched results!" | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="username/password not supplied" | |
* ), | |
* @OA\Response( | |
* response=422, | |
* description="Invalid Credentials" | |
* ) | |
* ) | |
* | |
* | |
*/ | |
$app->post('/api/mutualfund/login', function ($request, $response) { | |
validate($request, [ | |
'username' => V::notBlank(), | |
'password' => V::notBlank(), | |
]); | |
return $response | |
->withStatus(200) | |
->withJson( | |
$this->customerModel | |
->mutualFundLogin( | |
$request->getParsedBody()['username'], | |
$request->getParsedBody()['password'] | |
) | |
); | |
}) | |
// ->add(new Authorization()) | |
// ->add(new auth()); | |
->add(new CheckMultifactorAuthentication()); | |
/** | |
* Get Mutual Fund Information | |
* | |
* This API endpoint allows authorized users to retrieve Mutual Fund information for a customer based on their CustID. | |
* | |
* @param {string} CustID - The customer's ID. | |
* | |
* @return {Object} Response - JSON response containing the Mutual Fund information. | |
* | |
* @throws {Error} 400 - Bad Request: If the CustID is missing or invalid. | |
* @throws {Error} 401 - Unauthorized: If the CustID in the request does not match the authenticated user's ID. | |
* @throws {Error} 500 - Internal Server Error: If an unexpected error occurs. | |
* | |
* @OA\Get( | |
* path="/api/mutualfund/mfInfo", | |
* tags={"Mutual Fund"}, | |
* summary="Get Mutual Fund Information", | |
* operationId="getMutualFundInfo", | |
* security={{ "BearerAuth": {} }}, | |
* @OA\Parameter( | |
* name="CustID", | |
* in="query", | |
* required=true, | |
* @OA\Schema( | |
* type="string" | |
* ), | |
* description="The customer's ID" | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Successful operation", | |
* @OA\JsonContent( | |
* @OA\Property(property="data", type="array", | |
* @OA\Items( | |
* @OA\Property(property="mfInfo", type="string"), | |
* @OA\Property(property="someOtherInfo", type="string") | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/mutualfund/mfInfo', function ($request, $response) { | |
validate($request, [ | |
'CustID' => V::notBlank(), | |
]); | |
$payload = $request->getQueryParams(); | |
$payload["CAMID"] = $request->getAttribute('CAMID'); | |
$payload["SECID"] = $request->getAttribute('SECID'); | |
//check CustID is same as token ID | |
if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$result = $this->customerModel->mfInfo($payload); | |
return $response | |
->withStatus($result["code"] ?? 200) | |
->withJson($result); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* Get Mutual Fund Login Details | |
* | |
* This API endpoint allows authorized users to retrieve Mutual Fund login details for a customer based on their CustID. | |
* | |
* @param {string} CustID - The customer's ID. | |
* | |
* @return {Object} Response - JSON response containing the Mutual Fund login details. | |
* | |
* @throws {Error} 400 - Bad Request: If the CustID is missing or invalid. | |
* @throws {Error} 401 - Unauthorized: If the CustID in the request does not match the authenticated user's ID. | |
* @throws {Error} 500 - Internal Server Error: If an unexpected error occurs. | |
* | |
* @OA\Post( | |
* path="/api/mutualfund/loginDetails", | |
* tags={"Mutual Fund"}, | |
* summary="Get Mutual Fund Login Details", | |
* operationId="getMutualFundLoginDetails", | |
* security={{ "BearerAuth": {} }}, | |
* @OA\RequestBody( | |
* required=true, | |
* @OA\JsonContent( | |
* @OA\Property(property="CustID", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Successful operation", | |
* @OA\JsonContent( | |
* @OA\Property(property="data", type="array", | |
* @OA\Items( | |
* @OA\Property(property="loginDetails", type="string"), | |
* @OA\Property(property="someOtherInfo", type="string") | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->post('/api/mutualfund/loginDetails', function ($request, $response) { | |
validate($request, [ | |
'CustID' => V::notBlank(), | |
]); | |
$payload = $request->getParsedBody(); | |
$payload["CAMID"] = $request->getAttribute('CAMID'); | |
$payload["SECID"] = $request->getAttribute('SECID'); | |
//check CustID is same as token ID | |
if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$result = $this->customerModel->mutualFundLoginDetails($payload); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}) | |
->add(new Authorization()) | |
->add(new auth()) | |
->add(new CheckMultifactorAuthentication()); | |
//created by Tayo for Mutual Funds Admin login 24th of June | |
/** | |
* Mutual Fund Admin Login | |
* | |
* This API endpoint allows authorized users to perform an admin login for a customer with a specified CustID. | |
* | |
* @param {string} CustID - The customer's ID. | |
* @param {string} admin - The admin type (e.g., "Virtual Account"). | |
* | |
* @return {Object} Response - JSON response containing the admin login details and customer information. | |
* | |
* @throws {Error} 400 - Bad Request: If the CustID is missing or invalid. | |
* @throws {Error} 401 - Unauthorized: If the user does not have admin authorization. | |
* @throws {Error} 500 - Internal Server Error: If an unexpected error occurs. | |
* | |
* @OA\Post( | |
* path="/api/mutualfund/adminLogin", | |
* tags={"Mutual Fund"}, | |
* summary="Mutual Fund Admin Login", | |
* operationId="mutualFundAdminLogin", | |
* security={{ "BearerAuth": {} }}, | |
* @OA\RequestBody( | |
* required=true, | |
* @OA\JsonContent( | |
* @OA\Property(property="CustID", type="string"), | |
* @OA\Property(property="admin", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Successful operation", | |
* @OA\JsonContent( | |
* @OA\Property(property="customer", type="array", | |
* @OA\Items( | |
* @OA\Property(property="Fullname", type="string"), | |
* @OA\Property(property="Email", type="string"), | |
* @OA\Property(property="Phone", type="string"), | |
* @OA\Property(property="CAMID", type="string"), | |
* @OA\Property(property="OtherInfo", type="string") | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->post('/api/mutualfund/adminLogin', function ($request, $response) { | |
validate($request, [ | |
'CustID' => V::notBlank(), | |
// 'admin' => V::notBlank(), | |
]); | |
//var_dump($request->getParsedBody()['CustID']); | |
$payload = $request->getParsedBody(); | |
$payload['admin'] = "Virtual Account"; | |
$result = $this->customerModel->mutualFundAdminLogin($payload['CustID'], $payload['admin']); | |
$result['customer']['Fullname'] = str_replace(",","",$result['customer'][0]["Name"]); | |
$result['customer']['Email'] = $result['customer'][0]["Email1"]; | |
$result['customer']['Phone'] = $result['customer'][0]["Phone1"]; | |
$result['customer']['CAMID'] = $result['customer'][0]["CAMID"]; | |
//check if result is empty | |
if(!is_null($result) && !empty($result) && $result != "" && $result != []) | |
{ | |
//check if user has cam involvement | |
if($result['customer'][0]["CAMID"] == "" || is_null($result['customer'][0]["CAMID"])) | |
{ | |
return $response | |
->withStatus(200) | |
->withJson("User does not have CAM Involvement"); | |
}else{ | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
} | |
}else{ | |
return $response | |
->withStatus(200) | |
->withJson("User does not exist"); | |
} | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
/** | |
* Mutual Fund Webhook Login | |
* | |
* This API endpoint allows authorized users to process webhook data based on the specified webhook type. | |
* | |
* @param {string} webhookType - The type of webhook data (e.g., "nubanPayment", "customerIdentification", "transfer", "paystack_recovery"). | |
* @param {Object} payload - The webhook data payload (contains varying properties based on the webhookType). | |
* @param {string} admin - The name of the admin user making the webhook call. | |
* | |
* @return {Object} Response - JSON response indicating the success or failure of the webhook processing. | |
* | |
* @throws {Error} 400 - Bad Request: If the webhookType is invalid or missing. | |
* @throws {Error} 401 - Unauthorized: If the user does not have admin authorization. | |
* @throws {Error} 500 - Internal Server Error: If an unexpected error occurs during webhook processing. | |
* | |
* @OA\Post( | |
* path="/api/mutualfund/webhookLogin", | |
* tags={"Mutual Fund"}, | |
* summary="Mutual Fund Webhook Login", | |
* operationId="mutualFundWebhookLogin", | |
* security={{ "BearerAuth": {} }}, | |
* @OA\RequestBody( | |
* required=true, | |
* @OA\JsonContent( | |
* @OA\Property(property="webhookType", type="string"), | |
* @OA\Property(property="payload", type="object"), | |
* @OA\Property(property="admin", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Successful operation", | |
* @OA\JsonContent( | |
* @OA\Property(property="code", type="integer"), | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->post('/api/mutualfund/webhookLogin', function ($request, $response) { | |
$payload = $request->getParsedBody(); | |
/* if($request->getAttribute('ID') != "1196") | |
{ | |
return $response | |
->withStatus(400) | |
->withJson(["message" => "Unauthorized Access"]); | |
} */ | |
if($payload['webhookType'] == "nubanPayment") | |
{ | |
/* validate($request, [ | |
'customerCode' => V::notBlank(), | |
'virtualAccountNumber' => V::notBlank(), | |
'amount' => V::notBlank(), | |
'bank' => V::notBlank(), | |
'reference' => V::notBlank(), | |
]); */ | |
}elseif($payload['webhookType'] == "customerIdentification") | |
{ | |
/* validate($request, [ | |
'customerCode' => V::notBlank(), | |
'email' => V::notBlank(), | |
'idType' => V::notBlank(), | |
'idValue' => V::notBlank(), | |
]); */ | |
}elseif($payload['webhookType'] == "transfer") | |
{ | |
/* validate($request, [ | |
'recipientCode' => V::notBlank(), | |
'accountName' => V::notBlank(), | |
'accountNumber' => V::notBlank(), | |
'bankName' => V::notBlank(), | |
'amount' => V::notBlank(), | |
'transferCode' => V::notBlank(), | |
'reason' => V::notBlank(), | |
]); */ | |
}elseif($payload['webhookType'] == "paystack_recovery") | |
{ | |
/* validate($request, [ | |
'recipientCode' => V::notBlank(), | |
'accountName' => V::notBlank(), | |
'accountNumber' => V::notBlank(), | |
'bankName' => V::notBlank(), | |
'amount' => V::notBlank(), | |
'transferCode' => V::notBlank(), | |
'reason' => V::notBlank(), | |
]); */ | |
}elseif($payload['webhookType'] == "paystack_log") | |
{ | |
/* validate($request, [ | |
'recipientCode' => V::notBlank(), | |
'accountName' => V::notBlank(), | |
'accountNumber' => V::notBlank(), | |
'bankName' => V::notBlank(), | |
'amount' => V::notBlank(), | |
'transferCode' => V::notBlank(), | |
'reason' => V::notBlank(), | |
]); */ | |
}elseif($payload['webhookType'] == "nubanPayment2") | |
{ | |
/* validate($request, [ | |
'recipientCode' => V::notBlank(), | |
'accountName' => V::notBlank(), | |
'accountNumber' => V::notBlank(), | |
'bankName' => V::notBlank(), | |
'amount' => V::notBlank(), | |
'transferCode' => V::notBlank(), | |
'reason' => V::notBlank(), | |
]); */ | |
}else{ | |
return $response | |
->withStatus(400) | |
->withJson("Invalid Webhook Option"); | |
} | |
// $payload['admin'] = $request->getAttribute('name'); | |
$payload['admin'] = 'Webhook'; | |
//log event | |
$message1 = "Cron Job Initiated"; | |
$message2 = "Valid Webhook Call"; | |
$message3 = "Webhook Type Verified"; | |
$message4 = (string) json_encode($payload); | |
$message5 = "Internal Call from: " . $_SERVER['REMOTE_ADDR']; | |
$log = $this->customerModel->activity_log($message1,$message2,$message3,$message4,$message5); | |
$rest = $this->customerModel->processWebhook($payload); | |
return $response | |
->withStatus($rest["code"] ?? 200) | |
->withJson(["code" => $rest["code"] ?? 200 , "message" => $rest["message"]]); | |
}); | |
// ->add(new AdminAuthorization()) | |
// ->add(new auth()); | |
$app->post('/api/equityMutualFund/webhookLogin', function ($request, $response) { | |
$payload = $request->getParsedBody(); | |
if($payload['webhookType'] == "nubanPayment") | |
{ | |
}elseif($payload['webhookType'] == "customerIdentification") | |
{ | |
}elseif($payload['webhookType'] === "paystack"){ | |
} | |
elseif($payload['webhookType'] == "transfer") | |
{ | |
}elseif($payload['webhookType'] == "paystack_recovery") | |
{ | |
}else{ | |
return $response | |
->withStatus(400) | |
->withJson("Invalid Webhook Option"); | |
} | |
$payload['admin'] = $request->getAttribute('name'); | |
$rest = $this->customerModel->processEquityWebhook($payload); | |
return $response | |
->withStatus($rest["code"] ?? 200) | |
->withJson(["code" => $rest["code"] ?? 200 , "message" => $rest["message"]]); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
//->add(new CheckMultifactorAuthentication()); | |
/** | |
* Mutual Fund Involvement | |
* | |
* This API endpoint retrieves mutual fund involvement information for a specific customer. | |
* | |
* @param {string} CustID - The ID of the customer to retrieve mutual fund involvement for. | |
* @param {string} SECID (Optional) - The stockbroking customer ID (if not provided in the request query parameters, it will be taken from the token attribute). | |
* @param {string} ASSETID (Optional) - The asset management customer ID (if not provided in the request query parameters, it will be taken from the token attribute). | |
* @param {string} CAMID (Optional) - The CAM customer ID (if not provided in the request query parameters, it will be taken from the token attribute). | |
* | |
* @return {Object} Response - JSON response containing the mutual fund involvement information for the specified customer. | |
* | |
* @throws {Error} 401 - Unauthorized: If the CustID is not the same as the ID in the token attribute, indicating unauthorized access. | |
* @throws {Error} 500 - Internal Server Error: If an unexpected error occurs while retrieving mutual fund involvement information. | |
* | |
* @OA\Get( | |
* path="/api/mutualfund/mfInvolvement", | |
* tags={"Mutual Fund"}, | |
* summary="Mutual Fund Involvement", | |
* operationId="mutualFundInvolvement", | |
* security={{ "BearerAuth": {} }}, | |
* @OA\Parameter( | |
* name="CustID", | |
* in="query", | |
* required=true, | |
* description="The ID of the customer to retrieve mutual fund involvement for", | |
* @OA\Schema(type="string") | |
* ), | |
* @OA\Parameter( | |
* name="SECID", | |
* in="query", | |
* required=false, | |
* description="The stockbroking customer ID (if not provided, it will be taken from the token attribute)", | |
* @OA\Schema(type="string") | |
* ), | |
* @OA\Parameter( | |
* name="ASSETID", | |
* in="query", | |
* required=false, | |
* description="The asset management customer ID (if not provided, it will be taken from the token attribute)", | |
* @OA\Schema(type="string") | |
* ), | |
* @OA\Parameter( | |
* name="CAMID", | |
* in="query", | |
* required=false, | |
* description="The CAM customer ID (if not provided, it will be taken from the token attribute)", | |
* @OA\Schema(type="string") | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Successful operation", | |
* @OA\JsonContent( | |
* @OA\Property(property="mutualFundInvolvement", type="array", @OA\Items(type="string")) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ) | |
* ) | |
*/ | |
//created on the 21st of June by Tayo to return mfInvolvements after creating involvement | |
$app->get('/api/mutualfund/mfInvolvement', function ($request, $response) { | |
validate($request, [ | |
'CustID' => V::notBlank(), | |
// 'SECID' => V::notBlank(), | |
// 'SECID' => V::notBlank(), | |
// 'SECID' => V::notBlank(), | |
]); | |
$queryParams = $request->getQueryParams(); | |
if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$stockBrokingCustomerId = $queryParams['SECID'] ?? $request->getAttribute('stockbrokingID'); | |
$assetMgmtCustomerId = $queryParams['ASSETID'] ?? $request->getAttribute('assetMgmtID'); | |
$CAMCustomerId = $queryParams['CAMID'] ?? $request->getAttribute('CAMID'); | |
$result = $this->customerModel->mfInvolvement($assetMgmtCustomerId, $stockBrokingCustomerId, $CAMCustomerId); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* @author Ukah Ewomazino | |
* | |
* @OA\Get( | |
* path="/api/fetchCustomerData", | |
* tags={"Customer"}, | |
* description="This function returns the customer data", | |
* summary="This function returns the customer data", | |
* operationId="fetchCustomerData", | |
* @OA\Parameter( | |
* description="Asst mgmt ID of the customer", | |
* in="query", | |
* name="assetMgmtID", | |
* required=false, | |
* @OA\Schema( | |
* type="string" | |
* ), | |
* example="0567" | |
* ), | |
* @OA\Parameter( | |
* description="Stockbroking ID of the customer", | |
* in="query", | |
* name="stockbrokingID", | |
* required=false, | |
* @OA\Schema( | |
* type="string" | |
* ), | |
* example="0567" | |
* ), | |
* @OA\Parameter( | |
* description="CAM ID of the customer", | |
* in="query", | |
* name="CAMID", | |
* required=false, | |
* @OA\Schema( | |
* type="string" | |
* ), | |
* example="0567" | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Successfully fetched results!", | |
* ), | |
* security={ | |
* {"authorization_token": {}} | |
* } | |
* ) | |
**/ | |
$app->get('/api/fetchCustomerData', function ($request, $response) { | |
$payload = $request->getQueryParams(); | |
validate($payload, [ | |
'CustID' => V::notBlank(), | |
]); | |
return $response | |
->withStatus(200) | |
->withJson( | |
$this->customerModel | |
->fetchCustomerData($payload) | |
); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* @author Ukah Ewomazino | |
* | |
* @OA\POST( | |
* path="/api/getCustomerDetails", | |
* tags={"Customer"}, | |
* description="This function returns the customer middleware data", | |
* summary="This function returns the customer middleware data", | |
* operationId="getCustomerDetails", | |
* @OA\RequestBody( | |
* required=true, | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* @OA\Property( | |
* property="CustID", | |
* description="Middlware id of the customer", | |
* type="string" | |
* ), | |
* example={"CustID": "demo1"} | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Successfully fetched details!", | |
* ), | |
* security={ | |
* {"authorization_token": {}} | |
* } | |
* ) | |
**/ | |
$app->post('/api/getCustomerDetails', function ($request, $response) { | |
validate($request, [ | |
'CustID' => V::notBlank(), | |
]); | |
if($request->getParsedBody()['CustID'] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$CustID = $request->getParsedBody()['CustID']; | |
$customerInfo = $this->customerModel->getCustomerDetails($CustID); | |
if (!$customerInfo) { | |
throw new Exception('Unable to find customer ' . $CustID); | |
} | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'successfully fetched customer info', | |
'customerInfo' => $customerInfo, | |
]); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* Get Customer Details | |
* | |
* This API endpoint retrieves customer details for a specific customer based on their CustID. | |
* | |
* @param {string} CustID - The ID of the customer to retrieve details for. | |
* | |
* @return {Object} Response - JSON response containing the customer information. | |
* | |
* @throws {Error} 401 - Unauthorized: If the request is not authorized, i.e., the user is not an admin or not authenticated. | |
* @throws {Error} 404 - Not Found: If the customer with the specified CustID is not found. | |
* @throws {Error} 500 - Internal Server Error: If an unexpected error occurs while retrieving customer details. | |
* | |
* @OA\Post( | |
* path="/api/getCustomerDetails_", | |
* tags={"Customer"}, | |
* summary="Get Customer Details", | |
* operationId="getCustomerDetails", | |
* security={{ "BearerAuth": {} }}, | |
* @OA\RequestBody( | |
* required=true, | |
* @OA\JsonContent( | |
* @OA\Property(property="CustID", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Successful operation", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string"), | |
* @OA\Property(property="customerInfo", type="object") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=404, | |
* description="Not Found", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->post('/api/getCustomerDetails_', function ($request, $response) { | |
validate($request, [ | |
'CustID' => V::notBlank(), | |
]); | |
$CustID = $request->getParsedBody()['CustID']; | |
$customerInfo = $this->customerModel->getCustomerDetails($CustID); | |
if (!$customerInfo) { | |
throw new Exception('Unable to find customer ' . $CustID); | |
} | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'successfully fetched customer info', | |
'customerInfo' => $customerInfo, | |
]); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
/** | |
* @author [email protected] | |
* | |
* @OA\GET( | |
* path="/api/customer/bank-details", | |
* tags={"Customer"}, | |
* description="This function returns the customer bank details", | |
* summary="This function returns the customer bank details", | |
* operationId="getCustomerBankDetails", | |
* @OA\Parameter( | |
* description="CustID", | |
* in="query", | |
* name="CustID", | |
* required=true, | |
* @OA\Schema( | |
* type="string" | |
* ), | |
* example="DEMO1" | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Successfully fetched Customr Bank details!", | |
* ), | |
* security={ | |
* {"authorization_token": {}} | |
* } | |
* ) | |
**/ | |
$app->get('/api/customer/bank-details', function ($request, $response) { | |
validate($request, [ | |
'CustID' => V::notBlank(), | |
]); | |
if($request->getQueryParams()['CustID'] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$CustID = $request->getQueryParams()['CustID']; | |
$customerBankInfo = $this->customerModel->getCustomerBankDetails($CustID); | |
if (!$customerBankInfo) { | |
throw new Exception('Unable to find customer ' . $CustID); | |
} | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'successfully fetched customer bank details', | |
'customerBankInfo' => $customerBankInfo, | |
]); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
$app->get('/api/customer/getCustomerBankDetails', function ($request, $response) { | |
validate($request, [ | |
'CustID' => V::notBlank(), | |
]); | |
/* if($request->getQueryParams()['CustID'] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} */ | |
$CustID = $request->getQueryParams()['CustID']; | |
$customerBankInfo = $this->customerModel->getCustomerBankDetails($CustID); | |
if (!$customerBankInfo) { | |
throw new Exception('Unable to find customer ' . $CustID); | |
} | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'successfully fetched customer bank details', | |
'customerBankInfo' => $customerBankInfo, | |
]); | |
}); | |
// ->add(new Authorization()) | |
// ->add(new auth()); | |
/**create feedback submission | |
* @author Tayo | |
* | |
* @OA\POST( | |
* path="/api/customer/feedback", | |
* tags={"Customer"}, | |
* description="This function submits users feedback during logout", | |
* summary="This function submits users feedback during logout", | |
* operationId="submitFeedback", | |
* @OA\Response( | |
* response=200, | |
* description="Feedback successfully submitted", | |
* ), | |
* security={ | |
* {"authorization_token": {}} | |
* } | |
* ) | |
**/ | |
$app->post('/api/customer/feedback', function ($request, $response) { | |
validate($request, [ | |
'rating' => V::notBlank(), | |
'feedback' => V::optional(v::stringType()), | |
'CustID' => V::notBlank(), | |
]); | |
$CustID = $request->getAttribute('ID'); | |
//var_dump("cust id is ". $CustID); | |
$emailAddress = $request->getAttribute('email'); | |
$phoneNumber = $request->getAttribute('phone'); | |
$rating = $request->getParsedBody()['rating'] ?? "N/A"; | |
$fullName = str_replace(",","",$request->getAttribute('name')); | |
$feedback = $request->getParsedBody()['feedback'] ?? "N/A"; | |
$submitFeedback = $this->customerModel->submitFeedbackRequest($CustID,$emailAddress,$phoneNumber,$rating,$fullName,$feedback); | |
return $response | |
->withStatus($submitFeedback ["code"] ?? 200) | |
->withJson($submitFeedback); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
//send OTP modified by Tayo | |
/** | |
* @author [email protected] | |
* | |
* @OA\GET( | |
* path="/api/customer/send-otp", | |
* tags={"Customer"}, | |
* description="This function sends otp to the customer for withdrawal", | |
* summary="This function sends otp to the customer for withdrawal", | |
* operationId="sendOTPtoCustomer", | |
* @OA\Response( | |
* response=200, | |
* description="OTP successfully sent to your email", | |
* ), | |
* security={ | |
* {"authorization_token": {}} | |
* } | |
* ) | |
**/ | |
$app->post('/api/customer/send-otp', function ($request, $response) { | |
$CustID = $request->getAttribute('ID'); | |
$email = $request->getAttribute('email'); | |
$fullName = str_replace(",","",$request->getAttribute('name')); | |
$phoneNumber = $request->getAttribute('phone'); | |
$otp = mt_rand(100000, 999999); | |
$payload = $request->getParsedBody(); | |
$createOTP = $this->customerModel->createOTPRequest($fullName, $CustID,$email,$otp,$phoneNumber, $payload['bizFrom'], $payload); | |
return $response | |
->withStatus(200) | |
->withJson($createOTP); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
$app->post('/api/customer/send-otp-unauth', function ($request, $response) { | |
// Assuming 'ID', 'email', 'name', and 'phone' are passed in the request body | |
$payload = $request->getParsedBody(); | |
validate($request, [ | |
'CustID' => V::notBlank(), | |
'email' => V::notBlank(), | |
'name' => V::notBlank(), | |
'phone' => V::notBlank(), | |
]); | |
$CustID = $payload['CustID']; | |
$email = $payload['email']; | |
$fullName = str_replace(",", "", $payload['name']); | |
$phoneNumber = $payload['phone']; | |
$otp = mt_rand(100000, 999999); | |
$createOTP = $this->customerModel->createOTPRequest($fullName, $CustID, $email, $otp, $phoneNumber, $payload['bizFrom'], $payload); | |
return $response | |
->withStatus(200) | |
->withJson($createOTP); | |
}); | |
/** | |
* Send Admin OTP | |
* | |
* This API endpoint sends an OTP (One-Time Password) to the customer's phone number for admin verification purposes. | |
* | |
* @param {string} fullName - The full name of the customer. | |
* @param {string} phoneNumber - The phone number of the customer. | |
* @param {string} CustID - The ID of the customer. | |
* @param {string} emailAddress - The email address of the customer. | |
* @param {string} admin - The admin details for verification. | |
* @param {string} bizFrom - The business information. | |
* @param {string} transactionType - The type of transaction. | |
* | |
* @return {Object} Response - JSON response containing the result of the OTP request. | |
* | |
* @throws {Error} 400 - Bad Request: If any of the required parameters are missing or have invalid data types. | |
* @throws {Error} 401 - Unauthorized: If the request is not authorized, i.e., the user does not have admin privileges or is not authenticated. | |
* @throws {Error} 500 - Internal Server Error: If an unexpected error occurs while processing the OTP request. | |
* | |
* @OA\Post( | |
* path="/api/customer/send-admin-otp", | |
* tags={"Customer"}, | |
* summary="Send Admin OTP", | |
* operationId="sendAdminOTP", | |
* security={{ "BearerAuth": {} }}, | |
* @OA\RequestBody( | |
* required=true, | |
* @OA\JsonContent( | |
* @OA\Property(property="fullName", type="string"), | |
* @OA\Property(property="phoneNumber", type="string"), | |
* @OA\Property(property="CustID", type="string"), | |
* @OA\Property(property="emailAddress", type="string"), | |
* @OA\Property(property="admin", type="string"), | |
* @OA\Property(property="bizFrom", type="string"), | |
* @OA\Property(property="transactionType", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Successful operation", | |
* @OA\JsonContent( | |
* @OA\Property(property="result", type="string"), | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->post('/api/customer/send-admin-otp', function ($request, $response) { | |
validate($request, [ | |
'fullName' => V::notBlank()->stringType(), | |
'phoneNumber' => V::notBlank()->stringType(), | |
'CustID' => V::notBlank()->stringType(), | |
'emailAddress' => V::notBlank()->stringType(), | |
'admin' => V::notBlank()->stringType(), | |
'bizFrom' => V::notBlank()->stringType(), | |
'transactionType' => V::notBlank()->stringType(), | |
]); | |
$payload = $request->getParsedBody(); | |
$otp = mt_rand(100000, 999999); | |
$payload = $request->getParsedBody(); | |
$createOTP = $this->customerModel->createAdminOTPRequest(str_replace(",","",$payload['fullName']), $payload['CustID'],$payload['emailAddress'],$otp,$payload['phoneNumber'], $payload['bizFrom'], $payload); | |
return $response | |
->withStatus(200) | |
->withJson($createOTP); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
/** | |
* @author [email protected] | |
* | |
* @OA\GET( | |
* path="/api/customer/resend-otp", | |
* tags={"Customer"}, | |
* description="This function resends otp to the customer for withdrawal", | |
* summary="This function resends otp to the customer for withdrawal", | |
* operationId="resendOTPtoCustomer", | |
* @OA\Response( | |
* response=200, | |
* description="OTP successfully resent", | |
* ), | |
* security={ | |
* {"authorization_token": {}} | |
* } | |
* ) | |
**/ | |
$app->post('/api/customer/resend-otp', function ($request, $response) { | |
$CustID = $request->getAttribute('ID'); | |
$email = $request->getAttribute('email'); | |
$fullName = str_replace(",","",$request->getAttribute('name')); | |
$phoneNumber = $request->getAttribute('phone'); | |
$otp = mt_rand(100000, 999999); | |
$payload = $request->getParsedBody(); | |
$createOTP = $this->customerModel->createOTPRequest($fullName, $CustID,$email,$otp,$phoneNumber, $payload['bizFrom'], $payload); | |
return $response | |
->withStatus(200) | |
->withJson($createOTP); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
$app->post('/api/customer/request-account-deletion', function ($request, $response) { | |
validate($request, [ | |
'otp' => V::notBlank() | |
]); | |
$CustID = $request->getAttribute('ID'); | |
$clientName = str_replace(",","",$request->getAttribute('name')); | |
$email = $request->getAttribute('emailAddress'); | |
$otp = $request->getParsedBody()['otp']; //temporarily changed from query params by Tayo | |
$verifyOTP = $this->customerModel->verifyOTPRequest($CustID,$email,$otp); | |
if($verifyOTP['code'] != 200) | |
{ | |
return $response | |
->withStatus($verifyOTP['code']) | |
->withJson( ['message' => $verifyOTP['message'], | |
'data' => null | |
]); | |
} | |
$processAccountDeletion = $this->customerModel->requestAccountDeletion($CustID,$email,$clientName); | |
return $response | |
->withStatus($processAccountDeletion['code']) | |
->withJson( ['message' => $processAccountDeletion['message'], | |
'data' => null]); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
$app->post('/api/customer/request-account-deletion-unauth', function ($request, $response) { | |
validate($request, [ | |
'otp' => V::notBlank(), | |
'email' => V::notBlank(), | |
'CustID' => V::notBlank(), | |
'name' => V::notBlank() | |
// Add more validation as necessary | |
]); | |
// Retrieve data directly from the request body | |
$data = $request->getParsedBody(); | |
$CustID = $data['CustID']; | |
$clientName = str_replace(",", "", $data['name'] ?? ''); // Fallback to empty string if not provided | |
$email = $data['email']; | |
$otp = $data['otp']; | |
$verifyOTP = $this->customerModel->verifyOTPRequest($CustID, $email, $otp); | |
if ($verifyOTP['code'] != 200) { | |
return $response | |
->withStatus($verifyOTP['code']) | |
->withJson(['message' => $verifyOTP['message'], | |
'data' => null | |
]); | |
} | |
$processAccountDeletion = $this->customerModel->requestAccountDeletion($CustID, $email, $clientName); | |
return $response | |
->withStatus($processAccountDeletion['code']) | |
->withJson(['message' => $processAccountDeletion['message'], | |
'data' => null]); | |
}); | |
/** | |
* @author [email protected] | |
* | |
* @OA\GET( | |
* path="/api/customer/verify-otp", | |
* tags={"Customer"}, | |
* description="This function used to verify the otp sent to the customer for withdrawal", | |
* summary="This function used to verify the otp sent to the customer for withdrawal", | |
* operationId="verifyOTPSentToCustomer", | |
* @OA\Parameter( | |
* description="otp", | |
* in="query", | |
* name="otp", | |
* required=true, | |
* @OA\Schema( | |
* type="string" | |
* ), | |
* example="8891" | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="OTP verified", | |
* ), | |
* security={ | |
* {"authorization_token": {}} | |
* } | |
* ) | |
**/ | |
$app->post('/api/customer/verify-otp', function ($request, $response) { | |
validate($request, [ | |
'otp' => V::notBlank(), | |
// 'CustID' => V::notBlank(), | |
// 'emailAddress' => V::notBlank(), | |
]); | |
$CustID = $request->getAttribute('ID'); | |
$email = $request->getAttribute('emailAddress'); | |
$otp = $request->getParsedBody()['otp']; //temporarily changed from query params by Tayo | |
// var_dump($CustID); | |
// var_dump($email); | |
// var_dump($otp); | |
$verifyOTP = $this->customerModel->verifyOTPRequest($CustID,$email,$otp ); | |
return $response | |
->withStatus($verifyOTP ["code"] ?? 200) | |
->withJson($verifyOTP); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
$app->post('/api/customer/verify-otp_', function ($request, $response) { | |
validate($request, [ | |
'otp' => V::notBlank(), | |
'CustID' => V::notBlank(), | |
'emailAddress' => V::notBlank(), | |
]); | |
$CustID = $request->getParsedBody()['CustID']; | |
$email = $request->getParsedBody()['emailAddress']; | |
$otp = $request->getParsedBody()['otp']; //temporarily changed from query params by Tayo | |
// var_dump($CustID); | |
// var_dump($email); | |
// var_dump($otp); | |
$verifyOTP = $this->customerModel->verifyOTPRequest($CustID,$email,$otp ); | |
return $response | |
->withStatus($verifyOTP ["code"] ?? 200) | |
->withJson($verifyOTP); | |
}); | |
/** | |
* Verify Admin OTP | |
* | |
* This API endpoint verifies the provided OTP (One-Time Password) for admin verification purposes. | |
* | |
* @param {string} otp - The OTP (One-Time Password) provided by the customer for verification. | |
* @param {string} CustID - The ID of the customer for whom the OTP is being verified. | |
* @param {string} emailAddress - The email address of the customer for verification. | |
* | |
* @return {Object} Response - JSON response containing the result of the OTP verification. | |
* | |
* @throws {Error} 400 - Bad Request: If any of the required parameters are missing or have invalid data types. | |
* @throws {Error} 401 - Unauthorized: If the request is not authorized, i.e., the user does not have admin privileges or is not authenticated. | |
* @throws {Error} 500 - Internal Server Error: If an unexpected error occurs while verifying the OTP. | |
* | |
* @OA\Post( | |
* path="/api/customer/verify-admin-otp", | |
* tags={"Customer"}, | |
* summary="Verify Admin OTP", | |
* operationId="verifyAdminOTP", | |
* security={{ "BearerAuth": {} }}, | |
* @OA\RequestBody( | |
* required=true, | |
* @OA\JsonContent( | |
* @OA\Property(property="otp", type="string"), | |
* @OA\Property(property="CustID", type="string"), | |
* @OA\Property(property="emailAddress", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Successful operation", | |
* @OA\JsonContent( | |
* @OA\Property(property="result", type="string"), | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->post('/api/customer/verify-admin-otp', function ($request, $response) { | |
validate($request, [ | |
'otp' => V::notBlank(), | |
'CustID' => V::notBlank(), | |
'emailAddress' => V::notBlank(), | |
]); | |
$CustID = $request->getParsedBody()['CustID']; | |
$email = $request->getParsedBody()['emailAddress']; | |
$otp = $request->getParsedBody()['otp']; | |
$verifyOTP = $this->customerModel->verifyOTPRequest($CustID,$email,$otp ); | |
return $response | |
->withStatus($verifyOTP ["code"] ?? 200) | |
->withJson($verifyOTP); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
//end of send OTP modified by Tayo | |
/** | |
* @author Ukah Ewomazino | |
* | |
* @OA\POST( | |
* path="/api/searchForCustomers", | |
* tags={"Customer"}, | |
* description="This function returns all the customers the match the search criteria on the middleware", | |
* summary="This function returns the all the customers the match the search criteria on the middleware", | |
* operationId="searchForCustomers", | |
* @OA\RequestBody( | |
* required=true, | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* @OA\Property( | |
* property="query", | |
* description="Search query/ username/ names ", | |
* type="string" | |
* ), | |
* example={"query": "dem"} | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Successfully fetched details!", | |
* ), | |
* security={ | |
* {"authorization_token": {}} | |
* } | |
* ) | |
**/ | |
/* $app->post('/api/searchForCustomers', function ($request, $response) { | |
$isAgency= false; | |
// validate request | |
// validate($request, [ | |
// 'query' => V::notBlank(), | |
// ]); | |
$query = $request->getParsedBody()['query'] ?? null; | |
$IAOfficerGroups = $request->getAttribute('groups'); | |
$IAOfficerName = $request->getAttribute('name'); | |
$map = [ | |
HNI_ABUJA_INFOWARE => HNI_ABUJA_LDAP, //infoware => ldap | |
HNI_LAGOS_INFOWARE => HNI_LAGOS_LDAP, //infoware => ldap | |
MASS_AFF_LAGOS_INFOWARE => MASS_AFF_LAGOS_LDAP, //infoware => ldap | |
MASS_AFF_ABUJA_INFOWARE => MASS_AFF_ABUJA_LDAP, //infoware => lda | |
CORPORATE_INFOWARE => CORPORATE_LDAP, //infoware => lda | |
LINE_MANAGER_APPROVAL => LINE_MANAGER_APPROVAL, | |
DIVISIONAL_MANAGER_APPROVAL => DIVISIONAL_MANAGER_APPROVAL, | |
FUND_MANAGER_APPROVAL => FUND_MANAGER_APPROVAL, | |
PAYMENT_PROCESSOR_MANAGER_APPROVAL => PAYMENT_PROCESSOR_MANAGER_APPROVAL | |
]; | |
$map_ = [//infowrae => ldap | |
$request->getAttribute('name') => $request->getAttribute('name') | |
]; | |
$IAOfficerGroups_ = []; | |
foreach($IAOfficerGroups as $key => $value){ //check if logged in user is an Agent | |
if($value == AGENCY_ACCESS){ | |
$IAOfficerGroups_ = ["Agency Access"]; | |
$isAgency = true; | |
break; | |
} | |
} | |
if($isAgency == true){ | |
$customers = array_filter($this->customerModel->searchForCustomers($query), function ($customer) use ($map_, $IAOfficerName) { | |
if (array_key_exists($customer['Agency Account'], $map_)) { | |
error_log($customer['Agency Account']); | |
return in_array($map_[$customer['Agency Account']], [$IAOfficerName]) ; | |
} | |
}); | |
}else{ | |
$customers = array_filter($this->customerModel->searchForCustomers($query), function ($customer) use ($map, $IAOfficerGroups, $IAOfficerName) { | |
if (array_key_exists($customer['Category'], $map)) { | |
return in_array($map[$customer['Category']], $IAOfficerGroups); | |
} | |
}); | |
} | |
if (count($customers) <= 0) { | |
throw new Exception('Unable to find customers for the query ' . $query); | |
} | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'successfully fetched customers', | |
'customers' => array_values($customers), | |
]); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); */ | |
$app->post('/api/searchForCustomers_', function ($request, $response) { | |
$isAgency= false; | |
// validate request | |
// validate($request, [ | |
// 'query' => V::notBlank(), | |
// ]); | |
$query = $request->getParsedBody()['query'] ?? null; | |
$IAOfficerGroups = $request->getAttribute('groups'); | |
$IAOfficerName = $request->getAttribute('name'); | |
$map = [ | |
HNI_ABUJA_INFOWARE => HNI_ABUJA_LDAP, //infoware => ldap | |
HNI_LAGOS_INFOWARE => HNI_LAGOS_LDAP, //infoware => ldap | |
MASS_AFF_LAGOS_INFOWARE => MASS_AFF_LAGOS_LDAP, //infoware => ldap | |
MASS_AFF_ABUJA_INFOWARE => MASS_AFF_ABUJA_LDAP, //infoware => lda | |
CORPORATE_INFOWARE => CORPORATE_LDAP, //infoware => lda | |
LINE_MANAGER_APPROVAL => LINE_MANAGER_APPROVAL, | |
DIVISIONAL_MANAGER_APPROVAL => DIVISIONAL_MANAGER_APPROVAL, | |
FUND_MANAGER_APPROVAL => FUND_MANAGER_APPROVAL, | |
PAYMENT_PROCESSOR_MANAGER_APPROVAL => PAYMENT_PROCESSOR_MANAGER_APPROVAL | |
]; | |
$map_ = [//infowrae => ldap | |
$request->getAttribute('name') => $request->getAttribute('name') | |
]; | |
$IAOfficerGroups_ = []; | |
foreach($IAOfficerGroups as $key => $value){ //check if logged in user is an Agent | |
//var_dump($value); | |
if($value == AGENCY_ACCESS){ | |
$IAOfficerGroups_ = ["Agency Access"]; | |
$isAgency = true; | |
break; | |
} | |
} | |
if (in_array("Institutional Sales", $IAOfficerGroups) || in_array("Portal Access Operations", $IAOfficerGroups)) { | |
$customers = $this->customerModel->searchForCustomers($query); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'successfully fetched customers', | |
'customers' => array_values($customers), | |
]); | |
} | |
elseif($isAgency == true){ | |
$customers = array_filter($this->customerModel->searchForCustomers($query), function ($customer) use ($map_, $IAOfficerName) { | |
if (array_key_exists($customer['Agency Account'], $map_)) { | |
error_log($customer['Agency Account']); | |
return in_array($map_[$customer['Agency Account']], [$IAOfficerName]) ; | |
} | |
}); | |
}else{ | |
//var_dump("Dump categoreis from customer model "); | |
$customerz = $this->customerModel->searchForCustomers($query); | |
$customers = array_filter($customerz, function ($customer) use ($map, $IAOfficerGroups, $IAOfficerName) { | |
//var_dump($customer['Category']); | |
if (array_key_exists($customer['Category'], $map)) { | |
return in_array($map[$customer['Category']], $IAOfficerGroups); | |
} | |
}); | |
} | |
if (count($customers) <= 0) { | |
throw new Exception('Unable to find customers for the query ' . $query); | |
} | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'successfully fetched customers', | |
'customers' => array_values($customers), | |
]); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
$app->post('/api/searchForCustomers', function ($request, $response) { | |
$isAgency = false; | |
$query = $request->getParsedBody()['query'] ?? null; | |
$IAOfficerGroups = $request->getAttribute('groups'); | |
$IAOfficerName = $request->getAttribute('name'); | |
$map = [ | |
HNI_ABUJA_INFOWARE => HNI_ABUJA_LDAP, //infoware => ldap | |
HNI_LAGOS_INFOWARE => HNI_LAGOS_LDAP, //infoware => ldap | |
MASS_AFF_LAGOS_INFOWARE => MASS_AFF_LAGOS_LDAP, //infoware => ldap | |
MASS_AFF_ABUJA_INFOWARE => MASS_AFF_ABUJA_LDAP, //infoware => ldap | |
CORPORATE_INFOWARE => CORPORATE_LDAP, //infoware => ldap | |
LINE_MANAGER_APPROVAL => LINE_MANAGER_APPROVAL, | |
DIVISIONAL_MANAGER_APPROVAL => DIVISIONAL_MANAGER_APPROVAL, | |
FUND_MANAGER_APPROVAL => FUND_MANAGER_APPROVAL, | |
PAYMENT_PROCESSOR_MANAGER_APPROVAL => PAYMENT_PROCESSOR_MANAGER_APPROVAL | |
]; | |
$map_ = [//infoware => ldap | |
$request->getAttribute('name') => $request->getAttribute('name') | |
]; | |
$IAOfficerGroups_ = []; | |
$customersFromSource = $this->customerModel->searchForCustomers($query); | |
foreach ($IAOfficerGroups as $key => $value) { //check if logged in user is an Agent | |
if ($value == AGENCY_ACCESS) { | |
$IAOfficerGroups_ = ["Agency Access"]; | |
$isAgency = true; | |
break; | |
} | |
} | |
$staffExceptions = $this->customerModel->getIAExceptions($IAOfficerName); | |
function filterStaff($customers, $staffExceptions) { | |
return array_filter($customers, function ($customer) use ($staffExceptions) { | |
return in_array($customer['customerId'], $staffExceptions); | |
}); | |
} | |
if (in_array("Institutional Sales", $IAOfficerGroups) || in_array("Portal Access Operations", $IAOfficerGroups)) { | |
$customers = $this->customerModel->searchForCustomers($query); | |
} elseif ($isAgency) { | |
$customers = array_filter($this->customerModel->searchForCustomers($query), function ($customer) use ($map_, $IAOfficerName) { | |
return array_key_exists($customer['Agency Account'], $map_) && in_array($map_[$customer['Agency Account']], [$IAOfficerName]); | |
}); | |
} else { | |
$customerz = $this->customerModel->searchForCustomers($query); | |
$customers = array_filter($customerz, function ($customer) use ($map, $IAOfficerGroups) { | |
return array_key_exists($customer['Category'], $map) && in_array($map[$customer['Category']], $IAOfficerGroups); | |
}); | |
} | |
// Apply the staff filter | |
$staffFilteredCustomers = filterStaff($customersFromSource, $staffExceptions); | |
$customers = array_merge($customers, $staffFilteredCustomers); | |
if (count($customers) <= 0) { | |
throw new Exception('Unable to find customers for the query ' . $query); | |
} | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'successfully fetched customers', | |
'customers' => array_values($customers), | |
]); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
/** | |
* | |
* @author ewomaukah <[email protected]> | |
* This endpoint is for authentication | |
* | |
* @OA\POST( | |
* path="/api/auth", | |
* tags={"Auth"}, | |
* description="This endpoint is for authentication", | |
* summary="This endpoint is for authentication", | |
* operationId="auth", | |
* @OA\RequestBody( | |
* required=true, | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* @OA\Property( | |
* property="secretkey", | |
* description="secretkey to access protected", | |
* type="string" | |
* ), | |
* example={"secretkey": "csp_98765"} | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Successfull !", | |
* ), | |
* ) | |
*/ | |
$app->post('/api/auth', function ($request, $response) { | |
$payload = $request->getParsedBody(); | |
$secretKey = $_ENV['DEFAULT_AUTH_KEY']; | |
if ($secretKey === $payload['secretkey']) { | |
$token = JWTToken::generate($secretKey); | |
} else { | |
return $response | |
->withStatus(401) | |
->withJson([ | |
'message' => 'wrong secret!', | |
], 400); | |
} | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'secret ok !', | |
'token' => $token, | |
], 200); | |
}); | |
// ->add(new Authorization()) | |
// ->add(new auth()); | |
/** | |
* | |
* @author ewomaukah <[email protected]> | |
* This endpoint generates report for clients with birthdays in the coming week | |
* | |
* @OA\POST( | |
* path="/api/generateClientsBirthdayReport", | |
* tags={"Customer"}, | |
* description="This endpoint generates report for clients with birthdays in the coming week", | |
* summary="This endpoint generates report for clients with birthdays in the coming week", | |
* operationId="generateClientsBirthdayReport", | |
* @OA\RequestBody( | |
* required=true, | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* @OA\Property( | |
* property="startDate", | |
* description="start date to consider", | |
* type="string" | |
* ), | |
* @OA\Property( | |
* property="endDate", | |
* description="end date to consider", | |
* type="string" | |
* ), | |
* @OA\Property( | |
* property="triggerMail", | |
* description="Send mail to sales containing the list of bithday celebrants", | |
* type="boolean" | |
* ), | |
* example={"startDate": "2020-02-17", "endDate": "2020-02-17", "triggerMail": false} | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Successfully generated report !", | |
* ), | |
* ) | |
*/ | |
$app->post('/api/clientsBirthdayReports', function ($request, $response) { | |
$payload = $request->getParsedBody(); | |
// begining of the week (monday) | |
$startDate = $payload['startDate'] ?? (new DateTime('next monday'))->format('Y-m-d'); | |
// $startDate = $payload['startDate'] ?? Carbon::now()->addDays(10)->format('Y-m-d'); | |
// end of the week (monday) | |
$endDate = $payload['endDate'] ?? Carbon::parse($startDate)->addDays(6)->format('Y-m-d'); | |
// iF not set trigger, default to true | |
if (!isset($payload['triggerMail'])) { | |
$payload['triggerMail'] = true; | |
} | |
$customers = formatIWRes( | |
container('IWSRequest')->birthDay('CP_0014', $startDate, $endDate, MIDDLEWARE_DB_NAME) | |
)['data']; | |
/* $customers = formatIWRes( | |
container('IWSRequest')->PGetData('CP_0008', MIDDLEWARE_DB_NAME) | |
)['data']; */ | |
//var_dump($customers); | |
//$payload['BirthDay'] = $payload['Birthday']; | |
//$customers = getUpcomingBirthdays($startDate, $endDate, $customers); | |
function date_compare($a, $b) | |
{ | |
$t1 = strtotime($a['BirthDay']); | |
$t2 = strtotime($b['BirthDay']); | |
return $t1 - $t2; | |
} | |
usort($customers, 'date_compare'); | |
// add to text msg queue -- Commendted by Tayo on the 16th of July 2021 | |
/* if (!$payload['triggerMail']) { | |
foreach ($customers as $customer) { | |
$names = explode(" ", $customer['Name'] ?? $customer['Name2' ?? '']); | |
addBirthdayNotificationToQueue([ | |
"message" => getbirthdayTxt([ | |
'first_name' => $names[1], | |
'last_name' => $names[0], | |
]), | |
"sender_name" => 'CardinalSTN', | |
"recipients" => $customer['Phone1'], | |
"forcednd" => 1 | |
]); | |
} | |
} */ | |
//var_dump($customers); | |
// send mail | |
if ($payload['triggerMail']) { | |
$this->customerModel->generateBirthdayReport([ | |
"customers" => array_values($customers), | |
"startDate" => $startDate, | |
"endDate" => $endDate, | |
]); | |
} | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'Birthday Reports Successfully sent to IAs' | |
]); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* Clients Birthday Reports | |
* | |
* This API endpoint generates birthday reports for clients within a specified date range and sends them to IAs (Independent Agents). | |
* | |
* @param {string} startDate - The start date of the date range for the birthday reports. (Optional) | |
* @param {string} endDate - The end date of the date range for the birthday reports. (Optional) | |
* @param {boolean} triggerMail - If set to true, triggers the email to send the birthday reports. Default is true if not provided. (Optional) | |
* | |
* @return {Object} Response - JSON response indicating the success of the birthday report generation and email triggering. | |
* | |
* @throws {Error} 400 - Bad Request: If the provided date range is invalid or the provided parameters have invalid data types. | |
* @throws {Error} 500 - Internal Server Error: If an unexpected error occurs while generating the birthday reports or sending the email. | |
* | |
* @OA\Get( | |
* path="/api/clientsBirthdayReports", | |
* tags={"Customer"}, | |
* summary="Clients Birthday Reports", | |
* operationId="clientsBirthdayReports", | |
* @OA\Parameter( | |
* name="startDate", | |
* in="query", | |
* description="The start date of the date range for the birthday reports. Format: YYYY-MM-DD.", | |
* required=false, | |
* @OA\Schema(type="string", format="date") | |
* ), | |
* @OA\Parameter( | |
* name="endDate", | |
* in="query", | |
* description="The end date of the date range for the birthday reports. Format: YYYY-MM-DD.", | |
* required=false, | |
* @OA\Schema(type="string", format="date") | |
* ), | |
* @OA\Parameter( | |
* name="triggerMail", | |
* in="query", | |
* description="If set to true, triggers the email to send the birthday reports. Default is true if not provided.", | |
* required=false, | |
* @OA\Schema(type="boolean") | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Successful operation", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/clientsBirthdayReports', function ($request, $response) { | |
$payload = $request->getQueryParams(); | |
// begining of the week (monday) | |
$startDate = $payload['startDate'] ?? (new DateTime('next monday'))->format('Y-m-d'); | |
// $startDate = $payload['startDate'] ?? Carbon::now()->addDays(10)->format('Y-m-d'); | |
// end of the week (monday) | |
$endDate = $payload['endDate'] ?? Carbon::parse($startDate)->addDays(6)->format('Y-m-d'); | |
// iF not set trigger, default to true | |
if (!isset($payload['triggerMail'])) { | |
$payload['triggerMail'] = true; | |
} | |
$customers = formatIWRes( | |
container('IWSRequest')->birthDay('CP_0014', $startDate, $endDate, MIDDLEWARE_DB_NAME) | |
)['data']; | |
function date_compare($a, $b) | |
{ | |
$t1 = strtotime($a['BirthDay']); | |
$t2 = strtotime($b['BirthDay']); | |
return $t1 - $t2; | |
} | |
usort($customers, 'date_compare'); | |
// send mail | |
if ($payload['triggerMail']) { | |
$this->customerModel->generateBirthdayReport([ | |
"customers" => array_values($customers), | |
"startDate" => $startDate, | |
"endDate" => $endDate, | |
]); | |
} | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'Birthday Reports Successfully sent to IAs' | |
]); | |
}); | |
// ->add(new Authorization()) | |
// ->add(new auth()); | |
/** | |
* | |
* @OA\Post( | |
* path="/api/changePassword", | |
* tags={"Customer"}, | |
* description="This endpoint is used for changing a customer's password", | |
* summary="This endpoint is used to change a customer's password", | |
* operationId="changePassword", | |
* @OA\RequestBody( | |
* required=true, | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* @OA\Property( | |
* property="CustID", | |
* description="ID of the customer", | |
* type="string" | |
* ), | |
* @OA\Property( | |
* property="newPassword", | |
* description="New password for the customer", | |
* type="string" | |
* ), | |
* @OA\Property( | |
* property="oldPassword", | |
* description="Old password for the customer", | |
* type="string" | |
* ), | |
* example={"CustID": "DEMO1", "newPassword": "demo1", "oldPassword": "demo1"} | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Successfully changed password!" | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="username/password not supplied" | |
* ), | |
* @OA\Response( | |
* response=422, | |
* description="Invalid Credentials" | |
* ), | |
* security={ | |
* {"authorization_token": {}} | |
* } | |
* ) | |
* | |
*/ | |
$app->post('/api/changePassword', function ($request, $response) { | |
$uppercase = v::regex('/[A-Z]/'); | |
$number = v::regex('/[0-9]/'); | |
$special = v::regex('/[^a-zA-Z\d]/'); | |
$length = v::length(6, null); | |
$passwordValidator = v::allOf($uppercase, $number, $special, $length); | |
validate($request, [ | |
'CustID' => V::notBlank(), | |
'newPassword' => $passwordValidator, | |
'oldPassword' => V::notBlank(), | |
]); | |
if($request->getParsedBody()['CustID'] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
return $response | |
->withStatus(200) | |
->withJson( | |
$this->customerModel | |
->resetPassword( | |
$request->getParsedBody()['CustID'], | |
$request->getParsedBody()['oldPassword'], | |
$request->getParsedBody()['newPassword'] | |
) | |
); | |
}) | |
->add(new Authorization()) | |
->add(new auth()) | |
->add(new RateLimitMiddleware()); | |
$app->post('/api/changePassword22', function ($request, $response) { | |
$data = retrieveCRM(); | |
$baseUrl = "https://svcs.infowarelimited.com/IWCardinalM/api/json"; | |
$session = "c96b0325-ef16-413d-99d0-8d4ded040649"; // Replace with your actual session token | |
$attributeName = "CRMID"; | |
foreach ($data as $entry) { | |
$CustID = $entry['CustAID']; | |
$CRMID = $entry['CRMID']; | |
// Construct the API endpoint URL | |
$url = "{$baseUrl}/CustInfo/{$session}/{$CustID}?AttributeName={$attributeName}&AttributeValue={$CRMID}"; | |
// Initialize cURL session | |
$curl = curl_init($url); | |
// Set cURL options | |
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); | |
curl_setopt($curl, CURLOPT_HEADER, false); | |
// Execute cURL session | |
$response = curl_exec($curl); | |
$httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE); | |
// Check if the request was successful | |
if ($httpCode == 200) { | |
echo "Success: " . $response . PHP_EOL; | |
} else { | |
echo "Failed to fetch data for CustID: {$CustID}" . PHP_EOL; | |
} | |
// Close cURL session | |
curl_close($curl); | |
} | |
}); | |
/** | |
* | |
* @OA\Post( | |
* path="/api/transferRequest", | |
* tags={"Customer"}, | |
* description="This endpoint is used for making a 'transfer funds' request", | |
* summary="This endpoint is used for making a 'transfer funds' request", | |
* operationId="transferRequest", | |
* @OA\RequestBody( | |
* required=true, | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* @OA\Property( | |
* property="cashAccountSrc", | |
* description="Source cash account", | |
* type="string" | |
* ), | |
* @OA\Property( | |
* property="cashAccountDest", | |
* description="Destination cash account", | |
* type="string" | |
* ), | |
* @OA\Property( | |
* property="amount", | |
* description="Amount", | |
* type="string" | |
* ), | |
* @OA\Property( | |
* property="note", | |
* description="notes/description", | |
* type="string" | |
* ), | |
* @OA\Property( | |
* property="ledgerType", | |
* description="The currency", | |
* type="string" | |
* ), | |
* example={ | |
* "cashAccountSrc": "STB Cash Account (0098775656)", | |
* "cashAccountDest": "FI Cash Account (008766565)", | |
* "amount": "2000", | |
* "ledgerType": "NGN", | |
* "note": "Transfer to my other cash account" | |
* } | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Successfully sent request!" | |
* ), | |
* @OA\Response( | |
* response=422, | |
* description="Invalid request" | |
* ), | |
* security={ | |
* {"authorization_token": {}} | |
* } | |
* ) | |
* | |
*/ | |
$app->post('/api/transferRequest', function ($request, $response) { | |
validate($request, [ | |
'cashAccountSrc' => V::notBlank(), | |
'cashAccountDest' => V::notBlank(), | |
'amount' => V::notBlank(), | |
'note' => V::notBlank(), | |
'ledgerType' => V::notBlank(), | |
]); | |
$payload = array_merge( | |
$request->getParsedBody(), | |
[ | |
'CustID' => $request->getAttribute('ID'), | |
'emailAddress' => $request->getAttribute('email'), | |
'fullName' => str_replace(",","",$request->getAttribute('name')), | |
'phoneNumber' => $request->getAttribute('phone'), | |
] | |
); | |
$this->customerModel->transferRequest($payload); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'Your request has been received', | |
]); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* | |
* @OA\Post( | |
* path="/api/withdrawRequest", | |
* tags={"Customer"}, | |
* description="This endpoint is used for making a withdraw request", | |
* summary="This endpoint is used for making a withdraw request to a specified bank account", | |
* operationId="withdrawRequest", | |
* @OA\RequestBody( | |
* required=true, | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* @OA\Property( | |
* property="cashAccount", | |
* description="Target Cash account", | |
* type="string" | |
* ), | |
* @OA\Property( | |
* property="ledgerType", | |
* description="The currency", | |
* type="string" | |
* ), | |
* @OA\Property( | |
* property="amount", | |
* description="Amount", | |
* type="string" | |
* ), | |
* example={ | |
* "cashAccount": "STB Cash Account (0098775656)", | |
* "ledgerType": "NGN", | |
* "amount": "2000", | |
* } | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Successfully sent request!" | |
* ), | |
* @OA\Response( | |
* response=422, | |
* description="Invalid request" | |
* ), | |
* security={ | |
* {"authorization_token": {}} | |
* } | |
* ) | |
* | |
*/ | |
$app->post('/api/withdrawRequester', function ($request, $response) { | |
validate($request, [ | |
'cashAccount' => V::notBlank(), | |
'amount' => V::notBlank(), | |
'ledgerType' => V::notBlank(), | |
]); | |
$payload = array_merge( | |
$request->getParsedBody(), | |
[ | |
'CustID' => $request->getAttribute('ID'), | |
'emailAddress' => $request->getAttribute('email'), | |
'fullName' => str_replace(",","",$request->getAttribute('name')), | |
'phoneNumber' => $request->getAttribute('phone'), | |
] | |
); | |
$this->customerModel->withdrawRequest($payload); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'Your request has been received', | |
]); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* @author ewomaukah <[email protected]> | |
* Endpoint to reset a customer's password | |
* @OA\Post( | |
* path="/api/reset", | |
* tags={"Customer"}, | |
* description="Endpoint to reset a customer's password NB: CALL THIS ENDPOINT ONLY TO RESET A CUSTOMER PASSWORD", | |
* summary="reset a customer's password", | |
* operationId="reset", | |
* @OA\RequestBody( | |
* required=true, | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* @OA\Property( | |
* property="CustAID", | |
* description="ID the customer", | |
* type="number" | |
* ), | |
* @OA\Property( | |
* property="PWDChangeRequired", | |
* description="PWDChangeRequired", | |
* type="string" | |
* ), | |
* example={"CustAID": "demo1"} | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Successfully sent reset link!" | |
* ), | |
* ) | |
* | |
**/ | |
/* $app->post('/api/reset', function ($request, $response) { | |
$status = 200; | |
$validator = $this->validator->validate($request, [ | |
'CustID' => V::notBlank(), | |
]); | |
if (!$validator->isValid()) { | |
$status = 422; | |
$result = $validator->getErrors(); | |
} else { | |
$payload = $request->getParsedBody(); | |
$newPassword = urlencode((new RandomString())->numberString(8)); | |
$res = container('IWSRequest') | |
->EBizResetPWD("CustAID={$payload['CustID']}&NewPWD={$newPassword}&PWDChangeRequired=true"); | |
$result = formatIWRes($res); | |
} | |
return $response | |
->withStatus($status) | |
->withJson($result); | |
}); */ | |
/* $app->post('/api/reset2', function ($request, $response) { | |
$status = 200; | |
$validator = $this->validator->validate($request, [ | |
'CustID' => V::notBlank(), | |
]); | |
if (!$validator->isValid()) { | |
$status = 422; | |
$result = $validator->getErrors(); | |
} else { | |
$payload = $request->getParsedBody(); //This should be ParseBody for a post request | |
$newPassword = urlencode((new RandomString())->numberString(8)); | |
$res = container('IWSRequest') | |
->EBizResetPWD("CustAID={$payload['CustID']}&NewPWD={$newPassword}&PWDChangeRequired=true"); | |
$result = formatIWRes($res); | |
} | |
return $response | |
->withStatus($status) | |
->withJson($result); | |
}); */ | |
/** | |
* Forgot Password | |
* | |
* This API endpoint initiates the password reset process for a customer by providing their CustID. | |
* | |
* @param {string} CustID - The ID of the customer who wants to reset their password. | |
* | |
* @return {Object} Response - JSON response containing the result of the password reset request. | |
* | |
* @throws {Error} 400 - Bad Request: If the CustID parameter is missing or blank. | |
* @throws {Error} 429 - Too Many Requests: If the rate limit for this endpoint is exceeded. | |
* @throws {Error} 500 - Internal Server Error: If an unexpected error occurs while processing the password reset request. | |
* | |
* @OA\Post( | |
* path="/api/forgotPassword", | |
* tags={"Customer"}, | |
* summary="Forgot Password", | |
* operationId="forgotPassword", | |
* @OA\RequestBody( | |
* required=true, | |
* @OA\JsonContent( | |
* @OA\Property(property="CustID", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Successful operation", | |
* @OA\JsonContent( | |
* @OA\Property(property="result", type="string"), | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=429, | |
* description="Too Many Requests", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->post('/api/forgotPassword', function ($request, $response) { | |
validate($request, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
]); | |
$payload = $request->getParsedBody(); | |
$result = $this->customerModel->forgotPassword($payload); | |
return $response | |
->withStatus($result["code"] ?? 200) | |
->withJson($result); | |
}) | |
->add(new RateLimitMiddleware()); | |
/** | |
* Forgot Password Verify | |
* | |
* This API endpoint verifies the provided resetHash for a customer's password reset request. | |
* | |
* @param {string} CustID - The ID of the customer who requested the password reset. | |
* @param {string} resetHash - The reset hash for verifying the password reset request. | |
* | |
* @return {Object} Response - JSON response containing the result of the reset hash verification. | |
* If successful, a redirect URL will be provided; otherwise, an error message will be returned. | |
* | |
* @throws {Error} 400 - Bad Request: If the CustID or resetHash parameter is missing or blank. | |
* @throws {Error} 500 - Internal Server Error: If an unexpected error occurs while verifying the reset hash. | |
* | |
* @OA\Post( | |
* path="/api/forgotPasswordVerify", | |
* tags={"Customer"}, | |
* summary="Forgot Password Verify", | |
* operationId="forgotPasswordVerify", | |
* @OA\RequestBody( | |
* required=true, | |
* @OA\JsonContent( | |
* @OA\Property(property="CustID", type="string"), | |
* @OA\Property(property="resetHash", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Successful operation, redirect to password reset page", | |
* @OA\JsonContent( | |
* @OA\Property(property="url", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ) | |
* ) | |
*/ | |
/***************************************************************************************************************************************************/ | |
$app->post('/api/forgotPasswordVerify', function ($request, $response) { | |
validate($request, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
'resetHash' => [ | |
'rules' => V::notBlank(), | |
'message' => 'resetHash is required' | |
], | |
]); | |
$payload = $request->getParsedBody(); | |
$result = $this->customerModel->forgotPasswordVerify($payload); | |
if($result["code"] ?? 200 == 200) | |
{ | |
return $response | |
->withStatus($result["code"] ?? 200) | |
->withRedirect($result["url"]); | |
}else{ | |
return $response | |
->withStatus($result["code"] ?? 200) | |
->withJson($result); | |
} | |
}); | |
$app->get('/api/forgotPasswordVerify', function ($request, $response) { | |
validate($request, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
'resetHash' => [ | |
'rules' => V::notBlank(), | |
'message' => 'resetHash is required' | |
], | |
]); | |
$payload = $request->getQueryParams(); | |
$result = $this->customerModel->forgotPasswordVerify($payload); | |
if($result["code"] ?? 200 == 200) | |
{ | |
return $response | |
->withStatus($result["code"] ?? 200) | |
->withRedirect($result["url"]); | |
}else{ | |
return $response | |
->withStatus($result["code"] ?? 200) | |
->withJson($result); | |
} | |
}); | |
/*************************************************************************************************************************************************************************** */ | |
/** | |
* Forgot Password Change | |
* | |
* This API endpoint allows the customer to change their password after a successful password reset request. | |
* | |
* @param {string} CustID - The ID of the customer who requested the password reset. | |
* @param {string} otp - The OTP (One-Time Password) received during the password reset process. | |
* @param {string} password - The new password set by the customer. | |
* | |
* @return {Object} Response - JSON response containing the result of the password change request. | |
* | |
* @throws {Error} 400 - Bad Request: If the CustID, otp, or password parameter is missing or blank. | |
* @throws {Error} 401 - Unauthorized: If the request is not authorized, i.e., the provided CustID is not authenticated. | |
* @throws {Error} 500 - Internal Server Error: If an unexpected error occurs while processing the password change request. | |
* | |
* @OA\Post( | |
* path="/api/forgotPasswordChange", | |
* tags={"Customer"}, | |
* summary="Forgot Password Change", | |
* operationId="forgotPasswordChange", | |
* security={{ "BearerAuth": {} }}, | |
* @OA\RequestBody( | |
* required=true, | |
* @OA\JsonContent( | |
* @OA\Property(property="CustID", type="string"), | |
* @OA\Property(property="otp", type="string"), | |
* @OA\Property(property="password", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Successful operation", | |
* @OA\JsonContent( | |
* @OA\Property(property="result", type="string"), | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->post('/api/forgotPasswordChange', function ($request, $response) { | |
$uppercase = v::regex('/[A-Z]/'); | |
$number = v::regex('/[0-9]/'); | |
$special = v::regex('/[^a-zA-Z\d]/'); | |
$length = v::length(6, null); | |
$passwordValidator = v::allOf($uppercase, $number, $special, $length); | |
validate($request, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
'otp' => [ | |
'rules' => V::notBlank(), | |
'message' => 'otp is required' | |
], | |
'password' => $passwordValidator | |
]); | |
$payload = $request->getParsedBody(); | |
$result = $this->customerModel->forgotPasswordChange($payload); | |
return $response | |
->withStatus($result["code"] ?? 200) | |
->withJson($result); | |
}); | |
/** | |
* @author ewomaukah <[email protected]> | |
* Endpoint to create new customer account | |
* @OA\Post( | |
* path="/api/createNewAccount", | |
* tags={"Customer"}, | |
* description="Endpoint to create new customer account. Pass null/nothing for blank fields", | |
* summary="create new customer account", | |
* operationId="createNewAccount", | |
* @OA\RequestBody( | |
* required=true, | |
* @OA\MediaType( | |
* mediaType="multipart/form-data", | |
* @OA\Schema( | |
* @OA\Property( | |
* property="Title", | |
* description="Customer's Title", | |
* type="string", | |
* example="dr" | |
* ), | |
* @OA\Property( | |
* property="Firstname", | |
* description="Customer's firstname", | |
* type="string", | |
* example="MazeePuntus" | |
* ), | |
* @OA\Property( | |
* property="Surname", | |
* description="Customer's Surname", | |
* type="string", | |
* example="Ukahbiala" | |
* ), | |
* @OA\Property( | |
* property="Othernames", | |
* description="Customer's other names", | |
* type="string", | |
* example="solomon" | |
* ), | |
* @OA\Property( | |
* property="gender", | |
* description="Customer's gender", | |
* type="string", | |
* example="male" | |
* ), | |
* @OA\Property( | |
* property="dateOfBirth", | |
* description="Customer's date of birth", | |
* type="string", | |
* example="1994-07-20" | |
* ), | |
* @OA\Property( | |
* property="address", | |
* description="Customer's date of birth", | |
* type="string", | |
* example="no 10, oyekan street, nitel estate" | |
* ), | |
* @OA\Property( | |
* property="city", | |
* description="Customer's city", | |
* type="string", | |
* example="lagos" | |
* ), | |
* @OA\Property( | |
* property="country", | |
* description="Customer's country", | |
* type="string", | |
* example="nigeria" | |
* ), | |
* @OA\Property( | |
* property="state", | |
* description="Customer's State Of Origin", | |
* type="string", | |
* example="Delta" | |
* ), | |
* @OA\Property( | |
* property="LGA", | |
* description="Customer's local governament area", | |
* type="string", | |
* example="isoko south" | |
* ), | |
* @OA\Property( | |
* property="EmailAddress", | |
* description="Customer's email address", | |
* type="string", | |
* example="[email protected]" | |
* ), | |
* @OA\Property( | |
* property="Phone", | |
* description="Customer's phone number", | |
* type="string", | |
* example="08093939393" | |
* ), | |
* @OA\Property( | |
* property="homePhone", | |
* description="Customer's home phone number", | |
* type="string", | |
* example="08093939393" | |
* ), | |
* @OA\Property( | |
* property="politicallyExposed", | |
* description="politicallyExposed e.g yes or no", | |
* type="string", | |
* example="no" | |
* ), | |
* @OA\Property( | |
* property="employmentType", | |
* description="Type of employment e.g Self Employed or Employee", | |
* type="string", | |
* example="Employee" | |
* ), | |
* @OA\Property( | |
* property="companyName", | |
* description="Name of the company", | |
* type="string", | |
* example="mazee tech" | |
* ), | |
* @OA\Property( | |
* property="occupation", | |
* description="occupation", | |
* type="string", | |
* example="Programmer" | |
* ), | |
* @OA\Property( | |
* property="bankName", | |
* description="Name of bank", | |
* type="string", | |
* example="sterling bank" | |
* ), | |
* @OA\Property( | |
* property="bankAcctNumber", | |
* description="Account number", | |
* type="string", | |
* example="09238372" | |
* ), | |
* @OA\Property( | |
* property="BVNNumber", | |
* description="BVN number", | |
* type="string", | |
* example="093939393" | |
* ), | |
* @OA\Property( | |
* property="nextOfKin", | |
* description="Next of kin", | |
* type="string", | |
* example="Orevaoghene" | |
* ), | |
* @OA\Property( | |
* property="nextOfKinPhone", | |
* description="Next of kin's phone", | |
* type="string", | |
* example="08093939393" | |
* ), | |
* @OA\Property( | |
* property="nextOfKinEmail", | |
* description="Next of kin's email", | |
* type="string", | |
* example="[email protected]" | |
* ), | |
* @OA\Property( | |
* property="contactAddress", | |
* description="Contact address", | |
* type="string", | |
* example="no 10, oyekan street, nitel estate, satellite town, lagos" | |
* ), | |
* @OA\Property( | |
* property="relationship", | |
* description="relationship", | |
* type="string", | |
* example="brother" | |
* ), | |
* @OA\Property( | |
* property="identityType", | |
* description="identityType", | |
* type="string", | |
* example="ID card" | |
* ), | |
* @OA\Property( | |
* property="identityNumber", | |
* description="identityNumber", | |
* type="string", | |
* example="90493848783" | |
* ), | |
* @OA\Property( | |
* property="businessInvolvement", | |
* description="businessInvolvement e.g IWCardinalS or IWCardinal", | |
* type="array", | |
* @OA\Items( | |
* type="string", | |
* ), | |
* ), | |
* @OA\Property( | |
* property="involvementType", | |
* description="Involvement Types e.g SMA, EIN, FI, Mutual Fund (SIP), T-Bills, MMI, Bonds, FGN Savings bond. N.B multiple types should be separated with a comma", | |
* type="string", | |
* example="SMA, EIN, FI" | |
* ), | |
* @OA\Property( | |
* property="identityDocument", | |
* description="A valid government issued ID (Int. Passport, Driver’s License, National ID or National Voter’s Card) or a duly notarized means of ID for clients outside of Lagos and Abuja. The notarized I.D is also applicable to foreign investors/clients. AlsoThe Kyc document to be uploaded. this file should be in binary format", | |
* type="string", | |
* format="binary", | |
* ), | |
* @OA\Property( | |
* property="passport", | |
* description="passport of the customer. This file should be in binary format", | |
* type="string", | |
* format="binary", | |
* ), | |
* @OA\Property( | |
* property="signature", | |
* description="signature of the customer. This file should be in binary format", | |
* type="string", | |
* format="binary", | |
* ), | |
* @OA\Property( | |
* property="proofOfAddress", | |
* description="Any valid proof of address (Utility Bill) that is not more than 3 months old. This file should be in binary format", | |
* type="string", | |
* format="binary", | |
* ), | |
* @OA\Property( | |
* property="expiryDate", | |
* description="expiryDate", | |
* type="string", | |
* example="1994-07-22" | |
* ), | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Successfully created account!" | |
* ), | |
* ) | |
* | |
**/ | |
$app->post('/api/createNewAccount', function ($request, $response) { | |
$payload = array_merge( | |
[ | |
"files" => $request->getUploadedFiles(), | |
], | |
$request->getParsedBody() | |
); | |
if (!contains_value($payload['businessInvolvement'])) { | |
//$payload['businessInvolvement'] = [CAM_DB_NAME]; //editted by Tayo - This cannot be correct, default DB should be middleware | |
$payload['businessInvolvement'] = [MIDDLEWARE_DB_NAME]; | |
} | |
if (is_string($payload['businessInvolvement'])) { | |
$payload['businessInvolvement'] = explode(',', $payload['businessInvolvement']); | |
} | |
validate($payload, [ | |
"firstName" => V::notBlank()->stringType(), | |
"lastName" => V::notBlank()->stringType(), | |
"gender" => V::notBlank(), | |
"dateOfBirth" => V::notBlank()->date('Y-m-d'), | |
"address" => V::notBlank(), | |
"city" => V::notBlank(), | |
"country" => V::notBlank(), | |
"state" => V::notBlank(), | |
"LGA" => V::notBlank(), | |
"emailAddress" => V::notBlank(), | |
"phoneNumber" => V::notBlank()->phone(), | |
"politicallyExposed" => V::notBlank(), | |
"employmentType" => V::notBlank(), | |
"occupation" => V::notBlank(), | |
"bankName" => V::notBlank(), | |
"bankAcctNumber" => V::notBlank(), | |
"BVNNumber" => V::notBlank(), | |
"nextOfKin" => V::notBlank(), | |
"nextOfKinPhone" => V::notBlank(), | |
"nextOfKinEmail" => V::notBlank(), | |
"contactAddress" => V::notBlank(), | |
"relationship" => V::notBlank(), | |
"identityType" => V::notBlank(), | |
"identityNumber" => V::notBlank(), | |
"businessInvolvement" => V::notBlank(),//->arrayVal(), | |
"identityExpiryDate" => V::notBlank()->date('Y-m-d'), | |
]); | |
$result = $this->customerModel->createNewAccount($payload); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => "Account Successfully created" | |
]); | |
/* return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'Account Successfully created', | |
'data' => $result->data | |
]);*/ | |
}); | |
/** | |
* @author <[email protected]> | |
* Endpoint to create customer involvement | |
* @OA\Post( | |
* path="/api/customer/involvement", | |
* tags={"Customer"}, | |
* description="Endpoint to create customer involvement", | |
* summary="create customer involvements", | |
* operationId="involvement", | |
* @OA\RequestBody( | |
* required=true, | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* @OA\Property( | |
* property="businessInvolvement", | |
* description="businessInvolvement e.g IWCardinalTest, IWAPISvcsCARDINALASSETMGTTEST, IWCardinalSTest2", | |
* type="string", | |
* ), | |
* @OA\Property( | |
* property="Involvements", | |
* description="Involvements e.g CSPFI, SOP,SMA, EIN, FI, Mutual Fund (SIP), T-Bills, MMI, etc", | |
* type="string", | |
* ), | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Involvements Successfully created" | |
* ), | |
* ) | |
* | |
**/ | |
//Updated 4th of June 2021 | |
$app->post('/api/customer/involvement', function ($request, $response) { | |
// validate($payload, [ | |
// "businessInvolvement" => V::notBlank(), | |
// "involvementType" => V::notBlank(), | |
// "fundCode" => V::notBlank(), | |
// "CustID" => V::notBlank(), | |
// ]); | |
$payload = $request->getParsedBody(); | |
if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
if(strtoupper($payload['businessInvolvement']) == strtoupper(STOCKBROKING_DB_NAME)) | |
{ | |
$payload["CSS"] = 1; | |
}elseif(strtoupper($payload['businessInvolvement']) == strtoupper(CAM_DB_NAME)) | |
{ | |
$payload["CAM"] = 1; | |
} | |
if(strtoupper($payload['involvementType']) == "TROVE") | |
{ | |
$payload["CSS"] = 1; | |
$payload["TROVE"] = 1; | |
} | |
//var_dump($payload); | |
//$payload = $request->getParsedBody(); | |
$payload['CAMID'] = $request->getParsedBody()['CAMID'] ? $request->getParsedBody()['CAMID'] : $request->getAttribute('CAMCustomerId') ; | |
$payload['SECID'] = $request->getParsedBody()['SECID'] ? $request->getParsedBody()['SECID'] : $request->getAttribute('stockbrokingID') ; | |
$payload['ASSETID'] = $request->getParsedBody()['ASSETID'] ? $request->getParsedBody()['ASSETID'] : $request->getAttribute('assetMgmtID'); | |
$payload['CustID'] = $request->getParsedBody()['CustID'] ? $request->getParsedBody()['CustID'] : $request->getAttribute('ID'); | |
$payload['businessInvolvement'] = $request->getParsedBody()['businessInvolvement']; //obtain businessInvolvement from parsedbody | |
$payload['involvementType'] = $request->getParsedBody()['involvementType']; //obtain involvementType from parsedbody | |
$payload['FUNDCODE'] = $request->getParsedBody()['fundCode']; //for MF only | |
$result = $this->customerModel->createInvolvement($payload); | |
return $response | |
->withStatus($result["code"] ?? 200) | |
->withJson($result["message"]); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* @author <[email protected]> | |
* Endpoint to create customer involvement | |
* @OA\Post( | |
* path="/api/customer/createInvolvement", | |
* tags={"Customer"}, | |
* description="Endpoint to create customer involvement", | |
* summary="create customer involvements", | |
* operationId="involvement", | |
* @OA\RequestBody( | |
* required=true, | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* @OA\Property( | |
* property="businessInvolvement", | |
* description="businessInvolvement e.g IWCardinalTest, IWAPISvcsCARDINALASSETMGTTEST, IWCardinalSTest2", | |
* type="string", | |
* ), | |
* @OA\Property( | |
* property="Involvements", | |
* description="Involvements e.g CSPFI, SOP,SMA, EIN, FI, Mutual Fund (SIP), T-Bills, MMI, etc", | |
* type="string", | |
* ), | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Involvements Successfully created" | |
* ), | |
* ) | |
* | |
**/ | |
//Updated 4th of June 2021 | |
$app->post('/api/customer/createInvolvement', function ($request, $response) { | |
$payload = $request->getParsedBody(); | |
validate($payload, [ | |
// "businessInvolvement" => V::notBlank(), | |
// "involvementType" => V::notBlank(), | |
// "fundCode" => V::notBlank(), | |
"CustID" => V::notBlank(), | |
]); | |
if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$payload['company'] = $payload['businessInvolvement']; | |
$customerDetails = $this->customerModel->verifyBusinessCode($payload); | |
if($customerDetails['code'] && $customerDetails['data'] == true) | |
{ | |
return $response | |
->withStatus(400) | |
->withJson(["message" => "Business involvement already exist"]); | |
} | |
if(strtoupper($payload['businessInvolvement']) == strtoupper(STOCKBROKING_DB_NAME)) | |
{ | |
$payload["CSS"] = 1; | |
}elseif(strtoupper($payload['businessInvolvement']) == strtoupper(CAM_DB_NAME)) | |
{ | |
$payload["CAM"] = 1; | |
}elseif(strtoupper($payload['businessInvolvement']) == "CSRL") | |
{ | |
$payload["CSRL"] = 1; | |
}elseif(strtoupper($payload['businessInvolvement']) == "CSA") | |
{ | |
$payload["CSA"] = 1; | |
} | |
if(strtoupper($payload['involvementType']) == "TROVE") | |
{ | |
$payload["CSS"] = 1; | |
$payload["TROVE"] = 1; | |
} | |
//var_dump($payload); | |
//$payload = $request->getParsedBody(); | |
$payload['CAMID'] = $request->getParsedBody()['CAMID'] ? $request->getParsedBody()['CAMID'] : $request->getAttribute('CAMCustomerId') ; | |
$payload['SECID'] = $request->getParsedBody()['SECID'] ? $request->getParsedBody()['SECID'] : $request->getAttribute('stockbrokingID') ; | |
$payload['ASSETID'] = $request->getParsedBody()['ASSETID'] ? $request->getParsedBody()['ASSETID'] : $request->getAttribute('assetMgmtID'); | |
$payload['CustID'] = $request->getParsedBody()['CustID'] ? $request->getParsedBody()['CustID'] : $request->getAttribute('ID'); | |
$payload['businessInvolvement'] = $request->getParsedBody()['businessInvolvement']; //obtain businessInvolvement from parsedbody | |
$payload['involvementType'] = $request->getParsedBody()['involvementType']; //obtain involvementType from parsedbody | |
$payload['FUNDCODE'] = $request->getParsedBody()['fundCode']; //for MF only | |
$result = $this->customerModel->createInvolvement($payload); | |
return $response | |
->withStatus($result["code"]) | |
->withJson($result); | |
}) | |
->add(new RateLimitMiddleware()) | |
->add(new Authorization()) | |
->add(new auth()); | |
$app->post('/api/admin/createInvolvement', function ($request, $response) { | |
$payload = $request->getParsedBody(); | |
validate($payload, [ | |
"businessInvolvement" => V::notBlank(), | |
"involvementType" => V::notBlank(), | |
"CustID" => V::notBlank() | |
]); | |
if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$payload['company'] = $payload['businessInvolvement']; | |
$customerDetails = $this->customerModel->verifyBusinessCode($payload); | |
if($customerDetails['code'] && $customerDetails['data'] == true) | |
{ | |
return $response | |
->withStatus(400) | |
->withJson(["message" => "Business involvement already exist"]); | |
} | |
$customerInfo = $this->customerModel->getCustomerDetails($payload['CustID']); | |
if(strtoupper($payload['businessInvolvement']) == strtoupper(STOCKBROKING_DB_NAME)) | |
{ | |
$payload["CSS"] = 1; | |
}elseif(strtoupper($payload['businessInvolvement']) == strtoupper(CAM_DB_NAME)) | |
{ | |
$payload["CAM"] = 1; | |
}elseif(strtoupper($payload['businessInvolvement']) == "CSRL") | |
{ | |
$payload["CSRL"] = 1; | |
}elseif(strtoupper($payload['businessInvolvement']) == "CSA") | |
{ | |
$payload["CSA"] = 1; | |
} | |
if(strtoupper($payload['involvementType']) == "TROVE") | |
{ | |
$payload["CSS"] = 1; | |
$payload["TROVE"] = 1; | |
} | |
//var_dump($payload); | |
//$payload = $request->getParsedBody(); | |
$payload['CAMID'] = $customerInfo['CAMID']; | |
$payload['SECID'] = $customerInfo['SECID']; | |
$payload['ASSETID'] = $customerInfo['ASSETID']; | |
$payload['CustID'] = $request->getParsedBody()['CustID']; | |
$payload['businessInvolvement'] = $request->getParsedBody()['businessInvolvement']; //obtain businessInvolvement from parsedbody | |
$payload['involvementType'] = $request->getParsedBody()['involvementType']; //obtain involvementType from parsedbody | |
$payload['FUNDCODE'] = $request->getParsedBody()['fundCode']; //for MF only | |
$result = $this->customerModel->createInvolvement($payload); | |
return $response | |
->withStatus($result["code"]) | |
->withJson($result); | |
}); | |
// ->add(new AdminAuthorization()) | |
// ->add(new auth()); | |
/** | |
* @author <[email protected]> | |
* Endpoint to create customer NUBAN Account | |
* @OA\Post( | |
* path="/api/customer/nubanAccount", | |
* tags={"Customer"}, | |
* description="Endpoint to create customer NUBAN Account", | |
* summary="create customer NUBAN Account", | |
* operationId="nubanAccount", | |
* @OA\RequestBody( | |
* required=true, | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* @OA\Property( | |
* property="email", | |
* description="Email address", | |
* type="string", | |
* ), | |
* @OA\Property( | |
* property="userID", | |
* description="userID", | |
* type="string", | |
* ), | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="NUBAN Account Successfully created" | |
* ), | |
* ) | |
* | |
**/ | |
$app->post('/api/customer/createNubanCustomer', function ($request, $response) { | |
//product = CSPFIFUND, TROVE, security, CSWALLET, fi | |
$payload = $request->getParsedBody(); | |
validate($payload, [ | |
"emailAddress" => V::notBlank(), | |
"phoneNumber" => V::notBlank(), | |
"firstName" => V::notBlank(), | |
"lastName" => V::notBlank(), | |
"fullName" => V::notBlank(), | |
"fundCode" => V::notBlank(), | |
// "company" => V::notBlank(), | |
"description" => V::notBlank(), | |
"product" => V::notBlank(), | |
"CustID" => V::notBlank() | |
]); | |
if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
//fetch product information | |
// $prod = $this->customerModel->getNubanProduct($payload["fundCode"]); | |
// $payload["description"] = $prod->description; | |
$payload['SECID'] = $request->getAttribute('SECID'); | |
$payload['ASSETID'] = $request->getAttribute('ASSETID'); | |
$payload['CAMID'] = $request->getAttribute('CAMID'); | |
$result = $this->customerModel->createNubanCustomer($payload); | |
return $response | |
->withStatus($result["code"] ?? 200) | |
->withJson($result); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
$app->post('/api/admin/createNubanCustomer', function ($request, $response) { | |
//product = CSPFIFUND, TROVE, security, CSWALLET, fi | |
$payload = $request->getParsedBody(); | |
validate($payload, [ | |
"emailAddress" => V::notBlank(), | |
"phoneNumber" => V::notBlank(), | |
"firstName" => V::notBlank(), | |
"lastName" => V::notBlank(), | |
"fullName" => V::notBlank(), | |
"fundCode" => V::notBlank(), | |
// "company" => V::notBlank(), | |
"description" => V::notBlank(), | |
"product" => V::notBlank(), | |
"CustID" => V::notBlank() | |
]); | |
$customerInfo = $this->customerModel->getCustomerDetails($payload['CustID']); | |
if (!$customerInfo) | |
{ | |
throw new Exception('Unable to find customer ' . $payload['CustID']); | |
} | |
//fetch product information | |
$payload['SECID'] = $customerInfo['SECID']; | |
$payload['ASSETID'] = $customerInfo['ASSETID']; | |
$payload["CAMID"] = $customerInfo['CAMID']; | |
$result = $this->customerModel->createNubanCustomer($payload); | |
return $response | |
->withStatus($result["code"] ?? 200) | |
->withJson($result); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
/** | |
* Get NUBAN Customer | |
* | |
* This API endpoint retrieves information about a NUBAN customer based on their CustID and the product type. | |
* | |
* @param {string} CustID - The ID of the customer for whom NUBAN information is requested. | |
* @param {string} product - The product type associated with the NUBAN customer (e.g., CSPFIFUND, TROVE, security, CSWALLET, fi). | |
* | |
* @return {Object} Response - JSON response containing the information of the NUBAN customer. | |
* | |
* @throws {Error} 400 - Bad Request: If the CustID or product parameter is missing or blank. | |
* @throws {Error} 401 - Unauthorized: If the request is not authorized, i.e., the provided CustID is not authenticated. | |
* @throws {Error} 500 - Internal Server Error: If an unexpected error occurs while retrieving the NUBAN customer information. | |
* | |
* @OA\Get( | |
* path="/api/customer/getNubanCustomer", | |
* tags={"Customer"}, | |
* summary="Get NUBAN Customer", | |
* operationId="getNubanCustomer", | |
* security={{ "BearerAuth": {} }}, | |
* @OA\Parameter( | |
* name="CustID", | |
* in="query", | |
* description="The ID of the customer for whom NUBAN information is requested.", | |
* required=true, | |
* @OA\Schema(type="string") | |
* ), | |
* @OA\Parameter( | |
* name="product", | |
* in="query", | |
* description="The product type associated with the NUBAN customer.", | |
* required=true, | |
* @OA\Schema(type="string") | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Successful operation", | |
* @OA\JsonContent( | |
* @OA\Property(property="result", type="string"), | |
* @OA\Property(property="message", type="string"), | |
* @OA\Property(property="customerData", type="object") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized Access", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getNubanCustomer', function ($request, $response) { | |
//product = CSPFIFUND, TROVE, security, CSWALLET, fi | |
$payload = $request->getQueryParams(); | |
validate($payload, [ | |
// "customerCode" => V::notBlank(), | |
"CustID" => V::notBlank(), | |
"product" => V::notBlank(), | |
]); | |
if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$result = $this->customerModel->getNubanCustomer($payload); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* Validate NUBAN Customer | |
* | |
* This API endpoint validates a NUBAN customer based on their provided information. | |
* | |
* @param {string} idType - The type of identification for the customer (e.g., ID card, passport). | |
* @param {string} idValue - The identification value of the customer (e.g., ID card number, passport number). | |
* @param {string} country - The country of the customer's identification. | |
* @param {string} firstName - The first name of the customer. | |
* @param {string} lastName - The last name of the customer. | |
* @param {string} customerCode - The customer code associated with the customer. | |
* @param {string} product - The product type associated with the customer (e.g., CSPFIFUND, TROVE, security, CSWALLET, fi). | |
* @param {string} CustID - The ID of the customer who is being validated. | |
* | |
* @return {Object} Response - JSON response containing the result of the customer validation. | |
* | |
* @throws {Error} 400 - Bad Request: If any of the required parameters are missing or blank. | |
* @throws {Error} 401 - Unauthorized: If the request is not authorized, i.e., the provided CustID is not authenticated. | |
* @throws {Error} 500 - Internal Server Error: If an unexpected error occurs while validating the NUBAN customer. | |
* | |
* @OA\Post( | |
* path="/api/customer/validateNubanCustomer", | |
* tags={"Customer"}, | |
* summary="Validate NUBAN Customer", | |
* operationId="validateNubanCustomer", | |
* security={{ "BearerAuth": {} }}, | |
* @OA\RequestBody( | |
* required=true, | |
* @OA\JsonContent( | |
* @OA\Property(property="idType", type="string"), | |
* @OA\Property(property="idValue", type="string"), | |
* @OA\Property(property="country", type="string"), | |
* @OA\Property(property="firstName", type="string"), | |
* @OA\Property(property="lastName", type="string"), | |
* @OA\Property(property="customerCode", type="string"), | |
* @OA\Property(property="product", type="string"), | |
* @OA\Property(property="CustID", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Successful operation", | |
* @OA\JsonContent( | |
* @OA\Property(property="result", type="string"), | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized Access", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->post('/api/customer/validateNubanCustomer', function ($request, $response) { | |
$payload = $request->getParsedBody(); | |
validate($payload, [ | |
"idType" => V::notBlank(), | |
"idValue" => V::notBlank(), | |
"country" => V::notBlank(), | |
"firstName" => V::notBlank(), | |
"lastName" => V::notBlank(), | |
"customerCode" => V::notBlank(), | |
"product" => V::notBlank(), | |
"CustID" => V::notBlank() | |
]); | |
if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$result = $this->customerModel->validateNubanCustomer($payload); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* List NUBAN Customers | |
* | |
* This API endpoint lists NUBAN customers based on the provided product type. | |
* | |
* @param {string} product - The product type associated with the NUBAN customers (e.g., CSPFIFUND, TROVE, security, CSWALLET, fi). | |
* | |
* @return {Object} Response - JSON response containing the list of NUBAN customers. | |
* | |
* @throws {Error} 400 - Bad Request: If the product parameter is missing or blank. | |
* @throws {Error} 401 - Unauthorized: If the request is not authorized, i.e., the user does not have admin privileges or is not authenticated. | |
* @throws {Error} 500 - Internal Server Error: If an unexpected error occurs while listing the NUBAN customers. | |
* | |
* @OA\Get( | |
* path="/api/customer/listNubanCustomers", | |
* tags={"Customer"}, | |
* summary="List NUBAN Customers", | |
* operationId="listNubanCustomers", | |
* security={{ "BearerAuth": {} }}, | |
* @OA\Parameter( | |
* name="product", | |
* in="query", | |
* description="The product type associated with the NUBAN customers.", | |
* required=true, | |
* @OA\Schema(type="string") | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Successful operation", | |
* @OA\JsonContent( | |
* @OA\Property(property="result", type="string"), | |
* @OA\Property(property="message", type="string"), | |
* @OA\Property(property="customerList", type="array", @OA\Items(type="object")) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/listNubanCustomers', function ($request, $response) { | |
validate($payload, [ | |
"product" => V::notBlank(), | |
]); | |
$payload = $request->getQueryParams(); | |
$result = $this->customerModel->listNubanCustomers($payload); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
/** | |
* Update NUBAN Customer | |
* | |
* This API endpoint allows an admin to update information for a NUBAN customer. | |
* | |
* @param {string} emailAddress - The updated email address of the customer. | |
* @param {string} product - The product type associated with the NUBAN customer (e.g., CSPFIFUND, TROVE, security, CSWALLET, fi). | |
* @param {string} phoneNumber - The updated phone number of the customer. | |
* @param {string} firstName - The updated first name of the customer. | |
* @param {string} lastName - The updated last name of the customer. | |
* @param {string} CustID - The ID of the customer being updated. | |
* @param {string} customerCode - The customer code associated with the customer. | |
* | |
* @return {Object} Response - JSON response containing the result of the customer update. | |
* | |
* @throws {Error} 400 - Bad Request: If any of the required parameters are missing or blank. | |
* @throws {Error} 401 - Unauthorized: If the request is not authorized, i.e., the user does not have admin privileges or is not authenticated. | |
* @throws {Error} 500 - Internal Server Error: If an unexpected error occurs while updating the NUBAN customer. | |
* | |
* @OA\Post( | |
* path="/api/customer/updateNubanCustomer", | |
* tags={"Customer"}, | |
* summary="Update NUBAN Customer", | |
* operationId="updateNubanCustomer", | |
* security={{ "BearerAuth": {} }}, | |
* @OA\RequestBody( | |
* required=true, | |
* @OA\JsonContent( | |
* @OA\Property(property="emailAddress", type="string"), | |
* @OA\Property(property="product", type="string"), | |
* @OA\Property(property="phoneNumber", type="string"), | |
* @OA\Property(property="firstName", type="string"), | |
* @OA\Property(property="lastName", type="string"), | |
* @OA\Property(property="CustID", type="string"), | |
* @OA\Property(property="customerCode", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Successful operation", | |
* @OA\JsonContent( | |
* @OA\Property(property="result", type="string"), | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->post('/api/customer/updateNubanCustomer', function ($request, $response) { | |
//stepped down momentarily | |
$payload = $request->getParsedBody(); | |
validate($payload, [ | |
"emailAddress" => V::notBlank(), | |
"product" => V::notBlank(), | |
"phoneNumber" => V::notBlank(), | |
"firstName" => V::notBlank(), | |
"lastName" => V::notBlank(), | |
"CustID" => V::notBlank(), | |
"customerCode" => V::notBlank() | |
]); | |
$result = $this->customerModel->updateNubanCustomer($payload); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
/** | |
* Create NUBAN Account | |
* | |
* This API endpoint allows an admin to create a NUBAN account for a customer. | |
* | |
* @param {string} customerCode - The customer code associated with the customer. | |
* @param {string} product - The product type associated with the NUBAN account (e.g., CSPFIFUND, TROVE, security, CSWALLET, fi). | |
* @param {string} CustID - The ID of the customer for whom the NUBAN account is being created. | |
* | |
* @return {Object} Response - JSON response containing the result of the NUBAN account creation. | |
* | |
* @throws {Error} 400 - Bad Request: If any of the required parameters are missing or blank. | |
* @throws {Error} 401 - Unauthorized: If the request is not authorized, i.e., the user does not have admin privileges or is not authenticated. | |
* @throws {Error} 500 - Internal Server Error: If an unexpected error occurs while creating the NUBAN account. | |
* | |
* @OA\Post( | |
* path="/api/customer/createNubanAccount", | |
* tags={"Customer"}, | |
* summary="Create NUBAN Account", | |
* operationId="createNubanAccount", | |
* security={{ "BearerAuth": {} }}, | |
* @OA\RequestBody( | |
* required=true, | |
* @OA\JsonContent( | |
* @OA\Property(property="customerCode", type="string"), | |
* @OA\Property(property="product", type="string"), | |
* @OA\Property(property="CustID", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Successful operation", | |
* @OA\JsonContent( | |
* @OA\Property(property="result", type="string"), | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized Access", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->post('/api/customer/createNubanAccount', function ($request, $response) { | |
//product = CSPFIFUND, TROVE, security, CSWALLET, fi | |
$payload = $request->getParsedBody(); | |
validate($payload, [ | |
"customerCode" => V::notBlank(), | |
"product" => V::notBlank(), | |
"CustID" => V::notBlank() | |
]); | |
$result = $this->customerModel->createNubanAccount($payload); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
/** | |
* Get NUBAN Account | |
* | |
* This API endpoint retrieves the NUBAN account details for a customer based on their CustID and the product type. | |
* | |
* @param {string} CustID - The ID of the customer for whom the NUBAN account details are requested. | |
* @param {string} product - The product type associated with the NUBAN account (e.g., CSPFIFUND, TROVE, security, CSWALLET, fi). | |
* | |
* @return {Object} Response - JSON response containing the NUBAN account details for the customer. | |
* | |
* @throws {Error} 400 - Bad Request: If the CustID or product parameter is missing or blank. | |
* @throws {Error} 401 - Unauthorized: If the request is not authorized, i.e., the provided CustID is not authenticated. | |
* @throws {Error} 500 - Internal Server Error: If an unexpected error occurs while retrieving the NUBAN account details. | |
* | |
* @OA\Get( | |
* path="/api/customer/getNubanAccount", | |
* tags={"Customer"}, | |
* summary="Get NUBAN Account", | |
* operationId="getNubanAccount", | |
* security={{ "BearerAuth": {} }}, | |
* @OA\Parameter( | |
* name="CustID", | |
* in="query", | |
* description="The ID of the customer for whom NUBAN account details are requested.", | |
* required=true, | |
* @OA\Schema(type="string") | |
* ), | |
* @OA\Parameter( | |
* name="product", | |
* in="query", | |
* description="The product type associated with the NUBAN account.", | |
* required=true, | |
* @OA\Schema(type="string") | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Successful operation", | |
* @OA\JsonContent( | |
* @OA\Property(property="result", type="string"), | |
* @OA\Property(property="message", type="string"), | |
* @OA\Property(property="accountDetails", type="object") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized Access", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getNubanAccount', function ($request, $response) { | |
//product = CSPFIFUND, TROVE, security, CSWALLET, fi | |
$payload = $request->getQueryParams(); | |
validate($payload, [ | |
"CustID" => V::notBlank(), | |
"product" => V::notBlank(), | |
]); | |
if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$result = $this->customerModel->getNubanAccount($payload); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* Get NUBAN Accounts | |
* | |
* This API endpoint retrieves all NUBAN accounts associated with a specific customer based on their CustID. | |
* | |
* @param {string} CustID - The ID of the customer for whom NUBAN accounts are requested. | |
* | |
* @return {Object} Response - JSON response containing the list of NUBAN accounts for the customer. | |
* | |
* @throws {Error} 400 - Bad Request: If the CustID parameter is missing or blank. | |
* @throws {Error} 401 - Unauthorized: If the request is not authorized, i.e., the provided CustID is not authenticated. | |
* @throws {Error} 500 - Internal Server Error: If an unexpected error occurs while retrieving the NUBAN accounts. | |
* | |
* @OA\Get( | |
* path="/api/customer/getNubanAccounts", | |
* tags={"Customer"}, | |
* summary="Get NUBAN Accounts", | |
* operationId="getNubanAccounts", | |
* security={{ "BearerAuth": {} }}, | |
* @OA\Parameter( | |
* name="CustID", | |
* in="query", | |
* description="The ID of the customer for whom NUBAN accounts are requested.", | |
* required=true, | |
* @OA\Schema(type="string") | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Successful operation", | |
* @OA\JsonContent( | |
* @OA\Property(property="result", type="string"), | |
* @OA\Property(property="message", type="string"), | |
* @OA\Property(property="accountList", type="array", @OA\Items(type="object")) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized Access", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getNubanAccounts', function ($request, $response) { | |
//product = CSPFIFUND, TROVE, security, CSWALLET, fi | |
$payload = $request->getQueryParams(); | |
validate($payload, [ | |
"CustID" => V::notBlank(), | |
]); | |
if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$result = $this->customerModel->getNubanAccounts($payload); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* Get Cash Accounts | |
* | |
* This API endpoint retrieves all cash accounts associated with a specific customer. | |
* | |
* @return {Object} Response - JSON response containing the list of cash accounts for the customer. | |
* | |
* @throws {Error} 401 - Unauthorized: If the request is not authorized, i.e., the user is not authenticated. | |
* @throws {Error} 500 - Internal Server Error: If an unexpected error occurs while retrieving the cash accounts. | |
* | |
* @OA\Get( | |
* path="/api/customer/getCashAccounts", | |
* tags={"Customer"}, | |
* summary="Get Cash Accounts", | |
* operationId="getCashAccounts", | |
* security={{ "BearerAuth": {} }}, | |
* @OA\Response( | |
* response=200, | |
* description="Successful operation", | |
* @OA\JsonContent( | |
* @OA\Property(property="result", type="string"), | |
* @OA\Property(property="message", type="string"), | |
* @OA\Property(property="accountList", type="array", @OA\Items(type="object")) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getCashAccounts', function ($request, $response) { | |
//product = CSPFIFUND, TROVE, security, CSWALLET, fi | |
$result = $this->customerModel->getCashAccounts(); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* Get Business Involvement | |
* | |
* This API endpoint retrieves the business involvement details for a specific customer. | |
* | |
* @return {Object} Response - JSON response containing the business involvement details for the customer. | |
* | |
* @throws {Error} 500 - Internal Server Error: If an unexpected error occurs while retrieving the business involvement details. | |
* | |
* @OA\Get( | |
* path="/api/customer/getBusinessInvolvement", | |
* tags={"Customer"}, | |
* summary="Get Business Involvement", | |
* operationId="getBusinessInvolvement", | |
* @OA\Response( | |
* response=200, | |
* description="Successful operation", | |
* @OA\JsonContent( | |
* @OA\Property(property="result", type="string"), | |
* @OA\Property(property="message", type="string"), | |
* @OA\Property(property="businessInvolvement", type="object") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getBusinessInvolvement', function ($request, $response) { | |
//product = CSPFIFUND, TROVE, security, CSWALLET, fi | |
$result = $this->customerModel->getBusinessInvolvement(); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}); | |
/** | |
* Get Product Involvements | |
* | |
* This API endpoint retrieves the product involvements for a specific customer. | |
* | |
* @return {Object} Response - JSON response containing the product involvements for the customer. | |
* | |
* @throws {Error} 500 - Internal Server Error: If an unexpected error occurs while retrieving the product involvements. | |
* | |
* @OA\Get( | |
* path="/api/customer/getProductInvolvements", | |
* tags={"Customer"}, | |
* summary="Get Product Involvements", | |
* operationId="getProductInvolvements", | |
* @OA\Response( | |
* response=200, | |
* description="Successful operation", | |
* @OA\JsonContent( | |
* @OA\Property(property="result", type="string"), | |
* @OA\Property(property="message", type="string"), | |
* @OA\Property(property="productInvolvements", type="object") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getProductInvolvements', function ($request, $response) { | |
//product = CSPFIFUND, TROVE, security, CSWALLET, fi | |
$result = $this->customerModel->getProductInvolvements(); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}); | |
$app->get('/api/customer/getNubanProduct', function ($request, $response) { | |
//product = CSPFIFUND, TROVE, security, CSWALLET, fi | |
$payload = $request->getQueryParams(); | |
validate($payload, [ | |
"product" => V::notBlank(), | |
]); | |
$result = $this->customerModel->getNubanProduct($payload['product']); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* Get NUBAN Product | |
* | |
* This API endpoint retrieves the details of a specific NUBAN product. | |
* | |
* @param {string} product - The product type associated with the NUBAN account (e.g., CSPFIFUND, TROVE, security, CSWALLET, fi). | |
* | |
* @return {Object} Response - JSON response containing the details of the NUBAN product. | |
* | |
* @throws {Error} 400 - Bad Request: If the product parameter is missing or blank. | |
* @throws {Error} 401 - Unauthorized: If the request is not authorized, i.e., the user is not authenticated. | |
* @throws {Error} 500 - Internal Server Error: If an unexpected error occurs while retrieving the NUBAN product details. | |
* | |
* @OA\Get( | |
* path="/api/customer/getNubanProduct", | |
* tags={"Customer"}, | |
* summary="Get NUBAN Product", | |
* operationId="getNubanProduct", | |
* security={{ "BearerAuth": {} }}, | |
* @OA\Parameter( | |
* name="product", | |
* in="query", | |
* description="The product type associated with the NUBAN account.", | |
* required=true, | |
* @OA\Schema(type="string") | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Successful operation", | |
* @OA\JsonContent( | |
* @OA\Property(property="result", type="string"), | |
* @OA\Property(property="message", type="string"), | |
* @OA\Property(property="productDetails", type="object") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized Access", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getNubanProducts', function ($request, $response) { | |
//product = CSPFIFUND, TROVE, security, CSWALLET, fi | |
$result = $this->customerModel->getNubanProducts(); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* List NUBAN Accounts | |
* | |
* This API endpoint retrieves a list of NUBAN accounts associated with a specific product. | |
* | |
* @param {string} product - The product type for which NUBAN accounts are to be listed (e.g., CSPFIFUND, TROVE, security, CSWALLET, fi). | |
* | |
* @return {Object} Response - JSON response containing the list of NUBAN accounts for the product. | |
* | |
* @throws {Error} 400 - Bad Request: If the product parameter is missing or blank. | |
* @throws {Error} 401 - Unauthorized: If the request is not authorized, i.e., the user is not authenticated. | |
* @throws {Error} 500 - Internal Server Error: If an unexpected error occurs while retrieving the NUBAN accounts. | |
* | |
* @OA\Get( | |
* path="/api/customer/listNubanAccounts", | |
* tags={"Customer"}, | |
* summary="List NUBAN Accounts", | |
* operationId="listNubanAccounts", | |
* security={{ "BearerAuth": {} }}, | |
* @OA\Parameter( | |
* name="product", | |
* in="query", | |
* description="The product type for which NUBAN accounts are to be listed.", | |
* required=true, | |
* @OA\Schema(type="string") | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Successful operation", | |
* @OA\JsonContent( | |
* @OA\Property(property="result", type="string"), | |
* @OA\Property(property="message", type="string"), | |
* @OA\Property(property="accountList", type="array", @OA\Items(type="object")) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized Access", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/listNubanAccounts', function ($request, $response) { | |
$payload = $request->getQueryParams(); | |
validate($payload, [ | |
"product" => V::notBlank(), | |
]); | |
$result = $this->customerModel->listNubanAccounts($payload); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
/** | |
* Get Rolling Average | |
* | |
* This API endpoint calculates the rolling average for a specific customer based on their ledger type, reference date, business involvement, and other parameters. | |
* | |
* @param {string} ledgerType - The ledger type associated with the customer. | |
* @param {string} refDate - The reference date for calculating the rolling average. | |
* @param {string} CustID - The ID of the customer for whom the rolling average is to be calculated. | |
* @param {string} businessInvolvement - The business involvement type associated with the customer (e.g., ASSETMGMT_DB_NAME, STOCKBROKING_DB_NAME, CAM_DB_NAME). | |
* | |
* @return {Object} Response - JSON response containing the calculated rolling average for the customer. | |
* | |
* @throws {Error} 400 - Bad Request: If any of the required parameters are missing or blank, or if an invalid business involvement type is provided. | |
* @throws {Error} 401 - Unauthorized: If the request is not authorized, i.e., the user is not authenticated or lacks permission. | |
* @throws {Error} 500 - Internal Server Error: If an unexpected error occurs while calculating the rolling average. | |
* | |
* @OA\Get( | |
* path="/api/customer/rollingAvg", | |
* tags={"Customer"}, | |
* summary="Get Rolling Average", | |
* operationId="rollingAvg", | |
* security={{ "BearerAuth": {} }}, | |
* @OA\Parameter( | |
* name="ledgerType", | |
* in="query", | |
* description="The ledger type associated with the customer.", | |
* required=true, | |
* @OA\Schema(type="string") | |
* ), | |
* @OA\Parameter( | |
* name="refDate", | |
* in="query", | |
* description="The reference date for calculating the rolling average.", | |
* required=true, | |
* @OA\Schema(type="string") | |
* ), | |
* @OA\Parameter( | |
* name="CustID", | |
* in="query", | |
* description="The ID of the customer for whom the rolling average is to be calculated.", | |
* required=true, | |
* @OA\Schema(type="string") | |
* ), | |
* @OA\Parameter( | |
* name="businessInvolvement", | |
* in="query", | |
* description="The business involvement type associated with the customer (e.g., ASSETMGMT_DB_NAME, STOCKBROKING_DB_NAME, CAM_DB_NAME).", | |
* required=true, | |
* @OA\Schema(type="string") | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Successful operation", | |
* @OA\JsonContent( | |
* @OA\Property(property="result", type="string"), | |
* @OA\Property(property="message", type="string"), | |
* @OA\Property(property="rollingAverage", type="number") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized Access", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ) | |
* ) | |
*/ | |
//created by Tayo 13th of June to get SEC rolling average | |
$app->get('/api/customer/rollingAvg', function ($request, $response) { | |
validate($request, [ | |
/* 'CSCSNumber' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CSCSNumber is required' | |
], */ | |
'ledgerType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'ledgerType is required' | |
], | |
'refDate' => [ | |
'rules' => V::notBlank(), | |
'message' => 'refDate is required' | |
], | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
'businessInvolvement' => [ | |
'rules' => V::notBlank(), | |
'message' => 'businessInvolvement is required' | |
] | |
]); | |
$payload = $request->getQueryParams(); | |
if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$payload['fullName'] = str_replace(",","",$request->getAttribute('name')); | |
//intialize BIZID based on the business and involvement of interest | |
if(strtoupper($payload['businessInvolvement']) == strtoupper(ASSETMGMT_DB_NAME)){ | |
$payload['BIZID'] = $request->getAttribute('assetMgmtID'); | |
$payload['ASSETID'] = $request->getAttribute('assetMgmtID'); | |
$result = $this->customerModel->CAMRollingAvg($payload); | |
}elseif(strtoupper($payload['businessInvolvement']) == strtoupper(STOCKBROKING_DB_NAME)){ | |
$payload['BIZID'] = $request->getAttribute('stockbrokingID'); | |
$payload['SECID'] = $request->getAttribute('stockbrokingID'); | |
$result = $this->customerModel->rollingAvg($payload); | |
}elseif(strtoupper($payload['businessInvolvement']) == strtoupper(CAM_DB_NAME)){ | |
$payload['BIZID'] = $request->getAttribute('CAMID'); | |
$payload['CAMID'] = $request->getAttribute('CAMID'); | |
$result = $this->customerModel->CAMRollingAvg($payload); | |
}else{ | |
return $response | |
->withStatus(400) | |
->withJson("Invalid Business Involvement"); | |
} | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* Get Total Rolling Average | |
* | |
* This API endpoint calculates the total rolling average for a specific customer based on their reference date, business involvement, and other parameters. | |
* | |
* @param {string} refDate - The reference date for calculating the total rolling average. | |
* @param {string} CustID - The ID of the customer for whom the total rolling average is to be calculated. | |
* @param {string} businessInvolvement - The business involvement type associated with the customer (e.g., ASSETMGMT_DB_NAME, STOCKBROKING_DB_NAME, CAM_DB_NAME). | |
* | |
* @return {Object} Response - JSON response containing the calculated total rolling average for the customer. | |
* | |
* @throws {Error} 400 - Bad Request: If any of the required parameters are missing or blank, or if an invalid business involvement type is provided. | |
* @throws {Error} 401 - Unauthorized: If the request is not authorized, i.e., the user is not authenticated or lacks permission. | |
* @throws {Error} 500 - Internal Server Error: If an unexpected error occurs while calculating the total rolling average. | |
* | |
* @OA\Get( | |
* path="/api/customer/totalRollingAvg", | |
* tags={"Customer"}, | |
* summary="Get Total Rolling Average", | |
* operationId="totalRollingAvg", | |
* security={{ "BearerAuth": {} }}, | |
* @OA\Parameter( | |
* name="refDate", | |
* in="query", | |
* description="The reference date for calculating the total rolling average.", | |
* required=true, | |
* @OA\Schema(type="string") | |
* ), | |
* @OA\Parameter( | |
* name="CustID", | |
* in="query", | |
* description="The ID of the customer for whom the total rolling average is to be calculated.", | |
* required=true, | |
* @OA\Schema(type="string") | |
* ), | |
* @OA\Parameter( | |
* name="businessInvolvement", | |
* in="query", | |
* description="The business involvement type associated with the customer (e.g., ASSETMGMT_DB_NAME, STOCKBROKING_DB_NAME, CAM_DB_NAME).", | |
* required=true, | |
* @OA\Schema(type="string") | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Successful operation", | |
* @OA\JsonContent( | |
* @OA\Property(property="result", type="string"), | |
* @OA\Property(property="message", type="string"), | |
* @OA\Property(property="totalRollingAverage", type="number") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized Access", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ) | |
* ) | |
*/ | |
//created by Tayo 13th of June to get SEC rolling average | |
$app->get('/api/customer/totalRollingAvg', function ($request, $response) { | |
validate($request, [ | |
/* 'CSCSNumber' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CSCSNumber is required' | |
], | |
'ledgerType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'ledgerType is required' | |
],*/ | |
'refDate' => [ | |
'rules' => V::notBlank(), | |
'message' => 'refDate is required' | |
], | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
'businessInvolvement' => [ | |
'rules' => V::notBlank(), | |
'message' => 'businessInvolvement is required' | |
] | |
]); | |
$payload = $request->getQueryParams(); | |
if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$payload['fullName'] = str_replace(",","",$request->getAttribute('name')); | |
//intialize BIZID based on the business and involvement of interest | |
if(strtoupper($payload['businessInvolvement']) == strtoupper(ASSETMGMT_DB_NAME)){ | |
$payload['BIZID'] = $request->getAttribute('assetMgmtID'); | |
$payload['ASSETID'] = $request->getAttribute('assetMgmtID'); | |
$result = $this->customerModel->CAMRollingAvg($payload); | |
}elseif(strtoupper($payload['businessInvolvement']) == strtoupper(STOCKBROKING_DB_NAME)){ | |
$payload['BIZID'] = $request->getAttribute('stockbrokingID'); | |
$payload['SECID'] = $request->getAttribute('stockbrokingID'); | |
$result = $this->customerModel->totalRollingAvg($payload); | |
}elseif(strtoupper($payload['businessInvolvement']) == strtoupper(CAM_DB_NAME)){ | |
$payload['BIZID'] = $request->getAttribute('CAMID'); | |
$payload['CAMID'] = $request->getAttribute('CAMID'); | |
$result = $this->customerModel->CAMRollingAvg($payload); | |
}else{ | |
return $response | |
->withStatus(400) | |
->withJson("Invalid Business Involvement"); | |
} | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* @author <[email protected]> | |
* Endpoint to get customer NUBAN Account | |
* @OA\Get( | |
* path="/api/customer/nubanAccount", | |
* tags={"Customer"}, | |
* description="Endpoint to fetch customer NUBAN Account", | |
* summary="fetch customer NUBAN Account", | |
* operationId="nubanAccount", | |
* @OA\RequestBody( | |
* required=true, | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* @OA\Property( | |
* property="userID", | |
* description="userID", | |
* type="string", | |
* ), | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="NUBAN Account Successfully created" | |
* ), | |
* ) | |
* | |
**/ | |
//account opening modified by Tayo | |
//create new customer account | |
$app->post('/api/customer/new-account', function ($request, $response) { | |
$uploadedFiles = $request->getUploadedFiles(); | |
if (!empty($uploadedFiles)) { | |
foreach ($uploadedFiles as $key => $uploadedFile) { | |
// Validate each file | |
$validationResult = validateUploadedFile($uploadedFile); | |
if ($validationResult !== true) { | |
// die($validationResult); // Handle validation failure | |
return $response | |
->withStatus(400) | |
->withJson([ | |
'message' => 'Incorrect file type', | |
]); | |
} | |
} | |
} | |
$payload = array_merge( | |
[ | |
"files" => $request->getUploadedFiles(), | |
], | |
$request->getParsedBody() | |
); | |
// $payload = $request->getParsedBody(); | |
validate($payload, [ | |
'accountOpeningProduct' => [ | |
'rules' => V::notBlank(), | |
'message' => 'accountOpeningProduct is required' | |
], | |
'accountType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'accountType is required' | |
], | |
/* 'businessInvolvement' => [ | |
'rules' => V::notBlank(), | |
'message' => 'businessInvolvement is required' | |
], | |
'involvementType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'involvementType is required' | |
], */ | |
]); | |
if(strtoupper($payload['accountOpeningProduct']) != "REGISTRAR") | |
{ | |
validate($payload, [ | |
'businessInvolvement' => [ | |
'rules' => V::notBlank(), | |
'message' => 'businessInvolvement is required' | |
], | |
'involvementType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'involvementType is required' | |
], | |
]); | |
} | |
if(strtoupper($payload['accountOpeningProduct']) == "MF"){ | |
$payload['MF'] = 1; | |
$payload['BIZ'] = "MF"; | |
if(strtoupper($payload['accountType']) == "IND"){ //individual account | |
validate($payload, [ | |
"Title" => V::optional(v::stringType()), | |
"accountType" => V::in(['IND', 'CORP']), | |
"product" => V::notBlank()->stringType(), | |
"firstName" => V::notBlank()->stringType(), | |
"lastName" => V::notBlank()->stringType(), | |
"otherNames" => V::optional(v::stringType()), | |
"BVNFirstName" => V::notBlank()->stringType(), | |
"BVNLastName" => V::notBlank()->stringType(), | |
"BVNMiddleName" => V::optional(v::stringType()), | |
"BVNMiddleName" => V::optional(v::stringType()), | |
"gender" => V::in(['1', '2']), // | |
"dateOfBirth" => V::notBlank()->date('Y-m-d'), | |
"address" => V::notBlank()->stringType(), | |
"swiftCode" => V::optional(v::stringType()), | |
"city" => V::notBlank()->stringType(), | |
"country" =>V::notBlank()->stringType(), | |
//"residency" =>V::notBlank()->stringType(), | |
"state" => V::notBlank()->stringType(), | |
"LGA" => V::optional(v::stringType()), | |
"emailAddress" => V::notBlank()->stringType(), | |
"phoneNumber" => V::notBlank()->stringType(), | |
"politicallyExposed" => V::optional(v::stringType()), | |
"employmentType" => V::optional(v::stringType()), | |
"occupation" => V::optional(v::stringType()), | |
"bankAcctName" => V::notBlank(), | |
"bankAcctNumber" => V::notBlank(), | |
"bankName" => V::notBlank(), | |
"bankCode" => V::notBlank(), | |
"bankAcctName2" => V::optional(v::stringType()), | |
"bankAcctNumber2" => V::optional(v::stringType()), | |
"bankName2" => V::optional(v::stringType()), | |
"bankCode2" => V::optional(v::stringType()), | |
"BVNNumber" => V::notBlank(), | |
"referrer" => V::optional(v::stringType()), | |
"referralSource" => V::optional(v::stringType()), | |
"beneficiaryName" => V::optional(v::stringType()), | |
"beneficiaryAcctNo" => V::optional(v::stringType()), | |
"beneficiaryBankName" => V::optional(v::stringType()), | |
"beneficiaryBankAddress" => V::optional(v::stringType()), | |
"correspondentName" => V::optional(v::stringType()), | |
"correspondentAcctNo" => V::optional(v::stringType()), | |
"companyName" => V::optional(v::stringType()), | |
"nextOfKin" =>V::optional(v::stringType()), | |
"nextOfKinPhone" => V::optional(v::stringType()), | |
"nextOfKinEmail" =>V::optional(v::stringType()), | |
"nextOfKinAddress" => V::optional(v::stringType()), | |
"nextOfKinGender" => V::optional(v::stringType()), | |
"nextOfKinDOB" => V::optional(v::stringType()), | |
"nextOfKinRelationship" => V::optional(v::stringType()), | |
"identityType" =>V::optional(v::stringType()), | |
"identityNumber" => V::optional(v::stringType()), | |
"identityExpiryDate" => V::optional(v::stringType()), | |
"employerName"=> V::optional(v::stringType()), | |
"employerNo" => V::optional(v::stringType()), | |
"employerAddress" => V::optional(v::stringType()), | |
"sortCode" => V::optional(v::stringType()), | |
"previousCHN" => V::optional(v::stringType()), | |
"businessInvolvement" => V::notBlank(),//->arrayVal(), //optional | |
"involvementType" => V::notBlank(), | |
// "agreementCheck" => V::notBlank(), | |
"authorisedSignatureName"=> V::optional(v::stringType()), | |
]); | |
}elseif(strtoupper($payload['accountType']) == "CORP"){ //corporate account | |
validate($payload, [ | |
"Title" => V::optional(v::stringType()), | |
"accountType" => V::in(['IND', 'CORP']), | |
"product" => V::notBlank()->stringType(), | |
"firstName" => V::optional(v::stringType()), | |
"lastName" =>V::optional(v::stringType()), | |
"otherNames" => V::optional(v::stringType()), | |
"BVNFirstName" => V::notBlank()->stringType(), | |
"BVNLastName" => V::notBlank()->stringType(), | |
"BVNMiddleName" => V::optional(v::stringType()), | |
"city" => V::notBlank()->stringType(), | |
"country" => V::notBlank()->stringType(), | |
"dateOfBirth" => V::notBlank()->date('Y-m-d'), | |
"gender" => V::optional(v::stringType()), | |
"address" => V::notBlank()->stringType(), | |
"state" => V::notBlank()->stringType(), | |
"LGA" =>V::optional(v::stringType()), | |
"emailAddress" => V::optional(v::stringType()), | |
"phoneNumber" => V::optional(v::stringType()), | |
"politicallyExposed" => V::optional(v::stringType()), | |
"companyName" => V::notBlank(), | |
"employmentType" => V::optional(v::stringType()), | |
"occupation" => V::optional(v::stringType()), | |
"bankAcctName" => V::notBlank(), | |
"bankAcctNumber" => V::notBlank(), | |
"bankName" => V::notBlank(), | |
"bankCode" => V::notBlank(), | |
"BVNNumber" => V::notBlank(), | |
"referrer" => V::optional(v::stringType()), | |
"referralSource" => V::optional(v::stringType()), | |
"beneficiaryName" => V::optional(v::stringType()), | |
"beneficiaryAcctNo" => V::optional(v::stringType()), | |
"beneficiaryBankName" => V::optional(v::stringType()), | |
"beneficiaryBankAddress" => V::optional(v::stringType()), | |
"correspondentName" => V::optional(v::stringType()), | |
"correspondentAcctNo" => V::optional(v::stringType()), | |
"nextOfKin" => V::optional(v::stringType()), | |
"nextOfKinPhone" =>V::optional(v::stringType()), | |
"nextOfKinEmail" =>V::optional(v::stringType()), | |
"nextOfKinAddress" => V::optional(v::stringType()), | |
"nextOfKinGender" =>V::optional(v::stringType()), | |
"nextOfKinDOB" => V::optional(v::date('Y-m-d')), | |
"nextOfKinRelationship" => V::optional(v::stringType()), | |
"identityType" => V::optional(v::stringType()), | |
"identityNumber" => V::optional(v::stringType()), | |
"identityExpiryDate" =>V::optional(v::stringType()), | |
"employerName"=> V::optional(v::stringType()), | |
"employerNo" => V::optional(v::stringType()), | |
"employerAddress" => V::optional(v::stringType()), | |
"sortCode" => V::optional(v::stringType()), | |
"swiftCode" => V::optional(v::stringType()), | |
"RCNo" => V::notBlank(), | |
"incorporationDate" => V::notBlank()->date('Y-m-d'), //optional | |
"taxID" => V::optional(v::stringType()), | |
"previousCHN" => V::optional(v::stringType()), | |
// "businessInvolvement" => V::optional(v::stringType()), | |
"correspondentBankNo" => V::optional(v::stringType()), | |
"correspondentBankName" => V::optional(v::stringType()), | |
"businessInvolvement" => V::notBlank(),//->arrayVal(), //optional | |
"involvementType" => V::notBlank(), | |
"primaryContactName" => V::notBlank(), | |
"primaryContactPhone" => V::notBlank(), | |
"primaryContactEmail" => V::notBlank(), | |
"primaryContactDesignation" => V::notBlank(), | |
"secondaryContactName" => V::optional(v::stringType()), | |
"secondaryContactPhone" => V::optional(v::stringType()), | |
"secondaryContactEmail" => V::optional(v::stringType()), | |
"secondaryContactDesignation" => V::optional(v::stringType()), | |
// "agreementCheck" => V::notBlank(), | |
"authorisedSignatureName"=> V::optional(v::stringType()), | |
//"gender" =>V::optional(v::stringType()), | |
]); | |
} | |
}elseif(strtoupper($payload['accountOpeningProduct']) == "TROVE"){ | |
$payload['TROVE'] = 1; | |
$payload['BIZ'] = "TROVE"; | |
// if( $payload['accountType'] == "IND"){ //individual account | |
validate($payload, [ | |
"Title" => V::optional(v::stringType()), | |
"accountType" => V::in(['IND', 'CORP']), | |
"product" => V::notBlank()->stringType(), | |
"firstName" => V::notBlank()->stringType(), | |
"lastName" => V::notBlank()->stringType(), | |
"otherNames" => V::optional(v::stringType()), | |
"BVNFirstName" => V::notBlank()->stringType(), | |
"BVNLastName" => V::notBlank()->stringType(), | |
"BVNMiddleName" => V::optional(v::stringType()), | |
"gender" => V::in(['1', '2']), // | |
"dateOfBirth" => V::notBlank()->date('Y-m-d'), | |
"address" => V::notBlank()->stringType(), | |
"swiftCode" => V::optional(v::stringType()), | |
"city" => V::notBlank()->stringType(), | |
"country" =>V::notBlank()->stringType(), | |
//"residency" =>V::notBlank()->stringType(), | |
"state" => V::notBlank()->stringType(), | |
"LGA" => V::optional(v::stringType()), | |
"emailAddress" => V::notBlank()->stringType(), | |
"phoneNumber" => V::notBlank()->stringType(), | |
"politicallyExposed" => V::optional(v::stringType()), | |
"employmentType" => V::optional(v::stringType()), | |
"occupation" => V::optional(v::stringType()), | |
"bankAcctName" => V::optional(v::stringType()), | |
"bankAcctNumber" => V::optional(v::stringType()), | |
"bankName" => V::optional(v::stringType()), | |
"bankCode" => V::optional(v::stringType()), | |
"bankAcctName2" => V::optional(v::stringType()), | |
"bankAcctNumber2" => V::optional(v::stringType()), | |
"bankName2" => V::optional(v::stringType()), | |
"bankCode2" => V::optional(v::stringType()), | |
"BVNNumber" => V::notBlank(), | |
"referrer" => V::optional(v::stringType()), | |
"referralSource" => V::optional(v::stringType()), | |
"beneficiaryName" => V::optional(v::stringType()), | |
"beneficiaryAcctNo" => V::optional(v::stringType()), | |
"beneficiaryBankName" => V::optional(v::stringType()), | |
"beneficiaryBankAddress" => V::optional(v::stringType()), | |
"correspondentName" => V::optional(v::stringType()), | |
"correspondentAcctNo" => V::optional(v::stringType()), | |
"companyName" => V::optional(v::stringType()), | |
"nextOfKin" =>V::optional(v::stringType()), | |
"nextOfKinPhone" => V::optional(v::stringType()), | |
"nextOfKinEmail" =>V::optional(v::stringType()), | |
"nextOfKinAddress" => V::optional(v::stringType()), | |
"nextOfKinGender" => V::optional(v::stringType()), | |
"nextOfKinDOB" => V::optional(v::stringType()), | |
"nextOfKinRelationship" => V::optional(v::stringType()), | |
"identityType" =>V::optional(v::stringType()), | |
"identityNumber" => V::optional(v::stringType()), | |
"identityExpiryDate" => V::optional(v::stringType()), | |
"employerName"=> V::optional(v::stringType()), | |
"employerNo" => V::optional(v::stringType()), | |
"employerAddress" => V::optional(v::stringType()), | |
"sortCode" => V::optional(v::stringType()), | |
"previousCHN" => V::optional(v::stringType()), | |
// "businessInvolvement" => V::optional(v::stringType()), //optional | |
"businessInvolvement" => V::notBlank(),//->arrayVal(), //optional | |
"involvementType" => V::notBlank(), | |
// "agreementCheck" => V::notBlank(), | |
"authorisedSignatureName"=> V::optional(v::stringType()), | |
]); | |
}elseif(strtoupper($payload['accountOpeningProduct']) == "REGISTRAR" ){ | |
$payload['CSRL'] = 1; | |
$payload['BIZ'] = "CSRL"; | |
if(strtoupper($payload['accountType']) == "IND"){ //individual account | |
validate($payload, [ | |
"Title" => V::optional(v::stringType()), | |
"accountType" => V::in(['IND', 'CORP']), | |
"product" => V::notBlank()->stringType(), | |
"firstName" => V::notBlank()->stringType(), | |
"lastName" => V::notBlank()->stringType(), | |
"otherNames" => V::optional(v::stringType()), | |
// "BVNFirstName" => V::notBlank()->stringType(), | |
// "BVNLastName" => V::notBlank()->stringType(), | |
// "BVNMiddleName" => V::optional(v::stringType()), | |
"gender" => V::in(['1', '2']), // | |
"dateOfBirth" => V::notBlank()->date('Y-m-d'), | |
"address" => V::notBlank()->stringType(), | |
"swiftCode" => V::optional(v::stringType()), | |
// "city" => V::notBlank()->stringType(), | |
// "country" =>V::notBlank()->stringType(), | |
//"residency" =>V::notBlank()->stringType(), | |
// "state" => V::notBlank()->stringType(), | |
"LGA" => V::optional(v::stringType()), | |
"emailAddress" => V::notBlank()->stringType(), | |
"phoneNumber" => V::notBlank()->stringType(), | |
"politicallyExposed" => V::optional(v::stringType()), | |
"employmentType" => V::optional(v::stringType()), | |
"occupation" => V::optional(v::stringType()), | |
"bankAcctName" => V::optional(v::stringType()), | |
"bankAcctNumber" => V::optional(v::stringType()), | |
"bankName" =>V::optional(v::stringType()), | |
"bankCode" => V::optional(v::stringType()), | |
"bankAcctName2" => V::optional(v::stringType()), | |
"bankAcctNumber2" => V::optional(v::stringType()), | |
"bankName2" => V::optional(v::stringType()), | |
"bankCode2" => V::optional(v::stringType()), | |
"BVNNumber" => V::notBlank(), | |
"referrer" => V::optional(v::stringType()), | |
"referralSource" => V::optional(v::stringType()), | |
"beneficiaryName" => V::optional(v::stringType()), | |
"beneficiaryAcctNo" => V::optional(v::stringType()), | |
"beneficiaryBankName" => V::optional(v::stringType()), | |
"beneficiaryBankAddress" => V::optional(v::stringType()), | |
"correspondentName" => V::optional(v::stringType()), | |
"correspondentAcctNo" => V::optional(v::stringType()), | |
"companyName" => V::optional(v::stringType()), | |
"nextOfKin" =>V::optional(v::stringType()), | |
"nextOfKinPhone" => V::optional(v::stringType()), | |
"nextOfKinEmail" =>V::optional(v::stringType()), | |
"nextOfKinAddress" => V::optional(v::stringType()), | |
"nextOfKinGender" => V::optional(v::stringType()), | |
"nextOfKinDOB" => V::optional(v::stringType()), | |
"nextOfKinRelationship" => V::optional(v::stringType()), | |
"identityType" =>V::optional(v::stringType()), | |
"identityNumber" => V::optional(v::stringType()), | |
"identityExpiryDate" => V::optional(v::stringType()), | |
"employerName"=> V::optional(v::stringType()), | |
"employerNo" => V::optional(v::stringType()), | |
"employerAddress" => V::optional(v::stringType()), | |
"sortCode" => V::optional(v::stringType()), | |
"previousCHN" => V::optional(v::stringType()), | |
"businessInvolvement" => V::optional(v::stringType()), //optional | |
"involvementType" => V::optional(v::stringType()), | |
// "agreementCheck" => V::notBlank(), | |
"authorisedSignatureName"=> V::optional(v::stringType()), | |
]); | |
}elseif(strtoupper($payload['accountType']) == "CORP"){ //corporate account | |
$payload['gender'] = '1'; | |
$payload['dateOfBirth'] = $payload['incorporationDate']; | |
validate($payload, [ | |
"Title" => V::optional(v::stringType()), | |
"accountType" => V::in(['IND', 'CORP']), | |
"product" => V::notBlank()->stringType(), | |
"firstName" => V::optional(v::stringType()), | |
"lastName" =>V::optional(v::stringType()), | |
"otherNames" => V::optional(v::stringType()), | |
// "BVNFirstName" => V::notBlank()->stringType(), | |
// "BVNLastName" => V::notBlank()->stringType(), | |
// "BVNMiddleName" => V::optional(v::stringType()), | |
"gender" => V::in(['1', '2']), // | |
"dateOfBirth" => V::notBlank()->date('Y-m-d'), | |
"incorporationDate" => V::notBlank()->date('Y-m-d'), //optional | |
"RCNo" => V::optional(v::stringType()), | |
"address" => V::notBlank()->stringType(), | |
"swiftCode" => V::optional(v::stringType()), | |
// "city" => V::notBlank()->stringType(), | |
// "country" =>V::notBlank()->stringType(), | |
//"residency" =>V::notBlank()->stringType(), | |
// "state" => V::notBlank()->stringType(), | |
"LGA" => V::optional(v::stringType()), | |
"emailAddress" => V::notBlank()->stringType(), | |
"phoneNumber" => V::notBlank()->stringType(), | |
"politicallyExposed" => V::optional(v::stringType()), | |
"employmentType" => V::optional(v::stringType()), | |
"occupation" => V::optional(v::stringType()), | |
"bankAcctName" => V::optional(v::stringType()), | |
"bankAcctNumber" => V::optional(v::stringType()), | |
"bankName" =>V::optional(v::stringType()), | |
"bankCode" => V::optional(v::stringType()), | |
"bankAcctName2" => V::optional(v::stringType()), | |
"bankAcctNumber2" => V::optional(v::stringType()), | |
"bankName2" => V::optional(v::stringType()), | |
"bankCode2" => V::optional(v::stringType()), | |
"BVNNumber" => V::notBlank(), | |
"referrer" => V::optional(v::stringType()), | |
"referralSource" => V::optional(v::stringType()), | |
"beneficiaryName" => V::optional(v::stringType()), | |
"beneficiaryAcctNo" => V::optional(v::stringType()), | |
"beneficiaryBankName" => V::optional(v::stringType()), | |
"beneficiaryBankAddress" => V::optional(v::stringType()), | |
"correspondentName" => V::optional(v::stringType()), | |
"correspondentAcctNo" => V::optional(v::stringType()), | |
"companyName" => V::notBlank(), | |
"nextOfKin" =>V::optional(v::stringType()), | |
"nextOfKinPhone" => V::optional(v::stringType()), | |
"nextOfKinEmail" =>V::optional(v::stringType()), | |
"nextOfKinAddress" => V::optional(v::stringType()), | |
"nextOfKinGender" => V::optional(v::stringType()), | |
"nextOfKinDOB" => V::optional(v::stringType()), | |
"nextOfKinRelationship" => V::optional(v::stringType()), | |
"identityType" =>V::optional(v::stringType()), | |
"identityNumber" => V::optional(v::stringType()), | |
"identityExpiryDate" => V::optional(v::stringType()), | |
"employerName"=> V::optional(v::stringType()), | |
"employerNo" => V::optional(v::stringType()), | |
"employerAddress" => V::optional(v::stringType()), | |
"sortCode" => V::optional(v::stringType()), | |
"previousCHN" => V::optional(v::stringType()), | |
"businessInvolvement" => V::optional(v::stringType()), //optional | |
"involvementType" => V::optional(v::stringType()), | |
// "agreementCheck" => V::notBlank(), | |
"authorisedSignatureName"=> V::optional(v::stringType()), | |
]); | |
} | |
}elseif(strtoupper($payload['accountOpeningProduct']) == "STK" ){ | |
$payload['CSS'] = 1; | |
$payload['BIZ'] = "CSS"; | |
if(strtoupper($payload['accountType']) == "IND"){ | |
validate($payload, [ | |
"Title" => V::optional(v::stringType()),// V::notBlank()->stringType(), | |
"accountType" => V::in(['IND', 'CORP']), | |
"product" => V::notBlank()->stringType(), | |
// "USMarket" => V::in([true, false]), | |
"firstName" => V::notBlank()->stringType(), | |
"lastName" => V::notBlank()->stringType(), | |
"otherNames" => V::optional(v::stringType()), | |
"BVNFirstName" => V::notBlank()->stringType(), | |
"BVNLastName" => V::notBlank()->stringType(), | |
"BVNMiddleName" => V::optional(v::stringType()), | |
"maidenName" => V::optional(v::stringType()), | |
"gender" => V::in(['1', '2']), | |
"dateOfBirth" => V::notBlank()->date('Y-m-d'), | |
"address" => V::notBlank()->stringType(), | |
"swiftCode" => V::optional(v::stringType()), | |
"city" => V::notBlank()->stringType(), | |
"country" => V::notBlank(), | |
//"residency" =>V::notBlank()->stringType(), | |
"state" => V::notBlank()->stringType(), | |
"LGA" => V::notBlank()->stringType(), | |
"emailAddress" => V::notBlank()->stringType(), | |
"phoneNumber" => V::optional(v::stringType()), | |
"politicallyExposed" => V::optional(v::stringType()),//V::notBlank(), | |
"employmentType" => V::optional(v::stringType()),//V::notBlank()->stringType(), | |
"occupation" => V::optional(v::stringType()), | |
"bankAcctName" => V::notBlank(), | |
"bankAcctNumber" => V::notBlank(), | |
"bankName" => V::notBlank(), | |
"bankCode" => V::notBlank(), | |
"bankAcctName2" => V::optional(v::stringType()), | |
"bankAcctNumber2" => V::optional(v::stringType()), | |
"bankName2" => V::optional(v::stringType()), | |
"bankCode2" => V::optional(v::stringType()), | |
"BVNNumber" => V::notBlank(), | |
"referrer" => V::optional(v::stringType()), | |
"referralSource" => V::optional(v::stringType()), | |
"beneficiaryName" => V::optional(v::stringType()), | |
"beneficiaryAcctNo" => V::optional(v::stringType()), | |
"beneficiaryBankName" => V::optional(v::stringType()), | |
"beneficiaryBankAddress" => V::optional(v::stringType()), | |
"correspondentName" => V::optional(v::stringType()), | |
"correspondentAcctNo" => V::optional(v::stringType()), | |
"companyName" => V::optional(v::stringType()), | |
"nextOfKin" => V::notBlank(), | |
"nextOfKinPhone" => V::optional(v::stringType()),//V::notBlank(), | |
"nextOfKinEmail" => V::optional(v::stringType()),//V::notBlank(), | |
"nextOfKinAddress" => V::optional(v::stringType()),// V::notBlank(), | |
"nextOfKinGender" => V::optional(v::stringType()),// V::notBlank(), | |
"nextOfKinDOB" => V::optional(v::stringType()),//V::notBlank()->date('Y-m-d'), | |
"nextOfKinRelationship" => V::optional(v::stringType()),//V::notBlank(), | |
"identityType" => V::optional(v::stringType()),//V::notBlank(), | |
"identityNumber" => V::optional(v::stringType()),//V::notBlank(), | |
"identityExpiryDate" => V::optional(v::stringType()),// V::notBlank()->date('Y-m-d'), | |
"employerName"=> V::optional(v::stringType()), | |
"employerNo" => V::optional(v::stringType()), | |
"employerAddress" => V::optional(v::stringType()), | |
"sortCode" => V::optional(v::stringType()), | |
"previousCHN" => V::optional(v::stringType()), | |
"businessInvolvement" => V::notBlank(),//->arrayVal(), //optional | |
"involvementType" => V::notBlank(),//->arrayVal(), // V::optional(v::arrayVal()), | |
"authorisedSignatureName"=> V::notBlank() | |
]); | |
}elseif(strtoupper($payload['accountType']) == "CORP"){ | |
validate($payload, [ | |
"Title" => V::optional(v::stringType()), | |
"accountType" => V::in(['IND', 'CORP']), | |
"product" => V::notBlank()->stringType(), | |
// "USMarket" => V::notBlank()->stringType(), | |
"firstName" => V::optional(v::stringType()), | |
"lastName" =>V::optional(v::stringType()), | |
"otherNames" => V::optional(v::stringType()), | |
"BVNFirstName" => V::notBlank()->stringType(), | |
"BVNLastName" => V::notBlank()->stringType(), | |
"BVNMiddleName" => V::optional(v::stringType()), | |
"city" => V::notBlank()->stringType(), | |
"country" => V::notBlank()->stringType(), | |
"dateOfBirth" => V::notBlank()->date('Y-m-d'), | |
"gender" =>V::optional(v::stringType()), | |
"address" => V::notBlank()->stringType(), | |
"state" => V::notBlank()->stringType(), | |
"LGA" => V::notBlank()->stringType(), | |
"emailAddress" => V::optional(v::stringType()),//V::notBlank()->stringType(), | |
"PhoneNumber" => V::optional(v::stringType()), | |
"politicallyExposed" =>V::optional(v::stringType()), | |
"companyName" => V::notBlank(), | |
"employmentType" => V::optional(v::stringType()), | |
"occupation" => V::optional(v::stringType()), | |
"bankAcctName" => V::notBlank(), | |
"bankAcctNumber" => V::notBlank(), | |
"bankName" => V::notBlank(), | |
"bankCode" => V::notBlank(), | |
"BVNNumber" => V::notBlank(), | |
"referrer" => V::optional(v::stringType()), | |
"referralSource" => V::optional(v::stringType()), | |
"beneficiaryName" => V::optional(v::stringType()), | |
"beneficiaryAcctNo" => V::optional(v::stringType()), | |
"beneficiaryBankName" => V::optional(v::stringType()), | |
"beneficiaryBankAddress" => V::optional(v::stringType()), | |
"correspondentName" => V::optional(v::stringType()), | |
"correspondentAcctNo" => V::optional(v::stringType()), | |
"nextOfKin" => V::optional(v::stringType()), | |
"nextOfKinPhone" =>V::optional(v::stringType()), | |
"nextOfKinEmail" =>V::optional(v::stringType()), | |
"nextOfKinAddress" => V::optional(v::stringType()), | |
"nextOfKinGender" =>V::optional(v::stringType()), | |
"nextOfKinDOB" => V::optional(v::date('Y-m-d')), | |
"nextOfKinRelationship" => V::optional(v::stringType()), | |
"identityType" => V::optional(v::stringType()),//V::notBlank(), | |
"identityNumber" => V::optional(v::stringType()),//V::notBlank(), | |
"identityExpiryDate" => V::optional(v::stringType()),//V::notBlank()->date('Y-m-d'), | |
"employerName"=> V::optional(v::stringType()), | |
"employerNo" => V::optional(v::stringType()), | |
"employerAddress" => V::optional(v::stringType()), | |
"sortCode" => V::optional(v::stringType()), | |
"swiftCode" => V::optional(v::stringType()), | |
"RCNo" => V::optional(v::stringType()), | |
"incorporationDate" => V::notBlank()->date('Y-m-d'), //optional | |
"taxID" => V::optional(v::stringType()), | |
"previousCHN" => V::optional(v::stringType()), | |
// "businessInvolvement" => V::optional(v::stringType()), | |
"correspondentBankNo" => V::optional(v::stringType()), | |
"correspondentBankName" => V::optional(v::stringType()), | |
"businessInvolvement" => V::notBlank(),//->arrayVal(), //optional | |
"involvementType" => V::notBlank(),//->arrayVal(), | |
// 'involvementTypeBusiness' => V::notBlank(),//->arrayVal(), | |
"primaryContactName" => V::optional(v::stringType()), | |
"primaryContactPhone" => V::optional(v::stringType()), | |
"primaryContactEmail" => V::optional(v::stringType()), | |
"primaryContactDesignation" => V::optional(v::stringType()), | |
"secondaryContactName" => V::optional(v::stringType()), | |
"secondaryContactPhone" => V::optional(v::stringType()), | |
"secondaryContactEmail" => V::optional(v::stringType()), | |
"secondaryContactDesignation" => V::optional(v::stringType()), | |
"authorisedSignatureName"=> V::notBlank(), | |
"identityDocument"=> V::optional(v::stringType()),//V::notBlank(), | |
"passport"=> V::optional(v::stringType()),//V::notBlank(), | |
"signature"=> V::optional(v::stringType()),//V::notBlank(), | |
"certificateOfIncoporation"=> V::optional(v::stringType()),//V::notBlank(), | |
"CACDocuments"=> V::optional(v::stringType()),//V::notBlank(), | |
"memorandomAndArticleOfIncorporation"=> V::optional(v::stringType()),//V::notBlank(), | |
]); | |
} | |
}elseif(strtoupper($payload['accountOpeningProduct']) == "MGIN" ){ | |
$payload['MGIN'] = 1; | |
$payload['BIZ'] = "MGIN"; | |
if(strtoupper($payload['accountType']) == "IND"){ | |
validate($payload, [ | |
"Title" => V::optional(v::stringType()),// V::notBlank()->stringType(), | |
"accountType" => V::in(['IND', 'CORP']), | |
"product" => V::notBlank()->stringType(), | |
// "USMarket" => V::in([true, false]), | |
"firstName" => V::notBlank()->stringType(), | |
"lastName" => V::notBlank()->stringType(), | |
"otherNames" => V::optional(v::stringType()), | |
"BVNFirstName" => V::notBlank()->stringType(), | |
"BVNLastName" => V::notBlank()->stringType(), | |
"BVNMiddleName" => V::optional(v::stringType()), | |
"maidenName" => V::optional(v::stringType()), | |
"gender" => V::in(['1', '2']), | |
"dateOfBirth" => V::notBlank()->date('Y-m-d'), | |
"address" => V::notBlank()->stringType(), | |
"swiftCode" => V::optional(v::stringType()), | |
"city" => V::notBlank()->stringType(), | |
"country" => V::notBlank(), | |
//"residency" =>V::notBlank()->stringType(), | |
"state" => V::notBlank()->stringType(), | |
"LGA" => V::notBlank()->stringType(), | |
"emailAddress" => V::notBlank()->stringType(), | |
"phoneNumber" => V::optional(v::stringType()), | |
"politicallyExposed" => V::optional(v::stringType()),//V::notBlank(), | |
"employmentType" => V::optional(v::stringType()),//V::notBlank()->stringType(), | |
"occupation" => V::optional(v::stringType()), | |
"bankAcctName" => V::notBlank(), | |
"bankAcctNumber" => V::notBlank(), | |
"bankName" => V::notBlank(), | |
"bankCode" => V::notBlank(), | |
"bankAcctName2" => V::optional(v::stringType()), | |
"bankAcctNumber2" => V::optional(v::stringType()), | |
"bankName2" => V::optional(v::stringType()), | |
"bankCode2" => V::optional(v::stringType()), | |
"BVNNumber" => V::notBlank(), | |
"referrer" => V::optional(v::stringType()), | |
"referralSource" => V::optional(v::stringType()), | |
"beneficiaryName" => V::optional(v::stringType()), | |
"beneficiaryAcctNo" => V::optional(v::stringType()), | |
"beneficiaryBankName" => V::optional(v::stringType()), | |
"beneficiaryBankAddress" => V::optional(v::stringType()), | |
"correspondentName" => V::optional(v::stringType()), | |
"correspondentAcctNo" => V::optional(v::stringType()), | |
"companyName" => V::optional(v::stringType()), | |
"nextOfKin" => V::notBlank(), | |
"nextOfKinPhone" => V::optional(v::stringType()),//V::notBlank(), | |
"nextOfKinEmail" => V::optional(v::stringType()),//V::notBlank(), | |
"nextOfKinAddress" => V::optional(v::stringType()),// V::notBlank(), | |
"nextOfKinGender" => V::optional(v::stringType()),// V::notBlank(), | |
"nextOfKinDOB" => V::optional(v::stringType()),//V::notBlank()->date('Y-m-d'), | |
"nextOfKinRelationship" => V::optional(v::stringType()),//V::notBlank(), | |
"identityType" => V::optional(v::stringType()),//V::notBlank(), | |
"identityNumber" => V::optional(v::stringType()),//V::notBlank(), | |
"identityExpiryDate" => V::optional(v::stringType()),// V::notBlank()->date('Y-m-d'), | |
"employerName"=> V::optional(v::stringType()), | |
"employerNo" => V::optional(v::stringType()), | |
"employerAddress" => V::optional(v::stringType()), | |
"sortCode" => V::optional(v::stringType()), | |
"previousCHN" => V::optional(v::stringType()), | |
"businessInvolvement" => V::notBlank(),//->arrayVal(), //optional | |
"involvementType" => V::notBlank(),//->arrayVal(), // V::optional(v::arrayVal()), | |
"authorisedSignatureName"=> V::notBlank() | |
]); | |
}elseif(strtoupper($payload['accountType']) == "CORP"){ | |
validate($payload, [ | |
"Title" => V::optional(v::stringType()), | |
"accountType" => V::in(['IND', 'CORP']), | |
"product" => V::notBlank()->stringType(), | |
// "USMarket" => V::notBlank()->stringType(), | |
"firstName" => V::optional(v::stringType()), | |
"lastName" =>V::optional(v::stringType()), | |
"otherNames" => V::optional(v::stringType()), | |
"BVNFirstName" => V::notBlank()->stringType(), | |
"BVNLastName" => V::notBlank()->stringType(), | |
"BVNMiddleName" => V::optional(v::stringType()), | |
"city" => V::notBlank()->stringType(), | |
"country" => V::notBlank()->stringType(), | |
"dateOfBirth" => V::notBlank()->date('Y-m-d'), | |
"gender" =>V::optional(v::stringType()), | |
"address" => V::notBlank()->stringType(), | |
"state" => V::notBlank()->stringType(), | |
"LGA" => V::notBlank()->stringType(), | |
"emailAddress" => V::optional(v::stringType()),//V::notBlank()->stringType(), | |
"PhoneNumber" => V::optional(v::stringType()), | |
"politicallyExposed" =>V::optional(v::stringType()), | |
"companyName" => V::notBlank(), | |
"employmentType" => V::optional(v::stringType()), | |
"occupation" => V::optional(v::stringType()), | |
"bankAcctName" => V::notBlank(), | |
"bankAcctNumber" => V::notBlank(), | |
"bankName" => V::notBlank(), | |
"bankCode" => V::notBlank(), | |
"BVNNumber" => V::notBlank(), | |
"referrer" => V::optional(v::stringType()), | |
"referralSource" => V::optional(v::stringType()), | |
"beneficiaryName" => V::optional(v::stringType()), | |
"beneficiaryAcctNo" => V::optional(v::stringType()), | |
"beneficiaryBankName" => V::optional(v::stringType()), | |
"beneficiaryBankAddress" => V::optional(v::stringType()), | |
"correspondentName" => V::optional(v::stringType()), | |
"correspondentAcctNo" => V::optional(v::stringType()), | |
"nextOfKin" => V::optional(v::stringType()), | |
"nextOfKinPhone" =>V::optional(v::stringType()), | |
"nextOfKinEmail" =>V::optional(v::stringType()), | |
"nextOfKinAddress" => V::optional(v::stringType()), | |
"nextOfKinGender" =>V::optional(v::stringType()), | |
"nextOfKinDOB" => V::optional(v::date('Y-m-d')), | |
"nextOfKinRelationship" => V::optional(v::stringType()), | |
"identityType" => V::optional(v::stringType()),//V::notBlank(), | |
"identityNumber" => V::optional(v::stringType()),//V::notBlank(), | |
"identityExpiryDate" => V::optional(v::stringType()),//V::notBlank()->date('Y-m-d'), | |
"employerName"=> V::optional(v::stringType()), | |
"employerNo" => V::optional(v::stringType()), | |
"employerAddress" => V::optional(v::stringType()), | |
"sortCode" => V::optional(v::stringType()), | |
"swiftCode" => V::optional(v::stringType()), | |
"RCNo" => V::optional(v::stringType()), | |
"incorporationDate" => V::notBlank()->date('Y-m-d'), //optional | |
"taxID" => V::optional(v::stringType()), | |
"previousCHN" => V::optional(v::stringType()), | |
// "businessInvolvement" => V::optional(v::stringType()), | |
"correspondentBankNo" => V::optional(v::stringType()), | |
"correspondentBankName" => V::optional(v::stringType()), | |
"businessInvolvement" => V::notBlank(),//->arrayVal(), //optional | |
"involvementType" => V::notBlank(),//->arrayVal(), | |
// 'involvementTypeBusiness' => V::notBlank(),//->arrayVal(), | |
"primaryContactName" => V::optional(v::stringType()), | |
"primaryContactPhone" => V::optional(v::stringType()), | |
"primaryContactEmail" => V::optional(v::stringType()), | |
"primaryContactDesignation" => V::optional(v::stringType()), | |
"secondaryContactName" => V::optional(v::stringType()), | |
"secondaryContactPhone" => V::optional(v::stringType()), | |
"secondaryContactEmail" => V::optional(v::stringType()), | |
"secondaryContactDesignation" => V::optional(v::stringType()), | |
"authorisedSignatureName"=> V::notBlank(), | |
"identityDocument"=> V::optional(v::stringType()),//V::notBlank(), | |
"passport"=> V::optional(v::stringType()),//V::notBlank(), | |
"signature"=> V::optional(v::stringType()),//V::notBlank(), | |
"certificateOfIncoporation"=> V::optional(v::stringType()),//V::notBlank(), | |
"CACDocuments"=> V::optional(v::stringType()),//V::notBlank(), | |
"memorandomAndArticleOfIncorporation"=> V::optional(v::stringType()),//V::notBlank(), | |
]); | |
} | |
}elseif(strtoupper($payload['accountOpeningProduct']) == "CAM" ){ | |
$payload['CAM'] = 1; | |
$payload['BIZ'] = "CAM"; | |
if(strtoupper($payload['accountType']) == "IND"){ | |
validate($payload, [ | |
"Title" => V::optional(v::stringType()),// V::notBlank()->stringType(), | |
"accountType" => V::in(['IND', 'CORP']), | |
"product" => V::notBlank()->stringType(), | |
// "USMarket" => V::in([true, false]), | |
"firstName" => V::notBlank()->stringType(), | |
"lastName" => V::notBlank()->stringType(), | |
"otherNames" => V::optional(v::stringType()), | |
"BVNFirstName" => V::notBlank()->stringType(), | |
"BVNLastName" => V::notBlank()->stringType(), | |
"BVNMiddleName" => V::optional(v::stringType()), | |
"maidenName" => V::optional(v::stringType()), | |
"gender" => V::in(['1', '2']), | |
"dateOfBirth" => V::notBlank()->date('Y-m-d'), | |
"address" => V::notBlank()->stringType(), | |
"swiftCode" => V::optional(v::stringType()), | |
"city" => V::notBlank()->stringType(), | |
"country" => V::notBlank(), | |
//"residency" =>V::notBlank()->stringType(), | |
"state" => V::notBlank()->stringType(), | |
"LGA" => V::notBlank()->stringType(), | |
"emailAddress" => V::notBlank()->stringType(), | |
"phoneNumber" => V::optional(v::stringType()), | |
"politicallyExposed" => V::optional(v::stringType()),//V::notBlank(), | |
"employmentType" => V::optional(v::stringType()),//V::notBlank()->stringType(), | |
"occupation" => V::optional(v::stringType()), | |
"bankAcctName" => V::notBlank(), | |
"bankAcctNumber" => V::notBlank(), | |
"bankName" => V::notBlank(), | |
"bankCode" => V::notBlank(), | |
"bankAcctName2" => V::optional(v::stringType()), | |
"bankAcctNumber2" => V::optional(v::stringType()), | |
"bankName2" => V::optional(v::stringType()), | |
"bankCode2" => V::optional(v::stringType()), | |
"BVNNumber" => V::notBlank(), | |
"referrer" => V::optional(v::stringType()), | |
"referralSource" => V::optional(v::stringType()), | |
"beneficiaryName" => V::optional(v::stringType()), | |
"beneficiaryAcctNo" => V::optional(v::stringType()), | |
"beneficiaryBankName" => V::optional(v::stringType()), | |
"beneficiaryBankAddress" => V::optional(v::stringType()), | |
"correspondentName" => V::optional(v::stringType()), | |
"correspondentAcctNo" => V::optional(v::stringType()), | |
"companyName" => V::optional(v::stringType()), | |
"nextOfKin" => V::notBlank(), | |
"nextOfKinPhone" => V::optional(v::stringType()),//V::notBlank(), | |
"nextOfKinEmail" => V::optional(v::stringType()),//V::notBlank(), | |
"nextOfKinAddress" => V::optional(v::stringType()),// V::notBlank(), | |
"nextOfKinGender" => V::optional(v::stringType()),// V::notBlank(), | |
"nextOfKinDOB" => V::optional(v::stringType()),//V::notBlank()->date('Y-m-d'), | |
"nextOfKinRelationship" => V::optional(v::stringType()),//V::notBlank(), | |
"identityType" => V::optional(v::stringType()),//V::notBlank(), | |
"identityNumber" => V::optional(v::stringType()),//V::notBlank(), | |
"identityExpiryDate" => V::optional(v::stringType()),// V::notBlank()->date('Y-m-d'), | |
"employerName"=> V::optional(v::stringType()), | |
"employerNo" => V::optional(v::stringType()), | |
"employerAddress" => V::optional(v::stringType()), | |
"sortCode" => V::optional(v::stringType()), | |
"previousCHN" => V::optional(v::stringType()), | |
"businessInvolvement" => V::notBlank(),//->arrayVal(), //optional | |
"involvementType" => V::notBlank(),//->arrayVal(), // V::optional(v::arrayVal()), | |
"authorisedSignatureName"=> V::notBlank() | |
]); | |
}else if(strtoupper($payload['accountType']) == "CORP"){ | |
validate($payload, [ | |
"Title" => V::optional(v::stringType()), | |
"accountType" => V::in(['IND', 'CORP']), | |
"product" => V::notBlank()->stringType(), | |
// "USMarket" => V::notBlank()->stringType(), | |
"firstName" => V::optional(v::stringType()), | |
"lastName" =>V::optional(v::stringType()), | |
"otherNames" => V::optional(v::stringType()), | |
"BVNFirstName" => V::notBlank()->stringType(), | |
"BVNLastName" => V::notBlank()->stringType(), | |
"BVNMiddleName" => V::optional(v::stringType()), | |
"city" => V::notBlank()->stringType(), | |
"country" => V::notBlank()->stringType(), | |
"dateOfBirth" => V::notBlank()->date('Y-m-d'), | |
"gender" =>V::optional(v::stringType()), | |
"address" => V::notBlank()->stringType(), | |
"state" => V::notBlank()->stringType(), | |
"LGA" => V::notBlank()->stringType(), | |
"emailAddress" => V::optional(v::stringType()),//V::notBlank()->stringType(), | |
"PhoneNumber" => V::optional(v::stringType()), | |
"politicallyExposed" =>V::optional(v::stringType()), | |
"companyName" => V::notBlank(), | |
"employmentType" => V::optional(v::stringType()), | |
"occupation" => V::optional(v::stringType()), | |
"bankAcctName" => V::notBlank(), | |
"bankAcctNumber" => V::notBlank(), | |
"bankName" => V::notBlank(), | |
"bankCode" => V::notBlank(), | |
"BVNNumber" => V::notBlank(), | |
"referrer" => V::optional(v::stringType()), | |
"referralSource" => V::optional(v::stringType()), | |
"beneficiaryName" => V::optional(v::stringType()), | |
"beneficiaryAcctNo" => V::optional(v::stringType()), | |
"beneficiaryBankName" => V::optional(v::stringType()), | |
"beneficiaryBankAddress" => V::optional(v::stringType()), | |
"correspondentName" => V::optional(v::stringType()), | |
"correspondentAcctNo" => V::optional(v::stringType()), | |
"nextOfKin" => V::optional(v::stringType()), | |
"nextOfKinPhone" =>V::optional(v::stringType()), | |
"nextOfKinEmail" =>V::optional(v::stringType()), | |
"nextOfKinAddress" => V::optional(v::stringType()), | |
"nextOfKinGender" =>V::optional(v::stringType()), | |
"nextOfKinDOB" => V::optional(v::date('Y-m-d')), | |
"nextOfKinRelationship" => V::optional(v::stringType()), | |
"identityType" => V::optional(v::stringType()),//V::notBlank(), | |
"identityNumber" => V::optional(v::stringType()),//V::notBlank(), | |
"identityExpiryDate" => V::optional(v::stringType()),//V::notBlank()->date('Y-m-d'), | |
"employerName"=> V::optional(v::stringType()), | |
"employerNo" => V::optional(v::stringType()), | |
"employerAddress" => V::optional(v::stringType()), | |
"sortCode" => V::optional(v::stringType()), | |
"swiftCode" => V::optional(v::stringType()), | |
"RCNo" => V::optional(v::stringType()), | |
"incorporationDate" => V::notBlank()->date('Y-m-d'), //optional | |
"taxID" => V::optional(v::stringType()), | |
"previousCHN" => V::optional(v::stringType()), | |
// "businessInvolvement" => V::optional(v::stringType()), | |
"correspondentBankNo" => V::optional(v::stringType()), | |
"correspondentBankName" => V::optional(v::stringType()), | |
"businessInvolvement" => V::notBlank(),//->arrayVal(), //optional | |
"involvementType" => V::notBlank(),//->arrayVal(), | |
// 'involvementTypeBusiness' => V::notBlank(),//->arrayVal(), | |
"primaryContactName" => V::optional(v::stringType()), | |
"primaryContactPhone" => V::optional(v::stringType()), | |
"primaryContactEmail" => V::optional(v::stringType()), | |
"primaryContactDesignation" => V::optional(v::stringType()), | |
"secondaryContactName" => V::optional(v::stringType()), | |
"secondaryContactPhone" => V::optional(v::stringType()), | |
"secondaryContactEmail" => V::optional(v::stringType()), | |
"secondaryContactDesignation" => V::optional(v::stringType()), | |
"authorisedSignatureName"=> V::notBlank(), | |
"identityDocument"=> V::optional(v::stringType()),//V::notBlank(), | |
"passport"=> V::optional(v::stringType()),//V::notBlank(), | |
"signature"=> V::optional(v::stringType()),//V::notBlank(), | |
"certificateOfIncoporation"=> V::optional(v::stringType()),//V::notBlank(), | |
"CACDocuments"=> V::optional(v::stringType()),//V::notBlank(), | |
"memorandomAndArticleOfIncorporation"=> V::optional(v::stringType()),//V::notBlank(), | |
]); | |
} | |
}elseif(strtoupper($payload['accountOpeningProduct']) == "SMA" ){ | |
$payload['SMA'] = 1; | |
$payload['BIZ'] = "SMA"; | |
if(strtoupper($payload['accountType']) == "IND"){ | |
validate($payload, [ | |
"Title" => V::optional(v::stringType()),// V::notBlank()->stringType(), | |
"accountType" => V::in(['IND', 'CORP']), | |
"product" => V::notBlank()->stringType(), | |
// "USMarket" => V::in([true, false]), | |
"firstName" => V::notBlank()->stringType(), | |
"lastName" => V::notBlank()->stringType(), | |
"otherNames" => V::optional(v::stringType()), | |
"BVNFirstName" => V::notBlank()->stringType(), | |
"BVNLastName" => V::notBlank()->stringType(), | |
"BVNMiddleName" => V::optional(v::stringType()), | |
"maidenName" => V::optional(v::stringType()), | |
"gender" => V::in(['1', '2']), | |
"dateOfBirth" => V::notBlank()->date('Y-m-d'), | |
"address" => V::notBlank()->stringType(), | |
"swiftCode" => V::optional(v::stringType()), | |
"city" => V::notBlank()->stringType(), | |
"country" => V::notBlank(), | |
//"residency" =>V::notBlank()->stringType(), | |
"state" => V::notBlank()->stringType(), | |
"LGA" => V::notBlank()->stringType(), | |
"emailAddress" => V::notBlank()->stringType(), | |
"phoneNumber" => V::optional(v::stringType()), | |
"politicallyExposed" => V::optional(v::stringType()),//V::notBlank(), | |
"employmentType" => V::optional(v::stringType()),//V::notBlank()->stringType(), | |
"occupation" => V::optional(v::stringType()), | |
"bankAcctName" => V::notBlank(), | |
"bankAcctNumber" => V::notBlank(), | |
"bankName" => V::notBlank(), | |
"bankCode" => V::notBlank(), | |
"bankAcctName2" => V::optional(v::stringType()), | |
"bankAcctNumber2" => V::optional(v::stringType()), | |
"bankName2" => V::optional(v::stringType()), | |
"bankCode2" => V::optional(v::stringType()), | |
"BVNNumber" => V::notBlank(), | |
"referrer" => V::optional(v::stringType()), | |
"referralSource" => V::optional(v::stringType()), | |
"beneficiaryName" => V::optional(v::stringType()), | |
"beneficiaryAcctNo" => V::optional(v::stringType()), | |
"beneficiaryBankName" => V::optional(v::stringType()), | |
"beneficiaryBankAddress" => V::optional(v::stringType()), | |
"correspondentName" => V::optional(v::stringType()), | |
"correspondentAcctNo" => V::optional(v::stringType()), | |
"companyName" => V::optional(v::stringType()), | |
"nextOfKin" => V::notBlank(), | |
"nextOfKinPhone" => V::optional(v::stringType()),//V::notBlank(), | |
"nextOfKinEmail" => V::optional(v::stringType()),//V::notBlank(), | |
"nextOfKinAddress" => V::optional(v::stringType()),// V::notBlank(), | |
"nextOfKinGender" => V::optional(v::stringType()),// V::notBlank(), | |
"nextOfKinDOB" => V::optional(v::stringType()),//V::notBlank()->date('Y-m-d'), | |
"nextOfKinRelationship" => V::optional(v::stringType()),//V::notBlank(), | |
"identityType" => V::optional(v::stringType()),//V::notBlank(), | |
"identityNumber" => V::optional(v::stringType()),//V::notBlank(), | |
"identityExpiryDate" => V::optional(v::stringType()),// V::notBlank()->date('Y-m-d'), | |
"employerName"=> V::optional(v::stringType()), | |
"employerNo" => V::optional(v::stringType()), | |
"employerAddress" => V::optional(v::stringType()), | |
"sortCode" => V::optional(v::stringType()), | |
"previousCHN" => V::optional(v::stringType()), | |
"businessInvolvement" => V::notBlank(),//->arrayVal(), //optional | |
"involvementType" => V::notBlank(),//->arrayVal(), // V::optional(v::arrayVal()), | |
"authorisedSignatureName"=> V::notBlank() | |
]); | |
}else if(strtoupper($payload['accountType']) == "CORP"){ | |
validate($payload, [ | |
"Title" => V::optional(v::stringType()), | |
"accountType" => V::in(['IND', 'CORP']), | |
"product" => V::notBlank()->stringType(), | |
// "USMarket" => V::notBlank()->stringType(), | |
"firstName" => V::optional(v::stringType()), | |
"lastName" =>V::optional(v::stringType()), | |
"otherNames" => V::optional(v::stringType()), | |
"BVNFirstName" => V::notBlank()->stringType(), | |
"BVNLastName" => V::notBlank()->stringType(), | |
"BVNMiddleName" => V::optional(v::stringType()), | |
"city" => V::notBlank()->stringType(), | |
"country" => V::notBlank()->stringType(), | |
"dateOfBirth" => V::notBlank()->date('Y-m-d'), | |
"gender" =>V::optional(v::stringType()), | |
"address" => V::notBlank()->stringType(), | |
"state" => V::notBlank()->stringType(), | |
"LGA" => V::notBlank()->stringType(), | |
"emailAddress" => V::optional(v::stringType()),//V::notBlank()->stringType(), | |
"PhoneNumber" => V::optional(v::stringType()), | |
"politicallyExposed" =>V::optional(v::stringType()), | |
"companyName" => V::notBlank(), | |
"employmentType" => V::optional(v::stringType()), | |
"occupation" => V::optional(v::stringType()), | |
"bankAcctName" => V::notBlank(), | |
"bankAcctNumber" => V::notBlank(), | |
"bankName" => V::notBlank(), | |
"bankCode" => V::notBlank(), | |
"BVNNumber" => V::notBlank(), | |
"referrer" => V::optional(v::stringType()), | |
"referralSource" => V::optional(v::stringType()), | |
"beneficiaryName" => V::optional(v::stringType()), | |
"beneficiaryAcctNo" => V::optional(v::stringType()), | |
"beneficiaryBankName" => V::optional(v::stringType()), | |
"beneficiaryBankAddress" => V::optional(v::stringType()), | |
"correspondentName" => V::optional(v::stringType()), | |
"correspondentAcctNo" => V::optional(v::stringType()), | |
"nextOfKin" => V::optional(v::stringType()), | |
"nextOfKinPhone" =>V::optional(v::stringType()), | |
"nextOfKinEmail" =>V::optional(v::stringType()), | |
"nextOfKinAddress" => V::optional(v::stringType()), | |
"nextOfKinGender" =>V::optional(v::stringType()), | |
"nextOfKinDOB" => V::optional(v::date('Y-m-d')), | |
"nextOfKinRelationship" => V::optional(v::stringType()), | |
"identityType" => V::optional(v::stringType()),//V::notBlank(), | |
"identityNumber" => V::optional(v::stringType()),//V::notBlank(), | |
"identityExpiryDate" => V::optional(v::stringType()),//V::notBlank()->date('Y-m-d'), | |
"employerName"=> V::optional(v::stringType()), | |
"employerNo" => V::optional(v::stringType()), | |
"employerAddress" => V::optional(v::stringType()), | |
"sortCode" => V::optional(v::stringType()), | |
"swiftCode" => V::optional(v::stringType()), | |
"RCNo" => V::optional(v::stringType()), | |
"incorporationDate" => V::notBlank()->date('Y-m-d'), //optional | |
"taxID" => V::optional(v::stringType()), | |
"previousCHN" => V::optional(v::stringType()), | |
// "businessInvolvement" => V::optional(v::stringType()), | |
"correspondentBankNo" => V::optional(v::stringType()), | |
"correspondentBankName" => V::optional(v::stringType()), | |
"businessInvolvement" => V::notBlank(),//->arrayVal(), //optional | |
"involvementType" => V::notBlank(),//->arrayVal(), | |
// 'involvementTypeBusiness' => V::notBlank(),//->arrayVal(), | |
"primaryContactName" => V::optional(v::stringType()), | |
"primaryContactPhone" => V::optional(v::stringType()), | |
"primaryContactEmail" => V::optional(v::stringType()), | |
"primaryContactDesignation" => V::optional(v::stringType()), | |
"secondaryContactName" => V::optional(v::stringType()), | |
"secondaryContactPhone" => V::optional(v::stringType()), | |
"secondaryContactEmail" => V::optional(v::stringType()), | |
"secondaryContactDesignation" => V::optional(v::stringType()), | |
"authorisedSignatureName"=> V::notBlank(), | |
"identityDocument"=> V::optional(v::stringType()),//V::notBlank(), | |
"passport"=> V::optional(v::stringType()),//V::notBlank(), | |
"signature"=> V::optional(v::stringType()),//V::notBlank(), | |
"certificateOfIncoporation"=> V::optional(v::stringType()),//V::notBlank(), | |
"CACDocuments"=> V::optional(v::stringType()),//V::notBlank(), | |
"memorandomAndArticleOfIncorporation"=> V::optional(v::stringType()),//V::notBlank(), | |
]); | |
} | |
}elseif(strtoupper($payload['accountOpeningProduct']) == "CST" ){ | |
$payload['CST'] = 1; | |
$payload['BIZ'] = "CST"; | |
if(strtoupper($payload['accountType']) == "IND"){ | |
validate($payload, [ | |
"Title" => V::optional(v::stringType()),// V::notBlank()->stringType(), | |
"accountType" => V::in(['IND', 'CORP']), | |
"product" => V::notBlank()->stringType(), | |
// "USMarket" => V::in([true, false]), | |
"firstName" => V::notBlank()->stringType(), | |
"lastName" => V::notBlank()->stringType(), | |
"otherNames" => V::optional(v::stringType()), | |
"BVNFirstName" => V::notBlank()->stringType(), | |
"BVNLastName" => V::notBlank()->stringType(), | |
"BVNMiddleName" => V::optional(v::stringType()), | |
"maidenName" => V::optional(v::stringType()), | |
"gender" => V::in(['1', '2']), | |
"dateOfBirth" => V::notBlank()->date('Y-m-d'), | |
"address" => V::notBlank()->stringType(), | |
"swiftCode" => V::optional(v::stringType()), | |
"city" => V::notBlank()->stringType(), | |
"country" => V::notBlank(), | |
//"residency" =>V::notBlank()->stringType(), | |
"state" => V::notBlank()->stringType(), | |
"LGA" => V::notBlank()->stringType(), | |
"emailAddress" => V::notBlank()->stringType(), | |
"phoneNumber" => V::optional(v::stringType()), | |
"politicallyExposed" => V::optional(v::stringType()),//V::notBlank(), | |
"employmentType" => V::optional(v::stringType()),//V::notBlank()->stringType(), | |
"occupation" => V::optional(v::stringType()), | |
"bankAcctName" => V::notBlank(), | |
"bankAcctNumber" => V::notBlank(), | |
"bankName" => V::notBlank(), | |
"bankCode" => V::notBlank(), | |
"bankAcctName2" => V::optional(v::stringType()), | |
"bankAcctNumber2" => V::optional(v::stringType()), | |
"bankName2" => V::optional(v::stringType()), | |
"bankCode2" => V::optional(v::stringType()), | |
"BVNNumber" => V::notBlank(), | |
"referrer" => V::optional(v::stringType()), | |
"referralSource" => V::optional(v::stringType()), | |
"beneficiaryName" => V::optional(v::stringType()), | |
"beneficiaryAcctNo" => V::optional(v::stringType()), | |
"beneficiaryBankName" => V::optional(v::stringType()), | |
"beneficiaryBankAddress" => V::optional(v::stringType()), | |
"correspondentName" => V::optional(v::stringType()), | |
"correspondentAcctNo" => V::optional(v::stringType()), | |
"companyName" => V::optional(v::stringType()), | |
"nextOfKin" => V::notBlank(), | |
"nextOfKinPhone" => V::optional(v::stringType()),//V::notBlank(), | |
"nextOfKinEmail" => V::optional(v::stringType()),//V::notBlank(), | |
"nextOfKinAddress" => V::optional(v::stringType()),// V::notBlank(), | |
"nextOfKinGender" => V::optional(v::stringType()),// V::notBlank(), | |
"nextOfKinDOB" => V::optional(v::stringType()),//V::notBlank()->date('Y-m-d'), | |
"nextOfKinRelationship" => V::optional(v::stringType()),//V::notBlank(), | |
"identityType" => V::optional(v::stringType()),//V::notBlank(), | |
"identityNumber" => V::optional(v::stringType()),//V::notBlank(), | |
"identityExpiryDate" => V::optional(v::stringType()),// V::notBlank()->date('Y-m-d'), | |
"employerName"=> V::optional(v::stringType()), | |
"employerNo" => V::optional(v::stringType()), | |
"employerAddress" => V::optional(v::stringType()), | |
"sortCode" => V::optional(v::stringType()), | |
"previousCHN" => V::optional(v::stringType()), | |
"businessInvolvement" => V::notBlank(),//->arrayVal(), //optional | |
"involvementType" => V::notBlank(),//->arrayVal(), // V::optional(v::arrayVal()), | |
"authorisedSignatureName"=> V::notBlank() | |
]); | |
}else if(strtoupper($payload['accountType']) == "CORP"){ | |
validate($payload, [ | |
"Title" => V::optional(v::stringType()), | |
"accountType" => V::in(['IND', 'CORP']), | |
"product" => V::notBlank()->stringType(), | |
// "USMarket" => V::notBlank()->stringType(), | |
"firstName" => V::optional(v::stringType()), | |
"lastName" =>V::optional(v::stringType()), | |
"otherNames" => V::optional(v::stringType()), | |
"BVNFirstName" => V::notBlank()->stringType(), | |
"BVNLastName" => V::notBlank()->stringType(), | |
"BVNMiddleName" => V::optional(v::stringType()), | |
"city" => V::notBlank()->stringType(), | |
"country" => V::notBlank()->stringType(), | |
"dateOfBirth" => V::notBlank()->date('Y-m-d'), | |
"gender" =>V::optional(v::stringType()), | |
"address" => V::notBlank()->stringType(), | |
"state" => V::notBlank()->stringType(), | |
"LGA" => V::notBlank()->stringType(), | |
"emailAddress" => V::optional(v::stringType()),//V::notBlank()->stringType(), | |
"PhoneNumber" => V::optional(v::stringType()), | |
"politicallyExposed" =>V::optional(v::stringType()), | |
"companyName" => V::notBlank(), | |
"employmentType" => V::optional(v::stringType()), | |
"occupation" => V::optional(v::stringType()), | |
"bankAcctName" => V::notBlank(), | |
"bankAcctNumber" => V::notBlank(), | |
"bankName" => V::notBlank(), | |
"bankCode" => V::notBlank(), | |
"BVNNumber" => V::notBlank(), | |
"referrer" => V::optional(v::stringType()), | |
"referralSource" => V::optional(v::stringType()), | |
"beneficiaryName" => V::optional(v::stringType()), | |
"beneficiaryAcctNo" => V::optional(v::stringType()), | |
"beneficiaryBankName" => V::optional(v::stringType()), | |
"beneficiaryBankAddress" => V::optional(v::stringType()), | |
"correspondentName" => V::optional(v::stringType()), | |
"correspondentAcctNo" => V::optional(v::stringType()), | |
"nextOfKin" => V::optional(v::stringType()), | |
"nextOfKinPhone" =>V::optional(v::stringType()), | |
"nextOfKinEmail" =>V::optional(v::stringType()), | |
"nextOfKinAddress" => V::optional(v::stringType()), | |
"nextOfKinGender" =>V::optional(v::stringType()), | |
"nextOfKinDOB" => V::optional(v::date('Y-m-d')), | |
"nextOfKinRelationship" => V::optional(v::stringType()), | |
"identityType" => V::optional(v::stringType()),//V::notBlank(), | |
"identityNumber" => V::optional(v::stringType()),//V::notBlank(), | |
"identityExpiryDate" => V::optional(v::stringType()),//V::notBlank()->date('Y-m-d'), | |
"employerName"=> V::optional(v::stringType()), | |
"employerNo" => V::optional(v::stringType()), | |
"employerAddress" => V::optional(v::stringType()), | |
"sortCode" => V::optional(v::stringType()), | |
"swiftCode" => V::optional(v::stringType()), | |
"RCNo" => V::optional(v::stringType()), | |
"incorporationDate" => V::notBlank()->date('Y-m-d'), //optional | |
"taxID" => V::optional(v::stringType()), | |
"previousCHN" => V::optional(v::stringType()), | |
// "businessInvolvement" => V::optional(v::stringType()), | |
"correspondentBankNo" => V::optional(v::stringType()), | |
"correspondentBankName" => V::optional(v::stringType()), | |
"businessInvolvement" => V::notBlank(),//->arrayVal(), //optional | |
"involvementType" => V::notBlank(),//->arrayVal(), | |
// 'involvementTypeBusiness' => V::notBlank(),//->arrayVal(), | |
"primaryContactName" => V::optional(v::stringType()), | |
"primaryContactPhone" => V::optional(v::stringType()), | |
"primaryContactEmail" => V::optional(v::stringType()), | |
"primaryContactDesignation" => V::optional(v::stringType()), | |
"secondaryContactName" => V::optional(v::stringType()), | |
"secondaryContactPhone" => V::optional(v::stringType()), | |
"secondaryContactEmail" => V::optional(v::stringType()), | |
"secondaryContactDesignation" => V::optional(v::stringType()), | |
"authorisedSignatureName"=> V::notBlank(), | |
"identityDocument"=> V::optional(v::stringType()),//V::notBlank(), | |
"passport"=> V::optional(v::stringType()),//V::notBlank(), | |
"signature"=> V::optional(v::stringType()),//V::notBlank(), | |
"certificateOfIncoporation"=> V::optional(v::stringType()),//V::notBlank(), | |
"CACDocuments"=> V::optional(v::stringType()),//V::notBlank(), | |
"memorandomAndArticleOfIncorporation"=> V::optional(v::stringType()),//V::notBlank(), | |
]); | |
} | |
}else{} | |
// $payload["USMarket"] = (boolean)$payload["USMarket"]; | |
/* if (!contains_value($payload['businessInvolvement'])) { | |
$payload['businessInvolvement'] = [MIDDLEWARE_DB_NAME]; | |
} | |
if (is_string($payload['businessInvolvement'])) { | |
// $payload['businessInvolvement'] = explode(',', $payload['businessInvolvement']); | |
$payload['businessInvolvement'] = (array_map('trim',array_filter(explode(',',$payload['businessInvolvement'])))); | |
} */ | |
//using this involvementTypeBusiness to create the product on involvementType | |
/* if (is_string($payload['involvementType'])) { | |
$payload['involvementType'] = (array_map('trim',array_filter(explode(',',$payload['involvementType'])))); | |
} */ | |
/* if (is_string($payload['involvementTypeBusiness'])) { | |
$payload['involvementTypeBusiness'] = (array_map('trim',array_filter(explode(',',$payload['involvementTypeBusiness'])))); | |
} */ | |
$payload['check-dc'] = false; | |
$data = container('FreshsalesRequest')->createContact($payload); | |
$result = $this->customerModel->newAccount($payload); | |
$payload['CustID'] = $result['CustID']; | |
$payload['CRMID'] = $data['Id']; | |
$updateCustomerData = $this->customerModel->updateCRMID($payload); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'data' => $result['message'], | |
'CustID' => $result['CustID'], | |
]); | |
}); | |
$app->post('/api/yochaa/customer/new-account', function ($request, $response) { | |
$payload = array_merge( | |
[ | |
"files" => $request->getUploadedFiles(), | |
], | |
$request->getParsedBody() | |
); | |
$payload['partner'] = 1; | |
validate($payload, [ | |
'accountOpeningProduct' => [ | |
'rules' => V::notBlank(), | |
'message' => 'accountOpeningProduct is required' | |
], | |
'accountType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'accountType is required' | |
], | |
/* 'businessInvolvement' => [ | |
'rules' => V::notBlank(), | |
'message' => 'businessInvolvement is required' | |
], | |
'involvementType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'involvementType is required' | |
], */ | |
]); | |
if(strtoupper($payload['accountOpeningProduct']) != "REGISTRAR") | |
{ | |
validate($payload, [ | |
'businessInvolvement' => [ | |
'rules' => V::notBlank(), | |
'message' => 'businessInvolvement is required' | |
], | |
'involvementType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'involvementType is required' | |
], | |
]); | |
} | |
if(strtoupper($payload['accountOpeningProduct']) == "MF"){ | |
$payload['MF'] = 1; | |
$payload['BIZ'] = "MF"; | |
if(strtoupper($payload['accountType']) == "IND"){ //individual account | |
validate($payload, [ | |
"Title" => V::optional(v::stringType()), | |
"accountType" => V::in(['IND', 'CORP']), | |
"product" => V::notBlank()->stringType(), | |
"firstName" => V::notBlank()->stringType(), | |
"lastName" => V::notBlank()->stringType(), | |
"otherNames" => V::optional(v::stringType()), | |
"BVNFirstName" => V::notBlank()->stringType(), | |
"BVNLastName" => V::notBlank()->stringType(), | |
"BVNMiddleName" => V::optional(v::stringType()), | |
"BVNMiddleName" => V::optional(v::stringType()), | |
"gender" => V::in(['1', '2']), // | |
"dateOfBirth" => V::notBlank()->date('Y-m-d'), | |
"address" => V::notBlank()->stringType(), | |
"swiftCode" => V::optional(v::stringType()), | |
"city" => V::notBlank()->stringType(), | |
"country" =>V::notBlank()->stringType(), | |
//"residency" =>V::notBlank()->stringType(), | |
"state" => V::notBlank()->stringType(), | |
"LGA" => V::optional(v::stringType()), | |
"emailAddress" => V::notBlank()->stringType(), | |
"phoneNumber" => V::notBlank()->stringType(), | |
"politicallyExposed" => V::optional(v::stringType()), | |
"employmentType" => V::optional(v::stringType()), | |
"occupation" => V::optional(v::stringType()), | |
"bankAcctName" => V::notBlank(), | |
"bankAcctNumber" => V::notBlank(), | |
"bankName" => V::notBlank(), | |
"bankCode" => V::notBlank(), | |
"bankAcctName2" => V::optional(v::stringType()), | |
"bankAcctNumber2" => V::optional(v::stringType()), | |
"bankName2" => V::optional(v::stringType()), | |
"bankCode2" => V::optional(v::stringType()), | |
"BVNNumber" => V::notBlank(), | |
"referrer" => V::optional(v::stringType()), | |
"referralSource" => V::optional(v::stringType()), | |
"beneficiaryName" => V::optional(v::stringType()), | |
"beneficiaryAcctNo" => V::optional(v::stringType()), | |
"beneficiaryBankName" => V::optional(v::stringType()), | |
"beneficiaryBankAddress" => V::optional(v::stringType()), | |
"correspondentName" => V::optional(v::stringType()), | |
"correspondentAcctNo" => V::optional(v::stringType()), | |
"companyName" => V::optional(v::stringType()), | |
"nextOfKin" =>V::optional(v::stringType()), | |
"nextOfKinPhone" => V::optional(v::stringType()), | |
"nextOfKinEmail" =>V::optional(v::stringType()), | |
"nextOfKinAddress" => V::optional(v::stringType()), | |
"nextOfKinGender" => V::optional(v::stringType()), | |
"nextOfKinDOB" => V::optional(v::stringType()), | |
"nextOfKinRelationship" => V::optional(v::stringType()), | |
"identityType" =>V::optional(v::stringType()), | |
"identityNumber" => V::optional(v::stringType()), | |
"identityExpiryDate" => V::optional(v::stringType()), | |
"employerName"=> V::optional(v::stringType()), | |
"employerNo" => V::optional(v::stringType()), | |
"employerAddress" => V::optional(v::stringType()), | |
"sortCode" => V::optional(v::stringType()), | |
"previousCHN" => V::optional(v::stringType()), | |
"businessInvolvement" => V::notBlank(),//->arrayVal(), //optional | |
"involvementType" => V::notBlank(), | |
// "agreementCheck" => V::notBlank(), | |
"authorisedSignatureName"=> V::optional(v::stringType()), | |
]); | |
}elseif(strtoupper($payload['accountType']) == "CORP"){ //corporate account | |
validate($payload, [ | |
"Title" => V::optional(v::stringType()), | |
"accountType" => V::in(['IND', 'CORP']), | |
"product" => V::notBlank()->stringType(), | |
"firstName" => V::optional(v::stringType()), | |
"lastName" =>V::optional(v::stringType()), | |
"otherNames" => V::optional(v::stringType()), | |
"BVNFirstName" => V::notBlank()->stringType(), | |
"BVNLastName" => V::notBlank()->stringType(), | |
"BVNMiddleName" => V::optional(v::stringType()), | |
"city" => V::notBlank()->stringType(), | |
"country" => V::notBlank()->stringType(), | |
"dateOfBirth" => V::notBlank()->date('Y-m-d'), | |
"gender" => V::optional(v::stringType()), | |
"address" => V::notBlank()->stringType(), | |
"state" => V::notBlank()->stringType(), | |
"LGA" =>V::optional(v::stringType()), | |
"emailAddress" => V::optional(v::stringType()), | |
"phoneNumber" => V::optional(v::stringType()), | |
"politicallyExposed" => V::optional(v::stringType()), | |
"companyName" => V::notBlank(), | |
"employmentType" => V::optional(v::stringType()), | |
"occupation" => V::optional(v::stringType()), | |
"bankAcctName" => V::notBlank(), | |
"bankAcctNumber" => V::notBlank(), | |
"bankName" => V::notBlank(), | |
"bankCode" => V::notBlank(), | |
"BVNNumber" => V::notBlank(), | |
"referrer" => V::optional(v::stringType()), | |
"referralSource" => V::optional(v::stringType()), | |
"beneficiaryName" => V::optional(v::stringType()), | |
"beneficiaryAcctNo" => V::optional(v::stringType()), | |
"beneficiaryBankName" => V::optional(v::stringType()), | |
"beneficiaryBankAddress" => V::optional(v::stringType()), | |
"correspondentName" => V::optional(v::stringType()), | |
"correspondentAcctNo" => V::optional(v::stringType()), | |
"nextOfKin" => V::optional(v::stringType()), | |
"nextOfKinPhone" =>V::optional(v::stringType()), | |
"nextOfKinEmail" =>V::optional(v::stringType()), | |
"nextOfKinAddress" => V::optional(v::stringType()), | |
"nextOfKinGender" =>V::optional(v::stringType()), | |
"nextOfKinDOB" => V::optional(v::date('Y-m-d')), | |
"nextOfKinRelationship" => V::optional(v::stringType()), | |
"identityType" => V::optional(v::stringType()), | |
"identityNumber" => V::optional(v::stringType()), | |
"identityExpiryDate" =>V::optional(v::stringType()), | |
"employerName"=> V::optional(v::stringType()), | |
"employerNo" => V::optional(v::stringType()), | |
"employerAddress" => V::optional(v::stringType()), | |
"sortCode" => V::optional(v::stringType()), | |
"swiftCode" => V::optional(v::stringType()), | |
"RCNo" => V::notBlank(), | |
"incorporationDate" => V::notBlank()->date('Y-m-d'), //optional | |
"taxID" => V::optional(v::stringType()), | |
"previousCHN" => V::optional(v::stringType()), | |
// "businessInvolvement" => V::optional(v::stringType()), | |
"correspondentBankNo" => V::optional(v::stringType()), | |
"correspondentBankName" => V::optional(v::stringType()), | |
"businessInvolvement" => V::notBlank(),//->arrayVal(), //optional | |
"involvementType" => V::notBlank(), | |
"primaryContactName" => V::notBlank(), | |
"primaryContactPhone" => V::notBlank(), | |
"primaryContactEmail" => V::notBlank(), | |
"primaryContactDesignation" => V::notBlank(), | |
"secondaryContactName" => V::optional(v::stringType()), | |
"secondaryContactPhone" => V::optional(v::stringType()), | |
"secondaryContactEmail" => V::optional(v::stringType()), | |
"secondaryContactDesignation" => V::optional(v::stringType()), | |
// "agreementCheck" => V::notBlank(), | |
"authorisedSignatureName"=> V::optional(v::stringType()), | |
//"gender" =>V::optional(v::stringType()), | |
]); | |
} | |
}elseif(strtoupper($payload['accountOpeningProduct']) == "TROVE"){ | |
$payload['TROVE'] = 1; | |
$payload['BIZ'] = "TROVE"; | |
// if( $payload['accountType'] == "IND"){ //individual account | |
validate($payload, [ | |
"Title" => V::optional(v::stringType()), | |
"accountType" => V::in(['IND', 'CORP']), | |
"product" => V::notBlank()->stringType(), | |
"firstName" => V::notBlank()->stringType(), | |
"lastName" => V::notBlank()->stringType(), | |
"otherNames" => V::optional(v::stringType()), | |
"BVNFirstName" => V::notBlank()->stringType(), | |
"BVNLastName" => V::notBlank()->stringType(), | |
"BVNMiddleName" => V::optional(v::stringType()), | |
"gender" => V::in(['1', '2']), // | |
"dateOfBirth" => V::notBlank()->date('Y-m-d'), | |
"address" => V::notBlank()->stringType(), | |
"swiftCode" => V::optional(v::stringType()), | |
"city" => V::notBlank()->stringType(), | |
"country" =>V::notBlank()->stringType(), | |
//"residency" =>V::notBlank()->stringType(), | |
"state" => V::notBlank()->stringType(), | |
"LGA" => V::optional(v::stringType()), | |
"emailAddress" => V::notBlank()->stringType(), | |
"phoneNumber" => V::notBlank()->stringType(), | |
"politicallyExposed" => V::optional(v::stringType()), | |
"employmentType" => V::optional(v::stringType()), | |
"occupation" => V::optional(v::stringType()), | |
"bankAcctName" => V::optional(v::stringType()), | |
"bankAcctNumber" => V::optional(v::stringType()), | |
"bankName" => V::optional(v::stringType()), | |
"bankCode" => V::optional(v::stringType()), | |
"bankAcctName2" => V::optional(v::stringType()), | |
"bankAcctNumber2" => V::optional(v::stringType()), | |
"bankName2" => V::optional(v::stringType()), | |
"bankCode2" => V::optional(v::stringType()), | |
"BVNNumber" => V::notBlank(), | |
"referrer" => V::optional(v::stringType()), | |
"referralSource" => V::optional(v::stringType()), | |
"beneficiaryName" => V::optional(v::stringType()), | |
"beneficiaryAcctNo" => V::optional(v::stringType()), | |
"beneficiaryBankName" => V::optional(v::stringType()), | |
"beneficiaryBankAddress" => V::optional(v::stringType()), | |
"correspondentName" => V::optional(v::stringType()), | |
"correspondentAcctNo" => V::optional(v::stringType()), | |
"companyName" => V::optional(v::stringType()), | |
"nextOfKin" =>V::optional(v::stringType()), | |
"nextOfKinPhone" => V::optional(v::stringType()), | |
"nextOfKinEmail" =>V::optional(v::stringType()), | |
"nextOfKinAddress" => V::optional(v::stringType()), | |
"nextOfKinGender" => V::optional(v::stringType()), | |
"nextOfKinDOB" => V::optional(v::stringType()), | |
"nextOfKinRelationship" => V::optional(v::stringType()), | |
"identityType" =>V::optional(v::stringType()), | |
"identityNumber" => V::optional(v::stringType()), | |
"identityExpiryDate" => V::optional(v::stringType()), | |
"employerName"=> V::optional(v::stringType()), | |
"employerNo" => V::optional(v::stringType()), | |
"employerAddress" => V::optional(v::stringType()), | |
"sortCode" => V::optional(v::stringType()), | |
"previousCHN" => V::optional(v::stringType()), | |
// "businessInvolvement" => V::optional(v::stringType()), //optional | |
"businessInvolvement" => V::notBlank(),//->arrayVal(), //optional | |
"involvementType" => V::notBlank(), | |
// "agreementCheck" => V::notBlank(), | |
"authorisedSignatureName"=> V::optional(v::stringType()), | |
]); | |
}elseif(strtoupper($payload['accountOpeningProduct']) == "REGISTRAR" ){ | |
$payload['CSRL'] = 1; | |
$payload['BIZ'] = "CSRL"; | |
if(strtoupper($payload['accountType']) == "IND"){ //individual account | |
validate($payload, [ | |
"Title" => V::optional(v::stringType()), | |
"accountType" => V::in(['IND', 'CORP']), | |
"product" => V::notBlank()->stringType(), | |
"firstName" => V::notBlank()->stringType(), | |
"lastName" => V::notBlank()->stringType(), | |
"otherNames" => V::optional(v::stringType()), | |
// "BVNFirstName" => V::notBlank()->stringType(), | |
// "BVNLastName" => V::notBlank()->stringType(), | |
// "BVNMiddleName" => V::optional(v::stringType()), | |
"gender" => V::in(['1', '2']), // | |
"dateOfBirth" => V::notBlank()->date('Y-m-d'), | |
"address" => V::notBlank()->stringType(), | |
"swiftCode" => V::optional(v::stringType()), | |
// "city" => V::notBlank()->stringType(), | |
// "country" =>V::notBlank()->stringType(), | |
//"residency" =>V::notBlank()->stringType(), | |
// "state" => V::notBlank()->stringType(), | |
"LGA" => V::optional(v::stringType()), | |
"emailAddress" => V::notBlank()->stringType(), | |
"phoneNumber" => V::notBlank()->stringType(), | |
"politicallyExposed" => V::optional(v::stringType()), | |
"employmentType" => V::optional(v::stringType()), | |
"occupation" => V::optional(v::stringType()), | |
"bankAcctName" => V::optional(v::stringType()), | |
"bankAcctNumber" => V::optional(v::stringType()), | |
"bankName" =>V::optional(v::stringType()), | |
"bankCode" => V::optional(v::stringType()), | |
"bankAcctName2" => V::optional(v::stringType()), | |
"bankAcctNumber2" => V::optional(v::stringType()), | |
"bankName2" => V::optional(v::stringType()), | |
"bankCode2" => V::optional(v::stringType()), | |
"BVNNumber" => V::notBlank(), | |
"referrer" => V::optional(v::stringType()), | |
"referralSource" => V::optional(v::stringType()), | |
"beneficiaryName" => V::optional(v::stringType()), | |
"beneficiaryAcctNo" => V::optional(v::stringType()), | |
"beneficiaryBankName" => V::optional(v::stringType()), | |
"beneficiaryBankAddress" => V::optional(v::stringType()), | |
"correspondentName" => V::optional(v::stringType()), | |
"correspondentAcctNo" => V::optional(v::stringType()), | |
"companyName" => V::optional(v::stringType()), | |
"nextOfKin" =>V::optional(v::stringType()), | |
"nextOfKinPhone" => V::optional(v::stringType()), | |
"nextOfKinEmail" =>V::optional(v::stringType()), | |
"nextOfKinAddress" => V::optional(v::stringType()), | |
"nextOfKinGender" => V::optional(v::stringType()), | |
"nextOfKinDOB" => V::optional(v::stringType()), | |
"nextOfKinRelationship" => V::optional(v::stringType()), | |
"identityType" =>V::optional(v::stringType()), | |
"identityNumber" => V::optional(v::stringType()), | |
"identityExpiryDate" => V::optional(v::stringType()), | |
"employerName"=> V::optional(v::stringType()), | |
"employerNo" => V::optional(v::stringType()), | |
"employerAddress" => V::optional(v::stringType()), | |
"sortCode" => V::optional(v::stringType()), | |
"previousCHN" => V::optional(v::stringType()), | |
"businessInvolvement" => V::optional(v::stringType()), //optional | |
"involvementType" => V::optional(v::stringType()), | |
// "agreementCheck" => V::notBlank(), | |
"authorisedSignatureName"=> V::optional(v::stringType()), | |
]); | |
}elseif(strtoupper($payload['accountType']) == "CORP"){ //corporate account | |
$payload['gender'] = '1'; | |
$payload['dateOfBirth'] = $payload['incorporationDate']; | |
validate($payload, [ | |
"Title" => V::optional(v::stringType()), | |
"accountType" => V::in(['IND', 'CORP']), | |
"product" => V::notBlank()->stringType(), | |
"firstName" => V::optional(v::stringType()), | |
"lastName" =>V::optional(v::stringType()), | |
"otherNames" => V::optional(v::stringType()), | |
// "BVNFirstName" => V::notBlank()->stringType(), | |
// "BVNLastName" => V::notBlank()->stringType(), | |
// "BVNMiddleName" => V::optional(v::stringType()), | |
"gender" => V::in(['1', '2']), // | |
"dateOfBirth" => V::notBlank()->date('Y-m-d'), | |
"incorporationDate" => V::notBlank()->date('Y-m-d'), //optional | |
"RCNo" => V::optional(v::stringType()), | |
"address" => V::notBlank()->stringType(), | |
"swiftCode" => V::optional(v::stringType()), | |
// "city" => V::notBlank()->stringType(), | |
// "country" =>V::notBlank()->stringType(), | |
//"residency" =>V::notBlank()->stringType(), | |
// "state" => V::notBlank()->stringType(), | |
"LGA" => V::optional(v::stringType()), | |
"emailAddress" => V::notBlank()->stringType(), | |
"phoneNumber" => V::notBlank()->stringType(), | |
"politicallyExposed" => V::optional(v::stringType()), | |
"employmentType" => V::optional(v::stringType()), | |
"occupation" => V::optional(v::stringType()), | |
"bankAcctName" => V::optional(v::stringType()), | |
"bankAcctNumber" => V::optional(v::stringType()), | |
"bankName" =>V::optional(v::stringType()), | |
"bankCode" => V::optional(v::stringType()), | |
"bankAcctName2" => V::optional(v::stringType()), | |
"bankAcctNumber2" => V::optional(v::stringType()), | |
"bankName2" => V::optional(v::stringType()), | |
"bankCode2" => V::optional(v::stringType()), | |
"BVNNumber" => V::notBlank(), | |
"referrer" => V::optional(v::stringType()), | |
"referralSource" => V::optional(v::stringType()), | |
"beneficiaryName" => V::optional(v::stringType()), | |
"beneficiaryAcctNo" => V::optional(v::stringType()), | |
"beneficiaryBankName" => V::optional(v::stringType()), | |
"beneficiaryBankAddress" => V::optional(v::stringType()), | |
"correspondentName" => V::optional(v::stringType()), | |
"correspondentAcctNo" => V::optional(v::stringType()), | |
"companyName" => V::notBlank(), | |
"nextOfKin" =>V::optional(v::stringType()), | |
"nextOfKinPhone" => V::optional(v::stringType()), | |
"nextOfKinEmail" =>V::optional(v::stringType()), | |
"nextOfKinAddress" => V::optional(v::stringType()), | |
"nextOfKinGender" => V::optional(v::stringType()), | |
"nextOfKinDOB" => V::optional(v::stringType()), | |
"nextOfKinRelationship" => V::optional(v::stringType()), | |
"identityType" =>V::optional(v::stringType()), | |
"identityNumber" => V::optional(v::stringType()), | |
"identityExpiryDate" => V::optional(v::stringType()), | |
"employerName"=> V::optional(v::stringType()), | |
"employerNo" => V::optional(v::stringType()), | |
"employerAddress" => V::optional(v::stringType()), | |
"sortCode" => V::optional(v::stringType()), | |
"previousCHN" => V::optional(v::stringType()), | |
"businessInvolvement" => V::optional(v::stringType()), //optional | |
"involvementType" => V::optional(v::stringType()), | |
// "agreementCheck" => V::notBlank(), | |
"authorisedSignatureName"=> V::optional(v::stringType()), | |
]); | |
} | |
}elseif(strtoupper($payload['accountOpeningProduct']) == "STK" ){ | |
$payload['CSS'] = 1; | |
$payload['BIZ'] = "CSS"; | |
if(strtoupper($payload['accountType']) == "IND"){ | |
validate($payload, [ | |
"Title" => V::optional(v::stringType()),// V::notBlank()->stringType(), | |
"accountType" => V::in(['IND', 'CORP']), | |
"product" => V::notBlank()->stringType(), | |
// "USMarket" => V::in([true, false]), | |
"firstName" => V::notBlank()->stringType(), | |
"lastName" => V::notBlank()->stringType(), | |
"otherNames" => V::optional(v::stringType()), | |
"BVNFirstName" => V::notBlank()->stringType(), | |
"BVNLastName" => V::notBlank()->stringType(), | |
"BVNMiddleName" => V::optional(v::stringType()), | |
"maidenName" => V::optional(v::stringType()), | |
"gender" => V::in(['1', '2']), | |
"dateOfBirth" => V::notBlank()->date('Y-m-d'), | |
"address" => V::notBlank()->stringType(), | |
"swiftCode" => V::optional(v::stringType()), | |
"city" => V::notBlank()->stringType(), | |
"country" => V::notBlank(), | |
//"residency" =>V::notBlank()->stringType(), | |
"state" => V::notBlank()->stringType(), | |
"LGA" => V::notBlank()->stringType(), | |
"emailAddress" => V::notBlank()->stringType(), | |
"phoneNumber" => V::optional(v::stringType()), | |
"politicallyExposed" => V::optional(v::stringType()),//V::notBlank(), | |
"employmentType" => V::optional(v::stringType()),//V::notBlank()->stringType(), | |
"occupation" => V::optional(v::stringType()), | |
"bankAcctName" => V::notBlank(), | |
"bankAcctNumber" => V::notBlank(), | |
"bankName" => V::notBlank(), | |
"bankCode" => V::notBlank(), | |
"bankAcctName2" => V::optional(v::stringType()), | |
"bankAcctNumber2" => V::optional(v::stringType()), | |
"bankName2" => V::optional(v::stringType()), | |
"bankCode2" => V::optional(v::stringType()), | |
"BVNNumber" => V::notBlank(), | |
"referrer" => V::optional(v::stringType()), | |
"referralSource" => V::optional(v::stringType()), | |
"beneficiaryName" => V::optional(v::stringType()), | |
"beneficiaryAcctNo" => V::optional(v::stringType()), | |
"beneficiaryBankName" => V::optional(v::stringType()), | |
"beneficiaryBankAddress" => V::optional(v::stringType()), | |
"correspondentName" => V::optional(v::stringType()), | |
"correspondentAcctNo" => V::optional(v::stringType()), | |
"companyName" => V::optional(v::stringType()), | |
"nextOfKin" => V::notBlank(), | |
"nextOfKinPhone" => V::optional(v::stringType()),//V::notBlank(), | |
"nextOfKinEmail" => V::optional(v::stringType()),//V::notBlank(), | |
"nextOfKinAddress" => V::optional(v::stringType()),// V::notBlank(), | |
"nextOfKinGender" => V::optional(v::stringType()),// V::notBlank(), | |
"nextOfKinDOB" => V::optional(v::stringType()),//V::notBlank()->date('Y-m-d'), | |
"nextOfKinRelationship" => V::optional(v::stringType()),//V::notBlank(), | |
"identityType" => V::optional(v::stringType()),//V::notBlank(), | |
"identityNumber" => V::optional(v::stringType()),//V::notBlank(), | |
"identityExpiryDate" => V::optional(v::stringType()),// V::notBlank()->date('Y-m-d'), | |
"employerName"=> V::optional(v::stringType()), | |
"employerNo" => V::optional(v::stringType()), | |
"employerAddress" => V::optional(v::stringType()), | |
"sortCode" => V::optional(v::stringType()), | |
"previousCHN" => V::optional(v::stringType()), | |
"businessInvolvement" => V::notBlank(),//->arrayVal(), //optional | |
"involvementType" => V::notBlank(),//->arrayVal(), // V::optional(v::arrayVal()), | |
"authorisedSignatureName"=> V::notBlank() | |
]); | |
}elseif(strtoupper($payload['accountType']) == "CORP"){ | |
validate($payload, [ | |
"Title" => V::optional(v::stringType()), | |
"accountType" => V::in(['IND', 'CORP']), | |
"product" => V::notBlank()->stringType(), | |
// "USMarket" => V::notBlank()->stringType(), | |
"firstName" => V::optional(v::stringType()), | |
"lastName" =>V::optional(v::stringType()), | |
"otherNames" => V::optional(v::stringType()), | |
"BVNFirstName" => V::notBlank()->stringType(), | |
"BVNLastName" => V::notBlank()->stringType(), | |
"BVNMiddleName" => V::optional(v::stringType()), | |
"city" => V::notBlank()->stringType(), | |
"country" => V::notBlank()->stringType(), | |
"dateOfBirth" => V::notBlank()->date('Y-m-d'), | |
"gender" =>V::optional(v::stringType()), | |
"address" => V::notBlank()->stringType(), | |
"state" => V::notBlank()->stringType(), | |
"LGA" => V::notBlank()->stringType(), | |
"emailAddress" => V::optional(v::stringType()),//V::notBlank()->stringType(), | |
"PhoneNumber" => V::optional(v::stringType()), | |
"politicallyExposed" =>V::optional(v::stringType()), | |
"companyName" => V::notBlank(), | |
"employmentType" => V::optional(v::stringType()), | |
"occupation" => V::optional(v::stringType()), | |
"bankAcctName" => V::notBlank(), | |
"bankAcctNumber" => V::notBlank(), | |
"bankName" => V::notBlank(), | |
"bankCode" => V::notBlank(), | |
"BVNNumber" => V::notBlank(), | |
"referrer" => V::optional(v::stringType()), | |
"referralSource" => V::optional(v::stringType()), | |
"beneficiaryName" => V::optional(v::stringType()), | |
"beneficiaryAcctNo" => V::optional(v::stringType()), | |
"beneficiaryBankName" => V::optional(v::stringType()), | |
"beneficiaryBankAddress" => V::optional(v::stringType()), | |
"correspondentName" => V::optional(v::stringType()), | |
"correspondentAcctNo" => V::optional(v::stringType()), | |
"nextOfKin" => V::optional(v::stringType()), | |
"nextOfKinPhone" =>V::optional(v::stringType()), | |
"nextOfKinEmail" =>V::optional(v::stringType()), | |
"nextOfKinAddress" => V::optional(v::stringType()), | |
"nextOfKinGender" =>V::optional(v::stringType()), | |
"nextOfKinDOB" => V::optional(v::date('Y-m-d')), | |
"nextOfKinRelationship" => V::optional(v::stringType()), | |
"identityType" => V::optional(v::stringType()),//V::notBlank(), | |
"identityNumber" => V::optional(v::stringType()),//V::notBlank(), | |
"identityExpiryDate" => V::optional(v::stringType()),//V::notBlank()->date('Y-m-d'), | |
"employerName"=> V::optional(v::stringType()), | |
"employerNo" => V::optional(v::stringType()), | |
"employerAddress" => V::optional(v::stringType()), | |
"sortCode" => V::optional(v::stringType()), | |
"swiftCode" => V::optional(v::stringType()), | |
"RCNo" => V::optional(v::stringType()), | |
"incorporationDate" => V::notBlank()->date('Y-m-d'), //optional | |
"taxID" => V::optional(v::stringType()), | |
"previousCHN" => V::optional(v::stringType()), | |
// "businessInvolvement" => V::optional(v::stringType()), | |
"correspondentBankNo" => V::optional(v::stringType()), | |
"correspondentBankName" => V::optional(v::stringType()), | |
"businessInvolvement" => V::notBlank(),//->arrayVal(), //optional | |
"involvementType" => V::notBlank(),//->arrayVal(), | |
// 'involvementTypeBusiness' => V::notBlank(),//->arrayVal(), | |
"primaryContactName" => V::optional(v::stringType()), | |
"primaryContactPhone" => V::optional(v::stringType()), | |
"primaryContactEmail" => V::optional(v::stringType()), | |
"primaryContactDesignation" => V::optional(v::stringType()), | |
"secondaryContactName" => V::optional(v::stringType()), | |
"secondaryContactPhone" => V::optional(v::stringType()), | |
"secondaryContactEmail" => V::optional(v::stringType()), | |
"secondaryContactDesignation" => V::optional(v::stringType()), | |
"authorisedSignatureName"=> V::notBlank(), | |
"identityDocument"=> V::optional(v::stringType()),//V::notBlank(), | |
"passport"=> V::optional(v::stringType()),//V::notBlank(), | |
"signature"=> V::optional(v::stringType()),//V::notBlank(), | |
"certificateOfIncoporation"=> V::optional(v::stringType()),//V::notBlank(), | |
"CACDocuments"=> V::optional(v::stringType()),//V::notBlank(), | |
"memorandomAndArticleOfIncorporation"=> V::optional(v::stringType()),//V::notBlank(), | |
]); | |
} | |
}elseif(strtoupper($payload['accountOpeningProduct']) == "MGIN" ){ | |
$payload['MGIN'] = 1; | |
$payload['BIZ'] = "MGIN"; | |
if(strtoupper($payload['accountType']) == "IND"){ | |
validate($payload, [ | |
"Title" => V::optional(v::stringType()),// V::notBlank()->stringType(), | |
"accountType" => V::in(['IND', 'CORP']), | |
"product" => V::notBlank()->stringType(), | |
// "USMarket" => V::in([true, false]), | |
"firstName" => V::notBlank()->stringType(), | |
"lastName" => V::notBlank()->stringType(), | |
"otherNames" => V::optional(v::stringType()), | |
"BVNFirstName" => V::notBlank()->stringType(), | |
"BVNLastName" => V::notBlank()->stringType(), | |
"BVNMiddleName" => V::optional(v::stringType()), | |
"maidenName" => V::optional(v::stringType()), | |
"gender" => V::in(['1', '2']), | |
"dateOfBirth" => V::notBlank()->date('Y-m-d'), | |
"address" => V::notBlank()->stringType(), | |
"swiftCode" => V::optional(v::stringType()), | |
"city" => V::notBlank()->stringType(), | |
"country" => V::notBlank(), | |
//"residency" =>V::notBlank()->stringType(), | |
"state" => V::notBlank()->stringType(), | |
"LGA" => V::notBlank()->stringType(), | |
"emailAddress" => V::notBlank()->stringType(), | |
"phoneNumber" => V::optional(v::stringType()), | |
"politicallyExposed" => V::optional(v::stringType()),//V::notBlank(), | |
"employmentType" => V::optional(v::stringType()),//V::notBlank()->stringType(), | |
"occupation" => V::optional(v::stringType()), | |
"bankAcctName" => V::notBlank(), | |
"bankAcctNumber" => V::notBlank(), | |
"bankName" => V::notBlank(), | |
"bankCode" => V::notBlank(), | |
"bankAcctName2" => V::optional(v::stringType()), | |
"bankAcctNumber2" => V::optional(v::stringType()), | |
"bankName2" => V::optional(v::stringType()), | |
"bankCode2" => V::optional(v::stringType()), | |
"BVNNumber" => V::notBlank(), | |
"referrer" => V::optional(v::stringType()), | |
"referralSource" => V::optional(v::stringType()), | |
"beneficiaryName" => V::optional(v::stringType()), | |
"beneficiaryAcctNo" => V::optional(v::stringType()), | |
"beneficiaryBankName" => V::optional(v::stringType()), | |
"beneficiaryBankAddress" => V::optional(v::stringType()), | |
"correspondentName" => V::optional(v::stringType()), | |
"correspondentAcctNo" => V::optional(v::stringType()), | |
"companyName" => V::optional(v::stringType()), | |
"nextOfKin" => V::notBlank(), | |
"nextOfKinPhone" => V::optional(v::stringType()),//V::notBlank(), | |
"nextOfKinEmail" => V::optional(v::stringType()),//V::notBlank(), | |
"nextOfKinAddress" => V::optional(v::stringType()),// V::notBlank(), | |
"nextOfKinGender" => V::optional(v::stringType()),// V::notBlank(), | |
"nextOfKinDOB" => V::optional(v::stringType()),//V::notBlank()->date('Y-m-d'), | |
"nextOfKinRelationship" => V::optional(v::stringType()),//V::notBlank(), | |
"identityType" => V::optional(v::stringType()),//V::notBlank(), | |
"identityNumber" => V::optional(v::stringType()),//V::notBlank(), | |
"identityExpiryDate" => V::optional(v::stringType()),// V::notBlank()->date('Y-m-d'), | |
"employerName"=> V::optional(v::stringType()), | |
"employerNo" => V::optional(v::stringType()), | |
"employerAddress" => V::optional(v::stringType()), | |
"sortCode" => V::optional(v::stringType()), | |
"previousCHN" => V::optional(v::stringType()), | |
"businessInvolvement" => V::notBlank(),//->arrayVal(), //optional | |
"involvementType" => V::notBlank(),//->arrayVal(), // V::optional(v::arrayVal()), | |
"authorisedSignatureName"=> V::notBlank() | |
]); | |
}elseif(strtoupper($payload['accountType']) == "CORP"){ | |
validate($payload, [ | |
"Title" => V::optional(v::stringType()), | |
"accountType" => V::in(['IND', 'CORP']), | |
"product" => V::notBlank()->stringType(), | |
// "USMarket" => V::notBlank()->stringType(), | |
"firstName" => V::optional(v::stringType()), | |
"lastName" =>V::optional(v::stringType()), | |
"otherNames" => V::optional(v::stringType()), | |
"BVNFirstName" => V::notBlank()->stringType(), | |
"BVNLastName" => V::notBlank()->stringType(), | |
"BVNMiddleName" => V::optional(v::stringType()), | |
"city" => V::notBlank()->stringType(), | |
"country" => V::notBlank()->stringType(), | |
"dateOfBirth" => V::notBlank()->date('Y-m-d'), | |
"gender" =>V::optional(v::stringType()), | |
"address" => V::notBlank()->stringType(), | |
"state" => V::notBlank()->stringType(), | |
"LGA" => V::notBlank()->stringType(), | |
"emailAddress" => V::optional(v::stringType()),//V::notBlank()->stringType(), | |
"PhoneNumber" => V::optional(v::stringType()), | |
"politicallyExposed" =>V::optional(v::stringType()), | |
"companyName" => V::notBlank(), | |
"employmentType" => V::optional(v::stringType()), | |
"occupation" => V::optional(v::stringType()), | |
"bankAcctName" => V::notBlank(), | |
"bankAcctNumber" => V::notBlank(), | |
"bankName" => V::notBlank(), | |
"bankCode" => V::notBlank(), | |
"BVNNumber" => V::notBlank(), | |
"referrer" => V::optional(v::stringType()), | |
"referralSource" => V::optional(v::stringType()), | |
"beneficiaryName" => V::optional(v::stringType()), | |
"beneficiaryAcctNo" => V::optional(v::stringType()), | |
"beneficiaryBankName" => V::optional(v::stringType()), | |
"beneficiaryBankAddress" => V::optional(v::stringType()), | |
"correspondentName" => V::optional(v::stringType()), | |
"correspondentAcctNo" => V::optional(v::stringType()), | |
"nextOfKin" => V::optional(v::stringType()), | |
"nextOfKinPhone" =>V::optional(v::stringType()), | |
"nextOfKinEmail" =>V::optional(v::stringType()), | |
"nextOfKinAddress" => V::optional(v::stringType()), | |
"nextOfKinGender" =>V::optional(v::stringType()), | |
"nextOfKinDOB" => V::optional(v::date('Y-m-d')), | |
"nextOfKinRelationship" => V::optional(v::stringType()), | |
"identityType" => V::optional(v::stringType()),//V::notBlank(), | |
"identityNumber" => V::optional(v::stringType()),//V::notBlank(), | |
"identityExpiryDate" => V::optional(v::stringType()),//V::notBlank()->date('Y-m-d'), | |
"employerName"=> V::optional(v::stringType()), | |
"employerNo" => V::optional(v::stringType()), | |
"employerAddress" => V::optional(v::stringType()), | |
"sortCode" => V::optional(v::stringType()), | |
"swiftCode" => V::optional(v::stringType()), | |
"RCNo" => V::optional(v::stringType()), | |
"incorporationDate" => V::notBlank()->date('Y-m-d'), //optional | |
"taxID" => V::optional(v::stringType()), | |
"previousCHN" => V::optional(v::stringType()), | |
// "businessInvolvement" => V::optional(v::stringType()), | |
"correspondentBankNo" => V::optional(v::stringType()), | |
"correspondentBankName" => V::optional(v::stringType()), | |
"businessInvolvement" => V::notBlank(),//->arrayVal(), //optional | |
"involvementType" => V::notBlank(),//->arrayVal(), | |
// 'involvementTypeBusiness' => V::notBlank(),//->arrayVal(), | |
"primaryContactName" => V::optional(v::stringType()), | |
"primaryContactPhone" => V::optional(v::stringType()), | |
"primaryContactEmail" => V::optional(v::stringType()), | |
"primaryContactDesignation" => V::optional(v::stringType()), | |
"secondaryContactName" => V::optional(v::stringType()), | |
"secondaryContactPhone" => V::optional(v::stringType()), | |
"secondaryContactEmail" => V::optional(v::stringType()), | |
"secondaryContactDesignation" => V::optional(v::stringType()), | |
"authorisedSignatureName"=> V::notBlank(), | |
"identityDocument"=> V::optional(v::stringType()),//V::notBlank(), | |
"passport"=> V::optional(v::stringType()),//V::notBlank(), | |
"signature"=> V::optional(v::stringType()),//V::notBlank(), | |
"certificateOfIncoporation"=> V::optional(v::stringType()),//V::notBlank(), | |
"CACDocuments"=> V::optional(v::stringType()),//V::notBlank(), | |
"memorandomAndArticleOfIncorporation"=> V::optional(v::stringType()),//V::notBlank(), | |
]); | |
} | |
}elseif(strtoupper($payload['accountOpeningProduct']) == "CAM" ){ | |
$payload['CAM'] = 1; | |
$payload['BIZ'] = "CAM"; | |
if(strtoupper($payload['accountType']) == "IND"){ | |
validate($payload, [ | |
"Title" => V::optional(v::stringType()),// V::notBlank()->stringType(), | |
"accountType" => V::in(['IND', 'CORP']), | |
"product" => V::notBlank()->stringType(), | |
// "USMarket" => V::in([true, false]), | |
"firstName" => V::notBlank()->stringType(), | |
"lastName" => V::notBlank()->stringType(), | |
"otherNames" => V::optional(v::stringType()), | |
"BVNFirstName" => V::notBlank()->stringType(), | |
"BVNLastName" => V::notBlank()->stringType(), | |
"BVNMiddleName" => V::optional(v::stringType()), | |
"maidenName" => V::optional(v::stringType()), | |
"gender" => V::in(['1', '2']), | |
"dateOfBirth" => V::notBlank()->date('Y-m-d'), | |
"address" => V::notBlank()->stringType(), | |
"swiftCode" => V::optional(v::stringType()), | |
"city" => V::notBlank()->stringType(), | |
"country" => V::notBlank(), | |
//"residency" =>V::notBlank()->stringType(), | |
"state" => V::notBlank()->stringType(), | |
"LGA" => V::notBlank()->stringType(), | |
"emailAddress" => V::notBlank()->stringType(), | |
"phoneNumber" => V::optional(v::stringType()), | |
"politicallyExposed" => V::optional(v::stringType()),//V::notBlank(), | |
"employmentType" => V::optional(v::stringType()),//V::notBlank()->stringType(), | |
"occupation" => V::optional(v::stringType()), | |
"bankAcctName" => V::notBlank(), | |
"bankAcctNumber" => V::notBlank(), | |
"bankName" => V::notBlank(), | |
"bankCode" => V::notBlank(), | |
"bankAcctName2" => V::optional(v::stringType()), | |
"bankAcctNumber2" => V::optional(v::stringType()), | |
"bankName2" => V::optional(v::stringType()), | |
"bankCode2" => V::optional(v::stringType()), | |
"BVNNumber" => V::notBlank(), | |
"referrer" => V::optional(v::stringType()), | |
"referralSource" => V::optional(v::stringType()), | |
"beneficiaryName" => V::optional(v::stringType()), | |
"beneficiaryAcctNo" => V::optional(v::stringType()), | |
"beneficiaryBankName" => V::optional(v::stringType()), | |
"beneficiaryBankAddress" => V::optional(v::stringType()), | |
"correspondentName" => V::optional(v::stringType()), | |
"correspondentAcctNo" => V::optional(v::stringType()), | |
"companyName" => V::optional(v::stringType()), | |
"nextOfKin" => V::notBlank(), | |
"nextOfKinPhone" => V::optional(v::stringType()),//V::notBlank(), | |
"nextOfKinEmail" => V::optional(v::stringType()),//V::notBlank(), | |
"nextOfKinAddress" => V::optional(v::stringType()),// V::notBlank(), | |
"nextOfKinGender" => V::optional(v::stringType()),// V::notBlank(), | |
"nextOfKinDOB" => V::optional(v::stringType()),//V::notBlank()->date('Y-m-d'), | |
"nextOfKinRelationship" => V::optional(v::stringType()),//V::notBlank(), | |
"identityType" => V::optional(v::stringType()),//V::notBlank(), | |
"identityNumber" => V::optional(v::stringType()),//V::notBlank(), | |
"identityExpiryDate" => V::optional(v::stringType()),// V::notBlank()->date('Y-m-d'), | |
"employerName"=> V::optional(v::stringType()), | |
"employerNo" => V::optional(v::stringType()), | |
"employerAddress" => V::optional(v::stringType()), | |
"sortCode" => V::optional(v::stringType()), | |
"previousCHN" => V::optional(v::stringType()), | |
"businessInvolvement" => V::notBlank(),//->arrayVal(), //optional | |
"involvementType" => V::notBlank(),//->arrayVal(), // V::optional(v::arrayVal()), | |
"authorisedSignatureName"=> V::notBlank() | |
]); | |
}else if(strtoupper($payload['accountType']) == "CORP"){ | |
validate($payload, [ | |
"Title" => V::optional(v::stringType()), | |
"accountType" => V::in(['IND', 'CORP']), | |
"product" => V::notBlank()->stringType(), | |
// "USMarket" => V::notBlank()->stringType(), | |
"firstName" => V::optional(v::stringType()), | |
"lastName" =>V::optional(v::stringType()), | |
"otherNames" => V::optional(v::stringType()), | |
"BVNFirstName" => V::notBlank()->stringType(), | |
"BVNLastName" => V::notBlank()->stringType(), | |
"BVNMiddleName" => V::optional(v::stringType()), | |
"city" => V::notBlank()->stringType(), | |
"country" => V::notBlank()->stringType(), | |
"dateOfBirth" => V::notBlank()->date('Y-m-d'), | |
"gender" =>V::optional(v::stringType()), | |
"address" => V::notBlank()->stringType(), | |
"state" => V::notBlank()->stringType(), | |
"LGA" => V::notBlank()->stringType(), | |
"emailAddress" => V::optional(v::stringType()),//V::notBlank()->stringType(), | |
"PhoneNumber" => V::optional(v::stringType()), | |
"politicallyExposed" =>V::optional(v::stringType()), | |
"companyName" => V::notBlank(), | |
"employmentType" => V::optional(v::stringType()), | |
"occupation" => V::optional(v::stringType()), | |
"bankAcctName" => V::notBlank(), | |
"bankAcctNumber" => V::notBlank(), | |
"bankName" => V::notBlank(), | |
"bankCode" => V::notBlank(), | |
"BVNNumber" => V::notBlank(), | |
"referrer" => V::optional(v::stringType()), | |
"referralSource" => V::optional(v::stringType()), | |
"beneficiaryName" => V::optional(v::stringType()), | |
"beneficiaryAcctNo" => V::optional(v::stringType()), | |
"beneficiaryBankName" => V::optional(v::stringType()), | |
"beneficiaryBankAddress" => V::optional(v::stringType()), | |
"correspondentName" => V::optional(v::stringType()), | |
"correspondentAcctNo" => V::optional(v::stringType()), | |
"nextOfKin" => V::optional(v::stringType()), | |
"nextOfKinPhone" =>V::optional(v::stringType()), | |
"nextOfKinEmail" =>V::optional(v::stringType()), | |
"nextOfKinAddress" => V::optional(v::stringType()), | |
"nextOfKinGender" =>V::optional(v::stringType()), | |
"nextOfKinDOB" => V::optional(v::date('Y-m-d')), | |
"nextOfKinRelationship" => V::optional(v::stringType()), | |
"identityType" => V::optional(v::stringType()),//V::notBlank(), | |
"identityNumber" => V::optional(v::stringType()),//V::notBlank(), | |
"identityExpiryDate" => V::optional(v::stringType()),//V::notBlank()->date('Y-m-d'), | |
"employerName"=> V::optional(v::stringType()), | |
"employerNo" => V::optional(v::stringType()), | |
"employerAddress" => V::optional(v::stringType()), | |
"sortCode" => V::optional(v::stringType()), | |
"swiftCode" => V::optional(v::stringType()), | |
"RCNo" => V::optional(v::stringType()), | |
"incorporationDate" => V::notBlank()->date('Y-m-d'), //optional | |
"taxID" => V::optional(v::stringType()), | |
"previousCHN" => V::optional(v::stringType()), | |
// "businessInvolvement" => V::optional(v::stringType()), | |
"correspondentBankNo" => V::optional(v::stringType()), | |
"correspondentBankName" => V::optional(v::stringType()), | |
"businessInvolvement" => V::notBlank(),//->arrayVal(), //optional | |
"involvementType" => V::notBlank(),//->arrayVal(), | |
// 'involvementTypeBusiness' => V::notBlank(),//->arrayVal(), | |
"primaryContactName" => V::optional(v::stringType()), | |
"primaryContactPhone" => V::optional(v::stringType()), | |
"primaryContactEmail" => V::optional(v::stringType()), | |
"primaryContactDesignation" => V::optional(v::stringType()), | |
"secondaryContactName" => V::optional(v::stringType()), | |
"secondaryContactPhone" => V::optional(v::stringType()), | |
"secondaryContactEmail" => V::optional(v::stringType()), | |
"secondaryContactDesignation" => V::optional(v::stringType()), | |
"authorisedSignatureName"=> V::notBlank(), | |
"identityDocument"=> V::optional(v::stringType()),//V::notBlank(), | |
"passport"=> V::optional(v::stringType()),//V::notBlank(), | |
"signature"=> V::optional(v::stringType()),//V::notBlank(), | |
"certificateOfIncoporation"=> V::optional(v::stringType()),//V::notBlank(), | |
"CACDocuments"=> V::optional(v::stringType()),//V::notBlank(), | |
"memorandomAndArticleOfIncorporation"=> V::optional(v::stringType()),//V::notBlank(), | |
]); | |
} | |
}elseif(strtoupper($payload['accountOpeningProduct']) == "SMA" ){ | |
$payload['SMA'] = 1; | |
$payload['BIZ'] = "SMA"; | |
if(strtoupper($payload['accountType']) == "IND"){ | |
validate($payload, [ | |
"Title" => V::optional(v::stringType()),// V::notBlank()->stringType(), | |
"accountType" => V::in(['IND', 'CORP']), | |
"product" => V::notBlank()->stringType(), | |
// "USMarket" => V::in([true, false]), | |
"firstName" => V::notBlank()->stringType(), | |
"lastName" => V::notBlank()->stringType(), | |
"otherNames" => V::optional(v::stringType()), | |
"BVNFirstName" => V::notBlank()->stringType(), | |
"BVNLastName" => V::notBlank()->stringType(), | |
"BVNMiddleName" => V::optional(v::stringType()), | |
"maidenName" => V::optional(v::stringType()), | |
"gender" => V::in(['1', '2']), | |
"dateOfBirth" => V::notBlank()->date('Y-m-d'), | |
"address" => V::notBlank()->stringType(), | |
"swiftCode" => V::optional(v::stringType()), | |
"city" => V::notBlank()->stringType(), | |
"country" => V::notBlank(), | |
//"residency" =>V::notBlank()->stringType(), | |
"state" => V::notBlank()->stringType(), | |
"LGA" => V::notBlank()->stringType(), | |
"emailAddress" => V::notBlank()->stringType(), | |
"phoneNumber" => V::optional(v::stringType()), | |
"politicallyExposed" => V::optional(v::stringType()),//V::notBlank(), | |
"employmentType" => V::optional(v::stringType()),//V::notBlank()->stringType(), | |
"occupation" => V::optional(v::stringType()), | |
"bankAcctName" => V::notBlank(), | |
"bankAcctNumber" => V::notBlank(), | |
"bankName" => V::notBlank(), | |
"bankCode" => V::notBlank(), | |
"bankAcctName2" => V::optional(v::stringType()), | |
"bankAcctNumber2" => V::optional(v::stringType()), | |
"bankName2" => V::optional(v::stringType()), | |
"bankCode2" => V::optional(v::stringType()), | |
"BVNNumber" => V::notBlank(), | |
"referrer" => V::optional(v::stringType()), | |
"referralSource" => V::optional(v::stringType()), | |
"beneficiaryName" => V::optional(v::stringType()), | |
"beneficiaryAcctNo" => V::optional(v::stringType()), | |
"beneficiaryBankName" => V::optional(v::stringType()), | |
"beneficiaryBankAddress" => V::optional(v::stringType()), | |
"correspondentName" => V::optional(v::stringType()), | |
"correspondentAcctNo" => V::optional(v::stringType()), | |
"companyName" => V::optional(v::stringType()), | |
"nextOfKin" => V::notBlank(), | |
"nextOfKinPhone" => V::optional(v::stringType()),//V::notBlank(), | |
"nextOfKinEmail" => V::optional(v::stringType()),//V::notBlank(), | |
"nextOfKinAddress" => V::optional(v::stringType()),// V::notBlank(), | |
"nextOfKinGender" => V::optional(v::stringType()),// V::notBlank(), | |
"nextOfKinDOB" => V::optional(v::stringType()),//V::notBlank()->date('Y-m-d'), | |
"nextOfKinRelationship" => V::optional(v::stringType()),//V::notBlank(), | |
"identityType" => V::optional(v::stringType()),//V::notBlank(), | |
"identityNumber" => V::optional(v::stringType()),//V::notBlank(), | |
"identityExpiryDate" => V::optional(v::stringType()),// V::notBlank()->date('Y-m-d'), | |
"employerName"=> V::optional(v::stringType()), | |
"employerNo" => V::optional(v::stringType()), | |
"employerAddress" => V::optional(v::stringType()), | |
"sortCode" => V::optional(v::stringType()), | |
"previousCHN" => V::optional(v::stringType()), | |
"businessInvolvement" => V::notBlank(),//->arrayVal(), //optional | |
"involvementType" => V::notBlank(),//->arrayVal(), // V::optional(v::arrayVal()), | |
"authorisedSignatureName"=> V::notBlank() | |
]); | |
}else if(strtoupper($payload['accountType']) == "CORP"){ | |
validate($payload, [ | |
"Title" => V::optional(v::stringType()), | |
"accountType" => V::in(['IND', 'CORP']), | |
"product" => V::notBlank()->stringType(), | |
// "USMarket" => V::notBlank()->stringType(), | |
"firstName" => V::optional(v::stringType()), | |
"lastName" =>V::optional(v::stringType()), | |
"otherNames" => V::optional(v::stringType()), | |
"BVNFirstName" => V::notBlank()->stringType(), | |
"BVNLastName" => V::notBlank()->stringType(), | |
"BVNMiddleName" => V::optional(v::stringType()), | |
"city" => V::notBlank()->stringType(), | |
"country" => V::notBlank()->stringType(), | |
"dateOfBirth" => V::notBlank()->date('Y-m-d'), | |
"gender" =>V::optional(v::stringType()), | |
"address" => V::notBlank()->stringType(), | |
"state" => V::notBlank()->stringType(), | |
"LGA" => V::notBlank()->stringType(), | |
"emailAddress" => V::optional(v::stringType()),//V::notBlank()->stringType(), | |
"PhoneNumber" => V::optional(v::stringType()), | |
"politicallyExposed" =>V::optional(v::stringType()), | |
"companyName" => V::notBlank(), | |
"employmentType" => V::optional(v::stringType()), | |
"occupation" => V::optional(v::stringType()), | |
"bankAcctName" => V::notBlank(), | |
"bankAcctNumber" => V::notBlank(), | |
"bankName" => V::notBlank(), | |
"bankCode" => V::notBlank(), | |
"BVNNumber" => V::notBlank(), | |
"referrer" => V::optional(v::stringType()), | |
"referralSource" => V::optional(v::stringType()), | |
"beneficiaryName" => V::optional(v::stringType()), | |
"beneficiaryAcctNo" => V::optional(v::stringType()), | |
"beneficiaryBankName" => V::optional(v::stringType()), | |
"beneficiaryBankAddress" => V::optional(v::stringType()), | |
"correspondentName" => V::optional(v::stringType()), | |
"correspondentAcctNo" => V::optional(v::stringType()), | |
"nextOfKin" => V::optional(v::stringType()), | |
"nextOfKinPhone" =>V::optional(v::stringType()), | |
"nextOfKinEmail" =>V::optional(v::stringType()), | |
"nextOfKinAddress" => V::optional(v::stringType()), | |
"nextOfKinGender" =>V::optional(v::stringType()), | |
"nextOfKinDOB" => V::optional(v::date('Y-m-d')), | |
"nextOfKinRelationship" => V::optional(v::stringType()), | |
"identityType" => V::optional(v::stringType()),//V::notBlank(), | |
"identityNumber" => V::optional(v::stringType()),//V::notBlank(), | |
"identityExpiryDate" => V::optional(v::stringType()),//V::notBlank()->date('Y-m-d'), | |
"employerName"=> V::optional(v::stringType()), | |
"employerNo" => V::optional(v::stringType()), | |
"employerAddress" => V::optional(v::stringType()), | |
"sortCode" => V::optional(v::stringType()), | |
"swiftCode" => V::optional(v::stringType()), | |
"RCNo" => V::optional(v::stringType()), | |
"incorporationDate" => V::notBlank()->date('Y-m-d'), //optional | |
"taxID" => V::optional(v::stringType()), | |
"previousCHN" => V::optional(v::stringType()), | |
// "businessInvolvement" => V::optional(v::stringType()), | |
"correspondentBankNo" => V::optional(v::stringType()), | |
"correspondentBankName" => V::optional(v::stringType()), | |
"businessInvolvement" => V::notBlank(),//->arrayVal(), //optional | |
"involvementType" => V::notBlank(),//->arrayVal(), | |
// 'involvementTypeBusiness' => V::notBlank(),//->arrayVal(), | |
"primaryContactName" => V::optional(v::stringType()), | |
"primaryContactPhone" => V::optional(v::stringType()), | |
"primaryContactEmail" => V::optional(v::stringType()), | |
"primaryContactDesignation" => V::optional(v::stringType()), | |
"secondaryContactName" => V::optional(v::stringType()), | |
"secondaryContactPhone" => V::optional(v::stringType()), | |
"secondaryContactEmail" => V::optional(v::stringType()), | |
"secondaryContactDesignation" => V::optional(v::stringType()), | |
"authorisedSignatureName"=> V::notBlank(), | |
"identityDocument"=> V::optional(v::stringType()),//V::notBlank(), | |
"passport"=> V::optional(v::stringType()),//V::notBlank(), | |
"signature"=> V::optional(v::stringType()),//V::notBlank(), | |
"certificateOfIncoporation"=> V::optional(v::stringType()),//V::notBlank(), | |
"CACDocuments"=> V::optional(v::stringType()),//V::notBlank(), | |
"memorandomAndArticleOfIncorporation"=> V::optional(v::stringType()),//V::notBlank(), | |
]); | |
} | |
}elseif(strtoupper($payload['accountOpeningProduct']) == "CST" ){ | |
$payload['CST'] = 1; | |
$payload['BIZ'] = "CST"; | |
if(strtoupper($payload['accountType']) == "IND"){ | |
validate($payload, [ | |
"Title" => V::optional(v::stringType()),// V::notBlank()->stringType(), | |
"accountType" => V::in(['IND', 'CORP']), | |
"product" => V::notBlank()->stringType(), | |
// "USMarket" => V::in([true, false]), | |
"firstName" => V::notBlank()->stringType(), | |
"lastName" => V::notBlank()->stringType(), | |
"otherNames" => V::optional(v::stringType()), | |
"BVNFirstName" => V::notBlank()->stringType(), | |
"BVNLastName" => V::notBlank()->stringType(), | |
"BVNMiddleName" => V::optional(v::stringType()), | |
"maidenName" => V::optional(v::stringType()), | |
"gender" => V::in(['1', '2']), | |
"dateOfBirth" => V::notBlank()->date('Y-m-d'), | |
"address" => V::notBlank()->stringType(), | |
"swiftCode" => V::optional(v::stringType()), | |
"city" => V::notBlank()->stringType(), | |
"country" => V::notBlank(), | |
//"residency" =>V::notBlank()->stringType(), | |
"state" => V::notBlank()->stringType(), | |
"LGA" => V::notBlank()->stringType(), | |
"emailAddress" => V::notBlank()->stringType(), | |
"phoneNumber" => V::optional(v::stringType()), | |
"politicallyExposed" => V::optional(v::stringType()),//V::notBlank(), | |
"employmentType" => V::optional(v::stringType()),//V::notBlank()->stringType(), | |
"occupation" => V::optional(v::stringType()), | |
"bankAcctName" => V::notBlank(), | |
"bankAcctNumber" => V::notBlank(), | |
"bankName" => V::notBlank(), | |
"bankCode" => V::notBlank(), | |
"bankAcctName2" => V::optional(v::stringType()), | |
"bankAcctNumber2" => V::optional(v::stringType()), | |
"bankName2" => V::optional(v::stringType()), | |
"bankCode2" => V::optional(v::stringType()), | |
"BVNNumber" => V::notBlank(), | |
"referrer" => V::optional(v::stringType()), | |
"referralSource" => V::optional(v::stringType()), | |
"beneficiaryName" => V::optional(v::stringType()), | |
"beneficiaryAcctNo" => V::optional(v::stringType()), | |
"beneficiaryBankName" => V::optional(v::stringType()), | |
"beneficiaryBankAddress" => V::optional(v::stringType()), | |
"correspondentName" => V::optional(v::stringType()), | |
"correspondentAcctNo" => V::optional(v::stringType()), | |
"companyName" => V::optional(v::stringType()), | |
"nextOfKin" => V::notBlank(), | |
"nextOfKinPhone" => V::optional(v::stringType()),//V::notBlank(), | |
"nextOfKinEmail" => V::optional(v::stringType()),//V::notBlank(), | |
"nextOfKinAddress" => V::optional(v::stringType()),// V::notBlank(), | |
"nextOfKinGender" => V::optional(v::stringType()),// V::notBlank(), | |
"nextOfKinDOB" => V::optional(v::stringType()),//V::notBlank()->date('Y-m-d'), | |
"nextOfKinRelationship" => V::optional(v::stringType()),//V::notBlank(), | |
"identityType" => V::optional(v::stringType()),//V::notBlank(), | |
"identityNumber" => V::optional(v::stringType()),//V::notBlank(), | |
"identityExpiryDate" => V::optional(v::stringType()),// V::notBlank()->date('Y-m-d'), | |
"employerName"=> V::optional(v::stringType()), | |
"employerNo" => V::optional(v::stringType()), | |
"employerAddress" => V::optional(v::stringType()), | |
"sortCode" => V::optional(v::stringType()), | |
"previousCHN" => V::optional(v::stringType()), | |
"businessInvolvement" => V::notBlank(),//->arrayVal(), //optional | |
"involvementType" => V::notBlank(),//->arrayVal(), // V::optional(v::arrayVal()), | |
"authorisedSignatureName"=> V::notBlank() | |
]); | |
}else if(strtoupper($payload['accountType']) == "CORP"){ | |
validate($payload, [ | |
"Title" => V::optional(v::stringType()), | |
"accountType" => V::in(['IND', 'CORP']), | |
"product" => V::notBlank()->stringType(), | |
// "USMarket" => V::notBlank()->stringType(), | |
"firstName" => V::optional(v::stringType()), | |
"lastName" =>V::optional(v::stringType()), | |
"otherNames" => V::optional(v::stringType()), | |
"BVNFirstName" => V::notBlank()->stringType(), | |
"BVNLastName" => V::notBlank()->stringType(), | |
"BVNMiddleName" => V::optional(v::stringType()), | |
"city" => V::notBlank()->stringType(), | |
"country" => V::notBlank()->stringType(), | |
"dateOfBirth" => V::notBlank()->date('Y-m-d'), | |
"gender" =>V::optional(v::stringType()), | |
"address" => V::notBlank()->stringType(), | |
"state" => V::notBlank()->stringType(), | |
"LGA" => V::notBlank()->stringType(), | |
"emailAddress" => V::optional(v::stringType()),//V::notBlank()->stringType(), | |
"PhoneNumber" => V::optional(v::stringType()), | |
"politicallyExposed" =>V::optional(v::stringType()), | |
"companyName" => V::notBlank(), | |
"employmentType" => V::optional(v::stringType()), | |
"occupation" => V::optional(v::stringType()), | |
"bankAcctName" => V::notBlank(), | |
"bankAcctNumber" => V::notBlank(), | |
"bankName" => V::notBlank(), | |
"bankCode" => V::notBlank(), | |
"BVNNumber" => V::notBlank(), | |
"referrer" => V::optional(v::stringType()), | |
"referralSource" => V::optional(v::stringType()), | |
"beneficiaryName" => V::optional(v::stringType()), | |
"beneficiaryAcctNo" => V::optional(v::stringType()), | |
"beneficiaryBankName" => V::optional(v::stringType()), | |
"beneficiaryBankAddress" => V::optional(v::stringType()), | |
"correspondentName" => V::optional(v::stringType()), | |
"correspondentAcctNo" => V::optional(v::stringType()), | |
"nextOfKin" => V::optional(v::stringType()), | |
"nextOfKinPhone" =>V::optional(v::stringType()), | |
"nextOfKinEmail" =>V::optional(v::stringType()), | |
"nextOfKinAddress" => V::optional(v::stringType()), | |
"nextOfKinGender" =>V::optional(v::stringType()), | |
"nextOfKinDOB" => V::optional(v::date('Y-m-d')), | |
"nextOfKinRelationship" => V::optional(v::stringType()), | |
"identityType" => V::optional(v::stringType()),//V::notBlank(), | |
"identityNumber" => V::optional(v::stringType()),//V::notBlank(), | |
"identityExpiryDate" => V::optional(v::stringType()),//V::notBlank()->date('Y-m-d'), | |
"employerName"=> V::optional(v::stringType()), | |
"employerNo" => V::optional(v::stringType()), | |
"employerAddress" => V::optional(v::stringType()), | |
"sortCode" => V::optional(v::stringType()), | |
"swiftCode" => V::optional(v::stringType()), | |
"RCNo" => V::optional(v::stringType()), | |
"incorporationDate" => V::notBlank()->date('Y-m-d'), //optional | |
"taxID" => V::optional(v::stringType()), | |
"previousCHN" => V::optional(v::stringType()), | |
// "businessInvolvement" => V::optional(v::stringType()), | |
"correspondentBankNo" => V::optional(v::stringType()), | |
"correspondentBankName" => V::optional(v::stringType()), | |
"businessInvolvement" => V::notBlank(),//->arrayVal(), //optional | |
"involvementType" => V::notBlank(),//->arrayVal(), | |
// 'involvementTypeBusiness' => V::notBlank(),//->arrayVal(), | |
"primaryContactName" => V::optional(v::stringType()), | |
"primaryContactPhone" => V::optional(v::stringType()), | |
"primaryContactEmail" => V::optional(v::stringType()), | |
"primaryContactDesignation" => V::optional(v::stringType()), | |
"secondaryContactName" => V::optional(v::stringType()), | |
"secondaryContactPhone" => V::optional(v::stringType()), | |
"secondaryContactEmail" => V::optional(v::stringType()), | |
"secondaryContactDesignation" => V::optional(v::stringType()), | |
"authorisedSignatureName"=> V::notBlank(), | |
"identityDocument"=> V::optional(v::stringType()),//V::notBlank(), | |
"passport"=> V::optional(v::stringType()),//V::notBlank(), | |
"signature"=> V::optional(v::stringType()),//V::notBlank(), | |
"certificateOfIncoporation"=> V::optional(v::stringType()),//V::notBlank(), | |
"CACDocuments"=> V::optional(v::stringType()),//V::notBlank(), | |
"memorandomAndArticleOfIncorporation"=> V::optional(v::stringType()),//V::notBlank(), | |
]); | |
} | |
}else{} | |
// $payload["USMarket"] = (boolean)$payload["USMarket"]; | |
/* if (!contains_value($payload['businessInvolvement'])) { | |
$payload['businessInvolvement'] = [MIDDLEWARE_DB_NAME]; | |
} | |
if (is_string($payload['businessInvolvement'])) { | |
// $payload['businessInvolvement'] = explode(',', $payload['businessInvolvement']); | |
$payload['businessInvolvement'] = (array_map('trim',array_filter(explode(',',$payload['businessInvolvement'])))); | |
} */ | |
//using this involvementTypeBusiness to create the product on involvementType | |
/* if (is_string($payload['involvementType'])) { | |
$payload['involvementType'] = (array_map('trim',array_filter(explode(',',$payload['involvementType'])))); | |
} */ | |
/* if (is_string($payload['involvementTypeBusiness'])) { | |
$payload['involvementTypeBusiness'] = (array_map('trim',array_filter(explode(',',$payload['involvementTypeBusiness'])))); | |
} */ | |
$data = container('FreshsalesRequest')->createContact($payload); | |
$payload['referralSource'] = 'Yochaa'; | |
$payload['referrer'] = 'Yochaa'; | |
$result = $this->customerModel->newAccount($payload); | |
$payload['CustID'] = $result['CustID']; | |
$payload['CRMID'] = $data['Id']; | |
$updateCustomerData = $this->customerModel->updateCRMID($payload); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'data' => $result['message'], | |
'CustID' => $result['CustID'], | |
]); | |
}); | |
// //->add(new PartnersMiddleware()); | |
/** | |
* Create Additional Account | |
* | |
* This API endpoint is used to create an additional account for a specific customer. | |
* | |
* @return {Object} Response - JSON response containing the result and message of the operation. | |
* | |
* @throws {Error} 500 - Internal Server Error: If an unexpected error occurs during the account creation process. | |
* | |
* @OA\Post( | |
* path="/api/customer/createAddtionalAccount", | |
* tags={"Customer"}, | |
* summary="Create Additional Account", | |
* operationId="createAdditionalAccount", | |
* @OA\Response( | |
* response=200, | |
* description="Successful operation", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ), | |
* @OA\RequestBody( | |
* description="Payload to create additional account", | |
* required=true, | |
* @OA\JsonContent( | |
* @OA\Property(property="files", type="object"), | |
* @OA\Property(property="CustID", type="string", example="12345", description="Customer ID (required)"), | |
* @OA\Property(property="accountOpeningProduct", type="string", example="MF", description="Account opening product (required)"), | |
* @OA\Property(property="accountType", type="string", example="IND", description="Account type (required)"), | |
* // Add more properties based on the requirements for each account opening product and account type | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->post('/api/customer/createAddtionalAccount', function ($request, $response) { | |
$payload = array_merge( | |
[ | |
"files" => $request->getUploadedFiles(), | |
], | |
$request->getParsedBody() | |
); | |
// $payload = $request->getParsedBody(); | |
validate($payload, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
'accountOpeningProduct' => [ | |
'rules' => V::notBlank(), | |
'message' => 'accountOpeningProduct is required' | |
], | |
'accountType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'accountType is required' | |
], | |
]); | |
if(strtoupper($payload['accountOpeningProduct']) == "MF"){ | |
$payload['MF'] = 1; | |
if(strtoupper($payload['accountType']) == "IND"){ //individual account | |
validate($payload, [ | |
"Title" => V::optional(v::stringType()), | |
"accountType" => V::in(['IND', 'CORP']), | |
"firstName" => V::notBlank()->stringType(), | |
"lastName" => V::notBlank()->stringType(), | |
"otherNames" => V::optional(v::stringType()), | |
"gender" => V::in(['1', '2']), // | |
"dateOfBirth" => V::notBlank()->date('Y-m-d'), | |
"address" => V::notBlank()->stringType(), | |
"swiftCode" => V::optional(v::stringType()), | |
"city" => V::notBlank()->stringType(), | |
"country" =>V::notBlank()->stringType(), | |
//"residency" =>V::notBlank()->stringType(), | |
"state" => V::notBlank()->stringType(), | |
"LGA" => V::optional(v::stringType()), | |
"emailAddress" => V::notBlank()->stringType(), | |
"phoneNumber" => V::notBlank()->stringType(), | |
"politicallyExposed" => V::optional(v::stringType()), | |
"employmentType" => V::optional(v::stringType()), | |
"occupation" => V::optional(v::stringType()), | |
"bankAcctName" => V::optional(v::stringType()), | |
"bankAcctNumber" => V::optional(v::stringType()), | |
"bankName" =>V::optional(v::stringType()), | |
"bankCode" => V::optional(v::stringType()), | |
"bankAcctName2" => V::optional(v::stringType()), | |
"bankAcctNumber2" => V::optional(v::stringType()), | |
"bankName2" => V::optional(v::stringType()), | |
"bankCode2" => V::optional(v::stringType()), | |
"BVNNumber" => V::optional(v::stringType()), | |
"beneficiaryName" => V::optional(v::stringType()), | |
"beneficiaryAcctNo" => V::optional(v::stringType()), | |
"beneficiaryBankName" => V::optional(v::stringType()), | |
"beneficiaryBankAddress" => V::optional(v::stringType()), | |
"correspondentName" => V::optional(v::stringType()), | |
"correspondentAcctNo" => V::optional(v::stringType()), | |
"companyName" => V::optional(v::stringType()), | |
"nextOfKin" =>V::optional(v::stringType()), | |
"nextOfKinPhone" => V::optional(v::stringType()), | |
"nextOfKinEmail" =>V::optional(v::stringType()), | |
"nextOfKinAddress" => V::optional(v::stringType()), | |
"nextOfKinGender" => V::optional(v::stringType()), | |
"nextOfKinDOB" => V::optional(v::stringType()), | |
"nextOfKinRelationship" => V::optional(v::stringType()), | |
"identityType" =>V::optional(v::stringType()), | |
"identityNumber" => V::optional(v::stringType()), | |
"identityExpiryDate" => V::optional(v::stringType()), | |
"employerName"=> V::optional(v::stringType()), | |
"employerNo" => V::optional(v::stringType()), | |
"employerAddress" => V::optional(v::stringType()), | |
"sortCode" => V::optional(v::stringType()), | |
"previousCHN" => V::optional(v::stringType()), | |
"businessInvolvement" => V::notBlank(),//->arrayVal(), //optional | |
"involvementType" => V::optional(v::stringType()), | |
// "agreementCheck" => V::notBlank(), | |
"authorisedSignatureName"=> V::optional(v::stringType()), | |
]); | |
}elseif(strtoupper($payload['accountType']) == "CORP"){ //corporate account | |
validate($payload, [ | |
"Title" => V::optional(v::stringType()), | |
"accountType" => V::in(['IND', 'CORP']), | |
"firstName" => V::optional(v::stringType()), | |
"lastName" =>V::optional(v::stringType()), | |
"otherNames" => V::optional(v::stringType()), | |
"city" => V::notBlank()->stringType(), | |
"country" => V::notBlank()->stringType(), | |
"dateOfBirth" => V::notBlank()->date('Y-m-d'), | |
"gender" => V::optional(v::stringType()), | |
"address" => V::notBlank()->stringType(), | |
"state" => V::notBlank()->stringType(), | |
"LGA" =>V::optional(v::stringType()), | |
"emailAddress" => V::optional(v::stringType()), | |
"phoneNumber" => V::optional(v::stringType()), | |
"politicallyExposed" => V::optional(v::stringType()), | |
"companyName" => V::notBlank(), | |
"employmentType" => V::optional(v::stringType()), | |
"occupation" => V::optional(v::stringType()), | |
"bankAcctName" => V::optional(v::stringType()), | |
"bankAcctNumber" =>V::optional(v::stringType()), | |
"bankName" => V::optional(v::stringType()), | |
"bankCode" => V::optional(v::stringType()), | |
"BVNNumber" => V::optional(v::stringType()), | |
"beneficiaryName" => V::optional(v::stringType()), | |
"beneficiaryAcctNo" => V::optional(v::stringType()), | |
"beneficiaryBankName" => V::optional(v::stringType()), | |
"beneficiaryBankAddress" => V::optional(v::stringType()), | |
"correspondentName" => V::optional(v::stringType()), | |
"correspondentAcctNo" => V::optional(v::stringType()), | |
"nextOfKin" => V::optional(v::stringType()), | |
"nextOfKinPhone" =>V::optional(v::stringType()), | |
"nextOfKinEmail" =>V::optional(v::stringType()), | |
"nextOfKinAddress" => V::optional(v::stringType()), | |
"nextOfKinGender" =>V::optional(v::stringType()), | |
"nextOfKinDOB" => V::optional(v::date('Y-m-d')), | |
"nextOfKinRelationship" => V::optional(v::stringType()), | |
"identityType" => V::optional(v::stringType()), | |
"identityNumber" => V::optional(v::stringType()), | |
"identityExpiryDate" =>V::optional(v::stringType()), | |
"employerName"=> V::optional(v::stringType()), | |
"employerNo" => V::optional(v::stringType()), | |
"employerAddress" => V::optional(v::stringType()), | |
"sortCode" => V::optional(v::stringType()), | |
"swiftCode" => V::optional(v::stringType()), | |
"RCNo" => V::notBlank(), | |
"incorporationDate" => V::notBlank()->date('Y-m-d'), //optional | |
"taxID" => V::optional(v::stringType()), | |
"previousCHN" => V::optional(v::stringType()), | |
"businessInvolvement" => V::optional(v::stringType()), | |
"correspondentBankNo" => V::optional(v::stringType()), | |
"correspondentBankName" => V::optional(v::stringType()), | |
"businessInvolvement" => V::notBlank(),//->arrayVal(), //optional | |
"involvementType" => V::optional(v::stringType()), | |
"primaryContactName" => V::notBlank(), | |
"primaryContactPhone" => V::notBlank(), | |
"primaryContactEmail" => V::notBlank(), | |
"primaryContactDesignation" => V::notBlank(), | |
"secondaryContactName" => V::optional(v::stringType()), | |
"secondaryContactPhone" => V::optional(v::stringType()), | |
"secondaryContactEmail" => V::optional(v::stringType()), | |
"secondaryContactDesignation" => V::optional(v::stringType()), | |
// "agreementCheck" => V::notBlank(), | |
"authorisedSignatureName"=> V::optional(v::stringType()), | |
//"gender" =>V::optional(v::stringType()), | |
]); | |
}else{} | |
}elseif(strtoupper($payload['accountOpeningProduct']) == "TROVE"){ | |
$payload['TROVE'] = 1; | |
// if( $payload['accountType'] == "IND"){ //individual account | |
validate($payload, [ | |
"Title" => V::optional(v::stringType()), | |
"accountType" => V::in(['IND', 'CORP']), | |
"firstName" => V::notBlank()->stringType(), | |
"lastName" => V::notBlank()->stringType(), | |
"otherNames" => V::optional(v::stringType()), | |
"gender" => V::in(['1', '2']), // | |
"dateOfBirth" => V::notBlank()->date('Y-m-d'), | |
"address" => V::notBlank()->stringType(), | |
"swiftCode" => V::optional(v::stringType()), | |
"city" => V::notBlank()->stringType(), | |
"country" =>V::notBlank()->stringType(), | |
//"residency" =>V::notBlank()->stringType(), | |
"state" => V::notBlank()->stringType(), | |
"LGA" => V::optional(v::stringType()), | |
"emailAddress" => V::notBlank()->stringType(), | |
"phoneNumber" => V::notBlank()->stringType(), | |
"politicallyExposed" => V::optional(v::stringType()), | |
"employmentType" => V::optional(v::stringType()), | |
"occupation" => V::optional(v::stringType()), | |
"bankAcctName" => V::optional(v::stringType()), | |
"bankAcctNumber" => V::optional(v::stringType()), | |
"bankName" =>V::optional(v::stringType()), | |
"bankCode" => V::optional(v::stringType()), | |
"bankAcctName2" => V::optional(v::stringType()), | |
"bankAcctNumber2" => V::optional(v::stringType()), | |
"bankName2" => V::optional(v::stringType()), | |
"bankCode2" => V::optional(v::stringType()), | |
"BVNNumber" => V::optional(v::stringType()), | |
"beneficiaryName" => V::optional(v::stringType()), | |
"beneficiaryAcctNo" => V::optional(v::stringType()), | |
"beneficiaryBankName" => V::optional(v::stringType()), | |
"beneficiaryBankAddress" => V::optional(v::stringType()), | |
"correspondentName" => V::optional(v::stringType()), | |
"correspondentAcctNo" => V::optional(v::stringType()), | |
"companyName" => V::optional(v::stringType()), | |
"nextOfKin" =>V::optional(v::stringType()), | |
"nextOfKinPhone" => V::optional(v::stringType()), | |
"nextOfKinEmail" =>V::optional(v::stringType()), | |
"nextOfKinAddress" => V::optional(v::stringType()), | |
"nextOfKinGender" => V::optional(v::stringType()), | |
"nextOfKinDOB" => V::optional(v::stringType()), | |
"nextOfKinRelationship" => V::optional(v::stringType()), | |
"identityType" =>V::optional(v::stringType()), | |
"identityNumber" => V::optional(v::stringType()), | |
"identityExpiryDate" => V::optional(v::stringType()), | |
"employerName"=> V::optional(v::stringType()), | |
"employerNo" => V::optional(v::stringType()), | |
"employerAddress" => V::optional(v::stringType()), | |
"sortCode" => V::optional(v::stringType()), | |
"previousCHN" => V::optional(v::stringType()), | |
"businessInvolvement" => V::optional(v::stringType()), //optional | |
"involvementType" => V::optional(v::stringType()), | |
// "agreementCheck" => V::notBlank(), | |
"authorisedSignatureName"=> V::optional(v::stringType()), | |
]); | |
}elseif(strtoupper($payload['accountOpeningProduct']) == "REGISTRAR" ){ | |
$payload['CSRL'] = 1; | |
// if( $payload['accountType'] == "IND"){ //individual account | |
validate($payload, [ | |
"Title" => V::optional(v::stringType()), | |
"accountType" => V::in(['IND', 'CORP']), | |
"firstName" => V::notBlank()->stringType(), | |
"lastName" => V::notBlank()->stringType(), | |
"otherNames" => V::optional(v::stringType()), | |
"gender" => V::in(['1', '2']), // | |
"dateOfBirth" => V::notBlank()->date('Y-m-d'), | |
"address" => V::notBlank()->stringType(), | |
"swiftCode" => V::optional(v::stringType()), | |
// "city" => V::notBlank()->stringType(), | |
// "country" =>V::notBlank()->stringType(), | |
//"residency" =>V::notBlank()->stringType(), | |
// "state" => V::notBlank()->stringType(), | |
"LGA" => V::optional(v::stringType()), | |
"emailAddress" => V::notBlank()->stringType(), | |
"phoneNumber" => V::notBlank()->stringType(), | |
"politicallyExposed" => V::optional(v::stringType()), | |
"employmentType" => V::optional(v::stringType()), | |
"occupation" => V::optional(v::stringType()), | |
"bankAcctName" => V::optional(v::stringType()), | |
"bankAcctNumber" => V::optional(v::stringType()), | |
"bankName" =>V::optional(v::stringType()), | |
"bankCode" => V::optional(v::stringType()), | |
"bankAcctName2" => V::optional(v::stringType()), | |
"bankAcctNumber2" => V::optional(v::stringType()), | |
"bankName2" => V::optional(v::stringType()), | |
"bankCode2" => V::optional(v::stringType()), | |
"BVNNumber" => V::optional(v::stringType()), | |
"beneficiaryName" => V::optional(v::stringType()), | |
"beneficiaryAcctNo" => V::optional(v::stringType()), | |
"beneficiaryBankName" => V::optional(v::stringType()), | |
"beneficiaryBankAddress" => V::optional(v::stringType()), | |
"correspondentName" => V::optional(v::stringType()), | |
"correspondentAcctNo" => V::optional(v::stringType()), | |
"companyName" => V::optional(v::stringType()), | |
"nextOfKin" =>V::optional(v::stringType()), | |
"nextOfKinPhone" => V::optional(v::stringType()), | |
"nextOfKinEmail" =>V::optional(v::stringType()), | |
"nextOfKinAddress" => V::optional(v::stringType()), | |
"nextOfKinGender" => V::optional(v::stringType()), | |
"nextOfKinDOB" => V::optional(v::stringType()), | |
"nextOfKinRelationship" => V::optional(v::stringType()), | |
"identityType" =>V::optional(v::stringType()), | |
"identityNumber" => V::optional(v::stringType()), | |
"identityExpiryDate" => V::optional(v::stringType()), | |
"employerName"=> V::optional(v::stringType()), | |
"employerNo" => V::optional(v::stringType()), | |
"employerAddress" => V::optional(v::stringType()), | |
"sortCode" => V::optional(v::stringType()), | |
"previousCHN" => V::optional(v::stringType()), | |
"businessInvolvement" => V::optional(v::stringType()), //optional | |
"involvementType" => V::optional(v::stringType()), | |
// "agreementCheck" => V::notBlank(), | |
"authorisedSignatureName"=> V::optional(v::stringType()), | |
]); | |
}else{ | |
if(strtoupper($payload['accountType']) == "IND"){ | |
validate($payload, [ | |
"Title" => V::optional(v::stringType()),// V::notBlank()->stringType(), | |
"accountType" => V::in(['IND', 'CORP']), | |
// "USMarket" => V::in([true, false]), | |
"firstName" => V::notBlank()->stringType(), | |
"lastName" => V::notBlank()->stringType(), | |
"otherNames" => V::optional(v::stringType()), | |
"maidenName" => V::optional(v::stringType()), | |
"gender" => V::in(['1', '2']), | |
"dateOfBirth" => V::notBlank()->date('Y-m-d'), | |
"address" => V::notBlank()->stringType(), | |
"swiftCode" => V::optional(v::stringType()), | |
"city" => V::notBlank()->stringType(), | |
"country" => V::notBlank(), | |
//"residency" =>V::notBlank()->stringType(), | |
"state" => V::notBlank()->stringType(), | |
"LGA" => V::notBlank()->stringType(), | |
"emailAddress" => V::notBlank()->stringType(), | |
"phoneNumber" => V::optional(v::stringType()), | |
"politicallyExposed" => V::optional(v::stringType()),//V::notBlank(), | |
"employmentType" => V::optional(v::stringType()),//V::notBlank()->stringType(), | |
"occupation" => V::optional(v::stringType()), | |
"bankAcctName" => V::optional(v::stringType()),//V::notBlank()->stringType(), | |
"bankAcctNumber" =>V::optional(v::stringType()),// V::notBlank(), | |
"bankName" => V::optional(v::stringType()),//V::notBlank(), | |
"bankCode" =>V::optional(v::stringType()),//V::notBlank(), | |
"bankAcctName2" => V::optional(v::stringType()), | |
"bankAcctNumber2" => V::optional(v::stringType()), | |
"bankName2" => V::optional(v::stringType()), | |
"bankCode2" => V::optional(v::stringType()), | |
"BVNNumber" => V::optional(v::stringType()), | |
"beneficiaryName" => V::optional(v::stringType()), | |
"beneficiaryAcctNo" => V::optional(v::stringType()), | |
"beneficiaryBankName" => V::optional(v::stringType()), | |
"beneficiaryBankAddress" => V::optional(v::stringType()), | |
"correspondentName" => V::optional(v::stringType()), | |
"correspondentAcctNo" => V::optional(v::stringType()), | |
"companyName" => V::optional(v::stringType()), | |
"nextOfKin" => V::notBlank(), | |
"nextOfKinPhone" => V::optional(v::stringType()),//V::notBlank(), | |
"nextOfKinEmail" => V::optional(v::stringType()),//V::notBlank(), | |
"nextOfKinAddress" => V::optional(v::stringType()),// V::notBlank(), | |
"nextOfKinGender" => V::optional(v::stringType()),// V::notBlank(), | |
"nextOfKinDOB" => V::optional(v::stringType()),//V::notBlank()->date('Y-m-d'), | |
"nextOfKinRelationship" => V::optional(v::stringType()),//V::notBlank(), | |
"identityType" => V::optional(v::stringType()),//V::notBlank(), | |
"identityNumber" => V::optional(v::stringType()),//V::notBlank(), | |
"identityExpiryDate" => V::optional(v::stringType()),// V::notBlank()->date('Y-m-d'), | |
"employerName"=> V::optional(v::stringType()), | |
"employerNo" => V::optional(v::stringType()), | |
"employerAddress" => V::optional(v::stringType()), | |
"sortCode" => V::optional(v::stringType()), | |
"previousCHN" => V::optional(v::stringType()), | |
"businessInvolvement" => V::notBlank(),//->arrayVal(), //optional | |
"involvementType" => V::notBlank(),//->arrayVal(), // V::optional(v::arrayVal()), | |
"authorisedSignatureName"=> V::notBlank() | |
]); | |
}else if(strtoupper($payload['accountType']) == "CORP"){ | |
validate($payload, [ | |
"Title" => V::optional(v::stringType()), | |
"accountType" => V::in(['IND', 'CORP']), | |
// "USMarket" => V::notBlank()->stringType(), | |
"firstName" => V::optional(v::stringType()), | |
"lastName" =>V::optional(v::stringType()), | |
"otherNames" => V::optional(v::stringType()), | |
"city" => V::notBlank()->stringType(), | |
"country" => V::notBlank()->stringType(), | |
"dateOfBirth" => V::notBlank()->date('Y-m-d'), | |
"gender" =>V::optional(v::stringType()), | |
"address" => V::notBlank()->stringType(), | |
"state" => V::notBlank()->stringType(), | |
"LGA" => V::notBlank()->stringType(), | |
"emailAddress" => V::optional(v::stringType()),//V::notBlank()->stringType(), | |
"PhoneNumber" => V::optional(v::stringType()), | |
"politicallyExposed" =>V::optional(v::stringType()), | |
"companyName" => V::notBlank(), | |
"employmentType" => V::optional(v::stringType()), | |
"occupation" => V::optional(v::stringType()), | |
"bankAcctName" => V::optional(v::stringType()),//V::notBlank()->stringType(), | |
"bankAcctNumber" => V::optional(v::stringType()),//V::notBlank(), | |
"bankName" => V::optional(v::stringType()),//V::notBlank(), | |
"bankCode" => V::optional(v::stringType()), | |
"BVNNumber" => V::optional(v::stringType()), | |
"beneficiaryName" => V::optional(v::stringType()), | |
"beneficiaryAcctNo" => V::optional(v::stringType()), | |
"beneficiaryBankName" => V::optional(v::stringType()), | |
"beneficiaryBankAddress" => V::optional(v::stringType()), | |
"correspondentName" => V::optional(v::stringType()), | |
"correspondentAcctNo" => V::optional(v::stringType()), | |
"nextOfKin" => V::optional(v::stringType()), | |
"nextOfKinPhone" =>V::optional(v::stringType()), | |
"nextOfKinEmail" =>V::optional(v::stringType()), | |
"nextOfKinAddress" => V::optional(v::stringType()), | |
"nextOfKinGender" =>V::optional(v::stringType()), | |
"nextOfKinDOB" => V::optional(v::date('Y-m-d')), | |
"nextOfKinRelationship" => V::optional(v::stringType()), | |
"identityType" => V::optional(v::stringType()),//V::notBlank(), | |
"identityNumber" => V::optional(v::stringType()),//V::notBlank(), | |
"identityExpiryDate" => V::optional(v::stringType()),//V::notBlank()->date('Y-m-d'), | |
"employerName"=> V::optional(v::stringType()), | |
"employerNo" => V::optional(v::stringType()), | |
"employerAddress" => V::optional(v::stringType()), | |
"sortCode" => V::optional(v::stringType()), | |
"swiftCode" => V::optional(v::stringType()), | |
"RCNo" => V::optional(v::stringType()), | |
"incorporationDate" => V::notBlank()->date('Y-m-d'), //optional | |
"taxID" => V::optional(v::stringType()), | |
"previousCHN" => V::optional(v::stringType()), | |
"businessInvolvement" => V::optional(v::stringType()), | |
"correspondentBankNo" => V::optional(v::stringType()), | |
"correspondentBankName" => V::optional(v::stringType()), | |
"businessInvolvement" => V::notBlank(),//->arrayVal(), //optional | |
"involvementType" => V::notBlank(),//->arrayVal(), | |
// 'involvementTypeBusiness' => V::notBlank(),//->arrayVal(), | |
"primaryContactName" => V::optional(v::stringType()), | |
"primaryContactPhone" => V::optional(v::stringType()), | |
"primaryContactEmail" => V::optional(v::stringType()), | |
"primaryContactDesignation" => V::optional(v::stringType()), | |
"secondaryContactName" => V::optional(v::stringType()), | |
"secondaryContactPhone" => V::optional(v::stringType()), | |
"secondaryContactEmail" => V::optional(v::stringType()), | |
"secondaryContactDesignation" => V::optional(v::stringType()), | |
"authorisedSignatureName"=> V::notBlank(), | |
"identityDocument"=> V::optional(v::stringType()),//V::notBlank(), | |
"passport"=> V::optional(v::stringType()),//V::notBlank(), | |
"signature"=> V::optional(v::stringType()),//V::notBlank(), | |
"certificateOfIncoporation"=> V::optional(v::stringType()),//V::notBlank(), | |
"CACDocuments"=> V::optional(v::stringType()),//V::notBlank(), | |
"memorandomAndArticleOfIncorporation"=> V::optional(v::stringType()),//V::notBlank(), | |
]); | |
}else{} | |
} | |
$result = $this->customerModel->createAddtionalAccount($payload); | |
return $response | |
->withStatus($result['code'] ?? 200) | |
->withJson($result["message"]); | |
}); | |
/** | |
* KYC Report | |
* | |
* This API endpoint is used to list pending Know Your Customer (KYC) requests based on their status. | |
* | |
* @param {string} status - The status of the KYC requests. Can be 'pending', 'approved', or 'rejected'. | |
* @return {Object} Response - JSON response containing the KYC report for the specified status. | |
* | |
* @throws {Error} 400 - Bad Request: If the 'status' parameter is missing or invalid. | |
* @throws {Error} 500 - Internal Server Error: If an unexpected error occurs while fetching the KYC report. | |
* | |
* @OA\Get( | |
* path="/api/customer/KYCReport", | |
* tags={"Customer"}, | |
* summary="KYC Report", | |
* operationId="KYCReport", | |
* @OA\Parameter( | |
* name="status", | |
* in="query", | |
* required=true, | |
* description="The status of the KYC requests (pending, approved, rejected)", | |
* @OA\Schema( | |
* type="string", | |
* enum={"pending", "approved", "rejected"} | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Successful operation", | |
* @OA\JsonContent( | |
* @OA\Property(property="result", type="array", @OA\Items(type="object")), | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ) | |
* ) | |
*/ | |
//Created by Tayo 31st of August to list pending KYC requests | |
$app->get('/api/customer/KYCReport', function($request, $response){ | |
$payload = $request->getQueryParams(); | |
validate($payload, [ | |
'status' => [ | |
'rules' => V::in(['pending', 'approved', 'rejected']), | |
// 'message' => 'status is required' | |
] | |
]); | |
$result = $this->customerModel->KYCReport($payload['status']); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
/** | |
* KYC Image | |
* | |
* This API endpoint is used to retrieve KYC images for a specific KYC request. | |
* | |
* @param {string} requestID - The unique identifier of the KYC request. | |
* @return {Object} Response - JSON response containing the KYC images for the specified requestID. | |
* | |
* @throws {Error} 400 - Bad Request: If the 'requestID' parameter is missing or empty. | |
* @throws {Error} 500 - Internal Server Error: If an unexpected error occurs while fetching the KYC images. | |
* | |
* @OA\Get( | |
* path="/api/customer/KYCImage", | |
* tags={"Customer"}, | |
* summary="KYC Image", | |
* operationId="KYCImage", | |
* @OA\Parameter( | |
* name="requestID", | |
* in="query", | |
* required=true, | |
* description="The unique identifier of the KYC request", | |
* @OA\Schema( | |
* type="string", | |
* format="uuid" | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Successful operation", | |
* @OA\JsonContent( | |
* @OA\Property(property="result", type="array", @OA\Items(type="string")), | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ) | |
* ) | |
*/ | |
//Created by Tayo 31st of August to list pending KYC Images for a particular client | |
$app->get('/api/customer/KYCImage', function($request, $response){ | |
validate($request, [ | |
'requestID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'requestID is required' | |
], | |
]); | |
$payload = $request->getQueryParams(); | |
$result = $this->customerModel->KYCImages($payload); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
/** | |
* IWKYC Image | |
* | |
* This API endpoint is used to retrieve IWKYC (International Wire Transfer) images for a specific customer. | |
* | |
* @param {string} CustID - The unique identifier of the customer. | |
* @return {Object} Response - JSON response containing the IWKYC images for the specified CustID. | |
* | |
* @throws {Error} 400 - Bad Request: If the 'CustID' parameter is missing or empty. | |
* @throws {Error} 500 - Internal Server Error: If an unexpected error occurs while fetching the IWKYC images. | |
* | |
* @OA\Get( | |
* path="/api/customer/IWKYCImage", | |
* tags={"Customer"}, | |
* summary="IWKYC Image", | |
* operationId="IWKYCImage", | |
* @OA\Parameter( | |
* name="CustID", | |
* in="query", | |
* required=true, | |
* description="The unique identifier of the customer", | |
* @OA\Schema( | |
* type="string", | |
* format="uuid" | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Successful operation", | |
* @OA\JsonContent( | |
* @OA\Property(property="result", type="array", @OA\Items(type="string")), | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/IWKYCImage', function($request, $response){ | |
validate($request, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
]); | |
$payload = $request->getQueryParams(); | |
$result = $this->customerModel->IWKYCImage($payload); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
/** | |
* IWKYC Report | |
* | |
* This API endpoint is used to retrieve the IWKYC (International Wire Transfer) report. | |
* The report contains information about IWKYC requests for international wire transfers. | |
* | |
* @return {Object} Response - JSON response containing the IWKYC report. | |
* | |
* @throws {Error} 500 - Internal Server Error: If an unexpected error occurs while fetching the IWKYC report. | |
* | |
* @OA\Get( | |
* path="/api/customer/IWKYCReport", | |
* tags={"Customer"}, | |
* summary="IWKYC Report", | |
* operationId="IWKYCReport", | |
* @OA\Response( | |
* response=200, | |
* description="Successful operation", | |
* @OA\JsonContent( | |
* @OA\Property(property="result", type="array", @OA\Items(type="object")), | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ) | |
* ) | |
*/ | |
//Created by Tayo 31st of August to retrieve KYC log from Infoware Middleware | |
$app->get('/api/customer/IWKYCReport', function($request, $response){ | |
$result = $this->customerModel->IWKYCReport(); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
/** | |
* KYC Approval | |
* | |
* This API endpoint is used to approve a KYC (Know Your Customer) request. | |
* | |
* @param {string} ID - The record ID of the KYC request to be approved. | |
* @param {string} admin - The username of the admin who is approving the KYC request. | |
* | |
* @return {Object} Response - JSON response containing the result of the KYC approval. | |
* | |
* @throws {Error} 400 - Bad Request: If the "ID" or "admin" parameter is missing or empty. | |
* @throws {Error} 401 - Unauthorized: If the user making the request is not authorized to approve KYC requests. | |
* @throws {Error} 500 - Internal Server Error: If an unexpected error occurs while processing the KYC approval. | |
* | |
* @OA\Post( | |
* path="/api/customer/KYCApprove", | |
* tags={"Customer"}, | |
* summary="KYC Approval", | |
* operationId="KYCApprove", | |
* @OA\RequestBody( | |
* required=true, | |
* @OA\JsonContent( | |
* @OA\Property(property="ID", type="string"), | |
* @OA\Property(property="admin", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Successful operation", | |
* @OA\JsonContent( | |
* @OA\Property(property="result", type="string"), | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ) | |
* ) | |
*/ | |
//Created by Tayo 31st of August to approve KYC requests in local db | |
$app->post('/api/customer/KYCApprove', function($request, $response){ | |
validate($request, [ | |
'ID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'record ID is required' | |
], | |
'admin' => [ | |
'rules' => V::notBlank(), | |
'message' => 'admin is required' | |
] | |
]); | |
$payload = $request->getParsedBody(); | |
$payload['userName'] = $payload['admin']; | |
$result = $this->customerModel->KYCApprove($payload); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
/** | |
* KYC Rejection | |
* | |
* This API endpoint is used to reject a KYC (Know Your Customer) request. | |
* | |
* @param {string} ID - The record ID of the KYC request to be rejected. | |
* @param {string} comment - The comment or reason for rejecting the KYC request. | |
* @param {string} admin - The username of the admin who is rejecting the KYC request. | |
* | |
* @return {Object} Response - JSON response containing the result of the KYC rejection. | |
* | |
* @throws {Error} 400 - Bad Request: If the "ID", "comment", or "admin" parameter is missing or empty. | |
* @throws {Error} 401 - Unauthorized: If the user making the request is not authorized to reject KYC requests. | |
* @throws {Error} 500 - Internal Server Error: If an unexpected error occurs while processing the KYC rejection. | |
* | |
* @OA\Post( | |
* path="/api/customer/KYCReject", | |
* tags={"Customer"}, | |
* summary="KYC Rejection", | |
* operationId="KYCReject", | |
* @OA\RequestBody( | |
* required=true, | |
* @OA\JsonContent( | |
* @OA\Property(property="ID", type="string"), | |
* @OA\Property(property="comment", type="string"), | |
* @OA\Property(property="admin", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Successful operation", | |
* @OA\JsonContent( | |
* @OA\Property(property="result", type="string"), | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ) | |
* ) | |
*/ | |
//Created by Tayo 31st of August to approve KYC requests in local db | |
$app->post('/api/customer/KYCReject', function($request, $response){ | |
validate($request, [ | |
'ID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'record ID is required' | |
], | |
'comment' => [ | |
'rules' => V::notBlank(), | |
'message' => 'rejection comment is required' | |
], | |
'admin' => [ | |
'rules' => V::notBlank(), | |
'message' => 'admin is required' | |
] | |
]); | |
$payload = $request->getParsedBody(); | |
$payload['userName'] = $payload['admin']; | |
$result = $this->customerModel->KYCReject($payload); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
/** | |
* IWKYC Approval | |
* | |
* This API endpoint is used to approve an IWKYC (International Know Your Customer) request. | |
* | |
* @param {string} CustID - The customer ID associated with the IWKYC request. | |
* @param {string} fullName - The full name of the customer. | |
* @param {string} emailAddress - The email address of the customer. | |
* @param {string} phoneNumber - The phone number of the customer. | |
* | |
* @return {Object} Response - JSON response containing the result of the IWKYC approval. | |
* | |
* @throws {Error} 400 - Bad Request: If any of the required parameters ("CustID", "fullName", "emailAddress", "phoneNumber") is missing or empty. | |
* @throws {Error} 401 - Unauthorized: If the user making the request is not authorized to approve IWKYC requests. | |
* @throws {Error} 500 - Internal Server Error: If an unexpected error occurs while processing the IWKYC approval. | |
* | |
* @OA\Post( | |
* path="/api/customer/IWKYCApprove", | |
* tags={"Customer"}, | |
* summary="IWKYC Approval", | |
* operationId="IWKYCApprove", | |
* @OA\RequestBody( | |
* required=true, | |
* @OA\JsonContent( | |
* @OA\Property(property="CustID", type="string"), | |
* @OA\Property(property="fullName", type="string"), | |
* @OA\Property(property="emailAddress", type="string"), | |
* @OA\Property(property="phoneNumber", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Successful operation", | |
* @OA\JsonContent( | |
* @OA\Property(property="result", type="string"), | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ) | |
* ) | |
*/ | |
//Created by Tayo 31st of August to approve pending KYC on infoware | |
$app->post('/api/customer/IWKYCApprove', function($request, $response){ | |
validate($request, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
'fullName' => [ | |
'rules' => V::notBlank(), | |
'message' => 'fullName is required' | |
], | |
'emailAddress' => [ | |
'rules' => V::notBlank(), | |
'message' => 'emailAddress is required' | |
], | |
'phoneNumber' => [ | |
'rules' => V::notBlank(), | |
'message' => 'phoneNumber is required' | |
], | |
]); | |
$payload = $request->getParsedBody(); | |
$result = $this->customerModel->IWKYCApprove($payload); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
/** | |
* IWKYC Rejection | |
* | |
* This API endpoint is used to reject an IWKYC (International Know Your Customer) request. | |
* | |
* @param {string} CustID - The customer ID associated with the IWKYC request. | |
* @param {string} fullName - The full name of the customer. | |
* @param {string} emailAddress - The email address of the customer. | |
* @param {string} phoneNumber - The phone number of the customer. | |
* @param {string} comment - The rejection comment provided by the admin. | |
* | |
* @return {Object} Response - JSON response containing the result of the IWKYC rejection. | |
* | |
* @throws {Error} 400 - Bad Request: If any of the required parameters ("CustID", "fullName", "emailAddress", "phoneNumber", "comment") is missing or empty. | |
* @throws {Error} 401 - Unauthorized: If the user making the request is not authorized to reject IWKYC requests. | |
* @throws {Error} 500 - Internal Server Error: If an unexpected error occurs while processing the IWKYC rejection. | |
* | |
* @OA\Post( | |
* path="/api/customer/IWKYCReject", | |
* tags={"Customer"}, | |
* summary="IWKYC Rejection", | |
* operationId="IWKYCReject", | |
* @OA\RequestBody( | |
* required=true, | |
* @OA\JsonContent( | |
* @OA\Property(property="CustID", type="string"), | |
* @OA\Property(property="fullName", type="string"), | |
* @OA\Property(property="emailAddress", type="string"), | |
* @OA\Property(property="phoneNumber", type="string"), | |
* @OA\Property(property="comment", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Successful operation", | |
* @OA\JsonContent( | |
* @OA\Property(property="result", type="string"), | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->post('/api/customer/IWKYCReject', function($request, $response){ | |
validate($request, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
'fullName' => [ | |
'rules' => V::notBlank(), | |
'message' => 'fullName is required' | |
], | |
'emailAddress' => [ | |
'rules' => V::notBlank(), | |
'message' => 'emailAddress is required' | |
], | |
'phoneNumber' => [ | |
'rules' => V::notBlank(), | |
'message' => 'phoneNumber is required' | |
], | |
'comment' => [ | |
'rules' => V::notBlank(), | |
'message' => 'rejection comment is required' | |
], | |
]); | |
$payload = $request->getParsedBody(); | |
$result = $this->customerModel->IWKYCReject($payload); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
//end of account opening modified by Tayo | |
//abridged version of KYC update created by Tayo 4th of September | |
/** | |
* KYC Submission | |
* | |
* This API endpoint is used to submit a KYC (Know Your Customer) request. | |
* | |
* @param {Object} Payload - The payload containing the KYC information. | |
* | |
* @return {Object} Response - JSON response containing the result of the KYC submission. | |
* | |
* @throws {Error} 400 - Bad Request: If any of the required parameters is missing or empty. | |
* @throws {Error} 401 - Unauthorized: If the user making the request is not authorized to access the KYC submission. | |
* @throws {Error} 500 - Internal Server Error: If an unexpected error occurs while processing the KYC submission. | |
* | |
* @OA\Post( | |
* path="/api/customer/KYCSubmit", | |
* tags={"Customer"}, | |
* summary="KYC Submission", | |
* operationId="KYCSubmit", | |
* @OA\RequestBody( | |
* required=true, | |
* @OA\JsonContent( | |
* @OA\Property(property="CustID", type="string"), | |
* @OA\Property(property="accountType", type="string"), | |
* @OA\Property(property="firstName", type="string"), | |
* @OA\Property(property="lastName", type="string"), | |
* @OA\Property(property="otherNames", type="string", nullable=true), | |
* @OA\Property(property="BVNFirstName", type="string"), | |
* @OA\Property(property="BVNLastName", type="string"), | |
* @OA\Property(property="BVNMiddleName", type="string", nullable=true), | |
* @OA\Property(property="emailAddress", type="string"), | |
* @OA\Property(property="phoneNumber", type="string"), | |
* @OA\Property(property="country", type="string"), | |
* @OA\Property(property="state", type="string"), | |
* @OA\Property(property="city", type="string"), | |
* @OA\Property(property="lga", type="string"), | |
* @OA\Property(property="address", type="string"), | |
* @OA\Property(property="bankAcctName", type="string"), | |
* @OA\Property(property="bankAcctNumber", type="string"), | |
* @OA\Property(property="bankName", type="string"), | |
* @OA\Property(property="bankCode", type="string"), | |
* @OA\Property(property="BVNNumber", type="string"), | |
* @OA\Property(property="sortCode", type="string"), | |
* @OA\Property(property="motherMaidenName", type="string"), | |
* @OA\Property(property="NOKName", type="string"), | |
* @OA\Property(property="RCNo", type="string", nullable=true), | |
* @OA\Property(property="bizFrom", type="string"), | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Successful operation", | |
* @OA\JsonContent( | |
* @OA\Property(property="data", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->post('/api/customer/KYCSubmit', function ($request, $response) { | |
$uploadedFiles = $request->getUploadedFiles(); | |
if (!empty($uploadedFiles)) { | |
foreach ($uploadedFiles as $key => $uploadedFile) { | |
// Validate each file | |
$validationResult = validateUploadedFile($uploadedFile); | |
if ($validationResult !== true) { | |
die($validationResult); // Handle validation failure | |
} | |
} | |
} | |
$payload = array_merge(["files" => $request->getUploadedFiles(),], $request->getParsedBody()); | |
if(strtoupper($payload["accountType"]) == "IND") | |
{ | |
//individual kyc update | |
validate($request, [ | |
"CustID" => V::notBlank(), | |
"firstName" => V::notBlank()->stringType(), | |
"lastName" => V::notBlank()->stringType(), | |
"otherNames" => V::optional(v::stringType()), | |
"BVNFirstName" => V::notBlank()->stringType(), | |
"BVNLastName" => V::notBlank()->stringType(), | |
"BVNMiddleName" => V::optional(v::stringType()), | |
"emailAddress" => V::notBlank()->stringType(), | |
"phoneNumber" => V::notBlank()->stringType(), | |
"country" => V::notBlank()->stringType(), | |
"state" => V::notBlank()->stringType(), | |
"city" => V::notBlank()->stringType(), | |
"lga" => V::notBlank()->stringType(), | |
"address" => V::notBlank()->stringType(), | |
// "address2" => V::optional()->stringType(), | |
"bankAcctName" => V::notBlank()->stringType(), | |
"bankAcctNumber" => V::notBlank()->stringType(), | |
"bankName" =>V::notBlank()->stringType(), | |
"bankCode" => V::notBlank()->stringType(), | |
"BVNNumber" => V::notBlank(), | |
"sortCode" => V::notBlank()->stringType(), | |
"motherMaidenName" => V::notBlank()->stringType(), | |
"NOKName" => V::notBlank()->stringType(), | |
// "proofOfAddress" => V::optional()->stringType(), | |
//prrofOfAddressType => V::optional()->stringType(), | |
// "identityType" => V::notBlank()->stringType(), | |
// "identityExpiryDate" => V::notBlank()->date('Y-m-d'), | |
// "identityNumber" => V::notBlank()->stringType(), | |
//"issueDate => V::notBlank()->date('Y-m-d'), | |
"accountType" => V::notBlank()->stringType(), | |
"bizFrom" => V::notBlank()->stringType(), | |
]); | |
} elseif(strtoupper($payload["accountType"]) == "CORP") | |
{ | |
//individual kyc update | |
validate($request, [ | |
"CustID" => V::notBlank(), | |
"compName" => V::notBlank()->stringType(), | |
"emailAddress" => V::notBlank()->stringType(), | |
"phoneNumber" => V::notBlank()->stringType(), | |
"country" => V::notBlank()->stringType(), | |
"state" => V::notBlank()->stringType(), | |
"city" => V::notBlank()->stringType(), | |
"lga" => V::notBlank()->stringType(), | |
"address" => V::notBlank()->stringType(), | |
// "address2" => V::optional()->stringType(), | |
"bankAcctName" => V::notBlank()->stringType(), | |
"bankAcctNumber" => V::notBlank()->stringType(), | |
"bankName" =>V::notBlank()->stringType(), | |
"bankCode" => V::notBlank()->stringType(), | |
"BVNNumber" => V::notBlank(), | |
"BVNFirstName" => V::notBlank()->stringType(), | |
"BVNLastName" => V::notBlank()->stringType(), | |
"BVNMiddleName" => V::optional(v::stringType()), | |
"sortCode" => V::notBlank()->stringType(), | |
// "proofOfAddress" => V::optional()->stringType(), | |
// "identityType" => V::notBlank()->stringType(), | |
// "identityExpiryDate" => V::notBlank()->date('Y-m-d'), | |
// "identityNumber" => V::notBlank()->stringType(), | |
//"issueDate => V::notBlank()->date('Y-m-d'), | |
"accountType" => V::notBlank()->stringType(), | |
"RCNo" => V::notBlank()->stringType(), | |
"bizFrom" => V::notBlank()->stringType(), | |
]); | |
} | |
if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$payload["CAMID"] == $request->getAttribute('CAMID'); | |
$payload["SECID"] == $request->getAttribute('SECID'); | |
$payload["ASSETID"] == $request->getAttribute('ASSETID'); | |
$result = $this->customerModel->KYCSubmit($payload); | |
$payload['CRMID'] = $this->customerModel->findCRMID($payload); | |
if($payload['CRMID'] != ""){ | |
$updateCRM = container('FreshsalesRequest')->updateContact($payload); | |
} | |
return $response | |
->withStatus($result['code']) | |
->withJson(['data' => $result['message']]); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* This API is used to update customer | |
* @author <[email protected]> | |
* | |
* @OA\Post( | |
* path="/api/customer/admin/approve/customer", | |
* tags={"Customer"}, | |
* description="This API is used to make update to new customer record", | |
* summary="This API is used to make update to new customer record", | |
* operationId="UpdateNewCustomerRequest", | |
* @OA\RequestBody( | |
* required=true, | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* @OA\Property( | |
* property="id", | |
* description="id of the request resource", | |
* type="integer" | |
* ), | |
* @OA\Property( | |
* property="status", | |
* description="1 or 2 ", | |
* type="integer" | |
* ), | |
* example={ | |
* "id" : "6", | |
* "status" : "1", | |
* "approved_by" : "Tayo Oyawale" | |
* } | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Transaction is Successful!" | |
* ), | |
* security={ | |
* {"authorization_token": {}} | |
* } | |
* ) | |
* | |
* @return mixed | |
*/ | |
$app->post('/api/customer/admin/approve/customer', function ($request, $response) { | |
validate($request, [ | |
'id' => [ | |
'rules' => V::numeric(), | |
'message' => 'Id is required' | |
], | |
'status' => [ | |
'rules' => V::numeric(), | |
'message' => 'Status is required' | |
], | |
'approved_by' => [ | |
'rules' => V::numeric(), | |
'message' => 'approved_by is required' | |
], | |
]); | |
$payload = $request->getParsedBody(); | |
$result = $this->customerModel->approveCustomerRecords($payload); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
/** | |
* This API is used to fetch customers on our local db for approval | |
* @author <[email protected]> | |
* | |
* @OA\Get( | |
* path="/api/customer/admin/new-customers", | |
* tags={"Customer"}, | |
* description="This API is used to get all new-customer", | |
* summary="This API is used to get all new-customer", | |
* operationId="FetchAllNewCustomersForAdmin", | |
* @OA\Parameter( | |
* description="This has 2 level of approval, 1 and 2. So pass this as either 1 or 2 depending on which you want to get", | |
* in="query", | |
* name="level", | |
* required=true, | |
* @OA\Schema( | |
* type="string" | |
* ), | |
* example="1 or 2" | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Transaction is Successful!" | |
* ), | |
* security={ | |
* {"authorization_token": {}} | |
* } | |
* ) | |
* | |
* @return mixed | |
*/ | |
$app->get('/api/customer/admin/new-customers', function($request, $response){ | |
validate($request, [ | |
'level' => [ | |
'rules' => V::numeric(), | |
'message' => 'level is required' | |
] | |
]); | |
$level = $request->getQueryParams()['level']; | |
$result = $this->customerModel->getAllNewCustomerForApproval($level); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
/** | |
* This API is used to get all invetsment liquidation | |
* @author <[email protected]> | |
* | |
* @OA\Get( | |
* path="/api/investment-liquidation", | |
* tags={"Customer"}, | |
* description="This API is used to get all liquidated Investment", | |
* summary="This API is used to get all liquidated Investment", | |
* operationId="FetchAllLiquidatedInvestment", | |
* @OA\Parameter( | |
* description="startDate", | |
* in="query", | |
* name="startDate", | |
* required=true, | |
* @OA\Schema( | |
* type="string" | |
* ), | |
* example="2021-12-23" | |
* ), | |
* @OA\Parameter( | |
* description="endDate", | |
* in="query", | |
* name="endDate", | |
* required=true, | |
* @OA\Schema( | |
* type="string" | |
* ), | |
* example="2021-12-30" | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Investment-liquidation successfully fetched..." | |
* ), | |
* security={ | |
* {"authorization_token": {}} | |
* } | |
* ) | |
* | |
* @return mixed | |
*/ | |
$app->get('/api/investment-liquidation', function($request, $response){ | |
validate($request, [ | |
'startDate' => V::notBlank(), | |
'endDate' => V::notBlank(), | |
]); | |
$startDate = $request->getQueryParams()['startDate']; | |
$endDate = $request->getQueryParams()['endDate']; | |
$result = formatIWRes(container('IWSRequest')->investmentLiquidation($startDate, $endDate))['data'] ?? []; | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'Investment-liquidation successfully fetched..', | |
'data' => $result | |
]); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
/** | |
* This API is used to get all accounts in debit | |
* @author <[email protected]> | |
* | |
* @OA\Get( | |
* path="/api/account-in-debit", | |
* tags={"Customer"}, | |
* description="This API is used to get all accounts in debit", | |
* summary="This API is used to get all accounts in debit", | |
* operationId="FetchAllAccountInDebit", | |
* @OA\Parameter( | |
* description="involvement", | |
* in="query", | |
* name="involvement", | |
* required=true, | |
* @OA\Schema( | |
* type="string" | |
* ), | |
* example="IWCardinalTest" | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Account in debit successfully fetched..." | |
* ), | |
* security={ | |
* {"authorization_token": {}} | |
* } | |
* ) | |
* | |
* @return mixed | |
*/ | |
$app->get('/api/account-in-debit', function($request, $response){ | |
validate($request, [ | |
'involvement' => V::notBlank() | |
]); | |
$businessInvolvement = $request->getQueryParams()['involvement']; | |
$result = formatIWRes(container('IWSRequest')->accountInDebit($businessInvolvement))['data'] ?? []; | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'Account in debit successfully fetched..', | |
'data' => $result | |
]); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
/** | |
* This API is used to get all notification sent to customers | |
* @author <[email protected]> | |
* | |
* @OA\Get( | |
* path="/api/customers/notification-sent", | |
* tags={"Customer"}, | |
* description="This API is used to get all notification sent to customers", | |
* summary="This API is used to get all notification sent to customers", | |
* operationId="FetchAllNotificationSentToCustomers", | |
* @OA\Response( | |
* response=200, | |
* description="Notification successfully fetched..." | |
* ), | |
* security={ | |
* {"authorization_token": {}} | |
* } | |
* ) | |
* | |
* @return mixed | |
*/ | |
$app->get('/api/customers/notification-sent', function($request, $response){ | |
$result = formatIWRes(container('IWSRequest')->returnClientNotificationSent())['data']; | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'Notification successfully fetched..', | |
'data' => $result | |
]); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
//editted by Tayo 22nd of June 2021 | |
/** | |
* This API is used to check if customers kyc completee or not | |
* @author <[email protected]> | |
* | |
* @OA\Get( | |
* path="/api/customer/kyc-check", | |
* tags={"Customer"}, | |
* description="This API is used to check if customers kyc completee or not", | |
* summary="This API is used to check if customers kyc completee or not", | |
* operationId="FetchCustomerKYCComplete", | |
* @OA\Parameter( | |
* description="This camid ofteh customer", | |
* in="query", | |
* name="CAMID", | |
* required=true, | |
* @OA\Schema( | |
* type="string" | |
* ), | |
* example="1869" | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Transaction is Successful!" | |
* ), | |
* security={ | |
* {"authorization_token": {}} | |
* } | |
* ) | |
* | |
* @return mixed | |
*/ | |
$app->get('/api/customer/kyc-check', function($request, $response){ | |
validate($request, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
/* 'businessInvolvement' => [ | |
'rules' => V::notBlank(), | |
'message' => 'Business Involvement is required' | |
] */ | |
]); | |
/* $CAMID = $request->getQueryParams()['CAMID']; | |
$SECID = $request->getQueryParams()['SECID']; | |
$ASSETID = $request->getQueryParams()['ASSETID']; */ | |
$payload = $request->getQueryParams(); | |
if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$payload['BIZ'] = MIDDLEWARE_DB_NAME; | |
$payload['BIZID'] = $payload['CustID']; | |
$kyc = $this->customerModel->checkIfcustomerKYCIsComplete($payload['BIZID'], $payload['BIZ']); | |
$checkKycRequest = $this->customerModel->KYCTable() | |
->orderBy('ID', 'desc') | |
->where( | |
[["CustID", "=", $payload['CustID']]]) | |
->first(); | |
// if kyc check result is null, assign incomplete kyc status | |
if(is_null($kyc)){ | |
$kyc[0] = ["Name"=> $kyc[0]["Name"], | |
"CustID"=> $kyc[0]["CustAID"], | |
"IsKYC"=> "False", | |
"Reason"=> "KYC is Pending"]; | |
} | |
//if kyc check reason is empty | |
if(((is_null($kyc[0]["Reason"]) || $kyc[0]["Reason"] == "" || $kyc[0]["Reason"] == 0) && strtoupper($kyc[0]["IsKYC"]) == "FALSE") && (strtoupper($kyc[0]["IsKYC"]) != "TRUE")){ | |
$kyc[0] = ["Name"=> $kyc[0]["Name"], | |
"CustID"=> $kyc[0]["CustAID"], | |
"IsKYC"=> $kyc[0]["IsKYC"], | |
"Reason"=> "KYC not complete"]; | |
}elseif(($kyc[0]["Reason"] == 1 || strtoupper($kyc[0]["IsKYC"]) == "TRUE")){ | |
$kyc[0] = ["Name"=> $kyc[0]["Name"], | |
"CustID"=> $kyc[0]["CustAID"], | |
"IsKYC"=> $kyc[0]["IsKYC"], | |
"Reason"=> "KYC complete"]; | |
}else{ | |
$kyc[0] = ["Name"=> $kyc[0]["Name"], | |
"CustID"=> $kyc[0]["CustAID"], | |
"IsKYC"=> $kyc[0]["IsKYC"], | |
"Reason"=> "KYC is pending"]; | |
} | |
if($checkKycRequest == null){ | |
$kyc[0]["status"] = null; | |
}else{ | |
$kyc[0]["status"] = $checkKycRequest->approval ?? "under review"; | |
} | |
$result = $kyc[0]; | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
$app->get('/api/admin/kyc-check', function($request, $response){ | |
validate($request, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
]); | |
$payload = $request->getQueryParams(); | |
$payload['BIZ'] = MIDDLEWARE_DB_NAME; | |
$payload['BIZID'] = $payload['CustID']; | |
$kyc = $this->customerModel->checkIfcustomerKYCIsComplete($payload['BIZID'], $payload['BIZ']); | |
$checkKycRequest = $this->customerModel->KYCTable() | |
->orderBy('ID', 'desc') | |
->where( | |
[["CustID", "=", $payload['CustID']]]) | |
->first(); | |
// if kyc check result is null, assign incomplete kyc status | |
if(is_null($kyc)){ | |
$kyc[0] = ["Name"=> $kyc[0]["Name"], | |
"CustID"=> $kyc[0]["CustAID"], | |
"IsKYC"=> "False", | |
"Reason"=> "KYC is Pending"]; | |
} | |
//if kyc check reason is empty | |
if(((is_null($kyc[0]["Reason"]) || $kyc[0]["Reason"] == "" || $kyc[0]["Reason"] == 0) && strtoupper($kyc[0]["IsKYC"]) == "FALSE") && (strtoupper($kyc[0]["IsKYC"]) != "TRUE")){ | |
$kyc[0] = ["Name"=> $kyc[0]["Name"], | |
"CustID"=> $kyc[0]["CustAID"], | |
"IsKYC"=> $kyc[0]["IsKYC"], | |
"Reason"=> "KYC not complete"]; | |
}elseif(($kyc[0]["Reason"] == 1 || strtoupper($kyc[0]["IsKYC"]) == "TRUE")){ | |
$kyc[0] = ["Name"=> $kyc[0]["Name"], | |
"CustID"=> $kyc[0]["CustAID"], | |
"IsKYC"=> $kyc[0]["IsKYC"], | |
"Reason"=> "KYC complete"]; | |
}else{ | |
$kyc[0] = ["Name"=> $kyc[0]["Name"], | |
"CustID"=> $kyc[0]["CustAID"], | |
"IsKYC"=> $kyc[0]["IsKYC"], | |
"Reason"=> "KYC is pending"]; | |
} | |
if($checkKycRequest == null){ | |
$kyc[0]["status"] = null; | |
}else{ | |
$kyc[0]["status"] = $checkKycRequest->approval ?? "under review"; | |
} | |
$result = $kyc[0]; | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
/** | |
* This API is used to fetch the state and lga | |
* @author <[email protected]> | |
* | |
* @OA\Get( | |
* path="/api/customer/state-lga", | |
* tags={"Customer"}, | |
* description="This API is used to fetch the state and lga", | |
* summary="This API is used to fetch the state and lga", | |
* operationId="FetchStateAndLGA", | |
* @OA\Response( | |
* response=200, | |
* description="Transaction is Successful!" | |
* ), | |
* security={ | |
* {"authorization_token": {}} | |
* } | |
* ) | |
* | |
* @return mixed | |
*/ | |
$app->get('/api/customer/state-lga', function($request, $response){ | |
$result = $this->customerModel->stateAndLGA(); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}); | |
/** | |
* This API is used to fetch the client Fi and EIn product | |
* @author <[email protected]> | |
* | |
* @OA\Get( | |
* path="/api/customer-product/fi-ein", | |
* tags={"Snapnet"}, | |
* description="This API is used to fetch the client Fi and EIn product", | |
* summary="This API is used to fetch the client Fi and EIn product", | |
* operationId="getFIEINProducts", | |
* @OA\Parameter( | |
* description="This is date needed to run the query", | |
* in="query", | |
* name="queryDate", | |
* required=true, | |
* @OA\Schema( | |
* type="string" | |
* ), | |
* example="2021-03-24" | |
* ), | |
* @OA\Parameter( | |
* description="custAID of the customer", | |
* in="query", | |
* name="custAID", | |
* required=false, | |
* @OA\Schema( | |
* type="string" | |
* ), | |
* example="DEMO1" | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Transaction is Successful!" | |
* ), | |
* security={ | |
* {"authorization_token": {}} | |
* } | |
* ) | |
* | |
* @return mixed | |
*/ | |
$app->get('/api/customer-product/fi-ein', function($request, $response){ | |
validate($request, [ | |
'queryDate' => [ | |
'rules' => V::notBlank(), | |
'message' => 'Date is required' | |
], | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
] | |
]); | |
$CustID = $request->getQueryParams()['CustID']; | |
if($CustID != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$queryDate = $request->getQueryParams()['queryDate']; | |
$result = formatIWRes( | |
container('IWSRequest')->getClientsFI_EINProducts($CustID, $queryDate))['data'] ?? []; | |
return $response | |
->withStatus(200) | |
->withJson([ | |
"message" => "Successfully fetch Customer Fi-EIN Product", | |
"data"=> $result | |
]); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* This API is used to retun the stock holding | |
* @author <[email protected]> | |
* | |
* @OA\Get( | |
* path="/api/customer-product/stockholding", | |
* tags={"Snapnet"}, | |
* description="This API is used to retun the stock holding", | |
* summary="This API is used to retun the stock holding", | |
* operationId="getCustomerStockHolding", | |
* @OA\Parameter( | |
* description="This is date needed to run the query", | |
* in="query", | |
* name="queryDate", | |
* required=true, | |
* @OA\Schema( | |
* type="string" | |
* ), | |
* example="2021-03-24" | |
* ), | |
* @OA\Parameter( | |
* description="custAID of the customer", | |
* in="query", | |
* name="custAID", | |
* required=false, | |
* @OA\Schema( | |
* type="string" | |
* ), | |
* example="DEMO1" | |
* ), | |
* @OA\Parameter( | |
* description="CSCSNumber of the customer", | |
* in="query", | |
* name="CSCSNumber", | |
* required=false, | |
* @OA\Schema( | |
* type="string" | |
* ), | |
* example="0034983394" | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Transaction is Successful!" | |
* ), | |
* security={ | |
* {"authorization_token": {}} | |
* } | |
* ) | |
* | |
* @return mixed | |
*/ | |
$app->get('/api/customer-product/stockholding', function($request, $response){ | |
validate($request, [ | |
'queryDate' => [ | |
'rules' => V::notBlank(), | |
'message' => 'Date is required' | |
], | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
'CSCSNumber' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CSCSNumber is required' | |
] | |
]); | |
$SECID = $request->getAttribute('SECID'); | |
$CustID = $request->getQueryParams()['CustID']; | |
if($CustID != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$queryDate = $request->getQueryParams()['queryDate']; | |
$CSCSNumber = $request->getQueryParams()['CSCSNumber']; | |
$result = $this->customerModel->getClientStockHolding($SECID, $CSCSNumber, $queryDate); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
"message" => "Successfully fetch Customer Stockholding", | |
"data"=> $result | |
]); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* This API is used to retun the inflow and outflow | |
* @author <[email protected]> | |
* | |
* @OA\Get( | |
* path="/api/customer-product/inflow-outflow", | |
* tags={"Snapnet"}, | |
* description="This API is used to retun the inflow and outflow", | |
* summary="This API is used to retun the inflow and outflow", | |
* operationId="getCustomerInflowOutflow", | |
* @OA\Parameter( | |
* description="This is date needed to run the query", | |
* in="query", | |
* name="startDate", | |
* required=true, | |
* @OA\Schema( | |
* type="string" | |
* ), | |
* example="2021-03-12" | |
* ), | |
* @OA\Parameter( | |
* description="endDate", | |
* in="query", | |
* name="endDate", | |
* required=true, | |
* @OA\Schema( | |
* type="string" | |
* ), | |
* example="2021-03-24" | |
* ), | |
* @OA\Parameter( | |
* description="custAID of the customer", | |
* in="query", | |
* name="custAID", | |
* required=true, | |
* @OA\Schema( | |
* type="string" | |
* ), | |
* example="DEMO1" | |
* ), | |
* @OA\Parameter( | |
* description="currency", | |
* in="query", | |
* name="currency", | |
* required=true, | |
* @OA\Schema( | |
* type="string" | |
* ), | |
* example="NGN,USD or GPB" | |
* ), | |
* @OA\Parameter( | |
* description="businessInvolvement", | |
* in="query", | |
* name="businessInvolvement", | |
* required=true, | |
* @OA\Schema( | |
* type="string" | |
* ), | |
* example="IWCardinal" | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Transaction is Successful!" | |
* ), | |
* security={ | |
* {"authorization_token": {}} | |
* } | |
* ) | |
* | |
* @return mixed | |
*/ | |
$app->get('/api/customer-product/inflow-outflow', function($request, $response){ | |
validate($request, [ | |
'startDate' => [ | |
'rules' => V::date('Y-m-d'), | |
'message' => 'startDate is required' | |
], | |
'endDate' => [ | |
'rules' => V::date('Y-m-d'), | |
'message' => 'endDate is required' | |
], | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
'currency' => [ | |
'rules' => V::notBlank(), | |
'message' => 'currency is required' | |
], | |
'businessInvolvement' => [ | |
'rules' => V::notBlank(), | |
'message' => 'businessInvolvement is required' | |
] | |
]); | |
$CustID = $request->getQueryParams()['CustID']; | |
if($CustID != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$startDate = $request->getQueryParams()['startDate']; | |
$endDate = $request->getQueryParams()['endDate']; | |
$currency = $request->getQueryParams()['currency']; | |
$businessInvolvement = $request->getQueryParams()['businessInvolvement']; | |
$result = formatIWRes( | |
container('IWSRequest')->getInflowAndOutflow($CustID, $startDate, $endDate, $currency, $businessInvolvement) | |
)['data'] ?? []; | |
return $response | |
->withStatus(200) | |
->withJson([ | |
"message" => "Successfully fetch Customer Inflow & Outflow", | |
"data"=> $result | |
]); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* This endpoint returns upcoming holiday | |
* | |
* @OA\GET( | |
* path="/api/upcoming-holidays", | |
* tags={"Holidays"}, | |
* description="This endpoint used to get upcoming holiday", | |
* summary="This endpoint used to get upcoming holiday", | |
* operationId="upcomingHoliday", | |
* @OA\Response( | |
* response=200, | |
* description="Successfully fetched Upcoming Holiday" | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Missing authentication token" | |
* ), | |
* security={ | |
* {"authorization_token": {}} | |
* } | |
* ) | |
*/ | |
$app->get('/api/upcoming-holidays', function( $request, $response ) { | |
$result = []; | |
if(!$result = container('cache')->fetch('publicHoliday')){ | |
$data = formatIWRes(container('IWSRequest')->getUpcomingHoliday()); | |
$result = $data; | |
container('cache')->save('publicHoliday', $result, 60*60*24); | |
} | |
return $response | |
->withStatus(200) | |
->withJson([ | |
"message" => "Successfully fetch Upcomig holiday", | |
"data"=> $result | |
]); | |
}); | |
/** | |
* This API is used to update customer | |
* @author <[email protected]> | |
* | |
* @OA\Post( | |
* path="/api/files/upload", | |
* tags={"Upload"}, | |
* description="This API is used for uploads", | |
* summary="This API is used for uploads", | |
* operationId="UploadFiles", | |
* @OA\Response( | |
* response=200, | |
* description="image url" | |
* ), | |
* security={ | |
* {"authorization_token": {}} | |
* } | |
* ) | |
* | |
* @return mixed | |
*/ | |
$app->post('/api/files/upload', function ($request, $response, $args) use ($app) { | |
$filename= ""; | |
$container = $app->getContainer(); | |
$container['upload_directory'] = dirname(__DIR__, 4) . "/public_view/files/"; | |
$directory = $this->get('upload_directory'); | |
$files = $request->getUploadedFiles(); | |
if (empty($files['file'])) { | |
throw new Exception('Expected a newfile'); | |
} | |
$uploadedFile = $files['file']; | |
if ($uploadedFile->getError() === UPLOAD_ERR_OK) { | |
$filename = $this->customerModel->moveUploadedFile($directory, $uploadedFile); | |
error_log('uploaded ' . $filename ); | |
} | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'url' => env('IMAGE_URL').$filename | |
]); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
$app->get('/api/check', function($request, $response){//commented by Tayo 13th of September | |
/* $payload['CustID'] = "DEMO1"; | |
$payload['CAMID'] = null; | |
$result = formatIWRes(container('IWSRequest')->createInvolvement($payload)); | |
return $response | |
->withStatus(200) | |
->withJson($result); */ | |
}); | |
/** | |
* Submit CAM Deal | |
* | |
* This API endpoint is used to submit a CAM (Capital Asset Management) deal. | |
* | |
* @param {Object} Payload - The payload containing the deal information. | |
* | |
* @return {Object} Response - JSON response containing the result of the deal submission. | |
* | |
* @throws {Error} 400 - Bad Request: If any of the required parameters is missing or empty, or if the transactionType is invalid. | |
* @throws {Error} 401 - Unauthorized: If the user making the request is not authorized to submit the deal. | |
* @throws {Error} 500 - Internal Server Error: If an unexpected error occurs while processing the deal submission. | |
* | |
* @OA\Post( | |
* path="/api/customer/submitCAMDeal", | |
* tags={"Customer"}, | |
* summary="Submit CAM Deal", | |
* operationId="submitCAMDeal", | |
* @OA\RequestBody( | |
* required=true, | |
* @OA\JsonContent( | |
* @OA\Property(property="CustID", type="string"), | |
* @OA\Property(property="transactionType", type="string"), | |
* @OA\Property(property="fullName", type="string"), | |
* @OA\Property(property="product", type="string"), | |
* @OA\Property(property="tenure", type="string", nullable=true), | |
* @OA\Property(property="rate", type="number", nullable=true), | |
* @OA\Property(property="amount", type="string"), | |
* @OA\Property(property="price", type="string"), | |
* @OA\Property(property="maturityDate", type="string"), | |
* @OA\Property(property="lastCouponDate", type="string", nullable=true), | |
* @OA\Property(property="productType", type="string"), | |
* @OA\Property(property="instrumentType", type="string"), | |
* @OA\Property(property="transNo", type="string", nullable=true), | |
* @OA\Property(property="yield", type="string", nullable=true), | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Successful operation", | |
* @OA\JsonContent( | |
* @OA\Property(property="data", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->post('/api/customer/submitCAMDeal', function( $request, $response ) { | |
$payload = $request->getParsedBody(); | |
validate($payload, [ | |
'transactionType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'transactionType is required' | |
], | |
]); | |
if(strtoupper($payload['transactionType']) == "BUY") | |
{ | |
validate($payload, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
'fullName' => [ | |
'rules' => V::notBlank(), | |
'message' => 'fullName is required' | |
], | |
'product' => [ | |
'rules' => V::notBlank(), | |
'message' => 'product is required' | |
], | |
'tenure' => [ | |
'rules' => V::notBlank(), | |
'message' => 'tenure is required' | |
], | |
'rate' => [ | |
'rules' => V::numeric(), | |
'message' => 'rate is required' | |
], | |
'amount' => [ | |
'rules' => V::notBlank(), | |
'message' => 'amount is required' | |
], | |
'price' => [ | |
'rules' => V::notBlank(), | |
'message' => 'price (issuing price for bonds and yield for tbills) is required' | |
], | |
'transactionType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'transactionType is required' | |
], | |
'maturityDate' => [ | |
'rules' => V::notBlank(), | |
'message' => 'maturityDate is required' | |
], | |
'lastCouponDate' => [ | |
'rules' => V::optional(v::stringType()), | |
'message' => 'lastCouponDate is required' | |
], | |
'productType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'productType (BONDS, TBILLS, CP, D-SMA, ND-SMA) is required' | |
], | |
'instrumentType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'instrumentType is required' | |
], | |
]); | |
}elseif(strtoupper($payload['transactionType']) == "SELL") | |
{ | |
validate($payload, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
'fullName' => [ | |
'rules' => V::notBlank(), | |
'message' => 'fullName is required' | |
], | |
'transNo' => [ | |
'rules' => V::notBlank(), | |
'message' => 'transNo is required' | |
], | |
'product' => [ | |
'rules' => V::notBlank(), | |
'message' => 'product is required' | |
], | |
'amount' => [ | |
'rules' => V::notBlank(), | |
'message' => 'amount is required' | |
], | |
'price' => [ | |
'rules' => V::notBlank(), | |
'message' => 'price (price or yield) is required' | |
], | |
'rate' => [ | |
'rules' => V::numeric(), | |
'message' => 'rate is required' | |
], | |
'transactionType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'transactionType is required' | |
], | |
'maturityDate' => [ | |
'rules' => V::notBlank(), | |
'message' => 'maturityDate is required' | |
], | |
'lastCouponDate' => [ | |
'rules' => V::optional(v::stringType()), | |
'message' => 'lastCouponDate is required' | |
], | |
'productType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'productType (BONDS or TBILLS) is required' | |
], | |
'instrumentType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'instrumentType is required' | |
], | |
]); | |
}else{ | |
return $response | |
->withStatus(400) | |
->withJson("Invalid Transaction Type"); | |
} | |
$payload["CAMID"] = $request->getAttribute('CAMID'); | |
/* if($payload["type"] = "TBILLS") | |
{ | |
validate($payload, [ | |
'yield' => [ | |
'rules' => V::notBlank(), | |
'message' => 'yield is required' | |
], | |
]); | |
} */ | |
if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$deal= $this->customerModel->submitCAMDeal($payload); | |
return $response | |
->withStatus(200) | |
->withJson($deal['message']); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* Reject CAM Deal | |
* | |
* This API endpoint is used to reject a CAM (Capital Asset Management) deal. | |
* | |
* @param {Object} Payload - The payload containing the deal information. | |
* | |
* @return {Object} Response - JSON response containing the result of the deal rejection. | |
* | |
* @throws {Error} 400 - Bad Request: If any of the required parameters is missing or empty. | |
* @throws {Error} 401 - Unauthorized: If the user making the request is not authorized to reject the deal. | |
* @throws {Error} 500 - Internal Server Error: If an unexpected error occurs while processing the deal rejection. | |
* | |
* @OA\Post( | |
* path="/api/customer/rejectCAMDeal", | |
* tags={"Customer"}, | |
* summary="Reject CAM Deal", | |
* operationId="rejectCAMDeal", | |
* @OA\RequestBody( | |
* required=true, | |
* @OA\JsonContent( | |
* @OA\Property(property="ID", type="string"), | |
* @OA\Property(property="CustID", type="string"), | |
* @OA\Property(property="admin", type="string"), | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Successful operation", | |
* @OA\JsonContent( | |
* @OA\Property(property="data", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->post('/api/customer/rejectCAMDeal', function( $request, $response ) { | |
$payload = $request->getParsedBody(); | |
validate($payload, [ | |
'ID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'ID is required' | |
], | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
'admin' => [ | |
'rules' => V::notBlank(), | |
'message' => 'admin is required' | |
], | |
]); | |
$deal= $this->customerModel->rejectCAMDeal($payload); | |
return $response | |
->withStatus($deal['code'] ?? 200) | |
->withJson($deal['message']); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
/** | |
* Approve CAM Deal | |
* | |
* This API endpoint is used to approve a CAM (Capital Asset Management) deal. | |
* | |
* @param {Object} Payload - The payload containing the deal information. | |
* | |
* @return {Object} Response - JSON response containing the result of the deal approval. | |
* | |
* @throws {Error} 400 - Bad Request: If any of the required parameters is missing or empty. | |
* @throws {Error} 401 - Unauthorized: If the user making the request is not authorized to approve the deal. | |
* @throws {Error} 500 - Internal Server Error: If an unexpected error occurs while processing the deal approval. | |
* | |
* @OA\Post( | |
* path="/api/customer/approveCAMDeal", | |
* tags={"Customer"}, | |
* summary="Approve CAM Deal", | |
* operationId="approveCAMDeal", | |
* @OA\RequestBody( | |
* required=true, | |
* @OA\JsonContent( | |
* @OA\Property(property="ID", type="string"), | |
* @OA\Property(property="CustID", type="string"), | |
* @OA\Property(property="admin", type="string"), | |
* @OA\Property(property="CAMID", type="string"), | |
* @OA\Property(property="fullName", type="string"), | |
* @OA\Property(property="product", type="string"), | |
* @OA\Property(property="tenure", type="string"), | |
* @OA\Property(property="interestRate", type="string"), | |
* @OA\Property(property="amount", type="string"), | |
* @OA\Property(property="ledgerType", type="string"), | |
* @OA\Property(property="transactionType", type="string"), | |
* @OA\Property(property="productType", type="string"), | |
* @OA\Property(property="investmentType", type="string"), | |
* @OA\Property(property="involvementType", type="string"), | |
* @OA\Property(property="capitalizeOnRollover", type="string"), | |
* @OA\Property(property="doAutomaticRollover", type="string"), | |
* @OA\Property(property="upfrontInterest", type="string"), | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Successful operation", | |
* @OA\JsonContent( | |
* @OA\Property(property="data", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->post('/api/customer/approveCAMDeal', function( $request, $response ) { | |
$payload = $request->getParsedBody(); | |
validate($payload, [ | |
'ID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'ID is required' | |
], | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
'admin' => [ | |
'rules' => V::notBlank(), | |
'message' => 'admin is required' | |
], | |
'CAMID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CAMID is required' | |
], | |
/* 'transNo' => [ | |
'rules' => V::notBlank(), | |
'message' => 'transNo is required' | |
], */ | |
'fullName' => [ | |
'rules' => V::notBlank(), | |
'message' => 'fullName is required' | |
], | |
'product' => [ | |
'rules' => V::notBlank(), | |
'message' => 'product is required' | |
], | |
'tenure' => [ | |
'rules' => V::notBlank(), | |
'message' => 'tenure is required' | |
], | |
'interestRate' => [ | |
'rules' => V::notBlank(), | |
'message' => 'interestRate is required' | |
], | |
'amount' => [ | |
'rules' => V::notBlank(), | |
'message' => 'amount is required' | |
], | |
'ledgerType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'ledgerType is required' | |
], | |
/* 'charge' => [ | |
'rules' => V::notBlank(), | |
'message' => 'charge is required' | |
], */ | |
'transactionType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'transactionType is required' | |
], | |
'productType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'productType is required' | |
], | |
/* 'GLMaster' => [ | |
'rules' => V::notBlank(), | |
'message' => 'GLMaster is required' | |
], */ | |
'investmentType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'investmentType is required' | |
], | |
'involvementType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'involvementType is required' | |
], | |
'capitalizeOnRollover' => [ | |
'rules' => V::notBlank(), | |
'message' => 'capitalizeOnRollover (string True or False) is required' | |
], | |
'doAutomaticRollover' => [ | |
'rules' => V::notBlank(), | |
'message' => 'doAutomaticRollover (string True or False) is required' | |
], | |
'upfrontInterest' => [ | |
'rules' => V::notBlank(), | |
'message' => 'upfrontInterest (string True or False) is required' | |
], | |
]); | |
$deal= $this->customerModel->approveCAMDeal($payload); | |
return $response | |
->withStatus($deal['code'] ?? 200) | |
->withJson($deal['message']); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
/** | |
* Create CAM Deal Rate | |
* | |
* This API endpoint is used to create a CAM (Capital Asset Management) deal rate. | |
* | |
* @param {Object} Payload - The payload containing the deal rate information. | |
* | |
* @return {Object} Response - JSON response containing the result of the deal rate creation. | |
* | |
* @throws {Error} 400 - Bad Request: If any of the required parameters is missing or empty. | |
* @throws {Error} 401 - Unauthorized: If the user making the request is not authorized to create the deal rate. | |
* @throws {Error} 500 - Internal Server Error: If an unexpected error occurs while processing the deal rate creation. | |
* | |
* @OA\Post( | |
* path="/api/customer/createCAMDealRate", | |
* tags={"Customer"}, | |
* summary="Create CAM Deal Rate", | |
* operationId="createCAMDealRate", | |
* @OA\RequestBody( | |
* required=true, | |
* @OA\JsonContent( | |
* @OA\Property(property="product", type="string"), | |
* @OA\Property(property="tenure", type="string"), | |
* @OA\Property(property="rate", type="string"), | |
* @OA\Property(property="charge", type="string"), | |
* @OA\Property(property="investmentType", type="string"), | |
* @OA\Property(property="instrumentType", type="string"), | |
* @OA\Property(property="admin", type="string"), | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Successful operation", | |
* @OA\JsonContent( | |
* @OA\Property(property="data", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->post('/api/customer/createCAMDealRate', function( $request, $response ) { | |
validate($request, [ | |
'product' => [ | |
'rules' => V::notBlank(), | |
'message' => 'product is required' | |
], | |
'tenure' => [ | |
'rules' => V::notBlank(), | |
'message' => 'tenure is required' | |
], | |
'rate' => [ | |
'rules' => V::numeric(), | |
'message' => 'rate is required' | |
], | |
'charge' => [ | |
'rules' => V::notBlank(), | |
'message' => 'charge is required' | |
], | |
'investmentType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'investmentType is required' | |
], | |
'instrumentType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'instrumentType is required' | |
], | |
'admin' => [ | |
'rules' => V::notBlank(), | |
'message' => 'admin user is required' | |
] | |
]); | |
$payload = $request->getParsedBody(); | |
$rate= $this->customerModel->createCAMDealRate($payload); | |
return $response | |
->withStatus(200) | |
->withJson($rate['message']); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
/** | |
* Update CAM Deal Rate | |
* | |
* This API endpoint is used to update a CAM (Capital Asset Management) deal rate. | |
* | |
* @param {Object} Payload - The payload containing the updated deal rate information. | |
* | |
* @return {Object} Response - JSON response containing the result of the deal rate update. | |
* | |
* @throws {Error} 400 - Bad Request: If any of the required parameters is missing or empty. | |
* @throws {Error} 401 - Unauthorized: If the user making the request is not authorized to update the deal rate. | |
* @throws {Error} 500 - Internal Server Error: If an unexpected error occurs while processing the deal rate update. | |
* | |
* @OA\Post( | |
* path="/api/customer/udpateCAMDealRate", | |
* tags={"Customer"}, | |
* summary="Update CAM Deal Rate", | |
* operationId="updateCAMDealRate", | |
* @OA\RequestBody( | |
* required=true, | |
* @OA\JsonContent( | |
* @OA\Property(property="product", type="string"), | |
* @OA\Property(property="ID", type="string"), | |
* @OA\Property(property="rate", type="string"), | |
* @OA\Property(property="charge", type="string"), | |
* @OA\Property(property="admin", type="string"), | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Successful operation", | |
* @OA\JsonContent( | |
* @OA\Property(property="data", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->post('/api/customer/udpateCAMDealRate', function( $request, $response ) { | |
validate($request, [ | |
'product' => [ | |
'rules' => V::notBlank(), | |
'message' => 'product is required' | |
], | |
'ID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'ID is required' | |
], | |
'rate' => [ | |
'rules' => V::numeric(), | |
'message' => 'rate is required' | |
], | |
'charge' => [ | |
'rules' => V::notBlank(), | |
'message' => 'charge is required' | |
], | |
'admin' => [ | |
'rules' => V::notBlank(), | |
'message' => 'admin user is required' | |
] | |
]); | |
$payload = $request->getParsedBody(); | |
$rate= $this->customerModel->udpateCAMDealRate($payload); | |
return $response | |
->withStatus(200) | |
->withJson($rate['message']); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
/** | |
* Create CAM Product | |
* | |
* This API endpoint is used to create a new CAM (Capital Asset Management) product. | |
* | |
* @param {Object} Payload - The payload containing the information of the new product. | |
* | |
* @return {Object} Response - JSON response containing the result of the product creation. | |
* | |
* @throws {Error} 400 - Bad Request: If any of the required parameters is missing or empty. | |
* @throws {Error} 401 - Unauthorized: If the user making the request is not authorized to create a new product. | |
* @throws {Error} 500 - Internal Server Error: If an unexpected error occurs while processing the product creation. | |
* | |
* @OA\Post( | |
* path="/api/customer/createCAMProduct", | |
* tags={"Customer"}, | |
* summary="Create CAM Product", | |
* operationId="createCAMProduct", | |
* @OA\RequestBody( | |
* required=true, | |
* @OA\JsonContent( | |
* @OA\Property(property="product", type="string"), | |
* @OA\Property(property="category", type="string"), | |
* @OA\Property(property="description", type="string"), | |
* @OA\Property(property="productType", type="string"), | |
* @OA\Property(property="walletRecipient", type="string"), | |
* @OA\Property(property="bookingType", type="string"), | |
* @OA\Property(property="investmentType", type="string"), | |
* @OA\Property(property="instrumentType", type="string"), | |
* @OA\Property(property="involvementType", type="string"), | |
* @OA\Property(property="minInvestment", type="string"), | |
* @OA\Property(property="ledgerType", type="string"), | |
* @OA\Property(property="admin", type="string"), | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Successful operation", | |
* @OA\JsonContent( | |
* @OA\Property(property="data", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->post('/api/customer/createCAMProduct', function( $request, $response ) { | |
validate($request, [ | |
'product' => [ | |
'rules' => V::notBlank(), | |
'message' => 'product is required' | |
], | |
'category' => [ | |
'rules' => V::notBlank(), | |
'message' => 'category is required' | |
], | |
'description' => [ | |
'rules' => V::notBlank(), | |
'message' => 'description is required' | |
], | |
'productType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'productType is required' | |
], | |
'walletRecipient' => [ | |
'rules' => V::notBlank(), | |
'message' => 'walletRecipient is required' | |
], | |
'bookingType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'bookingType is required' | |
], | |
'investmentType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'investmentType is required' | |
], | |
'instrumentType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'instrumentType is required' | |
], | |
'involvementType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'involvementType is required' | |
], | |
'minInvestment' => [ | |
'rules' => V::notBlank(), | |
'message' => 'minInvestment is required' | |
], | |
'ledgerType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'ledgerType is required' | |
], | |
'admin' => [ | |
'rules' => V::notBlank(), | |
'message' => 'admin user is required' | |
] | |
]); | |
$payload = $request->getParsedBody(); | |
$rate= $this->customerModel->createCAMProduct($payload); | |
return $response | |
->withStatus(200) | |
->withJson($rate['message']); | |
}); | |
// ->add(new AdminAuthorization()) | |
// ->add(new auth()); | |
/** | |
* Get CAM Products | |
* | |
* This API endpoint is used to retrieve a list of CAM (Capital Asset Management) products based on specified filters. | |
* | |
* @param {Object} Payload - The payload containing filters to apply for retrieving CAM products (optional). | |
* | |
* @return {Object} Response - JSON response containing the list of CAM products matching the specified filters. | |
* | |
* @throws {Error} 401 - Unauthorized: If the user making the request is not authorized to access CAM products. | |
* @throws {Error} 500 - Internal Server Error: If an unexpected error occurs while processing the request. | |
* | |
* @OA\Get( | |
* path="/api/customer/getCAMProducts", | |
* tags={"Customer"}, | |
* summary="Get CAM Products", | |
* operationId="getCAMProducts", | |
* @OA\Parameter( | |
* name="product", | |
* in="query", | |
* description="Filter by product name", | |
* required=false, | |
* @OA\Schema( | |
* type="string" | |
* ) | |
* ), | |
* @OA\Parameter( | |
* name="category", | |
* in="query", | |
* description="Filter by product category", | |
* required=false, | |
* @OA\Schema( | |
* type="string" | |
* ) | |
* ), | |
* @OA\Parameter( | |
* name="productType", | |
* in="query", | |
* description="Filter by product type", | |
* required=false, | |
* @OA\Schema( | |
* type="string" | |
* ) | |
* ), | |
* @OA\Parameter( | |
* name="investmentType", | |
* in="query", | |
* description="Filter by investment type", | |
* required=false, | |
* @OA\Schema( | |
* type="string" | |
* ) | |
* ), | |
* @OA\Parameter( | |
* name="instrumentType", | |
* in="query", | |
* description="Filter by instrument type", | |
* required=false, | |
* @OA\Schema( | |
* type="string" | |
* ) | |
* ), | |
* @OA\Parameter( | |
* name="ledgerType", | |
* in="query", | |
* description="Filter by ledger type", | |
* required=false, | |
* @OA\Schema( | |
* type="string" | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Successful operation", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string"), | |
* @OA\Property(property="data", type="array", @OA\Items(ref="#/components/schemas/CAMProduct")), | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getCAMProducts', function( $request, $response ) { | |
$payload = $request->getQueryParams(); | |
$rates= $this->customerModel->getCAMProducts($payload); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'successfully fetched CAM Products', | |
'data' => $rates | |
]); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* Get CAM Product | |
* | |
* This API endpoint is used to retrieve a single CAM (Capital Asset Management) product based on the specified product type. | |
* | |
* @param {Object} Payload - The payload containing the product type to retrieve (required). | |
* | |
* @return {Object} Response - JSON response containing the CAM product details matching the specified product type. | |
* | |
* @throws {Error} 400 - Bad Request: If the required payload parameter (productType) is missing or empty. | |
* @throws {Error} 401 - Unauthorized: If the user making the request is not authorized to access CAM products. | |
* @throws {Error} 500 - Internal Server Error: If an unexpected error occurs while processing the request. | |
* | |
* @OA\Get( | |
* path="/api/customer/getCAMProduct", | |
* tags={"Customer"}, | |
* summary="Get CAM Product", | |
* operationId="getCAMProduct", | |
* @OA\Parameter( | |
* name="productType", | |
* in="query", | |
* description="The product type to retrieve", | |
* required=true, | |
* @OA\Schema( | |
* type="string" | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Successful operation", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string"), | |
* @OA\Property(property="data", ref="#/components/schemas/CAMProduct"), | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getCAMProduct', function( $request, $response ) { | |
validate($request, [ | |
'productType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'productType is required' | |
], | |
]); | |
$payload = $request->getQueryParams(); | |
$rates= $this->customerModel->getCAMProduct($payload); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'successfully fetched CAM Product', | |
'data' => $rates | |
]); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* Get CAM Deal Rate | |
* | |
* This API endpoint is used to retrieve the current CAM (Capital Asset Management) deal rate based on the specified instrument type and investment type. | |
* | |
* @param {Object} Payload - The payload containing the instrument type and investment type to fetch the deal rate (required). | |
* | |
* @return {Object} Response - JSON response containing the current CAM deal rate data matching the specified instrument type and investment type. | |
* | |
* @throws {Error} 400 - Bad Request: If the required payload parameters (instrumentType, investmentType) are missing or empty. | |
* @throws {Error} 401 - Unauthorized: If the user making the request is not authorized to access CAM deal rates. | |
* @throws {Error} 500 - Internal Server Error: If an unexpected error occurs while processing the request. | |
* | |
* @OA\Get( | |
* path="/api/customer/getCAMDealRate", | |
* tags={"Customer"}, | |
* summary="Get CAM Deal Rate", | |
* operationId="getCAMDealRate", | |
* @OA\Parameter( | |
* name="instrumentType", | |
* in="query", | |
* description="The instrument type to fetch the deal rate", | |
* required=true, | |
* @OA\Schema( | |
* type="string" | |
* ) | |
* ), | |
* @OA\Parameter( | |
* name="investmentType", | |
* in="query", | |
* description="The investment type to fetch the deal rate", | |
* required=true, | |
* @OA\Schema( | |
* type="string" | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Successful operation", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string"), | |
* @OA\Property(property="data", ref="#/components/schemas/CAMDealRate"), | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getCAMDealRate', function( $request, $response ) { | |
validate($request, [ | |
'instrumentType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'instrumentType is required' | |
], | |
'investmentType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'investmentType is required' | |
], | |
/* 'tenure' => [ | |
'rules' => V::notBlank(), | |
'message' => 'tenure is required' | |
], */ | |
]); | |
$payload = $request->getQueryParams(); | |
$rates= $this->customerModel->getCAMDealRate($payload); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'successfully fetched current rate', | |
'data' => $rates | |
]); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
$app->get('/api/yochaa/customer/getRate', function( $request, $response ) { | |
validate($request, [ | |
'instrumentType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'instrumentType is required' | |
], | |
'investmentType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'investmentType is required' | |
], | |
/* 'tenure' => [ | |
'rules' => V::notBlank(), | |
'message' => 'tenure is required' | |
], */ | |
]); | |
$payload = $request->getQueryParams(); | |
$rates= $this->customerModel->getYochaaDealRate($payload); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'successfully fetched current rate', | |
'data' => $rates | |
]); | |
}) | |
// //->add(new PartnersMiddleware()) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
/** | |
* Get CAM Deal Tenure | |
* | |
* This API endpoint is used to retrieve the available tenures for CAM (Capital Asset Management) deals based on the specified instrument type and investment type. | |
* | |
* @param {Object} Payload - The payload containing the instrument type and investment type to fetch the available tenures (required). | |
* | |
* @return {Object} Response - JSON response containing the available tenures for CAM deals matching the specified instrument type and investment type. | |
* | |
* @throws {Error} 400 - Bad Request: If the required payload parameters (instrumentType, investmentType) are missing or empty. | |
* @throws {Error} 401 - Unauthorized: If the user making the request is not authorized to access CAM deal tenures. | |
* @throws {Error} 500 - Internal Server Error: If an unexpected error occurs while processing the request. | |
* | |
* @OA\Get( | |
* path="/api/customer/getCAMDealTenure", | |
* tags={"Customer"}, | |
* summary="Get CAM Deal Tenure", | |
* operationId="getCAMDealTenure", | |
* @OA\Parameter( | |
* name="instrumentType", | |
* in="query", | |
* description="The instrument type to fetch the available tenures", | |
* required=true, | |
* @OA\Schema( | |
* type="string" | |
* ) | |
* ), | |
* @OA\Parameter( | |
* name="investmentType", | |
* in="query", | |
* description="The investment type to fetch the available tenures", | |
* required=true, | |
* @OA\Schema( | |
* type="string" | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Successful operation", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string"), | |
* @OA\Property(property="data", ref="#/components/schemas/CAMDealTenure"), | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getCAMDealTenure', function( $request, $response ) { | |
validate($request, [ | |
'instrumentType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'instrumentType is required' | |
], | |
'investmentType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'investmentType is required' | |
], | |
]); | |
$payload = $request->getQueryParams(); | |
$rates= $this->customerModel->getCAMDealTenure($payload); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'successfully fetched tenures', | |
'data' => $rates | |
]); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* Get All CAM Deal Rates | |
* | |
* This API endpoint is used to retrieve all CAM (Capital Asset Management) deal rates available in the system. | |
* | |
* @return {Object} Response - JSON response containing all CAM deal rates. | |
* | |
* @throws {Error} 401 - Unauthorized: If the user making the request is not authorized to access all CAM deal rates. | |
* @throws {Error} 500 - Internal Server Error: If an unexpected error occurs while processing the request. | |
* | |
* @OA\Get( | |
* path="/api/customer/getAllCAMDealRates", | |
* tags={"Customer"}, | |
* summary="Get All CAM Deal Rates", | |
* operationId="getAllCAMDealRates", | |
* @OA\Response( | |
* response=200, | |
* description="Successful operation", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string"), | |
* @OA\Property(property="data", type="array", @OA\Items(ref="#/components/schemas/CAMDealRate")), | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getAllCAMDealRates', function( $request, $response ) { | |
$rates= $this->customerModel->getAllCAMDealRates(); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'successfully fetched all rates', | |
'data' => $rates | |
]); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* Get Current CAM Deals | |
* | |
* This API endpoint is used to retrieve all current CAM (Capital Asset Management) deals available in the system. | |
* | |
* @return {Object} Response - JSON response containing all current CAM deals. | |
* | |
* @throws {Error} 401 - Unauthorized: If the user making the request is not authorized to access current CAM deals. | |
* @throws {Error} 500 - Internal Server Error: If an unexpected error occurs while processing the request. | |
* | |
* @OA\Get( | |
* path="/api/customer/getCurrentCAMDeals", | |
* tags={"Customer"}, | |
* summary="Get Current CAM Deals", | |
* operationId="getCurrentCAMDeals", | |
* @OA\Response( | |
* response=200, | |
* description="Successful operation", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string"), | |
* @OA\Property(property="data", type="array", @OA\Items(ref="#/components/schemas/CAMDeal")), | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getCurrentCAMDeals', function( $request, $response ) { | |
$deals= $this->customerModel->getCurrentCAMDeals(); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'successfully fetched current deals', | |
'data' => $deals | |
]); | |
}); | |
// ->add(new AdminAuthorization()) | |
// ->add(new auth()); | |
/** | |
* Get All CAM Deals | |
* | |
* This API endpoint is used to retrieve all CAM (Capital Asset Management) deals available in the system. | |
* | |
* @return {Object} Response - JSON response containing all CAM deals. | |
* | |
* @throws {Error} 401 - Unauthorized: If the user making the request is not authorized to access all CAM deals. | |
* @throws {Error} 500 - Internal Server Error: If an unexpected error occurs while processing the request. | |
* | |
* @OA\Get( | |
* path="/api/customer/getAllCAMDeals", | |
* tags={"Customer"}, | |
* summary="Get All CAM Deals", | |
* operationId="getAllCAMDeals", | |
* security={{"bearerAuth": {}}}, | |
* @OA\Response( | |
* response=200, | |
* description="Successful operation", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string"), | |
* @OA\Property(property="data", type="array", @OA\Items(ref="#/components/schemas/CAMDeal")), | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getAllCAMDeals', function( $request, $response ) { | |
$deals= $this->customerModel->getAllCAMDeals(); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'successfully fetched all deals', | |
'data' => $deals | |
]); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
/** | |
* Get Holidays | |
* | |
* This API endpoint is used to retrieve a list of holidays. | |
* | |
* @return {Object} Response - JSON response containing the list of holidays. | |
* | |
* @throws {Error} 500 - Internal Server Error: If an unexpected error occurs while processing the request. | |
* | |
* @OA\Get( | |
* path="/api/customer/getHolidays", | |
* tags={"Customer"}, | |
* summary="Get Holidays", | |
* operationId="getHolidays", | |
* @OA\Response( | |
* response=200, | |
* description="Successful operation", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string"), | |
* @OA\Property(property="data", type="array", @OA\Items(ref="#/components/schemas/Holiday")), | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getHolidays', function( $request, $response ) { | |
$holidays= $this->customerModel->getHolidays(); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'successfully fetched holidays', | |
'data' => $holidays | |
]); | |
}); | |
/** | |
* Get Margin Report | |
* | |
* This API endpoint is used to compute and retrieve the Margin Report. | |
* | |
* @return {Object} Response - JSON response containing the computed Margin Report data. | |
* | |
* @throws {Error} 500 - Internal Server Error: If an unexpected error occurs while processing the request. | |
* | |
* @OA\Get( | |
* path="/api/customer/getMarginReport", | |
* tags={"Customer"}, | |
* summary="Get Margin Report", | |
* operationId="getMarginReport", | |
* @OA\Response( | |
* response=200, | |
* description="Successful operation", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string"), | |
* @OA\Property(property="data", type="object", @OA\Property(property="report", type="array", @OA\Items(ref="#/components/schemas/MarginReport"))), | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getMarginReport', function( $request, $response ) { | |
$margin= $this->customerModel->processMarginReport(); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'successfully computed Margin Report', | |
'data' => $margin | |
]); | |
}); | |
// ->add(new AdminAuthorization()) | |
// ->add(new auth()); | |
/** | |
* Get Margin Clients | |
* | |
* This API endpoint is used to retrieve a list of Margin Clients. | |
* | |
* @return {Object} Response - JSON response containing the list of Margin Clients. | |
* | |
* @throws {Error} 500 - Internal Server Error: If an unexpected error occurs while processing the request. | |
* | |
* @OA\Get( | |
* path="/api/customer/getMarginClients", | |
* tags={"Customer"}, | |
* summary="Get Margin Clients", | |
* operationId="getMarginClients", | |
* @OA\Response( | |
* response=200, | |
* description="Successful operation", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string"), | |
* @OA\Property(property="data", type="object", @OA\Property(property="clients", type="array", @OA\Items(ref="#/components/schemas/MarginClient"))), | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getMarginClients', function( $request, $response ) { | |
$margin= $this->customerModel->getMarginClients(); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'successfully fetched Margin Clients', | |
'data' => $margin | |
]); | |
}); | |
// ->add(new AdminAuthorization()) | |
// ->add(new auth()); | |
/** | |
* Get Margin Client Daily Balance | |
* | |
* This API endpoint is used to retrieve the daily balance of a Margin Client within a specified date range. | |
* | |
* @param {string} SECID.query.required - The SECID of the Margin Client. | |
* @param {string} sdate.query.required - The start date of the date range in the format 'YYYY-MM-DD'. | |
* @param {string} edate.query.required - The end date of the date range in the format 'YYYY-MM-DD'. | |
* | |
* @return {Object} Response - JSON response containing the daily balance data for the Margin Client. | |
* | |
* @throws {Error} 400 - Bad Request: If any of the required parameters (SECID, sdate, edate) is missing or invalid. | |
* @throws {Error} 500 - Internal Server Error: If an unexpected error occurs while processing the request. | |
* | |
* @OA\Get( | |
* path="/api/customer/getMarginClientDailyBalance", | |
* tags={"Customer"}, | |
* summary="Get Margin Client Daily Balance", | |
* operationId="getMarginClientDailyBalance", | |
* @OA\Parameter( | |
* name="SECID", | |
* in="query", | |
* required=true, | |
* description="The SECID of the Margin Client", | |
* @OA\Schema(type="string") | |
* ), | |
* @OA\Parameter( | |
* name="sdate", | |
* in="query", | |
* required=true, | |
* description="The start date of the date range (format: 'YYYY-MM-DD')", | |
* @OA\Schema(type="string") | |
* ), | |
* @OA\Parameter( | |
* name="edate", | |
* in="query", | |
* required=true, | |
* description="The end date of the date range (format: 'YYYY-MM-DD')", | |
* @OA\Schema(type="string") | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Successful operation", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string"), | |
* @OA\Property(property="data", type="object", @OA\Property(property="margin", type="array", @OA\Items(ref="#/components/schemas/MarginData"))), | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getMarginClientDailyBalance', function( $request, $response ) { | |
validate($request, [ | |
'SECID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'SECID is required' | |
], | |
'sdate' => [ | |
'rules' => V::notBlank(), | |
'message' => 'Start date is required' | |
], | |
'edate' => [ | |
'rules' => V::notBlank(), | |
'message' => 'End date is required' | |
], | |
]); | |
$payload = $request->getQueryParams(); | |
$margin= $this->customerModel->getMarginClientDailyBalance($payload['SECID'], $payload['sdate'], $payload['edate']); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'successfully fetched Margin client daily balance', | |
'data' => $margin | |
]); | |
}); | |
// ->add(new AdminAuthorization()) | |
// ->add(new auth()); | |
/** | |
* Get Client Margin Status | |
* | |
* This API endpoint is used to retrieve the margin status of a client with the specified CustID. | |
* | |
* @param {string} CustID.query.required - The CustID of the client. | |
* | |
* @return {Object} Response - JSON response containing the margin status data for the client. | |
* | |
* @throws {Error} 400 - Bad Request: If the required parameter CustID is missing or invalid. | |
* @throws {Error} 401 - Unauthorized: If the CustID does not match the ID in the request's attribute. | |
* @throws {Error} 500 - Internal Server Error: If an unexpected error occurs while processing the request. | |
* | |
* @OA\Get( | |
* path="/api/customer/getClientMarginStatus", | |
* tags={"Customer"}, | |
* summary="Get Client Margin Status", | |
* operationId="getClientMarginStatus", | |
* @OA\Parameter( | |
* name="CustID", | |
* in="query", | |
* required=true, | |
* description="The CustID of the client", | |
* @OA\Schema(type="string") | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Successful operation", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string"), | |
* @OA\Property(property="data", type="object", @OA\Property(property="margin", type="array", @OA\Items(ref="#/components/schemas/MarginData"))), | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getClientMarginStatus', function( $request, $response ) { | |
validate($request, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
]); | |
$payload = $request->getQueryParams(); | |
if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$payload['SECID'] = $request->getAttribute('SECID'); | |
$margin = $this->customerModel->getClientMarginStatus($payload); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'Client Margin Status Fetched', | |
'data' => $margin | |
]); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* Get Client Margin Default Status | |
* | |
* This API endpoint is used to retrieve the default margin status of a client with the specified CustID. | |
* | |
* @param {string} CustID.query.required - The CustID of the client. | |
* | |
* @return {Object} Response - JSON response containing the default margin status data for the client. | |
* | |
* @throws {Error} 400 - Bad Request: If the required parameter CustID is missing or invalid. | |
* @throws {Error} 401 - Unauthorized: If the CustID does not match the ID in the request's attribute. | |
* @throws {Error} 500 - Internal Server Error: If an unexpected error occurs while processing the request. | |
* | |
* @OA\Get( | |
* path="/api/customer/getClientMarginDefaultStatus", | |
* tags={"Customer"}, | |
* summary="Get Client Margin Default Status", | |
* operationId="getClientMarginDefaultStatus", | |
* @OA\Parameter( | |
* name="CustID", | |
* in="query", | |
* required=true, | |
* description="The CustID of the client", | |
* @OA\Schema(type="string") | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Successful operation", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string"), | |
* @OA\Property(property="data", type="object", @OA\Property(property="margin", type="array", @OA\Items(ref="#/components/schemas/MarginData"))), | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getClientMarginDefaultStatus', function($request, $response){ | |
validate($request, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
]); | |
$payload = $request->getQueryParams(); | |
if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$payload["SECID"] = $request->getAttribute('SECID'); | |
$payload["CAMID"] = $request->getAttribute('CAMID'); | |
$margin = $this->customerModel->getClientMarginDefaultStatus($payload); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'Client Margin Default Status Fetched', | |
'data' => $margin | |
]); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* Get Client Wallet Status | |
* | |
* This API endpoint is used to retrieve the wallet status of a client with the specified CustID. | |
* | |
* @param {string} CustID.query.required - The CustID of the client. | |
* | |
* @return {Object} Response - JSON response containing the wallet status data for the client. | |
* | |
* @throws {Error} 400 - Bad Request: If the required parameter CustID is missing or invalid. | |
* @throws {Error} 401 - Unauthorized: If the CustID does not match the ID in the request's attribute. | |
* @throws {Error} 500 - Internal Server Error: If an unexpected error occurs while processing the request. | |
* | |
* @OA\Get( | |
* path="/api/customer/getClientWalletStatus", | |
* tags={"Customer"}, | |
* summary="Get Client Wallet Status", | |
* operationId="getClientWalletStatus", | |
* @OA\Parameter( | |
* name="CustID", | |
* in="query", | |
* required=true, | |
* description="The CustID of the client", | |
* @OA\Schema(type="string") | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Successful operation", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string"), | |
* @OA\Property(property="data", type="object", @OA\Property(property="wallet", type="array", @OA\Items(ref="#/components/schemas/WalletData"))), | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getClientWalletStatus', function( $request, $response ) { | |
validate($request, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
]); | |
$payload = $request->getQueryParams(); | |
if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$payload['CAMID'] = $request->getAttribute('CAMID'); | |
$wallet = $this->customerModel->getClientWalletStatus($payload); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'Client Wallet Status Fetched', | |
'data' => $wallet | |
]); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* Get Cash Account | |
* | |
* This API endpoint is used to retrieve the cash account information for a client with the specified CustID and accountOpeningProduct. | |
* | |
* @param {string} CustID.query.required - The CustID of the client. | |
* @param {string} accountOpeningProduct.query.required - The accountOpeningProduct associated with the client. | |
* | |
* @return {Object} Response - JSON response containing the cash account information for the client. | |
* | |
* @throws {Error} 400 - Bad Request: If the required parameters CustID or accountOpeningProduct are missing or invalid. | |
* @throws {Error} 401 - Unauthorized: If the CustID does not match the ID in the request's attribute. | |
* @throws {Error} 500 - Internal Server Error: If an unexpected error occurs while processing the request. | |
* | |
* @OA\Get( | |
* path="/api/customer/getCashAccount", | |
* tags={"Customer"}, | |
* summary="Get Cash Account", | |
* operationId="getCashAccount", | |
* @OA\Parameter( | |
* name="CustID", | |
* in="query", | |
* required=true, | |
* description="The CustID of the client", | |
* @OA\Schema(type="string") | |
* ), | |
* @OA\Parameter( | |
* name="accountOpeningProduct", | |
* in="query", | |
* required=true, | |
* description="The accountOpeningProduct associated with the client", | |
* @OA\Schema(type="string") | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Successful operation", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string"), | |
* @OA\Property(property="data", type="object", @OA\Property(property="cashAccount", type="array", @OA\Items(ref="#/components/schemas/CashAccountData"))), | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getCashAccount', function( $request, $response ) { | |
validate($request, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
'accountOpeningProduct' => [ | |
'rules' => V::notBlank(), | |
'message' => 'accountOpeningProduct is required' | |
], | |
]); | |
$payload = $request->getQueryParams(); | |
if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$payload['CAMID'] = $request->getAttribute('CAMID'); | |
$cashAccount = $this->customerModel->getCashAccount($payload); | |
return $response | |
->withStatus($cashAccount["code"] ?? 200) | |
->withJson($cashAccount); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* Get Sector or Asset Class Types | |
* | |
* This API endpoint is used to retrieve all Sector or Asset Class Types based on the specified key. | |
* | |
* @param {string} key.body.required - The key indicating whether to fetch Sector or Asset Class Types (e.g., 'Sector' or 'Asset'). | |
* | |
* @return {Object} Response - JSON response containing the Sector or Asset Class Types. | |
* | |
* @throws {Error} 400 - Bad Request: If the required parameter 'key' is missing or invalid. | |
* @throws {Error} 500 - Internal Server Error: If an unexpected error occurs while processing the request. | |
* | |
* @OA\Post( | |
* path="/api/customer/getSectorAssetType", | |
* tags={"Customer"}, | |
* summary="Get Sector or Asset Class Types", | |
* operationId="getSectorAssetType", | |
* @OA\RequestBody( | |
* required=true, | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* required={"key"}, | |
* @OA\Property(property="key", type="string"), | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Successful operation", | |
* @OA\JsonContent( | |
* @OA\Property(property="message", type="string"), | |
* @OA\Property(property="data", type="object", @OA\Property(property="sectorAssetTypes", type="array", @OA\Items(type="string"))), | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\JsonContent( | |
* @OA\Property(property="error", type="string") | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->post('/api/customer/getSectorAssetType', function( $request, $response ) { | |
validate($request, [ | |
'key' => [ | |
'rules' => V::notBlank(), | |
'message' => 'Key (Sector/Asset) is required' | |
], | |
]); | |
$payload = $request->getParsedBody(); | |
$res = $this->customerModel->getSectorAssetType($payload); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'successfully fetched all Sector or Asset Class Types', | |
'data' => $res | |
]); | |
}); | |
$app->post('/api/customer/getCSCSDetails', function( $request, $response ) { | |
validate($request, [ | |
'SECID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'SEC ID is required' | |
], | |
]); | |
$payload = $request->getParsedBody(); | |
$res = $this->customerModel->getCSCSDetails($payload); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'successfully fetched CSCS details', | |
'data' => $res | |
]); | |
}); | |
// ->add(new AdminAuthorization()) | |
// ->add(new auth()); | |
/** | |
* Get Sector or Asset Class Data | |
* | |
* @OA\Get( | |
* path="/api/customer/getSectorAssetData", | |
* tags={"Customer"}, | |
* summary="Get Sector or Asset Class Data", | |
* operationId="getSectorAssetData", | |
* @OA\Parameter( | |
* name="key", | |
* in="query", | |
* required=true, | |
* description="Key (Sector/Asset)", | |
* @OA\Schema(type="string") | |
* ), | |
* @OA\Parameter( | |
* name="value", | |
* in="query", | |
* required=true, | |
* description="Sector or Asset Class value", | |
* @OA\Schema(type="string") | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message", | |
* example="Successfully fetched all Sector or Asset Class Data" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="array", | |
* description="Sector or Asset Class Data", | |
* @OA\Items( | |
* type="object", | |
* @OA\Property( | |
* property="id", | |
* type="integer", | |
* description="Record ID", | |
* example=1 | |
* ), | |
* @OA\Property( | |
* property="name", | |
* type="string", | |
* description="Name of the Sector or Asset Class", | |
* example="Technology" | |
* ), | |
* @OA\Property( | |
* property="description", | |
* type="string", | |
* description="Description of the Sector or Asset Class", | |
* example="Companies involved in technology and software" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message", | |
* example="An unexpected error occurred, please try again" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getSectorAssetData', function( $request, $response ) { | |
/* validate($request, [ | |
'key' => [ | |
'rules' => V::notBlank(), | |
'message' => 'Key (Sector/Asset) is required' | |
], | |
'value' => [ | |
'rules' => V::notBlank(), | |
'message' => 'Sector or Asset Class value is required' | |
], | |
]); | |
$payload = $request->getQueryParams(); */ | |
$res = $this->customerModel->getSectorAssetData($payload); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'successfully fetched all Sector or Asset Class Data', | |
'data' => $res | |
]); | |
}); | |
// ->add(new AdminAuthorization()) | |
// ->add(new auth()); | |
/** | |
* Get Sector or Asset Class Data | |
* | |
* @OA\Post( | |
* path="/api/customer/getSectorAssetData", | |
* tags={"Customer"}, | |
* summary="Get Sector or Asset Class Data", | |
* operationId="getSectorAssetData", | |
* @OA\RequestBody( | |
* required=true, | |
* description="Sector or Asset Class Data", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="key", | |
* type="string", | |
* description="Key (Sector/Asset)", | |
* example="sector" | |
* ), | |
* @OA\Property( | |
* property="value", | |
* type="string", | |
* description="Sector or Asset Class value", | |
* example="technology" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message", | |
* example="Successfully fetched all Sector or Asset Class Data" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="array", | |
* description="Sector or Asset Class Data", | |
* @OA\Items( | |
* type="object", | |
* @OA\Property( | |
* property="id", | |
* type="integer", | |
* description="Record ID", | |
* example=1 | |
* ), | |
* @OA\Property( | |
* property="name", | |
* type="string", | |
* description="Name of the Sector or Asset Class", | |
* example="Technology" | |
* ), | |
* @OA\Property( | |
* property="description", | |
* type="string", | |
* description="Description of the Sector or Asset Class", | |
* example="Companies involved in technology and software" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message", | |
* example="An unexpected error occurred, please try again" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->post('/api/customer/getSectorAssetData', function( $request, $response ) { | |
/* validate($request, [ | |
'key' => [ | |
'rules' => V::notBlank(), | |
'message' => 'Key (Sector/Asset) is required' | |
], | |
'value' => [ | |
'rules' => V::notBlank(), | |
'message' => 'Sector or Asset Class value is required' | |
], | |
]); | |
$payload = $request->getParsedBody(); */ | |
$res = container('SecurityModel')->getSectorAssetData($payload); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'successfully fetched all Sector or Asset Class Data', | |
'data' => $res | |
]); | |
}); | |
// ->add(new AdminAuthorization()) | |
// ->add(new auth()); | |
/** | |
* Check if a Date is a Holiday | |
* | |
* @OA\Get( | |
* path="/api/customer/checkIfHoliday", | |
* tags={"Customer"}, | |
* summary="Check if a Date is a Holiday", | |
* operationId="checkIfHoliday", | |
* @OA\Parameter( | |
* name="date", | |
* in="query", | |
* description="Date to check if it is a holiday", | |
* required=true, | |
* @OA\Schema( | |
* type="string", | |
* format="date", | |
* example="2023-12-25" | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message", | |
* example="Holiday check successful" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="boolean", | |
* description="Flag indicating whether the date is a holiday", | |
* example=true | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message", | |
* example="Date is required" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/checkIfHoliday', function( $request, $response ) { | |
validate($request, [ | |
'date' => [ | |
'rules' => V::notBlank(), | |
'message' => 'Date is required' | |
], | |
]); | |
$payload = $request->getQueryParams(); | |
$holidays= $this->customerModel->checkIfHoliday($payload['date']); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'Holiday check successful', | |
'data' => $holidays | |
]); | |
}); | |
$app->get('/api/customer/checkIfWeekend', function( $request, $response ) { | |
validate($request, [ | |
'date' => [ | |
'rules' => V::notBlank(), | |
'message' => 'Date is required' | |
], | |
]); | |
$payload = $request->getQueryParams(); | |
$holidays= $this->customerModel->checkIfWeekend_2($payload['date']); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'Weekend check successful', | |
'data' => $holidays | |
]); | |
}); | |
/** | |
* Check if a Date is a Weekend | |
* | |
* @OA\Get( | |
* path="/api/customer/checkIfWeekend", | |
* tags={"Customer"}, | |
* summary="Check if a Date is a Weekend", | |
* operationId="checkIfWeekend", | |
* @OA\Parameter( | |
* name="date", | |
* in="query", | |
* description="Date to check if it is a weekend", | |
* required=true, | |
* @OA\Schema( | |
* type="string", | |
* format="date", | |
* example="2023-07-22" | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message", | |
* example="Weekend check successful" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="boolean", | |
* description="Flag indicating whether the date is a weekend", | |
* example=true | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message", | |
* example="Date is required" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getTotalHoldingBySectorAssetClass', function( $request, $response ) { | |
validate($request, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
'CSCSNumber' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CSCSNumber is required' | |
], | |
'category' => [ | |
'rules' => V::notBlank(), | |
'message' => 'category (AssetClass or Sector) is required' | |
], | |
]); | |
$payload = $request->getQueryParams(); | |
/* if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$payload['SECID'] = $request->getAttribute('SECID'); */ | |
$holding= $this->customerModel->getTotalHoldingBySectorAssetClass($payload); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'Total holdings by '. $payload['category'] .' successful fetched', | |
'data' => $holding | |
]); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* Get Total Holdings by Sector/Asset Class | |
* | |
* @OA\Get( | |
* path="/api/customer/getTotalHoldingBySectorAssetClass", | |
* tags={"Customer"}, | |
* summary="Get Total Holdings by Sector/Asset Class", | |
* operationId="getTotalHoldingBySectorAssetClass", | |
* @OA\Parameter( | |
* name="CustID", | |
* in="query", | |
* description="Customer ID", | |
* required=true, | |
* @OA\Schema( | |
* type="integer", | |
* example=12345 | |
* ) | |
* ), | |
* @OA\Parameter( | |
* name="CSCSNumber", | |
* in="query", | |
* description="CSCS Number", | |
* required=true, | |
* @OA\Schema( | |
* type="string", | |
* example="CSCS12345" | |
* ) | |
* ), | |
* @OA\Parameter( | |
* name="category", | |
* in="query", | |
* description="Category (AssetClass or Sector)", | |
* required=true, | |
* @OA\Schema( | |
* type="string", | |
* enum={"AssetClass", "Sector"}, | |
* example="AssetClass" | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message", | |
* example="Total holdings by AssetClass successful fetched" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="array", | |
* @OA\Items( | |
* type="object", | |
* @OA\Property( | |
* property="sector", | |
* type="string", | |
* description="Sector/Asset Class name", | |
* example="Technology" | |
* ), | |
* @OA\Property( | |
* property="total_holding", | |
* type="number", | |
* description="Total holding value for the sector/asset class", | |
* example=50000.00 | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message", | |
* example="CustID is required" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Unauthorized message", | |
* example="Unauthorized Access" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getTotalSecurityHolding', function( $request, $response ) { | |
validate($request, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
'CSCSNumber' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CSCSNumber is required' | |
], | |
]); | |
$payload = $request->getQueryParams(); | |
if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$payload['SECID'] = $request->getAttribute('SECID'); | |
$holding= $this->customerModel->getTotalSecurityHolding($payload); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'Total stockbroking holdings successful fetched', | |
'data' => $holding | |
]); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* Get Total Stockbroking Holdings | |
* | |
* @OA\Get( | |
* path="/api/customer/getTotalSecurityHolding", | |
* tags={"Customer"}, | |
* summary="Get Total Stockbroking Holdings", | |
* operationId="getTotalSecurityHolding", | |
* @OA\Parameter( | |
* name="CustID", | |
* in="query", | |
* description="Customer ID", | |
* required=true, | |
* @OA\Schema( | |
* type="integer", | |
* example=12345 | |
* ) | |
* ), | |
* @OA\Parameter( | |
* name="CSCSNumber", | |
* in="query", | |
* description="CSCS Number", | |
* required=true, | |
* @OA\Schema( | |
* type="string", | |
* example="CSCS12345" | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message", | |
* example="Total stockbroking holdings successfully fetched" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="array", | |
* @OA\Items( | |
* type="object", | |
* @OA\Property( | |
* property="security", | |
* type="string", | |
* description="Security name", | |
* example="ABC Corporation" | |
* ), | |
* @OA\Property( | |
* property="quantity", | |
* type="integer", | |
* description="Total quantity of the security", | |
* example=500 | |
* ), | |
* @OA\Property( | |
* property="current_value", | |
* type="number", | |
* description="Current value of the security holding", | |
* example=10000.00 | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message", | |
* example="CustID is required" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Unauthorized message", | |
* example="Unauthorized Access" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getAllTotalSecurityHolding', function( $request, $response ) { | |
validate($request, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
/* 'CSCSNumber' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CSCSNumber is required' | |
], */ | |
]); | |
$payload = $request->getQueryParams(); | |
if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$payload['SECID'] = $request->getAttribute('SECID'); | |
$holding= $this->customerModel->getAllTotalSecurityHolding($payload); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'Total Stockbroking Portfolio Value Across CSCS Accounts Successful Fetched', | |
'data' => $holding | |
]); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* Get Available Stocks for Margin Collateral | |
* | |
* @OA\Get( | |
* path="/api/customer/getAvailableStocksForMarginCollateral", | |
* tags={"Customer"}, | |
* summary="Get Available Stocks for Margin Collateral", | |
* operationId="getAvailableStocksForMarginCollateral", | |
* @OA\Parameter( | |
* name="CustID", | |
* in="query", | |
* description="Customer ID", | |
* required=true, | |
* @OA\Schema( | |
* type="integer", | |
* example=12345 | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message", | |
* example="Total Stockbroking Portfolio Available for Margin Collateral Across CSCS Accounts Successfully Fetched" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="array", | |
* @OA\Items( | |
* type="object", | |
* @OA\Property( | |
* property="security", | |
* type="string", | |
* description="Security name", | |
* example="ABC Corporation" | |
* ), | |
* @OA\Property( | |
* property="quantity", | |
* type="integer", | |
* description="Available quantity of the security for margin collateral", | |
* example=500 | |
* ), | |
* @OA\Property( | |
* property="current_value", | |
* type="number", | |
* description="Current value of the security available for margin collateral", | |
* example=10000.00 | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Unauthorized message", | |
* example="Unauthorized Access" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getAvailableStocksForMarginCollateral', function( $request, $response ) { | |
validate($request, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
/* 'CSCSNumber' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CSCSNumber is required' | |
], */ | |
]); | |
$payload = $request->getQueryParams(); | |
if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$payload['SECID'] = $request->getAttribute('SECID'); | |
$holding= $this->customerModel->getAvailableStocksForMarginCollateral($payload); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'Total Stockbroking Portfolio Available for Margin Collateral Across CSCS Accounts Successful Fetched', | |
'data' => $holding | |
]); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* Get Holdings by Sector/Asset Class | |
* | |
* @OA\Get( | |
* path="/api/customer/getHoldingBySectorAssetClass", | |
* tags={"Customer"}, | |
* summary="Get Holdings by Sector/Asset Class", | |
* operationId="getHoldingBySectorAssetClass", | |
* @OA\Parameter( | |
* name="CustID", | |
* in="query", | |
* description="Customer ID", | |
* required=true, | |
* @OA\Schema( | |
* type="integer", | |
* example=12345 | |
* ) | |
* ), | |
* @OA\Parameter( | |
* name="CSCSNumber", | |
* in="query", | |
* description="CSCS Number", | |
* required=true, | |
* @OA\Schema( | |
* type="string", | |
* example="CSCS12345" | |
* ) | |
* ), | |
* @OA\Parameter( | |
* name="category", | |
* in="query", | |
* description="Category (AssetClass or Sector)", | |
* required=true, | |
* @OA\Schema( | |
* type="string", | |
* example="AssetClass" | |
* ) | |
* ), | |
* @OA\Parameter( | |
* name="key", | |
* in="query", | |
* description="Key (AssetClass/Sector value)", | |
* required=true, | |
* @OA\Schema( | |
* type="string", | |
* example="Technology" | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message", | |
* example="Holdings by AssetClass successful fetched" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="array", | |
* @OA\Items( | |
* type="object", | |
* @OA\Property( | |
* property="security", | |
* type="string", | |
* description="Security name", | |
* example="ABC Corporation" | |
* ), | |
* @OA\Property( | |
* property="quantity", | |
* type="integer", | |
* description="Total quantity of the security", | |
* example=500 | |
* ), | |
* @OA\Property( | |
* property="current_value", | |
* type="number", | |
* description="Current value of the security holding", | |
* example=10000.00 | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Unauthorized message", | |
* example="Unauthorized Access" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getHoldingBySectorAssetClass', function( $request, $response ) { | |
validate($request, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
'CSCSNumber' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CSCSNumber is required' | |
], | |
'category' => [ | |
'rules' => V::notBlank(), | |
'message' => 'category (AssetClass or Sector) is required' | |
], | |
'key' => [ | |
'rules' => V::notBlank(), | |
'message' => 'key (AssetClass/Sector value) is required' | |
], | |
]); | |
$payload = $request->getQueryParams(); | |
if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$payload['SECID'] = $request->getAttribute('SECID'); | |
$holding= $this->customerModel->getHoldingBySectorAssetClass($payload); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'Holdings by '. $payload['category'] .' successful fetched', | |
'data' => $holding | |
]); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* Book CAM (Capital Asset Management) Investment | |
* | |
* @OA\Post( | |
* path="/api/customer/bookCAMInvestment", | |
* tags={"Customer"}, | |
* summary="Book CAM (Capital Asset Management) Investment", | |
* operationId="bookCAMInvestment", | |
* @OA\RequestBody( | |
* required=true, | |
* description="CAM investment details", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* required={"CustID", "involvementType", "investmentType", "instrumentType", "amount", "interestRate", "tenure", "ledgerType", "capitalizeOnRollover", "doAutomaticRollover", "upfrontInterest"}, | |
* @OA\Property( | |
* property="CustID", | |
* type="integer", | |
* description="Customer ID", | |
* example=12345 | |
* ), | |
* @OA\Property( | |
* property="involvementType", | |
* type="string", | |
* description="Type of involvement in the investment", | |
* example="Individual" | |
* ), | |
* @OA\Property( | |
* property="investmentType", | |
* type="string", | |
* description="Type of investment", | |
* example="Fixed Deposit" | |
* ), | |
* @OA\Property( | |
* property="instrumentType", | |
* type="string", | |
* description="Type of investment instrument", | |
* example="Government Bonds" | |
* ), | |
* @OA\Property( | |
* property="amount", | |
* type="number", | |
* description="Investment amount", | |
* example=10000.00 | |
* ), | |
* @OA\Property( | |
* property="interestRate", | |
* type="number", | |
* description="Interest rate for the investment", | |
* example=5.5 | |
* ), | |
* @OA\Property( | |
* property="tenure", | |
* type="integer", | |
* description="Tenure of the investment in months", | |
* example=12 | |
* ), | |
* @OA\Property( | |
* property="ledgerType", | |
* type="string", | |
* description="Type of ledger for the investment", | |
* example="Savings Account" | |
* ), | |
* @OA\Property( | |
* property="capitalizeOnRollover", | |
* type="string", | |
* description="Indicates whether to capitalize on rollover (True or False)", | |
* example="True" | |
* ), | |
* @OA\Property( | |
* property="doAutomaticRollover", | |
* type="string", | |
* description="Indicates whether to do automatic rollover (True or False)", | |
* example="True" | |
* ), | |
* @OA\Property( | |
* property="upfrontInterest", | |
* type="string", | |
* description="Indicates whether upfront interest is applicable (True or False)", | |
* example="False" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message", | |
* example="Investment successfully booked" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="object", | |
* @OA\Property( | |
* property="StatusID", | |
* type="integer", | |
* description="Status code for the investment booking (0 for success, non-zero for failure)", | |
* example=0 | |
* ), | |
* @OA\Property( | |
* property="StatusMsg", | |
* type="string", | |
* description="Status message for the investment booking", | |
* example="Investment booked successfully" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message", | |
* example="Investment booking failed" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Unauthorized message", | |
* example="Unauthorized Access" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->post('/api/customer/bookCAMInvestment', function( $request, $response ) { | |
validate($request, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
'involvementType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'involvementType is required' | |
], | |
'investmentType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'investmentType is required' | |
], | |
'instrumentType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'instrumentType is required' | |
], | |
'amount' => [ | |
'rules' => V::notBlank(), | |
'message' => 'amount is required' | |
], | |
'interestRate' => [ | |
'rules' => V::notBlank(), | |
'message' => 'interestRate is required' | |
], | |
'tenure' => [ | |
'rules' => V::notBlank(), | |
'message' => 'tenure is required' | |
], | |
'ledgerType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'ledgerType is required' | |
], | |
'capitalizeOnRollover' => [ | |
'rules' => V::notBlank(), | |
'message' => 'capitalizeOnRollover (string True or False) is required' | |
], | |
'doAutomaticRollover' => [ | |
'rules' => V::notBlank(), | |
'message' => 'doAutomaticRollover (string True or False) is required' | |
], | |
'upfrontInterest' => [ | |
'rules' => V::notBlank(), | |
'message' => 'upfrontInterest (string True or False) is required' | |
], | |
]); | |
$payload = $request->getParsedBody(); | |
if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$payload["CAMID"] = $request->getAttribute('CAMID'); | |
$payload["SECID"] = $request->getAttribute('SECID'); | |
$holding= $this->customerModel->bookCAMInvestment($payload); | |
return $response | |
->withStatus(($holding["StatusID"] == 0) ? 200 : 400) | |
->withJson([ | |
'message' => ($holding["StatusID"] == 0) ? 'Investment successfully booked' : 'Investment booking failed', | |
'data' => $holding | |
]); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
$app->post('/api/yochaa/customer/bookCAMInvestment', function( $request, $response ) { | |
validate($request, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
'involvementType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'involvementType is required' | |
], | |
'investmentType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'investmentType is required' | |
], | |
'instrumentType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'instrumentType is required' | |
], | |
'amount' => [ | |
'rules' => V::notBlank(), | |
'message' => 'amount is required' | |
], | |
'interestRate' => [ | |
'rules' => V::notBlank(), | |
'message' => 'interestRate is required' | |
], | |
'tenure' => [ | |
'rules' => V::notBlank(), | |
'message' => 'tenure is required' | |
], | |
'ledgerType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'ledgerType is required' | |
], | |
'capitalizeOnRollover' => [ | |
'rules' => V::notBlank(), | |
'message' => 'capitalizeOnRollover (string True or False) is required' | |
], | |
'doAutomaticRollover' => [ | |
'rules' => V::notBlank(), | |
'message' => 'doAutomaticRollover (string True or False) is required' | |
], | |
'upfrontInterest' => [ | |
'rules' => V::notBlank(), | |
'message' => 'upfrontInterest (string True or False) is required' | |
], | |
]); | |
$payload = $request->getParsedBody(); | |
$customerInfo = $this->customerModel->getCustomerDetails($payload['CustID']); | |
if (!$customerInfo) { | |
throw new Exception('Unable to find customer ' . $payload['CustID']); | |
} | |
$payload["CAMID"] = $customerInfo['CAMID']; | |
$payload["SECID"] = $customerInfo['SECID']; | |
$holding= $this->customerModel->bookCAMInvestment($payload); | |
return $response | |
->withStatus(($holding["StatusID"] == 0) ? 200 : 400) | |
->withJson([ | |
'message' => ($holding["StatusID"] == 0) ? 'Investment successfully booked' : 'Investment booking failed', | |
'data' => $holding | |
]); | |
}) | |
// //->add(new PartnersMiddleware()) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
/** | |
* Book Commercial Paper (CP) Investment | |
* | |
* @OA\Post( | |
* path="/api/customer/bookCP", | |
* tags={"Customer"}, | |
* summary="Book Commercial Paper (CP) Investment", | |
* operationId="bookCP", | |
* @OA\RequestBody( | |
* required=true, | |
* description="CP investment details", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* required={"CustID", "fullName", "involvementType", "price", "amount", "rate", "tenure", "ledgerType", "capitalizeOnRollover", "doAutomaticRollover", "upfrontInterest", "product", "instrumentType"}, | |
* @OA\Property( | |
* property="CustID", | |
* type="integer", | |
* description="Customer ID", | |
* example=12345 | |
* ), | |
* @OA\Property( | |
* property="fullName", | |
* type="string", | |
* description="Full name of the customer", | |
* example="John Doe" | |
* ), | |
* @OA\Property( | |
* property="involvementType", | |
* type="string", | |
* description="Type of involvement in the investment", | |
* example="Individual" | |
* ), | |
* @OA\Property( | |
* property="price", | |
* type="number", | |
* description="Price of the CP", | |
* example=1000.00 | |
* ), | |
* @OA\Property( | |
* property="amount", | |
* type="number", | |
* description="Investment amount", | |
* example=10000.00 | |
* ), | |
* @OA\Property( | |
* property="rate", | |
* type="number", | |
* description="Interest rate for the investment", | |
* example=5.5 | |
* ), | |
* @OA\Property( | |
* property="tenure", | |
* type="integer", | |
* description="Tenure of the investment in months", | |
* example=12 | |
* ), | |
* @OA\Property( | |
* property="ledgerType", | |
* type="string", | |
* description="Type of ledger for the investment", | |
* example="Savings Account" | |
* ), | |
* @OA\Property( | |
* property="capitalizeOnRollover", | |
* type="string", | |
* description="Indicates whether to capitalize on rollover (True or False)", | |
* example="True" | |
* ), | |
* @OA\Property( | |
* property="doAutomaticRollover", | |
* type="string", | |
* description="Indicates whether to do automatic rollover (True or False)", | |
* example="True" | |
* ), | |
* @OA\Property( | |
* property="upfrontInterest", | |
* type="string", | |
* description="Indicates whether upfront interest is applicable (True or False)", | |
* example="False" | |
* ), | |
* @OA\Property( | |
* property="product", | |
* type="string", | |
* description="Type of CP product", | |
* example="XYZ Corporation CP" | |
* ), | |
* @OA\Property( | |
* property="instrumentType", | |
* type="string", | |
* description="Type of investment instrument", | |
* example="Commercial Paper" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message", | |
* example="Investment successfully booked" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message", | |
* example="Investment booking failed" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Unauthorized message", | |
* example="Unauthorized Access" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->post('/api/customer/bookCP', function( $request, $response ) { //we cannot use submitCAMDeal for CP, because CP cannot be sold/liquidated | |
validate($request, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
'fullName' => [ | |
'rules' => V::notBlank(), | |
'message' => 'fullName is required' | |
], | |
'involvementType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'involvementType is required' | |
], | |
'price' => [ | |
'rules' => V::notBlank(), | |
'message' => 'price is required' | |
], | |
'amount' => [ | |
'rules' => V::notBlank(), | |
'message' => 'amount is required' | |
], | |
'rate' => [ | |
'rules' => V::numeric(), | |
'message' => 'rate is required' | |
], | |
'tenure' => [ | |
'rules' => V::notBlank(), | |
'message' => 'tenure is required' | |
], | |
'ledgerType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'ledgerType is required' | |
], | |
'capitalizeOnRollover' => [ | |
'rules' => V::notBlank(), | |
'message' => 'capitalizeOnRollover (string True or False) is required' | |
], | |
'doAutomaticRollover' => [ | |
'rules' => V::notBlank(), | |
'message' => 'doAutomaticRollover (string True or False) is required' | |
], | |
'upfrontInterest' => [ | |
'rules' => V::notBlank(), | |
'message' => 'upfrontInterest (string True or False) is required' | |
], | |
'product' => [ | |
'rules' => V::notBlank(), | |
'message' => 'product is required' | |
], | |
'instrumentType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'instrumentType is required' | |
], | |
]); | |
$payload = $request->getParsedBody(); | |
if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$payload["CAMID"] = $request->getAttribute('CAMID'); | |
$payload["productType"] = CP; | |
$holding= $this->customerModel->submitCAMDeal($payload); | |
return $response | |
->withStatus($holding["code"] ?? 200) | |
->withJson($holding["message"]); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* Submit Break CAM (Capital Asset Management) Investment Request | |
* | |
* @OA\Post( | |
* path="/api/customer/submitBreakCAMInvestment", | |
* tags={"Customer"}, | |
* summary="Submit Break CAM (Capital Asset Management) Investment Request", | |
* operationId="submitBreakCAMInvestment", | |
* @OA\RequestBody( | |
* required=true, | |
* description="Break CAM investment request details", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* required={"CustID", "fullName", "transNo", "chgAmount", "tenure", "rate", "instrumentType", "productType", "penalty", "product"}, | |
* @OA\Property( | |
* property="CustID", | |
* type="integer", | |
* description="Customer ID", | |
* example=12345 | |
* ), | |
* @OA\Property( | |
* property="fullName", | |
* type="string", | |
* description="Full name of the customer", | |
* example="John Doe" | |
* ), | |
* @OA\Property( | |
* property="transNo", | |
* type="string", | |
* description="Transaction number", | |
* example="CAM12345" | |
* ), | |
* @OA\Property( | |
* property="chgAmount", | |
* type="number", | |
* description="Changed investment amount", | |
* example=12000.00 | |
* ), | |
* @OA\Property( | |
* property="tenure", | |
* type="integer", | |
* description="Remaining tenure of the investment in months", | |
* example=6 | |
* ), | |
* @OA\Property( | |
* property="rate", | |
* type="number", | |
* description="Interest rate for the investment", | |
* example=5.5 | |
* ), | |
* @OA\Property( | |
* property="instrumentType", | |
* type="string", | |
* description="Type of investment instrument", | |
* example="Mutual Fund" | |
* ), | |
* @OA\Property( | |
* property="productType", | |
* type="string", | |
* description="Type of CAM product", | |
* example="Growth CAM" | |
* ), | |
* @OA\Property( | |
* property="penalty", | |
* type="number", | |
* description="Penalty amount (if any)", | |
* example=200.00 | |
* ), | |
* @OA\Property( | |
* property="product", | |
* type="string", | |
* description="Type of investment product", | |
* example="ABC Mutual Fund" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message", | |
* example="Break CAM investment request submitted" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message", | |
* example="Failed to submit break CAM investment request" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Unauthorized message", | |
* example="Unauthorized Access" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->post('/api/customer/submitBreakCAMInvestment', function( $request, $response ) { | |
validate($request, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
/* 'CAMID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CAMID is required' | |
], */ | |
'fullName' => [ | |
'rules' => V::notBlank(), | |
'message' => 'fullName is required' | |
], | |
'transNo' => [ | |
'rules' => V::notBlank(), | |
'message' => 'transNo is required' | |
], | |
'chgAmount' => [ | |
'rules' => V::notBlank(), | |
'message' => 'chgAmount is required' | |
], | |
'tenure' => [ | |
'rules' => V::notBlank(), | |
'message' => 'tenure (RemainderTenure) is required' | |
], | |
'rate' => [ | |
'rules' => V::numeric(), | |
'message' => 'rate is required' | |
], | |
'instrumentType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'InstrumentType is required' | |
], | |
'productType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'productType is required' | |
], | |
'penalty' => [ | |
'rules' => V::notBlank(), | |
'message' => 'penalty is required' | |
], | |
'product' => [ | |
'rules' => V::notBlank(), | |
'message' => 'product is required' | |
], | |
]); | |
$payload = $request->getParsedBody(); | |
if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$payload["CAMID"] = $request->getAttribute('CAMID'); | |
$result= $this->customerModel->submitBreakCAMInvestment($payload); | |
return $response | |
->withStatus($result["code"] ?? 200) | |
->withJson($result); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* Compute Break CAM (Capital Asset Management) Investment | |
* | |
* @OA\Post( | |
* path="/api/customer/computeBreakCAMInvestment", | |
* tags={"Customer"}, | |
* summary="Compute Break CAM (Capital Asset Management) Investment", | |
* operationId="computeBreakCAMInvestment", | |
* @OA\RequestBody( | |
* required=true, | |
* description="Break CAM investment computation details", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* required={"CustID", "transNo", "chgAmount", "instrumentType"}, | |
* @OA\Property( | |
* property="CustID", | |
* type="integer", | |
* description="Customer ID", | |
* example=12345 | |
* ), | |
* @OA\Property( | |
* property="transNo", | |
* type="string", | |
* description="Transaction number", | |
* example="CAM12345" | |
* ), | |
* @OA\Property( | |
* property="chgAmount", | |
* type="number", | |
* description="Changed investment amount", | |
* example=12000.00 | |
* ), | |
* @OA\Property( | |
* property="instrumentType", | |
* type="string", | |
* description="Type of investment instrument", | |
* example="CAM-MMI" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message", | |
* example="Break CAM investment computed successfully" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="array", | |
* @OA\Items( | |
* type="object", | |
* @OA\Property( | |
* property="rebate_amount", | |
* type="number", | |
* description="Rebate amount after breaking CAM investment", | |
* example=100.00 | |
* ), | |
* @OA\Property( | |
* property="new_tenure", | |
* type="integer", | |
* description="New tenure after breaking CAM investment", | |
* example=6 | |
* ), | |
* @OA\Property( | |
* property="new_interest_rate", | |
* type="number", | |
* description="New interest rate after breaking CAM investment", | |
* example=5.0 | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message", | |
* example="Failed to compute break CAM investment" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Unauthorized message", | |
* example="Unauthorized Access" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->post('/api/customer/computeBreakCAMInvestment', function( $request, $response ) { | |
validate($request, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
'transNo' => [ | |
'rules' => V::notBlank(), | |
'message' => 'transNo is required' | |
], | |
'chgAmount' => [ | |
'rules' => V::notBlank(), | |
'message' => 'chgAmount is required' | |
], | |
/* 'tenure' => [ | |
'rules' => V::notBlank(), | |
'message' => 'tenure (RemainderTenure) is required' | |
], | |
'interestRate' => [ | |
'rules' => V::notBlank(), | |
'message' => 'interestRate is required' | |
], */ | |
'instrumentType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'Instrument Type is required' | |
], | |
]); | |
$payload = $request->getParsedBody(); | |
if(strtoupper($payload['instrumentType']) != "CAM-MMI" && strtoupper($payload['instrumentType']) != "CAM-MMIGBP" && strtoupper($payload['instrumentType']) != "MMI" && strtoupper($payload['instrumentType']) != "MMI-GBP" && strtoupper($payload['instrumentType']) != "CAM-EIN" && strtoupper($payload['instrumentType']) != "EIN" && strtoupper($payload['instrumentType']) != "CAM-FI" && strtoupper($payload['instrumentType']) != "FI-FI") | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Invalid Instrument Type"]); | |
} | |
if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$payload["CAMID"] = $request->getAttribute('CAMID'); | |
$holding= $this->customerModel->computeBreakCAMInvestment($payload); | |
return $response | |
->withStatus($holding["code"] ?? 200) | |
->withJson([$holding]); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* Break CAM (Capital Asset Management) Investment | |
* | |
* @OA\Post( | |
* path="/api/customer/breakCAMInvestment", | |
* tags={"Customer"}, | |
* summary="Break CAM (Capital Asset Management) Investment", | |
* operationId="breakCAMInvestment", | |
* @OA\RequestBody( | |
* required=true, | |
* description="Break CAM investment details", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* required={"CustID", "transNo", "chgAmount", "tenure", "interestRate", "instrumentType"}, | |
* @OA\Property( | |
* property="CustID", | |
* type="integer", | |
* description="Customer ID", | |
* example=12345 | |
* ), | |
* @OA\Property( | |
* property="transNo", | |
* type="string", | |
* description="Transaction number", | |
* example="CAM12345" | |
* ), | |
* @OA\Property( | |
* property="chgAmount", | |
* type="number", | |
* description="Changed investment amount", | |
* example=12000.00 | |
* ), | |
* @OA\Property( | |
* property="tenure", | |
* type="integer", | |
* description="Remaining tenure of the investment in months", | |
* example=6 | |
* ), | |
* @OA\Property( | |
* property="interestRate", | |
* type="number", | |
* description="Interest rate for the investment", | |
* example=5.5 | |
* ), | |
* @OA\Property( | |
* property="instrumentType", | |
* type="string", | |
* description="Type of investment instrument", | |
* example="CAM-MMI" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message", | |
* example="Investment successfully terminated" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="array", | |
* @OA\Items( | |
* type="object", | |
* @OA\Property( | |
* property="security", | |
* type="string", | |
* description="Security name", | |
* example="ABC Corporation" | |
* ), | |
* @OA\Property( | |
* property="quantity", | |
* type="integer", | |
* description="Total quantity of the security", | |
* example=500 | |
* ), | |
* @OA\Property( | |
* property="current_value", | |
* type="number", | |
* description="Current value of the security holding", | |
* example=10000.00 | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message", | |
* example="Investment termination failed" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Unauthorized message", | |
* example="Unauthorized Access" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->post('/api/customer/breakCAMInvestment', function( $request, $response ) { | |
validate($request, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
'transNo' => [ | |
'rules' => V::notBlank(), | |
'message' => 'transNo is required' | |
], | |
'chgAmount' => [ | |
'rules' => V::notBlank(), | |
'message' => 'chgAmount is required' | |
], | |
'tenure' => [ | |
'rules' => V::notBlank(), | |
'message' => 'tenure (RemainderTenure)is required' | |
], | |
'interestRate' => [ | |
'rules' => V::notBlank(), | |
'message' => 'interestRate is required' | |
], | |
'instrumentType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'Instrument Type is required' | |
], | |
]); | |
$payload = $request->getParsedBody(); | |
/* if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} */ | |
$payload["CAMID"] = $request->getAttribute('CAMID'); | |
$holding= $this->customerModel->breakCAMInvestment($payload); | |
return $response | |
->withStatus(($holding["StatusID"] == 0) ? 200 : 400) | |
->withJson([ | |
'message' => ($holding["StatusID"] == 0) ? 'Investment successfully terminated' : 'Investment termination failed', | |
'data' => $holding | |
]); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
$app->post('/api/yochaa/customer/breakCAMInvestment', function( $request, $response ) { | |
validate($request, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
'transNo' => [ | |
'rules' => V::notBlank(), | |
'message' => 'transNo is required' | |
], | |
'chgAmount' => [ | |
'rules' => V::notBlank(), | |
'message' => 'chgAmount is required' | |
], | |
'tenure' => [ | |
'rules' => V::notBlank(), | |
'message' => 'tenure (RemainderTenure)is required' | |
], | |
'interestRate' => [ | |
'rules' => V::notBlank(), | |
'message' => 'interestRate is required' | |
], | |
'instrumentType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'Instrument Type is required' | |
], | |
]); | |
$payload = $request->getParsedBody(); | |
$customerInfo = $this->customerModel->getCustomerDetails($payload['CustID']); | |
if (!$customerInfo) | |
{ | |
throw new Exception('Unable to find customer ' . $payload['CustID']); | |
} | |
$payload["CAMID"] = $customerInfo['CAMID']; | |
$holding= $this->customerModel->breakCAMInvestment($payload); | |
return $response | |
->withStatus(($holding["StatusID"] == 0) ? 200 : 400) | |
->withJson([ | |
'message' => ($holding["StatusID"] == 0) ? 'Investment successfully terminated' : 'Investment termination failed', | |
'data' => $holding | |
]); | |
}) | |
//->add(new PartnersMiddleware()) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
$app->post('/api/yochaa/customer/getCustomerInvestments', function( $request, $response ) { | |
validate($request, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
]); | |
$payload = $request->getParsedBody(); | |
$customerInfo = $this->customerModel->getCustomerDetails($payload['CustID']); | |
if (!$customerInfo) { | |
throw new Exception('Unable to find customer ' . $payload['CustID']); | |
} | |
$payload["CAMID"] = $customerInfo['CAMID']; | |
$holding= container('termInstrument_CAMModel')->findCustomerTermInstruments($payload['CAMID']); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'Investment(s) Successfully Fetched', | |
'data' => $holding | |
]); | |
}) | |
//->add(new PartnersMiddleware()) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
/** | |
* Break EIN (Equity Investment Note) Investment | |
* | |
* @OA\Post( | |
* path="/api/customer/breakEINInvestment", | |
* tags={"Customer"}, | |
* summary="Break EIN (Equity Investment Note) Investment", | |
* operationId="breakEINInvestment", | |
* @OA\RequestBody( | |
* required=true, | |
* description="Break EIN investment details", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* required={"CustID", "transNo", "chgAmount", "tenure", "interestRate", "instrumentType"}, | |
* @OA\Property( | |
* property="CustID", | |
* type="integer", | |
* description="Customer ID", | |
* example=12345 | |
* ), | |
* @OA\Property( | |
* property="transNo", | |
* type="string", | |
* description="Transaction number", | |
* example="EIN12345" | |
* ), | |
* @OA\Property( | |
* property="chgAmount", | |
* type="number", | |
* description="Changed investment amount", | |
* example=12000.00 | |
* ), | |
* @OA\Property( | |
* property="tenure", | |
* type="integer", | |
* description="Remaining tenure of the investment in months", | |
* example=6 | |
* ), | |
* @OA\Property( | |
* property="interestRate", | |
* type="number", | |
* description="Interest rate for the investment", | |
* example=5.5 | |
* ), | |
* @OA\Property( | |
* property="instrumentType", | |
* type="string", | |
* description="Type of investment instrument", | |
* example="EIN" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message", | |
* example="Investment successfully terminated" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="array", | |
* @OA\Items( | |
* type="object", | |
* @OA\Property( | |
* property="security", | |
* type="string", | |
* description="Security name", | |
* example="ABC Corporation" | |
* ), | |
* @OA\Property( | |
* property="quantity", | |
* type="integer", | |
* description="Total quantity of the security", | |
* example=500 | |
* ), | |
* @OA\Property( | |
* property="current_value", | |
* type="number", | |
* description="Current value of the security holding", | |
* example=10000.00 | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message", | |
* example="Investment termination failed" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Unauthorized message", | |
* example="Unauthorized Access" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->post('/api/customer/breakEINInvestment', function( $request, $response ) { | |
validate($request, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
'transNo' => [ | |
'rules' => V::notBlank(), | |
'message' => 'transNo is required' | |
], | |
'chgAmount' => [ | |
'rules' => V::notBlank(), | |
'message' => 'chgAmount is required' | |
], | |
'tenure' => [ | |
'rules' => V::notBlank(), | |
'message' => 'tenure (RemainderTenure) is required' | |
], | |
'interestRate' => [ | |
'rules' => V::notBlank(), | |
'message' => 'interestRate is required' | |
], | |
'instrumentType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'Instrument Type is required' | |
], | |
]); | |
$payload = $request->getParsedBody(); | |
if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$payload["CAMID"] = $request->getAttribute('CAMID'); | |
$holding= $this->customerModel->breakEINInvestment($payload); | |
return $response | |
->withStatus(($holding["StatusID"] == 0) ? 200 : 400) | |
->withJson([ | |
'message' => ($holding["StatusID"] == 0) ? 'Investment successfully terminated' : 'Investment termination failed', | |
'data' => $holding | |
]); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
/** | |
* Get Active CAM (Capital Asset Management) Investment(s) | |
* | |
* @OA\Get( | |
* path="/api/customer/getActiveCAMInvestment", | |
* tags={"Customer"}, | |
* summary="Get Active CAM (Capital Asset Management) Investment(s)", | |
* operationId="getActiveCAMInvestment", | |
* @OA\Parameter( | |
* name="CustID", | |
* in="query", | |
* description="Customer ID", | |
* required=true, | |
* @OA\Schema( | |
* type="integer", | |
* example=12345 | |
* ) | |
* ), | |
* @OA\Parameter( | |
* name="ledgerType", | |
* in="query", | |
* description="Type of ledger", | |
* required=true, | |
* @OA\Schema( | |
* type="string", | |
* example="ledger123" | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message", | |
* example="Active CAM Investment(s) Successfully Fetched" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="array", | |
* @OA\Items( | |
* type="object", | |
* @OA\Property( | |
* property="security", | |
* type="string", | |
* description="Security name", | |
* example="ABC Corporation" | |
* ), | |
* @OA\Property( | |
* property="quantity", | |
* type="integer", | |
* description="Total quantity of the security", | |
* example=500 | |
* ), | |
* @OA\Property( | |
* property="current_value", | |
* type="number", | |
* description="Current value of the security holding", | |
* example=10000.00 | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message", | |
* example="Invalid Request" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Unauthorized message", | |
* example="Unauthorized Access" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getActiveCAMInvestment', function( $request, $response ) { | |
validate($request, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
'ledgerType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'ledgerType is required' | |
], | |
]); | |
$payload = $request->getQueryParams(); | |
if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$payload["CAMID"] = $request->getAttribute('CAMID'); | |
$holding= $this->customerModel->getActiveCAMInvestment($payload); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'Active CAM Investment(s) Successfully Fetched', | |
'data' => $holding | |
]); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* Get Active SMA (Simplified Managed Account) CAM Investment(s) | |
* | |
* @OA\Get( | |
* path="/api/customer/getActiveSMACAMInvestment", | |
* tags={"Customer"}, | |
* summary="Get Active SMA (Simplified Managed Account) CAM Investment(s)", | |
* operationId="getActiveSMACAMInvestment", | |
* @OA\Parameter( | |
* name="CustID", | |
* in="query", | |
* description="Customer ID", | |
* required=true, | |
* @OA\Schema( | |
* type="integer", | |
* example=12345 | |
* ) | |
* ), | |
* @OA\Parameter( | |
* name="ledgerType", | |
* in="query", | |
* description="Type of ledger", | |
* required=true, | |
* @OA\Schema( | |
* type="string", | |
* example="ledger123" | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message", | |
* example="Active SMA Investment(s) Successfully Fetched" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="array", | |
* @OA\Items( | |
* type="object", | |
* @OA\Property( | |
* property="security", | |
* type="string", | |
* description="Security name", | |
* example="XYZ Corporation" | |
* ), | |
* @OA\Property( | |
* property="quantity", | |
* type="integer", | |
* description="Total quantity of the security", | |
* example=200 | |
* ), | |
* @OA\Property( | |
* property="current_value", | |
* type="number", | |
* description="Current value of the security holding", | |
* example=5000.00 | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message", | |
* example="Invalid Request" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Unauthorized message", | |
* example="Unauthorized Access" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getActiveSMACAMInvestment', function( $request, $response ) { | |
validate($request, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
'ledgerType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'ledgerType is required' | |
], | |
]); | |
$payload = $request->getQueryParams(); | |
/* if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$payload["CAMID"] = $request->getAttribute('CAMID'); */ | |
$holding= $this->customerModel->getActiveSMACAMInvestment($payload); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'Active SMA Investment(s) Successfully Fetched', | |
'data' => $holding | |
]); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
$app->get('/api/admin/getActiveSMACAMInvestment', function( $request, $response ) { | |
validate($request, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
'ledgerType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'ledgerType is required' | |
], | |
]); | |
$payload = $request->getQueryParams(); | |
$holding= $this->customerModel->getActiveSMACAMInvestment($payload); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'Active SMA Investment(s) Successfully Fetched', | |
'data' => $holding | |
]); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
/** | |
* Get Active SMA (Simplified Managed Account) CSS Investment(s) | |
* | |
* @OA\Get( | |
* path="/api/customer/getActiveSMACSSInvestment", | |
* tags={"Customer"}, | |
* summary="Get Active SMA (Simplified Managed Account) CSS Investment(s)", | |
* operationId="getActiveSMACSSInvestment", | |
* @OA\Parameter( | |
* name="CustID", | |
* in="query", | |
* description="Customer ID", | |
* required=true, | |
* @OA\Schema( | |
* type="integer", | |
* example=12345 | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message", | |
* example="Active SMA Investment(s) Successfully Fetched" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="array", | |
* @OA\Items( | |
* type="object", | |
* @OA\Property( | |
* property="security", | |
* type="string", | |
* description="Security name", | |
* example="XYZ Corporation" | |
* ), | |
* @OA\Property( | |
* property="quantity", | |
* type="integer", | |
* description="Total quantity of the security", | |
* example=200 | |
* ), | |
* @OA\Property( | |
* property="current_value", | |
* type="number", | |
* description="Current value of the security holding", | |
* example=5000.00 | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message", | |
* example="Invalid Request" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Unauthorized message", | |
* example="Unauthorized Access" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getActiveSMACSSInvestment', function( $request, $response ) { | |
validate($request, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
/* 'ledgerType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'ledgerType is required' | |
], */ | |
]); | |
$payload = $request->getQueryParams(); | |
/* if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$payload["CAMID"] = $request->getAttribute('CAMID'); */ | |
$holding= $this->customerModel->getActiveSMACSSInvestment($payload); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'Active SMA Investment(s) Successfully Fetched', | |
'data' => $holding | |
]); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* Get Total Value of Active SMA (Simplified Managed Account) Investments | |
* | |
* @OA\Get( | |
* path="/api/customer/getSMAInvestmentTotal", | |
* tags={"Customer"}, | |
* summary="Get Total Value of Active SMA (Simplified Managed Account) Investments", | |
* operationId="getSMAInvestmentTotal", | |
* @OA\Parameter( | |
* name="CustID", | |
* in="query", | |
* description="Customer ID", | |
* required=true, | |
* @OA\Schema( | |
* type="integer", | |
* example=12345 | |
* ) | |
* ), | |
* @OA\Parameter( | |
* name="ledgerType", | |
* in="query", | |
* description="Ledger Type (NGN, USD, GBP)", | |
* required=true, | |
* @OA\Schema( | |
* type="string", | |
* enum={"NGN", "USD", "GBP"}, | |
* example="NGN" | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message", | |
* example="Active SMA Investment(s) Total Value Computed" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="number", | |
* description="Total value of active SMA investments", | |
* example=150000.00 | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message", | |
* example="Invalid Request" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Unauthorized message", | |
* example="Unauthorized Access" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getSMAInvestmentTotal', function( $request, $response ) { | |
validate($request, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
'ledgerType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'ledgerType (NGN/USD/GBP) is required' | |
], | |
]); | |
$payload = $request->getQueryParams(); | |
/* if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} */ | |
$holding = $this->customerModel->getSMAInvestmentTotal($payload); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'Active SMA Investment(s) Total Value Computed', | |
'data' => $holding | |
]); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* Get All Active SMA (Simplified Managed Account) Investments | |
* | |
* @OA\Get( | |
* path="/api/customer/getAllSMAInvestments", | |
* tags={"Customer"}, | |
* summary="Get All Active SMA (Simplified Managed Account) Investments", | |
* operationId="getAllSMAInvestments", | |
* @OA\Parameter( | |
* name="CustID", | |
* in="query", | |
* description="Customer ID", | |
* required=true, | |
* @OA\Schema( | |
* type="integer", | |
* example=12345 | |
* ) | |
* ), | |
* @OA\Parameter( | |
* name="ledgerType", | |
* in="query", | |
* description="Ledger Type (NGN, USD, GBP)", | |
* required=true, | |
* @OA\Schema( | |
* type="string", | |
* enum={"NGN", "USD", "GBP"}, | |
* example="NGN" | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message", | |
* example="Active SMA Investment(s) Successfully Fetched" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="array", | |
* @OA\Items( | |
* type="object", | |
* @OA\Property( | |
* property="investment_id", | |
* type="integer", | |
* description="Unique identifier for the investment", | |
* example=12345 | |
* ), | |
* @OA\Property( | |
* property="investment_name", | |
* type="string", | |
* description="Name of the investment", | |
* example="SMA Investment 1" | |
* ), | |
* @OA\Property( | |
* property="investment_amount", | |
* type="number", | |
* description="Amount invested in the SMA investment", | |
* example=5000.00 | |
* ), | |
* @OA\Property( | |
* property="investment_currency", | |
* type="string", | |
* description="Currency of the investment (NGN, USD, GBP)", | |
* example="NGN" | |
* ), | |
* @OA\Property( | |
* property="investment_status", | |
* type="string", | |
* description="Status of the investment", | |
* example="Active" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message", | |
* example="Invalid Request" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Unauthorized message", | |
* example="Unauthorized Access" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getAllSMAInvestments', function( $request, $response ) { | |
validate($request, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
'ledgerType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'ledgerType is required' | |
], | |
]); | |
$payload = $request->getQueryParams(); | |
/* if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$payload["CAMID"] = $request->getAttribute('CAMID'); */ | |
$holding = $this->customerModel->getAllSMAInvestments($payload); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'Active SMA Investment(s) Total Value Computed', | |
'data' => $holding | |
]); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* Get Total Value of Active Mutual Funds Investments | |
* | |
* @OA\Get( | |
* path="/api/customer/getMFInvestmentTotal", | |
* tags={"Customer"}, | |
* summary="Get Total Value of Active Mutual Funds Investments", | |
* operationId="getMFInvestmentTotal", | |
* @OA\Parameter( | |
* name="CustID", | |
* in="query", | |
* description="Customer ID", | |
* required=true, | |
* @OA\Schema( | |
* type="integer", | |
* example=12345 | |
* ) | |
* ), | |
* @OA\Parameter( | |
* name="ledgerType", | |
* in="query", | |
* description="Ledger Type (NGN, USD, GBP)", | |
* required=true, | |
* @OA\Schema( | |
* type="string", | |
* enum={"NGN", "USD", "GBP"}, | |
* example="NGN" | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message", | |
* example="Active Mutual Funds Investment(s) Total Value Computed" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="object", | |
* @OA\Property( | |
* property="total_value", | |
* type="number", | |
* description="Total value of active mutual funds investments", | |
* example=15000.00 | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message", | |
* example="Invalid Request" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Unauthorized message", | |
* example="Unauthorized Access" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getMFInvestmentTotal', function( $request, $response ) { | |
validate($request, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
'ledgerType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'ledgerType (NGN/USD/GBP) is required' | |
], | |
]); | |
$payload = $request->getQueryParams(); | |
if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$payload["CAMID"] = $request->getAttribute('CAMID'); | |
$holding = $this->customerModel->getMFInvestmentTotal($payload); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'Active Mutual Funds Investment(s) Total Value Computed', | |
'data' => $holding | |
]); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* Get All Active Mutual Fund Investments | |
* | |
* @OA\Get( | |
* path="/api/customer/getAllMFInvestments", | |
* tags={"Customer"}, | |
* summary="Get All Active Mutual Fund Investments", | |
* operationId="getAllMFInvestments", | |
* @OA\Parameter( | |
* name="CustID", | |
* in="query", | |
* description="Customer ID", | |
* required=true, | |
* @OA\Schema( | |
* type="integer", | |
* example=12345 | |
* ) | |
* ), | |
* @OA\Parameter( | |
* name="ledgerType", | |
* in="query", | |
* description="Ledger Type (NGN, USD, GBP)", | |
* required=true, | |
* @OA\Schema( | |
* type="string", | |
* enum={"NGN", "USD", "GBP"}, | |
* example="NGN" | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message", | |
* example="Active Mutual Fund Investment(s) Fetched" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="array", | |
* @OA\Items( | |
* type="object", | |
* @OA\Property( | |
* property="investment_id", | |
* type="integer", | |
* description="ID of the mutual fund investment", | |
* example=101 | |
* ), | |
* @OA\Property( | |
* property="investment_name", | |
* type="string", | |
* description="Name of the mutual fund investment", | |
* example="ABC Mutual Fund" | |
* ), | |
* @OA\Property( | |
* property="investment_type", | |
* type="string", | |
* description="Type of the mutual fund investment", | |
* example="Equity Fund" | |
* ), | |
* @OA\Property( | |
* property="investment_units", | |
* type="number", | |
* description="Number of units of the mutual fund investment", | |
* example=200 | |
* ), | |
* @OA\Property( | |
* property="investment_value", | |
* type="number", | |
* description="Value of the mutual fund investment", | |
* example=50000.00 | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message", | |
* example="Invalid Request" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Unauthorized message", | |
* example="Unauthorized Access" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getAllMFInvestments', function( $request, $response ) { | |
validate($request, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
'ledgerType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'ledgerType is required' | |
], | |
]); | |
$payload = $request->getQueryParams(); | |
if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$payload["CAMID"] = $request->getAttribute('CAMID'); | |
$holding = $this->customerModel->getAllMFInvestments($payload); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'Active Mutual Fund Investment(s) Fetched', | |
'data' => $holding | |
]); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* Get Active CAM Investment(s) By Transaction Number | |
* | |
* @OA\Get( | |
* path="/api/customer/getActiveCAMInvestmentByTransNo", | |
* tags={"Customer"}, | |
* summary="Get Active CAM Investment(s) By Transaction Number", | |
* operationId="getActiveCAMInvestmentByTransNo", | |
* @OA\Parameter( | |
* name="transNo", | |
* in="query", | |
* description="Transaction Number", | |
* required=true, | |
* @OA\Schema( | |
* type="string", | |
* example="TXN123456" | |
* ) | |
* ), | |
* @OA\Parameter( | |
* name="CustID", | |
* in="query", | |
* description="Customer ID", | |
* required=true, | |
* @OA\Schema( | |
* type="integer", | |
* example=12345 | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message", | |
* example="Active investment(s) successfully fetched" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="array", | |
* @OA\Items( | |
* type="object", | |
* @OA\Property( | |
* property="investment_id", | |
* type="integer", | |
* description="ID of the CAM investment", | |
* example=101 | |
* ), | |
* @OA\Property( | |
* property="investment_type", | |
* type="string", | |
* description="Type of the CAM investment", | |
* example="CAM-MMI" | |
* ), | |
* @OA\Property( | |
* property="investment_amount", | |
* type="number", | |
* description="Amount of the CAM investment", | |
* example=50000.00 | |
* ), | |
* @OA\Property( | |
* property="investment_interest_rate", | |
* type="number", | |
* description="Interest rate of the CAM investment", | |
* example=5.5 | |
* ), | |
* @OA\Property( | |
* property="investment_tenure", | |
* type="integer", | |
* description="Tenure of the CAM investment", | |
* example=12 | |
* ), | |
* @OA\Property( | |
* property="investment_ledger_type", | |
* type="string", | |
* description="Ledger Type of the CAM investment", | |
* example="NGN" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message", | |
* example="Invalid Request" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Unauthorized message", | |
* example="Unauthorized Access" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getActiveCAMInvestmentByTransNo', function( $request, $response ) { | |
validate($request, [ | |
'transNo' => [ | |
'rules' => V::notBlank(), | |
'message' => 'transNo is required' | |
], | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
]); | |
$payload = $request->getQueryParams(); | |
/* if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} */ | |
// $payload["CAMID"] = $request->getAttribute('CAMID'); | |
$holding= $this->customerModel->getActiveCAMInvestmentByTransNo($payload); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'Active investment(s) successfully fetched', | |
'data' => $holding | |
]); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* Get Terminated CAM Investment(s) | |
* | |
* @OA\Get( | |
* path="/api/customer/getTerminatedCAMInvestment", | |
* tags={"Customer"}, | |
* summary="Get Terminated CAM Investment(s)", | |
* operationId="getTerminatedCAMInvestment", | |
* @OA\Parameter( | |
* name="CustID", | |
* in="query", | |
* description="Customer ID", | |
* required=true, | |
* @OA\Schema( | |
* type="integer", | |
* example=12345 | |
* ) | |
* ), | |
* @OA\Parameter( | |
* name="ledgerType", | |
* in="query", | |
* description="Ledger Type (NGN/USD/GBP)", | |
* required=true, | |
* @OA\Schema( | |
* type="string", | |
* example="NGN" | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message", | |
* example="Terminated investment(s) successfully fetched" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="array", | |
* @OA\Items( | |
* type="object", | |
* @OA\Property( | |
* property="investment_id", | |
* type="integer", | |
* description="ID of the terminated CAM investment", | |
* example=102 | |
* ), | |
* @OA\Property( | |
* property="investment_type", | |
* type="string", | |
* description="Type of the terminated CAM investment", | |
* example="CAM-MMIGBP" | |
* ), | |
* @OA\Property( | |
* property="investment_amount", | |
* type="number", | |
* description="Amount of the terminated CAM investment", | |
* example=10000.00 | |
* ), | |
* @OA\Property( | |
* property="termination_date", | |
* type="string", | |
* description="Date when the investment was terminated", | |
* example="2023-07-15" | |
* ), | |
* @OA\Property( | |
* property="termination_reason", | |
* type="string", | |
* description="Reason for the termination", | |
* example="Maturity" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message", | |
* example="Invalid Request" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Unauthorized message", | |
* example="Unauthorized Access" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getTerminatedCAMInvestment', function( $request, $response ) { | |
validate($request, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
'ledgerType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'ledgerType is required' | |
], | |
]); | |
$payload = $request->getQueryParams(); | |
if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$payload["CAMID"] = $request->getAttribute('CAMID'); | |
$holding= $this->customerModel->getTerminatedCAMInvestment($payload); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'Terminated investment(s) successfully fetched', | |
'data' => $holding | |
]); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
$app->get('/api/yochaa/customer/getTerminatedCAMInvestment', function( $request, $response ) { | |
validate($request, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
'ledgerType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'ledgerType is required' | |
], | |
]); | |
$payload = $request->getQueryParams(); | |
$customerInfo = $this->customerModel->getCustomerDetails($payload['CustID']); | |
if (!$customerInfo) { | |
throw new Exception('Unable to find customer ' . $payload['CustID']); | |
} | |
$payload["CAMID"] = $customerInfo['CAMID']; | |
$holding= $this->customerModel->getTerminatedCAMInvestment($payload); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'Terminated investment(s) successfully fetched', | |
'data' => $holding | |
]); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
/** | |
* Get All Terminated CAM Investment(s) | |
* | |
* @OA\Get( | |
* path="/api/getAllTerminatedCAMInvestment", | |
* tags={"Admin"}, | |
* summary="Get All Terminated CAM Investment(s)", | |
* operationId="getAllTerminatedCAMInvestment", | |
* @OA\Parameter( | |
* name="ledgerType", | |
* in="query", | |
* description="Ledger Type (NGN/USD/GBP)", | |
* required=true, | |
* @OA\Schema( | |
* type="string", | |
* example="NGN" | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message", | |
* example="Terminated investments successfully fetched" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="array", | |
* @OA\Items( | |
* type="object", | |
* @OA\Property( | |
* property="investment_id", | |
* type="integer", | |
* description="ID of the terminated CAM investment", | |
* example=102 | |
* ), | |
* @OA\Property( | |
* property="customer_id", | |
* type="integer", | |
* description="ID of the customer", | |
* example=12345 | |
* ), | |
* @OA\Property( | |
* property="investment_type", | |
* type="string", | |
* description="Type of the terminated CAM investment", | |
* example="CAM-MMIGBP" | |
* ), | |
* @OA\Property( | |
* property="investment_amount", | |
* type="number", | |
* description="Amount of the terminated CAM investment", | |
* example=10000.00 | |
* ), | |
* @OA\Property( | |
* property="termination_date", | |
* type="string", | |
* description="Date when the investment was terminated", | |
* example="2023-07-15" | |
* ), | |
* @OA\Property( | |
* property="termination_reason", | |
* type="string", | |
* description="Reason for the termination", | |
* example="Maturity" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message", | |
* example="Invalid Request" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Unauthorized message", | |
* example="Unauthorized Access" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/getAllTerminatedCAMInvestment', function( $request, $response ) { | |
validate($request, [ | |
// 'CustID' => [ | |
// 'rules' => V::notBlank(), | |
// 'message' => 'CustID is required' | |
// ], | |
'ledgerType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'ledgerType is required' | |
], | |
]); | |
$payload = $request->getQueryParams(); | |
$holding= $this->customerModel->getAllTerminatedCAMInvestment($payload); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'Terminated investments successfully fetched', | |
'data' => $holding | |
]); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
/** | |
* Get Payment Channels | |
* | |
* @OA\Get( | |
* path="/api/customer/getPaymentChannel", | |
* tags={"Customer"}, | |
* summary="Get Payment Channels", | |
* operationId="getPaymentChannel", | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message", | |
* example="Successfully fetched all payment channels" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="array", | |
* @OA\Items( | |
* type="object", | |
* @OA\Property( | |
* property="channel_id", | |
* type="integer", | |
* description="ID of the payment channel", | |
* example=1 | |
* ), | |
* @OA\Property( | |
* property="channel_name", | |
* type="string", | |
* description="Name of the payment channel", | |
* example="Bank Transfer" | |
* ), | |
* @OA\Property( | |
* property="is_active", | |
* type="boolean", | |
* description="Status of the payment channel (active/inactive)", | |
* example=true | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message", | |
* example="Internal Server Error" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getPaymentChannel', function( $request, $response ) { | |
$res = $this->customerModel->getPaymentChannel($payload); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'successfully Fetched All Payment Channels', | |
'data' => $res | |
]); | |
}); | |
/** | |
* Get Ledger Types | |
* | |
* @OA\Get( | |
* path="/api/customer/getLedgerType", | |
* tags={"Customer"}, | |
* summary="Get Ledger Types", | |
* operationId="getLedgerType", | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message", | |
* example="Successfully fetched all ledger types" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="array", | |
* @OA\Items( | |
* type="object", | |
* @OA\Property( | |
* property="ledger_id", | |
* type="integer", | |
* description="ID of the ledger type", | |
* example=1 | |
* ), | |
* @OA\Property( | |
* property="ledger_name", | |
* type="string", | |
* description="Name of the ledger type", | |
* example="NGN" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message", | |
* example="Internal Server Error" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getLedgerType', function( $request, $response ) { | |
$res = $this->customerModel->getLedgerType($payload); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'successfully Fetched All Ledger Types', | |
'data' => $res | |
]); | |
}); | |
/** | |
* Get Client Active CAM Ledgers | |
* | |
* @OA\Get( | |
* path="/api/customer/getClientActiveCAMLedger", | |
* tags={"Customer"}, | |
* summary="Get Client Active CAM Ledgers", | |
* operationId="getClientActiveCAMLedger", | |
* @OA\Parameter( | |
* name="CustID", | |
* in="query", | |
* required=true, | |
* @OA\Schema( | |
* type="integer", | |
* example=12345 | |
* ), | |
* description="Customer ID" | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message", | |
* example="Successfully fetched client active CAM ledgers" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="array", | |
* @OA\Items( | |
* type="object", | |
* @OA\Property( | |
* property="ledger_id", | |
* type="integer", | |
* description="ID of the CAM ledger", | |
* example=1 | |
* ), | |
* @OA\Property( | |
* property="ledger_name", | |
* type="string", | |
* description="Name of the CAM ledger", | |
* example="NGN" | |
* ), | |
* @OA\Property( | |
* property="balance", | |
* type="number", | |
* description="Current balance of the CAM ledger", | |
* example=150000.50 | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Unauthorized Access message", | |
* example="Unauthorized Access" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message", | |
* example="Internal Server Error" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getClientActiveCAMLedger', function( $request, $response ) { | |
validate($request, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
]); | |
$payload = $request->getQueryParams(); | |
if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$payload["CAMID"] = $request->getAttribute('CAMID'); | |
$res = $this->customerModel->getClientActiveCAMLedger($payload); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'successfully Fetched Client Active CAM Ledgers', | |
'data' => $res | |
]); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* Get Client Active SMA Ledgers | |
* | |
* @OA\Get( | |
* path="/api/customer/getClientActiveSMALedger", | |
* tags={"Customer"}, | |
* summary="Get Client Active SMA Ledgers", | |
* operationId="getClientActiveSMALedger", | |
* @OA\Parameter( | |
* name="CustID", | |
* in="query", | |
* required=true, | |
* @OA\Schema( | |
* type="integer", | |
* example=12345 | |
* ), | |
* description="Customer ID" | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message", | |
* example="Successfully fetched client active SMA ledgers" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="array", | |
* @OA\Items( | |
* type="object", | |
* @OA\Property( | |
* property="ledger_id", | |
* type="integer", | |
* description="ID of the SMA ledger", | |
* example=1 | |
* ), | |
* @OA\Property( | |
* property="ledger_name", | |
* type="string", | |
* description="Name of the SMA ledger", | |
* example="NGN" | |
* ), | |
* @OA\Property( | |
* property="balance", | |
* type="number", | |
* description="Current balance of the SMA ledger", | |
* example=150000.50 | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Unauthorized Access message", | |
* example="Unauthorized Access" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message", | |
* example="Internal Server Error" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getClientActiveSMALedger', function( $request, $response ) { | |
validate($request, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
]); | |
$payload = $request->getQueryParams(); | |
if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$payload["CAMID"] = $request->getAttribute('CAMID'); | |
$res = $this->customerModel->getClientActiveSMALedger($payload); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'successfully Fetched Client Active CAM Ledgers', | |
'data' => $res | |
]); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* Get Client Active CSS Ledgers | |
* | |
* @OA\Get( | |
* path="/api/customer/getClientActiveCSSLedger", | |
* tags={"Customer"}, | |
* summary="Get Client Active CSS Ledgers", | |
* operationId="getClientActiveCSSLedger", | |
* @OA\Parameter( | |
* name="CustID", | |
* in="query", | |
* required=true, | |
* @OA\Schema( | |
* type="integer", | |
* example=12345 | |
* ), | |
* description="Customer ID" | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message", | |
* example="Successfully fetched client active CSS ledgers" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="array", | |
* @OA\Items( | |
* type="object", | |
* @OA\Property( | |
* property="ledger_id", | |
* type="integer", | |
* description="ID of the CSS ledger", | |
* example=1 | |
* ), | |
* @OA\Property( | |
* property="ledger_name", | |
* type="string", | |
* description="Name of the CSS ledger", | |
* example="NGN" | |
* ), | |
* @OA\Property( | |
* property="balance", | |
* type="number", | |
* description="Current balance of the CSS ledger", | |
* example=50000.75 | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Unauthorized Access message", | |
* example="Unauthorized Access" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message", | |
* example="Internal Server Error" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getClientActiveCSSLedger', function( $request, $response ) { | |
validate($request, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
]); | |
$payload = $request->getQueryParams(); | |
if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$payload["SECID"] = $request->getAttribute('SECID'); | |
$res = $this->customerModel->getClientActiveCSSLedger($payload); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'successfully Fetched Client Active CSS Ledgers', | |
'data' => $res | |
]); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* Get Client Active MF Ledgers | |
* | |
* @OA\Get( | |
* path="/api/customer/getClientActiveMFLedger", | |
* tags={"Customer"}, | |
* summary="Get Client Active MF Ledgers", | |
* operationId="getClientActiveMFLedger", | |
* @OA\Parameter( | |
* name="CustID", | |
* in="query", | |
* required=true, | |
* @OA\Schema( | |
* type="integer", | |
* example=12345 | |
* ), | |
* description="Customer ID" | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message", | |
* example="Successfully fetched client active MF ledgers" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="array", | |
* @OA\Items( | |
* type="object", | |
* @OA\Property( | |
* property="ledger_id", | |
* type="integer", | |
* description="ID of the MF ledger", | |
* example=1 | |
* ), | |
* @OA\Property( | |
* property="ledger_name", | |
* type="string", | |
* description="Name of the MF ledger", | |
* example="USD" | |
* ), | |
* @OA\Property( | |
* property="balance", | |
* type="number", | |
* description="Current balance of the MF ledger", | |
* example=5000.25 | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Unauthorized Access message", | |
* example="Unauthorized Access" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message", | |
* example="Internal Server Error" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getClientActiveMFLedger', function( $request, $response ) { | |
validate($request, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
]); | |
$payload = $request->getQueryParams(); | |
if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$payload["CAMID"] = $request->getAttribute('CAMID'); | |
$res = $this->customerModel->getClientActiveMFLedger($payload); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'successfully Fetched Client Active MF Ledgers', | |
'data' => $res | |
]); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* Get Outstanding Cash Balance | |
* | |
* @OA\Get( | |
* path="/api/customer/getOustandingCashBalance", | |
* tags={"Customer"}, | |
* summary="Get Outstanding Cash Balance", | |
* operationId="getOustandingCashBalance", | |
* @OA\Parameter( | |
* name="CustID", | |
* in="query", | |
* required=true, | |
* @OA\Schema( | |
* type="integer", | |
* example=12345 | |
* ), | |
* description="Customer ID" | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message", | |
* example="Outstanding Cash Balance Fetched" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="number", | |
* description="Outstanding cash balance", | |
* example=5000.25 | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Unauthorized Access message", | |
* example="Unauthorized Access" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message", | |
* example="Internal Server Error" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getOustandingCashBalance', function( $request, $response ) { | |
validate($request, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
]); | |
$payload = $request->getQueryParams(); | |
if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$cash = $this->customerModel->getOustandingBalance($payload); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'Oustanding Cash Balance Fetched', | |
'data' => $cash | |
]); | |
}); | |
// ->add(new Authorization()) | |
// ->add(new auth()); | |
/** | |
* Get Cash Balance by Ledger Type | |
* | |
* @OA\Get( | |
* path="/api/customer/getCashBalanceByLedgerType", | |
* tags={"Customer"}, | |
* summary="Get Cash Balance by Ledger Type", | |
* operationId="getCashBalanceByLedgerType", | |
* @OA\Parameter( | |
* name="CustID", | |
* in="query", | |
* required=true, | |
* @OA\Schema( | |
* type="integer", | |
* example=12345 | |
* ), | |
* description="Customer ID" | |
* ), | |
* @OA\Parameter( | |
* name="ledgerType", | |
* in="query", | |
* required=true, | |
* @OA\Schema( | |
* type="string", | |
* example="NGN" | |
* ), | |
* description="Ledger Type (NGN/USD/GBP)" | |
* ), | |
* @OA\Parameter( | |
* name="businessInvolvement", | |
* in="query", | |
* required=true, | |
* @OA\Schema( | |
* type="string", | |
* example="XYZ Company" | |
* ), | |
* description="Business Involvement" | |
* ), | |
* @OA\Parameter( | |
* name="involvementType", | |
* in="query", | |
* required=true, | |
* @OA\Schema( | |
* type="string", | |
* example="Owner" | |
* ), | |
* description="Involvement Type" | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message", | |
* example="Cash Balance Fetched" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="number", | |
* description="Cash balance for the given ledger type", | |
* example=5000.25 | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Unauthorized Access message", | |
* example="Unauthorized Access" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message", | |
* example="Internal Server Error" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getCashBalanceByLedgerType', function( $request, $response ) { | |
validate($request, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
'ledgerType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'ledgerType is required' | |
], | |
'businessInvolvement' => [ | |
'rules' => V::notBlank(), | |
'message' => 'businessInvolvement is required' | |
], | |
'involvementType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'involvementType is required' | |
], | |
]); | |
$payload = $request->getQueryParams(); | |
if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$cash = $this->customerModel->getCashBalanceByLedgerType($payload); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'Cash Balance Fetched', | |
'data' => $cash | |
]); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* Get Total Cash Balance by Ledger Type | |
* | |
* @OA\Get( | |
* path="/api/customer/getTotalCashBalanceByLedgerType", | |
* tags={"Customer"}, | |
* summary="Get Total Cash Balance by Ledger Type", | |
* operationId="getTotalCashBalanceByLedgerType", | |
* @OA\Parameter( | |
* name="CustID", | |
* in="query", | |
* required=true, | |
* @OA\Schema( | |
* type="integer", | |
* example=12345 | |
* ), | |
* description="Customer ID" | |
* ), | |
* @OA\Parameter( | |
* name="ledgerType", | |
* in="query", | |
* required=true, | |
* @OA\Schema( | |
* type="string", | |
* example="NGN" | |
* ), | |
* description="Ledger Type (NGN/USD/GBP)" | |
* ), | |
* @OA\Parameter( | |
* name="businessInvolvement", | |
* in="query", | |
* required=true, | |
* @OA\Schema( | |
* type="string", | |
* example="XYZ Company" | |
* ), | |
* description="Business Involvement" | |
* ), | |
* @OA\Parameter( | |
* name="involvementType", | |
* in="query", | |
* required=true, | |
* @OA\Schema( | |
* type="string", | |
* example="Owner" | |
* ), | |
* description="Involvement Type" | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message", | |
* example="Total Cash Balance Fetched" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="object", | |
* description="Cash balance information", | |
* @OA\Property( | |
* property="balance", | |
* type="number", | |
* description="Total cash balance", | |
* example=5000.25 | |
* ), | |
* @OA\Property( | |
* property="availableBalanceForTrade", | |
* type="number", | |
* description="Available balance for trade (STK involvement type only)", | |
* example=4500.50 | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Unauthorized Access message", | |
* example="Unauthorized Access" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message", | |
* example="Internal Server Error" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getTotalCashBalanceByLedgerType', function( $request, $response ) { | |
$payload = $request->getQueryParams(); | |
// $payload["CustID"] = $request->getAttribute('ID'); | |
validate($payload, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
'ledgerType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'ledgerType is required' | |
], | |
'businessInvolvement' => [ | |
'rules' => V::notBlank(), | |
'message' => 'businessInvolvement is required' | |
], | |
'involvementType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'involvementType is required' | |
], | |
/* 'instrumentType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'instrumentType is required' | |
], | |
'cashAccount' => [ | |
'rules' => V::notBlank(), | |
'message' => 'cashAccount is required' | |
], */ | |
]); | |
/* if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$payload["CAMID"] = $request->getAttribute('CAMID'); */ | |
$payload["SECID"] = $request->getAttribute('SECID'); | |
$cash = $this->customerModel->getTotalCashBalanceByLedgerType($payload); | |
if($payload['involvementType'] == 'STK'){ | |
$outstandingBalance = $this->customerModel->getOustandingBalance($payload); | |
$cash['availableBalanceForTrade'] = ($cash['balance'] - $outstandingBalance[0]['Amount']); | |
} | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'Total Cash Balance Fetched', | |
'data' => $cash | |
]); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* Get Investment Type | |
* | |
* @OA\Get( | |
* path="/api/customer/getInvestmentType", | |
* tags={"Customer"}, | |
* summary="Get Investment Type", | |
* operationId="getInvestmentType", | |
* @OA\Parameter( | |
* name="CustID", | |
* in="query", | |
* required=true, | |
* @OA\Schema( | |
* type="integer", | |
* example=12345 | |
* ), | |
* description="Customer ID" | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message", | |
* example="Successfully Fetched All Asset Management Investment Types" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="array", | |
* description="List of investment types", | |
* @OA\Items( | |
* type="string", | |
* example="Equity" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Unauthorized Access message", | |
* example="Unauthorized Access" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message", | |
* example="Internal Server Error" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getInvestmentType', function( $request, $response ) { | |
$res = $this->customerModel->getInvestmentType($payload); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'successfully Fetched All Asset Managment Investment Types', | |
'data' => $res | |
]); | |
}); | |
$app->get('/api/getCreateInvestmentType', function( $request, $response ) { | |
$res = $this->customerModel->getCreateInvestmentType($payload); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'successfully Fetched All Asset Managment Investment Types', | |
'data' => $res | |
]); | |
}); | |
/** | |
* Get Create Investment Type | |
* | |
* @OA\Get( | |
* path="/api/getCreateInvestmentType", | |
* tags={"Customer"}, | |
* summary="Get Create Investment Type", | |
* operationId="getCreateInvestmentType", | |
* @OA\Parameter( | |
* name="CustID", | |
* in="query", | |
* required=true, | |
* @OA\Schema( | |
* type="integer", | |
* example=12345 | |
* ), | |
* description="Customer ID" | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message", | |
* example="Successfully Fetched All Asset Management Investment Types" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="array", | |
* description="List of investment types", | |
* @OA\Items( | |
* type="string", | |
* example="Equity" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Unauthorized Access message", | |
* example="Unauthorized Access" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message", | |
* example="Internal Server Error" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getClientInvestmentType', function( $request, $response ) { | |
validate($request, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
'ledgerType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'ledgerType is required' | |
], | |
'date' => [ | |
'rules' => V::notBlank(), | |
'message' => 'date is required' | |
], | |
]); | |
$payload = $request->getQueryParams(); | |
if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$res = $this->customerModel->getClientInvestmentType($payload); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => "successfully Fetched Client's Active Investment Types", | |
'data' => $res | |
]); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* Get Client Investment Type | |
* | |
* @OA\Get( | |
* path="/api/customer/getClientInvestmentType", | |
* tags={"Customer"}, | |
* summary="Get Client Investment Type", | |
* operationId="getClientInvestmentType", | |
* @OA\Parameter( | |
* name="CustID", | |
* in="query", | |
* required=true, | |
* @OA\Schema( | |
* type="integer", | |
* example=12345 | |
* ), | |
* description="Customer ID" | |
* ), | |
* @OA\Parameter( | |
* name="ledgerType", | |
* in="query", | |
* required=true, | |
* @OA\Schema( | |
* type="string", | |
* example="NGN" | |
* ), | |
* description="Ledger Type (NGN/USD/GBP)" | |
* ), | |
* @OA\Parameter( | |
* name="date", | |
* in="query", | |
* required=true, | |
* @OA\Schema( | |
* type="string", | |
* example="2023-07-31" | |
* ), | |
* description="Date (YYYY-MM-DD)" | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message", | |
* example="Successfully Fetched Client's Active Investment Types" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="array", | |
* description="List of active investment types", | |
* @OA\Items( | |
* type="string", | |
* example="Equity" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Unauthorized Access message", | |
* example="Unauthorized Access" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message", | |
* example="Internal Server Error" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getHoldingByInvestmentType', function( $request, $response ) { | |
validate($request, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
'ledgerType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'ledgerType is required' | |
], | |
'date' => [ | |
'rules' => V::notBlank(), | |
'message' => 'date is required' | |
], | |
'investmentType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'investmentType is required' | |
], | |
]); | |
$payload = $request->getQueryParams(); | |
/* if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} */ | |
$porfolio = $this->customerModel->getHoldingByInvestmentType($payload); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'Holding by Investment Type Fetched', | |
'data' => $porfolio | |
]); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* Get Total Holding by Investment Type | |
* | |
* @OA\Get( | |
* path="/api/customer/getTotalHoldingByInvestmentType", | |
* tags={"Customer"}, | |
* summary="Get Total Holding by Investment Type", | |
* operationId="getTotalHoldingByInvestmentType", | |
* @OA\Parameter( | |
* name="CustID", | |
* in="query", | |
* required=true, | |
* @OA\Schema( | |
* type="integer", | |
* example=12345 | |
* ), | |
* description="Customer ID" | |
* ), | |
* @OA\Parameter( | |
* name="ledgerType", | |
* in="query", | |
* required=true, | |
* @OA\Schema( | |
* type="string", | |
* example="NGN" | |
* ), | |
* description="Ledger Type (NGN/USD/GBP)" | |
* ), | |
* @OA\Parameter( | |
* name="date", | |
* in="query", | |
* required=true, | |
* @OA\Schema( | |
* type="string", | |
* example="2023-07-31" | |
* ), | |
* description="Date (YYYY-MM-DD)" | |
* ), | |
* @OA\Parameter( | |
* name="investmentType", | |
* in="query", | |
* required=true, | |
* @OA\Schema( | |
* type="string", | |
* example="Equity" | |
* ), | |
* description="Investment Type" | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message", | |
* example="Total Holding by Investment Type Fetched" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="object", | |
* description="Total holding by investment type", | |
* @OA\Property( | |
* property="investmentType", | |
* type="string", | |
* example="Equity" | |
* ), | |
* @OA\Property( | |
* property="totalHolding", | |
* type="number", | |
* format="double", | |
* example=1500.50 | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Unauthorized Access message", | |
* example="Unauthorized Access" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message", | |
* example="Internal Server Error" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getTotalHoldingByInvestmentType', function( $request, $response ) { | |
validate($request, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
'ledgerType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'ledgerType is required' | |
], | |
'date' => [ | |
'rules' => V::notBlank(), | |
'message' => 'date is required' | |
], | |
'investmentType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'investmentType is required' | |
], | |
]); | |
$payload = $request->getQueryParams(); | |
if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$porfolio = $this->customerModel->getTotalHoldingByInvestmentType($payload); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'Total Holding by Investment Type Fetched', | |
'data' => $porfolio | |
]); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* Get All Holdings by Ledger Type | |
* | |
* @OA\Get( | |
* path="/api/customer/getAllHoldingByLedgerType", | |
* tags={"Customer"}, | |
* summary="Get All Holdings by Ledger Type", | |
* operationId="getAllHoldingByLedgerType", | |
* @OA\Parameter( | |
* name="CustID", | |
* in="query", | |
* required=true, | |
* @OA\Schema( | |
* type="integer", | |
* example=12345 | |
* ), | |
* description="Customer ID" | |
* ), | |
* @OA\Parameter( | |
* name="ledgerType", | |
* in="query", | |
* required=true, | |
* @OA\Schema( | |
* type="string", | |
* example="NGN" | |
* ), | |
* description="Ledger Type (NGN/USD/GBP)" | |
* ), | |
* @OA\Parameter( | |
* name="date", | |
* in="query", | |
* required=true, | |
* @OA\Schema( | |
* type="string", | |
* example="2023-07-31" | |
* ), | |
* description="Date (YYYY-MM-DD)" | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message", | |
* example="All Holdings by Ledger Type Fetched" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="array", | |
* description="Array of holdings by ledger type", | |
* @OA\Items( | |
* type="object", | |
* @OA\Property( | |
* property="investmentType", | |
* type="string", | |
* example="Equity" | |
* ), | |
* @OA\Property( | |
* property="holding", | |
* type="number", | |
* format="double", | |
* example=1500.50 | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Unauthorized Access message", | |
* example="Unauthorized Access" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message", | |
* example="Internal Server Error" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getAllHoldingByLedgerType', function( $request, $response ) { | |
validate($request, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
'ledgerType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'ledgerType is required' | |
], | |
'date' => [ | |
'rules' => V::notBlank(), | |
'message' => 'date is required' | |
], | |
]); | |
$payload = $request->getQueryParams(); | |
if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$porfolio = $this->customerModel->getAllHoldingByLedgerType($payload); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'All Holdings by Ledger Type Fetched', | |
'data' => $porfolio | |
]); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
// edit by Kolade Apri 7,2023 | |
/** | |
* Get All CAM Holdings by Ledger Type | |
* | |
* @OA\Get( | |
* path="/api/customer/getAllCAMHoldingByLedgerType", | |
* tags={"Customer"}, | |
* summary="Get All CAM Holdings by Ledger Type", | |
* operationId="getAllCAMHoldingByLedgerType", | |
* @OA\Parameter( | |
* name="CustID", | |
* in="query", | |
* required=true, | |
* @OA\Schema( | |
* type="integer", | |
* example=12345 | |
* ), | |
* description="Customer ID" | |
* ), | |
* @OA\Parameter( | |
* name="ledgerType", | |
* in="query", | |
* required=true, | |
* @OA\Schema( | |
* type="string", | |
* example="NGN" | |
* ), | |
* description="Ledger Type (NGN/USD/GBP)" | |
* ), | |
* @OA\Parameter( | |
* name="date", | |
* in="query", | |
* required=true, | |
* @OA\Schema( | |
* type="string", | |
* example="2023-07-31" | |
* ), | |
* description="Date (YYYY-MM-DD)" | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message", | |
* example="All CAM Holdings by Ledger Type Fetched" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="array", | |
* description="Array of CAM holdings by ledger type", | |
* @OA\Items( | |
* type="object", | |
* @OA\Property( | |
* property="investmentType", | |
* type="string", | |
* example="Equity Fund" | |
* ), | |
* @OA\Property( | |
* property="holding", | |
* type="number", | |
* format="double", | |
* example=2500.75 | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Unauthorized Access message", | |
* example="Unauthorized Access" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message", | |
* example="Internal Server Error" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getAllCAMHoldingByLedgerType', function( $request, $response ) { | |
validate($request, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
'ledgerType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'ledgerType is required' | |
], | |
'date' => [ | |
'rules' => V::notBlank(), | |
'message' => 'date is required' | |
], | |
]); | |
$payload = $request->getQueryParams(); | |
if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$porfolio = $this->customerModel->getAllCAMHoldingByLedgerType($payload); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'All CAM Holdings by Ledger Type Fetched', | |
'data' => $porfolio | |
]); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
$app->get('/api/admin/getAllCAMHoldingByLedgerType', function( $request, $response ) { | |
validate($request, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
'ledgerType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'ledgerType is required' | |
], | |
'date' => [ | |
'rules' => V::notBlank(), | |
'message' => 'date is required' | |
], | |
]); | |
$payload = $request->getQueryParams(); | |
$porfolio = $this->customerModel->getAllCAMHoldingByLedgerType($payload); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'All CAM Holdings by Ledger Type Fetched', | |
'data' => $porfolio | |
]); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
// end of edit | |
/** | |
* Get All Total Holding by Investment Type | |
* | |
* @OA\Get( | |
* path="/api/customer/getAllTotalHoldingByInvestmentType", | |
* tags={"Customer"}, | |
* summary="Get All Total Holding by Investment Type", | |
* operationId="getAllTotalHoldingByInvestmentType", | |
* @OA\Parameter( | |
* name="CustID", | |
* in="query", | |
* required=true, | |
* @OA\Schema( | |
* type="integer", | |
* example=12345 | |
* ), | |
* description="Customer ID" | |
* ), | |
* @OA\Parameter( | |
* name="ledgerType", | |
* in="query", | |
* required=true, | |
* @OA\Schema( | |
* type="string", | |
* example="NGN" | |
* ), | |
* description="Ledger Type (NGN/USD/GBP)" | |
* ), | |
* @OA\Parameter( | |
* name="date", | |
* in="query", | |
* required=true, | |
* @OA\Schema( | |
* type="string", | |
* example="2023-07-31" | |
* ), | |
* description="Date (YYYY-MM-DD)" | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message", | |
* example="All Total Holding by Investment Type Fetched" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="array", | |
* description="Array of total holdings by investment type", | |
* @OA\Items( | |
* type="object", | |
* @OA\Property( | |
* property="investmentType", | |
* type="string", | |
* example="Equity Fund" | |
* ), | |
* @OA\Property( | |
* property="totalHolding", | |
* type="number", | |
* format="double", | |
* example=80000.25 | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Unauthorized Access message", | |
* example="Unauthorized Access" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message", | |
* example="Internal Server Error" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getAllTotalHoldingByInvestmentType', function( $request, $response ) { | |
validate($request, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
'ledgerType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'ledgerType is required' | |
], | |
'date' => [ | |
'rules' => V::notBlank(), | |
'message' => 'date is required' | |
], | |
]); | |
$payload = $request->getQueryParams(); | |
if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$payload["CAMID"] = $request->getAttribute('CAMID'); | |
$porfolio = $this->customerModel->getAllTotalHoldingByInvestmentType($payload); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'All Total Holding by Investment Type Fetched', | |
'data' => $porfolio | |
]); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* Get CAM Portfolio Value | |
* | |
* @OA\Get( | |
* path="/api/customer/getCAMPortfolioValue", | |
* tags={"Customer"}, | |
* summary="Get CAM Portfolio Value", | |
* operationId="getCAMPortfolioValue", | |
* @OA\Parameter( | |
* name="CustID", | |
* in="query", | |
* required=true, | |
* @OA\Schema( | |
* type="integer", | |
* example=12345 | |
* ), | |
* description="Customer ID" | |
* ), | |
* @OA\Parameter( | |
* name="ledgerType", | |
* in="query", | |
* required=true, | |
* @OA\Schema( | |
* type="string", | |
* example="NGN" | |
* ), | |
* description="Ledger Type (NGN/USD/GBP)" | |
* ), | |
* @OA\Parameter( | |
* name="date", | |
* in="query", | |
* required=true, | |
* @OA\Schema( | |
* type="string", | |
* example="2023-07-31" | |
* ), | |
* description="Date (YYYY-MM-DD)" | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message", | |
* example="Portfolio Value Fetched" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="number", | |
* format="double", | |
* example=125000.75, | |
* description="Total portfolio value" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Unauthorized Access message", | |
* example="Unauthorized Access" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message", | |
* example="Internal Server Error" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getCAMPortfolioValue', function( $request, $response ) { | |
validate($request, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
'ledgerType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'ledgerType is required' | |
], | |
'date' => [ | |
'rules' => V::notBlank(), | |
'message' => 'date is required' | |
], | |
]); | |
$payload = $request->getQueryParams(); | |
/* if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} */ | |
$porfolio = $this->customerModel->getCAMPortfolioValue($payload); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'Portfolio Value Fetched', | |
'data' => $porfolio | |
]); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* Get All CAM Total Holding by Investment Type | |
* | |
* @OA\Get( | |
* path="/api/customer/getAllCAMTotalHoldingByInvestmentType", | |
* tags={"Customer"}, | |
* summary="Get All CAM Total Holding by Investment Type", | |
* operationId="getAllCAMTotalHoldingByInvestmentType", | |
* @OA\Parameter( | |
* name="CustID", | |
* in="query", | |
* required=true, | |
* @OA\Schema( | |
* type="integer", | |
* example=12345 | |
* ), | |
* description="Customer ID" | |
* ), | |
* @OA\Parameter( | |
* name="ledgerType", | |
* in="query", | |
* required=true, | |
* @OA\Schema( | |
* type="string", | |
* example="NGN" | |
* ), | |
* description="Ledger Type (NGN/USD/GBP)" | |
* ), | |
* @OA\Parameter( | |
* name="date", | |
* in="query", | |
* required=true, | |
* @OA\Schema( | |
* type="string", | |
* example="2023-07-31" | |
* ), | |
* description="Date (YYYY-MM-DD)" | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message", | |
* example="All CAM Total Holding by Investment Type Fetched" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="array", | |
* @OA\Items( | |
* type="object", | |
* @OA\Property( | |
* property="InvestmentType", | |
* type="string", | |
* example="Equity", | |
* description="Investment Type" | |
* ), | |
* @OA\Property( | |
* property="TotalHolding", | |
* type="number", | |
* format="double", | |
* example=12500.45, | |
* description="Total holding value for the investment type" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Unauthorized Access message", | |
* example="Unauthorized Access" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message", | |
* example="Internal Server Error" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getAllCAMTotalHoldingByInvestmentType', function( $request, $response ) { | |
validate($request, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
'ledgerType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'ledgerType is required' | |
], | |
'date' => [ | |
'rules' => V::notBlank(), | |
'message' => 'date is required' | |
], | |
]); | |
$payload = $request->getQueryParams(); | |
/* if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} */ | |
$porfolio = $this->customerModel->getAllCAMTotalHoldingByInvestmentType($payload); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'All CAM Total Holding by Investment Type Fetched', | |
'data' => $porfolio | |
]); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* Fetch Bank Names | |
* | |
* @OA\Get( | |
* path="/api/fetchBankNames", | |
* tags={"API"}, | |
* summary="Fetch Bank Names", | |
* operationId="fetchBankNames", | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="bankNames", | |
* type="array", | |
* @OA\Items( | |
* type="string", | |
* example="Bank A" | |
* ), | |
* description="An array of bank names" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message", | |
* example="Internal Server Error" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/fetchBankNames', function ($request, $response) { | |
// http://svcs.infowarelimited.com/IWCardinalS/api/json/PGetData/d2ebdabd-ac91-499d-af47-49fdd4723764?FunctionID=P_00132 | |
$bankNames = formatIWRes( | |
container('IWSRequest')->PGetData('P_00132', STOCKBROKING_DB_NAME) | |
)['data'] ?? []; | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'bankNames' => array_values($bankNames) | |
]); | |
}); | |
/** | |
* Get Customer Bank Details | |
* | |
* @OA\Get( | |
* path="/api/customer/getBankDetails", | |
* tags={"Customer"}, | |
* summary="Get Customer Bank Details", | |
* operationId="getBankDetails", | |
* @OA\Parameter( | |
* name="CustID", | |
* in="query", | |
* required=true, | |
* @OA\Schema( | |
* type="string", | |
* format="uuid", | |
* description="Customer ID" | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message", | |
* example="successfully Fetched Banking Details" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="object", | |
* @OA\Property( | |
* property="bankName", | |
* type="string", | |
* example="Bank A", | |
* description="Name of the bank" | |
* ), | |
* @OA\Property( | |
* property="accountNumber", | |
* type="string", | |
* example="1234567890", | |
* description="Customer's bank account number" | |
* ), | |
* @OA\Property( | |
* property="accountType", | |
* type="string", | |
* example="Savings", | |
* description="Type of the bank account (e.g., Savings, Current)" | |
* ), | |
* @OA\Property( | |
* property="branch", | |
* type="string", | |
* example="Main Branch", | |
* description="Name of the bank branch" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized Access", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message", | |
* example="Unauthorized Access" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getBankDetails', function( $request, $response ) { | |
validate($request, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
]); | |
$payload = $request->getQueryParams(); | |
if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$bank = $this->customerModel->getCustomerBankDetails($payload["CustID"]); | |
return $response | |
->withStatus(200) | |
->withJson([ | |
'message' => 'successfully Fetched Banking Details', | |
'data' => $bank | |
]); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* Resolve Bank Account | |
* | |
* @OA\Get( | |
* path="/api/customer/resolveBankAccount", | |
* tags={"Customer"}, | |
* summary="Resolve Bank Account", | |
* operationId="resolveBankAccount", | |
* @OA\Parameter( | |
* name="accountNumber", | |
* in="query", | |
* required=true, | |
* @OA\Schema( | |
* type="string", | |
* description="Bank account number" | |
* ) | |
* ), | |
* @OA\Parameter( | |
* name="bankCode", | |
* in="query", | |
* required=true, | |
* @OA\Schema( | |
* type="string", | |
* description="Bank code" | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="object", | |
* @OA\Property( | |
* property="bankName", | |
* type="string", | |
* example="Bank A", | |
* description="Name of the bank associated with the account" | |
* ), | |
* @OA\Property( | |
* property="accountNumber", | |
* type="string", | |
* example="1234567890", | |
* description="Bank account number" | |
* ), | |
* @OA\Property( | |
* property="accountName", | |
* type="string", | |
* example="John Doe", | |
* description="Name of the account holder" | |
* ), | |
* @OA\Property( | |
* property="bankCode", | |
* type="string", | |
* example="ABC123", | |
* description="Code of the bank" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/resolveBankAccount', function( $request, $response ) { | |
validate($request, [ | |
'accountNumber' => [ | |
'rules' => V::notBlank(), | |
'message' => 'accountNumber is required' | |
], | |
'bankCode' => [ | |
'rules' => V::notBlank(), | |
'message' => 'bankCode is required' | |
], | |
]); | |
$payload = $request->getQueryParams(); | |
$bank = $this->customerModel->resolveBankAccount($payload); | |
return $response | |
->withStatus($bank["code"] ?? 200) | |
->withJson([ | |
'message' => $bank["message"], | |
'data' => $bank["data"] | |
]); | |
}); | |
// ->add(new AdminAuthorization()) | |
// ->add(new auth()); | |
/** | |
* Create Transfer Recipient | |
* | |
* @OA\Post( | |
* path="/api/customer/createTransferRecipient", | |
* tags={"Customer"}, | |
* summary="Create Transfer Recipient", | |
* operationId="createTransferRecipient", | |
* @OA\RequestBody( | |
* required=true, | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* required={"accountNumber", "bankCode", "fullName"}, | |
* @OA\Property( | |
* property="accountNumber", | |
* type="string", | |
* description="Bank account number", | |
* example="1234567890" | |
* ), | |
* @OA\Property( | |
* property="bankCode", | |
* type="string", | |
* description="Bank code", | |
* example="ABC123" | |
* ), | |
* @OA\Property( | |
* property="fullName", | |
* type="string", | |
* description="Full name of the account holder", | |
* example="John Doe" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="object", | |
* @OA\Property( | |
* property="recipientID", | |
* type="integer", | |
* example="123", | |
* description="Unique identifier for the created transfer recipient" | |
* ), | |
* @OA\Property( | |
* property="accountNumber", | |
* type="string", | |
* example="1234567890", | |
* description="Bank account number" | |
* ), | |
* @OA\Property( | |
* property="bankCode", | |
* type="string", | |
* example="ABC123", | |
* description="Code of the bank" | |
* ), | |
* @OA\Property( | |
* property="fullName", | |
* type="string", | |
* example="John Doe", | |
* description="Full name of the account holder" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->post('/api/customer/createTransferRecipient', function( $request, $response ) { | |
validate($request, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
'accountName' => [ | |
'rules' => V::notBlank(), | |
'message' => 'Account name is required' | |
], | |
'accountNumber' => [ | |
'rules' => V::notBlank(), | |
'message' => 'Account number is required' | |
], | |
'bankName' => [ | |
'rules' => V::notBlank(), | |
'message' => 'Bank name is required' | |
], | |
'bankCode' => [ | |
'rules' => V::notBlank(), | |
'message' => 'Bank code is required' | |
], | |
]); | |
$payload = $request->getParsedBody(); | |
if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$transferRecipients = container('customerModel')->checkDuplicates($payload); | |
if(count($transferRecipients) > 0){ | |
return $response | |
->withStatus(400) | |
->withJson(["message" => "Transfer recipient for this account exists already"]); | |
} | |
$payload["CAMID"] = $request->getAttribute('CAMID'); | |
$payload["SECID"] = $request->getAttribute('SECID'); | |
$payload["ASSETID"] = $request->getAttribute('ASSETID'); | |
$payload['fullName'] = $request->getAttribute('fullName'); | |
$payload['emailAddress'] = $request->getAttribute('emailAddress'); | |
$payload['phoneNumber'] = $request->getAttribute('phoneNumber'); | |
$transferRecipient = $this->customerModel->createTransferRecipient($payload); | |
return $response | |
->withStatus($transferRecipient["code"] ?? 200) | |
->withJson([ | |
'message' => $transferRecipient["message"], | |
'data' => $transferRecipient["data"] | |
]); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* Withdraw From Wallet | |
* | |
* @OA\Post( | |
* path="/api/customer/withdrawFromWallet", | |
* tags={"Customer"}, | |
* summary="Withdraw funds from wallet", | |
* operationId="withdrawFromWallet", | |
* @OA\RequestBody( | |
* required=true, | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* required={"amount", "CustID", "accountOfficerEmail", "company", "bankName", "bankAcctNumber"}, | |
* @OA\Property( | |
* property="amount", | |
* type="number", | |
* format="float", | |
* minimum=0, | |
* description="Amount to be withdrawn from the wallet" | |
* ), | |
* @OA\Property( | |
* property="CustID", | |
* type="integer", | |
* description="Customer ID (CustID)" | |
* ), | |
* @OA\Property( | |
* property="accountOfficerEmail", | |
* type="string", | |
* description="Email address of the account officer" | |
* ), | |
* @OA\Property( | |
* property="company", | |
* type="string", | |
* description="Name of the company" | |
* ), | |
* @OA\Property( | |
* property="bankName", | |
* type="string", | |
* description="Name of the bank" | |
* ), | |
* @OA\Property( | |
* property="bankAcctNumber", | |
* type="string", | |
* description="Bank account number" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="object", | |
* @OA\Property( | |
* property="transactionID", | |
* type="integer", | |
* example="12345", | |
* description="Unique identifier for the transaction" | |
* ), | |
* @OA\Property( | |
* property="amount", | |
* type="number", | |
* format="float", | |
* example="1000.00", | |
* description="Amount withdrawn from the wallet" | |
* ), | |
* @OA\Property( | |
* property="bankName", | |
* type="string", | |
* example="Bank of XYZ", | |
* description="Name of the bank" | |
* ), | |
* @OA\Property( | |
* property="bankAcctNumber", | |
* type="string", | |
* example="1234567890", | |
* description="Bank account number" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->post('/api/customer/withdrawFromWallet', function( $request, $response ) { | |
// Usage of the function | |
if (!isAllowedTime()) | |
{ | |
return $response | |
->withStatus(400) | |
->withJson( ['message' => "Withdrawals are not allowed at this time.Withdrawals are only allowed from Monday to Friday and from 8 am to 5 pm.", | |
'data' => null ]); | |
} | |
$payload = $request->getParsedBody(); | |
$validator = container('validator')->validate($payload, [ | |
'base64EncryptedMessage' => V::notBlank(), | |
]); | |
if (!$validator->isValid()) { | |
return $response | |
->withStatus(400) | |
->withJson($validator->getErrors()); | |
} | |
$decryptedContent = MobileEncryption::decrypt( | |
$payload['base64EncryptedMessage'], 'core' | |
); | |
$payload = $decryptedContent; | |
validate($payload, [ | |
'amount' => [ | |
'rules' => V::callback(function ($amount) { | |
return $amount !== '' && $amount >= 1000; | |
}), | |
'message' => 'Minimum withdrawal amount is 1000' | |
], | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
'otp' => [ | |
'rules' => V::notBlank(), | |
'message' => 'OTP is required' | |
], | |
'accountOfficerEmail' => [ | |
'rules' => V::notBlank(), | |
'message' => 'accountOfficerEmail is required' | |
], | |
'emailAddress' => [ | |
'rules' => V::notBlank(), | |
'message' => 'Email address is required' | |
], | |
'company' => [ | |
'rules' => V::notBlank(), | |
'message' => 'company is required' | |
], | |
'recipientCode' => [ | |
'rules' => V::notBlank(), | |
'message' => 'recipientCode is required' | |
] | |
]); | |
// $payload = $request->getParsedBody(); | |
if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$verifyOTP = $this->customerModel->verifyOTPRequest($payload['CustID'],$payload['emailAddress'],$payload['otp']); | |
if($verifyOTP['code'] != 200) | |
{ | |
return $response | |
->withStatus($verifyOTP['code']) | |
->withJson( ['message' => $verifyOTP['message'], | |
'data' => null | |
]); | |
} | |
$walletLimit = $this->customerModel->dailyWalletSpent($payload)['dailyLimit']; | |
$totalAmountWithdrawn = $this->customerModel->getTotalAmountWithdrawnToday($payload['CustID']); | |
if(($totalAmountWithdrawn + $payload['amount']) > $walletLimit){ | |
return $response | |
->withStatus(400) | |
->withJson( ['message' => "You have exceeded your daily limit", | |
'data' => null | |
]); | |
} | |
$payload["CAMID"] = $request->getAttribute('CAMID'); | |
$payload["SECID"] = $request->getAttribute('SECID'); | |
if($payload["amount"] <= SELF_APPROVE) | |
{ | |
$bank = $this->customerModel->withdrawFromWallet($payload); | |
return $response | |
->withStatus($bank["code"] ?? 200) | |
->withJson([ | |
'message' => $bank["message"], | |
'data' => $bank["data"] | |
]); | |
// }elseif($payload["amount"] > 50000 && $payload["amount"] <= 1000000) | |
}elseif($payload["amount"] > SELF_APPROVE) | |
{ | |
$bank = $this->customerModel->withdrawFromWalletIAPM($payload); | |
return $response | |
->withStatus($bank["code"] ?? 200) | |
->withJson([ | |
'message' => $bank["message"], | |
'data' => $bank["data"] | |
]); | |
}else{ | |
return $response | |
->withStatus(400) | |
->withJson("Invalid Withdrawal Amount"); | |
} | |
}) | |
->add(new RateLimitMiddleware()) | |
->add(new Authorization()) | |
->add(new auth()); | |
$app->post('/api/customer/withdrawFromWalletNew', function( $request, $response ) { | |
// Usage of the function | |
if (!isAllowedTime()) | |
{ | |
return $response | |
->withStatus(400) | |
->withJson( ['message' => "Withdrawals are not allowed at this time.Withdrawals are only allowed from Monday to Friday and from 8 am to 5 pm.", | |
'data' => null ]); | |
} | |
$payload = $request->getParsedBody(); | |
$validator = container('validator')->validate($payload, [ | |
'base64EncryptedMessage' => V::notBlank(), | |
]); | |
if (!$validator->isValid()) { | |
return $response | |
->withStatus(400) | |
->withJson($validator->getErrors()); | |
} | |
$decryptedContent = EncryptedDataRequest::decryptContent( | |
$payload['base64EncryptedMessage'] | |
); | |
$payload = $decryptedContent; | |
validate($payload, [ | |
'amount' => [ | |
'rules' => V::callback(function ($amount) { | |
return $amount !== '' && $amount >= 1000; | |
}), | |
'message' => 'Minimum withdrawal amount is 1000' | |
], | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
'accountOfficerEmail' => [ | |
'rules' => V::notBlank(), | |
'message' => 'accountOfficerEmail is required' | |
], | |
'company' => [ | |
'rules' => V::notBlank(), | |
'message' => 'company is required' | |
], | |
'otp' => [ | |
'rules' => V::notBlank(), | |
'message' => 'OTP is required' | |
], | |
'emailAddress' => [ | |
'rules' => V::notBlank(), | |
'message' => 'Email address is required' | |
], | |
'recipientCode' => [ | |
'rules' => V::notBlank(), | |
'message' => 'recipientCode is required' | |
] | |
]); | |
// $payload = $request->getParsedBody(); | |
if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$verifyOTP = $this->customerModel->verifyOTPRequest($payload['CustID'],$payload['emailAddress'],$payload['otp'] ); | |
if($verifyOTP['code'] != 200) | |
{ | |
return $response | |
->withStatus($verifyOTP['code']) | |
->withJson( ['message' => $verifyOTP['message'], | |
'data' => null | |
]); | |
} | |
$walletLimit = $this->customerModel->dailyWalletSpent($payload)['dailyLimit']; | |
$totalAmountWithdrawn = $this->customerModel->getTotalAmountWithdrawnToday($payload['CustID']); | |
if(($totalAmountWithdrawn + $payload['amount']) > $walletLimit){ | |
return $response | |
->withStatus(400) | |
->withJson( ['message' => "You have exceeded your daily limit", | |
'data' => null | |
]); | |
} | |
$payload["CAMID"] = $request->getAttribute('CAMID'); | |
$payload["SECID"] = $request->getAttribute('SECID'); | |
if($payload["amount"] <= SELF_APPROVE) | |
{ | |
$bank = $this->customerModel->withdrawFromWallet($payload); | |
return $response | |
->withStatus($bank["code"] ?? 200) | |
->withJson([ | |
'message' => $bank["message"], | |
'data' => $bank["data"] | |
]); | |
// }elseif($payload["amount"] > 50000 && $payload["amount"] <= 1000000) | |
}elseif($payload["amount"] > SELF_APPROVE) | |
{ | |
$bank = $this->customerModel->withdrawFromWalletIAPM($payload); | |
return $response | |
->withStatus($bank["code"] ?? 200) | |
->withJson([ | |
'message' => $bank["message"], | |
'data' => $bank["data"] | |
]); | |
}else{ | |
return $response | |
->withStatus(400) | |
->withJson("Invalid Withdrawal Amount"); | |
} | |
}) | |
->add(new RateLimitMiddleware()) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* Get Redemption Payout Summary | |
* | |
* @OA\Get( | |
* path="/api/customer/getRedemptionPayoutSummary", | |
* tags={"Customer"}, | |
* summary="Get the redemption payout summary", | |
* operationId="getRedemptionPayoutSummary", | |
* security={{"jwt":{}}}, | |
* @OA\Parameter( | |
* name="admin", | |
* in="query", | |
* required=true, | |
* description="Admin identifier (e.g., [email protected])", | |
* @OA\Schema( | |
* type="string" | |
* ) | |
* ), | |
* @OA\Parameter( | |
* name="role", | |
* in="query", | |
* required=true, | |
* description="Role identifier (e.g., PM/FINCON/VP/EXCO)", | |
* @OA\Schema( | |
* type="string" | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="object", | |
* @OA\Property( | |
* property="summary", | |
* type="array", | |
* @OA\Items( | |
* type="object", | |
* @OA\Property( | |
* property="investmentType", | |
* type="string", | |
* example="Stocks", | |
* description="Investment type" | |
* ), | |
* @OA\Property( | |
* property="totalRedemption", | |
* type="number", | |
* format="float", | |
* example="50000.00", | |
* description="Total redemption amount for the investment type" | |
* ) | |
* ), | |
* description="Array of redemption payout summary per investment type" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getRedemptionPayoutSummary', function( $request, $response ) { | |
validate($request, [ | |
'admin' => [ | |
'rules' => V::notBlank(), | |
'message' => 'admin is required' | |
], | |
'role' => [ | |
'rules' => V::notBlank(), | |
'message' => 'role (PM/FINCON/VP/EXCO)is required' | |
], | |
]); | |
$payload = $request->getQueryParams(); | |
// var_dump($payload); | |
$getRedemptionPayoutSummary = $this->customerModel->getRedemptionPayoutSummary($payload); | |
// var_dump($getRedemptionPayoutSummary); | |
return $response | |
->withStatus($getRedemptionPayoutSummary["code"]) | |
->withJson($getRedemptionPayoutSummary); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
/** | |
* Process Redemption Payout | |
* | |
* @OA\Post( | |
* path="/api/customer/processRedemptionPayout", | |
* tags={"Customer"}, | |
* summary="Process redemption payout", | |
* operationId="processRedemptionPayout", | |
* security={{"jwt":{}}}, | |
* @OA\RequestBody( | |
* required=true, | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="adminEmailAddress", | |
* type="string", | |
* description="Admin's email address (e.g., [email protected])" | |
* ), | |
* @OA\Property( | |
* property="admin", | |
* type="string", | |
* description="Admin identifier (e.g., [email protected])" | |
* ), | |
* @OA\Property( | |
* property="role", | |
* type="string", | |
* description="Role identifier (e.g., PM/FINCON/VP/EXCO)" | |
* ), | |
* @OA\Property( | |
* property="action", | |
* type="string", | |
* description="Action (approve/reject/pending)" | |
* ), | |
* @OA\Property( | |
* property="infowareRedemptionID", | |
* type="string", | |
* description="Infoware redemption ID (required when 'action' is 'approve' and 'role' is 'PM')" | |
* ), | |
* @OA\Property( | |
* property="batchID", | |
* type="string", | |
* description="Batch ID (required when 'action' is 'approve' and 'role' is 'FINCON' or 'EXCO' or 'VP')" | |
* ), | |
* @OA\Property( | |
* property="class", | |
* type="string", | |
* description="Class (A/B) (required when 'action' is 'approve' and 'role' is 'FINCON')" | |
* ), | |
* @OA\Property( | |
* property="authorizer_1", | |
* type="string", | |
* description="Email address of authorizer 1 (required when 'action' is 'approve' and 'role' is 'FINCON')" | |
* ), | |
* @OA\Property( | |
* property="authorizer_2", | |
* type="string", | |
* description="Email address of authorizer 2 (required when 'action' is 'approve' and 'role' is 'FINCON' and 'class' is 'A')" | |
* ), | |
* @OA\Property( | |
* property="totalAmount", | |
* type="number", | |
* format="float", | |
* description="Total amount (required when 'action' is 'approve' and 'role' is 'FINCON')" | |
* ), | |
* @OA\Property( | |
* property="otp", | |
* type="string", | |
* description="Verified OTP (required when 'action' is 'approve' or 'reject')" | |
* ), | |
* @OA\Property( | |
* property="comment", | |
* type="string", | |
* description="Comment (required when 'action' is 'approve' or 'reject')" | |
* ), | |
* @OA\Property( | |
* property="authorization_score", | |
* type="number", | |
* format="float", | |
* description="Authorization score (required when 'action' is 'approve' or 'reject')" | |
* ), | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="object", | |
* @OA\Property( | |
* property="result", | |
* type="string", | |
* description="Result of the process (e.g., 'success')" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->post('/api/customer/processRedemptionPayout', function( $request, $response ) { | |
$payload = $request->getParsedBody(); | |
validate($payload, [ | |
'adminEmailAddress' => [ | |
'rules' => V::notBlank(), | |
'message' => 'adminEmailAddress is required' | |
], | |
'admin' => [ | |
'rules' => V::notBlank(), | |
'message' => 'admin is required' | |
], | |
'role' => [ | |
'rules' => V::notBlank(), | |
'message' => 'role (PM/FINCON/VP/EXCO)is required' | |
], | |
'action' => [ | |
'rules' => V::notBlank(), | |
'message' => 'action (approve/reject/pending) is required' | |
], | |
]); | |
if(strtoupper($payload['action']) == "APPROVE" && strtoupper($payload['role']) == PM) | |
{ | |
validate($payload, [ | |
'infowareRedemptionID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'infowareRedemptionID is required' | |
], | |
]); | |
}elseif(strtoupper($payload['action']) == "APPROVE" && strtoupper($payload['role']) == FINCON) | |
{ | |
validate($payload, [ | |
'batchID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'batchID is required' | |
], | |
'class' => [ | |
'rules' => V::notBlank(), | |
'message' => 'class (A/B) is required' | |
], | |
'authorizer_1' => [ | |
'rules' => V::notBlank(), | |
'message' => 'authorizer_1 (email address of authorizer 1) is required' | |
], | |
'totalAmount' => [ | |
'rules' => V::notBlank(), | |
'message' => 'totalAmount is required' | |
], | |
]); | |
if(strtoupper($payload["class"]) == "A") | |
{ | |
validate($payload, [ | |
'authorizer_2' => [ | |
'rules' => V::notBlank(), | |
'message' => 'authorizer_2 (email address of authorizer 2) is required' | |
], | |
]); | |
} | |
}elseif(strtoupper($payload['action']) == "APPROVE" || strtoupper($payload['action']) == "REJECT") | |
{ | |
validate($payload, [ | |
'batchID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'batchID is required' | |
], | |
'otp' => [ | |
'rules' => V::notBlank(), | |
'message' => 'otp (verified otp) is required' | |
], | |
'comment' => [ | |
'rules' => V::notBlank(), | |
'message' => 'comment is required' | |
], | |
'authorization_score' => [ | |
'rules' => V::numeric(), | |
'message' => 'authorization_score is required' | |
], | |
]); | |
} | |
$processRedemptionPayout = $this->customerModel->processRedemptionPayout($payload); | |
return $response | |
->withStatus($processRedemptionPayout["code"] ?? 200) | |
->withJson($processRedemptionPayout); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
/** | |
* Fetch Payout Authorizer | |
* | |
* @OA\Post( | |
* path="/api/customer/fetchPayoutAuthorizer", | |
* tags={"Customer"}, | |
* summary="Fetch payout authorizer", | |
* operationId="fetchPayoutAuthorizer", | |
* security={{"jwt":{}}}, | |
* @OA\RequestBody( | |
* required=true, | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="class", | |
* type="string", | |
* description="Class (A/B) (required)" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="object", | |
* @OA\Property( | |
* property="authorizer_1", | |
* type="string", | |
* description="Email address of authorizer 1" | |
* ), | |
* @OA\Property( | |
* property="authorizer_2", | |
* type="string", | |
* description="Email address of authorizer 2 (only applicable when 'class' is 'A')" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->post('/api/customer/fetchPayoutAuthorizer', function( $request, $response ) { | |
$payload = $request->getParsedBody(); | |
validate($payload, [ | |
'class' => [ | |
'rules' => V::notBlank(), | |
'message' => 'class (A/B) is required' | |
], | |
]); | |
$fetchPayoutAuthorizer = $this->customerModel->fetchPayoutAuthorizer($payload); | |
return $response | |
->withStatus($fetchPayoutAuthorizer["code"] ?? 200) | |
->withJson($fetchPayoutAuthorizer); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
/** | |
* Fetch Payout by Batch ID | |
* | |
* @OA\Post( | |
* path="/api/customer/fetchPayoutByBatchID", | |
* tags={"Customer"}, | |
* summary="Fetch payout by batch ID", | |
* operationId="fetchPayoutByBatchID", | |
* security={{"jwt":{}}}, | |
* @OA\RequestBody( | |
* required=true, | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="batchID", | |
* type="string", | |
* description="Batch ID (required)" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="object", | |
* @OA\Property( | |
* property="payouts", | |
* type="array", | |
* @OA\Items(ref="#/components/schemas/Payout") | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->post('/api/customer/fetchPayoutByBatchID', function( $request, $response ) { | |
$payload = $request->getParsedBody(); | |
validate($payload, [ | |
'batchID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'batchID is required' | |
], | |
]); | |
$fetchPayoutByBatchID = $this->customerModel->fetchPayoutByBatchID($payload); | |
return $response | |
->withStatus($fetchPayoutByBatchID["code"] ?? 200) | |
->withJson($fetchPayoutByBatchID); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
$app->post('/api/customer/fetchPayoutByRedemptionID', function( $request, $response ) { | |
$payload = $request->getParsedBody(); | |
validate($payload, [ | |
'redemptionID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'redemptionID is required' | |
], | |
]); | |
$details = $this->customerModel->fetchPayoutByRedemptionID($payload); | |
return $response | |
->withStatus($details["code"] ?? 200) | |
->withJson($details); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
$app->post('/api/customer/updateRedemptionRecord', function( $request, $response ) { | |
$payload = $request->getParsedBody(); | |
validate($payload, [ | |
'redemptionID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'redemptionID is required' | |
], | |
'comment' => [ | |
'rules' => V::notBlank(), | |
'message' => 'comment is required' | |
], | |
]); | |
$details = $this->customerModel->updateRedemptionRecord($payload); | |
return $response | |
->withStatus(200) | |
->withJson($details); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
/** | |
* Process Withdraw Requests | |
* | |
* @OA\Post( | |
* path="/api/customer/processWithdrawRequests", | |
* tags={"Customer"}, | |
* summary="Process withdraw requests", | |
* operationId="processWithdrawRequests", | |
* security={{"jwt":{}}}, | |
* @OA\RequestBody( | |
* required=true, | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="accountOfficerEmail", | |
* type="string", | |
* description="Account Officer Email (required)" | |
* ), | |
* @OA\Property( | |
* property="admin", | |
* type="string", | |
* description="Admin (required)" | |
* ), | |
* @OA\Property( | |
* property="role", | |
* type="string", | |
* description="Role (IA/IALEAD/PM/FINCON/RICA/AUTOPAY) (required)" | |
* ), | |
* @OA\Property( | |
* property="action", | |
* type="string", | |
* description="Action (fetch/approve/reject/fetchall) (required)" | |
* ), | |
* @OA\Property( | |
* property="ID", | |
* type="integer", | |
* description="ID (required for approve/reject actions)" | |
* ), | |
* @OA\Property( | |
* property="CustID", | |
* type="integer", | |
* description="Customer ID (required for approve/reject actions)" | |
* ), | |
* @OA\Property( | |
* property="comment", | |
* type="string", | |
* description="Comment (required for approve/reject actions)" | |
* ), | |
* @OA\Property( | |
* property="CAMID", | |
* type="integer", | |
* description="CAM ID (required for approve/reject actions)" | |
* ), | |
* @OA\Property( | |
* property="amount", | |
* type="number", | |
* format="float", | |
* description="Amount (required for approve/reject actions)" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="object", | |
* @OA\Property( | |
* property="withdrawRequests", | |
* type="array", | |
* @OA\Items(ref="#/components/schemas/WithdrawRequest") | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->post('/api/customer/processWithdrawRequests', function( $request, $response ) { | |
validate($request, [ | |
'accountOfficerEmail' => [ | |
'rules' => V::notBlank(), | |
'message' => 'accountOfficerEmail is required' | |
], | |
'admin' => [ | |
'rules' => V::notBlank(), | |
'message' => 'admin is required' | |
], | |
'role' => [ | |
'rules' => V::notBlank(), | |
'message' => 'role (IA/IALEAD/PM/FINCON/RICA/AUTOPAY)is required' | |
], | |
'action' => [ | |
'rules' => V::notBlank(), | |
'message' => 'action (fetch/approve/reject/fetchall) is required' | |
], | |
]); | |
$payload = $request->getParsedBody(); | |
if(strtoupper($payload['action']) == "APPROVE" || strtoupper($payload['action']) == "REJECT") | |
{ | |
validate($request, [ | |
'ID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'ID is required' | |
], | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
'comment' => [ | |
'rules' => V::notBlank(), | |
'message' => 'comment is required' | |
], | |
/* 'SECID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'SECID is required' | |
], */ | |
'CAMID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CAMID is required' | |
], | |
'amount' => [ | |
'rules' => V::notBlank(), | |
'message' => 'amount is required' | |
], | |
]); | |
} | |
$withdrawRequest = $this->customerModel->processWithdrawRequests($payload); | |
return $response | |
->withStatus($withdrawRequest["code"] ?? 200) | |
->withJson($withdrawRequest); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
//to process liquidation of direct request type investments (buy and sell) | |
/** | |
* Process Investment Requests | |
* | |
* @OA\Post( | |
* path="/api/customer/processInvestmentRequests", | |
* tags={"Customer"}, | |
* summary="Process investment requests", | |
* operationId="processInvestmentRequests", | |
* security={{"jwt":{}}}, | |
* @OA\RequestBody( | |
* required=true, | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="admin", | |
* type="string", | |
* description="Admin (required)" | |
* ), | |
* @OA\Property( | |
* property="role", | |
* type="string", | |
* description="Role (PM/FINCON/RICA) (required)" | |
* ), | |
* @OA\Property( | |
* property="action", | |
* type="string", | |
* description="Action (fetch/approve/reject/pending/approved/rejected/fetchall) (required)" | |
* ), | |
* @OA\Property( | |
* property="ID", | |
* type="integer", | |
* description="ID (required for approve/reject/fetch actions)" | |
* ), | |
* @OA\Property( | |
* property="CustID", | |
* type="integer", | |
* description="Customer ID (required for approve/reject/fetch actions)" | |
* ), | |
* @OA\Property( | |
* property="comment", | |
* type="string", | |
* description="Comment (required for approve/reject actions)" | |
* ), | |
* @OA\Property( | |
* property="CAMID", | |
* type="integer", | |
* description="CAM ID (required for approve/reject actions)" | |
* ), | |
* @OA\Property( | |
* property="amount", | |
* type="number", | |
* format="float", | |
* description="Amount (required for approve/reject actions)" | |
* ), | |
* @OA\Property( | |
* property="productType", | |
* type="string", | |
* description="Product Type (BONDS, TBILLS, or CP) (required for approve/reject actions)" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="object", | |
* @OA\Property( | |
* property="investmentRequests", | |
* type="array", | |
* @OA\Items(ref="#/components/schemas/InvestmentRequest") | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->post('/api/customer/processInvestmentRequests', function( $request, $response ) { | |
validate($request, [ | |
'admin' => [ | |
'rules' => V::notBlank(), | |
'message' => 'admin is required' | |
], | |
'role' => [ | |
'rules' => V::notBlank(), | |
'message' => 'role (PM/FINCON/RICA)is required' | |
], | |
'action' => [ | |
'rules' => V::notBlank(), | |
'message' => 'action (fetch/approve/reject/pending/approved/rejected/fetchall) is required' | |
], | |
/* 'product' => [ | |
'rules' => V::notBlank(), | |
'message' => 'product is required' | |
], | |
'productType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'productType (BONDS, TBILLS, or CP) is required' | |
], */ | |
]); | |
$payload = $request->getParsedBody(); | |
if(strtoupper($payload['action']) == "APPROVE" || strtoupper($payload['action']) == "REJECT") | |
{ | |
validate($request, [ | |
'ID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'ID is required' | |
], | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
'comment' => [ | |
'rules' => V::notBlank(), | |
'message' => 'comment is required' | |
], | |
/* 'SECID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'SECID is required' | |
], */ | |
'CAMID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CAMID is required' | |
], | |
'amount' => [ | |
'rules' => V::notBlank(), | |
'message' => 'amount is required' | |
], | |
'productType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'productType (BONDS, TBILLS, or CP) is required' | |
], | |
]); | |
} | |
if(strtoupper($payload['action']) == "FETCH") | |
{ | |
validate($request, [ | |
'ID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'ID is required' | |
], | |
]); | |
} | |
$withdrawRequest = $this->customerModel->processInvestmentRequests($payload); | |
return $response | |
->withStatus($withdrawRequest["code"] ?? 200) | |
->withJson($withdrawRequest); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
/** | |
* Process Investment Liquidation | |
* | |
* @OA\Post( | |
* path="/api/customer/processInvestmentLiquidation", | |
* tags={"Customer"}, | |
* summary="Process investment liquidation", | |
* operationId="processInvestmentLiquidation", | |
* security={{"jwt":{}}}, | |
* @OA\RequestBody( | |
* required=true, | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="admin", | |
* type="string", | |
* description="Admin (required)" | |
* ), | |
* @OA\Property( | |
* property="role", | |
* type="string", | |
* description="Role (PM/FINCON/RICA) (required)" | |
* ), | |
* @OA\Property( | |
* property="action", | |
* type="string", | |
* description="Action (approve/reject/fetchall/pending/approved/rejected) (required)" | |
* ), | |
* @OA\Property( | |
* property="ID", | |
* type="integer", | |
* description="ID (required for approve/reject/fetch actions)" | |
* ), | |
* @OA\Property( | |
* property="CustID", | |
* type="integer", | |
* description="Customer ID (required for approve/reject/fetch actions)" | |
* ), | |
* @OA\Property( | |
* property="comment", | |
* type="string", | |
* description="Comment (required for approve/reject actions)" | |
* ), | |
* @OA\Property( | |
* property="CAMID", | |
* type="integer", | |
* description="CAM ID (required for approve/reject actions)" | |
* ), | |
* @OA\Property( | |
* property="chgAmount", | |
* type="number", | |
* format="float", | |
* description="Changed Amount (required for approve/reject actions)" | |
* ), | |
* @OA\Property( | |
* property="productType", | |
* type="string", | |
* description="Product Type (BONDS, TBILLS, or CP) (required for approve/reject actions)" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="object", | |
* @OA\Property( | |
* property="investmentLiquidation", | |
* type="array", | |
* @OA\Items(ref="#/components/schemas/InvestmentLiquidation") | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
//to process liquidation of direct booking type investments | |
$app->post('/api/customer/processInvestmentLiquidation', function( $request, $response ) { | |
validate($request, [ | |
'admin' => [ | |
'rules' => V::notBlank(), | |
'message' => 'admin is required' | |
], | |
'role' => [ | |
'rules' => V::notBlank(), | |
'message' => 'role (PM/FINCON/RICA)is required' | |
], | |
'action' => [ | |
'rules' => V::notBlank(), | |
'message' => 'action (approve/reject/fetchall/pending/approved/rejected) is required' | |
], | |
/* 'product' => [ | |
'rules' => V::notBlank(), | |
'message' => 'product is required' | |
], | |
'productType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'productType is required' | |
], */ | |
]); | |
$payload = $request->getParsedBody(); | |
if(strtoupper($payload['action']) == "APPROVE" || strtoupper($payload['action']) == "REJECT") | |
{ | |
validate($request, [ | |
'ID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'ID is required' | |
], | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
'comment' => [ | |
'rules' => V::notBlank(), | |
'message' => 'comment is required' | |
], | |
'CAMID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CAMID is required' | |
], | |
/* 'SECID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'SECID is required' | |
], */ | |
'chgAmount' => [ | |
'rules' => V::notBlank(), | |
'message' => 'chgAmount is required' | |
], | |
'productType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'productType (BONDS, TBILLS, or CP) is required' | |
], | |
]); | |
} | |
if(strtoupper($payload['action']) == "FETCH") | |
{ | |
validate($request, [ | |
'ID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'ID is required' | |
], | |
]); | |
} | |
$processInvestmentLiquidation = $this->customerModel->processInvestmentLiquidation($payload); | |
return $response | |
->withStatus($processInvestmentLiquidation["code"] ?? 200) | |
->withJson($processInvestmentLiquidation); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
/** | |
* Get Investment Request Summary | |
* | |
* @OA\Get( | |
* path="/api/customer/getInvestmentRequestSummary", | |
* tags={"Customer"}, | |
* summary="Get investment request summary", | |
* operationId="getInvestmentRequestSummary", | |
* security={{"jwt":{}}}, | |
* @OA\Parameter( | |
* name="admin", | |
* in="query", | |
* required=true, | |
* @OA\Schema( | |
* type="string" | |
* ), | |
* description="Admin (required)" | |
* ), | |
* @OA\Parameter( | |
* name="role", | |
* in="query", | |
* required=true, | |
* @OA\Schema( | |
* type="string" | |
* ), | |
* description="Role (PM/FINCON/RICA) (required)" | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="object", | |
* @OA\Property( | |
* property="investmentRequestSummary", | |
* type="array", | |
* @OA\Items(ref="#/components/schemas/InvestmentRequestSummary") | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
//to process booking of direct booking type investments | |
$app->get('/api/customer/getInvestmentRequestSummary', function( $request, $response ) { | |
validate($request, [ | |
'admin' => [ | |
'rules' => V::notBlank(), | |
'message' => 'admin is required' | |
], | |
'role' => [ | |
'rules' => V::notBlank(), | |
'message' => 'role (PM/FINCON/RICA)is required' | |
], | |
]); | |
$payload = $request->getQueryParams(); | |
$getInvestmentRequestSummary = $this->customerModel->getInvestmentRequestSummary($payload); | |
return $response | |
->withStatus($getInvestmentRequestSummary["code"] ?? 200) | |
->withJson($getInvestmentRequestSummary); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
/** | |
* Get Investment Liquidation Summary | |
* | |
* @OA\Get( | |
* path="/api/customer/getInvestmentLiquidationSummary", | |
* tags={"Customer"}, | |
* summary="Get investment liquidation summary", | |
* operationId="getInvestmentLiquidationSummary", | |
* security={{"jwt":{}}}, | |
* @OA\Parameter( | |
* name="admin", | |
* in="query", | |
* required=true, | |
* @OA\Schema( | |
* type="string" | |
* ), | |
* description="Admin (required)" | |
* ), | |
* @OA\Parameter( | |
* name="role", | |
* in="query", | |
* required=true, | |
* @OA\Schema( | |
* type="string" | |
* ), | |
* description="Role (PM/FINCON/RICA) (required)" | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="object", | |
* @OA\Property( | |
* property="investmentLiquidationSummary", | |
* type="array", | |
* @OA\Items(ref="#/components/schemas/InvestmentLiquidationSummary") | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
//to process liquidation of direct booking type investments | |
$app->get('/api/customer/getInvestmentLiquidationSummary', function( $request, $response ) { | |
validate($request, [ | |
'admin' => [ | |
'rules' => V::notBlank(), | |
'message' => 'admin is required' | |
], | |
'role' => [ | |
'rules' => V::notBlank(), | |
'message' => 'role (PM/FINCON/RICA)is required' | |
], | |
]); | |
$payload = $request->getQueryParams(); | |
$getInvestmentLiquidationSummary = $this->customerModel->getInvestmentLiquidationSummary($payload); | |
return $response | |
->withStatus($getInvestmentLiquidationSummary["code"] ?? 200) | |
->withJson($getInvestmentLiquidationSummary); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
/** | |
* Get Margin Request Summary | |
* | |
* @OA\Get( | |
* path="/api/customer/getMarginRequestSummary", | |
* tags={"Customer"}, | |
* summary="Get margin request summary", | |
* operationId="getMarginRequestSummary", | |
* security={{"jwt":{}}}, | |
* @OA\Parameter( | |
* name="admin", | |
* in="query", | |
* required=true, | |
* @OA\Schema( | |
* type="string" | |
* ), | |
* description="Admin (required)" | |
* ), | |
* @OA\Parameter( | |
* name="role", | |
* in="query", | |
* required=true, | |
* @OA\Schema( | |
* type="string" | |
* ), | |
* description="Role (CSS/AMO/RICA/PARTNER) (required)" | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="object", | |
* @OA\Property( | |
* property="marginRequestSummary", | |
* type="array", | |
* @OA\Items(ref="#/components/schemas/MarginRequestSummary") | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getMarginRequestSummary', function( $request, $response ) { | |
validate($request, [ | |
'admin' => [ | |
'rules' => V::notBlank(), | |
'message' => 'admin is required' | |
], | |
'role' => [ | |
'rules' => V::notBlank(), | |
'message' => 'role (CSS/AMO/RICA/PARTNER)is required' | |
], | |
]); | |
$payload = $request->getQueryParams(); | |
$getMarginRequestSummary = $this->customerModel->getMarginRequestSummary($payload); | |
return $response | |
->withStatus($getMarginRequestSummary["code"] ?? 200) | |
->withJson($getMarginRequestSummary); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
/** | |
* Terminate Margin Loan | |
* | |
* @OA\Post( | |
* path="/api/customer/terminateMarginLoan", | |
* tags={"Customer"}, | |
* summary="Terminate margin loan", | |
* operationId="terminateMarginLoan", | |
* security={{"jwt":{}}}, | |
* @OA\RequestBody( | |
* required=true, | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="ID", | |
* type="string", | |
* description="ID (required)" | |
* ), | |
* @OA\Property( | |
* property="CustID", | |
* type="string", | |
* description="CustID (required)" | |
* ), | |
* @OA\Property( | |
* property="loanType", | |
* type="string", | |
* description="Loan type (required)" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="object", | |
* @OA\Property( | |
* property="terminatedLoan", | |
* type="object", | |
* ref="#/components/schemas/TerminatedLoan" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->post('/api/customer/terminateMarginLoan', function( $request, $response ) { | |
validate($request, [ | |
'ID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'ID is required' | |
], | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
'loanType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'loanType is required' | |
], | |
]); | |
$payload = $request->getParsedBody(); | |
$payload["admin"] = $request->getAttribute('fullName'); | |
$terminateMarginLoan = $this->customerModel->terminateMarginLoan($payload); | |
return $response | |
->withStatus($terminateMarginLoan["code"] ?? 200) | |
->withJson($terminateMarginLoan); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
/** | |
* Get Withdrawal Request Summary | |
* | |
* @OA\Get( | |
* path="/api/customer/getWithdrawalRequestSummary", | |
* tags={"Customer"}, | |
* summary="Get withdrawal request summary", | |
* operationId="getWithdrawalRequestSummary", | |
* security={{"jwt":{}}}, | |
* @OA\Parameter( | |
* name="admin", | |
* in="query", | |
* required=true, | |
* @OA\Schema( | |
* type="string" | |
* ), | |
* description="Admin's email address (required)" | |
* ), | |
* @OA\Parameter( | |
* name="role", | |
* in="query", | |
* required=true, | |
* @OA\Schema( | |
* type="string" | |
* ), | |
* description="Role (IA/IALEAD/PM/FINCON/RICA) (required)" | |
* ), | |
* @OA\Parameter( | |
* name="accountOfficerEmail", | |
* in="query", | |
* @OA\Schema( | |
* type="string" | |
* ), | |
* description="Account officer's email address (required for 'IA' role)" | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="object", | |
* @OA\Property( | |
* property="withdrawalRequests", | |
* type="array", | |
* @OA\Items(ref="#/components/schemas/WithdrawalRequest") | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getWithdrawalRequestSummary', function( $request, $response ) { | |
validate($request, [ | |
'admin' => [ | |
'rules' => V::notBlank(), | |
'message' => 'admin is required' | |
], | |
'role' => [ | |
'rules' => V::notBlank(), | |
'message' => 'role (IA/IALEAD/PM/FINCON/RICA)is required' | |
], | |
]); | |
$payload = $request->getQueryParams(); | |
if(strtoupper($payload['role']) == IA) | |
{ | |
validate($payload, [ | |
'accountOfficerEmail' => [ | |
'rules' => V::notBlank(), | |
'message' => 'accountOfficerEmail is required' | |
], | |
]); | |
} | |
$getWithdrawalRequestSummary = $this->customerModel->getWithdrawalRequestSummary($payload); | |
return $response | |
->withStatus($getWithdrawalRequestSummary["code"] ?? 200) | |
->withJson($getWithdrawalRequestSummary); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
/** | |
* Process Margin Requests | |
* | |
* @OA\Post( | |
* path="/api/customer/processMarginRequests", | |
* tags={"Customer"}, | |
* summary="Process margin requests", | |
* operationId="processMarginRequests", | |
* security={{"jwt":{}}}, | |
* @OA\RequestBody( | |
* required=true, | |
* description="Request body for processing margin requests", | |
* @OA\JsonContent(ref="#/components/schemas/MarginRequestProcess") | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="object", | |
* @OA\Property( | |
* property="marginRequests", | |
* type="array", | |
* @OA\Items(ref="#/components/schemas/MarginRequest") | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->post('/api/customer/processMarginRequests', function( $request, $response ) { | |
validate($request, [ | |
'accountOfficerEmail' => [ | |
'rules' => V::notBlank(), | |
'message' => 'accountOfficerEmail is required' | |
], | |
'admin' => [ | |
'rules' => V::notBlank(), | |
'message' => 'admin is required' | |
], | |
'role' => [ | |
'rules' => V::notBlank(), | |
'message' => 'role (CSS/AMO/RICA/PARTNER)is required' | |
], | |
'action' => [ | |
'rules' => V::notBlank(), | |
'message' => 'action (fetch/approve/reject/pending/approved/rejected/fetchall) is required' | |
], | |
]); | |
$payload = $request->getParsedBody(); | |
if(strtoupper($payload['action']) == "FETCH") | |
{ | |
validate($request, [ | |
'ID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'ID is required' | |
], | |
]); | |
} | |
if(strtoupper($payload['action']) == "APPROVE" || strtoupper($payload['action']) == "REJECT") | |
{ | |
validate($payload, [ | |
'ID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'ID is required' | |
], | |
/* 'applicationID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'applicationID is required' | |
], */ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
'comment' => [ | |
'rules' => V::notBlank(), | |
'message' => 'comment is required' | |
], | |
'SECID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'SECID is required' | |
], | |
'CAMID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CAMID is required' | |
], | |
'fullName' => [ | |
'rules' => V::notBlank(), | |
'message' => 'fullName is required' | |
], | |
'emailAddress' => [ | |
'rules' => V::notBlank(), | |
'message' => 'emailAddress is required' | |
], | |
'rate' => [ | |
'rules' => V::numeric(), | |
'message' => 'rate is required' | |
], | |
'portfolioValuation' => [ | |
'rules' => V::notBlank(), | |
'message' => 'portfolioValuation is required' | |
], | |
'loanAmount' => [ | |
'rules' => V::notBlank(), | |
'message' => 'loanAmount is required' | |
], | |
'loanType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'loanType is required' | |
], | |
/* 'collateral' => [ | |
'rules' => V::notBlank(), | |
'message' => 'collateral is required' | |
], | |
'collateralValue' => [ | |
'rules' => V::notBlank(), | |
'message' => 'collateralValue is required' | |
], */ | |
'admin' => [ | |
'rules' => V::notBlank(), | |
'message' => 'admin is required' | |
], | |
]); | |
} | |
$processMarginRequests = $this->customerModel->processMarginRequests($payload); | |
return $response | |
->withStatus($processMarginRequests["code"] ?? 200) | |
->withJson($processMarginRequests); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
/** | |
* Get Bulk Withdraw From Wallet | |
* | |
* @OA\Get( | |
* path="/api/customer/getBulkWithdrawFromWallet", | |
* tags={"Customer"}, | |
* summary="Get bulk withdraw from wallet", | |
* operationId="getBulkWithdrawFromWallet", | |
* security={{"jwt":{}}}, | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="object", | |
* @OA\Property( | |
* property="bulkWithdrawals", | |
* type="array", | |
* @OA\Items(ref="#/components/schemas/BulkWithdrawal") | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getBulkWithdrawFromWallet', function( $request, $response ) { | |
/* validate($request, [ | |
'amount' => [ | |
'rules' => V::notBlank(), | |
'message' => 'amount is required' | |
], | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
] | |
]); */ | |
// $payload = $request->getQueryParams(); | |
$getBulkWithdrawFromWallet = $this->customerModel->getBulkWithdrawFromWallet(); | |
return $response | |
->withStatus($getBulkWithdrawFromWallet["code"] ?? 200) | |
->withJson($getBulkWithdrawFromWallet); | |
}); | |
// ->add(new AdminAuthorization()) | |
// ->add(new auth()); | |
/** | |
* Get Pending Bulk Withdraw From Wallet | |
* | |
* @OA\Get( | |
* path="/api/customer/getPendingBulkWithdrawFromWallet", | |
* tags={"Customer"}, | |
* summary="Get pending bulk withdraw from wallet", | |
* operationId="getPendingBulkWithdrawFromWallet", | |
* security={{"jwt":{}}}, | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="object", | |
* @OA\Property( | |
* property="pendingBulkWithdrawals", | |
* type="array", | |
* @OA\Items(ref="#/components/schemas/BulkWithdrawal") | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getPendingBulkWithdrawFromWallet', function( $request, $response ) { | |
/* validate($request, [ | |
'amount' => [ | |
'rules' => V::notBlank(), | |
'message' => 'amount is required' | |
], | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
] | |
]); */ | |
// $payload = $request->getQueryParams(); | |
$getPendingBulkWithdrawFromWallet = $this->customerModel->getPendingBulkWithdrawFromWallet(); | |
return $response | |
->withStatus($getPendingBulkWithdrawFromWallet["code"] ?? 200) | |
->withJson($getPendingBulkWithdrawFromWallet); | |
}); | |
// ->add(new AdminAuthorization()) | |
// ->add(new auth()); | |
/** | |
* Bulk Withdraw From Wallet | |
* | |
* @OA\Post( | |
* path="/api/customer/bulkWithdrawFromWallet", | |
* tags={"Customer"}, | |
* summary="Bulk withdraw from wallet", | |
* operationId="bulkWithdrawFromWallet", | |
* security={{"jwt":{}}}, | |
* @OA\RequestBody( | |
* required=true, | |
* description="Bulk withdrawal details", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema(ref="#/components/schemas/BulkWithdrawal") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->post('/api/customer/bulkWithdrawFromWallet', function( $request, $response ) { | |
/* validate($request, [ | |
'action' => [ | |
'rules' => V::notBlank(), | |
'message' => 'action is required' | |
], | |
'amount' => [ | |
'rules' => V::notBlank(), | |
'message' => 'amount is required' | |
], | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
] | |
]); */ | |
$payload = $request->getParsedBody(); | |
$bulkWithdrawFromWallet = $this->customerModel->bulkWithdrawFromWallet(); | |
return $response | |
->withStatus($bulkWithdrawFromWallet["code"] ?? 200) | |
->withJson($bulkWithdrawFromWallet); | |
}); | |
// ->add(new AdminAuthorization()) | |
// ->add(new auth()); | |
/** | |
* Decline Bulk Withdraw From Wallet | |
* | |
* @OA\Post( | |
* path="/api/customer/declineBulkWithdrawFromWallet", | |
* tags={"Customer"}, | |
* summary="Decline bulk withdraw from wallet", | |
* operationId="declineBulkWithdrawFromWallet", | |
* security={{"jwt":{}}}, | |
* @OA\RequestBody( | |
* required=true, | |
* description="Bulk withdrawal details", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema(ref="#/components/schemas/BulkWithdrawal") | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->post('/api/customer/declineBulkWithdrawFromWallet', function( $request, $response ) { | |
/* validate($request, [ | |
'action' => [ | |
'rules' => V::notBlank(), | |
'message' => 'action is required' | |
], | |
'amount' => [ | |
'rules' => V::notBlank(), | |
'message' => 'amount is required' | |
], | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
] | |
]); */ | |
$payload = $request->getParsedBody(); | |
$declineBulkWithdrawFromWallet = $this->customerModel->declineBulkWithdrawFromWallet($payload); | |
return $response | |
->withStatus($declineBulkWithdrawFromWallet["code"] ?? 200) | |
->withJson($declineBulkWithdrawFromWallet); | |
}); | |
// ->add(new AdminAuthorization()) | |
// ->add(new auth()); | |
/** | |
* Verify Product Involvement | |
* | |
* @OA\Get( | |
* path="/api/customer/verifyProductInvolvement", | |
* tags={"Customer"}, | |
* summary="Verify product involvement", | |
* operationId="verifyProductInvolvement", | |
* security={{"jwt":{}}}, | |
* @OA\Parameter( | |
* name="businessInvolvement", | |
* in="query", | |
* required=true, | |
* description="Business involvement (ASSETMGMT/STOCKBROKING/CAM)", | |
* @OA\Schema( | |
* type="string" | |
* ) | |
* ), | |
* @OA\Parameter( | |
* name="involvementType", | |
* in="query", | |
* required=true, | |
* description="Involvement type", | |
* @OA\Schema( | |
* type="string" | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="object", | |
* description="Data related to product involvement", | |
* @OA\Property( | |
* property="field1", | |
* type="string", | |
* description="Description of field 1" | |
* ), | |
* @OA\Property( | |
* property="field2", | |
* type="integer", | |
* description="Description of field 2" | |
* ), | |
* ... | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/verifyProductInvolvement', function( $request, $response ) { | |
validate($request, [ | |
'businessInvolvement' => [ | |
'rules' => V::notBlank(), | |
'message' => 'businessInvolvement is required' | |
], | |
'involvementType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'involvementType is required' | |
], | |
]); | |
$payload = $request->getQueryParams(); | |
if(strtoupper($payload['businessInvolvement']) == strtoupper(ASSETMGMT_DB_NAME)){ | |
$payload['BIZID'] = $request->getAttribute('assetMgmtID'); | |
}elseif(strtoupper($payload['businessInvolvement']) == strtoupper(STOCKBROKING_DB_NAME)){ | |
$payload['BIZID'] = $request->getAttribute('stockbrokingID'); | |
}elseif(strtoupper($payload['businessInvolvement']) == strtoupper(CAM_DB_NAME)){ | |
$payload['BIZID'] = $request->getAttribute('CAMID'); | |
}else{ | |
return $response | |
->withStatus(400) | |
->withJson("Invalid Business Involvement"); | |
} | |
$verify = $this->customerModel->verifyProductInvolvement($payload['BIZID'], $payload['involvementType'], $payload['businessInvolvement']); | |
return $response | |
->withStatus($verify["code"] ?? 200) | |
->withJson([ | |
'message' => $verify["message"], | |
'data' => $verify["data"] | |
]); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
$app->get('/api/admin/verifyProductInvolvement', function( $request, $response ) { | |
validate($request, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
'businessInvolvement' => [ | |
'rules' => V::notBlank(), | |
'message' => 'businessInvolvement is required' | |
], | |
'involvementType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'involvementType is required' | |
], | |
]); | |
$payload = $request->getQueryParams(); | |
$customerInfo = $this->customerModel->getCustomerDetails($payload['CustID']); | |
if(strtoupper($payload['businessInvolvement']) == strtoupper(ASSETMGMT_DB_NAME)){ | |
$payload['BIZID'] =$customerInfo['ASSETID']; | |
}elseif(strtoupper($payload['businessInvolvement']) == strtoupper(STOCKBROKING_DB_NAME)){ | |
$payload['BIZID'] = $customerInfo['SECID']; | |
}elseif(strtoupper($payload['businessInvolvement']) == strtoupper(CAM_DB_NAME)){ | |
$payload['BIZID'] = $customerInfo['CAMID']; | |
}else{ | |
return $response | |
->withStatus(400) | |
->withJson("Invalid Business Involvement"); | |
} | |
$verify = $this->customerModel->verifyProductInvolvement($payload['BIZID'], $payload['involvementType'], $payload['businessInvolvement']); | |
return $response | |
->withStatus($verify["code"] ?? 200) | |
->withJson([ | |
'message' => $verify["message"], | |
'data' => $verify["data"] | |
]); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
/** | |
* Get CSCS Number | |
* | |
* @OA\Get( | |
* path="/api/customer/getCSCSNumber", | |
* tags={"Customer"}, | |
* summary="Get CSCS Number", | |
* operationId="getCSCSNumber", | |
* security={{"jwt":{}}}, | |
* @OA\Parameter( | |
* name="CustID", | |
* in="query", | |
* required=true, | |
* description="Customer ID", | |
* @OA\Schema( | |
* type="integer" | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="object", | |
* description="Data related to the CSCS number", | |
* @OA\Property( | |
* property="CSCSNumber", | |
* type="string", | |
* description="Customer's CSCS Number" | |
* ), | |
* ... | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getCSCSNumber', function( $request, $response ) { | |
validate($request, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
]); | |
$payload = $request->getQueryParams(); | |
/* if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} */ | |
/* $payload["SECID"] = $request->getAttribute('SECID'); */ | |
$cscs = $this->customerModel->getCSCSNumber($payload); | |
return $response | |
->withStatus($cscs["code"] ?? 200) | |
->withJson([ | |
'message' => $cscs["message"], | |
'data' => $cscs["data"] | |
]); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* Check if CSCS Number Exists | |
* | |
* @OA\Get( | |
* path="/api/customer/isCSCSNumber", | |
* tags={"Customer"}, | |
* summary="Check if CSCS Number Exists", | |
* operationId="isCSCSNumber", | |
* security={{"jwt":{}}}, | |
* @OA\Parameter( | |
* name="CustID", | |
* in="query", | |
* required=true, | |
* description="Customer ID", | |
* @OA\Schema( | |
* type="integer" | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="CSCSExists", | |
* type="boolean", | |
* description="Indicates whether the CSCS number exists or not" | |
* ), | |
* ... | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/isCSCSNumber', function( $request, $response ) { | |
validate($request, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
]); | |
$payload = $request->getQueryParams(); | |
if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$payload["SECID"] = $request->getAttribute('SECID'); | |
$cscs = $this->customerModel->isCSCSNumber($payload["SECID"]); | |
return $response | |
->withStatus(200) | |
->withJson($cscs); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* Get Client Product Involvements | |
* | |
* @OA\Get( | |
* path="/api/customer/getClientProductInvolvements", | |
* tags={"Customer"}, | |
* summary="Get Client Product Involvements", | |
* operationId="getClientProductInvolvements", | |
* security={{"jwt":{}}}, | |
* @OA\Parameter( | |
* name="CustID", | |
* in="query", | |
* required=true, | |
* description="Customer ID", | |
* @OA\Schema( | |
* type="integer" | |
* ) | |
* ), | |
* @OA\Parameter( | |
* name="businessInvolvement", | |
* in="query", | |
* required=true, | |
* description="Business Involvement", | |
* @OA\Schema( | |
* type="string" | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="data", | |
* type="array", | |
* @OA\Items( | |
* type="object", | |
* @OA\Property( | |
* property="businessInvolvement", | |
* type="string", | |
* description="The type of business involvement" | |
* ), | |
* @OA\Property( | |
* property="productInvolvement", | |
* type="string", | |
* description="The product involvement associated with the business involvement" | |
* ), | |
* ... | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getClientProductInvolvements', function( $request, $response ) { | |
validate($request, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
'businessInvolvement' => [ | |
'rules' => V::notBlank(), | |
'message' => 'businessInvolvement is required' | |
], | |
]); | |
$payload = $request->getQueryParams(); | |
if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$payload["SECID"] = $request->getAttribute('SECID'); | |
$payload["CAMID"] = $request->getAttribute('CAMID'); | |
$productInvolvement = $this->customerModel->getClientProductInvolvements($payload); | |
return $response | |
->withStatus(200) | |
->withJson($productInvolvement); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* Get Non-Client Product Involvements | |
* | |
* @OA\Get( | |
* path="/api/customer/getNonClientProductInvolvements", | |
* tags={"Customer"}, | |
* summary="Get Non-Client Product Involvements", | |
* operationId="getNonClientProductInvolvements", | |
* security={{"jwt":{}}}, | |
* @OA\Parameter( | |
* name="CustID", | |
* in="query", | |
* required=true, | |
* description="Customer ID", | |
* @OA\Schema( | |
* type="integer" | |
* ) | |
* ), | |
* @OA\Parameter( | |
* name="businessInvolvement", | |
* in="query", | |
* required=true, | |
* description="Business Involvement", | |
* @OA\Schema( | |
* type="string" | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="data", | |
* type="array", | |
* @OA\Items( | |
* type="object", | |
* @OA\Property( | |
* property="businessInvolvement", | |
* type="string", | |
* description="The type of business involvement" | |
* ), | |
* @OA\Property( | |
* property="productInvolvement", | |
* type="string", | |
* description="The product involvement associated with the business involvement" | |
* ), | |
* ... | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getNonClientProductInvolvements', function( $request, $response ) { | |
validate($request, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
'businessInvolvement' => [ | |
'rules' => V::notBlank(), | |
'message' => 'businessInvolvement is required' | |
], | |
/* 'accountOpeningProduct' => [ | |
'rules' => V::notBlank(), | |
'message' => 'accountOpeningProduct is required' | |
], */ | |
]); | |
$payload = $request->getQueryParams(); | |
if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$payload["SECID"] = $request->getAttribute('SECID'); | |
$payload["CAMID"] = $request->getAttribute('CAMID'); | |
$productInvolvement = $this->customerModel->getNonClientProductInvolvements($payload); | |
return $response | |
->withStatus(200) | |
->withJson($productInvolvement); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* Get User Details From Middleware | |
* | |
* @OA\Get( | |
* path="/api/customer/getUserDetailsFromMiddleware", | |
* tags={"Customer"}, | |
* summary="Get User Details From Middleware", | |
* operationId="getUserDetailsFromMiddleware", | |
* security={{"jwt":{}}}, | |
* @OA\Parameter( | |
* name="CustID", | |
* in="query", | |
* required=true, | |
* description="Customer ID", | |
* @OA\Schema( | |
* type="integer" | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="data", | |
* type="object", | |
* @OA\Property( | |
* property="CustID", | |
* type="integer", | |
* description="The Customer ID" | |
* ), | |
* @OA\Property( | |
* property="SECID", | |
* type="integer", | |
* description="The SECID from middleware" | |
* ), | |
* @OA\Property( | |
* property="CAMID", | |
* type="integer", | |
* description="The CAMID from middleware" | |
* ), | |
* ... | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getUserDetailsFromMiddleware', function( $request, $response ) { | |
validate($request, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
] | |
]); | |
$payload = $request->getQueryParams(); | |
if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$payload["SECID"] = $request->getAttribute('SECID'); | |
$payload["CAMID"] = $request->getAttribute('CAMID'); | |
$middleware = $this->customerModel->getUserDetailsFromMiddleware($payload); | |
return $response | |
->withStatus(200) | |
->withJson($middleware); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* Trade Time | |
* | |
* @OA\Get( | |
* path="/api/tradeTime", | |
* tags={"Customer"}, | |
* summary="Trade Time", | |
* operationId="tradeTime", | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="data", | |
* type="array", | |
* @OA\Items( | |
* type="object", | |
* @OA\Property( | |
* property="startTime", | |
* type="string", | |
* description="The start time of the trade" | |
* ), | |
* @OA\Property( | |
* property="endTime", | |
* type="string", | |
* description="The end time of the trade" | |
* ), | |
* ... | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/tradeTime', function( $request, $response ) { | |
$tradeTime = $this->customerModel->tradeTime(); | |
return $response | |
->withStatus(200) | |
->withJson($tradeTime); | |
}); | |
/** | |
* US Trade Time | |
* | |
* @OA\Get( | |
* path="/api/us_tradeTime", | |
* tags={"Customer"}, | |
* summary="US Trade Time", | |
* operationId="us_tradeTime", | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="data", | |
* type="array", | |
* @OA\Items( | |
* type="object", | |
* @OA\Property( | |
* property="startTime", | |
* type="string", | |
* description="The start time of the US trade" | |
* ), | |
* @OA\Property( | |
* property="endTime", | |
* type="string", | |
* description="The end time of the US trade" | |
* ), | |
* ... | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/us_tradeTime', function( $request, $response ) { | |
$us_tradeTime = $this->customerModel->us_tradeTime(); | |
return $response | |
->withStatus(200) | |
->withJson($us_tradeTime); | |
}); | |
/** | |
* Get Country | |
* | |
* @OA\Get( | |
* path="/api/getCountry", | |
* tags={"Customer"}, | |
* summary="Get Country", | |
* operationId="getCountry", | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="data", | |
* type="array", | |
* @OA\Items( | |
* type="object", | |
* @OA\Property( | |
* property="countryCode", | |
* type="string", | |
* description="The country code of the country" | |
* ), | |
* @OA\Property( | |
* property="countryName", | |
* type="string", | |
* description="The name of the country" | |
* ), | |
* ... | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/getCountry', function( $request, $response ) { | |
$getCountry = $this->customerModel->getCountry(); | |
return $response | |
->withStatus(200) | |
->withJson($getCountry); | |
}); | |
/** | |
* Get State | |
* | |
* @OA\Get( | |
* path="/api/getState", | |
* tags={"Customer"}, | |
* summary="Get State", | |
* operationId="getState", | |
* @OA\Parameter( | |
* name="countryID", | |
* in="query", | |
* required=true, | |
* description="The ID of the country for which to retrieve states", | |
* @OA\Schema( | |
* type="integer", | |
* format="int64" | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="data", | |
* type="array", | |
* @OA\Items( | |
* type="object", | |
* @OA\Property( | |
* property="stateID", | |
* type="integer", | |
* format="int64", | |
* description="The ID of the state" | |
* ), | |
* @OA\Property( | |
* property="stateName", | |
* type="string", | |
* description="The name of the state" | |
* ), | |
* ... | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message describing the reason for the bad request" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/getState', function( $request, $response ) { | |
validate($request, [ | |
'countryID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'countryID is required' | |
] | |
]); | |
$payload = $request->getQueryParams(); | |
$getState = $this->customerModel->getState($payload); | |
return $response | |
->withStatus(200) | |
->withJson($getState); | |
}); | |
/** | |
* Get City | |
* | |
* @OA\Get( | |
* path="/api/getCity", | |
* tags={"Customer"}, | |
* summary="Get City", | |
* operationId="getCity", | |
* @OA\Parameter( | |
* name="stateID", | |
* in="query", | |
* required=true, | |
* description="The ID of the state for which to retrieve cities", | |
* @OA\Schema( | |
* type="integer", | |
* format="int64" | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="data", | |
* type="array", | |
* @OA\Items( | |
* type="object", | |
* @OA\Property( | |
* property="cityID", | |
* type="integer", | |
* format="int64", | |
* description="The ID of the city" | |
* ), | |
* @OA\Property( | |
* property="cityName", | |
* type="string", | |
* description="The name of the city" | |
* ), | |
* ... | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message describing the reason for the bad request" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/getCity', function( $request, $response ) { | |
validate($request, [ | |
'stateID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'stateID is required' | |
] | |
]); | |
$payload = $request->getQueryParams(); | |
$getCity = $this->customerModel->getCity($payload); | |
return $response | |
->withStatus(200) | |
->withJson($getCity); | |
}); | |
/** | |
* Get Local Government Areas (LGA) | |
* | |
* @OA\Get( | |
* path="/api/getLGA", | |
* tags={"Customer"}, | |
* summary="Get Local Government Areas (LGA)", | |
* operationId="getLGA", | |
* @OA\Parameter( | |
* name="stateID", | |
* in="query", | |
* required=true, | |
* description="The ID of the state for which to retrieve LGAs", | |
* @OA\Schema( | |
* type="integer", | |
* format="int64" | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="data", | |
* type="array", | |
* @OA\Items( | |
* type="object", | |
* @OA\Property( | |
* property="lgaID", | |
* type="integer", | |
* format="int64", | |
* description="The ID of the LGA" | |
* ), | |
* @OA\Property( | |
* property="lgaName", | |
* type="string", | |
* description="The name of the LGA" | |
* ), | |
* ... | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message describing the reason for the bad request" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/getLGA', function( $request, $response ) { | |
validate($request, [ | |
'stateID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'stateID is required' | |
] | |
]); | |
$payload = $request->getQueryParams(); | |
$getLGA = $this->customerModel->getLGA($payload); | |
return $response | |
->withStatus(200) | |
->withJson($getLGA); | |
}); | |
$app->get('/api/isMarketOpen', function( $request, $response ) { | |
$isMarketOpen = $this->customerModel->isMarketOpen(); | |
return $response | |
->withStatus(200) | |
->withJson($isMarketOpen); | |
}); | |
/** | |
* Check if Market is Open | |
* | |
* @OA\Get( | |
* path="/api/isMarketOpen", | |
* tags={"Customer"}, | |
* summary="Check if the market is open", | |
* operationId="isMarketOpen", | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="isMarketOpen", | |
* type="boolean", | |
* description="Indicates whether the market is open or closed" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message describing the internal server error" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/isUSMarketOpen', function( $request, $response ) { | |
$isUSMarketOpen = $this->customerModel->isUSMarketOpen(); | |
return $response | |
->withStatus(200) | |
->withJson($isUSMarketOpen); | |
}); | |
/** | |
* Get List of Banks | |
* | |
* @OA\Get( | |
* path="/api/banks", | |
* tags={"Customer"}, | |
* summary="Get a list of banks", | |
* operationId="getBanks", | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="data", | |
* type="array", | |
* @OA\Items( | |
* type="string", | |
* description="Bank name" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message describing the internal server error" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/banks', function($request, $response){ | |
$result = $this->customerModel->banks(); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}); | |
/** | |
* Get Treasury Bills Investment Details | |
* | |
* @OA\Get( | |
* path="/api/customer/getTbillsInvestmentDetails", | |
* tags={"Customer"}, | |
* summary="Get details of Treasury Bills investments", | |
* operationId="getTbillsInvestmentDetails", | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="data", | |
* type="array", | |
* @OA\Items( | |
* type="object", | |
* @OA\Property( | |
* property="investmentID", | |
* type="integer", | |
* description="The ID of the investment" | |
* ), | |
* @OA\Property( | |
* property="investmentType", | |
* type="string", | |
* description="Type of investment (Treasury Bills)" | |
* ), | |
* @OA\Property( | |
* property="investmentAmount", | |
* type="number", | |
* format="float", | |
* description="Amount invested in the Treasury Bills" | |
* ), | |
* @OA\Property( | |
* property="maturityDate", | |
* type="string", | |
* format="date", | |
* description="Date when the Treasury Bills matures" | |
* ), | |
* @OA\Property( | |
* property="interestRate", | |
* type="number", | |
* format="float", | |
* description="Interest rate for the Treasury Bills investment" | |
* ), | |
* @OA\Property( | |
* property="status", | |
* type="string", | |
* description="Status of the Treasury Bills investment (e.g., active, matured, etc.)" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message describing the internal server error" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getTbillsInvestmentDetails', function($request, $response){ | |
$result = $this->customerModel->getTbillsInvestmentDetails(); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}); | |
/** | |
* Get Bonds Investment Details | |
* | |
* @OA\Get( | |
* path="/api/customer/getBondsInvestmentDetails", | |
* tags={"Customer"}, | |
* summary="Get details of Bonds investments", | |
* operationId="getBondsInvestmentDetails", | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="data", | |
* type="array", | |
* @OA\Items( | |
* type="object", | |
* @OA\Property( | |
* property="investmentID", | |
* type="integer", | |
* description="The ID of the investment" | |
* ), | |
* @OA\Property( | |
* property="investmentType", | |
* type="string", | |
* description="Type of investment (Bonds)" | |
* ), | |
* @OA\Property( | |
* property="investmentAmount", | |
* type="number", | |
* format="float", | |
* description="Amount invested in the Bonds" | |
* ), | |
* @OA\Property( | |
* property="maturityDate", | |
* type="string", | |
* format="date", | |
* description="Date when the Bonds matures" | |
* ), | |
* @OA\Property( | |
* property="interestRate", | |
* type="number", | |
* format="float", | |
* description="Interest rate for the Bonds investment" | |
* ), | |
* @OA\Property( | |
* property="status", | |
* type="string", | |
* description="Status of the Bonds investment (e.g., active, matured, etc.)" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message describing the internal server error" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getBondsInvestmentDetails', function($request, $response){ | |
$result = $this->customerModel->getBondsInvestmentDetails(); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}); | |
/** | |
* Submit Margin Application | |
* | |
* @OA\Post( | |
* path="/api/customer/submitMarginApplication", | |
* tags={"Customer"}, | |
* summary="Submit a margin application", | |
* operationId="submitMarginApplication", | |
* @OA\RequestBody( | |
* description="JSON payload for submitting a margin application", | |
* required=true, | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="CustID", | |
* type="integer", | |
* description="Customer ID (required)" | |
* ), | |
* @OA\Property( | |
* property="fullName", | |
* type="string", | |
* description="Full name of the customer (required)" | |
* ), | |
* @OA\Property( | |
* property="emailAddress", | |
* type="string", | |
* description="Email address of the customer (required)" | |
* ), | |
* @OA\Property( | |
* property="portfolioValuation", | |
* type="number", | |
* format="float", | |
* description="Portfolio valuation of the customer (required)" | |
* ), | |
* @OA\Property( | |
* property="loanAmount", | |
* type="number", | |
* format="float", | |
* description="Loan amount requested by the customer (required, should be between 5000 and 200000000)" | |
* ), | |
* @OA\Property( | |
* property="loanType", | |
* type="string", | |
* description="Type of loan requested (required)" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message describing the bad request" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message indicating unauthorized access" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message describing the internal server error" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->post('/api/customer/submitMarginApplication', function($request, $response){ | |
$payload = $request->getParsedBody(); | |
validate($payload, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
'fullName' => [ | |
'rules' => V::notBlank(), | |
'message' => 'fullName is required' | |
], | |
'emailAddress' => [ | |
'rules' => V::notBlank(), | |
'message' => 'emailAddress is required' | |
], | |
'portfolioValuation' => [ | |
'rules' => V::notBlank(), | |
'message' => 'portfolioValuation is required' | |
], | |
'loanAmount' => [ | |
'rules' => V::notBlank()->numeric()->between(5000, 200000000), | |
'message' => 'Loan Amount should not exceed N200,000,000' | |
], | |
'loanType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'loanType is required' | |
], | |
/* 'rate' => [ | |
'rules' => V::notBlank(), | |
'message' => 'rate is required' | |
], */ | |
/* 'collateral' => [ | |
'rules' => V::notBlank(), | |
'message' => 'collateral is required' | |
], | |
'collateralValue' => [ | |
'rules' => V::notBlank(), | |
'message' => 'collateralValue is required' | |
], */ | |
]); | |
if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$payload["CAMID"] = $request->getAttribute('CAMID'); | |
$payload["SECID"] = $request->getAttribute('SECID'); | |
$result = $this->customerModel->submitMarginApplication($payload); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* Get Margin Conversion Rate | |
* | |
* @OA\Get( | |
* path="/api/customer/getMarginConversionRate", | |
* tags={"Customer"}, | |
* summary="Get the margin conversion rate", | |
* operationId="getMarginConversionRate", | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="array", | |
* @OA\Items( | |
* type="object", | |
* @OA\Property( | |
* property="currency", | |
* type="string", | |
* description="Currency code" | |
* ), | |
* @OA\Property( | |
* property="rate", | |
* type="number", | |
* format="float", | |
* description="Conversion rate" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message describing the internal server error" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getMarginConversionRate', function($request, $response){ | |
$payload = $request->getParsedBody(); | |
$result = $this->customerModel->getMarginConversionRate($payload); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}); | |
// ->add(new AdminAuthorization()) | |
// ->add(new auth()); | |
/** | |
* Get Margin Application | |
* | |
* @OA\Get( | |
* path="/api/customer/getMarginApplication_", | |
* tags={"Customer"}, | |
* summary="Get margin applications based on role and action", | |
* operationId="getMarginApplication", | |
* @OA\Parameter( | |
* name="role", | |
* in="query", | |
* required=true, | |
* @OA\Schema( | |
* type="string", | |
* enum={"CSS", "AMO", "RICA", "PARTNER"}, | |
* default="CSS", | |
* ), | |
* description="Role (CSS/AMO/RICA/PARTNER) to filter margin applications" | |
* ), | |
* @OA\Parameter( | |
* name="action", | |
* in="query", | |
* required=true, | |
* @OA\Schema( | |
* type="string", | |
* enum={"all", "pending", "approved", "rejected"}, | |
* default="all", | |
* ), | |
* description="Action (all/pending/approved/rejected) to filter margin applications" | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="array", | |
* @OA\Items( | |
* type="object", | |
* // Define the properties of margin application data here | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message describing the bad request" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message describing the internal server error" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getMarginApplication_', function($request, $response){ | |
validate($request, [ | |
'role' => [ | |
'rules' => V::notBlank(), | |
'message' => 'role (CSS/AMO/RICA/PARTNER)is required' | |
], | |
'action' => [ | |
'rules' => V::notBlank(), | |
'message' => 'action (all/pending/approved/rejected) is required' | |
], | |
]); | |
$payload = $request->getQueryParams(); | |
$result = $this->customerModel->getMarginApplication($payload); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
/** | |
* Get Margin Application Details | |
* | |
* @OA\Get( | |
* path="/api/customer/getMarginApplicationDetails", | |
* tags={"Customer"}, | |
* summary="Get details of a specific margin application", | |
* operationId="getMarginApplicationDetails", | |
* @OA\Parameter( | |
* name="CustID", | |
* in="query", | |
* required=true, | |
* @OA\Schema( | |
* type="string", | |
* ), | |
* description="Customer ID for whom the margin application details are to be fetched" | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="array", | |
* @OA\Items( | |
* type="object", | |
* // Define the properties of margin application details data here | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message describing the bad request" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message indicating unauthorized access" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message describing the internal server error" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getMarginApplicationDetails', function($request, $response){ | |
$payload = $request->getQueryParams(); | |
validate($payload, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
/* 'ID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'ID is required' | |
], */ | |
]); | |
//check CustID is same as token ID | |
/* if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} */ | |
$result = $this->customerModel->getMarginApplicationDetails($payload); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* Get Margin Collateral | |
* | |
* @OA\Get( | |
* path="/api/customer/getMarginCollateral", | |
* tags={"Customer"}, | |
* summary="Get details of margin collateral for a specific application", | |
* operationId="getMarginCollateral", | |
* @OA\Parameter( | |
* name="applicationID", | |
* in="query", | |
* required=true, | |
* @OA\Schema( | |
* type="string", | |
* ), | |
* description="Application ID for which the margin collateral details are to be fetched" | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="array", | |
* @OA\Items( | |
* type="object", | |
* // Define the properties of margin collateral details data here | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message describing the bad request" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message indicating unauthorized access" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message describing the internal server error" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getMarginCollateral', function($request, $response){ | |
$payload = $request->getQueryParams(); | |
validate($payload, [ | |
'applicationID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'applicationID is required' | |
], | |
]); | |
$result = $this->customerModel->getMarginCollateral($payload); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* Get Margin Collaterals | |
* | |
* @OA\Get( | |
* path="/api/customer/getMarginCollaterals", | |
* tags={"Customer"}, | |
* summary="Get all margin collaterals", | |
* operationId="getMarginCollaterals", | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="array", | |
* @OA\Items( | |
* type="object", | |
* // Define the properties of each margin collateral data here | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message indicating unauthorized access" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message describing the internal server error" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getMarginCollaterals', function($request, $response){ | |
$result = $this->customerModel->getMarginCollaterals(); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
/** | |
* Get Margin Lien | |
* | |
* @OA\Get( | |
* path="/api/customer/getMarginLien", | |
* tags={"Customer"}, | |
* summary="Get margin lien details", | |
* operationId="getMarginLien", | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="data", | |
* type="array", | |
* @OA\Items( | |
* type="object", | |
* // Define the properties of each margin lien data here | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message indicating unauthorized access" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message describing the internal server error" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getMarginLien', function($request, $response){ | |
$result = $this->customerModel->getMarginLien(); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
/** | |
* Get Margin Details | |
* | |
* @OA\Get( | |
* path="/api/customer/getMarginDetails", | |
* tags={"Customer"}, | |
* summary="Get margin details for a customer", | |
* operationId="getMarginDetails", | |
* @OA\Parameter( | |
* name="CustID", | |
* in="query", | |
* required=true, | |
* @OA\Schema( | |
* type="string" | |
* ), | |
* description="Customer ID" | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Success message" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="array", | |
* @OA\Items( | |
* type="object", | |
* // Define the properties of each margin detail data here | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message indicating unauthorized access" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message describing the internal server error" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getMarginDetails', function($request, $response){ | |
$payload = $request->getQueryParams(); | |
validate($payload, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
]); | |
//check CustID is same as token ID | |
if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$result = $this->customerModel->getMarginDetails($payload); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* Get Existing Margin Amount | |
* | |
* @OA\Get( | |
* path="/api/customer/getExistingMarginAmount", | |
* tags={"Customer"}, | |
* summary="Get existing margin amount for a customer", | |
* operationId="getExistingMarginAmount", | |
* @OA\Parameter( | |
* name="CustID", | |
* in="query", | |
* description="Customer ID", | |
* required=true, | |
* @OA\Schema( | |
* type="integer" | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="data", | |
* type="array", | |
* @OA\Items( | |
* type="object", | |
* // Define the properties of each existing margin amount data here | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message indicating unauthorized access" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message describing the internal server error" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getExistingMarginAmount', function($request, $response){ | |
$payload = $request->getQueryParams(); | |
validate($payload, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
]); | |
//check CustID is same as token ID | |
if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$result = $this->customerModel->getExistingMarginAmount($payload); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* Get Investment Summary | |
* | |
* @OA\Get( | |
* path="/api/customer/getInvestmentSummary", | |
* tags={"Customer"}, | |
* summary="Get investment summary for a customer", | |
* operationId="getInvestmentSummary", | |
* @OA\Parameter( | |
* name="CustID", | |
* in="query", | |
* description="Customer ID", | |
* required=true, | |
* @OA\Schema( | |
* type="integer" | |
* ) | |
* ), | |
* @OA\Parameter( | |
* name="ledgerType", | |
* in="query", | |
* description="Ledger Type", | |
* required=true, | |
* @OA\Schema( | |
* type="string" | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="data", | |
* type="array", | |
* @OA\Items( | |
* type="object", | |
* // Define the properties of each investment summary data here | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message indicating unauthorized access" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message describing the internal server error" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getInvestmentSummary', function($request, $response){ | |
$payload = $request->getQueryParams(); | |
validate($payload, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
'ledgerType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'ledgerType is required' | |
], | |
]); | |
//check CustID is same as token ID | |
$result = $this->customerModel->getInvestmentSummary($payload); | |
// dd($result); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}); | |
// ->add(new Authorization()) | |
// ->add(new auth()); | |
$app->get('/api/admin/getInvestmentSummary', function($request, $response){ | |
$payload = $request->getQueryParams(); | |
validate($payload, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
'ledgerType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'ledgerType is required' | |
], | |
]); | |
//check CustID is same as token ID | |
$result = $this->customerModel->getInvestmentSummary($payload); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
$app->get('/api/customer/computeEINReport', function($request, $response){ | |
$payload = $request->getQueryParams(); | |
validate($payload, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
] | |
]); | |
if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$payload["CAMID"] = $request->getAttribute('CAMID'); | |
$result = $this->customerModel->computeValuationReport($payload['CAMID']); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* Get Portal Margin Clients | |
* | |
* @OA\Get( | |
* path="/api/customer/getPortalMarginClients", | |
* tags={"Customer"}, | |
* summary="Get portal margin clients", | |
* operationId="getPortalMarginClients", | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="data", | |
* type="array", | |
* @OA\Items( | |
* type="object", | |
* // Define the properties of each portal margin client data here | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message indicating unauthorized access" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message describing the internal server error" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getPortalMarginClients', function($request, $response){ | |
$result = $this->customerModel->getPortalMarginClients(); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
/** | |
* Get Margin Accrued Interest | |
* | |
* @OA\Get( | |
* path="/api/customer/getMarginAccruedInterest", | |
* tags={"Customer"}, | |
* summary="Get margin accrued interest", | |
* operationId="getMarginAccruedInterest", | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="data", | |
* type="array", | |
* @OA\Items( | |
* type="object", | |
* // Define the properties of each margin accrued interest data here | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message indicating unauthorized access" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message describing the internal server error" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getMarginAccruedInterest', function($request, $response){ | |
$result = $this->customerModel->getMarginAccruedInterest(); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
/** | |
* Get Client Margin Accrued Interest | |
* | |
* @OA\Get( | |
* path="/api/customer/getClientMarginAccruedInterest", | |
* tags={"Customer"}, | |
* summary="Get accrued interest for a client's margin", | |
* operationId="getClientMarginAccruedInterest", | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="data", | |
* type="array", | |
* @OA\Items( | |
* type="object", | |
* // Define the properties of each client's margin accrued interest data here | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message indicating unauthorized access" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message describing the internal server error" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getClientMarginAccruedInterest', function($request, $response){ | |
$payload["CustID"] = $request->getAttribute('ID'); | |
$result = $this->customerModel->getClientMarginAccruedInterest($payload); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
$app->get('/api/feedbacks', function($request, $response){ | |
$result = $this->customerModel->fetchAllFeedbacks(); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}); | |
/** | |
* Get Margin Interest Log | |
* | |
* @OA\Get( | |
* path="/api/customer/getMarginInterestLog", | |
* tags={"Customer"}, | |
* summary="Get margin interest log", | |
* operationId="getMarginInterestLog", | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="data", | |
* type="array", | |
* @OA\Items( | |
* type="object", | |
* // Define the properties of each margin interest log data here | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message indicating unauthorized access" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message describing the internal server error" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getMarginInterestLog', function($request, $response){ | |
$result = $this->customerModel->getMarginInterestLog(); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
/* $app->post('/api/customer/rejectMarginApplication', function( $request, $response ) { | |
$payload = $request->getParsedBody(); | |
validate($payload, [ | |
'ID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'ID is required' | |
], | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
'admin' => [ | |
'rules' => V::notBlank(), | |
'message' => 'admin is required' | |
], | |
]); | |
$deal= $this->customerModel->rejectMarginApplication($payload); | |
return $response | |
->withStatus($deal['code'] ?? 200) | |
->withJson($deal['message']); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
$app->post('/api/customer/approveMarginApplication', function( $request, $response ) { | |
$payload = $request->getParsedBody(); | |
validate($payload, [ | |
'ID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'ID is required' | |
], | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
'CAMID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CAMID is required' | |
], | |
'SECID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'SECID is required' | |
], | |
'fullName' => [ | |
'rules' => V::notBlank(), | |
'message' => 'fullName is required' | |
], | |
'emailAddress' => [ | |
'rules' => V::notBlank(), | |
'message' => 'emailAddress is required' | |
], | |
'rate' => [ | |
'rules' => V::numeric(), | |
'message' => 'rate is required' | |
], | |
'portfolioValuation' => [ | |
'rules' => V::notBlank(), | |
'message' => 'portfolioValuation is required' | |
], | |
'loanAmount' => [ | |
'rules' => V::notBlank(), | |
'message' => 'loanAmount is required' | |
], | |
'loanType' => [ | |
'rules' => V::notBlank(), | |
'message' => 'loanType is required' | |
], | |
'collateral' => [ | |
'rules' => V::notBlank(), | |
'message' => 'collateral is required' | |
], | |
'collateralValue' => [ | |
'rules' => V::notBlank(), | |
'message' => 'collateralValue is required' | |
], | |
'admin' => [ | |
'rules' => V::notBlank(), | |
'message' => 'admin is required' | |
], | |
]); | |
$deal= $this->customerModel->approveMarginApplication($payload); | |
return $response | |
->withStatus($deal['code'] ?? 200) | |
->withJson($deal['message']); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
$app->post('/api/customer/postMarginTransaction', function($request, $response){ | |
$result = $this->customerModel->postMarginTransaction(); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
*/ | |
/** | |
* Compute Margin Interest | |
* | |
* @OA\Post( | |
* path="/api/customer/computeMarginInterest", | |
* tags={"Customer"}, | |
* summary="Compute margin interest", | |
* operationId="computeMarginInterest", | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="data", | |
* type="array", | |
* @OA\Items( | |
* type="object", | |
* // Define the properties of each computed margin interest data here | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message describing the internal server error" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
// $app->post('/api/customer/computeMarginInterest', function($request, $response){ | |
// $result = $this->customerModel->computeMarginInterest(); | |
// return $response | |
// ->withStatus(200) | |
// ->withJson($result); | |
// }); | |
// ->add(new AdminAuthorization()) | |
// ->add(new auth()); | |
/** | |
* Compute Margin Interest | |
* | |
* @OA\Get( | |
* path="/api/customer/computeMarginInterest", | |
* tags={"Customer"}, | |
* summary="Compute margin interest", | |
* operationId="computeMarginInterest", | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="data", | |
* type="array", | |
* @OA\Items( | |
* type="object", | |
* // Define the properties of each computed margin interest data here | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message describing the internal server error" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
// ->add(new AdminAuthorization()) | |
// ->add(new auth()); | |
/** | |
* Get Margin Defaulters | |
* | |
* @OA\Get( | |
* path="/api/customer/getMarginDefaulters", | |
* tags={"Customer"}, | |
* summary="Get margin defaulters", | |
* operationId="getMarginDefaulters", | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="data", | |
* type="array", | |
* @OA\Items( | |
* type="object", | |
* // Define the properties of each margin defaulter data here | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message describing the internal server error" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getMarginDefaulters', function($request, $response){ | |
$result = $this->customerModel->getMarginDefaulters(); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}); | |
// ->add(new AdminAuthorization()) | |
// ->add(new auth()); | |
/** | |
* Post Margin Interest | |
* | |
* @OA\Post( | |
* path="/api/customer/postMarginInterest", | |
* tags={"Customer"}, | |
* summary="Post margin interest", | |
* operationId="postMarginInterest", | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="data", | |
* type="array", | |
* @OA\Items( | |
* type="object", | |
* // Define the properties of each posted margin interest data here | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message describing the internal server error" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->post('/api/customer/postMarginInterest', function($request, $response){ | |
$result = $this->customerModel->postMarginInterest(); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}); | |
// ->add(new AdminAuthorization()) | |
// ->add(new auth()); | |
/** | |
* Post Margin Interest | |
* | |
* @OA\Get( | |
* path="/api/customer/postMarginInterest", | |
* tags={"Customer"}, | |
* summary="Post margin interest", | |
* operationId="postMarginInterest", | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="data", | |
* type="array", | |
* @OA\Items( | |
* type="object", | |
* // Define the properties of each posted margin interest data here | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message describing the internal server error" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/postMarginInterest', function($request, $response){ | |
$result = $this->customerModel->postMarginInterest(); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}); | |
// ->add(new AdminAuthorization()) | |
// ->add(new auth()); | |
/** | |
* Notify Margin Defaulters | |
* | |
* @OA\Get( | |
* path="/api/customer/notifyMarginDefaulters", | |
* tags={"Customer"}, | |
* summary="Notify margin defaulters", | |
* operationId="notifyMarginDefaulters", | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="data", | |
* type="array", | |
* @OA\Items( | |
* type="object", | |
* // Define the properties of each notification data here | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message describing the internal server error" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/notifyMarginDefaulters', function($request, $response){ | |
$result = $this->customerModel->notifyMarginDefaulters(); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}); | |
// ->add(new AdminAuthorization()) | |
// ->add(new auth()); | |
/* $app->get('/api/customer/computeMarginDefaulters', function($request, $response){ | |
$result = $this->customerModel->computeMarginDefaulters(); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}); | |
// ->add(new AdminAuthorization()) | |
// ->add(new auth()); */ | |
/** | |
* Get Valuation Fee | |
* | |
* @OA\Get( | |
* path="/api/customer/getValuationFee", | |
* tags={"Customer"}, | |
* summary="Get valuation fee", | |
* operationId="getValuationFee", | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="data", | |
* type="array", | |
* @OA\Items( | |
* type="object", | |
* // Define the properties of each valuation fee data here | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message describing the internal server error" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getValuationFee', function($request, $response){ | |
$result = $this->customerModel->getValuationFee(); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}); | |
// ->add(new AdminAuthorization()) | |
// ->add(new auth()); | |
/** | |
* EIN Valuation Report | |
* | |
* @OA\Post( | |
* path="/api/customer/EINValuationReport", | |
* tags={"Customer"}, | |
* summary="Generate EIN Valuation Report", | |
* operationId="EINValuationReport", | |
* @OA\RequestBody( | |
* required=true, | |
* description="JSON object containing investmentDate, rate, and principal", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="investmentDate", | |
* type="string", | |
* description="The investment date" | |
* ), | |
* @OA\Property( | |
* property="rate", | |
* type="number", | |
* description="The rate" | |
* ), | |
* @OA\Property( | |
* property="principal", | |
* type="string", | |
* description="The principal amount" | |
* ), | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="data", | |
* type="array", | |
* @OA\Items( | |
* type="object", | |
* // Define the properties of each EIN valuation report data here | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message describing the internal server error" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->post('/api/customer/EINValuationReport', function($request, $response){ | |
$payload = $request->getParsedBody(); | |
validate($payload, [ | |
'investmentDate' => [ | |
'rules' => V::notBlank(), | |
'message' => 'investmentDate is required' | |
], | |
'rate' => [ | |
'rules' => V::numeric(), | |
'message' => 'rate is required' | |
], | |
'principal' => [ | |
'rules' => V::notBlank(), | |
'message' => 'principal is required' | |
], | |
]); | |
$result = $this->customerModel->EINValuationReport($payload); | |
return $response | |
->withStatus(200) | |
->withJson($result); | |
}); | |
// ->add(new AdminAuthorization()) | |
// ->add(new auth()); | |
/** | |
* Purchase Voucher | |
* | |
* @OA\Post( | |
* path="/api/customer/purchaseVoucher", | |
* tags={"Customer"}, | |
* summary="Purchase voucher", | |
* operationId="purchaseVoucher", | |
* @OA\RequestBody( | |
* required=true, | |
* description="JSON object containing voucher purchase details", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="CustID", | |
* type="string", | |
* description="The customer ID" | |
* ), | |
* @OA\Property( | |
* property="recipientFullName", | |
* type="string", | |
* description="The full name of the recipient" | |
* ), | |
* @OA\Property( | |
* property="recipientEmailAddress", | |
* type="string", | |
* description="The email address of the recipient" | |
* ), | |
* @OA\Property( | |
* property="recipientPhoneNumber", | |
* type="string", | |
* description="The phone number of the recipient" | |
* ), | |
* @OA\Property( | |
* property="voucherValue", | |
* type="string", | |
* description="The value of the voucher" | |
* ), | |
* @OA\Property( | |
* property="transactionID", | |
* type="string", | |
* description="The transaction ID" | |
* ), | |
* @OA\Property( | |
* property="companyName", | |
* type="string", | |
* description="The name of the company (CSS/CAM)" | |
* ), | |
* @OA\Property( | |
* property="channel", | |
* type="string", | |
* description="The channel used for the purchase" | |
* ), | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="code", | |
* type="integer", | |
* description="Status code indicating the success of the purchase (e.g., 200 for success)" | |
* ), | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message indicating unauthorized access" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message describing the internal server error" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
// $app->post('/api/customer/purchaseVoucher', function($request, $response){ | |
// $payload = $request->getParsedBody(); | |
// validate($payload, [ | |
// 'CustID' => [ | |
// 'rules' => V::notBlank(), | |
// 'message' => 'CustID is required' | |
// ], | |
// 'recipientFullName' => [ | |
// 'rules' => V::notBlank(), | |
// 'message' => 'recipientFullName is required' | |
// ], | |
// 'recipientEmailAddress' => [ | |
// 'rules' => V::notBlank(), | |
// 'message' => 'recipientEmailAddress is required' | |
// ], | |
// 'recipientPhoneNumber' => [ | |
// 'rules' => V::notBlank(), | |
// 'message' => 'recipientPhoneNumber is required' | |
// ], | |
// 'voucherValue' => [ | |
// 'rules' => V::notBlank(), | |
// 'message' => 'voucherValue is required' | |
// ], | |
// 'transactionID' => [ | |
// 'rules' => V::notBlank(), | |
// 'message' => 'transactionID is required' | |
// ], | |
// /* 'accountOfficerEmail' => [ | |
// 'rules' => V::notBlank(), | |
// 'message' => 'accountOfficerEmail is required' | |
// ], */ | |
// 'companyName' => [ | |
// 'rules' => V::notBlank(), | |
// 'message' => 'companyName (CSS/CAM) is required' | |
// ], | |
// 'channel' => [ | |
// 'rules' => V::notBlank(), | |
// 'message' => 'channel is required' | |
// ], | |
// ]); | |
// if($payload["CustID"] != $request->getAttribute('ID')) | |
// { | |
// return $response | |
// ->withStatus(401) | |
// ->withJson(["message" => "Unauthorized Access"]); | |
// } | |
// $payload["senderFullName"] = $request->getAttribute('name'); | |
// $payload["senderPhoneNumber"] = $request->getAttribute('phone'); | |
// $payload["senderEmailAddress"] = $request->getAttribute('email'); | |
// $result = $this->customerModel->purchaseVoucher($payload); | |
// return $response | |
// ->withStatus($result["code"] ?? 200); | |
// // ->withJson($result); | |
// }) | |
// ->add(new Authorization()) | |
// ->add(new auth()); | |
/** | |
* Verify Voucher | |
* | |
* @OA\Post( | |
* path="/api/customer/verifyVoucher", | |
* tags={"Customer"}, | |
* summary="Verify voucher", | |
* operationId="verifyVoucher", | |
* @OA\RequestBody( | |
* required=true, | |
* description="JSON object containing voucher verification details", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="CustID", | |
* type="string", | |
* description="The customer ID" | |
* ), | |
* @OA\Property( | |
* property="voucherCode", | |
* type="string", | |
* description="The voucher code to be verified" | |
* ), | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="code", | |
* type="integer", | |
* description="Status code indicating the success of the verification (e.g., 200 for success)" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="array", | |
* @OA\Items( | |
* type="object", | |
* // Define the properties of each verification data here | |
* ) | |
* ), | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message indicating unauthorized access" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message describing the internal server error" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->post('/api/customer/verifyVoucher', function($request, $response){ | |
$payload = $request->getParsedBody(); | |
validate($payload, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
'voucherCode' => [ | |
'rules' => V::notBlank(), | |
'message' => 'voucherCode is required' | |
], | |
]); | |
if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$result = $this->customerModel->verifyVoucher($payload); | |
return $response | |
->withStatus($result["code"] ?? 200) | |
->withJson($result); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* Redeem Voucher | |
* | |
* @OA\Post( | |
* path="/api/customer/redeemVoucher", | |
* tags={"Customer"}, | |
* summary="Redeem voucher", | |
* operationId="redeemVoucher", | |
* @OA\RequestBody( | |
* required=true, | |
* description="JSON object containing voucher redemption details", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="CustID", | |
* type="string", | |
* description="The customer ID" | |
* ), | |
* @OA\Property( | |
* property="voucherCode", | |
* type="string", | |
* description="The voucher code to be redeemed" | |
* ), | |
* @OA\Property( | |
* property="voucherProduct", | |
* type="string", | |
* description="The product associated with the voucher" | |
* ), | |
* @OA\Property( | |
* property="cash_account_id", | |
* type="string", | |
* description="The ID of the cash account" | |
* ), | |
* @OA\Property( | |
* property="companyName", | |
* type="string", | |
* description="The name of the company (CSS/CAM)" | |
* ), | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="code", | |
* type="integer", | |
* description="Status code indicating the success of the redemption (e.g., 200 for success)" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="array", | |
* @OA\Items( | |
* type="object", | |
* // Define the properties of each redemption data here | |
* ) | |
* ), | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message indicating unauthorized access" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message describing the internal server error" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
// $app->post('/api/customer/redeemVoucher', function($request, $response){ | |
// $payload = $request->getParsedBody(); | |
// validate($payload, [ | |
// 'CustID' => [ | |
// 'rules' => V::notBlank(), | |
// 'message' => 'CustID is required' | |
// ], | |
// 'voucherCode' => [ | |
// 'rules' => V::notBlank(), | |
// 'message' => 'voucherCode is required' | |
// ], | |
// 'voucherProduct' => [ | |
// 'rules' => V::notBlank(), | |
// 'message' => 'voucherProduct is required' | |
// ], | |
// 'cash_account_id' => [ | |
// 'rules' => V::notBlank(), | |
// 'message' => 'cash_account_id is required' | |
// ], | |
// 'companyName' => [ | |
// 'rules' => V::notBlank(), | |
// 'message' => 'companyName (CSS/CAM) is required' | |
// ], | |
// ]); | |
// if($payload["CustID"] != $request->getAttribute('ID')) | |
// { | |
// return $response | |
// ->withStatus(401) | |
// ->withJson(["message" => "Unauthorized Access"]); | |
// } | |
// $payload["CAMID"] = $request->getAttribute('CAMID'); | |
// $payload["SECID"] = $request->getAttribute('SECID'); | |
// $payload["ASSETID"] = $request->getAttribute('ASSETID'); | |
// $payload["fullName"] = $request->getAttribute('name'); | |
// $payload["emailAddress"] = $request->getAttribute('email'); | |
// $result = $this->customerModel->redeemVoucher($payload); | |
// return $response | |
// ->withStatus($result["code"] ?? 200) | |
// ->withJson($result); | |
// }) | |
// ->add(new Authorization()) | |
// ->add(new auth()); | |
/** | |
* Valuation Report | |
* | |
* @OA\Post( | |
* path="/api/customer/valuationReport", | |
* tags={"Customer"}, | |
* summary="Generate valuation report", | |
* operationId="valuationReport", | |
* @OA\RequestBody( | |
* required=true, | |
* description="Multipart/form-data containing valuation report details", | |
* @OA\MediaType( | |
* mediaType="multipart/form-data", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="CustID", | |
* type="string", | |
* description="The customer ID" | |
* ), | |
* @OA\Property( | |
* property="fullName", | |
* type="string", | |
* description="The full name of the customer" | |
* ), | |
* @OA\Property( | |
* property="emailAddress", | |
* type="string", | |
* description="The email address of the customer" | |
* ), | |
* @OA\Property( | |
* property="company", | |
* type="string", | |
* description="The name of the company (CSS/CAM)" | |
* ), | |
* @OA\Property( | |
* property="files", | |
* type="file", | |
* description="The valuation report file(s)" | |
* ), | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="code", | |
* type="integer", | |
* description="Status code indicating the success of the valuation report generation (e.g., 200 for success)" | |
* ), | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message indicating unauthorized access" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message describing the internal server error" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->post('/api/customer/valuationReport', function ($request, $response) { | |
$payload = array_merge(["files" => $request->getUploadedFiles(),], $request->getParsedBody()); | |
// var_dump($payload); | |
validate($payload, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
'fullName' => [ | |
'rules' => V::notBlank(), | |
'message' => 'fullName is required' | |
], | |
'emailAddress' => [ | |
'rules' => V::notBlank(), | |
'message' => 'emailAddress is required' | |
], | |
// 'transactionID' => [ | |
// 'rules' => V::notBlank(), | |
// 'message' => 'transactionID is required' | |
// ], | |
'company' => [ | |
'rules' => V::notBlank(), | |
'message' => 'company (CSS/CAM) is required' | |
], | |
'files' => [ | |
'rules' => V::notBlank(), | |
'message' => 'report file is required' | |
], | |
// 'channel' => [ | |
// 'rules' => V::notBlank(), | |
// 'message' => 'channel file is required' | |
// ], | |
]); | |
if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$payload["CAMID"] == $request->getAttribute('CAMID'); | |
$payload["SECID"] == $request->getAttribute('SECID'); | |
$payload["ASSETID"] == $request->getAttribute('ASSETID'); | |
$result = $this->customerModel->valuationReport($payload); | |
return $response | |
->withStatus($result['code'] ?? 200); | |
// ->withJson(['data' => $result['message']]); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
$app->post('/api/admin/valuationReport', function ($request, $response) { | |
$payload = array_merge(["files" => $request->getUploadedFiles(),], $request->getParsedBody()); | |
// var_dump($payload); | |
validate($payload, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
'fullName' => [ | |
'rules' => V::notBlank(), | |
'message' => 'fullName is required' | |
], | |
'emailAddress' => [ | |
'rules' => V::notBlank(), | |
'message' => 'emailAddress is required' | |
], | |
// 'transactionID' => [ | |
// 'rules' => V::notBlank(), | |
// 'message' => 'transactionID is required' | |
// ], | |
'company' => [ | |
'rules' => V::notBlank(), | |
'message' => 'company (CSS/CAM) is required' | |
], | |
'files' => [ | |
'rules' => V::notBlank(), | |
'message' => 'report file is required' | |
], | |
// 'channel' => [ | |
// 'rules' => V::notBlank(), | |
// 'message' => 'channel file is required' | |
// ], | |
]); | |
$customerInfo = $this->customerModel->getCustomerDetails($payload['CustID']); | |
if (!$customerInfo) | |
{ | |
throw new Exception('Unable to find customer ' . $payload['CustID']); | |
} | |
//fetch product information | |
$payload['SECID'] = $customerInfo['SECID']; | |
$payload['ASSETID'] = $customerInfo['ASSETID']; | |
$payload["CAMID"] = $customerInfo['CAMID']; | |
$result = $this->customerModel->valuationReport($payload); | |
return $response | |
->withStatus($result['code'] ?? 200); | |
// ->withJson(['data' => $result['message']]); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
/** | |
* Add Bank Account | |
* | |
* @OA\Post( | |
* path="/api/customer/addBankAccount", | |
* tags={"Customer"}, | |
* summary="Add bank account", | |
* operationId="addBankAccount", | |
* @OA\RequestBody( | |
* required=true, | |
* description="Multipart/form-data containing bank account details", | |
* @OA\MediaType( | |
* mediaType="multipart/form-data", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="CustID", | |
* type="string", | |
* description="The customer ID" | |
* ), | |
* @OA\Property( | |
* property="bankAcctName", | |
* type="string", | |
* description="The name of the bank account" | |
* ), | |
* @OA\Property( | |
* property="bankAcctNumber", | |
* type="string", | |
* description="The bank account number" | |
* ), | |
* @OA\Property( | |
* property="BVNNumber", | |
* type="string", | |
* description="The BVN (Bank Verification Number)" | |
* ), | |
* @OA\Property( | |
* property="sortCode", | |
* type="string", | |
* description="The sort code of the bank account" | |
* ), | |
* @OA\Property( | |
* property="bankCode", | |
* type="string", | |
* description="The bank code of the bank account" | |
* ), | |
* @OA\Property( | |
* property="files", | |
* type="file", | |
* description="Any additional files related to the bank account (e.g., documents)" | |
* ), | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="code", | |
* type="integer", | |
* description="Status code indicating the success of adding the bank account (e.g., 200 for success)" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="A message indicating the success or details of the operation" | |
* ) | |
* ), | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message indicating unauthorized access" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message describing the internal server error" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->post('/api/customer/addBankAccount', function ($request, $response) { | |
$payload = array_merge(["files" => $request->getUploadedFiles(),], $request->getParsedBody()); | |
// var_dump($payload); | |
validate($payload, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
'bankAcctName' => [ | |
'rules' => V::notBlank(), | |
'message' => 'bankAcctName is required' | |
], | |
'bankAcctNumber' => [ | |
'rules' => V::notBlank(), | |
'message' => 'bankAcctNumber is required' | |
], | |
'BVNNumber' => [ | |
'rules' => V::notBlank(), | |
'message' => 'BVNNumber is required' | |
], | |
'sortCode' => [ | |
'rules' => V::notBlank(), | |
'message' => 'sortCode is required' | |
], | |
'bankCode' => [ | |
'rules' => V::notBlank(), | |
'message' => 'bankCode is required' | |
], | |
]); | |
if($payload["CustID"] != $request->getAttribute('ID')) | |
{ | |
return $response | |
->withStatus(401) | |
->withJson(["message" => "Unauthorized Access"]); | |
} | |
$payload["CAMID"] == $request->getAttribute('CAMID'); | |
$payload["SECID"] == $request->getAttribute('SECID'); | |
$payload["ASSETID"] == $request->getAttribute('ASSETID'); | |
$result = $this->customerModel->addBankAccount($payload); | |
return $response | |
->withStatus($result['code'] ?? 200) | |
->withJson(['data' => $result['message']]); | |
}) | |
->add(new Authorization()) | |
->add(new auth()); | |
/** | |
* Get Inter-Bank Report | |
* | |
* @OA\Get( | |
* path="/api/customer/getInterBankReport", | |
* tags={"Customer"}, | |
* summary="Get inter-bank report", | |
* operationId="getInterBankReport", | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="code", | |
* type="integer", | |
* description="Status code indicating the success of getting the inter-bank report (e.g., 200 for success)" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="A message indicating the success or details of the operation" | |
* ), | |
* @OA\Property( | |
* property="report", | |
* type="array", | |
* @OA\Items( | |
* type="object", | |
* // Define the properties of each inter-bank report data here | |
* ) | |
* ) | |
* ), | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message indicating unauthorized access" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message describing the internal server error" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getInterBankReport', function($request, $response){ | |
$result = $this->customerModel->getInterBankReport(); | |
return $response | |
->withStatus($result["code"] ?? 200) | |
->withJson($result); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
/** | |
* Update Inter-Bank Report | |
* | |
* @OA\Post( | |
* path="/api/customer/updateInterBankReport", | |
* tags={"Customer"}, | |
* summary="Update inter-bank report", | |
* operationId="updateInterBankReport", | |
* @OA\RequestBody( | |
* required=true, | |
* description="JSON payload containing the updated inter-bank report data", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="id", | |
* type="string", | |
* description="The ID of the inter-bank report to be updated" | |
* ), | |
* // Define other properties of the inter-bank report data that can be updated here | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="code", | |
* type="integer", | |
* description="Status code indicating the success of updating the inter-bank report (e.g., 200 for success)" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="A message indicating the success or details of the operation" | |
* ) | |
* ), | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message indicating unauthorized access" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message describing the internal server error" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->post('/api/customer/updateInterBankReport', function($request, $response){ | |
$payload = $request->getParsedBody(); | |
/* | |
validate($payload, [ | |
'id' => [ | |
'rules' => V::notBlank(), | |
'message' => 'id is required' | |
], | |
]); */ | |
$result = $this->customerModel->updateInterBankReport($payload); | |
return $response | |
->withStatus($result["code"] ?? 200) | |
->withJson($result); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
/** | |
* Get Active Directory (AD) User Details | |
* | |
* @OA\Get( | |
* path="/api/customer/adUserDetails", | |
* tags={"Customer"}, | |
* summary="Get Active Directory (AD) user details", | |
* operationId="adUserDetails", | |
* @OA\Parameter( | |
* name="userName", | |
* in="query", | |
* required=true, | |
* description="The username of the Active Directory (AD) user", | |
* @OA\Schema( | |
* type="string" | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="code", | |
* type="integer", | |
* description="Status code indicating the success of getting the AD user details (e.g., 200 for success)" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="A message indicating the success or details of the operation" | |
* ), | |
* @OA\Property( | |
* property="user", | |
* type="object", | |
* // Define the properties of the AD user data here | |
* ) | |
* ), | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=400, | |
* description="Bad Request", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message indicating a bad request (e.g., missing parameters)" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message indicating unauthorized access" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message describing the internal server error" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/adUserDetails', function($request, $response){ | |
validate($request, [ | |
'userName' => [ | |
'rules' => V::notBlank(), | |
'message' => 'userName is required' | |
], | |
]); | |
$payload = $request->getQueryParams(); | |
$result = $this->customerModel->adUserDetails($payload["userName"]); | |
return $response | |
->withStatus($result["code"] ?? 200) | |
->withJson($result); | |
}); | |
// ->add(new AdminAuthorization()) | |
// ->add(new auth()); | |
/** | |
* Get Expired KYC Records | |
* | |
* @OA\Get( | |
* path="/api/customer/expiredKYC", | |
* tags={"Customer"}, | |
* summary="Get expired KYC records", | |
* operationId="expiredKYC", | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="code", | |
* type="integer", | |
* description="Status code indicating the success of getting expired KYC records (e.g., 200 for success)" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="A message indicating the success or details of the operation" | |
* ), | |
* @OA\Property( | |
* property="records", | |
* type="array", | |
* @OA\Items( | |
* type="object", | |
* // Define the properties of each expired KYC record here | |
* ) | |
* ) | |
* ), | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message indicating unauthorized access" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message describing the internal server error" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/expiredKYC', function($request, $response){ | |
$result = $this->customerModel->expiredKYC(); | |
return $response | |
->withStatus($result["code"] ?? 200) | |
->withJson($result); | |
}); | |
// ->add(new AdminAuthorization()) | |
// ->add(new auth()); | |
/** | |
* Get Margin Interest Rate | |
* | |
* @OA\Get( | |
* path="/api/customer/getMarginInterestRate", | |
* tags={"Customer"}, | |
* summary="Get margin interest rate", | |
* operationId="getMarginInterestRate", | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="code", | |
* type="integer", | |
* description="Status code indicating the success of getting the margin interest rate (e.g., 200 for success)" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="A message indicating the success or details of the operation" | |
* ), | |
* @OA\Property( | |
* property="interestRate", | |
* type="number", | |
* description="The current margin interest rate" | |
* ) | |
* ), | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message indicating unauthorized access" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message describing the internal server error" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getMarginInterestRate', function($request, $response){ | |
$result = $this->customerModel->getMarginInterestRate(); | |
return $response | |
->withStatus($result["code"] ?? 200) | |
->withJson($result); | |
}); | |
// ->add(new AdminAuthorization()) | |
// ->add(new auth()); | |
/** | |
* Update Margin Interest Rate | |
* | |
* @OA\Post( | |
* path="/api/customer/updateMarginInterestRate", | |
* tags={"Customer"}, | |
* summary="Update the margin interest rate", | |
* operationId="updateMarginInterestRate", | |
* @OA\RequestBody( | |
* required=true, | |
* description="JSON object containing the staff and commercial interest rates", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* required={"staff", "commercial"}, | |
* @OA\Property( | |
* property="staff", | |
* type="number", | |
* description="The new staff interest rate" | |
* ), | |
* @OA\Property( | |
* property="commercial", | |
* type="number", | |
* description="The new commercial interest rate" | |
* ), | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="code", | |
* type="integer", | |
* description="Status code indicating the success of updating the margin interest rate (e.g., 200 for success)" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="A message indicating the success or details of the operation" | |
* ) | |
* ), | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message indicating unauthorized access" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message describing the internal server error" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->post('/api/customer/updateMarginInterestRate', function($request, $response){ | |
validate($request, [ | |
'staff' => [ | |
'rules' => V::notBlank(), | |
'message' => 'staff is required' | |
], | |
'commercial' => [ | |
'rules' => V::notBlank(), | |
'message' => 'commercial is required' | |
], | |
]); | |
$payload = $request->getParsedBody(); | |
$payload["admin"] = $request->getAttribute('fullName'); | |
$result = $this->customerModel->updateMarginInterestRate($payload); | |
return $response | |
->withStatus($result["code"] ?? 200) | |
->withJson($result); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
/** | |
* Get CAMAUM Products | |
* | |
* @OA\Get( | |
* path="/api/customer/getCAMAUMProducts", | |
* tags={"Customer"}, | |
* summary="Get CAMAUM products", | |
* operationId="getCAMAUMProducts", | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="code", | |
* type="integer", | |
* description="Status code indicating the success of getting CAMAUM products (e.g., 200 for success)" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="A message indicating the success or details of the operation" | |
* ), | |
* @OA\Property( | |
* property="products", | |
* type="array", | |
* @OA\Items( | |
* type="object", | |
* // Define the properties of each CAMAUM product here | |
* ) | |
* ) | |
* ), | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message indicating unauthorized access" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message describing the internal server error" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getCAMAUMProducts', function($request, $response){ | |
$result = $this->customerModel->getCAMAUMProducts(); | |
return $response | |
->withStatus($result["code"] ?? 200) | |
->withJson($result); | |
}); | |
// ->add(new AdminAuthorization()) | |
// ->add(new auth()); | |
/** | |
* Get CAMAUM | |
* | |
* @OA\Get( | |
* path="/api/customer/getCAMAUM", | |
* tags={"Customer"}, | |
* summary="Get CAMAUM", | |
* operationId="getCAMAUM", | |
* @OA\Parameter( | |
* name="cashAccount", | |
* in="query", | |
* required=true, | |
* description="The cash account number", | |
* @OA\Schema( | |
* type="string" | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="code", | |
* type="integer", | |
* description="Status code indicating the success of getting CAMAUM data (e.g., 200 for success)" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="A message indicating the success or details of the operation" | |
* ), | |
* @OA\Property( | |
* property="camaum_data", | |
* type="array", | |
* @OA\Items( | |
* type="object", | |
* // Define the properties of each CAMAUM data here | |
* ) | |
* ) | |
* ), | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message indicating unauthorized access" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message describing the internal server error" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getCAMAUM', function($request, $response){ | |
validate($request, [ | |
/* 'date' => [ | |
'rules' => V::notBlank(), | |
'message' => 'date is required' | |
], */ | |
'cashAccount' => [ | |
'rules' => V::notBlank(), | |
'message' => 'cashAccount is required' | |
], | |
]); | |
$payload = $request->getQueryParams(); | |
$result = $this->customerModel->getCAMAUM($payload); | |
return $response | |
->withStatus($result["code"] ?? 200) | |
->withJson($result); | |
}); | |
// ->add(new AdminAuthorization()) | |
// ->add(new auth()); | |
/** | |
* Get SMA EQAUM | |
* | |
* @OA\Get( | |
* path="/api/customer/getSMAEQAUM", | |
* tags={"Customer"}, | |
* summary="Get SMA EQAUM", | |
* operationId="getSMAEQAUM", | |
* @OA\Parameter( | |
* name="startDate", | |
* in="query", | |
* required=true, | |
* description="The start date for retrieving SMA EQAUM", | |
* @OA\Schema( | |
* type="string", | |
* format="date" | |
* ) | |
* ), | |
* @OA\Parameter( | |
* name="endDate", | |
* in="query", | |
* required=true, | |
* description="The end date for retrieving SMA EQAUM", | |
* @OA\Schema( | |
* type="string", | |
* format="date" | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="code", | |
* type="integer", | |
* description="Status code indicating the success of getting SMA EQAUM data (e.g., 200 for success)" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="A message indicating the success or details of the operation" | |
* ), | |
* @OA\Property( | |
* property="sma_eqaum_data", | |
* type="array", | |
* @OA\Items( | |
* type="object", | |
* // Define the properties of each SMA EQAUM data here | |
* ) | |
* ) | |
* ), | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message indicating unauthorized access" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message describing the internal server error" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getSMAEQAUM', function($request, $response){ | |
$payload = $request->getQueryParams(); | |
$result = $this->customerModel->getSMAEQAUM($payload); | |
return $response | |
->withStatus($result["code"] ?? 200) | |
->withJson($result); | |
}); | |
// ->add(new AdminAuthorization()) | |
// ->add(new auth()); | |
/** | |
* Get SEC AUM | |
* | |
* @OA\Get( | |
* path="/api/customer/getSECAUM", | |
* tags={"Customer"}, | |
* summary="Get SEC AUM", | |
* operationId="getSECAUM", | |
* @OA\Parameter( | |
* name="startDate", | |
* in="query", | |
* required=true, | |
* description="The start date for retrieving SEC AUM", | |
* @OA\Schema( | |
* type="string", | |
* format="date" | |
* ) | |
* ), | |
* @OA\Parameter( | |
* name="endDate", | |
* in="query", | |
* required=true, | |
* description="The end date for retrieving SEC AUM", | |
* @OA\Schema( | |
* type="string", | |
* format="date" | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="code", | |
* type="integer", | |
* description="Status code indicating the success of getting SEC AUM data (e.g., 200 for success)" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="A message indicating the success or details of the operation" | |
* ), | |
* @OA\Property( | |
* property="sec_aum_data", | |
* type="array", | |
* @OA\Items( | |
* type="object", | |
* // Define the properties of each SEC AUM data here | |
* ) | |
* ) | |
* ), | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message indicating unauthorized access" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message describing the internal server error" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getSECAUM', function($request, $response){ | |
/* validate($request, [ | |
'date' => [ | |
'rules' => V::notBlank(), | |
'message' => 'date is required' | |
], | |
]); */ | |
$payload = $request->getQueryParams(); | |
$result = $this->customerModel->getSECAUM($payload); | |
return $response | |
->withStatus($result["code"] ?? 200) | |
->withJson($result); | |
}); | |
// ->add(new AdminAuthorization()) | |
// ->add(new auth()); | |
/** | |
* Add SPA Client | |
* | |
* @OA\Post( | |
* path="/api/customer/addSPAClient", | |
* tags={"Customer"}, | |
* summary="Add SPA Client", | |
* operationId="addSPAClient", | |
* @OA\RequestBody( | |
* required=true, | |
* description="JSON object containing data for adding SPA client", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="CustID", | |
* type="string", | |
* description="The ID of the customer to whom the SPA client is added" | |
* ), | |
* // Define other properties of the SPA client to be added here | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="code", | |
* type="integer", | |
* description="Status code indicating the success of adding SPA client (e.g., 200 for success)" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="A message indicating the success or details of the operation" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message indicating unauthorized access" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message describing the internal server error" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->post('/api/customer/addSPAClient', function($request, $response){ | |
validate($request, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
]); | |
$payload = $request->getParsedBody(); | |
// $payload['SECID'] = $request->getAttribute('SECID'); | |
$result = $this->customerModel->addSPAClient($payload); | |
return $response | |
->withStatus($result["code"] ?? 200) | |
->withJson($result); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
/** | |
* Update SPA Client | |
* | |
* @OA\Post( | |
* path="/api/customer/updateSPAClient", | |
* tags={"Customer"}, | |
* summary="Update SPA Client", | |
* operationId="updateSPAClient", | |
* @OA\RequestBody( | |
* required=true, | |
* description="JSON object containing data for updating SPA client", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="CustID", | |
* type="string", | |
* description="The ID of the customer whose SPA client is to be updated" | |
* ), | |
* // Define other properties of the SPA client to be updated here | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="code", | |
* type="integer", | |
* description="Status code indicating the success of updating SPA client (e.g., 200 for success)" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="A message indicating the success or details of the operation" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message indicating unauthorized access" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message describing the internal server error" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->post('/api/customer/updateSPAClient', function($request, $response){ | |
validate($request, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
]); | |
$payload = $request->getParsedBody(); | |
$result = $this->customerModel->updateSPAClient($payload); | |
return $response | |
->withStatus($result["code"] ?? 200) | |
->withJson($result); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
/** | |
* Remove SPA Client | |
* | |
* @OA\Post( | |
* path="/api/customer/removeSPAClient", | |
* tags={"Customer"}, | |
* summary="Remove SPA Client", | |
* operationId="removeSPAClient", | |
* @OA\RequestBody( | |
* required=true, | |
* description="JSON object containing data for removing SPA client", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="CustID", | |
* type="string", | |
* description="The ID of the customer whose SPA client is to be removed" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="code", | |
* type="integer", | |
* description="Status code indicating the success of removing SPA client (e.g., 200 for success)" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="A message indicating the success or details of the operation" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message indicating unauthorized access" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message describing the internal server error" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->post('/api/customer/removeSPAClient', function($request, $response){ | |
validate($request, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
]); | |
$payload = $request->getParsedBody(); | |
$result = $this->customerModel->removeSPAClient($payload); | |
return $response | |
->withStatus($result["code"] ?? 200) | |
->withJson($result); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
/** | |
* Get SPA Client | |
* | |
* @OA\Get( | |
* path="/api/customer/getSPAClient", | |
* tags={"Customer"}, | |
* summary="Get SPA Client", | |
* operationId="getSPAClient", | |
* security={{"AdminAuthorization": {}}, {"auth": {}}}, | |
* @OA\Parameter( | |
* name="CustID", | |
* in="query", | |
* required=true, | |
* description="The ID of the customer to retrieve SPA client", | |
* @OA\Schema(type="string") | |
* ), | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="code", | |
* type="integer", | |
* description="Status code indicating the success of the operation (e.g., 200 for success)" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="A message indicating the success or details of the operation" | |
* ), | |
* @OA\Property( | |
* property="spaClient", | |
* type="object", | |
* description="The SPA client data retrieved for the customer" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message indicating unauthorized access" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message describing the internal server error" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getSPAClient', function($request, $response){ | |
validate($request, [ | |
'CustID' => [ | |
'rules' => V::notBlank(), | |
'message' => 'CustID is required' | |
], | |
]); | |
$payload = $request->getParsedBody(); | |
$result = $this->customerModel->getSPAClient($payload); | |
return $response | |
->withStatus($result["code"] ?? 200) | |
->withJson($result); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
/** | |
* Get All SPA Clients | |
* | |
* @OA\Get( | |
* path="/api/customer/getSPAClients", | |
* tags={"Customer"}, | |
* summary="Get All SPA Clients", | |
* operationId="getSPAClients", | |
* security={{"AdminAuthorization": {}}, {"auth": {}}}, | |
* @OA\Response( | |
* response=200, | |
* description="Success", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="code", | |
* type="integer", | |
* description="Status code indicating the success of the operation (e.g., 200 for success)" | |
* ), | |
* @OA\Property( | |
* property="data", | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="A message indicating the success or details of the operation" | |
* ), | |
* @OA\Property( | |
* property="spaClients", | |
* type="array", | |
* @OA\Items( | |
* type="object", | |
* description="The SPA client data retrieved" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=401, | |
* description="Unauthorized", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message indicating unauthorized access" | |
* ) | |
* ) | |
* ) | |
* ), | |
* @OA\Response( | |
* response=500, | |
* description="Internal Server Error", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="message", | |
* type="string", | |
* description="Error message describing the internal server error" | |
* ) | |
* ) | |
* ) | |
* ) | |
* ) | |
*/ | |
$app->get('/api/customer/getSPAClients', function($request, $response){ | |
$result = $this->customerModel->getSPAClients(); | |
return $response | |
->withStatus($result["code"] ?? 200) | |
->withJson($result); | |
}) | |
->add(new AdminAuthorization()) | |
->add(new auth()); | |
/** | |
* Investment Calculator | |
* | |
* @OA\Post( | |
* path="/api/investmentCalculator", | |
* tags={"Investment"}, | |
* summary="Investment Calculator", | |
* operationId="investmentCalculator", | |
* @OA\RequestBody( | |
* required=true, | |
* description="JSON object containing investment calculator data", | |
* @OA\MediaType( | |
* mediaType="application/json", | |
* @OA\Schema( | |
* type="object", | |
* @OA\Property( | |
* property="capital", | |
* type="number", | |
* description="The initial capital amount for investment" | |
* ), | |
* @OA\Property( | |
* property="additional", | |
* type="number", | |
* description="The additional amount added to the investment at each frequency interval" | |
* ), | |
* @OA\Property( | |
* property="rate", | |
* type="number", | |
* description="The annual interest rate for the investment (in decimal format, e.g., 0.05 for 5%)" | |
* ), | |
* @OA\Property( | |
* property="tenor", | |
* type="integer", | |
* description="The investment tenor in years" | |
* ), | |
* @OA\Property( | |
* property="frequency", | |
* type="string", | |
* description="The frequency of interest compounding (e.g., 'monthly', 'quarterly', 'annually' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment