merge-requests/583/head
haroon amjad 4 years ago
parent 2a22edfdd0
commit efced34ffa

@ -0,0 +1,22 @@
{
"provider": "apple_pay",
"data": {
"merchantIdentifier": "merchant.com.hmgwebservices",
"displayName": "Sulaiman Al Habib",
"merchantCapabilities": [
"3DS",
"debit",
"credit"
],
"supportedNetworks": [
"amex",
"visa",
"discover",
"masterCard"
],
"countryCode": "SA",
"currencyCode": "SAR",
"requiredBillingContactFields": null,
"requiredShippingContactFields": null
}
}

@ -0,0 +1,22 @@
{
"provider": "apple_pay",
"data": {
"merchantIdentifier": "merchant.com.hmgwebservices",
"displayName": "Sulaiman Al Habib",
"merchantCapabilities": [
"3DS",
"debit",
"credit"
],
"supportedNetworks": [
"amex",
"visa",
"discover",
"masterCard"
],
"countryCode": "SA",
"currencyCode": "SAR",
"requiredBillingContactFields": null,
"requiredShippingContactFields": null
}
}

@ -0,0 +1,135 @@
class ApplePayRequest {
String currency;
String language;
String customername;
dynamic customerEmail;
String orderdescription;
String liveServiceid;
String longitude;
String latitude;
String devicetoken;
String clientrequestid;
String projectid;
String serviceid;
String patientid;
String amount;
String appleData;
String appleSignature;
AppleHeader appleHeader;
ApplePaymentMethod applePaymentMethod;
ApplePayRequest(
{this.currency,
this.language,
this.customername,
this.customerEmail,
this.orderdescription,
this.liveServiceid,
this.longitude,
this.latitude,
this.devicetoken,
this.clientrequestid,
this.projectid,
this.serviceid,
this.patientid,
this.amount,
this.appleData,
this.appleSignature,
this.appleHeader,
this.applePaymentMethod});
ApplePayRequest.fromJson(Map<String, dynamic> json) {
currency = json['currency'];
language = json['language'];
customername = json['customername'];
customerEmail = json['customer_email'];
orderdescription = json['orderdescription'];
liveServiceid = json['live_serviceid'];
longitude = json['longitude'];
latitude = json['latitude'];
devicetoken = json['devicetoken'];
clientrequestid = json['clientrequestid'];
projectid = json['projectid'];
serviceid = json['serviceid'];
patientid = json['patientid'];
amount = json['Amount'];
appleData = json['apple_data'];
appleSignature = json['apple_signature'];
appleHeader = json['apple_header'] != null ? new AppleHeader.fromJson(json['apple_header']) : null;
applePaymentMethod = json['apple_paymentMethod'] != null ? new ApplePaymentMethod.fromJson(json['apple_paymentMethod']) : null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['currency'] = this.currency;
data['language'] = this.language;
data['customername'] = this.customername;
data['customer_email'] = this.customerEmail;
data['orderdescription'] = this.orderdescription;
data['live_serviceid'] = this.liveServiceid;
data['longitude'] = this.longitude;
data['latitude'] = this.latitude;
data['devicetoken'] = this.devicetoken;
data['clientrequestid'] = this.clientrequestid;
data['projectid'] = this.projectid;
data['serviceid'] = this.serviceid;
data['patientid'] = this.patientid;
data['Amount'] = this.amount;
data['apple_data'] = this.appleData;
data['apple_signature'] = this.appleSignature;
if (this.appleHeader != null) {
data['apple_header'] = this.appleHeader.toJson();
}
if (this.applePaymentMethod != null) {
data['apple_paymentMethod'] = this.applePaymentMethod.toJson();
}
return data;
}
}
class AppleHeader {
String appleApplicationData;
String appleEphemeralPublicKey;
String applePublicKeyHash;
String appleTransactionId;
AppleHeader({this.appleApplicationData, this.appleEphemeralPublicKey, this.applePublicKeyHash, this.appleTransactionId});
AppleHeader.fromJson(Map<String, dynamic> json) {
appleApplicationData = json['apple_applicationData'];
appleEphemeralPublicKey = json['apple_ephemeralPublicKey'];
applePublicKeyHash = json['apple_publicKeyHash'];
appleTransactionId = json['apple_transactionId'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['apple_applicationData'] = this.appleApplicationData;
data['apple_ephemeralPublicKey'] = this.appleEphemeralPublicKey;
data['apple_publicKeyHash'] = this.applePublicKeyHash;
data['apple_transactionId'] = this.appleTransactionId;
return data;
}
}
class ApplePaymentMethod {
String appleDisplayName;
String appleNetwork;
String appleType;
ApplePaymentMethod({this.appleDisplayName, this.appleNetwork, this.appleType});
ApplePaymentMethod.fromJson(Map<String, dynamic> json) {
appleDisplayName = json['apple_displayName'];
appleNetwork = json['apple_network'];
appleType = json['apple_type'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['apple_displayName'] = this.appleDisplayName;
data['apple_network'] = this.appleNetwork;
data['apple_type'] = this.appleType;
return data;
}
}

@ -0,0 +1,112 @@
import 'dart:convert';
class ApplePayResponse {
PaymentMethod paymentMethod;
dynamic billingContact;
dynamic shippingMethod;
dynamic shippingContact;
Token token;
ApplePayResponse(
{this.paymentMethod,
this.billingContact,
this.shippingMethod,
this.shippingContact,
this.token});
ApplePayResponse.fromJson(Map<String, dynamic> jsonValue) {
paymentMethod = jsonValue['paymentMethod'] != null
? new PaymentMethod.fromJson(jsonValue['paymentMethod'])
: null;
// billingContact = json['billingContact'] != null ? json['billingContact'] : "";
// shippingMethod = json['shippingMethod'] != null ? json['shippingMethod'] : "";
// shippingContact = json['shippingContact'] != null ? json['shippingContact'] : "";
token = jsonValue['token'] != null ? new Token.fromJson(json.decode(jsonValue['token'])) : null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.paymentMethod != null) {
data['paymentMethod'] = this.paymentMethod.toJson();
}
data['billingContact'] = this.billingContact;
data['shippingMethod'] = this.shippingMethod;
data['shippingContact'] = this.shippingContact;
if (this.token != null) {
data['token'] = this.token.toJson();
}
return data;
}
}
class PaymentMethod {
dynamic network;
dynamic displayName;
dynamic type;
PaymentMethod({this.network, this.displayName, this.type});
PaymentMethod.fromJson(Map<String, dynamic> json) {
network = json['network'];
displayName = json['displayName'];
type = json['type'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['network'] = this.network;
data['displayName'] = this.displayName;
data['type'] = this.type;
return data;
}
}
class Token {
String version;
String data;
String signature;
Header header;
Token({this.version, this.data, this.signature, this.header});
Token.fromJson(Map<String, dynamic> json) {
version = json['version'];
data = json['data'];
signature = json['signature'];
header =
json['header'] != null ? new Header.fromJson(json['header']) : null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['version'] = this.version;
data['data'] = this.data;
data['signature'] = this.signature;
if (this.header != null) {
data['header'] = this.header.toJson();
}
return data;
}
}
class Header {
String ephemeralPublicKey;
String publicKeyHash;
String transactionId;
Header({this.ephemeralPublicKey, this.publicKeyHash, this.transactionId});
Header.fromJson(Map<String, dynamic> json) {
ephemeralPublicKey = json['ephemeralPublicKey'];
publicKeyHash = json['publicKeyHash'];
transactionId = json['transactionId'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['ephemeralPublicKey'] = this.ephemeralPublicKey;
data['publicKeyHash'] = this.publicKeyHash;
data['transactionId'] = this.transactionId;
return data;
}
}

@ -50,7 +50,7 @@ class _AllHabibMedicalSevicePage2State extends State<AllHabibMedicalSevicePage2>
hmgServices.clear(); hmgServices.clear();
hmgServices.add(new HmgServices(0, TranslationBase.of(context).liveCareTitle, TranslationBase.of(context).liveCareSubtitle, "assets/images/new/Live_Care.svg", isLogin)); hmgServices.add(new HmgServices(0, TranslationBase.of(context).liveCareTitle, TranslationBase.of(context).liveCareSubtitle, "assets/images/new/Live_Care.svg", isLogin));
hmgServices.add(new HmgServices(1, TranslationBase.of(context).covidTest, TranslationBase.of(context).driveThru, "assets/images/new/covid_test_drive_thru.svg", isLogin)); hmgServices.add(new HmgServices(1, TranslationBase.of(context).covidTest, TranslationBase.of(context).driveThru, "assets/images/new/CoronaIcon.svg", isLogin));
hmgServices.add(new HmgServices(2, TranslationBase.of(context).onlinePayment, TranslationBase.of(context).onlinePaymentSubtitle, "assets/images/new/paymentMethods.png", isLogin)); hmgServices.add(new HmgServices(2, TranslationBase.of(context).onlinePayment, TranslationBase.of(context).onlinePaymentSubtitle, "assets/images/new/paymentMethods.png", isLogin));
hmgServices.add(new HmgServices(3, TranslationBase.of(context).hhcHome, TranslationBase.of(context).healthCare, "assets/images/new/HHC.svg", isLogin)); hmgServices.add(new HmgServices(3, TranslationBase.of(context).hhcHome, TranslationBase.of(context).healthCare, "assets/images/new/HHC.svg", isLogin));
hmgServices.add(new HmgServices(4, TranslationBase.of(context).cmcTitle, TranslationBase.of(context).cmcSubtitle, "assets/images/new/comprehensive_checkup.svg", isLogin)); hmgServices.add(new HmgServices(4, TranslationBase.of(context).cmcTitle, TranslationBase.of(context).cmcSubtitle, "assets/images/new/comprehensive_checkup.svg", isLogin));

@ -367,10 +367,10 @@ class _AnicllaryOrdersState extends State<AnicllaryOrdersDetails> with SingleTic
addSelectedProcedure(value[i]); addSelectedProcedure(value[i]);
}); });
}), }),
Utils.tableColumnValue('${value[i].procedureName}', isLast: true, isCapitable: false), Utils.tableColumnValue('${value[i].procedureName}', isLast: true, isCapitable: false, mProjectViewModel: projectViewModel),
Utils.tableColumnValue('${value[i].patientShare.toString() + " " + TranslationBase.of(context).sar.toUpperCase()}', isLast: true, isCapitable: false), Utils.tableColumnValue('${value[i].patientShare.toString() + " " + TranslationBase.of(context).sar.toUpperCase()}', isLast: true, isCapitable: false, mProjectViewModel: projectViewModel),
Utils.tableColumnValue('${value[i].patientTaxAmount.toString() + " " + TranslationBase.of(context).sar.toUpperCase()}', isLast: true, isCapitable: false), Utils.tableColumnValue('${value[i].patientTaxAmount.toString() + " " + TranslationBase.of(context).sar.toUpperCase()}', isLast: true, isCapitable: false, mProjectViewModel: projectViewModel),
Utils.tableColumnValue('${value[i].patientShareWithTax.toString() + " " + TranslationBase.of(context).sar.toUpperCase()}', isLast: true, isCapitable: false), Utils.tableColumnValue('${value[i].patientShareWithTax.toString() + " " + TranslationBase.of(context).sar.toUpperCase()}', isLast: true, isCapitable: false, mProjectViewModel: projectViewModel),
]), ]),
); );
} }

