|
|
|
|
@ -31,7 +31,11 @@ class ConfirmPaymentPage extends StatefulWidget {
|
|
|
|
|
final String selectedPaymentMethod;
|
|
|
|
|
AuthenticatedUser authenticatedUser;
|
|
|
|
|
|
|
|
|
|
ConfirmPaymentPage({this.advanceModel, this.patientInfoAndMobileNumber, this.selectedPaymentMethod, this.authenticatedUser});
|
|
|
|
|
ConfirmPaymentPage(
|
|
|
|
|
{this.advanceModel,
|
|
|
|
|
this.patientInfoAndMobileNumber,
|
|
|
|
|
this.selectedPaymentMethod,
|
|
|
|
|
this.authenticatedUser});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
_ConfirmPaymentPageState createState() => _ConfirmPaymentPageState();
|
|
|
|
|
@ -47,12 +51,16 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
|
|
|
|
|
void submit(MyBalanceViewModel model, code) {
|
|
|
|
|
final activationCode = code;
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(AppGlobal.context);
|
|
|
|
|
model.checkActivationCodeForAdvancePayment(activationCode: activationCode).then((value) {
|
|
|
|
|
model
|
|
|
|
|
.checkActivationCodeForAdvancePayment(activationCode: activationCode)
|
|
|
|
|
.then((value) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(AppGlobal.context);
|
|
|
|
|
Navigator.pop(context, true);
|
|
|
|
|
AppoitmentAllHistoryResultList appo = new AppoitmentAllHistoryResultList();
|
|
|
|
|
AppoitmentAllHistoryResultList appo =
|
|
|
|
|
new AppoitmentAllHistoryResultList();
|
|
|
|
|
appo.projectID = widget.patientInfoAndMobileNumber.projectID;
|
|
|
|
|
openPayment(widget.selectedPaymentMethod, widget.authenticatedUser, double.parse(widget.advanceModel.amount), null);
|
|
|
|
|
openPayment(widget.selectedPaymentMethod, widget.authenticatedUser,
|
|
|
|
|
double.parse(widget.advanceModel.amount), null);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -70,22 +78,6 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
|
|
|
|
|
Navigator.pop(context),
|
|
|
|
|
},
|
|
|
|
|
).displayDialog(context);
|
|
|
|
|
|
|
|
|
|
// showDialog(
|
|
|
|
|
// context: context,
|
|
|
|
|
// barrierDismissible: false,
|
|
|
|
|
// child: ConfirmSMSDialog(
|
|
|
|
|
// phoneNumber: patientInfoAndMobileNumber.mobileNumber,
|
|
|
|
|
// ),
|
|
|
|
|
// ).then((value) {
|
|
|
|
|
// print("dialog dismissed");
|
|
|
|
|
// print(value);
|
|
|
|
|
// if (value != null && value) {
|
|
|
|
|
// AppoitmentAllHistoryResultList appo = new AppoitmentAllHistoryResultList();
|
|
|
|
|
// appo.projectID = patientInfoAndMobileNumber.projectID;
|
|
|
|
|
// openPayment(selectedPaymentMethod, authenticatedUser, double.parse(advanceModel.amount), null);
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return BaseView<MyBalanceViewModel>(
|
|
|
|
|
@ -120,11 +112,13 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
|
|
|
|
|
Container(
|
|
|
|
|
height: 100.0,
|
|
|
|
|
padding: EdgeInsets.all(7.0),
|
|
|
|
|
width: MediaQuery.of(context).size.width * 0.45,
|
|
|
|
|
child: widget.selectedPaymentMethod == "ApplePay" ? SvgPicture.asset(getImagePath(widget.selectedPaymentMethod)) : Image.asset(getImagePath(widget.selectedPaymentMethod)),
|
|
|
|
|
width: MediaQuery.of(context).size.width * 0.30,
|
|
|
|
|
child: Image.asset(
|
|
|
|
|
getImagePath(widget.selectedPaymentMethod)),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
'${widget.advanceModel.amount} SAR',
|
|
|
|
|
'${widget.advanceModel.amount} ' +
|
|
|
|
|
TranslationBase.of(context).sar,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 20,
|
|
|
|
|
fontWeight: FontWeight.w900,
|
|
|
|
|
@ -153,7 +147,8 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
|
|
|
|
|
margin: EdgeInsets.all(3),
|
|
|
|
|
child: NewTextFields(
|
|
|
|
|
hintText: TranslationBase.of(context).name,
|
|
|
|
|
initialValue: widget.patientInfoAndMobileNumber.firstName,
|
|
|
|
|
initialValue:
|
|
|
|
|
widget.patientInfoAndMobileNumber.firstName,
|
|
|
|
|
isEnabled: false,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
@ -173,7 +168,11 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
|
|
|
|
|
),
|
|
|
|
|
NewTextFields(
|
|
|
|
|
hintText: TranslationBase.of(context).depositorName,
|
|
|
|
|
initialValue: model.user.firstName + " " + model.user.middleName + " " + model.user.lastName,
|
|
|
|
|
initialValue: model.user.firstName +
|
|
|
|
|
" " +
|
|
|
|
|
model.user.middleName +
|
|
|
|
|
" " +
|
|
|
|
|
model.user.lastName,
|
|
|
|
|
isEnabled: false,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
@ -198,9 +197,14 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
|
|
|
|
|
TranslationBase.of(context).confirm.toUpperCase(),
|
|
|
|
|
() {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
model.sendActivationCodeForAdvancePayment(patientID: int.parse(widget.advanceModel.fileNumber), projectID: widget.advanceModel.hospitalsModel.iD).then((value) {
|
|
|
|
|
model
|
|
|
|
|
.sendActivationCodeForAdvancePayment(
|
|
|
|
|
patientID: int.parse(widget.advanceModel.fileNumber),
|
|
|
|
|
projectID: widget.advanceModel.hospitalsModel.iD)
|
|
|
|
|
.then((value) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
if (model.state != ViewState.ErrorLocal && model.state != ViewState.Error) showSMSDialog(model);
|
|
|
|
|
if (model.state != ViewState.ErrorLocal &&
|
|
|
|
|
model.state != ViewState.Error) showSMSDialog(model);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
@ -213,35 +217,54 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
|
|
|
|
|
String getImagePath(String paymentMethod) {
|
|
|
|
|
switch (paymentMethod) {
|
|
|
|
|
case "MADA":
|
|
|
|
|
return 'assets/images/new-design/mada.png';
|
|
|
|
|
return 'assets/images/new/payment/Mada.png';
|
|
|
|
|
break;
|
|
|
|
|
case "SADAD":
|
|
|
|
|
return 'assets/images/new-design/sadad.png';
|
|
|
|
|
break;
|
|
|
|
|
case "VISA":
|
|
|
|
|
return 'assets/images/new-design/visa.png';
|
|
|
|
|
return 'assets/images/new/payment/visa.png';
|
|
|
|
|
break;
|
|
|
|
|
case "MASTERCARD":
|
|
|
|
|
return 'assets/images/new-design/mastercard.png';
|
|
|
|
|
return 'assets/images/new/payment/Mastercard.png';
|
|
|
|
|
break;
|
|
|
|
|
case "Installment":
|
|
|
|
|
return 'assets/images/new-design/installment.png';
|
|
|
|
|
return 'assets/images/new/payment/installments.png';
|
|
|
|
|
break;
|
|
|
|
|
case "ApplePay":
|
|
|
|
|
return 'assets/images/new-design/applepay.svg';
|
|
|
|
|
return 'assets/images/new/payment/Apple_Pay.png';
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 'assets/images/new-design/mada.png';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
openPayment(String paymentMethod, AuthenticatedUser authenticatedUser, double amount, AppoitmentAllHistoryResultList appo) {
|
|
|
|
|
browser = new MyInAppBrowser(onExitCallback: onBrowserExit, appo: appo, onLoadStartCallback: onBrowserLoadStart);
|
|
|
|
|
openPayment(String paymentMethod, AuthenticatedUser authenticatedUser,
|
|
|
|
|
double amount, AppoitmentAllHistoryResultList appo) {
|
|
|
|
|
browser = new MyInAppBrowser(
|
|
|
|
|
onExitCallback: onBrowserExit,
|
|
|
|
|
appo: appo,
|
|
|
|
|
onLoadStartCallback: onBrowserLoadStart);
|
|
|
|
|
|
|
|
|
|
transID = Utils.getAdvancePaymentTransID(widget.advanceModel.hospitalsModel.iD, int.parse(widget.advanceModel.fileNumber));
|
|
|
|
|
transID = Utils.getAdvancePaymentTransID(
|
|
|
|
|
widget.advanceModel.hospitalsModel.iD,
|
|
|
|
|
int.parse(widget.advanceModel.fileNumber));
|
|
|
|
|
|
|
|
|
|
browser.openPaymentBrowser(amount, "Advance Payment", transID, widget.advanceModel.hospitalsModel.iD.toString(), widget.advanceModel.email, paymentMethod,
|
|
|
|
|
widget.patientInfoAndMobileNumber.patientType, widget.advanceModel.patientName, widget.advanceModel.fileNumber, authenticatedUser, browser, false, "3", "");
|
|
|
|
|
browser.openPaymentBrowser(
|
|
|
|
|
amount,
|
|
|
|
|
"Advance Payment",
|
|
|
|
|
transID,
|
|
|
|
|
widget.advanceModel.hospitalsModel.iD.toString(),
|
|
|
|
|
widget.advanceModel.email,
|
|
|
|
|
paymentMethod,
|
|
|
|
|
widget.patientInfoAndMobileNumber.patientType,
|
|
|
|
|
widget.advanceModel.patientName,
|
|
|
|
|
widget.advanceModel.fileNumber,
|
|
|
|
|
authenticatedUser,
|
|
|
|
|
browser,
|
|
|
|
|
false,
|
|
|
|
|
"3",
|
|
|
|
|
"");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onBrowserLoadStart(String url) {
|
|
|
|
|
@ -293,11 +316,23 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
|
|
|
|
|
createAdvancePayment(res, AppoitmentAllHistoryResultList appo) {
|
|
|
|
|
DoctorsListService service = new DoctorsListService();
|
|
|
|
|
String paymentReference = res['Fort_id'].toString();
|
|
|
|
|
service.HIS_createAdvancePayment(appo, widget.advanceModel.hospitalsModel.iD.toString(), res['Amount'], res['Fort_id'], res['PaymentMethod'], widget.patientInfoAndMobileNumber.patientType,
|
|
|
|
|
widget.advanceModel.patientName, widget.advanceModel.fileNumber, AppGlobal.context)
|
|
|
|
|
service.HIS_createAdvancePayment(
|
|
|
|
|
appo,
|
|
|
|
|
widget.advanceModel.hospitalsModel.iD.toString(),
|
|
|
|
|
res['Amount'],
|
|
|
|
|
res['Fort_id'],
|
|
|
|
|
res['PaymentMethod'],
|
|
|
|
|
widget.patientInfoAndMobileNumber.patientType,
|
|
|
|
|
widget.advanceModel.patientName,
|
|
|
|
|
widget.advanceModel.fileNumber,
|
|
|
|
|
AppGlobal.context)
|
|
|
|
|
.then((res) {
|
|
|
|
|
print(res['OnlineCheckInAppointments'][0]['AdvanceNumber']);
|
|
|
|
|
addAdvancedNumberRequest(res['OnlineCheckInAppointments'][0]['AdvanceNumber'].toString(), paymentReference, 0, appo);
|
|
|
|
|
addAdvancedNumberRequest(
|
|
|
|
|
res['OnlineCheckInAppointments'][0]['AdvanceNumber'].toString(),
|
|
|
|
|
paymentReference,
|
|
|
|
|
0,
|
|
|
|
|
appo);
|
|
|
|
|
}).catchError((err) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(AppGlobal.context);
|
|
|
|
|
AppToast.showErrorToast(message: err);
|
|
|
|
|
@ -305,9 +340,13 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
addAdvancedNumberRequest(String advanceNumber, String paymentReference, dynamic appointmentID, AppoitmentAllHistoryResultList appo) {
|
|
|
|
|
addAdvancedNumberRequest(String advanceNumber, String paymentReference,
|
|
|
|
|
dynamic appointmentID, AppoitmentAllHistoryResultList appo) {
|
|
|
|
|
DoctorsListService service = new DoctorsListService();
|
|
|
|
|
service.addAdvancedNumberRequest(advanceNumber, paymentReference, appointmentID, AppGlobal.context).then((res) {
|
|
|
|
|
service
|
|
|
|
|
.addAdvancedNumberRequest(
|
|
|
|
|
advanceNumber, paymentReference, appointmentID, AppGlobal.context)
|
|
|
|
|
.then((res) {
|
|
|
|
|
print(res);
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(AppGlobal.context);
|
|
|
|
|
navigateToHome(AppGlobal.context);
|
|
|
|
|
|