Payfort request & response insert

haroon_dev
haroon amjad 1 day ago
parent 6abcdf135e
commit 3dd4665f6e

@ -211,7 +211,7 @@ class ApiClientImp implements ApiClient {
}
body['TokenID'] = "@dm!n";
// body['PatientID'] = 4772993;
// body['PatientID'] = 255375;
// body['PatientID'] = 89754444;
// body['PatientTypeID'] = 1;
// body['PatientOutSA'] = 0;

@ -988,7 +988,10 @@ var IS_DOCTOR_AVAILABLE_BY_CALENDAR_SCHEDULE = 'Services/OUTPs.svc/REST/HIS_IsDo
//PAYFORT
var getPayFortProjectDetails = "Services/PayFort_Serv.svc/REST/GetPayFortProjectDetails";
var addPayFortApplePayResponse = "Services/PayFort_Serv.svc/REST/AddResponse";
var ADD_PAYFORT_REQUEST = "Services/PayFort_Serv.svc/REST/AddRequest";
var ADD_PAYFORT_RESPONSE = "Services/PayFort_Serv.svc/REST/AddResponse";
// var payFortEnvironment = FortEnvironment.production;
// var applePayMerchantId = "merchant.com.hmgwebservices";
// var payFortEnvironment = FortEnvironment.test;

