Ejemplo n.º 1
0
        public async void Run_SearchCustomerTest()
        {
            ShowTestOnTerminal("SearchCustomer");

            UpdateCustomerRequest setupRequest = new UpdateCustomerRequest
            {
                Customer = new Customer
                {
                    FirstName    = "Test",
                    LastName     = "Customer",
                    CompanyName  = "Test Company",
                    EmailAddress = "*****@*****.**",
                    SmsNumber    = "(123) 123-1234",
                },
            };

            output.WriteLine("Setup request: {0}", setupRequest);

            CustomerResponse setupResponse = await blockchyp.UpdateCustomerAsync(setupRequest);

            output.WriteLine("Setup Response: {0}", setupResponse);

            CustomerSearchRequest request = new CustomerSearchRequest
            {
                Query = "123123",
            };

            output.WriteLine("Request: {0}", request);

            CustomerSearchResponse response = await blockchyp.CustomerSearchAsync(request);

            output.WriteLine("Response: {0}", response);

            Assert.True(response.Success, "response.Success");
        }
Ejemplo n.º 2
0
 public static CustomerResult ToCustomerSearchResult(this CustomerSearchResponse response)
 {
     return(new()
     {
         AddressResponse = response.AddressResponse,
         CompanyResponse = response.CompanyResponse
     });
 }
        private static CustomerSearchResponse WrapSearch(ICollection <CustomerSearchDetail> details, SearchRequest request)
        {
            var results  = ApiHelper.FilterCustomers(details, request.Search.Value).ToList();
            var response = new CustomerSearchResponse
            {
                Data            = PageResults(results, request),
                Draw            = request.Draw,
                RecordsFiltered = results.Count,
                RecordsTotal    = details.Count
            };

            return(response);
        }
Ejemplo n.º 4
0
        public IHttpActionResult Post([FromBody] DataTableRequest requestModel)
        {
            var orderBy       = new Dictionary <string, string>();
            var sortedColumns = requestModel.Order;

            foreach (var column in sortedColumns)
            {
                orderBy[requestModel.Columns[column.Column].Data] = column.Dir;
            }

            var queryResult = _dbContext.GetResults(requestModel.Search.Value, requestModel.Start, requestModel.Length, orderBy);

            var response = new CustomerSearchResponse
            {
                data            = queryResult.Data,
                draw            = requestModel.draw,
                recordsFiltered = queryResult.FilteredCount,
                recordsTotal    = queryResult.TotalCount
            };

            return(Json(response));
        }
Ejemplo n.º 5
0
        public async Task <CustomerSearchResponse> Search(CustomerSearchRequest request)
        {
            CustomerSearchResponse response = new CustomerSearchResponse();

            try
            {
                RefSqlPaging paging = new RefSqlPaging(request.PageIndex, request.PageSize);
                var          data   = await _customerService.Search(request.Code, request.Email, request.Mobile, request.FullName,
                                                                    request.FromBirthdayValue, request.ToBirthDayValue, request.Type, request.Status, paging);

                response.TotalRow  = paging.TotalRow;
                response.Customers = data.Select(p => p.ToModel()).ToArray();
                response.PageIndex = request.PageIndex;
                response.PageSize  = request.PageSize;
                response.SetSucess();
            }
            catch (Exception e)
            {
                response.SetFail(e);
                _logger.LogError(e, e.Message, request);
            }
            return(response);
        }
