public async Task <ActionResult> CreateDeposit([FromBody] AssetDepositData deposit) { if (!ModelState.IsValid) { return(BadRequest(new ApiResponse { Status = false, ModelState = ModelState })); } try { var newDeposit = await _orderService.AddDepositAsync(deposit); if (newDeposit == null) { return(BadRequest(new ApiResponse { Status = false })); } else { return(Ok(new ApiResponse { Status = true, Deposit = newDeposit })); } } catch (Exception exp) { _logger.LogError(exp.Message); return(BadRequest(new ApiResponse { Status = false })); } }
public AssetDepositData AddDeposit(AssetDepositData depositNotification) { //depositNotification.referenceId = Guid.NewGuid().ToString(); lock (DepositNotificationLock) { DepositNotifications.TryAdd(depositNotification.referenceId, depositNotification); Console.WriteLine("Asset Deposit Notification {0} Added", depositNotification.referenceId); AssetTransferData newTransfer = new AssetTransferData(); newTransfer.clientId = depositNotification.clientId; newTransfer.referenceId = depositNotification.referenceId; newTransfer.assetId = depositNotification.assetId; newTransfer.assetAmount = depositNotification.amount; newTransfer.transferStatus = TransferStatusEnum.InProgress; newTransfer.transferType = TransferTypeEnum.Deposit; newTransfer.tokenId = '@' + depositNotification.assetId; newTransfer.tokenAmount = depositNotification.amount; switch (newTransfer.clientId) { case 1: newTransfer.forAccountOf = "TradezDigital"; break; case 4: newTransfer.forAccountOf = "VinceSmall"; break; case 5: newTransfer.forAccountOf = "MarkVanRoon"; break; default: newTransfer.forAccountOf = String.Format("Abacas Exchange Client {0}", newTransfer.clientId); break; } lock (AssetTransferLock) { AssetTransfers.TryAdd(newTransfer.referenceId, newTransfer); Console.WriteLine("Asset Deposit Transfer Added {0}", newTransfer.referenceId); } } return(depositNotification); }
public Task <AssetDepositData> AddDepositAsync(AssetDepositData depositNotification) { return(_orderServiceClient.AddDepositAsync(depositNotification)); }
public void DepositAdded(AssetDepositData depositData) { Console.WriteLine("Deposit of {0} {1} with Reference {2} Added", depositData.assetId, depositData.amount, depositData.referenceId); }