public async Task <IActionResult> SetForMerchant(string merchantId, string assetPairId, [FromBody] UpdateMarkupRequest request) { IMerchant merchant = await _merchantService.GetAsync(merchantId); if (merchant == null) { return(NotFound(ErrorResponse.Create("Merchant not found"))); } if (!string.IsNullOrEmpty(request.PriceAssetPairId)) { AssetPair priceAssetPair = await _assetsLocalCache.GetAssetPairByIdAsync(request.PriceAssetPairId); if (priceAssetPair == null) { return(NotFound(ErrorResponse.Create("Price asset pair doesn't exist"))); } } try { await _markupService.SetForMerchantAsync(assetPairId, merchantId, request.PriceAssetPairId, request.PriceMethod, request); return(Ok()); } catch (Exception ex) { await _log.WriteErrorAsync(nameof(MarkupsController), nameof(SetForMerchant), ex); throw; } }
public async Task <IActionResult> SetForMerchant(string merchantId, string assetPairId, [FromBody] UpdateMarkupRequest request) { merchantId = Uri.UnescapeDataString(merchantId); assetPairId = Uri.UnescapeDataString(assetPairId); try { if (!string.IsNullOrEmpty(request.PriceAssetPairId)) { AssetPair priceAssetPair = await _assetsLocalCache.GetAssetPairByIdAsync(request.PriceAssetPairId); if (priceAssetPair == null) { return(NotFound(ErrorResponse.Create("Price asset pair doesn't exist"))); } } await _markupService.SetForMerchantAsync( assetPairId, merchantId, request.PriceAssetPairId, request.PriceMethod, request); return(Ok()); } catch (InvalidRowKeyValueException e) { _log.ErrorWithDetails(e, new { e.Variable, e.Value }); return(NotFound(ErrorResponse.Create("Merchant or asset pair not found"))); } }