@ -34,19 +34,19 @@ class EROnlineCheckInPaymentDetails extends StatefulWidget {
bool isERBookAppointment = false ;
String projectName = " " ;
EROnlineCheckInPaymentDetails ( { @ required this . projectID , @ required this . isERBookAppointment , @ required this . projectName } ) ;
EROnlineCheckInPaymentDetails ( { required this . projectID , required this . isERBookAppointment , required this . projectName } ) ;
@ override
State < EROnlineCheckInPaymentDetails > createState ( ) = > _EROnlineCheckInPaymentDetailsState ( ) ;
}
class _EROnlineCheckInPaymentDetailsState extends State < EROnlineCheckInPaymentDetails > with SingleTickerProviderStateMixin {
ProjectViewModel projectViewModel ;
EROnlineCheckInPaymentDetailsResponse erOnlineCheckInPaymentDetailsResponse ;
String selectedPaymentMethod ;
String selectedInstallmentPlan ;
late ProjectViewModel projectViewModel ;
EROnlineCheckInPaymentDetailsResponse ? erOnlineCheckInPaymentDetailsResponse ;
String ? selectedPaymentMethod ;
String ? selectedInstallmentPlan ;
String transID = " " ;
MyInAppBrowser browser ;
late MyInAppBrowser browser ;
@ override
void initState ( ) {
@ -109,7 +109,7 @@ class _EROnlineCheckInPaymentDetailsState extends State<EROnlineCheckInPaymentDe
) ,
mWidth ( 3 ) ,
Text (
projectViewModel . user . firstName + " " + projectViewModel . user . lastName ,
projectViewModel . user . firstName ! + " " + projectViewModel . user . lastName ! ,
style: TextStyle (
fontWeight: FontWeight . w600 ,
fontSize: 14 ,
@ -278,7 +278,7 @@ class _EROnlineCheckInPaymentDetailsState extends State<EROnlineCheckInPaymentDe
width: MediaQuery . of ( context ) . size . width * 0.75 ,
child: getPaymentMethods ( ) ,
) ,
_amountView ( TranslationBase . of ( context ) . patientShareTotalToDo , erOnlineCheckInPaymentDetailsResponse . patientShareWithTax . toString ( ) + " " + TranslationBase . of ( context ) . sar ,
_amountView ( TranslationBase . of ( context ) . patientShareTotalToDo , erOnlineCheckInPaymentDetailsResponse ! . patientShareWithTax . toString ( ) + " " + TranslationBase . of ( context ) . sar ,
isBold: true , isTotal: true ) ,
SizedBox ( height: 12 ) ,
DefaultButton (
@ -300,7 +300,7 @@ class _EROnlineCheckInPaymentDetailsState extends State<EROnlineCheckInPaymentDe
showDraggableDialog (
context ,
PaymentMethod (
onSelectedMethod: ( String method , [ String selectedInstallmentPlan ] ) {
onSelectedMethod: ( String method , [ String ? selectedInstallmentPlan ] ) {
selectedPaymentMethod = method ;
this . selectedInstallmentPlan = selectedInstallmentPlan ;
if ( selectedPaymentMethod = = " ApplePay " ) {
@ -309,25 +309,25 @@ class _EROnlineCheckInPaymentDetailsState extends State<EROnlineCheckInPaymentDe
} else {
AppoitmentAllHistoryResultList appo = new AppoitmentAllHistoryResultList ( ) ;
appo . projectID = widget . projectID ;
openPayment ( selectedPaymentMethod , projectViewModel . user , erOnlineCheckInPaymentDetailsResponse . patientShareWithTax , null ) ;
openPayment ( selectedPaymentMethod ! , projectViewModel . user , erOnlineCheckInPaymentDetailsResponse ! . patientShareWithTax ! , AppoitmentAllHistoryResultList ( ) ) ;
}
} else {
openPayment ( selectedPaymentMethod , projectViewModel . user , erOnlineCheckInPaymentDetailsResponse . patientShareWithTax , null ) ;
openPayment ( selectedPaymentMethod ! , projectViewModel . user , erOnlineCheckInPaymentDetailsResponse ! . patientShareWithTax ! , AppoitmentAllHistoryResultList ( ) ) ;
}
} ,
patientShare: erOnlineCheckInPaymentDetailsResponse . patientShareWithTax ,
patientShare: erOnlineCheckInPaymentDetailsResponse ! . patientShareWithTax ,
isFromAdvancePayment: false ,
) ,
) ;
}
openPayment ( String paymentMethod , AuthenticatedUser authenticatedUser , num amount , AppoitmentAllHistoryResultList appo ) {
transID = Utils . getAdvancePaymentTransID ( widget . projectID , projectViewModel . user . patientID ) ;
transID = Utils . getAdvancePaymentTransID ( widget . projectID , projectViewModel . user . patientID ! ) ;
browser = new MyInAppBrowser ( onExitCallback: onBrowserExit , appo: appo , onLoadStartCallback: onBrowserLoadStart ) ;
browser . openPaymentBrowser ( amount , " ER Online Check-In Payment " , transID , widget . projectID . toString ( ) , authenticatedUser . emailAddress , paymentMethod , authenticatedUser . patientType ,
authenticatedUser . firstName , authenticatedUser . patientID , authenticatedUser , browser , false , " 3 " , " " , null ) ;
browser . openPaymentBrowser ( amount , " ER Online Check-In Payment " , transID , widget . projectID . toString ( ) , authenticatedUser . emailAddress ! , paymentMethod , authenticatedUser . patientType ,
authenticatedUser . firstName ! , authenticatedUser . patientID , authenticatedUser , browser , false , " 3 " , " " , context ) ;
}
onBrowserLoadStart ( String url ) {
@ -357,7 +357,7 @@ class _EROnlineCheckInPaymentDetailsState extends State<EROnlineCheckInPaymentDe
}
void startApplePay ( ) async {
transID = Utils . getAdvancePaymentTransID ( widget . projectID , projectViewModel . user . patientID ) ;
transID = Utils . getAdvancePaymentTransID ( widget . projectID , projectViewModel . user . patientID ! ) ;
print ( " TransactionID: $ transID " ) ;
GifLoaderDialogUtils . showMyDialog ( context ) ;
@ -365,9 +365,9 @@ class _EROnlineCheckInPaymentDetailsState extends State<EROnlineCheckInPaymentDe
LiveCareService service = new LiveCareService ( ) ;
ApplePayInsertRequest applePayInsertRequest = new ApplePayInsertRequest ( ) ;
PayfortProjectDetailsRespModel payfortProjectDetailsRespModel ;
PayfortProjectDetailsRespModel ? payfortProjectDetailsRespModel ;
await context . read < PayfortViewModel > ( ) . getProjectDetailsForPayfort ( projectId: widget . projectID , serviceId: ServiceTypeEnum . appointmentPayment . getIdFromServiceEnum ( ) ) . then ( ( value ) {
payfortProjectDetailsRespModel = value ;
payfortProjectDetailsRespModel = value ! ;
} ) ;
applePayInsertRequest . clientRequestID = transID ;
@ -376,7 +376,7 @@ class _EROnlineCheckInPaymentDetailsState extends State<EROnlineCheckInPaymentDe
/ / applePayInsertRequest . customerEmail = projectViewModel . authenticatedUserObject . user . emailAddress ;
applePayInsertRequest . customerEmail = " CustID_ ${ projectViewModel . user . patientID } @HMG.com " ;
applePayInsertRequest . customerID = projectViewModel . user . patientID ;
applePayInsertRequest . customerName = projectViewModel . user . firstName + " " + projectViewModel . user . lastName ;
applePayInsertRequest . customerName = projectViewModel . user . firstName ! + " " + projectViewModel . user . lastName ! ;
applePayInsertRequest . deviceToken = await AppSharedPreferences ( ) . getString ( PUSH_TOKEN ) ;
applePayInsertRequest . voipToken = await AppSharedPreferences ( ) . getString ( ONESIGNAL_APNS_TOKEN ) ;
applePayInsertRequest . doctorID = 0 ;
@ -392,7 +392,7 @@ class _EROnlineCheckInPaymentDetailsState extends State<EROnlineCheckInPaymentDe
applePayInsertRequest . liveServiceID = " 0 " ;
applePayInsertRequest . latitude = " 0.0 " ;
applePayInsertRequest . longitude = " 0.0 " ;
applePayInsertRequest . amount = erOnlineCheckInPaymentDetailsResponse . patientShareWithTax . toString ( ) ;
applePayInsertRequest . amount = erOnlineCheckInPaymentDetailsResponse ! . patientShareWithTax . toString ( ) ;
applePayInsertRequest . isSchedule = " 0 " ;
applePayInsertRequest . language = projectViewModel . isArabic ? ' ar ' : ' en ' ;
applePayInsertRequest . languageID = projectViewModel . isArabic ? 1 : 2 ;
@ -403,22 +403,22 @@ class _EROnlineCheckInPaymentDetailsState extends State<EROnlineCheckInPaymentDe
applePayInsertRequest . isMobSDK = true ;
applePayInsertRequest . merchantReference = transID ;
applePayInsertRequest . merchantIdentifier = payfortProjectDetailsRespModel . merchantIdentifier ;
applePayInsertRequest . merchantIdentifier = payfortProjectDetailsRespModel ! . merchantIdentifier ;
applePayInsertRequest . commandType = " PURCHASE " ;
applePayInsertRequest . signature = payfortProjectDetailsRespModel . signature ;
applePayInsertRequest . accessCode = payfortProjectDetailsRespModel . accessCode ;
applePayInsertRequest . shaRequestPhrase = payfortProjectDetailsRespModel . shaRequest ;
applePayInsertRequest . shaResponsePhrase = payfortProjectDetailsRespModel . shaResponse ;
applePayInsertRequest . signature = payfortProjectDetailsRespModel ! . signature ;
applePayInsertRequest . accessCode = payfortProjectDetailsRespModel ! . accessCode ;
applePayInsertRequest . shaRequestPhrase = payfortProjectDetailsRespModel ! . shaRequest ;
applePayInsertRequest . shaResponsePhrase = payfortProjectDetailsRespModel ! . shaResponse ;
applePayInsertRequest . returnURL = " " ;
service . applePayInsertRequest ( applePayInsertRequest , context ) . then ( ( res ) async {
if ( res [ " MessageStatus " ] = = 1 ) {
await context . read < PayfortViewModel > ( ) . initiateApplePayWithPayfort (
customerName: projectViewModel . user . firstName + " " + projectViewModel . user . lastName ,
customerName: projectViewModel . user . firstName ! + " " + projectViewModel . user . lastName ! ,
/ / customerEmail: projectViewModel . authenticatedUserObject . user . emailAddress ,
customerEmail: " CustID_ ${ projectViewModel . user . patientID } @HMG.com " ,
orderDescription: " ER Online Check-In Payment " ,
orderAmount: erOnlineCheckInPaymentDetailsResponse . patientShareWithTax ,
orderAmount: erOnlineCheckInPaymentDetailsResponse ! . patientShareWithTax ,
merchantReference: transID ,
payfortProjectDetailsRespModel: payfortProjectDetailsRespModel ,
currency: projectViewModel . user . outSA = = 1 ? " AED " : " SAR " ,
@ -428,7 +428,7 @@ class _EROnlineCheckInPaymentDetailsState extends State<EROnlineCheckInPaymentDe
} ,
onSuccess: ( successResult ) async {
log ( " Payfort: ${ successResult . responseMessage } " ) ;
await context . read < PayfortViewModel > ( ) . addPayfortApplePayResponse ( projectViewModel . user . patientID , result: successResult ) ;
await context . read < PayfortViewModel > ( ) . addPayfortApplePayResponse ( projectViewModel . user . patientID ! , result: successResult ) ;
GifLoaderDialogUtils . hideDialog ( context ) ;
checkPaymentStatus ( AppoitmentAllHistoryResultList ( ) ) ;
} ,
@ -497,7 +497,7 @@ class _EROnlineCheckInPaymentDetailsState extends State<EROnlineCheckInPaymentDe
DoctorsListService service = new DoctorsListService ( ) ;
String paymentReference = paymentRes [ ' Fort_id ' ] . toString ( ) ;
service . HIS_createAdvancePayment ( appo , widget . projectID . toString ( ) , paymentRes [ ' Amount ' ] , paymentRes [ ' Fort_id ' ] , paymentRes [ ' PaymentMethod ' ] , projectViewModel . user . patientType ,
projectViewModel . user . firstName + " " + projectViewModel . user . lastName , projectViewModel . user . patientID , context )
projectViewModel . user . firstName ! + " " + projectViewModel . user . lastName ! , projectViewModel . user . patientID , context )
. then ( ( res ) {
addAdvancedNumberRequest (
Utils . isVidaPlusProject ( projectViewModel , widget . projectID )