Ejemplo n.º 1
0
        public async Task <IActionResult> SendOTP(ExistingCustomer request)
        {
            dt = new DataTable();
            dc = new Dictionary <string, string>();
            dt = await acc.CheckExistingRegister("", request.LineUserId);

            string agreementNo = "";
            string PhoneNumber = "";

            PhoneNumber = request.PhoneNumber.Remove(0, 1);
            PhoneNumber = "66" + PhoneNumber;
            if (dt.Rows.Count == 0)
            {
                dc.Add("refCode", "");
                dc.Add("result", "ไม่พบบัญชีนี้ในระบบ");
                return(NotFound(dc));
            }
            agreementNo = dt.Rows[0]["Agreement No_"].ToString();
            dt          = new DataTable();
            dt          = management.REST_GenerateOTP(request.PhoneNumber, agreementNo, "UpdateMobile");
            string urlData = string.Format(state.SMSConfigs.UrlBase + "user={0}&pass={1}&type={2}&to={3}&from={4}&text={5}&servid={6}", state.SMSConfigs.User, state.SMSConfigs.Pass, state.SMSConfigs.Type, PhoneNumber, state.SMSConfigs.From, func.ToHexString(dt.Rows[0]["Message"].ToString()), state.SMSConfigs.ServID);

            acc.CallAPI(urlData);
            dc = new Dictionary <string, string>();
            dc.Add("refCode", dt.Rows[0]["OTP_Reference"].ToString());
            dc.Add("result", "Success");
            return(Ok(dc));
        }