예제 #1
0
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='userId'>
 /// Lykke user Id (won't be use for Chainalysis)
 /// </param>
 /// <param name='transaction'>
 /// Transaction to be added
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <object> UserByUserIdAddtransactionPostAsync(this IChainalysisProxyAPI operations, string userId, NewTransactionModel transaction = default(NewTransactionModel), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.UserByUserIdAddtransactionPostWithHttpMessagesAsync(userId, transaction, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
예제 #2
0
        /// <summary>
        /// Add Transaction
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="transaction"></param>
        /// <returns></returns>
        public async Task <UserScoreDetails> AddTransaction(string userId, NewTransactionModel transaction)
        {
            var result = await _service.UserByUserIdAddtransactionPostWithHttpMessagesAsync(userId, transaction.Map());

            if (result.Response.IsSuccessStatusCode)
            {
                return(Mapper.Map <UserScoreDetails>(result.Body));
            }

            return(null);
        }
        /// <summary>
        /// Add Transaction
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="transaction"></param>
        /// <returns></returns>
        public async Task <Contracts.NewTransactionModel> AddTransaction(string userId, Contracts.NewTransactionModel transaction)
        {
            var task    = _service.UserByUserIdAddtransactionPostWithHttpMessagesAsync(userId, transaction.Map());
            var resTask = await TaskWithDelay(task);

            if (resTask != task)
            {
                _log.WriteWarning(nameof(ChainalysisProxyClient), nameof(AddTransaction), $"Timeout with {transaction.Transaction}");
                return(null);
            }

            var result = task.Result;

            if (result.Response.IsSuccessStatusCode)
            {
                return(MapNewTransactionModel((INewTransactionModel)result.Body));
            }

            return(null);
        }