public async Task <IActionResult> GetSettlementAssets() { try { AvailableAssetsResponse response = await _payInternalClient.GetAvailableSettlementAssetsAsync(_headersHelper.MerchantId); return(Ok(Mapper.Map <AssetsResponseModel>(response))); } catch (Exception ex) { _log.Error(ex, null, $"request: {new {_headersHelper.MerchantId}.ToJson()}"); throw; } }
public async Task <IReadOnlyDictionary <string, string> > GetPaymentAssetsAsync(string merchantId, string settlementAssetId) { var result = new Dictionary <string, string>(); try { AvailableAssetsResponse response = await _payInternalClient.GetAvailablePaymentAssetsAsync(merchantId, settlementAssetId); foreach (string assetId in response.Assets) { Asset asset = await _lykkeAssetsResolver.TryGetAssetAsync(assetId); result.TryAdd(assetId, asset?.DisplayId ?? assetId); } } catch (Exception ex) { _log.ErrorWithDetails(ex, new { merchantId, settlementAssetId }); } return(result); }
public async Task <IActionResult> GetPaymentAssets(string settlementAssetId) { try { AvailableAssetsResponse response = await _payInternalClient.GetAvailablePaymentAssetsAsync(_headersHelper.MerchantId, settlementAssetId); return(Ok(Mapper.Map <AssetsResponseModel>(response))); } catch (Exception ex) { _log.Error(ex, null, $@"request: { new { _headersHelper.MerchantId, settlementAssetId }.ToJson() }"); if (ex is DefaultErrorResponseException clientEx) { if (clientEx.StatusCode == HttpStatusCode.NotFound) { return(NotFound(clientEx.Error)); } if (clientEx.StatusCode == HttpStatusCode.BadRequest) { return(BadRequest(clientEx.Error)); } } throw; } }