Ejemplo n.º 1
0
 internal Response <List <ProductPrintFieldResult> > GetProductPrintFields(long?productId, long?cardId, long?requestId, long auditUserId, string auditWorkstation)
 {
     try
     {
         var results = _cardManService.GetProductPrintFields(productId, cardId, requestId, auditUserId, auditWorkstation);
         return(new Response <List <ProductPrintFieldResult> >(results, ResponseType.SUCCESSFUL,
                                                               "",
                                                               ""));
     }
     catch (Exception ex)
     {
         log.Error(ex);
         return(new Response <List <ProductPrintFieldResult> >(null,
                                                               ResponseType.ERROR,
                                                               "Error when processing request.",
                                                               log.IsDebugEnabled || log.IsTraceEnabled ? ex.Message : ""));
     }
 }
Ejemplo n.º 2
0
        public BaseResponse FeeCharge(CustomerDetails customerDetails, AuditInfo auditInfo)
        {
            List <IProductPrintField> printFields = _cardManService.GetProductPrintFields(customerDetails.ProductId, null, null);

            _log.Trace(t => t("Looking up account in Core Banking System."));
            // IntegrationController _integration = IntegrationController.Instance;
            Veneka.Indigo.Integration.Config.IConfig config;
            Veneka.Indigo.Integration.External.ExternalSystemFields externalFields;
            _integration.CoreBankingSystem(customerDetails.ProductId, InterfaceArea.ISSUING, out externalFields, out config);

            InterfaceInfo interfaceInfo = new InterfaceInfo
            {
                Config        = config,
                InterfaceGuid = config.InterfaceGuid.ToString()
            };

            CardObject _object = new CardObject();

            _object.CustomerAccount = new AccountDetails();
            _object.CustomerAccount.AccountNumber = customerDetails.AccountNumber;
            _object.PrintFields = printFields;
            var response = _comsCore.CheckBalance(customerDetails, externalFields, interfaceInfo, auditInfo);

            if (response.ResponseCode == 0)
            {
                // var accountLookupLogic = new Logic.AccountLookupLogic(_cardManService, _comsCoreInstance, _integration);

                //Validate returned account
                //   if (accountLookupLogic.ValidateAccount(customerDetails.ProductId, response.Value, out responseMessage))

                {
                    try
                    {
                        string feeResponse = String.Empty;

                        // Charge Fee if it's greater than 0 and has not already been charged for.
                        if (customerDetails.FeeCharge != null && customerDetails.FeeCharge.Value > 0 && String.IsNullOrWhiteSpace(customerDetails.FeeReferenceNumber))
                        {
                            _log.Trace(t => t("calling Charge the fee."));
                            string feeReferenceNumber = string.Empty;

                            var response_fee = _comsCore.ChargeFee(customerDetails, externalFields, interfaceInfo, auditInfo);

                            if (response_fee.ResponseCode == 0)
                            {
                                // customerDetails.FeeReferenceNumber = feeReferenceNumber;
                                _log.DebugFormat("FeeReferenceNumber " + customerDetails.FeeReferenceNumber);


                                _log.DebugFormat("Fee  charged: Ref{0}", customerDetails.FeeReferenceNumber);

                                return(new BaseResponse(ResponseType.SUCCESSFUL, feeResponse, feeResponse));
                            }
                            else
                            {
                                _log.Trace(t => t(feeResponse));

                                return(new BaseResponse(ResponseType.UNSUCCESSFUL, feeResponse, feeResponse));
                            }
                        }
                        else
                        {
                            if (!String.IsNullOrWhiteSpace(customerDetails.FeeReferenceNumber))
                            {
                                if (_log.IsDebugEnabled)
                                {
                                    _log.DebugFormat("Fee already charged: Ref{0}", customerDetails.FeeReferenceNumber);
                                }
                                else
                                {
                                    _log.Trace(t => t("Fee already charged."));
                                }
                            }
                            return(new BaseResponse(ResponseType.SUCCESSFUL, feeResponse, feeResponse));
                        }
                    }
                    catch (NotImplementedException nie)
                    {
                        _log.Warn(nie);
                        return(new BaseResponse(ResponseType.ERROR,
                                                nie.Message,
                                                nie.Message));
                    }
                    catch (Exception ex)
                    {
                        _log.Error(ex);
                        return(new BaseResponse(ResponseType.ERROR,
                                                ex.Message,
                                                _log.IsDebugEnabled || _log.IsTraceEnabled ? ex.Message : ""));
                    }
                }
            }

            return(new BaseResponse(ResponseType.UNSUCCESSFUL, response.ResponseMessage, response.ResponseMessage));
        }
