From ea8d700d228ff7386ddef500f0ef4eca9051c625 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Wed, 19 Jan 2022 17:14:21 +0300 Subject: [PATCH 1/5] updates & fixes --- assets/applepay.json | 6 +- lib/pages/ToDoList/payment_method_select.dart | 22 -------- .../medical/balance/confirm_payment_page.dart | 56 +++++++------------ 3 files changed, 22 insertions(+), 62 deletions(-) diff --git a/assets/applepay.json b/assets/applepay.json index 5b00d6d5..0a5fdc11 100644 --- a/assets/applepay.json +++ b/assets/applepay.json @@ -4,14 +4,10 @@ "merchantIdentifier": "merchant.com.hmgwebservices", "displayName": "Sulaiman Al Habib", "merchantCapabilities": [ - "3DS", - "debit", - "credit" + "3DS" ], "supportedNetworks": [ - "amex", "visa", - "discover", "masterCard" ], "countryCode": "SA", diff --git a/lib/pages/ToDoList/payment_method_select.dart b/lib/pages/ToDoList/payment_method_select.dart index b0f65e13..f306fe09 100644 --- a/lib/pages/ToDoList/payment_method_select.dart +++ b/lib/pages/ToDoList/payment_method_select.dart @@ -302,28 +302,6 @@ class _PaymentMethodState extends State { padding: EdgeInsets.all(16), color: Colors.white, child: - // selectedPaymentMethod == "ApplePay" - // ? ApplePayButton( - // paymentConfigurationAsset: 'applepay.json', - // paymentItems: _paymentItems, - // style: ApplePayButtonStyle.black, - // type: ApplePayButtonType.inStore, - // width: MediaQuery.of(context).size.width, - // height: 50, - // margin: const EdgeInsets.only(top: 15.0), - // onPaymentResult: (value) { - // print(value); - // // applePayResponse = ApplePayResponse.fromJson(value); - // // print(applePayResponse.token.data); - // }, - // onError: (error) { - // print(error); - // }, - // loadingIndicator: const Center( - // child: CircularProgressIndicator(), - // ), - // ) - // : Container( width: MediaQuery.of(context).size.width, height: 50.0, diff --git a/lib/pages/medical/balance/confirm_payment_page.dart b/lib/pages/medical/balance/confirm_payment_page.dart index 57548633..e8bc51aa 100644 --- a/lib/pages/medical/balance/confirm_payment_page.dart +++ b/lib/pages/medical/balance/confirm_payment_page.dart @@ -5,6 +5,7 @@ import 'package:diplomaticquarterapp/core/model/my_balance/patient_info_and_mobi import 'package:diplomaticquarterapp/core/viewModels/medical/my_balance_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.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'; @@ -42,19 +43,12 @@ class _ConfirmPaymentPageState extends State { AppSharedPreferences sharedPref = AppSharedPreferences(); String transID = ""; + ApplePayResponse applePayResponse; 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); @@ -65,25 +59,6 @@ class _ConfirmPaymentPageState extends State { appo.projectID = widget.patientInfoAndMobileNumber.projectID; if (widget.selectedPaymentMethod == "ApplePay") { - // _payClient.userCanPay(PayProvider.apple_pay).then((value) { - // print(value); - // }); - - // return FutureBuilder( - // 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); } @@ -215,14 +190,7 @@ class _ConfirmPaymentPageState extends State { child: DefaultButton( TranslationBase.of(context).confirm.toUpperCase(), () { - _payClient.userCanPay(PayProvider.apple_pay).then((value) async { - print(value); - final result = await _payClient.showPaymentSelector( - provider: PayProvider.apple_pay, - paymentItems: _paymentItems, - ); - print(result); - }); + startApplePayPayment(); // GifLoaderDialogUtils.showMyDialog(context); // model.sendActivationCodeForAdvancePayment(patientID: int.parse(widget.advanceModel.fileNumber), projectID: widget.advanceModel.hospitalsModel.iD).then((value) { // GifLoaderDialogUtils.hideDialog(context); @@ -328,6 +296,24 @@ class _ConfirmPaymentPageState extends State { }); } + startApplePayPayment() { + var _paymentItems = [ + PaymentItem( + label: TranslationBase.of(context).advancePayment, + 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); + }); + } + addAdvancedNumberRequest(String advanceNumber, String paymentReference, dynamic appointmentID, AppoitmentAllHistoryResultList appo) { DoctorsListService service = new DoctorsListService(); service.addAdvancedNumberRequest(advanceNumber, paymentReference, appointmentID, AppGlobal.context).then((res) { From f8b3847d0aa8bebed5ac0cf957965d20af0723bf Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 20 Jan 2022 12:09:31 +0300 Subject: [PATCH 2/5] Ancillary Orders completed --- lib/config/localized_values.dart | 1 + .../ancillaryOrdersDetails.dart | 20 ++++++++++++++++--- lib/uitl/translations_delegate_base.dart | 2 ++ 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 706bec87..626b7c7f 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1751,4 +1751,5 @@ const Map localizedValues = { "covidTestTodo": {"en": "Covid-19 Test", "ar": "فحص كورونا"}, "ancillaryOrdersPaymentConfirm": {"en": "Are you sure you want to make payment for selected orders?", "ar": "هل أنت متأكد أنك تريد سداد قيمة الطلبات المختارة؟"}, "successRegister": {"en": "Your account has been created.", "ar": "لقد تم إنشاء حسابك."}, + "ancillaryOrderPaymentSuccess": {"en": "Your payment has been successfully made. Your invoice no. is: ", "ar": "تم الدفع الخاص بك بنجاح. فاتورتك لا. يكون: "}, }; diff --git a/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart b/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart index f2bc4091..4798b533 100644 --- a/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart +++ b/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart @@ -15,6 +15,7 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/alert_dialog.dart'; import 'package:diplomaticquarterapp/widgets/dragable_sheet.dart'; import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -369,8 +370,10 @@ class _AnicllaryOrdersState extends State with SingleTic }), 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, mProjectViewModel: projectViewModel), - 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, mProjectViewModel: projectViewModel), + 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, mProjectViewModel: projectViewModel), ]), ); } @@ -500,8 +503,8 @@ class _AnicllaryOrdersState extends State with SingleTic DoctorsListService service = new DoctorsListService(); service.autoGenerateAncillaryOrdersInvoice(widget.orderNo, widget.projectID, widget.appoNo, selectedProcListAPI, AppGlobal.context).then((res) { - print(res); GifLoaderDialogUtils.hideDialog(AppGlobal.context); + showAlertDialog(res['AncillaryOrderInvoiceList'][0]['InvoiceNo']); }).catchError((err) { GifLoaderDialogUtils.hideDialog(AppGlobal.context); AppToast.showErrorToast(message: err); @@ -509,6 +512,17 @@ class _AnicllaryOrdersState extends State with SingleTic }); } + showAlertDialog(dynamic invoiceNo) { + AlertDialogBox( + context: context, + confirmMessage: TranslationBase.of(context).ancillaryOrderPaymentSuccess + invoiceNo.toString(), + okText: TranslationBase.of(context).ok, + okFunction: () { + AlertDialogBox.closeAlertDialog(context); + Navigator.of(context).pop(); + }).showAlertDialog(context); + } + bool checkIfProcedureSelected(AncillaryOrderProcDetailsList ancillaryOrderProcDetailsList) { if (selectedProcList.length > 0) { if (selectedProcList.contains(ancillaryOrderProcDetailsList)) { diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index a367df0d..3d84a86c 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -2827,6 +2827,8 @@ class TranslationBase { String get ancillaryOrdersPaymentConfirm => localizedValues["ancillaryOrdersPaymentConfirm"][locale.languageCode]; String get covidTestTodo => localizedValues["covidTestTodo"][locale.languageCode]; String get successRegister => localizedValues["successRegister"][locale.languageCode]; + String get ancillaryOrderPaymentSuccess => localizedValues["ancillaryOrderPaymentSuccess"][locale.languageCode]; + } class TranslationBaseDelegate extends LocalizationsDelegate { From 4bc67b37e0986515b8578d009ea4f052056b4576 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 25 Jan 2022 16:55:36 +0300 Subject: [PATCH 3/5] no message --- ios/Podfile.lock | 6 ++ .../medical/balance/confirm_payment_page.dart | 72 +++++++++++++------ 2 files changed, 56 insertions(+), 22 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 49f5e49b..564d98c2 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -225,6 +225,8 @@ PODS: - Flutter - path_provider_ios (0.0.1): - Flutter + - pay_ios (0.0.1): + - Flutter - "permission_handler (5.1.0+2)": - Flutter - PromisesObjC (2.0.0) @@ -297,6 +299,7 @@ DEPENDENCIES: - native_device_orientation (from `.symlinks/plugins/native_device_orientation/ios`) - package_info_plus (from `.symlinks/plugins/package_info_plus/ios`) - path_provider_ios (from `.symlinks/plugins/path_provider_ios/ios`) + - pay_ios (from `.symlinks/plugins/pay_ios/ios`) - permission_handler (from `.symlinks/plugins/permission_handler/ios`) - screen_brightness_ios (from `.symlinks/plugins/screen_brightness_ios/ios`) - searchable_dropdown (from `.symlinks/plugins/searchable_dropdown/ios`) @@ -407,6 +410,8 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/package_info_plus/ios" path_provider_ios: :path: ".symlinks/plugins/path_provider_ios/ios" + pay_ios: + :path: ".symlinks/plugins/pay_ios/ios" permission_handler: :path: ".symlinks/plugins/permission_handler/ios" screen_brightness_ios: @@ -484,6 +489,7 @@ SPEC CHECKSUMS: OrderedSet: aaeb196f7fef5a9edf55d89760da9176ad40b93c package_info_plus: 6c92f08e1f853dc01228d6f553146438dafcd14e path_provider_ios: 7d7ce634493af4477d156294792024ec3485acd5 + pay_ios: 8c7beb9c61d885f3f51b61f75f8793023fc8843a permission_handler: ccb20a9fad0ee9b1314a52b70b76b473c5f8dab0 PromisesObjC: 68159ce6952d93e17b2dfe273b8c40907db5ba58 Reachability: 33e18b67625424e47b6cde6d202dce689ad7af96 diff --git a/lib/pages/medical/balance/confirm_payment_page.dart b/lib/pages/medical/balance/confirm_payment_page.dart index e8bc51aa..c755e9b1 100644 --- a/lib/pages/medical/balance/confirm_payment_page.dart +++ b/lib/pages/medical/balance/confirm_payment_page.dart @@ -1,11 +1,9 @@ import 'package:diplomaticquarterapp/config/config.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'; import 'package:diplomaticquarterapp/core/viewModels/medical/my_balance_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.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'; @@ -43,7 +41,6 @@ class _ConfirmPaymentPageState extends State { AppSharedPreferences sharedPref = AppSharedPreferences(); String transID = ""; - ApplePayResponse applePayResponse; Pay _payClient = Pay.withAssets([ 'applepay.json', @@ -58,7 +55,6 @@ class _ConfirmPaymentPageState extends State { AppoitmentAllHistoryResultList appo = new AppoitmentAllHistoryResultList(); appo.projectID = widget.patientInfoAndMobileNumber.projectID; if (widget.selectedPaymentMethod == "ApplePay") { - } else { openPayment(widget.selectedPaymentMethod, widget.authenticatedUser, double.parse(widget.advanceModel.amount), null); } @@ -95,6 +91,30 @@ class _ConfirmPaymentPageState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ + // ApplePayButton( + // paymentConfigurationAsset: 'applepay.json', + // paymentItems: [ + // PaymentItem( + // label: 'Advance Payment', + // amount: widget.advanceModel.amount, + // status: PaymentItemStatus.final_price, + // ) + // ], + // style: ApplePayButtonStyle.black, + // type: ApplePayButtonType.plain, + // width: 200, + // height: 50, + // margin: const EdgeInsets.only(top: 15.0), + // onPaymentResult: (value) { + // print(value); + // }, + // onError: (error) { + // print(error); + // }, + // loadingIndicator: const Center( + // child: CircularProgressIndicator(), + // ), + // ), Text( TranslationBase.of(context).confirmThePayment, textAlign: TextAlign.center, @@ -190,7 +210,7 @@ class _ConfirmPaymentPageState extends State { child: DefaultButton( TranslationBase.of(context).confirm.toUpperCase(), () { - startApplePayPayment(); + // startApplePayPayment(); // GifLoaderDialogUtils.showMyDialog(context); // model.sendActivationCodeForAdvancePayment(patientID: int.parse(widget.advanceModel.fileNumber), projectID: widget.advanceModel.hospitalsModel.iD).then((value) { // GifLoaderDialogUtils.hideDialog(context); @@ -204,6 +224,21 @@ class _ConfirmPaymentPageState extends State { ); } + List getPaymentItems() { + List _paymentItems = []; + _paymentItems.add(PaymentItem( + label: 'Advance Payment', + amount: widget.advanceModel.amount, + status: PaymentItemStatus.final_price, + )); + + return _paymentItems; + } + + void onApplePayResult(paymentResult) { + print(paymentResult); + } + String getImagePath(String paymentMethod) { switch (paymentMethod) { case "MADA": @@ -296,23 +331,16 @@ class _ConfirmPaymentPageState extends State { }); } - startApplePayPayment() { - var _paymentItems = [ - PaymentItem( - label: TranslationBase.of(context).advancePayment, - 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); - }); - } + // startApplePayPayment() { + // _payClient.userCanPay(PayProvider.apple_pay).then((value) async { + // print(value); + // final result = await _payClient.showPaymentSelector( + // provider: PayProvider.apple_pay, + // paymentItems: _paymentItems, + // ); + // print(result); + // }); + // } addAdvancedNumberRequest(String advanceNumber, String paymentReference, dynamic appointmentID, AppoitmentAllHistoryResultList appo) { DoctorsListService service = new DoctorsListService(); From 742d06976fa2f683121d7699fc18c886a384bcec Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 25 Jan 2022 16:56:02 +0300 Subject: [PATCH 4/5] no message --- assets/applepay.json | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/assets/applepay.json b/assets/applepay.json index 0a5fdc11..b33de32d 100644 --- a/assets/applepay.json +++ b/assets/applepay.json @@ -4,11 +4,14 @@ "merchantIdentifier": "merchant.com.hmgwebservices", "displayName": "Sulaiman Al Habib", "merchantCapabilities": [ - "3DS" + "3DS", + "credit", + "debit" ], "supportedNetworks": [ "visa", - "masterCard" + "masterCard", + "mada" ], "countryCode": "SA", "currencyCode": "SAR", From 736edad01841eefcd31ca1aab5b5a7bca5ca3505 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Wed, 23 Feb 2022 15:04:34 +0300 Subject: [PATCH 5/5] OB Gyne appo updates --- lib/config/localized_values.dart | 1 + lib/uitl/translations_delegate_base.dart | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 69c2b10d..40b4afbf 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1752,4 +1752,5 @@ const Map localizedValues = { "ancillaryOrdersPaymentConfirm": {"en": "Are you sure you want to make payment for selected orders?", "ar": "هل أنت متأكد أنك تريد سداد قيمة الطلبات المختارة؟"}, "successRegister": {"en": "Your account has been created.", "ar": "لقد تم إنشاء حسابك."}, "pharmacyLiveCare": {"en": "Pharmacy LiveCare", "ar": "لايف كير صيدلية"}, + "ancillaryOrderPaymentSuccess": {"en": "Your payment for selected orders has been made successfully.", "ar": "تم سداد دفعتك للطلبات المحددة بنجاح."}, }; diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 9ed7671a..ae0a9849 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -2828,7 +2828,7 @@ class TranslationBase { String get covidTestTodo => localizedValues["covidTestTodo"][locale.languageCode]; String get successRegister => localizedValues["successRegister"][locale.languageCode]; String get pharmacyLiveCare => localizedValues["pharmacyLiveCare"][locale.languageCode]; - + String get ancillaryOrderPaymentSuccess => localizedValues["ancillaryOrderPaymentSuccess"][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate {