示例#1
0
        public async Task <CreatePaymentResponse> Create([FromBody] CreatePaymentRequest request)
        {
            var steamId      = ulong.Parse(request.SteamId);
            var payerSteamId = steamId;

            if (request.PayerSteamId != null)
            {
                payerSteamId = ulong.Parse(request.PayerSteamId);
            }

            var matchId = request.MatchId;
            var url     = request.Provider switch
            {
                CreatePaymentProvider.Alipay => await _stripeService.CreateAlipayRequest(steamId, payerSteamId, matchId, request.PaymentKind),
                CreatePaymentProvider.WeChat => await _stripeService.CreateWeChatRequest(steamId, payerSteamId, matchId, request.PaymentKind),
                _ => throw new Exception($"Unknown provider kind: {request.Provider}"),
            };

            return(new CreatePaymentResponse {
                Url = url
            });
        }