Дипломная работа: Автоматизация и обеспечение информационной безопасности обработки заявок в ПАО "СКБ Банк"

Внимание! Если размещение файла нарушает Ваши авторские права, то обязательно сообщите нам
107
Рис. п1.6 Форма заполнения заявки. Шаг 6
108
Подсказки экранов формы ввода анкетных данных.
Рис. п1.7 Форма заполнения заявки с подсказками. Шаг 1
Рис. п1.8 Форма заполнения заявки с подсказкой. Шаг 2
109
Приложение 3.
Листинг программных модулей
Исходный текст модуля интерфейса API
<?php
namespace app\modules\api2\controllers;
class ApiController extends ActiveController
{
public $modelClass = 'app\modules\landings\models\Claims';
public function actionPostClaim(): array
{
$response = [];
if (!empty($post = Yii::$app->request->post())) {
$post = $this->imitateFormPost();
if ($this->formManager->object->load($post)) {
if ($this->formManager->object->validate()) {
if ($this->formManager->object->validateOnly()) {
$response = ['validated' => 1];
} else {
if ($this->formManager->object->save(false)) {
if ($this->formManager->object->isUnhandledDuplicate()) {
$this->errorManager->setError(ErrorManager::STATE_API_CLAIM_IS_DUPLICATE);
}
//$response = $this->formManager->getApiResponse();
$response = $this->formManager->object->getApiResponse();
$this->getLdgPixelParams($this->formManager->object->id);
} else {
$this->errorManager->setError(ErrorManager::STATE_API_CLAIM_NOT_SAVED);
}
}
} else {
$this->errorManager->setError(ErrorManager::STATE_API_VALIDATION_ERROR, $this-
>formManager->object->getErrors());
}
} else {
$this->errorManager->setError(ErrorManager::STATE_API_FORM_WAS_NOT_LOADED);
}
} else {
$this->errorManager->setError(ErrorManager::STATE_API_EMPTY_POST);
}
return $this->getAnswer($response);
}
public function actionPostFile(): array
{
$response['errors'] = 'empty';
if (Yii::$app->request->isPost) {
if (isset(Yii::$app->request->bodyParams['hash']) &&
isset(Yii::$app->request->bodyParams['file_name']) &&
110
isset(Yii::$app->request->bodyParams['file_extension']) &&
isset(Yii::$app->request->bodyParams['file_content'])
) {
$hash = Yii::$app->request->bodyParams['hash'];
$filename = Yii::$app->request->bodyParams['file_name'];
$fileextension = Yii::$app->request->bodyParams['file_extension'];
$content = Yii::$app->request->bodyParams['file_content'];
/** @var RabbitTransporter $rabbit */
$rabbit = Yii::$app->creditFrontTransporter;
$rabbit->setPassage(CreditSiebel::TRANSPORTER_PASSAGE_FILE_CASH_RQ);
$response['transfered'] = $rabbit->pushFile($hash, $filename, $fileextension, $content);
}
}
return $this->getAnswer($response);
}
public function actionGetClaim($h): array
{
$hash = $h;
$response = [];
$claim = Yii::$app->db->useMaster(function ($db) use ($hash) {
return Claims::find()
->with('info')
->with('states')
->where(['hash' => $hash])
->one();
});
if ($claim) {
// todo need to filter this values, we don't need it all on front
$this->formManager->object->setAttributes(array_merge($claim->attributes, $claim->info-
>attributes, $claim->info->dataArray), false);
$response['last_scenario'] = ArrayHelper::getValue($claim, 'info.dataArray.lastScenario');
$response['hash'] = $claim->hash;
$importantFields = [
'sex',
'office',
'first_name',
'middle_name',
'birth_date',
'income_proof',
'city_code',
'spouse_state',
'passport_has_changed',
'passport_issued_when',
'registration_address_equal_to_factual_address',
'international_passport_availability',
'employment_state',
111
'consent_to_life_insurance',
'consent_to_insurance_against_job_loss',
'post_not_found',
];
foreach (get_object_vars($this->formManager->object) as $attribute => $attributeValue) {
if (in_array($attribute, ['lastScenario', 'validateOnly'])) {
continue;
}
if (in_array($attribute, $importantFields) && $attributeValue != '') {
$response['attributes'][$attribute] = $attributeValue;
} else {
$response['attributes'][$attribute] = $attributeValue !== null && $attributeValue !== '';
}
if($attribute == 'city_name')
if(!empty($response['attributes'][$attribute]))
if ($response['attributes'][$attribute] == 'Город не найден')
$response['attributes'][$attribute] = false;
}
} else {
$this->errorManager->setError(ErrorManager::STATE_API_INCORRECT_HASH);
}
return $this->getAnswer($response);
}
public function actionGetList($list, $query = null): array
{
if (empty($this->formManager) || is_null($this->formManager->getList($list, $query))) {
$this->errorManager->setError(ErrorManager::STATE_API_UNDEFINED_LIST);
}
return $this->getAnswer(['list' => $this->formManager->getList($list, $query)]);
}
/**
* Get all available lists for current form
*
* @return array
*/
public function actionGetLists()//: array
{
return $this->getAnswer(['available_lists' => $this->formManager->getLists()]);
}
public function actionSendCode($claim_hash): array
{
if (!Hash::getInstance($claim_hash)->isHash()) {
$this->errorManager->setError(ErrorManager::STATE_API_INCORRECT_HASH);
}
$response = [];
$smsManager = new SmsManager();
$smsManager->setClaim($claim_hash);
Источник: https://baza.diplomsite.ru/previewfile/1778