check activation code

merge-requests/193/head
Elham Rababah 4 years ago
parent 7001940d0d
commit 9b0731d5c8

@ -61,7 +61,9 @@ class BaseAppClient {
body['SessionID'] = SESSION_ID;
body['IsLoginForDoctorApp'] = IS_LOGIN_FOR_DOCTOR_APP;
body['PatientOutSA'] = 0; // PATIENT_OUT_SA;
body['VidaAuthTokenID'] = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMDAyIiwianRpIjoiZjcwMTUyYzktMjAwNy00Y2FjLTkzMWUtOGI0MDlhMWFkNjc4IiwiZW1haWwiOiIiLCJpZCI6IjEwMDIiLCJOYW1lIjoiVEVNUCAtIERPQ1RPUiIsIkVtcGxveWVlSWQiOiI0NzA5IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiI0NzA5IiwiU0VTU0lPTklEIjoiMjE1ODU1MzAiLCJDbGluaWNJZCI6IjE3Iiwicm9sZSI6IkRPQ1RPUlMiLCJuYmYiOjE2MDg1NTMxMDAsImV4cCI6MTYwOTQxNzEwMCwiaWF0IjoxNjA4NTUzMTAwfQ.lydDI-nsHlmb4Z4vesnckCU1i3hnNayoWVacc3E5_XM";
body['VidaAuthTokenID'] = await sharedPref.getString(VIDA_AUTH_TOKEN_ID);
body['VidaRefreshTokenID'] = await sharedPref.getString(VIDA_REFRESH_TOKEN_ID);
print("URL : $url");
print("Body : ${json.encode(body)}");

@ -78,6 +78,11 @@ const SEND_ACTIVATION_CODE_FOR_DOCTOR_APP =
const MEMBER_CHECK_ACTIVATION_CODE_NEW =
'Services/Sentry.svc/REST/MemberCheckActivationCode_New';
const CHECK_ACTIVATION_CODE_FOR_DOCTOR_APP =
'Services/DoctorApplication.svc/REST/CheckActivationCodeForDoctorApp';
const GET_DOC_PROFILES = 'Services/Doctors.svc/REST/GetDocProfiles';
const TRANSFERT_TO_ADMIN = 'LiveCareApi/DoctorApp/TransferToAdmin';
const END_CALL = 'LiveCareApi/DoctorApp/EndCall';

@ -1,5 +1,13 @@
final TOKEN = 'token';
final PROJECT_ID = 'projectID';
final VIDA_AUTH_TOKEN_ID = 'VidaAuthTokenID';
final VIDA_REFRESH_TOKEN_ID = 'VidaRefreshTokenID';
final LOGIN_TOKEN_ID = 'LogInToken';
// set VidaAuthTokenID
// VidaRefreshTokenID
// LogInTokenIDPROJECT_ID = 'projectID';
//===========amjad============
final DOCTOR_ID = 'doctorID';
//=======================

@ -1,5 +1,6 @@
import 'package:doctor_app_flutter/client/base_app_client.dart';
import 'package:doctor_app_flutter/models/auth/activation_Code_req_model.dart';
import 'package:doctor_app_flutter/models/auth/check_activation_code_request_model.dart';
import 'package:doctor_app_flutter/models/doctor/clinic_model.dart';
import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart';
@ -158,6 +159,29 @@ class AuthViewModel with ChangeNotifier {
}
}
Future<dynamic> checkActivationCodeForDoctorApp(CheckActivationCodeRequestModel checkActivationCodeRequestModel) async {
try {
dynamic localRes;
await baseAppClient.post(CHECK_ACTIVATION_CODE_FOR_DOCTOR_APP,
onSuccess: (dynamic response, int statusCode) {
localRes = response;
selectedClinicName =
ClinicModel.fromJson(response['List_DoctorsClinic'][0]).clinicName;
response['List_DoctorsClinic'].forEach((v) {
doctorsClinicList.add(new ClinicModel.fromJson(v));
});
}, onFailure: (String error, int statusCode) {
throw error;
}, body: checkActivationCodeRequestModel.toJson());
return Future.value(localRes);
} catch (error) {
print(error);
throw error;
}
}
/*
*@author: Elham Rababah
*@Date:17/5/2020

@ -0,0 +1,64 @@
class CheckActivationCodeRequestModel {
String mobileNumber;
String zipCode;
int doctorID;
String iPAdress;
int channel;
int languageID;
int projectID;
double versionID;
String generalid;
String logInTokenID;
String activationCode;
String vidaAuthTokenID;
String vidaRefreshTokenID;
CheckActivationCodeRequestModel(
{this.mobileNumber,
this.zipCode,
this.doctorID,
this.iPAdress,
this.channel,
this.languageID,
this.projectID,
this.versionID,
this.generalid,
this.logInTokenID,
this.activationCode,
this.vidaAuthTokenID,
this.vidaRefreshTokenID});
CheckActivationCodeRequestModel.fromJson(Map<String, dynamic> json) {
mobileNumber = json['MobileNumber'];
zipCode = json['ZipCode'];
doctorID = json['DoctorID'];
iPAdress = json['IPAdress'];
channel = json['Channel'];
languageID = json['LanguageID'];
projectID = json['ProjectID'];
versionID = json['VersionID'];
generalid = json['generalid'];
logInTokenID = json['LogInTokenID'];
activationCode = json['activationCode'];
vidaAuthTokenID = json['VidaAuthTokenID'];
vidaRefreshTokenID = json['VidaRefreshTokenID'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['MobileNumber'] = this.mobileNumber;
data['ZipCode'] = this.zipCode;
data['DoctorID'] = this.doctorID;
data['IPAdress'] = this.iPAdress;
data['Channel'] = this.channel;
data['LanguageID'] = this.languageID;
data['ProjectID'] = this.projectID;
data['VersionID'] = this.versionID;
data['generalid'] = this.generalid;
data['LogInTokenID'] = this.logInTokenID;
data['activationCode'] = this.activationCode;
data['VidaAuthTokenID'] = this.vidaAuthTokenID;
data['VidaRefreshTokenID'] = this.vidaRefreshTokenID;
return data;
}
}

@ -1,6 +1,7 @@
import 'dart:async';
import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
import 'package:doctor_app_flutter/models/auth/check_activation_code_request_model.dart';
import 'package:doctor_app_flutter/models/doctor/clinic_model.dart';
import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart';
import 'package:doctor_app_flutter/models/doctor/profile_req_Model.dart';
@ -363,7 +364,37 @@ class _VerifyAccountState extends State<VerifyAccount> {
"IsSilentLogIN": false
};
authProv.memberCheckActivationCodeNew(model).then((res) async{
// "MobileNumber": "0541696495",
//
// "ZipCode": "966",
//
// "DoctorID": 1485,
// "IPAdress": "10.10.10.10",
//
// "Channel": 9,
//
// "LanguageID": 2,
//
// "ProjectID": 15,
//
// "VersionID": 1.2,
//
// "generalid": "Cs2020@2016$2958",
//
// "LogInTokenID": "+C16+k1lMkOwG2Zynd0nDQ==",
CheckActivationCodeRequestModel checkActivationCodeForDoctorApp = new CheckActivationCodeRequestModel(
zipCode: _loggedUser['ZipCode'],
mobileNumber: _loggedUser['MobileNumber'],
projectID: await sharedPref.getInt(PROJECT_ID),
logInTokenID: await sharedPref.getInt(LOGIN_TOKEN_ID),
doctorID: 1485,
// TODO do it dynamic
activationCode: activationCode,
generalid: "Cs2020@2016\$2958"
);
authProv.checkActivationCodeForDoctorApp(checkActivationCodeForDoctorApp)
.then((res) async {
if (res['MessageStatus'] == 1) {
sharedPref.setString(TOKEN, res['AuthenticationTokenID']);
if (res['List_DoctorProfile'] != null) {
@ -371,7 +402,7 @@ class _VerifyAccountState extends State<VerifyAccount> {
res['List_DoctorProfile'][0], changeLoadingStata);
} else {
ClinicModel clinic =
ClinicModel.fromJson(res['List_DoctorsClinic'][0]);
ClinicModel.fromJson(res['List_DoctorsClinic'][0]);
getDocProfiles(clinic, changeLoadingStata);
}
} else {

@ -267,17 +267,18 @@ class _VerificationMethodsState extends State<VerificationMethods> {
*@return:
*@desc: send Activation Code By Otp Notification Type
*/
sendActivationCodeByOtpNotificationType(oTPSendType, AuthViewModel authProv) {
sendActivationCodeByOtpNotificationType(oTPSendType, AuthViewModel authProv) async {
// TODO : build enum for verfication method
if (oTPSendType == 1 || oTPSendType == 2) {
widget.changeLoadingStata(true);
int projectID = await sharedPref.getInt(PROJECT_ID);
ActivationCodeModel activationCodeModel = ActivationCodeModel(
facilityId: 15,
facilityId: projectID,
generalid: "Cs2020@2016\$2958",
memberID: _loggedUser['List_MemberInformation'][0]['MemberID'],
zipCode: _loggedUser['ZipCode'],
mobileNumber: _loggedUser['MobileNumber'],
password: widget.password);
Map<String, dynamic> model = {
@ -292,6 +293,9 @@ class _VerificationMethodsState extends State<VerificationMethods> {
widget.changeLoadingStata(false);
if (res['MessageStatus'] == 1) {
sharedPref.setString(VIDA_AUTH_TOKEN_ID, res["VidaAuthTokenID"]);
sharedPref.setString(VIDA_REFRESH_TOKEN_ID, res["VidaRefreshTokenID"]);
sharedPref.setString(LOGIN_TOKEN_ID, res["LogInTokenID"]);
Navigator.of(context).pushReplacementNamed(VERIFY_ACCOUNT,
arguments: {'model': model});
} else {

Loading…
Cancel
Save