|
|
|
|
@ -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<ConfirmPaymentPage> {
|
|
|
|
|
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<ConfirmPaymentPage> {
|
|
|
|
|
appo.projectID = widget.patientInfoAndMobileNumber.projectID;
|
|
|
|
|
if (widget.selectedPaymentMethod == "ApplePay") {
|
|
|
|
|
|
|
|
|
|
// _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);
|
|
|
|
|
}
|
|
|
|
|
@ -215,14 +190,7 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
|
|
|
|
|
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<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);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
addAdvancedNumberRequest(String advanceNumber, String paymentReference, dynamic appointmentID, AppoitmentAllHistoryResultList appo) {
|
|
|
|
|
DoctorsListService service = new DoctorsListService();
|
|
|
|
|
service.addAdvancedNumberRequest(advanceNumber, paymentReference, appointmentID, AppGlobal.context).then((res) {
|
|
|
|
|
|