public void TranslationBatchCancelGetTest() { BatchCreate batchCreate = new BatchCreate(); batchCreate = translationApi.TranslationBatchCreateGet(null); BatchCancel batchCancel = new BatchCancel(); batchCancel = translationApi.TranslationBatchCancelGet(batchCreate.BatchId, null); Assert.IsNotNull(batchCancel.Status); }
public void TranslationBatchCancelGetAsyncTest() { BatchCreate batchCreate = new BatchCreate(); batchCreate = translationApi.TranslationBatchCreateGet(null); BatchCancel batchCancel = new BatchCancel(); Task.Run(async() => { batchCancel = await translationApi.TranslationBatchCancelGetAsync(batchCreate.BatchId, null); }).Wait(); Assert.IsNotNull(batchCancel.Status); }
CancelTransactionsResponse ICommonGameActionsProvider.BatchCancel(BatchCancel request) { var errorCode = GameApiErrorCode.NoError; var errorDescription = (string)null; var errorsList = new ConcurrentBag <BatchCommandTransactionError>(); var txCount = 0; try { txCount = request.Transactions.Count; request.Transactions.AsParallel().ForAll(async transaction => { try { await CancelTransaction(transaction, request.BatchId); } catch (Exception ex) { errorsList.Add(CreateBatchTransactionError(ex, transaction.Id, transaction.UserId)); } }); } catch (Exception ex) { errorCode = _errors.GetErrorCodeByException(ex, out errorDescription); } return(new CancelTransactionsResponse { BatchId = request.BatchId, TransactionCount = txCount, BatchTimestamp = DateTimeOffset.UtcNow.ToString("O"), Errors = errorsList.ToList(), ErrorCode = errorCode, ErrorDescription = errorDescription }); }
public CancelTransactionsResponse Post(BatchCancel request) { return(GameActions.BatchCancel(request)); }