Exemplo n.º 1
0
        public async Task <IActionResult> PayAsync([FromBody] PaymentRequest model,
                                                   [FromServices] PayMeCredentials payMeCredentials,
                                                   [FromServices] TelemetryClient client,
                                                   CancellationToken token)
        {
            try
            {
                var command = new PaymentCommand(model.UserId, model.TutorId, model.StudentPay, model.SpitballPay,
                                                 model.StudyRoomSessionId, payMeCredentials.BuyerKey, model.AdminDuration);
                await _commandBus.DispatchAsync(command, token);

                return(Ok());
            }
            catch (HttpRequestException ex)
            {
                client.TrackException(ex, model.AsDictionary());
                return(BadRequest(ex.Message));
            }
        }