@ -200,7 +200,8 @@ class _BookConfirmState extends State<BookConfirm> {
disabledTextColor: Colors.white, disabledTextColor: Colors.white,
disabledColor: new Color(0xFFbcc2c4), disabledColor: new Color(0xFFbcc2c4),
onPressed: () async { onPressed: () async {
if (await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT) != null && !await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT)) { bool isLiveCareSchedule = await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT);
if (isLiveCareSchedule != null && isLiveCareSchedule) {
insertLiveCareScheduledAppointment(context, widget.doctor); insertLiveCareScheduledAppointment(context, widget.doctor);
} else { } else {
insertAppointment(context, widget.doctor); insertAppointment(context, widget.doctor);

@ -148,12 +148,13 @@ class _DoctorProfileState extends State<DoctorProfile> with TickerProviderStateM
onTap: (index) { onTap: (index) {
setState(() { setState(() {
if (index == 1) { if (index == 1) {
// if (widget.doctor.clinicID == 17 || widget.doctor.clinicID == 23 || widget.doctor.clinicID == 47 || widget.isLiveCareAppointment) { if (widget.doctor.clinicID == 17 || widget.doctor.clinicID == 23 || widget.doctor.clinicID == 47 || widget.isLiveCareAppointment) {
// _tabController.index = _tabController.previousIndex; _tabController.index = _tabController.previousIndex;
showFooterButton = false; showFooterButton = false;
} else { } else {
showFooterButton = true; showFooterButton = true;
} }
}
print(showFooterButton); print(showFooterButton);
}); });
}, },

@ -6,6 +6,7 @@ import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:pay/pay.dart';
class PaymentMethod extends StatefulWidget { class PaymentMethod extends StatefulWidget {
Function onSelectedMethod; Function onSelectedMethod;
@ -300,35 +301,58 @@ class _PaymentMethodState extends State<PaymentMethod> {
bottomSheet: Container( bottomSheet: Container(
padding: EdgeInsets.all(16), padding: EdgeInsets.all(16),
color: Colors.white, color: Colors.white,
child: Container( child:
width: MediaQuery.of(context).size.width, // selectedPaymentMethod == "ApplePay"
height: 50.0, // ? ApplePayButton(
color: Colors.white, // paymentConfigurationAsset: 'applepay.json',
// margin: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 20.0), // paymentItems: _paymentItems,
child: ButtonTheme( // style: ApplePayButtonStyle.black,
shape: RoundedRectangleBorder( // type: ApplePayButtonType.inStore,
borderRadius: BorderRadius.circular(10.0), // width: MediaQuery.of(context).size.width,
), // height: 50,
minWidth: MediaQuery.of(context).size.height * 0.1, // margin: const EdgeInsets.only(top: 15.0),
height: 45.0, // onPaymentResult: (value) {
child: RaisedButton( // print(value);
color: CustomColors.green, // // applePayResponse = ApplePayResponse.fromJson(value);
textColor: Colors.white, // // print(applePayResponse.token.data);
disabledTextColor: Colors.white, // },
disabledColor: new Color(0xFFbcc2c4), // onError: (error) {
elevation: 0, // print(error);
onPressed: () { // },
widget.onSelectedMethod(selectedPaymentMethod); // loadingIndicator: const Center(
Navigator.pop(context, selectedPaymentMethod); // child: CircularProgressIndicator(),
}, // ),
child: Text(TranslationBase.of(context).confirm.toUpperCase(), // )
style: TextStyle( // :
fontSize: 14.0, Container(
fontWeight: FontWeight.w600, width: MediaQuery.of(context).size.width,
)), height: 50.0,
), color: Colors.white,
), // margin: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 20.0),
), child: ButtonTheme(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
),
minWidth: MediaQuery.of(context).size.height * 0.1,
height: 45.0,
child: RaisedButton(
color: CustomColors.green,
textColor: Colors.white,
disabledTextColor: Colors.white,
disabledColor: new Color(0xFFbcc2c4),
elevation: 0,
onPressed: () {
widget.onSelectedMethod(selectedPaymentMethod);
Navigator.pop(context, selectedPaymentMethod);
},
child: Text(TranslationBase.of(context).confirm.toUpperCase(),
style: TextStyle(
fontSize: 14.0,
fontWeight: FontWeight.w600,
)),
),
),
),
), ),
); );
} }

