Merge branch 'development_v2.5' into zik_new_design_flutter_v2.5

* development_v2.5:
  Updates & fixes

# Conflicts: resolved
#	lib/pages/medical/balance/confirm_payment_page.dart
merge-requests/586/head
Zohaib Iqbal Kambrani 4 years ago
commit ff508de9f7

@ -12,12 +12,12 @@ class LacumService extends BaseService{
LacumAccountInformation lacumInformation;
LacumAccountInformation lacumGroupInformation;
Future getLacumAccountInformation() async {
Future getLacumAccountInformation(String identificationNo) async {
hasError = false;
super.error = "";
Map<String, dynamic> body = Map();
body['IdentificationNo'] = user.patientIdentificationNo;
body['IdentificationNo'] = identificationNo;
try {
await baseAppClient.post(GET_LACUM_ACCOUNT_INFORMATION,
@ -32,12 +32,12 @@ class LacumService extends BaseService{
}
}
Future getLacumGroupInformation() async {
Future getLacumGroupInformation(String identificationNo) async {
hasError = false;
super.error = "";
Map<String, dynamic> body = Map();
body['IdentificationNo'] = user.patientIdentificationNo;
body['IdentificationNo'] = identificationNo;
body['AccountNumber'] = "${lacumInformation.yahalaAccountNo}";
body['IsDetailsRequired'] = true;

@ -22,14 +22,14 @@ class LacumViewModel extends BaseViewModel {
String get successMsg =>
_lacumService.successMsg;
Future getLacumData() async {
await getLacumAccountData();
getLacumGroupData();
Future getLacumData(String identificationNo) async {
await getLacumAccountData(identificationNo);
getLacumGroupData(identificationNo);
}
Future getLacumAccountData() async {
Future getLacumAccountData(String identificationNo) async {
setState(ViewState.Busy);
await _lacumService.getLacumAccountInformation();
await _lacumService.getLacumAccountInformation(identificationNo);
if (_lacumService.hasError) {
error = _lacumService.error;
setState(ViewState.Error);
@ -38,9 +38,9 @@ class LacumViewModel extends BaseViewModel {
}
}
Future getLacumGroupData() async {
Future getLacumGroupData(String identificationNo) async {
setState(ViewState.Busy);
await _lacumService.getLacumGroupInformation();
await _lacumService.getLacumGroupInformation(identificationNo);
if (_lacumService.hasError) {
error = _lacumService.error;
setState(ViewState.Error);
@ -49,7 +49,7 @@ class LacumViewModel extends BaseViewModel {
}
}
Future makeAccountActivate() async {
Future makeAccountActivate(String identificationNo) async {
setState(ViewState.Busy);
await _lacumService.makeAccountActivate();
if (_lacumService.hasError) {
@ -57,11 +57,11 @@ class LacumViewModel extends BaseViewModel {
setState(ViewState.Error);
} else {
lacumGroupInformation.lakumInquiryInformationObjVersion.accountStatus = "Active";
getLacumAccountData();
getLacumAccountData(identificationNo);
}
}
Future makeAccountDeactivate() async {
Future makeAccountDeactivate(String identificationNo) async {
setState(ViewState.Busy);
await _lacumService.makeAccountDeactivate();
if (_lacumService.hasError) {
@ -69,7 +69,7 @@ class LacumViewModel extends BaseViewModel {
setState(ViewState.Error);
} else {
lacumGroupInformation.lakumInquiryInformationObjVersion.accountStatus = "Cancelled";
getLacumAccountData();
getLacumAccountData(identificationNo);
}
}

@ -5,8 +5,8 @@ class ApplePayRequest {
dynamic customerEmail;
String orderdescription;
String liveServiceid;
String longitude;
String latitude;
dynamic longitude;
dynamic latitude;
String devicetoken;
String clientrequestid;
String projectid;

@ -567,10 +567,6 @@ class _HomePageFragment2State extends State<HomePageFragment2> {
);
}
callPayfortApplePayAPI(ApplePayResponse applePayResponse) {
}
Widget showFloating(String icon) {
return Container(
width: MediaQuery.of(context).size.width * 0.06,

@ -1,4 +1,5 @@
import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/my_balance/AdvanceModel.dart';
import 'package:diplomaticquarterapp/core/model/my_balance/patient_info_and_mobile_number.dart';
@ -6,6 +7,8 @@ import 'package:diplomaticquarterapp/core/viewModels/medical/my_balance_view_mod
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart';
import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
import 'package:diplomaticquarterapp/models/apple_pay_request.dart';
import 'package:diplomaticquarterapp/models/apple_pay_response.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/routes.dart';
import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart';
@ -22,8 +25,8 @@ import 'package:diplomaticquarterapp/widgets/otp/sms-popup.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:pay/pay.dart';
import 'package:provider/provider.dart';
import 'new_text_Field.dart';
class ConfirmPaymentPage extends StatefulWidget {
@ -40,24 +43,16 @@ class ConfirmPaymentPage extends StatefulWidget {
class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
MyInAppBrowser browser;
ProjectViewModel projectViewModel;
AppSharedPreferences sharedPref = AppSharedPreferences();
String transID = "";
ProjectViewModel projectViewModel;
Pay _payClient = Pay.withAssets([
'applepay.json',
]);
var _paymentItems = [
PaymentItem(
label: 'Total',
amount: '99.99',
status: PaymentItemStatus.final_price,
)
];
void submit(MyBalanceViewModel model, code) {
final activationCode = code;
GifLoaderDialogUtils.showMyDialog(AppGlobal.context);
@ -66,15 +61,18 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
Navigator.pop(context, true);
AppoitmentAllHistoryResultList appo = new AppoitmentAllHistoryResultList();
appo.projectID = widget.patientInfoAndMobileNumber.projectID;
if (widget.selectedPaymentMethod == "ApplePay") {
startApplePay();
} else {
projectViewModel.analytics.advancePayments.payment_otp_confirmation(method: widget.selectedPaymentMethod.toLowerCase(), type: 'wallet');
openPayment(widget.selectedPaymentMethod, widget.authenticatedUser,
double.parse(widget.advanceModel.amount), null);
openPayment(widget.selectedPaymentMethod, widget.authenticatedUser, double.parse(widget.advanceModel.amount), null);
}
});
}
@override
Widget build(BuildContext context) {
projectViewModel = Provider.of(context);
void showSMSDialog(MyBalanceViewModel model) {
new SMSOTP(
context,
@ -211,6 +209,8 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
if (model.state != ViewState.ErrorLocal &&
model.state != ViewState.Error) showSMSDialog(model);
});
startApplePay();
// if()
// GifLoaderDialogUtils.showMyDialog(context);
// model.sendActivationCodeForAdvancePayment(patientID: int.parse(widget.advanceModel.fileNumber), projectID: widget.advanceModel.hospitalsModel.iD).then((value) {
// GifLoaderDialogUtils.hideDialog(context);
@ -224,6 +224,87 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
);
}
startApplePay() {
GifLoaderDialogUtils.showMyDialog(context);
ApplePayResponse applePayResponse;
var _paymentItems = [
PaymentItem(
label: 'Total',
amount: widget.advanceModel.amount,
status: PaymentItemStatus.final_price,
)
];
_payClient.userCanPay(PayProvider.apple_pay).then((value) async {
print(value);
final result = await _payClient.showPaymentSelector(
provider: PayProvider.apple_pay,
paymentItems: _paymentItems,
);
print(result);
applePayResponse = ApplePayResponse.fromJson(result);
callPayfortApplePayAPI(applePayResponse);
});
}
callPayfortApplePayAPI(ApplePayResponse applePayResponse) async {
DoctorsListService service = new DoctorsListService();
ApplePayRequest applePayRequest = new ApplePayRequest();
AppleHeader appleHeader = new AppleHeader();
ApplePaymentMethod applePaymentMethod = new ApplePaymentMethod();
applePayRequest.amount = widget.advanceModel.amount;
applePayRequest.currency = "SAR";
applePayRequest.language = projectViewModel.isArabic ? "ar" : "en";
applePayRequest.customername = projectViewModel.user.firstName;
applePayRequest.customerEmail = projectViewModel.user.emailAddress;
applePayRequest.orderdescription = "Advance Payment";
applePayRequest.liveServiceid = "";
applePayRequest.latitude = await this.sharedPref.getDouble(USER_LAT);
applePayRequest.longitude = await this.sharedPref.getDouble(USER_LONG);
applePayRequest.devicetoken = await sharedPref.getString(PUSH_TOKEN);
applePayRequest.clientrequestid = Utils.getAdvancePaymentTransID(widget.advanceModel.hospitalsModel.iD, int.parse(widget.advanceModel.fileNumber));
applePayRequest.projectid = widget.advanceModel.hospitalsModel.iD.toString();
applePayRequest.serviceid = "3";
applePayRequest.patientid = projectViewModel.user.patientID.toString();
applePayRequest.appleData = applePayResponse.token.data;
applePayRequest.appleSignature = applePayResponse.token.signature;
appleHeader.appleEphemeralPublicKey = applePayResponse.token.header.ephemeralPublicKey;
appleHeader.appleTransactionId = applePayResponse.token.header.transactionId;
appleHeader.applePublicKeyHash = applePayResponse.token.header.publicKeyHash;
applePaymentMethod.appleType = getApplePayPaymentType(applePayResponse.paymentMethod.type);
applePaymentMethod.appleNetwork = applePayResponse.paymentMethod.network;
applePaymentMethod.appleDisplayName = applePayResponse.paymentMethod.displayName;
applePayRequest.appleHeader = appleHeader;
applePayRequest.applePaymentMethod = applePaymentMethod;
service.callPayfortApplePayAPI(applePayRequest, context).then((res) {
print(res);
GifLoaderDialogUtils.hideDialog(context);
}).catchError((err) {
GifLoaderDialogUtils.hideDialog(context);
print(err);
// _showMyDialog(err, this.context);
});
}
String getApplePayPaymentType(dynamic paymentMethod) {
switch (paymentMethod) {
case 1:
return 'debit';
break;
case 2:
return 'credit';
break;
case 3:
return 'prepaid';
break;
}
return 'debit';
}
String getImagePath(String paymentMethod) {
switch (paymentMethod) {
case "MADA":

@ -1,5 +1,6 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/lacum-registration-viewModel.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/buttons/borderedButton.dart';
@ -7,16 +8,19 @@ import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'lacum-registration-page.dart';
class LakumActivationVidaPage extends StatelessWidget {
ProjectViewModel projectViewModel;
TextEditingController _identificationNumberController =
new TextEditingController();
@override
Widget build(BuildContext context) {
final mediaQuery = MediaQuery.of(context);
projectViewModel = Provider.of(context);
return BaseView<LacumRegistrationViewModel>(
builder: (_, model, wi) => AppScaffold(
@ -72,7 +76,7 @@ class LakumActivationVidaPage extends StatelessWidget {
fontSize: 16,
hPadding: 8,
vPadding: 12,
handler: _identificationNumberController.text != null &&
handler: _identificationNumberController.text != null ||
_identificationNumberController.text != ""
? () {
model
@ -89,7 +93,7 @@ class LakumActivationVidaPage extends StatelessWidget {
.text)))
.then((status) => {
if (status == 200)
{Navigator.pop(context, "")}
{model.makeAccountActivate(projectViewModel.user.patientIdentificationNo)}
// back to previous page
})
}

@ -1,6 +1,7 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/LacumAccountInformation.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/lacum-viewmodel.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/widgets/lacum-banner-widget.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
@ -10,6 +11,7 @@ import 'package:diplomaticquarterapp/widgets/buttons/borderedButton.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class LakumSettingPage extends StatefulWidget {
final LacumAccountInformation lacumInformation;
@ -26,6 +28,8 @@ class _LakumSettingPageState extends State<LakumSettingPage> {
TextEditingController _nameController = new TextEditingController();
TextEditingController _phoneController = new TextEditingController();
ProjectViewModel projectViewModel;
@override
void initState() {
_lakumAccountActivated = widget.lacumGroupInformation
@ -39,6 +43,7 @@ class _LakumSettingPageState extends State<LakumSettingPage> {
@override
Widget build(BuildContext context) {
final mediaQuery = MediaQuery.of(context);
projectViewModel = Provider.of(context);
return BaseView<LacumViewModel>(
onModelReady: (model) => model.setLakumData(
@ -126,9 +131,9 @@ class _LakumSettingPageState extends State<LakumSettingPage> {
value: _lakumAccountActivated,
onChanged: (val) {
if (_lakumAccountActivated) {
model.makeAccountDeactivate();
model.makeAccountDeactivate(projectViewModel.user.patientIdentificationNo);
} else {
model.makeAccountActivate();
model.makeAccountActivate(projectViewModel.user.patientIdentificationNo);
}
setState(() {
_lakumAccountActivated = val;

@ -27,7 +27,7 @@ class LakumMainPage extends StatelessWidget {
return BaseView<LacumViewModel>(
onModelReady: (model) async {
await model.getLacumData();
await model.getLacumData(projectViewModel.user.patientIdentificationNo);
if (model.lacumInformation.yahalaAccountNo == 0 || model.lacumInformation.yahalaAccountNo == null) {
navigateToLakumRegister(context);
} else {
@ -73,7 +73,7 @@ class LakumMainPage extends StatelessWidget {
SizedBox(
height: 12,
),
LakumHomeButtons(mediaQuery, model),
LakumHomeButtons(mediaQuery, model, projectViewModel),
SizedBox(
height: 12,
),
@ -253,25 +253,26 @@ class LakumMainPage extends StatelessWidget {
navigateToLakumRegister(BuildContext context) {
Navigator.pushReplacement(context, FadePage(page: LakumRegistrationPage(projectViewModel.user.patientIdentificationNo)));
}
}
List<Widget> _buildAppBarICons(BuildContext context, LacumViewModel model) {
return [
IconButton(
icon: Icon(Icons.settings),
color: Colors.white,
onPressed: () {
Navigator.push(context, FadePage(page: LakumSettingPage(model.lacumInformation, model.lacumGroupInformation))).then((result) => {model.getLacumGroupData()});
},
),
];
List<Widget> _buildAppBarICons(BuildContext context, LacumViewModel model) {
return [
IconButton(
icon: Icon(Icons.settings),
color: Colors.white,
onPressed: () {
Navigator.push(context, FadePage(page: LakumSettingPage(model.lacumInformation, model.lacumGroupInformation))).then((result) => {model.getLacumGroupData(projectViewModel.user.patientIdentificationNo)});
},
),
];
}
}
class LakumHomeButtons extends StatelessWidget {
final MediaQueryData mediaQuery;
final LacumViewModel model;
ProjectViewModel projectViewModel;
LakumHomeButtons(this.mediaQuery, this.model);
LakumHomeButtons(this.mediaQuery, this.model, this.projectViewModel);
@override
Widget build(BuildContext context) {
@ -328,7 +329,7 @@ class LakumHomeButtons extends StatelessWidget {
child: InkWell(
onTap: () {
Navigator.push(context, FadePage(page: LacumTransferPage(model.lacumInformation, model.lacumGroupInformation))).then((result) {
model.getLacumGroupData();
model.getLacumGroupData(projectViewModel.user.patientIdentificationNo);
});
},
child: Container(

@ -1,6 +1,7 @@
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/lacum-registration-viewModel.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/buttons/borderedButton.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
@ -12,8 +13,7 @@ class LakumTermsConditions extends StatelessWidget {
final String firstName, lastName, mobileNo, identificationNo;
final int languageId;
LakumTermsConditions(this.identificationNo, this.firstName, this.lastName,
this.mobileNo, this.languageId);
LakumTermsConditions(this.identificationNo, this.firstName, this.lastName, this.mobileNo, this.languageId);
@override
Widget build(BuildContext context) {
@ -37,13 +37,9 @@ class LakumTermsConditions extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (model.listUserAgreement != null &&
model.listUserAgreement.userAgreementLAKUM !=
null)
if (model.listUserAgreement != null && model.listUserAgreement.userAgreementLAKUM != null)
Html(
data: projectProvider.isArabic
? model.listUserAgreement.userAgreementLAKUMn
: model.listUserAgreement.userAgreementLAKUM,
data: projectProvider.isArabic ? model.listUserAgreement.userAgreementLAKUMn : model.listUserAgreement.userAgreementLAKUM,
),
],
),
@ -62,9 +58,12 @@ class LakumTermsConditions extends StatelessWidget {
vPadding: 12,
handler: () {
model.createNewLakumAccount("$firstName $lastName", mobileNo, identificationNo, languageId).then((status) => {
if (status == 200) {Navigator.pop(context, "")}
// back to previous page
});
if (status == 200) {Navigator.pop(context, "")} else {
Navigator.pop(context, ""),
AppToast.showErrorToast(message: model.error)
}
// back to previous page
});
},
),
),

Loading…
Cancel
Save