Beispiel #1
0
        public Task <bool> RequestPaymentAsync(int amount, string sourceId, string currency, string description)
        {
            var dto = new ChargeDto
            {
                Amount       = amount,
                CardSourceId = sourceId,
                Currency     = currency,
                Description  = description
            };
            var request = new PostCreateChargeRequest(_jsonSerializer, dto, _stripeConfig);

            return(_restHttpClient.TrySendAsync(request, _logger));
        }
Beispiel #2
0
        internal Task <bool> RegisterAsync(string email, string password, bool isAcceptedTerms)
        {
            var dto = new RegisterDto
            {
                Email    = email,
                Password = password,
                IsAcceptedTermsOfService = isAcceptedTerms
            };
            var request = new RegisterRequest(_jsonSerializer, dto, _authConfig);

            return(_restHttpClient.TrySendAsync(request, _logger));
        }
        public async Task <string> UploadImageAsync(Stream image, string extension)
        {
            var getTokenRequest = new GetAzureTokenRequest(_chatConfig.ApiUrl);
            var token           = default(string);

            try
            {
                token = await _httpClient.SendAndGetResponseAsync(getTokenRequest).ConfigureAwait(false);
            }
            catch (Exception ex)
            {
                _logger.Error(ex);
            }

            if (token == null)
            {
                return(null);
            }

            var uploadRequest = new UploadImageRequest(_chatConfig.BlobUrl, token.Replace("\"", string.Empty), image, extension);
            var uploadResult  = await _httpClient.TrySendAsync(uploadRequest, _logger).ConfigureAwait(false);

            return(uploadResult ? uploadRequest.FilePath : null);
        }
Beispiel #4
0
        public Task <bool> CloseChatAsync(string chatId)
        {
            var request = new PutCloseChatRequest(_chatConfig.ApiUrl, chatId);

            return(_httpClient.TrySendAsync(request, _logger));
        }