コード例 #1
0
ファイル: PaymentMutations.cs プロジェクト: EventMS/EMS
        public async Task <PaymentIntentResponse> SignUpForEvent(Guid eventId,
                                                                 [CurrentUserGlobalState] CurrentUser currentUser)
        {
            var price = await _service.CalculateEventPriceForUserAsync(eventId, currentUser);

            if (price == null)
            {
                throw new QueryException(ErrorBuilder.New()
                                         .SetMessage("Price is missing unexpectedly")
                                         .SetCode("ID_UNKNOWN")
                                         .Build());
            }

            var clientSecret = _stripeService.SignUpToEvent(price.Value, currentUser.UserId, eventId);

            return(new PaymentIntentResponse()
            {
                ClientSecret = clientSecret,
                Price = price.Value
            });
        }