|
|
|
|
@ -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<ConfirmPaymentPage> {
|
|
|
|
|
AppSharedPreferences sharedPref = AppSharedPreferences();
|
|
|
|
|
|
|
|
|
|
String transID = "";
|
|
|
|
|
ApplePayResponse applePayResponse;
|
|
|
|
|
|
|
|
|
|
Pay _payClient = Pay.withAssets([
|
|
|
|
|
'applepay.json',
|
|
|
|
|
@ -58,7 +55,6 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
|
|
|
|
|
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<ConfirmPaymentPage> {
|
|
|
|
|
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<ConfirmPaymentPage> {
|
|
|
|
|
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<ConfirmPaymentPage> {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<PaymentItem> getPaymentItems() {
|
|
|
|
|
List<PaymentItem> _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<ConfirmPaymentPage> {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
|