コード例 #1
0
        public async Task <IActionResult> GetCalculatedAmountInfoAsync([FromBody] GetCalculatedAmountInfoRequest model)
        {
            try
            {
                ICalculatedAmountInfo calculatedAmountInfo = await _orderService.GetCalculatedAmountInfoAsync(
                    model.SettlementAssetId,
                    model.PaymentAssetId,
                    model.Amount,
                    model.MerchantId);

                return(Ok(calculatedAmountInfo));
            }
            catch (AssetUnknownException e)
            {
                _log.ErrorWithDetails(e, new { e.Asset });

                return(BadRequest(ErrorResponse.Create(e.Message)));
            }
            catch (MarkupNotFoundException e)
            {
                _log.ErrorWithDetails(e, new
                {
                    e.MerchantId,
                    e.AssetPairId
                });

                return(BadRequest(ErrorResponse.Create(e.Message)));
            }
            catch (MarketPriceZeroException e)
            {
                _log.ErrorWithDetails(e, new { e.PriceType });

                return(BadRequest(ErrorResponse.Create(e.Message)));
            }
            catch (UnexpectedAssetPairPriceMethodException e)
            {
                _log.ErrorWithDetails(e, new { e.PriceMethod });

                return(BadRequest(ErrorResponse.Create(e.Message)));
            }
        }
コード例 #2
0
 public Task <CalculatedAmountResponse> GetCalculatedAmountInfoAsync(GetCalculatedAmountInfoRequest model)
 {
     return(_runner.RunWithDefaultErrorHandlingAsync(() => _ordersApi.GetCalculatedAmountInfoAsync(model)));
 }