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));
            }
        }
示例#2
0
 public PayMePaymentProvider(HttpClient client, PayMeCredentials credentials)
 {
     _client      = client;
     _credentials = credentials ?? throw new ArgumentNullException(nameof(credentials));
 }