public CustomerIdentificationResult IdentifyCustomer(PhysicalCustomer customer)
        {
            CustomerIdentificationResult result = new CustomerIdentificationResult();

            this.Use(client => { result = client.IdentifyCustomerAsync(customer, CustomerRegistrationSource.DigitalBanking).Result; }
                     );
            return(result);
        }
        /// <summary>
        /// Հաճախորդի գրանցում անձնական տվյալներով
        /// Նույնականացնում է ֆիզիկական անձին անձնական տվյալների հիման վրա։
        /// Եթե Նորք/Էկենգից վերադարձված հաճախորդը առկա չէ բանկի բազայում, ապա գրանցում է։
        /// </summary>
        /// <returns></returns>
        public CustomerRegistrationProcessResult RegistrateByPersonalInformation()
        {
            var result = new CustomerRegistrationProcessResult();
            PhysicalCustomer             physicalCustomer     = null;
            CustomerIdentificationResult identificationResult = null;

            if (!String.IsNullOrEmpty(this.RegParams.DocumentValue))
            {
                var notIdentifiedCustomer = new PhysicalCustomer()
                {
                    person = new Person()
                    {
                        documentList = new List <CustomerDocument>()
                    }
                };
                notIdentifiedCustomer.person.documentList.Add(new CustomerDocument()
                {
                    documentGroup = new KeyValue()
                    {
                        key = 1
                    }, documentType = new KeyValue()
                    {
                        key = (short)this.RegParams.DocumentType
                    }, documentNumber = this.RegParams.DocumentValue
                });

                try
                {
                    identificationResult = _acbaOperationService.IdentifyCustomer(notIdentifiedCustomer);
                }
                catch
                {
                    result.RegistrationResult = RegistrationResult.NotFoundClient;
                    result.ResultDescription  = "Գրանցումը հնարավոր չէ կատարել:  Փորձեք մի փոքր ուշ կամ կապ հաստատեք Բանկի հետ:";
                    return(result);
                }
                physicalCustomer = _acbaOperationService.GetCustomer(identificationResult.CustomerNumber);
            }

            result = RegistratePhysicalCustomer(physicalCustomer);

            return(result);
        }
Exemple #3
0
        public IActionResult GetCustomerInfoForAuthentication([FromBody] CustomerAuthenticationRequest request)
        {
            if (ModelState.IsValid)
            {
                var response = new SingleResponse <CustomerInfoForAuthentication>()
                {
                    Result = new CustomerInfoForAuthentication()
                };
                response.ResultCode = ResultCodes.normal;

                //Եթե նշված չէ կամ սխալ է փաստաթղթի տեսակը։
                if (request.DocumentType != DocumentType.IdentifierCard && request.DocumentType != DocumentType.RApassport && request.DocumentType != DocumentType.BiometricPassport)
                {
                    response.ResultCode  = ResultCodes.validationError;
                    response.Description = "Incorect request data";
                    response.Result      = null;
                    return(ResponseExtensions.ToHttpResponse(response));
                }

                CustomerIdentificationResult identificationResult = null;
                var notIdentifiedCustomer = new PhysicalCustomer()
                {
                    person = new Person()
                    {
                        documentList = new List <CustomerDocument>()
                    }
                };
                notIdentifiedCustomer.person.documentList.Add(new CustomerDocument()
                {
                    documentGroup = new KeyValue()
                    {
                        key = 1
                    }, documentType = new KeyValue()
                    {
                        key = (short)request.DocumentType
                    }, documentNumber = request.DocumentValue
                });

                try
                {
                    identificationResult = _acbaOperationService.IdentifyCustomer(notIdentifiedCustomer);
                }
                catch
                {
                    response.Result.ProcessResultCode = CustomerAuthenticationResult.NonCustomer;
                    response.Result.TypeOfDocument    = CustomerAuthenticationInfoType.Empty;
                    response.Result.ResultDescription = "Հնարավոր չէ կատարել նույնականացում։";
                    return(ResponseExtensions.ToHttpResponse(response));
                }

                bool hasCustomerOnlineBanking = _xbService.HasCustomerOnlineBanking(identificationResult.CustomerNumber);

                if (hasCustomerOnlineBanking)
                {
                    response.Result.ProcessResultCode = CustomerAuthenticationResult.CustomerWithOnlineBanking;
                    response.Result.TypeOfDocument    = CustomerAuthenticationInfoType.Empty;
                    response.Result.CustomerNumber    = identificationResult.CustomerNumber;
                    response.Result.ResultDescription = "Հաճախորդը ունի օնլայն բանկինգ։";
                    return(ResponseExtensions.ToHttpResponse(response));
                }

                response.Result.CustomerNumber    = identificationResult.CustomerNumber;
                response.Result.ProcessResultCode = CustomerAuthenticationResult.CustomerWithAttachment;
                response.Result.ResultDescription = "Հաճախորդը գտնված է։";

                //Հաճախորդի անձը հաստատող փաստաթղթեր
                var documents = _acbaOperationService.GetCustomerDocumentList((uint)_acbaOperationService.GetIdentityId(identificationResult.CustomerNumber)).FindAll(doc => doc.documentGroup.key == 1);
                documents.Sort((x, y) => y.id.CompareTo(x.id));

                foreach (var document in documents)
                {
                    var attachments = _acbaOperationService.GetAttachmentDocumentList(Convert.ToUInt64(document.id));
                    if (attachments.Count != 0)
                    {
                        attachments.Sort((x, y) => x.PageNumber.CompareTo(y.PageNumber));
                        attachments.ForEach(item =>
                        {
                            response.Result.Data.Add(new KeyValuePair <string, string>(Convert.ToBase64String(_acbaOperationService.GetOneAttachment(item.id)), ((TypeOfAttachments)item.FileExtension).ToString()));
                        });
                        response.Result.TypeOfDocument = CustomerAuthenticationInfoType.Document;
                        break;
                    }
                }

                if (response.Result.Data.Count == 0)
                {
                    response.Result.ProcessResultCode = CustomerAuthenticationResult.CustomerWithNoAttachments;
                    response.Result.TypeOfDocument    = CustomerAuthenticationInfoType.Empty;
                    response.Result.ResultDescription = "Առկա չէ հաճախորդին կցված փաստաթուղթ։";
                }

                return(ResponseExtensions.ToHttpResponse(response));
            }
            else
            {
                return(ValidationError.GetValidationErrorResponse(ModelState));
            }
        }