Пример #1
0
        public async Task <MChatResponseGenerateQRCode> GenerateNewCodeAsync(MChatGenerateQRCodeRequestBody generateQRCodeBody, StateChanged bnsStateChanged)
        {
            this.stateChanged = bnsStateChanged;
            MChatGenerateQRCodeBodyPrivate privateBody = new MChatGenerateQRCodeBodyPrivate(generateQRCodeBody)
            {
            };
            String body     = JsonConvert.SerializeObject(privateBody);
            var    response = await httpClient.PostAsync("https://" + configBuilder.domain + "/v1/api/worker/onlineqr/generate", new StringContent(body, Encoding.UTF8, "application/json"));

            if (response.StatusCode == System.Net.HttpStatusCode.OK)
            {
                var responseBody = await response.Content.ReadAsStringAsync();

                mChatResponseGenerateQRCode = JsonConvert.DeserializeObject <MChatResponseGenerateQRCode>(responseBody);
                ConnectToBusinessNotificationService();
                return(mChatResponseGenerateQRCode);
            }
            else
            {
                mChatResponseGenerateQRCode         = new MChatResponseGenerateQRCode();
                mChatResponseGenerateQRCode.code    = (int)response.StatusCode;
                mChatResponseGenerateQRCode.message = response.ReasonPhrase;
                return(mChatResponseGenerateQRCode);
            }
        }
Пример #2
0
 public MChatGenerateQRCodeBodyPrivate(MChatGenerateQRCodeRequestBody body)
 {
     this.totalPrice = body.totalPrice;
     this.products   = body.products;
     this.title      = body.title;
     this.subTitle   = body.subTitle;
     this.noat       = body.noat;
     this.nhat       = body.nhat;
     this.ttd        = body.ttd;
 }