Exemplo n.º 1
0
        /// Method Name     : PostTransactionHistory
        /// Author          : Ranjana Singh
        /// Creation Date   : 23 Jan 2018
        /// Purpose         : Creates new records for transaction history based on given customer ID.
        /// Revision        : By Pratik Soni on 27 Jan 2018: Modified to send proper request body for CRM POST method and return validated serviceResponse
        /// </summary>
        public DTO.ServiceResponse <DTO.Payment> PostTransactionHistory(DTO.Payment dtoPayment)
        {
            Dictionary <string, string> crmResponse;
            string jsonFormattedData;
            string moveGUID, customerGUID;

            try
            {
                moveGUID              = General.GetSpecificAttributeFromCRMResponse(dalMoveDetails.GetMoveGUID(dtoPayment.MoveID), "jkmoving_moveid");
                customerGUID          = General.GetSpecificAttributeFromCRMResponse(dalCustomerDetails.GetCustomerGUID(dtoPayment.CustomerID), "contactid");
                dtoPayment.MoveID     = moveGUID;
                dtoPayment.CustomerID = customerGUID;

                jsonFormattedData = General.ConvertToJson <Payment>(dtoPayment);
                crmResponse       = crmUtilities.ExecutePostRequest(transactionEntityNamePlural, dtoToCRMMapper.MapPaymentDTOToCRM(jsonFormattedData));

                return(crmUtilities.GetFormattedResponseToDTO <Payment>(crmResponse));
            }
            catch (Exception ex)
            {
                logger.Error(resourceManager.GetString("msgServiceUnavailable"), ex);
                return(new ServiceResponse <Payment> {
                    Message = resourceManager.GetString("msgServiceUnavailable")
                });
            }
        }