@ -1,3 +1,4 @@
import 'dart:convert';
import 'dart:math' as math; import 'dart:math' as math;
import 'package:auto_size_text/auto_size_text.dart'; import 'package:auto_size_text/auto_size_text.dart';
@ -7,6 +8,7 @@ import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart';
import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart';
import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
import 'package:diplomaticquarterapp/models/apple_pay_response.dart';
import 'package:diplomaticquarterapp/models/gradient_color.dart'; import 'package:diplomaticquarterapp/models/gradient_color.dart';
import 'package:diplomaticquarterapp/models/hmg_services.dart'; import 'package:diplomaticquarterapp/models/hmg_services.dart';
import 'package:diplomaticquarterapp/models/slider_data.dart'; import 'package:diplomaticquarterapp/models/slider_data.dart';
@ -23,7 +25,9 @@ import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:pay/pay.dart';
class HomePageFragment2 extends StatefulWidget { class HomePageFragment2 extends StatefulWidget {
DashboardViewModel model; DashboardViewModel model;
@ -39,6 +43,7 @@ class _HomePageFragment2State extends State<HomePageFragment2> {
ProjectViewModel projectViewModel; ProjectViewModel projectViewModel;
List<HmgServices> hmgServices = []; List<HmgServices> hmgServices = [];
List<AppoitmentAllHistoryResultList> appoList = []; List<AppoitmentAllHistoryResultList> appoList = [];
ApplePayResponse applePayResponse;
@override @override
void initState() { void initState() {
@ -561,6 +566,10 @@ class _HomePageFragment2State extends State<HomePageFragment2> {
); );
} }
callPayfortApplePayAPI(ApplePayResponse applePayResponse) {
}
Widget showFloating(String icon) { Widget showFloating(String icon) {
return Container( return Container(
width: MediaQuery.of(context).size.width * 0.06, width: MediaQuery.of(context).size.width * 0.06,

@ -15,13 +15,12 @@ import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/otp/sms-popup.dart'; import 'package:diplomaticquarterapp/widgets/otp/sms-popup.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:pay/pay.dart';
import 'new_text_Field.dart'; import 'new_text_Field.dart';
@ -31,11 +30,7 @@ class ConfirmPaymentPage extends StatefulWidget {
final String selectedPaymentMethod; final String selectedPaymentMethod;
AuthenticatedUser authenticatedUser; AuthenticatedUser authenticatedUser;
ConfirmPaymentPage( ConfirmPaymentPage({this.advanceModel, this.patientInfoAndMobileNumber, this.selectedPaymentMethod, this.authenticatedUser});
{this.advanceModel,
this.patientInfoAndMobileNumber,
this.selectedPaymentMethod,
this.authenticatedUser});
@override @override
_ConfirmPaymentPageState createState() => _ConfirmPaymentPageState(); _ConfirmPaymentPageState createState() => _ConfirmPaymentPageState();
@ -48,19 +43,50 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
String transID = ""; String transID = "";
Pay _payClient = Pay.withAssets([
'applepay.json',
]);
var _paymentItems = [
PaymentItem(
label: 'Total',
amount: '99.99',
status: PaymentItemStatus.final_price,
)
];
void submit(MyBalanceViewModel model, code) { void submit(MyBalanceViewModel model, code) {
final activationCode = code; final activationCode = code;
GifLoaderDialogUtils.showMyDialog(AppGlobal.context); GifLoaderDialogUtils.showMyDialog(AppGlobal.context);
model model.checkActivationCodeForAdvancePayment(activationCode: activationCode).then((value) {
.checkActivationCodeForAdvancePayment(activationCode: activationCode)
.then((value) {
GifLoaderDialogUtils.hideDialog(AppGlobal.context); GifLoaderDialogUtils.hideDialog(AppGlobal.context);
Navigator.pop(context, true); Navigator.pop(context, true);
AppoitmentAllHistoryResultList appo = AppoitmentAllHistoryResultList appo = new AppoitmentAllHistoryResultList();
new AppoitmentAllHistoryResultList();
appo.projectID = widget.patientInfoAndMobileNumber.projectID; appo.projectID = widget.patientInfoAndMobileNumber.projectID;
openPayment(widget.selectedPaymentMethod, widget.authenticatedUser, if (widget.selectedPaymentMethod == "ApplePay") {
double.parse(widget.advanceModel.amount), null);
// _payClient.userCanPay(PayProvider.apple_pay).then((value) {
// print(value);
// });
// return FutureBuilder<bool>(
// builder: (context, snapshot) {
// if (snapshot.connectionState == ConnectionState.done) {
// if (snapshot.data == true) {
// return RawGooglePayButton(
// style: GooglePayButtonStyle.black,
// type: GooglePayButtonType.pay,
// onPressed: onGooglePayPressed);
// } else {
// // userCanPay returned false
// // Consider showing an alternative payment method
// }
// }
// },
// );
} else {
openPayment(widget.selectedPaymentMethod, widget.authenticatedUser, double.parse(widget.advanceModel.amount), null);
}
}); });
} }
@ -113,12 +139,10 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
height: 100.0, height: 100.0,
padding: EdgeInsets.all(7.0), padding: EdgeInsets.all(7.0),
width: MediaQuery.of(context).size.width * 0.30, width: MediaQuery.of(context).size.width * 0.30,
child: Image.asset( child: Image.asset(getImagePath(widget.selectedPaymentMethod)),
getImagePath(widget.selectedPaymentMethod)),
), ),
Text( Text(
'${widget.advanceModel.amount} ' + '${widget.advanceModel.amount} ' + TranslationBase.of(context).sar,
TranslationBase.of(context).sar,
style: TextStyle( style: TextStyle(
fontSize: 20, fontSize: 20,
fontWeight: FontWeight.w900, fontWeight: FontWeight.w900,
@ -147,8 +171,7 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
margin: EdgeInsets.all(3), margin: EdgeInsets.all(3),
child: NewTextFields( child: NewTextFields(
hintText: TranslationBase.of(context).name, hintText: TranslationBase.of(context).name,
initialValue: initialValue: widget.patientInfoAndMobileNumber.firstName,
widget.patientInfoAndMobileNumber.firstName,
isEnabled: false, isEnabled: false,
), ),
), ),
@ -168,11 +191,7 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
), ),
NewTextFields( NewTextFields(
hintText: TranslationBase.of(context).depositorName, hintText: TranslationBase.of(context).depositorName,
initialValue: model.user.firstName + initialValue: model.user.firstName + " " + model.user.middleName + " " + model.user.lastName,
" " +
model.user.middleName +
" " +
model.user.lastName,
isEnabled: false, isEnabled: false,
), ),
SizedBox( SizedBox(
@ -196,16 +215,19 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
child: DefaultButton( child: DefaultButton(
TranslationBase.of(context).confirm.toUpperCase(), TranslationBase.of(context).confirm.toUpperCase(),
() { () {
GifLoaderDialogUtils.showMyDialog(context); _payClient.userCanPay(PayProvider.apple_pay).then((value) async {
model print(value);
.sendActivationCodeForAdvancePayment( final result = await _payClient.showPaymentSelector(
patientID: int.parse(widget.advanceModel.fileNumber), provider: PayProvider.apple_pay,
projectID: widget.advanceModel.hospitalsModel.iD) paymentItems: _paymentItems,
.then((value) { );
GifLoaderDialogUtils.hideDialog(context); print(result);
if (model.state != ViewState.ErrorLocal &&
model.state != ViewState.Error) showSMSDialog(model);
}); });
// GifLoaderDialogUtils.showMyDialog(context);
// 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);
// });
}, },
), ),
), ),
@ -239,32 +261,13 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
return 'assets/images/new-design/mada.png'; return 'assets/images/new-design/mada.png';
} }
openPayment(String paymentMethod, AuthenticatedUser authenticatedUser, openPayment(String paymentMethod, AuthenticatedUser authenticatedUser, double amount, AppoitmentAllHistoryResultList appo) {
double amount, AppoitmentAllHistoryResultList appo) { browser = new MyInAppBrowser(onExitCallback: onBrowserExit, appo: appo, onLoadStartCallback: onBrowserLoadStart);
browser = new MyInAppBrowser(
onExitCallback: onBrowserExit,
appo: appo,
onLoadStartCallback: onBrowserLoadStart);
transID = Utils.getAdvancePaymentTransID( transID = Utils.getAdvancePaymentTransID(widget.advanceModel.hospitalsModel.iD, int.parse(widget.advanceModel.fileNumber));
widget.advanceModel.hospitalsModel.iD,
int.parse(widget.advanceModel.fileNumber));
browser.openPaymentBrowser( browser.openPaymentBrowser(amount, "Advance Payment", transID, widget.advanceModel.hospitalsModel.iD.toString(), widget.advanceModel.email, paymentMethod,
amount, widget.patientInfoAndMobileNumber.patientType, widget.advanceModel.patientName, widget.advanceModel.fileNumber, authenticatedUser, browser, false, "3", "");
"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) { onBrowserLoadStart(String url) {
@ -314,22 +317,10 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
createAdvancePayment(res, AppoitmentAllHistoryResultList appo) { createAdvancePayment(res, AppoitmentAllHistoryResultList appo) {
DoctorsListService service = new DoctorsListService(); DoctorsListService service = new DoctorsListService();
String paymentReference = res['Fort_id'].toString(); String paymentReference = res['Fort_id'].toString();
service.HIS_createAdvancePayment( service.HIS_createAdvancePayment(appo, widget.advanceModel.hospitalsModel.iD.toString(), res['Amount'], res['Fort_id'], res['PaymentMethod'], widget.patientInfoAndMobileNumber.patientType,
appo, widget.advanceModel.patientName, widget.advanceModel.fileNumber, AppGlobal.context)
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) { .then((res) {
addAdvancedNumberRequest( addAdvancedNumberRequest(res['OnlineCheckInAppointments'][0]['AdvanceNumber'].toString(), paymentReference, 0, appo);
res['OnlineCheckInAppointments'][0]['AdvanceNumber'].toString(),
paymentReference,
0,
appo);
}).catchError((err) { }).catchError((err) {
GifLoaderDialogUtils.hideDialog(AppGlobal.context); GifLoaderDialogUtils.hideDialog(AppGlobal.context);
AppToast.showErrorToast(message: err); AppToast.showErrorToast(message: err);
@ -337,13 +328,9 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
}); });
} }
addAdvancedNumberRequest(String advanceNumber, String paymentReference, addAdvancedNumberRequest(String advanceNumber, String paymentReference, dynamic appointmentID, AppoitmentAllHistoryResultList appo) {
dynamic appointmentID, AppoitmentAllHistoryResultList appo) {
DoctorsListService service = new DoctorsListService(); DoctorsListService service = new DoctorsListService();
service service.addAdvancedNumberRequest(advanceNumber, paymentReference, appointmentID, AppGlobal.context).then((res) {
.addAdvancedNumberRequest(
advanceNumber, paymentReference, appointmentID, AppGlobal.context)
.then((res) {
print(res); print(res);
GifLoaderDialogUtils.hideDialog(AppGlobal.context); GifLoaderDialogUtils.hideDialog(AppGlobal.context);
navigateToHome(AppGlobal.context); navigateToHome(AppGlobal.context);

@ -1,50 +1,50 @@
import 'dart:convert'; import 'dart:convert';
// import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:diplomaticquarterapp/pages/webRTC/fcm/FCMSendNotification.dart';
import 'package:diplomaticquarterapp/uitl/SignalRUtil.dart'; import 'package:diplomaticquarterapp/uitl/SignalRUtil.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter_webrtc/flutter_webrtc.dart'; import 'package:flutter_webrtc/flutter_webrtc.dart';
import 'call_page.dart';
typedef void StreamStateCallback(MediaStream stream); typedef void StreamStateCallback(MediaStream stream);
typedef void RTCIceGatheringStateCallback(RTCIceGatheringState state); typedef void RTCIceGatheringStateCallback(RTCIceGatheringState state);
typedef void RTCPeerConnectionStateCallback(RTCPeerConnectionState state); typedef void RTCPeerConnectionStateCallback(RTCPeerConnectionState state);
typedef void RTCSignalingStateCallback(RTCSignalingState state); typedef void RTCSignalingStateCallback(RTCSignalingState state);
class Signaling { class Signaling {
dispose() {
dispose(){ if (peerConnection != null) peerConnection.dispose();
if(peerConnection != null)
peerConnection.dispose();
signalR.closeConnection(); signalR.closeConnection();
} }
init(){ init() {
// Create Peer Connection // Create Peer Connection
createPeerConnection(configuration).then((value){ createPeerConnection(configuration).then((value) {
peerConnection = value; peerConnection = value;
registerPeerConnectionListeners(); registerPeerConnectionListeners();
}); });
} }
initializeSignalR(String userName) async {
initializeSignalR(String userName) async{ if (signalR != null) await signalR.closeConnection();
if(signalR != null)
await signalR.closeConnection();
// https://vcallapi.hmg.com/webRTCHub?source=web&username=zohaib // https://vcallapi.hmg.com/webRTCHub?source=web&username=zohaib
signalR = SignalRUtil(hubName: "https://vcallapi.hmg.com/webRTCHub?source=mobile&username=$userName"); signalR = SignalRUtil(hubName: "https://vcallapi.hmg.com/webRTCHub?source=mobile&username=$userName");
final connected = await signalR.openConnection(); final connected = await signalR.openConnection();
if(!connected) if (!connected) throw 'Failed to connect SignalR';
throw 'Failed to connect SignalR';
} }
Map<String, dynamic> configuration = { Map<String, dynamic> configuration = {
// 'iceServers': [
// {
// 'urls': ['stun:stun1.l.google.com:19302', 'stun:stun2.l.google.com:19302']
// }
// ]
'iceServers': [ 'iceServers': [
{ // {
'urls': ['stun:stun1.l.google.com:19302', 'stun:stun2.l.google.com:19302'] // 'urls': ['stun:stun1.l.google.com:19302', 'stun:stun2.l.google.com:19302']
} // }
{'url': "stun:ec2-15-185-116-59.me-south-1.compute.amazonaws.com:3478"},
{'url': "turn:ec2-15-185-116-59.me-south-1.compute.amazonaws.com:3479", 'credential': "admin", 'username': "admin"}
] ]
}; };
@ -65,8 +65,7 @@ class Signaling {
// return isCallPlaced; // return isCallPlaced;
// } // }
Future<bool> acceptCall(String caller, String receiver, {@required MediaStream localMediaStream, @required Function(MediaStream) onRemoteMediaStream}) async {
Future<bool> acceptCall(String caller, String receiver, {@required MediaStream localMediaStream, @required Function(MediaStream) onRemoteMediaStream}) async{
await initializeSignalR(receiver); await initializeSignalR(receiver);
signalR.setContributors(caller: caller, receiver: receiver); signalR.setContributors(caller: caller, receiver: receiver);
await signalR.acceptCall(receiver, caller).catchError((e) => throw 'Failed to inform signalR that i accepted a call'); await signalR.acceptCall(receiver, caller).catchError((e) => throw 'Failed to inform signalR that i accepted a call');
@ -81,35 +80,28 @@ class Signaling {
return true; return true;
} }
Future hangupCall(String caller, String receiver) async{ Future hangupCall(String caller, String receiver) async {
await signalR.hangupCall(caller, receiver); await signalR.hangupCall(caller, receiver);
dispose(); dispose();
} }
answerOffer(String sdp) async{ answerOffer(String sdp) async {
final offer = jsonDecode(sdp); final offer = jsonDecode(sdp);
final caller = offer['caller']; final caller = offer['caller'];
final receiver = offer['target']; final receiver = offer['target'];
final offerSdp = offer['sdp']; final offerSdp = offer['sdp'];
peerConnection.setRemoteDescription(rtcSessionDescriptionFrom(offerSdp)) peerConnection.setRemoteDescription(rtcSessionDescriptionFrom(offerSdp)).then((value) {
.then((value) {
return peerConnection.createAnswer(); return peerConnection.createAnswer();
}) }).then((anwser) {
.then((anwser) {
return peerConnection.setLocalDescription(anwser); return peerConnection.setLocalDescription(anwser);
}) }).then((value) {
.then((value) {
return peerConnection.getLocalDescription(); return peerConnection.getLocalDescription();
}) }).then((answer) {
.then((answer) {
return signalR.answerOffer(answer, caller, receiver); return signalR.answerOffer(answer, caller, receiver);
}); });
} }
Future<void> hangUp(RTCVideoRenderer localVideo) async { Future<void> hangUp(RTCVideoRenderer localVideo) async {}
}
Future<String> createSdpAnswer(String toOfferSdp) async { Future<String> createSdpAnswer(String toOfferSdp) async {
final offerSdp = rtcSessionDescriptionFrom(jsonDecode(toOfferSdp)); final offerSdp = rtcSessionDescriptionFrom(jsonDecode(toOfferSdp));
@ -128,12 +120,12 @@ class Signaling {
return offerSdp; return offerSdp;
} }
addCandidate(String candidateJson){ addCandidate(String candidateJson) {
peerConnection.addCandidate(rtcIceCandidateFrom(candidateJson)); peerConnection.addCandidate(rtcIceCandidateFrom(candidateJson));
} }
void registerPeerConnectionListeners() { void registerPeerConnectionListeners() {
peerConnection.onIceCandidate = (RTCIceCandidate candidate){ peerConnection.onIceCandidate = (RTCIceCandidate candidate) {
// print(json.encode(candidate.toMap())); // print(json.encode(candidate.toMap()));
signalR.addIceCandidate(json.encode(candidate.toMap())); signalR.addIceCandidate(json.encode(candidate.toMap()));
}; };
@ -152,14 +144,14 @@ class Signaling {
} }
} }
rtcSessionDescriptionFrom(Map sdp) {
rtcSessionDescriptionFrom(Map sdp){
return RTCSessionDescription( return RTCSessionDescription(
sdp['sdp'],sdp['type'], sdp['sdp'],
sdp['type'],
); );
} }
rtcIceCandidateFrom(String json){ rtcIceCandidateFrom(String json) {
final map = jsonDecode(json)['candidate']; final map = jsonDecode(json)['candidate'];
return RTCIceCandidate(map['candidate'], map['sdpMid'], map['sdpMLineIndex']); return RTCIceCandidate(map['candidate'], map['sdpMid'], map['sdpMLineIndex']);
} }

@ -9,10 +9,12 @@ import 'package:diplomaticquarterapp/models/Appointments/PatientShareResposne.da
import 'package:diplomaticquarterapp/models/Appointments/doctor_pre_post_image.dart'; import 'package:diplomaticquarterapp/models/Appointments/doctor_pre_post_image.dart';
import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
import 'package:diplomaticquarterapp/models/Request.dart'; import 'package:diplomaticquarterapp/models/Request.dart';
import 'package:diplomaticquarterapp/models/apple_pay_request.dart';
import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
class DoctorsListService extends BaseService { class DoctorsListService extends BaseService {
@ -391,6 +393,7 @@ class DoctorsListService extends BaseService {
"StrAppointmentDate": selectedDate, "StrAppointmentDate": selectedDate,
"IsVirtual": false, "IsVirtual": false,
"DeviceType": Platform.isIOS ? 'iOS' : 'Android', "DeviceType": Platform.isIOS ? 'iOS' : 'Android',
"DeviceToken": await sharedPref.getString(PUSH_TOKEN),
"BookedBy": 102, "BookedBy": 102,
"VisitType": 1, "VisitType": 1,
"VisitFor": 1, "VisitFor": 1,
@ -1343,6 +1346,47 @@ class DoctorsListService extends BaseService {
return Future.value(localRes); return Future.value(localRes);
} }
Future<Map> callPayfortApplePayAPI(ApplePayRequest applePayRequest, BuildContext context) async {
Map<String, dynamic> request;
request = {
"currency": applePayRequest.currency,
"language": applePayRequest.language,
"customername": applePayRequest.customername,
"customer_email": applePayRequest.customerEmail,
"orderdescription": applePayRequest.orderdescription,
"live_serviceid": applePayRequest.liveServiceid,
"longitude": applePayRequest.longitude,
"latitude": applePayRequest.latitude,
"devicetoken": applePayRequest.devicetoken,
"clientrequestid": applePayRequest.clientrequestid,
"projectid": applePayRequest.projectid,
"serviceid": applePayRequest.serviceid,
"patientid": applePayRequest.patientid,
"Amount": applePayRequest.amount,
"apple_data": applePayRequest.appleData,
"apple_signature": applePayRequest.appleSignature,
"apple_header": {
"apple_applicationData": "76a9a9cb2d9811e8de56d8e7713601bfa6acda3d488b1cf03b9b115bc3ff12b4",
"apple_ephemeralPublicKey": applePayRequest.appleHeader.appleEphemeralPublicKey,
"apple_publicKeyHash": applePayRequest.appleHeader.applePublicKeyHash,
"apple_transactionId": applePayRequest.appleHeader.appleTransactionId
},
"apple_paymentMethod": {
"apple_displayName": applePayRequest.applePaymentMethod.appleDisplayName,
"apple_network": applePayRequest.applePaymentMethod.appleNetwork,
"apple_type": applePayRequest.applePaymentMethod.appleType
}
};
dynamic localRes;
await baseAppClient.post(MyInAppBrowser.APPLE_PAY_PAYFORT_URL, onSuccess: (response, statusCode) async {
localRes = response;
}, onFailure: (String error, int statusCode) {
throw error;
}, body: request, isExternal: true);
return Future.value(localRes);
}
Future<Map> getLaserBodyPartsList(int laserCategoryID) async { Future<Map> getLaserBodyPartsList(int laserCategoryID) async {
Map<String, dynamic> request; Map<String, dynamic> request;

@ -209,8 +209,9 @@ class LiveCareService extends BaseService {
"ClientRequestID": clientRequestID, "ClientRequestID": clientRequestID,
"DeviceToken": deviceToken, "DeviceToken": deviceToken,
"VoipToken": "", "VoipToken": "",
"Latitude": "24.708488", "IsFlutter": true,
"Longitude": "46.665925", "Latitude": await this.sharedPref.getDouble(USER_LAT),
"Longitude": await this.sharedPref.getDouble(USER_LONG),
"DeviceType": Platform.isIOS ? 'iOS' : 'Android', "DeviceType": Platform.isIOS ? 'iOS' : 'Android',
"Age": authUser.age != null ? authUser.age : 0, "Age": authUser.age != null ? authUser.age : 0,
"PatientID": authUser.patientID != null ? authUser.patientID : 0, "PatientID": authUser.patientID != null ? authUser.patientID : 0,

@ -121,6 +121,8 @@ class AppSharedPreferences {
/// remove value based on [key] the key was saved /// remove value based on [key] the key was saved
remove(String key) async { remove(String key) async {
final SharedPreferences prefs = await _prefs; final SharedPreferences prefs = await _prefs;
prefs.remove(key); prefs.remove(key).then((value) {
print(value);
});
} }
} }

@ -28,13 +28,16 @@ var _InAppBrowserOptions = InAppBrowserClassOptions(
class MyInAppBrowser extends InAppBrowser { class MyInAppBrowser extends InAppBrowser {
_PAYMENT_TYPE paymentType; _PAYMENT_TYPE paymentType;
// static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT // static String APPLE_PAY_PAYFORT_URL = 'https://hmgwebservices.com/PayFortWebLive/PayFortApi/MakeApplePayRequest'; // Payfort Payment Gateway URL LIVE
static String APPLE_PAY_PAYFORT_URL = 'https://hmgwebservices.com/PayFortWeb/PayFortApi/MakeApplePayRequest'; // Payfort Payment Gateway URL UAT
static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL LIVE static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT
// static String PREAUTH_SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort PreAuth Payment Gateway URL UAT // static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL LIVE
static String PREAUTH_SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort PreAuth Payment Gateway URL Live Store static String PREAUTH_SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort PreAuth Payment Gateway URL UAT
// static String PREAUTH_SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort PreAuth Payment Gateway URL Live Store
// static String PRESCRIPTION_PAYMENT_WITH_ORDERID = // static String PRESCRIPTION_PAYMENT_WITH_ORDERID =
// 'https://uat.hmgwebservices.com/epharmacy/checkout/OpcCompleteRedirectionPaymentClientbyOrder?orderID='; // 'https://uat.hmgwebservices.com/epharmacy/checkout/OpcCompleteRedirectionPaymentClientbyOrder?orderID=';

@ -42,7 +42,10 @@ dependencies:
permission_handler: ^8.3.0 permission_handler: ^8.3.0
# Flutter Html View # Flutter Html View
flutter_html: ^2.1.5 flutter_html: ^2.2.1
#Apple Pay
pay: ^1.0.7
# Pagnation # Pagnation
pull_to_refresh: ^2.0.0 pull_to_refresh: ^2.0.0
@ -107,7 +110,7 @@ dependencies:
syncfusion_flutter_calendar: ^19.3.55 syncfusion_flutter_calendar: ^19.3.55
# SVG Images # SVG Images
flutter_svg: ^0.23.0+1 # flutter_svg: ^0.23.0+1
#Calendar Events #Calendar Events
manage_calendar_events: ^2.0.1 manage_calendar_events: ^2.0.1
@ -200,6 +203,7 @@ dependencies:
dependency_overrides: dependency_overrides:
provider : ^5.0.0 provider : ^5.0.0
permission_handler : ^6.0.1+1 permission_handler : ^6.0.1+1
flutter_svg: ^1.0.0
dev_dependencies: dev_dependencies:
@ -211,6 +215,7 @@ flutter:
uses-material-design: true uses-material-design: true
# assets: # assets:
assets: assets:
- assets/
- assets/images/ - assets/images/
- assets/images/map_markers/ - assets/images/map_markers/
- assets/images/pharmacy/ - assets/images/pharmacy/

Loading…
Cancel
Save