@ -0,0 +1,128 @@
class PayfortRequestInsertModel {
String? accessCode;
String? commandType;
num? amount;
String? customerEmail;
String? orderDescription;
String? serviceID;
String? returnURL;
String? paymentOption;
String? clientRequestID;
String? projectID;
String? fileNumber;
String? customerName;
String? currency;
String? liveServiceID;
String? longitude;
String? latitude;
String? merchantReference;
String? merchantIdentifier;
String? deviceToken;
String? sHARequestPhase;
String? sHAResponsePhase;
String? signature;
String? language;
String? integrationId;
String? iPAdress;
String? isSchedule;
String? appointmentDate;
String? appointmentNo;
String? doctorID;
PayfortRequestInsertModel(
{this.accessCode,
this.commandType,
this.amount,
this.customerEmail,
this.orderDescription,
this.serviceID,
this.returnURL,
this.paymentOption,
this.clientRequestID,
this.projectID,
this.fileNumber,
this.customerName,
this.currency,
this.liveServiceID,
this.longitude,
this.latitude,
this.merchantReference,
this.merchantIdentifier,
this.deviceToken,
this.sHARequestPhase,
this.sHAResponsePhase,
this.signature,
this.language,
this.integrationId,
this.iPAdress,
this.isSchedule,
this.appointmentDate,
this.appointmentNo,
this.doctorID});
PayfortRequestInsertModel.fromJson(Map<String, dynamic> json) {
accessCode = json['Access_code'];
commandType = json['CommandType'];
amount = json['Amount'];
customerEmail = json['CustomerEmail'];
orderDescription = json['OrderDescription'];
serviceID = json['Service_ID'];
returnURL = json['ReturnURL'];
paymentOption = json['PaymentOption'];
clientRequestID = json['ClientRequestID'];
projectID = json['ProjectID'];
fileNumber = json['FileNumber'];
customerName = json['CustomerName'];
currency = json['Currency'];
liveServiceID = json['Live_ServiceID'];
longitude = json['Longitude'];
latitude = json['Latitude'];
merchantReference = json['Merchant_Reference'];
merchantIdentifier = json['Merchant_Identifier'];
deviceToken = json['DeviceToken'];
sHARequestPhase = json['SHA_RequestPhase'];
sHAResponsePhase = json['SHA_ResponsePhase'];
signature = json['Signature'];
language = json['Language'];
integrationId = json['Integration_Id'];
iPAdress = json['IPAdress'];
isSchedule = json['IsSchedule'];
appointmentDate = json['AppointmentDate'];
appointmentNo = json['AppointmentNo'];
doctorID = json['DoctorID'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['Access_code'] = this.accessCode;
data['CommandType'] = this.commandType;
data['Amount'] = this.amount;
data['CustomerEmail'] = this.customerEmail;
data['OrderDescription'] = this.orderDescription;
data['Service_ID'] = this.serviceID;
data['ReturnURL'] = this.returnURL;
data['PaymentOption'] = this.paymentOption;
data['ClientRequestID'] = this.clientRequestID;
data['ProjectID'] = this.projectID;
data['FileNumber'] = this.fileNumber;
data['CustomerName'] = this.customerName;
data['Currency'] = this.currency;
data['Live_ServiceID'] = this.liveServiceID;
data['Longitude'] = this.longitude;
data['Latitude'] = this.latitude;
data['Merchant_Reference'] = this.merchantReference;
data['Merchant_Identifier'] = this.merchantIdentifier;
data['DeviceToken'] = this.deviceToken;
data['SHA_RequestPhase'] = this.sHARequestPhase;
data['SHA_ResponsePhase'] = this.sHAResponsePhase;
data['Signature'] = this.signature;
data['Language'] = this.language;
data['Integration_Id'] = this.integrationId;
data['IPAdress'] = this.iPAdress;
data['IsSchedule'] = this.isSchedule;
data['AppointmentDate'] = this.appointmentDate;
data['AppointmentNo'] = this.appointmentNo;
data['DoctorID'] = this.doctorID;
return data;
}
}

@ -0,0 +1,77 @@
class PayfortResponseInsertModel {
String? fortId;
String? commandType;
num? amount;
String? sadadOLP;
String? paymentOption;
String? customerIP;
String? eCI;
String? responseMessage;
String? cardNumber;
String? cardBin;
int? installmentsNumber;
String? status;
String? merchantRef;
bool? isRefund;
bool? remmeberMe;
String? reconciliationReference;
PayfortResponseInsertModel({
this.fortId,
this.commandType,
this.amount,
this.sadadOLP,
this.paymentOption,
this.customerIP,
this.eCI,
this.responseMessage,
this.cardNumber,
this.cardBin,
this.installmentsNumber,
this.status,
this.merchantRef,
this.isRefund,
this.remmeberMe,
this.reconciliationReference,
});
PayfortResponseInsertModel.fromJson(Map<String, dynamic> json) {
fortId = json['Fort_id'];
commandType = json['CommandType'];
amount = json['Amount'];
sadadOLP = json['Sadad_OLP'];
paymentOption = json['Payment_Option'];
customerIP = json['Customer_IP'];
eCI = json['ECI'];
responseMessage = json['Response_Message'];
cardNumber = json['Card_Number'];
cardBin = json['Card_Bin'];
installmentsNumber = json['Installments_Number'];
status = json['Status'];
merchantRef = json['Merchant_Ref'];
isRefund = json['IsRefund'];
remmeberMe = json['RemmeberMe'];
reconciliationReference = json['Reconciliation_Reference'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = Map<String, dynamic>();
data['Fort_id'] = this.fortId;
data['CommandType'] = this.commandType;
data['Amount'] = this.amount;
data['Sadad_OLP'] = this.sadadOLP;
data['Payment_Option'] = this.paymentOption;
data['Customer_IP'] = this.customerIP;
data['ECI'] = this.eCI;
data['Response_Message'] = this.responseMessage;
data['Card_Number'] = this.cardNumber;
data['Card_Bin'] = this.cardBin;
data['Installments_Number'] = this.installmentsNumber;
data['Status'] = this.status;
data['Merchant_Ref'] = this.merchantRef;
data['IsRefund'] = this.isRefund;
data['RemmeberMe'] = this.remmeberMe;
data['Reconciliation_Reference'] = this.reconciliationReference;
return data;
}
}

@ -8,6 +8,8 @@ import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/
import 'package:hmg_patient_app_new/features/payfort/models/apple_pay_request_insert_model.dart';
import 'package:hmg_patient_app_new/features/payfort/models/payfort_check_payment_status_response_model.dart';
import 'package:hmg_patient_app_new/features/payfort/models/payfort_project_details_resp_model.dart';
import 'package:hmg_patient_app_new/features/payfort/models/payfort_request_insert_model.dart';
import 'package:hmg_patient_app_new/features/payfort/models/payfort_response_insert_model.dart';
import 'package:hmg_patient_app_new/features/payfort/models/sdk_token_response_model.dart';
import 'package:hmg_patient_app_new/services/logger_service.dart';
@ -28,6 +30,10 @@ abstract class PayfortRepo {
{required String responseMessage, required String status, required String clientRequestID, required String tamaraOrderID});
Future<Either<Failure, GenericApiModel<GetTamaraInstallmentsDetailsResponseModel>>> getTamaraInstallmentsDetails();
Future<Either<Failure, GenericApiModel<dynamic>>> payfortRequestInsert({required PayfortRequestInsertModel payfortRequestInsertModel});
Future<Either<Failure, GenericApiModel<dynamic>>> payfortResponseInsert({required PayfortResponseInsertModel payfortResponseInsertModel});
}
class PayfortRepoImp implements PayfortRepo {
@ -291,4 +297,57 @@ class PayfortRepoImp implements PayfortRepo {
}
}
@override
Future<Either<Failure, GenericApiModel>> payfortRequestInsert({required PayfortRequestInsertModel payfortRequestInsertModel}) async {
try {
GenericApiModel<dynamic>? apiResponse;
Failure? failure;
await apiClient.post(ADD_PAYFORT_REQUEST, body: payfortRequestInsertModel.toJson(), onFailure: (error, statusCode, {messageStatus, failureType}) {
failure = failureType;
}, onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
try {
apiResponse = GenericApiModel<dynamic>(
messageStatus: messageStatus,
statusCode: statusCode,
errorMessage: null,
data: response,
);
} catch (e) {
failure = DataParsingFailure(e.toString());
}
}, isAllowAny: true, isPaymentServices: true);
if (failure != null) return Left(failure!);
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
return Right(apiResponse!);
} catch (e) {
return Left(UnknownFailure(e.toString()));
}
}
@override
Future<Either<Failure, GenericApiModel>> payfortResponseInsert({required PayfortResponseInsertModel payfortResponseInsertModel}) async {
try {
GenericApiModel<dynamic>? apiResponse;
Failure? failure;
await apiClient.post(ADD_PAYFORT_RESPONSE, body: payfortResponseInsertModel.toJson(), onFailure: (error, statusCode, {messageStatus, failureType}) {
failure = failureType;
}, onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
try {
apiResponse = GenericApiModel<dynamic>(
messageStatus: messageStatus,
statusCode: statusCode,
errorMessage: null,
data: response,
);
} catch (e) {
failure = DataParsingFailure(e.toString());
}
}, isAllowAny: true, isPaymentServices: true);
if (failure != null) return Left(failure!);
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
return Right(apiResponse!);
} catch (e) {
return Left(UnknownFailure(e.toString()));
}
}
}

