/// <summary>
        /// Refund Credit Card Async.
        /// </summary>
        /// <returns>ANetRefundCreateTransactionResponse instance</returns>
        /// <param name="transaction">TransactionRequest.</param>
        /// <param name="refId">Reference identifier.</param>
        public async Task <ANetRefundTransactionResponse> RefundAsync(ANetRefundTransactionRequest transaction, string refId)
        {
            var createRequest          = new ANetRefundCreateTransactionRequest();
            var requestBody            = new ANetRefundTransactionRequestBody();
            var merchantAuthentication = getMerchantAuthentication();

            transaction.TransactionType        = ANetTransactionType.refundTransaction;
            requestBody.MerchantAuthentication = merchantAuthentication;
            requestBody.RefId = refId;
            requestBody.TransactionRequest         = transaction;
            createRequest.CreateTransactionRequest = requestBody;
            return(await refundAsync(createRequest));
        }
        private async Task <ANetRefundTransactionResponse> refundAsync(ANetRefundCreateTransactionRequest request)
        {
            var json      = JSON.SerializeObject(request);
            var strResult = await _endPoint.PostStringAsync(json).ReceiveString();

            var entity = JSON.DeserializeObject <ANetRefundCreateTransactionResponse>(strResult);

            if (entity.TransactionResponse != null)
            {
                return(entity.TransactionResponse);
            }
            else
            {
                //return a new transactionResponse object with the message list
                var errorEntity = new ANetRefundTransactionResponse();
                var messages    = JSON.DeserializeObject <ANetCreateResponseMessages>(strResult);
                errorEntity.ResponseCode = ANetResponseCodeType.Error;
                errorEntity.Messages     = messages.ToMessageEnumerable();
                return(errorEntity);
            }
        }