示例#1
0
        private async Task <OrderRequestResponse> GenerateOrder(Lykke.Pay.Service.StoreRequest.Client.Models.OrderRequest store, string address)
        {
            store.SourceAddress = address;

            var rate = await GetRatesWithSession(store.AssetPair, new AprRequest
            {
                Markup = new AssertPairRateRequest
                {
                    Percent = store.Markup.Percent ?? 0,
                    Pips    = store.Markup.Pips ?? 0
                }
            });

            if (rate == null)
            {
                return(null);
            }



            store.OriginAmount = store.Amount;
            store.Amount       = Math.Round((store.Amount ?? 0d) / rate.Bid, 8);
            await _storeRequestClient.ApiStoreOrderPostWithHttpMessagesAsync(store);



            return(new OrderRequestResponse(store, rate.Bid));
        }
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='request'>
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task ApiStoreOrderPostAsync(this ILykkePayServiceStoreRequestMicroService operations, OrderRequest request = default(OrderRequest), CancellationToken cancellationToken = default(CancellationToken))
 {
     (await operations.ApiStoreOrderPostWithHttpMessagesAsync(request, null, cancellationToken).ConfigureAwait(false)).Dispose();
 }