@ -8,11 +8,15 @@ import 'package:flutter/services.dart';
import 'package:flutter_amazonpaymentservices/flutter_amazonpaymentservices.dart';
import 'package:hmg_patient_app_new/core/api_consts.dart';
import 'package:hmg_patient_app_new/core/app_state.dart';
import 'package:hmg_patient_app_new/core/cache_consts.dart';
import 'package:hmg_patient_app_new/core/dependencies.dart';
import 'package:hmg_patient_app_new/core/utils/utils.dart';
import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/get_tamara_installments_details_response_model.dart';
import 'package:hmg_patient_app_new/features/payfort/models/apple_pay_request_insert_model.dart';
import 'package:hmg_patient_app_new/features/payfort/models/payfort_check_payment_status_response_model.dart';
import 'package:hmg_patient_app_new/features/payfort/models/payfort_project_details_resp_model.dart';
import 'package:hmg_patient_app_new/features/payfort/models/payfort_request_insert_model.dart';
import 'package:hmg_patient_app_new/features/payfort/models/payfort_response_insert_model.dart';
import 'package:hmg_patient_app_new/features/payfort/models/sdk_token_response_model.dart';
import 'package:hmg_patient_app_new/features/payfort/payfort_repo.dart';
import 'package:hmg_patient_app_new/services/error_handler_service.dart';
@ -92,6 +96,44 @@ class PayfortViewModel extends ChangeNotifier {
);
}
Future<void> payfortRequestInsert({required PayfortRequestInsertModel payfortRequestInsertModel, Function(dynamic)? onSuccess, Function(String)? onError}) async {
final result = await payfortRepo.payfortRequestInsert(payfortRequestInsertModel: payfortRequestInsertModel);
result.fold(
(failure) async => await errorHandlerService.handleError(failure: failure),
(apiResponse) {
if (apiResponse.messageStatus == 2) {
// dialogService.showErrorDialog(message: apiResponse.errorMessage!, onOkPressed: () {});
} else if (apiResponse.messageStatus == 1) {
// payfortProjectDetailsRespModel = apiResponse.data!;
notifyListeners();
if (onSuccess != null) {
onSuccess(apiResponse);
}
}
},
);
}
Future<void> payfortResponseInsert({required PayfortResponseInsertModel payfortResponseInsertModel, Function(dynamic)? onSuccess, Function(String)? onError}) async {
final result = await payfortRepo.payfortResponseInsert(payfortResponseInsertModel: payfortResponseInsertModel);
result.fold(
(failure) async => await errorHandlerService.handleError(failure: failure),
(apiResponse) {
if (apiResponse.messageStatus == 2) {
// dialogService.showErrorDialog(message: apiResponse.errorMessage!, onOkPressed: () {});
} else if (apiResponse.messageStatus == 1) {
// payfortProjectDetailsRespModel = apiResponse.data!;
notifyListeners();
if (onSuccess != null) {
onSuccess(apiResponse);
}
}
},
);
}
Future<void> checkPaymentStatus({required String transactionID, Function(dynamic)? onSuccess, Function(String)? onError}) async {
final result = await payfortRepo.checkPaymentStatus(transactionID: transactionID);
@ -291,13 +333,19 @@ class PayfortViewModel extends ChangeNotifier {
}
Future<void> initiatePaymentWithCard( // var request, {
{
String paymentOption,
String liveServiceID,
String isScheduleLiveCare,
String appointmentDate,
String appointmentNo,
String doctorID, {
SucceededCallback? onSucceeded,
FailedCallback? onFailed,
String countryIsoCode = "SA",
String transactionID = "",
String amount = "0",
String fileNumber = "0",
String orderDescription = "",
}) async {
dynamic paymentResult;
@ -325,6 +373,38 @@ class PayfortViewModel extends ChangeNotifier {
"customer_name": "${getIt.get<AppState>().getAuthenticatedUser()!.firstName} ${getIt.get<AppState>().getAuthenticatedUser()!.lastName}",
};
PayfortRequestInsertModel payfortRequestInsertModel = PayfortRequestInsertModel();
payfortRequestInsertModel.accessCode = payfortProjectDetailsRespModel!.accessCode;
payfortRequestInsertModel.commandType = "PURCHASE";
payfortRequestInsertModel.amount = num.parse(amount);
payfortRequestInsertModel.customerEmail = getIt.get<AppState>().getAuthenticatedUser()!.emailAddress;
payfortRequestInsertModel.orderDescription = orderDescription;
payfortRequestInsertModel.serviceID = payfortProjectDetailsRespModel!.servID.toString();
payfortRequestInsertModel.paymentOption = paymentOption;
payfortRequestInsertModel.clientRequestID = transactionID;
payfortRequestInsertModel.projectID = payfortProjectDetailsRespModel!.projectID.toString();
payfortRequestInsertModel.fileNumber = getIt.get<AppState>().getAuthenticatedUser()!.patientId.toString();
payfortRequestInsertModel.customerName = "${getIt.get<AppState>().getAuthenticatedUser()!.firstName} ${getIt.get<AppState>().getAuthenticatedUser()!.lastName}";
payfortRequestInsertModel.currency = getIt.get<AppState>().getAuthenticatedUser()!.outSa! == 0 ? "SAR" : "AED";
payfortRequestInsertModel.liveServiceID = liveServiceID;
payfortRequestInsertModel.latitude = getIt.get<AppState>().userLat.toString();
payfortRequestInsertModel.longitude = getIt.get<AppState>().userLong.toString();
payfortRequestInsertModel.merchantReference = transactionID;
payfortRequestInsertModel.merchantIdentifier = payfortProjectDetailsRespModel!.merchantIdentifier;
payfortRequestInsertModel.deviceToken = await Utils.getStringFromPrefs(CacheConst.pushToken);
payfortRequestInsertModel.sHARequestPhase = payfortProjectDetailsRespModel!.shaRequest;
payfortRequestInsertModel.sHAResponsePhase = payfortProjectDetailsRespModel!.shaResponse;
payfortRequestInsertModel.signature = sdkTokenResponse!.signature;
payfortRequestInsertModel.language = getIt.get<AppState>().isArabic() ? "ar" : "en";
payfortRequestInsertModel.integrationId = "1";
payfortRequestInsertModel.isSchedule = isScheduleLiveCare;
payfortRequestInsertModel.appointmentDate = appointmentDate;
payfortRequestInsertModel.appointmentNo = appointmentNo;
payfortRequestInsertModel.doctorID = doctorID;
await payfortRequestInsert(payfortRequestInsertModel: payfortRequestInsertModel);
LoaderBottomSheet.hideLoader();
paymentResult = await FlutterAmazonpaymentservices.normalPay(request, ApiConsts.payFortEnvironmentType, isShowResponsePage: false);
@ -332,6 +412,27 @@ class PayfortViewModel extends ChangeNotifier {
String responseCode = paymentMap['response_code'] ?? "";
print("Payment Success Data: ${paymentMap.toString()}");
PayfortResponseInsertModel payfortResponseInsertModel = PayfortResponseInsertModel();
payfortResponseInsertModel.fortId = paymentMap['fort_id'] ?? "";
payfortResponseInsertModel.commandType = paymentMap['command'] ?? "";
payfortResponseInsertModel.amount = num.tryParse(paymentMap['amount'] ?? "0") ?? 0;
payfortResponseInsertModel.sadadOLP = "";
payfortResponseInsertModel.paymentOption = paymentMap['payment_option'] ?? "";
payfortResponseInsertModel.customerIP = paymentMap['customer_ip'] ?? "";
payfortResponseInsertModel.eCI = paymentMap['eci'] ?? "";
payfortResponseInsertModel.responseMessage = paymentMap['response_message'] ?? "";
payfortResponseInsertModel.cardNumber = paymentMap['card_number'] ?? "";
payfortResponseInsertModel.cardBin = paymentMap['card_bin'] ?? "";
payfortResponseInsertModel.installmentsNumber = int.tryParse(paymentMap['installments_number'] ?? "0") ?? 0;
payfortResponseInsertModel.status = paymentMap['status'] ?? "";
payfortResponseInsertModel.merchantRef = paymentMap['merchant_reference'] ?? "";
payfortResponseInsertModel.isRefund = false;
payfortResponseInsertModel.remmeberMe = true;
payfortResponseInsertModel.reconciliationReference = "";
await payfortResponseInsert(payfortResponseInsertModel: payfortResponseInsertModel);
if (responseCode.startsWith("14") || responseCode == "20064") {
if (onSucceeded != null) {
onSucceeded(PayFortResult.fromMap(paymentMap));

@ -228,8 +228,15 @@ class _AppointmentPaymentPageState extends State<AppointmentPaymentPage> {
serviceId: ServiceTypeEnum.appointmentPayment.getIdFromServiceEnum(), projectId: widget.patientAppointmentHistoryResponseModel.projectID, integrationId: 1);
payfortViewModel.initiatePaymentWithCard(
"mada",
"0",
widget.patientAppointmentHistoryResponseModel.isLiveCareAppointment! ? "true" : "false",
widget.patientAppointmentHistoryResponseModel.appointmentDate!,
widget.patientAppointmentHistoryResponseModel.appointmentNo!,
widget.patientAppointmentHistoryResponseModel.doctorID!,
transactionID: transID,
fileNumber: appState.getAuthenticatedUser()!.patientId.toString(),
orderDescription: "Appointment Payment",
amount: myAppointmentsViewModel.patientAppointmentShareResponseModel!.patientShareWithTax!.toString(),
onSucceeded: (paymentResult) async {
print("Payment Success Data: ${paymentResult.toString()}");
@ -444,9 +451,16 @@ class _AppointmentPaymentPageState extends State<AppointmentPaymentPage> {
serviceId: ServiceTypeEnum.appointmentPayment.getIdFromServiceEnum(), projectId: widget.patientAppointmentHistoryResponseModel.projectID, integrationId: 1);
payfortViewModel.initiatePaymentWithCard(
"visa",
"0",
widget.patientAppointmentHistoryResponseModel.isLiveCareAppointment! ? "true" : "false",
widget.patientAppointmentHistoryResponseModel.appointmentDate!,
widget.patientAppointmentHistoryResponseModel.appointmentNo!,
widget.patientAppointmentHistoryResponseModel.doctorID!,
transactionID: transID,
fileNumber: appState.getAuthenticatedUser()!.patientId.toString(),
amount: myAppointmentsViewModel.patientAppointmentShareResponseModel!.patientShareWithTax!.toString(),
orderDescription: "Appointment Payment",
onSucceeded: (paymentResult) async {
print("Payment Success Data: ${paymentResult.toString()}");
LoaderBottomSheet.showLoader(loadingText: LocaleKeys.checkingPaymentStatusPleaseWait.tr(context: context));

@ -184,9 +184,16 @@ class _ImmediateLiveCarePaymentPageState extends State<ImmediateLiveCarePaymentP
integrationId: 1);
payfortViewModel.initiatePaymentWithCard(
"mada",
immediateLiveCareViewModel.immediateLiveCareSelectedClinic.serviceID.toString(),
"false",
DateUtil.convertDateToString(DateTime.now()),
"0",
"0",
transactionID: transID,
fileNumber: appState.getAuthenticatedUser()!.patientId.toString(),
amount: immediateLiveCareViewModel.liveCareImmediateAppointmentFeesList.total ?? "0.0",
orderDescription: "LiveCare Payment",
onSucceeded: (paymentResult) async {
print("Payment Success Data: ${paymentResult.toString()}");
LoaderBottomSheet.showLoader(loadingText: LocaleKeys.checkingPaymentStatusPleaseWait.tr(context: context));
@ -328,9 +335,16 @@ class _ImmediateLiveCarePaymentPageState extends State<ImmediateLiveCarePaymentP
integrationId: 1);
payfortViewModel.initiatePaymentWithCard(
"visa",
immediateLiveCareViewModel.immediateLiveCareSelectedClinic.serviceID.toString(),
"false",
DateUtil.convertDateToString(DateTime.now()),
"0",
"0",
transactionID: transID,
fileNumber: appState.getAuthenticatedUser()!.patientId.toString(),
amount: immediateLiveCareViewModel.liveCareImmediateAppointmentFeesList.total ?? "0.0",
orderDescription: "LiveCare Payment",
onSucceeded: (paymentResult) async {
print("Payment Success Data: ${paymentResult.toString()}");
LoaderBottomSheet.showLoader(loadingText: LocaleKeys.checkingPaymentStatusPleaseWait.tr(context: context));

@ -192,9 +192,16 @@ class _WaitingAppointmentPaymentPageState extends State<WaitingAppointmentPaymen
serviceId: ServiceTypeEnum.appointmentPayment.getIdFromServiceEnum(), projectId: bookAppointmentsViewModel.selectedDoctor.projectID!, integrationId: 1);
payfortViewModel.initiatePaymentWithCard(
"mada",
"0",
"false",
DateUtil.convertDateToString(DateTime.now()),
DateTime.now().millisecondsSinceEpoch.toString(),
bookAppointmentsViewModel.selectedDoctor.doctorID.toString(),
transactionID: transID,
fileNumber: appState.getAuthenticatedUser()!.patientId.toString(),
amount: bookAppointmentsViewModel.patientWalkInAppointmentShareResponseModel!.patientShareWithTax!.toString(),
orderDescription: "Appointment Payment",
onSucceeded: (paymentResult) async {
print("Payment Success Data: ${paymentResult.toString()}");
LoaderBottomSheet.hideLoader();
@ -336,9 +343,16 @@ class _WaitingAppointmentPaymentPageState extends State<WaitingAppointmentPaymen
serviceId: ServiceTypeEnum.appointmentPayment.getIdFromServiceEnum(), projectId: bookAppointmentsViewModel.selectedDoctor.projectID!, integrationId: 1);
payfortViewModel.initiatePaymentWithCard(
"visa",
"0",
"false",
DateUtil.convertDateToString(DateTime.now()),
DateTime.now().millisecondsSinceEpoch.toString(),
bookAppointmentsViewModel.selectedDoctor.doctorID.toString(),
transactionID: transID,
fileNumber: appState.getAuthenticatedUser()!.patientId.toString(),
amount: bookAppointmentsViewModel.patientWalkInAppointmentShareResponseModel!.patientShareWithTax!.toString(),
orderDescription: "Appointment Payment",
onSucceeded: (paymentResult) async {
print("Payment Success Data: ${paymentResult.toString()}");
LoaderBottomSheet.hideLoader();

@ -13,6 +13,7 @@ import 'package:hmg_patient_app_new/core/app_state.dart';
import 'package:hmg_patient_app_new/core/cache_consts.dart';
import 'package:hmg_patient_app_new/core/dependencies.dart';
import 'package:hmg_patient_app_new/core/enums.dart';
import 'package:hmg_patient_app_new/core/utils/date_util.dart';
import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
import 'package:hmg_patient_app_new/core/utils/utils.dart';
import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
@ -178,9 +179,16 @@ class _WalletPaymentConfirmPageState extends State<WalletPaymentConfirmPage> {
serviceId: ServiceTypeEnum.advancePayment.getIdFromServiceEnum(), projectId: habibWalletVM.selectedHospital!.iD!, integrationId: 1);
payfortViewModel.initiatePaymentWithCard(
"mada",
"0",
"false",
DateUtil.convertDateToString(DateTime.now()),
"0",
"0",
transactionID: transID,
fileNumber: habibWalletVM.fileNumber.toString(),
amount: habibWalletVM.walletRechargeAmount.toString(),
orderDescription: "Advance Payment",
onSucceeded: (paymentResult) async {
print("Payment Success Data: ${paymentResult.toString()}");
LoaderBottomSheet.showLoader();
@ -204,7 +212,7 @@ class _WalletPaymentConfirmPageState extends State<WalletPaymentConfirmPage> {
habibWalletVM.setIsWalletAmountToBeLoaded(true);
habibWalletVM.initHabibWalletProvider();
habibWalletVM.getPatientBalanceAmount();
Navigator.of(getIt.get<NavigationService>().navigatorKey.currentContext!).pop();
// Navigator.of(getIt.get<NavigationService>().navigatorKey.currentContext!).pop();
Navigator.of(getIt.get<NavigationService>().navigatorKey.currentContext!).pop();
}, isFullScreen: false, isCloseButtonVisible: true, isAutoDismiss: true);
},
@ -353,9 +361,16 @@ class _WalletPaymentConfirmPageState extends State<WalletPaymentConfirmPage> {
serviceId: ServiceTypeEnum.advancePayment.getIdFromServiceEnum(), projectId: habibWalletVM.selectedHospital!.iD!, integrationId: 1);
payfortViewModel.initiatePaymentWithCard(
"visa",
"0",
"false",
DateUtil.convertDateToString(DateTime.now()),
"0",
"0",
transactionID: transID,
fileNumber: habibWalletVM.fileNumber.toString(),
amount: habibWalletVM.walletRechargeAmount.toString(),
orderDescription: "Advance Payment",
onSucceeded: (paymentResult) async {
print("Payment Success Data: ${paymentResult.toString()}");
LoaderBottomSheet.showLoader();
@ -380,7 +395,7 @@ class _WalletPaymentConfirmPageState extends State<WalletPaymentConfirmPage> {
habibWalletVM.initHabibWalletProvider();
habibWalletVM.getPatientBalanceAmount();
Navigator.of(getIt.get<NavigationService>().navigatorKey.currentContext!).pop();
Navigator.of(getIt.get<NavigationService>().navigatorKey.currentContext!).pop();
// Navigator.of(getIt.get<NavigationService>().navigatorKey.currentContext!).pop();
}, isFullScreen: false, isCloseButtonVisible: true, isAutoDismiss: true);
},
onError: (err) {

@ -171,9 +171,16 @@ class _AncillaryOrderPaymentPageState extends State<AncillaryOrderPaymentPage> {
);
payfortViewModel.initiatePaymentWithCard(
"mada",
"0",
"false",
DateUtil.convertDateToString(DateTime.now()),
"0",
"0",
transactionID: transID,
fileNumber: appState.getAuthenticatedUser()!.patientId.toString(),
amount: widget.totalAmount.toString(),
orderDescription: "Ancillary Order Payment",
onSucceeded: (paymentResult) async {
print("Payment Success Data: ${paymentResult.toString()}");
LoaderBottomSheet.showLoader(loadingText: LocaleKeys.checkingPaymentStatusPleaseWait.tr(context: context));
@ -286,9 +293,16 @@ class _AncillaryOrderPaymentPageState extends State<AncillaryOrderPaymentPage> {
);
payfortViewModel.initiatePaymentWithCard(
"visa",
"0",
"false",
DateUtil.convertDateToString(DateTime.now()),
"0",
"0",
transactionID: transID,
fileNumber: appState.getAuthenticatedUser()!.patientId.toString(),
amount: widget.totalAmount.toString(),
orderDescription: "Ancillary Order Payment",
onSucceeded: (paymentResult) async {
print("Payment Success Data: ${paymentResult.toString()}");
LoaderBottomSheet.showLoader(loadingText: LocaleKeys.checkingPaymentStatusPleaseWait.tr(context: context));

Loading…
Cancel
Save