/// <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 <GenerateAddressModel> ApiGeneratePostAsync(this ILykkePayServiceGenerateAddressMicroService operations, GenerateAddressRequest request = default(GenerateAddressRequest), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ApiGeneratePostWithHttpMessagesAsync(request, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
public async Task <IActionResult> GenerateAddress(string assertId) { var isValid = await ValidateRequest(); if ((isValid as OkResult)?.StatusCode != Ok().StatusCode) { return(isValid); } var response = await _gaService.ApiGeneratePostWithHttpMessagesAsync(new GenerateAddressRequest { MerchantId = MerchantId, AssertId = assertId }); var publicKey = response.Body.Address; var result = new { Currency = assertId, Address = publicKey }; var context = new { MerchantId, AssertId = assertId, Address = publicKey }; await Log.WriteInfoAsync(nameof(GenerateAddressController), nameof(GenerateAddress), context.ToJson(), $"Generate address for mercahnt"); return(Json(result)); }
public async Task <IActionResult> CreateNewOrder([FromBody] OrderRequest request) { var isValid = await ValidateRequest(); if ((isValid as OkResult)?.StatusCode != Ok().StatusCode) { return(isValid); } var store = request?.GetRequest(MerchantId); if (store == null) { return(BadRequest()); } store.MerchantPayRequestStatus = MerchantPayRequestStatus.New.ToString(); //store.MerchantPayRequestNotification = MerchantPayRequestNotification.InProgress.ToString(); var resp = await _gaService.ApiGeneratePostWithHttpMessagesAsync(new GenerateAddressRequest { MerchantId = MerchantId, AssertId = store.ExchangeAssetId }); var result = await GenerateOrder(store, resp.Body.Address); if (result == null) { return(BadRequest()); } await Log.WriteInfoAsync(nameof(OrderController), nameof(CreateNewOrder), OrderContext(MerchantId, result), "Created new order"); return(Json(result)); }