Ejemplo n.º 6
0
        public static ESBData RetrieveESBData(Params param)
        {
            ESBData data = new ESBData();
            CustomerSearchResponse response    = new CustomerSearchResponse();
            OptTimeout             timeout     = null;
            RestTimeout            restTimeout = null;
            bool isRest = false;

            switch (param.WSDL)
            {
            /*
             * Integration with EAI
             * WSDL
             */
            case "AccountDetail": timeout = new OptTimeout(IntegrationManager.ExecuteAccountDetail); break;

            case "AccountStatementByDate": timeout = new OptTimeout(IntegrationManager.ExecuteAccountStatementByDate); break;

            case "AllRelatedDetail": timeout = new OptTimeout(IntegrationManager.ExecuteAllRelatedDetail); break;

            case "CallStoreProcedure": timeout = new OptTimeout(IntegrationManager.ExecuteCallStoreProcedure); break;

            case "CallStoreProcedureDelimiter": timeout = new OptTimeout(IntegrationManager.ExecuteCallStoreProcedureDelimiter); break;

            case "CardManagement": timeout = new OptTimeout(IntegrationManager.ExecuteCardManagement); break;

            case "CardStatusUpdate": timeout = new OptTimeout(IntegrationManager.ExecuteCardStatusUpdate); break;

            case "CCAddressDetail": timeout = new OptTimeout(IntegrationManager.ExecuteCCAddressDetail); break;

            case "CCBillingStatementByStatementDate": timeout = new OptTimeout(IntegrationManager.ExecuteCCBillingStatementByStatementDate); break;

            case "CCInformationDetail": timeout = new OptTimeout(IntegrationManager.ExecuteCCInformationDetail); break;

            case "CCInquiryTransactionDetail": timeout = new OptTimeout(IntegrationManager.ExecuteCCInquiryTransactionDetail); break;

            case "CCInquiryUnsettleTransaction": timeout = new OptTimeout(IntegrationManager.ExecuteCCInquiryUnsettleTransaction); break;

            case "CCListAutoPayment": timeout = new OptTimeout(IntegrationManager.ExecuteCCListAutoPayment); break;

            case "CCMerchantInformation": timeout = new OptTimeout(IntegrationManager.ExecuteCCMerchantInformation); break;

            case "CCStatementDateHistory": timeout = new OptTimeout(IntegrationManager.ExecuteCCStatementDateHistory); break;

            case "CorporateCardBlock": timeout = new OptTimeout(IntegrationManager.ExecuteCorporateCardBlock); break;

            case "CorporateCardInquiry": timeout = new OptTimeout(IntegrationManager.ExecuteCorporateCardInquiry); break;

            case "CustomerChannelListInquiry": timeout = new OptTimeout(IntegrationManager.ExecuteCustomerChannelListInquiry_V2); break;

            case "CustomerInformationInquiry": timeout = new OptTimeout(IntegrationManager.ExecuteCustomerInformationInquiry); break;

            case "CustomerProductListInquiry": timeout = new OptTimeout(IntegrationManager.ExecuteCustomerProductListInquiry_V2); break;

            case "CustomerSpecificChannelInquiry": timeout = new OptTimeout(IntegrationManager.ExecuteCustomerSpecificChannelListInquiry); break;

            case "CustomerSpecificProductInquiry": timeout = new OptTimeout(IntegrationManager.ExecuteCustomerSpecificProductListInquiry); break;

            case "DepositAccountAndCardDetail": timeout = new OptTimeout(IntegrationManager.ExecuteDepositAccountAndCardDetail); break;

            case "ESBDBDelimiter": timeout = new OptTimeout(IntegrationManager.ExecuteESBDBDelimiter); break;

            case "LoanInfoDetail": timeout = new OptTimeout(IntegrationManager.ExecuteLoanInfoDetail_V2); break;

            case "LoginIBIStatusUpdate": timeout = new OptTimeout(IntegrationManager.ExecuteLoginIBIStatusUpdate); break;

            case "LoginSMEStatusUpdate": timeout = new OptTimeout(IntegrationManager.ExecuteLoginSMEStatusUpdate); break;

            case "MBManagement": timeout = new OptTimeout(IntegrationManager.ExecuteUserMobileBankingManagement); break;

            case "Merchant": timeout = new OptTimeout(IntegrationManager.ExecuteCCMerchantInformation); break;

            case "PhoneBankingTransaction": timeout = new OptTimeout(IntegrationManager.ExecuteRemoteBankingInquiryTransaction); break;

            case "POSManagement": timeout = new OptTimeout(IntegrationManager.ExecutePOSRegistration); break;

            case "TokenAuthentication": timeout = new OptTimeout(IntegrationManager.ExecuteTokenAuthentication); break;

            case "TokenResynch": timeout = new OptTimeout(IntegrationManager.ExecuteTokenResynch); break;

            case "TokenSMEUpdateStatus": timeout = new OptTimeout(IntegrationManager.ExecuteTokenSMEUpdateStatus); break;

            case "TokenUnlock": timeout = new OptTimeout(IntegrationManager.ExecuteTokenUnlock); break;

            case "TokenUpdateStatus": timeout = new OptTimeout(IntegrationManager.ExecuteTokenUpdateStatus); break;

            case "UserIBIStatusUpdate": timeout = new OptTimeout(IntegrationManager.ExecuteUserIBIStatusUpdate); break;

            case "UserInternetBankingManagement": timeout = new OptTimeout(IntegrationManager.ExecuteUserInternetBankingManagement); break;

            case "UserMBStatusUpdate": timeout = new OptTimeout(IntegrationManager.ExecuteUserMBStatusUpdate); break;

            case "UserMobileBankingManagement": timeout = new OptTimeout(IntegrationManager.ExecuteUserMobileBankingManagement); break;

            case "UserPhoneBankingInquiry": timeout = new OptTimeout(IntegrationManager.ExecuteUserPhoneBankingInquiry); break;

            case "UserPhoneBankingManagement": timeout = new OptTimeout(IntegrationManager.ExecuteUserPhoneBankingManagement); break;

            case "UserPhoneBankingStatusUpdate": timeout = new OptTimeout(IntegrationManager.ExecuteUserPhoneBankingStatusUpdate); break;

            case "UserSMSBankingStatusUpdate": timeout = new OptTimeout(IntegrationManager.ExecuteUserSMSBankingStatusUpdate); break;

            case "UserSMSTopUpStatusUpdate": timeout = new OptTimeout(IntegrationManager.ExecuteUserSMSTopUpStatusUpdate); break;

            /*
             * Integration with EAI
             * REST SERVICE
             */
            case "OTPCashOut": restTimeout = new RestTimeout(RestManager.ExecuteGetOTPCashOut); isRest = true; break;

            default: timeout = new OptTimeout(IntegrationManager.ExecuteCRMGeneralFunction); break;
            }
            Stopwatch    exectime = Stopwatch.StartNew();
            IAsyncResult results  = isRest ? restTimeout.BeginInvoke(param.RequestTransType, param.Parameter, null, null) : timeout.BeginInvoke(param.RequestTransType, param.Parameter, response, null, null);

            try
            {
                if (!results.IsCompleted)
                {
                    results.AsyncWaitHandle.WaitOne(30000, false);
                    if (!results.IsCompleted)
                    {
                        exectime.Stop();
                        data.Message = "Request doesnt complete.";
                    }
                    else
                    {
                        data.Result = isRest ? restTimeout.EndInvoke(results) : timeout.EndInvoke(results);
                        exectime.Stop();
                    }
                }
            }
            catch (Exception e)
            {
                data.Message = e.ToString();
            }
            return(data);
        }