コード例 #1
0
        public Uri Haravan_BuildPageAuthUri(string shopUrl)
        {
            var url = new HaravanService.HaravanService().BuildPageAuthUri();
            var s   = url.ToString();

            return(url);
        }
コード例 #2
0
        public async Task <Integration> Haravan_Auth(string shopUrl, string accessToken, string userId)
        {
            Integration result = new Integration();

            HaravanService.HaravanService svc = new HaravanService.HaravanService(accessToken);
            var res = await svc.CountPage();

            if (res.Code == System.Net.HttpStatusCode.OK)
            {
                var info = new Integration()
                {
                    Id                = Guid.NewGuid(),
                    SiteId            = (int)IntegrationType.Haravan,
                    AccId             = shopUrl,
                    Email             = shopUrl,
                    ApiKey            = accessToken,
                    UserId            = userId,
                    LastConnectedDate = DateTime.Now
                };
                IU(info, userId);
                result = info;
            }
            else
            {
                throw new BusinessException("Không thể kết nối Haravan");
            }
            return(result);
        }