Esempio n. 1
0
        public async Task <SaleForceAuthTokenResponse> SaleForceAuthToken()
        {
            var url         = $"{_configuration.GetSection("SaleForce:AuthUrl").Value}";
            var requestBody = new SaleForceAuthTokenRequest()
            {
                grant_type    = $"{_configuration.GetSection("SaleForce:grant_type").Value}",
                client_id     = $"{_configuration.GetSection("SaleForce:client_id").Value}",
                client_secret = $"{_configuration.GetSection("SaleForce:client_secret").Value}",
                account_id    = $"{_configuration.GetSection("SaleForce:account_id").Value}",
            };

            return(await _httpFactory.ClientPostAsync <SaleForceAuthTokenRequest, SaleForceAuthTokenResponse>(url, requestBody));
        }
Esempio n. 2
0
        public async Task <EcouponsRegisterResponseDto> EcouponsRegister(UserRegisterDto registeredUser)
        {
            var headers = new Dictionary <string, string>
            {
                { _configuration.GetSection("Ecoupons:APIKey").Key, _configuration.GetSection("Ecoupons:APIKey").Value },
                { _configuration.GetSection("Ecoupons:ServiceKey").Key, _configuration.GetSection("Ecoupons:ServiceKey").Value },
                { _configuration.GetSection("Ecoupons:Password").Key, _configuration.GetSection("Ecoupons:Password").Value },
                { _configuration.GetSection("Ecoupons:RequestType").Key, _configuration.GetSection("Ecoupons:RequestType").Value },
                { "ReferenceNo", new Random().Next(0, 10000000).ToString() }
            };
            var url  = $"{_configuration.GetSection("Ecoupons:Url").Value}/eCoponAPI/RegisterPepsi";
            var user = _mapper.Map <EcouponRegisterDto>(registeredUser);

            return(await _httpFactory.ClientPostAsync <EcouponRegisterDto, EcouponsRegisterResponseDto>(url, user, headers));
        }