public async Task <IActionResult> SetAssetGeneralSettings([FromBody] UpdateAssetGeneralSettingsRequest request) { try { string lykkeAssetId = await _lykkeAssetsResolver.GetLykkeId(request.AssetDisplayId); Asset asset = await _assetsLocalCache.GetAssetByIdAsync(lykkeAssetId); if (asset == null) { return(NotFound(ErrorResponse.Create($"Asset {request.AssetDisplayId} not found"))); } await _assetSettingsService.SetGeneralAsync(Mapper.Map <AssetGeneralSettings>(request)); return(NoContent()); } catch (InvalidRowKeyValueException e) { _log.ErrorWithDetails(e, new { e.Variable, e.Value }); return(NotFound(ErrorResponse.Create("Asset not found"))); } catch (AssetUnknownException e) { _log.ErrorWithDetails(e, new { e.Asset }); return(NotFound(ErrorResponse.Create($"Asset {e.Asset} can't be resolved"))); } }
public async Task <ActionResult> AddGeneralSettings(AddGeneralSettingsDialogViewModel model) { if (string.IsNullOrEmpty(model.AssetDisplayId)) { return(this.JsonFailResult(Phrases.FieldShouldNotBeEmpty, ErrorMessageAnchor)); } var request = new UpdateAssetGeneralSettingsRequest(); request.AssetDisplayId = model.AssetDisplayId; request.Network = (BlockchainType)Enum.Parse(typeof(BlockchainType), model.SelectedNetwork); request.PaymentAvailable = model.PaymentAvailable; request.SettlementAvailable = model.SettlementAvailable; try { await _payInternalClient.SetAssetGeneralSettingsAsync(request); } catch (DefaultErrorResponseException ex) { if (ex.InnerException != null) { var content = Newtonsoft.Json.JsonConvert.DeserializeObject <ErrorResponse>(((Refit.ApiException)ex.InnerException).Content); return(this.JsonFailResult(content.ErrorMessage, ErrorMessageAnchor)); } else { return(this.JsonFailResult(ex.Message, ErrorMessageAnchor)); } } return(this.JsonRequestResult("#generalSettingsList", Url.Action("GeneralSettingsList"))); }
public Task SetAssetGeneralSettingsAsync(UpdateAssetGeneralSettingsRequest request) { return(_runner.RunWithDefaultErrorHandlingAsync(() => _assetsApi.SetAssetGeneralSettingsAsync(request))); }