public int UpdateCustomerNFCTag(CustomerNewNFCCardinfo registrationNewNFC) { try { // GenerateCustomerAccountNumber(); if (!ChangerValidations.IsCustomerNFCTagValid(registrationNewNFC.PIN)) { return(1202); } //Get the OLD NFC tag for the given customer account and update the status as Lost var CustomerDetails = _changerMintsUOW.Repository <CustomerDetail>().Query().Filter(q => q.CustomerAccountNumber == registrationNewNFC.CustomerAccountNumber).Get(); if (CustomerDetails.FirstOrDefault() == null) { return(1201); } var OLDNFCTag = CustomerDetails.FirstOrDefault().NFCTagID.ToString(); //Add the updated date CustomerDetails.FirstOrDefault().UpdatedDate = DateTime.Now; //Update old NFCTag status as Lost var CustomerOldNFCDetails = _changerMintsUOW.Repository <CustomerNFCTagDetail>().Query().Filter(q => q.NFCTagID.ToString() == OLDNFCTag).Get(); CustomerOldNFCDetails.FirstOrDefault().NFCStatus = 1007; //Insert new NFC tag in CustomerNFCTagDetail and update the status as ACTIVE var CustomerNewNFCDetails = _changerMintsUOW.Repository <CustomerNFCTagDetail>().Query().Filter(q => q.PIN == registrationNewNFC.PIN).Get(); if (CustomerNewNFCDetails.FirstOrDefault() == null) { return(1202); } CustomerNewNFCDetails.FirstOrDefault().NFCStatus = 1001; //Update the new NFC Tag for the given account Number CustomerDetails.FirstOrDefault().NFCTagID = CustomerNewNFCDetails.FirstOrDefault().NFCTagID; //Maintain previous history in the ChangerUpdatedDetails table var updatedDetails = new ChangerUpdatedDetail() { CustomerAccountNumber = registrationNewNFC.CustomerAccountNumber, ShopKeeperAccountNumber = null, UpdatedField = "NFCTagID", UpdatedDate = DateTime.Now, PreviousValue = OLDNFCTag }; return(1251); } catch (Exception ex) { if (ex.InnerException == null) { throw ex; } else { throw ex.InnerException; } } }
// Get the Shopkeeper available balance both in Sender & Receiver public ShopkeeperSenderAndReceiverBalanceResponse GetShopKeeperBalance(ShopKeeperSenderAndReceiverBalance ShopkeeperBalance) { _balanceResponse = new ShopkeeperSenderAndReceiverBalanceResponse(); try { var messageCreators = new List <ModelResponses <ShopkeeperSenderAndReceiverBalanceResponse, ChangerValidations> > { // Check if the Shopkeeper Account is of Valid length new ModelResponses <ShopkeeperSenderAndReceiverBalanceResponse, ChangerValidations>(model => model.IsShopKeeperAccountValid( ShopkeeperBalance.ShopKeeperAccountNumber), 1101) }; ModelResponses <ShopkeeperSenderAndReceiverBalanceResponse, ChangerValidations> errorCreator = null; if (!ChangerValidations.GetInputParametersStatus <ShopkeeperSenderAndReceiverBalanceResponse, ChangerValidations>(messageCreators, out errorCreator)) { return(errorCreator.FillErrorDTO <ShopkeeperSenderAndReceiverBalanceResponse>()); } // Get current shopkeeper account details var currentShopkeeperAccountDetails = _changerMintsUOW.Repository <ShopKeeperAccountDetail>().Query().Filter(q => q.ShopKeeperAccountNumber == ShopkeeperBalance.ShopKeeperAccountNumber).Get().FirstOrDefault(); if (currentShopkeeperAccountDetails != null) { _balanceResponse.ErrorNumber = 1; _balanceResponse.ErrorMessage = ConfigurationManager.AppSettings[_balanceResponse.ErrorNumber.ToString()]; _balanceResponse.SenderBalance = currentShopkeeperAccountDetails.SenderBalance; _balanceResponse.ReceiverBalance = currentShopkeeperAccountDetails.ReceiverBalance; } else { _balanceResponse.ErrorNumber = 1050; _balanceResponse.ErrorMessage = ConfigurationManager.AppSettings[_balanceResponse.ErrorNumber.ToString()]; } } catch (Exception ex) { throw ex; } return(_balanceResponse); }
// Receiver balance to sender balance transaction service public InterTransactionResponse ShopKeeperToShopKeeperTransaction(ShopKeeperReceiverToSenderTransaction ShopkeeperToShopkeeper) { _interTransactionResponse = new InterTransactionResponse(); try { var messageCreators = new List <ModelResponses <InterTransactionResponse, ChangerValidations> > { // Check if the Shopkeeper Account is of Valid length new ModelResponses <InterTransactionResponse, ChangerValidations>(model => model.IsShopKeeperAccountValid( ShopkeeperToShopkeeper.ShopKeeperAccountNumber), 1101), // Check if the Amount is of >0 new ModelResponses <InterTransactionResponse, ChangerValidations>(model => model.IsAmountValid( ShopkeeperToShopkeeper.Amount), 1401), }; ModelResponses <InterTransactionResponse, ChangerValidations> errorCreator = null; if (!ChangerValidations.GetInputParametersStatus <InterTransactionResponse, ChangerValidations>(messageCreators, out errorCreator)) { return(errorCreator.FillErrorDTO <InterTransactionResponse>()); } // Get current shopkeeper account details var currentShopkeeperAccountDetails = _changerMintsUOW.Repository <ShopKeeperAccountDetail>().Query().Filter(q => q.ShopKeeperAccountNumber == ShopkeeperToShopkeeper.ShopKeeperAccountNumber).Get().FirstOrDefault(); if (currentShopkeeperAccountDetails == null) { _interTransactionResponse.ErrorNumber = 1107; _interTransactionResponse.ErrorMessage = ConfigurationManager.AppSettings[_interTransactionResponse.ErrorNumber.ToString()]; return(_interTransactionResponse); } if (currentShopkeeperAccountDetails.ReceiverBalance > ShopkeeperToShopkeeper.Amount && currentShopkeeperAccountDetails.ReceiverBalance > 0) { // Start Transaction decimal TransferableAmountToShopkeeper = TRANSFERABLE_PERCENTAGE_AFTER_COMMISION * ShopkeeperToShopkeeper.Amount; decimal TransferableAmountToChanger = COMMISSION_TO_CHANGER * ShopkeeperToShopkeeper.Amount; currentShopkeeperAccountDetails.ReceiverBalance -= ShopkeeperToShopkeeper.Amount; currentShopkeeperAccountDetails.SenderBalance += TransferableAmountToShopkeeper; _changerMintsUOW.Repository <ShopKeeperAccountDetail>().Update(currentShopkeeperAccountDetails); _changerMintsUOW.Save(); // Update the Transaction details var getShopkeeperAccountDetails = _changerMintsUOW.Repository <ShopKeeperAccountDetail>().Query().Filter(q => q.ShopKeeperAccountNumber == ShopkeeperToShopkeeper.ShopKeeperAccountNumber).Get().FirstOrDefault(); // Update the transaction table for Shopkeeper var shopKeeperTransactionDetail = new ShopKeeperTransactionDetail() { ShopKeeperAccountNumber = getShopkeeperAccountDetails.ShopKeeperAccountNumber, SenderBalance = getShopkeeperAccountDetails.SenderBalance, ReceiverBalance = getShopkeeperAccountDetails.ReceiverBalance, ReceivedFrom = 0, PaidTo = getShopkeeperAccountDetails.ShopKeeperAccountNumber, AmountTransfered = ShopkeeperToShopkeeper.Amount, TransactionDate = DateTime.Now, TransactionStatus = 1001, TerminalIMEINumber = ShopkeeperToShopkeeper.TerminalIMEINumber, TransactionID = GenerateTransactionID() }; _changerMintsUOW.Repository <ShopKeeperTransactionDetail>().Insert(shopKeeperTransactionDetail); _changerMintsUOW.Save(); // success message _interTransactionResponse.ErrorNumber = 1302; _interTransactionResponse.ErrorMessage = ConfigurationManager.AppSettings[_interTransactionResponse.ErrorNumber.ToString()]; _interTransactionResponse.SenderBalance = Convert.ToDecimal(currentShopkeeperAccountDetails.SenderBalance); _interTransactionResponse.ReceiverBalance = Convert.ToDecimal(currentShopkeeperAccountDetails.ReceiverBalance); } else { _interTransactionResponse.ErrorNumber = 1301; } _interTransactionResponse.ErrorMessage = ConfigurationManager.AppSettings[_interTransactionResponse.ErrorNumber.ToString()]; } catch (Exception e) { throw e; } return(_interTransactionResponse); }
// Shopkeeper to Customer Transaction Service public CrossTransactionResponse ShopkeeperToCustomerTransaction(ShopKeeperToCustomerTransaction ShopkeeperToCustomer) { _crossTransactionResponse = new CrossTransactionResponse(); try { var messageCreators = new List <ModelResponses <CrossTransactionResponse, ChangerValidations> > { // Check if the Shopkeeper Account is of Valid length new ModelResponses <CrossTransactionResponse, ChangerValidations>(model => model.IsShopKeeperAccountValid( ShopkeeperToCustomer.ShopKeeperAccountNumber), 1101), // Check if the Customer Account is of Valid length new ModelResponses <CrossTransactionResponse, ChangerValidations>(model => model.IsCustomerNFCTagIDValid( ShopkeeperToCustomer.NFCTagID), 1202), // Check if the Amount is of >0 new ModelResponses <CrossTransactionResponse, ChangerValidations>(model => model.IsAmountValid( ShopkeeperToCustomer.Amount), 1401), }; ModelResponses <CrossTransactionResponse, ChangerValidations> errorCreator = null; if (!ChangerValidations.GetInputParametersStatus <CrossTransactionResponse, ChangerValidations>(messageCreators, out errorCreator)) { return(errorCreator.FillErrorDTO <CrossTransactionResponse>()); } // Get current customer details var currentCustomerDetails = _changerMintsUOW.Repository <CustomerDetail>().Query().Filter(q => q.NFCTagID == ShopkeeperToCustomer.NFCTagID).Get().FirstOrDefault(); // Verify if the customer is registered to the changer if (currentCustomerDetails == null) { //Transaction Fail _crossTransactionResponse.ErrorNumber = 1208; _crossTransactionResponse.ErrorMessage = ConfigurationManager.AppSettings[_crossTransactionResponse.ErrorNumber.ToString()]; return(_crossTransactionResponse); } var currentCustomerNFCDetails = _changerMintsUOW.Repository <CustomerNFCTagDetail>().Query().Filter(q => q.NFCTagID == ShopkeeperToCustomer.NFCTagID).Get().FirstOrDefault(); if (currentCustomerNFCDetails.NFCTagUID != ShopkeeperToCustomer.NFCTagUID) { //Transaction Fail - NFCUID mis match _crossTransactionResponse.ErrorNumber = 1210; _crossTransactionResponse.ErrorMessage = ConfigurationManager.AppSettings[_crossTransactionResponse.ErrorNumber.ToString()]; return(_crossTransactionResponse); } // Retrieve particulars from the database for given Shopkeeper and Customer var currentShopkeeperAccountDetails = _changerMintsUOW.Repository <ShopKeeperAccountDetail>().Query().Filter(q => q.ShopKeeperAccountNumber == ShopkeeperToCustomer.ShopKeeperAccountNumber).Get().FirstOrDefault(); var currentCustomerAccountDetails = _changerMintsUOW.Repository <CustomerAccountDetail>().Query().Filter(q => q.CustomerAccountNumber == currentCustomerDetails.CustomerAccountNumber).Get().FirstOrDefault(); // Verify if the Shopkeeper is registered to our system. if (currentShopkeeperAccountDetails == null) { //Transaction Fail _crossTransactionResponse.ErrorNumber = 1107; _crossTransactionResponse.ErrorMessage = ConfigurationManager.AppSettings[_crossTransactionResponse.ErrorNumber.ToString()]; return(_crossTransactionResponse); } // Verify if the customer is registered to the changer if (currentCustomerAccountDetails == null) { //Transaction Fail _crossTransactionResponse.ErrorNumber = 1208; _crossTransactionResponse.ErrorMessage = ConfigurationManager.AppSettings[_crossTransactionResponse.ErrorNumber.ToString()]; return(_crossTransactionResponse); } // If the balance is greater than the transferable amount, start the transaction if (currentShopkeeperAccountDetails.SenderBalance > ShopkeeperToCustomer.Amount && currentShopkeeperAccountDetails.SenderBalance > 0) { // Start the transaction currentShopkeeperAccountDetails.SenderBalance -= ShopkeeperToCustomer.Amount; currentCustomerAccountDetails.Balance += ShopkeeperToCustomer.Amount; _changerMintsUOW.Repository <ShopKeeperAccountDetail>().Update(currentShopkeeperAccountDetails); _changerMintsUOW.Repository <CustomerAccountDetail>().Update(currentCustomerAccountDetails); _changerMintsUOW.Save(); // Update Shopkeeper & Customer Transaction Details var getShopkeeperAccountDetails = _changerMintsUOW.Repository <ShopKeeperAccountDetail>().Query().Filter(q => q.ShopKeeperAccountNumber == ShopkeeperToCustomer.ShopKeeperAccountNumber).Get().FirstOrDefault(); var getCustomerAccountDetails = _changerMintsUOW.Repository <CustomerAccountDetail>().Query().Filter(q => q.CustomerAccountNumber == currentCustomerDetails.CustomerAccountNumber).Get().FirstOrDefault(); var query1 = from s in _changerMintsUOW.Repository <ShopKeeperAccountDetail>().Query().Filter(q => q.ShopKeeperAccountNumber == ShopkeeperToCustomer.ShopKeeperAccountNumber).Get() select new CrossTransactionResponse { ShopKeeperSenderBalance = s.SenderBalance, ShopKeeperReceiverBalance = s.ReceiverBalance }; UpdateTransactionDetails <ShopKeeperToCustomerTransaction>(ShopkeeperToCustomer); // Fill the Response DTO & send back to the controller _crossTransactionResponse.ErrorNumber = 1302; _crossTransactionResponse.ErrorMessage = ConfigurationManager.AppSettings[_crossTransactionResponse.ErrorNumber.ToString()]; _crossTransactionResponse.ShopKeeperSenderBalance = Convert.ToDecimal(getShopkeeperAccountDetails.SenderBalance); _crossTransactionResponse.ShopKeeperReceiverBalance = Convert.ToDecimal(getShopkeeperAccountDetails.ReceiverBalance); } else { _crossTransactionResponse.ErrorNumber = 1301; _crossTransactionResponse.ErrorMessage = ConfigurationManager.AppSettings[_crossTransactionResponse.ErrorNumber.ToString()]; } } catch (Exception e) { throw e; } return(_crossTransactionResponse); }
// Customer to Shopkeeper Transaction Service public CrossTransactionResponse CustomerToShopKeeperTransaction(CustomerToShopKeeperTransaction CustomerToShopkeeper) { _crossTransactionResponse = new CrossTransactionResponse(); try { var messageCreators = new List <ModelResponses <CrossTransactionResponse, ChangerValidations> > { // Check if the Shopkeeper Account is of Valid length new ModelResponses <CrossTransactionResponse, ChangerValidations>(model => model.IsShopKeeperAccountValid( CustomerToShopkeeper.ShopKeeperAccountNumber), 1101), // Check if the Customer Account is of Valid length new ModelResponses <CrossTransactionResponse, ChangerValidations>(model => model.IsCustomerNFCTagIDValid( CustomerToShopkeeper.NFCTagID), 1202), // Check if the Amount is of >0 new ModelResponses <CrossTransactionResponse, ChangerValidations>(model => model.IsAmountValid( CustomerToShopkeeper.Amount), 1401), }; ModelResponses <CrossTransactionResponse, ChangerValidations> errorCreator = null; if (!ChangerValidations.GetInputParametersStatus <CrossTransactionResponse, ChangerValidations>(messageCreators, out errorCreator)) { return(errorCreator.FillErrorDTO <CrossTransactionResponse>()); } // Get current customer details var currentCustomerDetails = _changerMintsUOW.Repository <CustomerDetail>().Query().Filter(q => q.NFCTagID == CustomerToShopkeeper.NFCTagID).Get().FirstOrDefault(); // Verify if the customer is registered to the changer if (currentCustomerDetails == null) { //Transaction Fail _crossTransactionResponse.ErrorNumber = 1208; _crossTransactionResponse.ErrorMessage = ConfigurationManager.AppSettings[_crossTransactionResponse.ErrorNumber.ToString()]; return(_crossTransactionResponse); } // Verify if the password matches if (!(currentCustomerDetails.Password == CustomerToShopkeeper.Password)) { _crossTransactionResponse.ErrorNumber = 1209; _crossTransactionResponse.ErrorMessage = ConfigurationManager.AppSettings[_crossTransactionResponse.ErrorNumber.ToString()]; return(_crossTransactionResponse); } var currentCustomerNFCDetails = _changerMintsUOW.Repository <CustomerNFCTagDetail>().Query().Filter(q => q.NFCTagID == CustomerToShopkeeper.NFCTagID).Get().FirstOrDefault(); if (currentCustomerNFCDetails.NFCTagUID != CustomerToShopkeeper.NFCTagUID) { //Transaction Fail - NFCUID mis match _crossTransactionResponse.ErrorNumber = 1210; _crossTransactionResponse.ErrorMessage = ConfigurationManager.AppSettings[_crossTransactionResponse.ErrorNumber.ToString()]; return(_crossTransactionResponse); } // Get current Customer Account Details var currentCustomerAccountDetails = _changerMintsUOW.Repository <CustomerAccountDetail>().Query().Filter(q => q.CustomerAccountNumber == currentCustomerDetails.CustomerAccountNumber).Get().FirstOrDefault(); // Verify if the customer has account in our system if (currentCustomerAccountDetails == null) { _crossTransactionResponse.ErrorNumber = 1208; _crossTransactionResponse.ErrorMessage = ConfigurationManager.AppSettings[_crossTransactionResponse.ErrorNumber.ToString()]; return(_crossTransactionResponse); } // Get current Shopkeeper Account Details var currentShopkeeperAccountDetails = _changerMintsUOW.Repository <ShopKeeperAccountDetail>().Query().Filter(q => q.ShopKeeperAccountNumber == CustomerToShopkeeper.ShopKeeperAccountNumber).Get().FirstOrDefault(); // Verify if the Shopkeeper has account in our system if (currentShopkeeperAccountDetails == null) { _crossTransactionResponse.ErrorNumber = 1107; _crossTransactionResponse.ErrorMessage = ConfigurationManager.AppSettings[_crossTransactionResponse.ErrorNumber.ToString()]; return(_crossTransactionResponse); } if (currentCustomerAccountDetails.Balance > 0 && currentCustomerAccountDetails.Balance > CustomerToShopkeeper.Amount) { var transactionID = GenerateTransactionID(); bool IsOTPRequired = (CustomerToShopkeeper.Amount >= MAXIMUM_TRANSACTION_LIMIT) ? true : false; if (IsOTPRequired) { if (CustomerToShopkeeper.OTP > 0) { // OTP is already sent, please validate the records & continue the transaction bool validateOTPStatus = ValidateOTP(CustomerToShopkeeper); if (validateOTPStatus) { // Start Transaction currentShopkeeperAccountDetails.ReceiverBalance += CustomerToShopkeeper.Amount; currentCustomerAccountDetails.Balance -= CustomerToShopkeeper.Amount; _changerMintsUOW.Repository <ShopKeeperAccountDetail>().Update(currentShopkeeperAccountDetails); _changerMintsUOW.Repository <CustomerAccountDetail>().Update(currentCustomerAccountDetails); _changerMintsUOW.Save(); } else { _crossTransactionResponse.ErrorNumber = 1500; _crossTransactionResponse.ErrorMessage = ConfigurationManager.AppSettings[_crossTransactionResponse.ErrorNumber.ToString()]; return(_crossTransactionResponse); } } else { // Generate OTP and send it as SMS to customer GenerateOTP(transactionID); // Send the response for Terminal _crossTransactionResponse.TransactionID = transactionID; return(_crossTransactionResponse); } } else { // Start Transaction currentShopkeeperAccountDetails.ReceiverBalance += CustomerToShopkeeper.Amount; currentCustomerAccountDetails.Balance -= CustomerToShopkeeper.Amount; _changerMintsUOW.Repository <ShopKeeperAccountDetail>().Update(currentShopkeeperAccountDetails); _changerMintsUOW.Repository <CustomerAccountDetail>().Update(currentCustomerAccountDetails); _changerMintsUOW.Save(); } // getting updated details after inserting values into database after transaction success var getShopkeeperAccountDetails = _changerMintsUOW.Repository <ShopKeeperAccountDetail>().Query().Filter(q => q.ShopKeeperAccountNumber == CustomerToShopkeeper.ShopKeeperAccountNumber).Get().FirstOrDefault(); var getCustomerAccountDetails = _changerMintsUOW.Repository <CustomerAccountDetail>().Query().Filter(q => q.CustomerAccountNumber == currentCustomerDetails.CustomerAccountNumber).Get().FirstOrDefault(); //updating details in transaction table after transaction sucess UpdateTransactionDetails <CustomerToShopKeeperTransaction>(CustomerToShopkeeper); // Fill the Response DTO & send back to the controller _crossTransactionResponse.ShopKeeperSenderBalance = Convert.ToDecimal(getShopkeeperAccountDetails.SenderBalance); _crossTransactionResponse.ShopKeeperReceiverBalance = Convert.ToDecimal(getShopkeeperAccountDetails.ReceiverBalance); _crossTransactionResponse.ErrorNumber = 1302; _crossTransactionResponse.ErrorMessage = ConfigurationManager.AppSettings[_crossTransactionResponse.ErrorNumber.ToString()]; } else { _crossTransactionResponse.ErrorNumber = 1301; _crossTransactionResponse.ErrorMessage = ConfigurationManager.AppSettings[_crossTransactionResponse.ErrorNumber.ToString()]; return(_crossTransactionResponse); } } catch (Exception e) { throw e; } return(_crossTransactionResponse); }
// Register customer to changer public CustomerNFCCardRegistrationResponse RegisterToChanger(CustomerNFCCardRegistration registrationWithNFC) { try { // If the phone number called is invalid if (registrationWithNFC.CalledPhoneNumber != CALLED_PHONE_NUMBER) { _changerMintsError.ErrorNumber = 1200; throw _changerMintsError; } // If Phone Number already registered var currentCustomer = _changerMintsUOW.Repository <CustomerDetail>().Query().Filter(q => q.PhoneNumber == registrationWithNFC.PhoneNumber).Get().FirstOrDefault(); if (currentCustomer != null) { _changerMintsError.ErrorNumber = 1207; throw _changerMintsError; } // Check if the NFC Tag ID is valid if (!ChangerValidations.IsCustomerNFCTagValid(registrationWithNFC.PIN)) { _changerMintsError.ErrorNumber = 1202; throw _changerMintsError; } // Block the phone number if it is an invalid NFC Tag PIN var customerNFCDetails = _changerMintsUOW.Repository <CustomerNFCTagDetail>().Query().Filter(q => q.PIN == registrationWithNFC.PIN).Get().FirstOrDefault(); if (customerNFCDetails == null) { var blockedCustomer = _changerMintsUOW.Repository <ChangerBlockList>().Query().Filter(q => q.MobileNumber == registrationWithNFC.PhoneNumber).Get().FirstOrDefault(); if (blockedCustomer == null) { var blockedCustomerDetail = new ChangerBlockList() { MobileNumber = registrationWithNFC.PhoneNumber, Attempts = 1, Blocked = false, SemiBlocked = false, }; _changerMintsUOW.Repository <ChangerBlockList>().Insert(blockedCustomerDetail); } else { blockedCustomer.Attempts++; if (blockedCustomer.Attempts >= BLOCKEDCUSTOMER) { blockedCustomer.Blocked = true; var wrongNFCEntries = new ChangerWrongNFCEntry() { MobileNumber = registrationWithNFC.PhoneNumber, NFC = registrationWithNFC.PIN }; } else if (blockedCustomer.Attempts >= SEMIBLOCKEDCUSTOMER) { blockedCustomer.SemiBlocked = true; var wrongNFCEntries = new ChangerWrongNFCEntry() { MobileNumber = registrationWithNFC.PhoneNumber, NFC = registrationWithNFC.PIN }; } } _changerMintsUOW.Save(); _changerMintsError.ErrorNumber = 1202; throw _changerMintsError; } // If customer NFC status is NOTACTIVE, then NFC is already registered. if (customerNFCDetails.NFCStatus != 1002) { _changerMintsError.ErrorNumber = 1206; throw _changerMintsError; } customerNFCDetails.NFCStatus = 1001; // If everything succeeds, register the customer to changer var customerDetail = new CustomerDetail() { CustomerAccountNumber = GenerateCustomerAccountNumber(registrationWithNFC.PhoneNumber), NFCTagID = customerNFCDetails.NFCTagID, PhoneNumber = registrationWithNFC.PhoneNumber.ToString(), CreatedDate = DateTime.Now, UpdatedDate = DateTime.Now, Password = GeneratePassword(), AccountStatus = 1001 }; _changerMintsUOW.Repository <CustomerDetail>().Insert(customerDetail); //If customer registers, add his account details. var customerAccountDetails = new CustomerAccountDetail() { CustomerAccountNumber = customerDetail.CustomerAccountNumber, Balance = 0.00m }; _changerMintsUOW.Repository <CustomerDetail>().Insert(customerDetail); _changerMintsUOW.Repository <CustomerAccountDetail>().Insert(customerAccountDetails); //save changes = false then it is just a response no need to save the details _changerMintsUOW.Save(); var registrationResponse = (from s in _changerMintsUOW.Repository <CustomerDetail>().Query().Filter(q => q.CustomerAccountNumber == customerDetail.CustomerAccountNumber).Get() select new CustomerNFCCardRegistrationResponse { PhoneNumber = s.PhoneNumber, Accountnumber = s.CustomerAccountNumber, PIN = s.Password, ErrorNumber = 1151, ErrorMessage = System.Configuration.ConfigurationManager.AppSettings[Convert.ToString(1151)] }).FirstOrDefault(); return(registrationResponse); } catch (ChangerMintsError Er) { throw new ChangerMintsError(Er.ErrorNumber); } catch (Exception ex) { if (ex.InnerException == null) { throw ex; } else { throw ex.InnerException; } } }