Ejemplo n.º 3
0
        public Response <AccountDetails> CoreBankingAccountLookupFundsLoad(int issuerId, int productId, int cardIssueReasonId, int branchId, string accountNumber, AuditInfo auditInfo)
        {
            _log.Trace(t => t("Looking up account in Core Banking System."));

            //Find printer fields for product
            List <IProductPrintField> printFields = _cardManService.GetProductPrintFields(productId, null, null);

            // Get configuration and external fields for product
            Veneka.Indigo.Integration.Config.IConfig config;
            ExternalSystemFields externalFields;

            _integration.FundsLoadCoreBankingSystem(productId, out externalFields, out config);

            InterfaceInfo interfaceInfo = new InterfaceInfo
            {
                Config        = config,
                InterfaceGuid = config.InterfaceGuid.ToString()
            };

            CardObject _object = new CardObject
            {
                CustomerAccount = new AccountDetails
                {
                    AccountNumber = accountNumber
                },
                PrintFields = printFields,
            };

            _log.Debug("calling GetAccountDetail");

            var cbsResponse = _comsCore.GetAccountDetail(_object, cardIssueReasonId, issuerId, branchId, productId, externalFields, interfaceInfo, auditInfo);

            if (cbsResponse.ResponseCode == 0)
            {
                // Sanity check that integration has actually returned an AccountDetails Object
                if (cbsResponse.Value == null)
                {
                    throw new Exception("Core Banking Interface responded successfuly but AccountDetail is null.");
                }

                //Check that the integration layer sent back the productFields
                if (cbsResponse.Value.ProductFields == null || cbsResponse.Value.ProductFields.Count < printFields.Count)
                {
                    throw new Exception("Integration layer has not returned all Product Print Fields.");
                }

                _log.Trace(t => t("Account successfully found in Core Banking System."));
                var accountDetails = cbsResponse.Value;

                // Do account mapping.
                // get the cms acconttype ,indigo_accountypte from account mapping assing to cardobject.
                ProductAccountTypeMapping mapping;
                if (_cardManService.TryGetProductAccountTypeMapping(productId, accountDetails.CBSAccountTypeId, auditInfo.LanguageId, auditInfo.AuditUserId, auditInfo.AuditWorkStation, out mapping))
                {
                    _log.Trace(t => t("CBS account mapping found"));
                    accountDetails.CMSAccountTypeId = mapping.CmsAccountType;
                    accountDetails.AccountTypeId    = mapping.IndigoAccountTypeId;
                }
                else
                {
                    throw new Exception(string.Format("No mapping found for product {0} and CBS Account Type {1}", productId, accountDetails.CBSAccountTypeId));
                }

                // Name on card build
                try
                {
                    //Logic for name on card if the filed is not populated, if it is populated then ignore integration layer handled it
                    IProductPrintField obj = printFields.Find(i => i.MappedName.Trim().ToUpper() == "IND_SYS_NOC");
                    if (String.IsNullOrWhiteSpace(accountDetails.NameOnCard) && obj != null)
                    {
                        accountDetails.NameOnCard = Veneka.Indigo.Integration.Common.Utility.BuildNameOnCard(accountDetails.FirstName, accountDetails.MiddleName, accountDetails.LastName);
                    }
                }
                catch (Exception ex)
                {
                    _log.Warn("Issue building name on card.", ex);
                }

                return(new Response <AccountDetails>(accountDetails, ResponseType.SUCCESSFUL, cbsResponse.ResponseMessage, ""));
            }

            return(new Response <AccountDetails>(null, ResponseType.UNSUCCESSFUL, cbsResponse.ResponseMessage, ""));
        }