diff --git a/PEC_WindowsServiceSetup/InstallUtil.InstallLog b/PEC_WindowsServiceSetup/InstallUtil.InstallLog index 12de83e..baf1742 100644 --- a/PEC_WindowsServiceSetup/InstallUtil.InstallLog +++ b/PEC_WindowsServiceSetup/InstallUtil.InstallLog @@ -103,3 +103,29 @@ The file is located at C:\Users\mehran\Desktop\PEC_WindowsServiceSetup\Pec-PCPOS The Commit phase completed successfully. The transacted install has completed. + +Running a transacted installation. + +Beginning the Install phase of the installation. +See the contents of the log file for the C:\HamekaraPosBridge\PEC_WindowsServiceSetup\Pec-PCPOS-WindowsService.exe assembly's progress. +The file is located at C:\HamekaraPosBridge\PEC_WindowsServiceSetup\Pec-PCPOS-WindowsService.InstallLog. + +An exception occurred during the Install phase. +System.InvalidOperationException: An exception occurred in the OnAfterInstall event handler of System.ServiceProcess.ServiceInstaller. +The inner exception System.InvalidOperationException was thrown with the following error message: Cannot start service PecPcposService on computer '.'.. +The inner exception System.ComponentModel.Win32Exception was thrown with the following error message: The system cannot find the file specified. + +The Rollback phase of the installation is beginning. +See the contents of the log file for the C:\HamekaraPosBridge\PEC_WindowsServiceSetup\Pec-PCPOS-WindowsService.exe assembly's progress. +The file is located at C:\HamekaraPosBridge\PEC_WindowsServiceSetup\Pec-PCPOS-WindowsService.InstallLog. + +The Rollback phase completed successfully. + +The transacted install has completed. + + +The uninstall is beginning. +See the contents of the log file for the C:\HamekaraPosBridge\PEC_WindowsServiceSetup\Pec-PCPOS-WindowsService.exe assembly's progress. +The file is located at C:\HamekaraPosBridge\PEC_WindowsServiceSetup\Pec-PCPOS-WindowsService.InstallLog. + +The uninstall has completed. diff --git a/PEC_WindowsServiceSetup/Pec-PCPOS-WindowsService.InstallLog b/PEC_WindowsServiceSetup/Pec-PCPOS-WindowsService.InstallLog index 6c1b287..9620bec 100644 --- a/PEC_WindowsServiceSetup/Pec-PCPOS-WindowsService.InstallLog +++ b/PEC_WindowsServiceSetup/Pec-PCPOS-WindowsService.InstallLog @@ -116,3 +116,31 @@ Affected parameters are: logfile = C:\Users\mehran\Desktop\PEC_WindowsServiceSetup\Pec-PCPOS-WindowsService.InstallLog assemblypath = C:\Users\mehran\Desktop\PEC_WindowsServiceSetup\Pec-PCPOS-WindowsService.exe logtoconsole = +Installing assembly 'C:\HamekaraPosBridge\PEC_WindowsServiceSetup\Pec-PCPOS-WindowsService.exe'. +Affected parameters are: + i = + logfile = C:\HamekaraPosBridge\PEC_WindowsServiceSetup\Pec-PCPOS-WindowsService.InstallLog + assemblypath = C:\HamekaraPosBridge\PEC_WindowsServiceSetup\Pec-PCPOS-WindowsService.exe + logtoconsole = +Installing service PecPcposService... +Creating EventLog source PecPcposService in log Application... +An exception occurred in the OnAfterInstall event handler of System.ServiceProcess.ServiceInstaller. +System.InvalidOperationException: Cannot start service PecPcposService on computer '.'. +The inner exception System.ComponentModel.Win32Exception was thrown with the following error message: The system cannot find the file specified. +Rolling back assembly 'C:\HamekaraPosBridge\PEC_WindowsServiceSetup\Pec-PCPOS-WindowsService.exe'. +Affected parameters are: + i = + logfile = C:\HamekaraPosBridge\PEC_WindowsServiceSetup\Pec-PCPOS-WindowsService.InstallLog + assemblypath = C:\HamekaraPosBridge\PEC_WindowsServiceSetup\Pec-PCPOS-WindowsService.exe + logtoconsole = +Restoring event log to previous state for source PecPcposService. +Uninstalling assembly 'C:\HamekaraPosBridge\PEC_WindowsServiceSetup\Pec-PCPOS-WindowsService.exe'. +Affected parameters are: + logtoconsole = + logfile = C:\HamekaraPosBridge\PEC_WindowsServiceSetup\Pec-PCPOS-WindowsService.InstallLog + assemblypath = C:\HamekaraPosBridge\PEC_WindowsServiceSetup\Pec-PCPOS-WindowsService.exe +An exception occurred in the OnBeforeUninstall event handler of System.ServiceProcess.ServiceInstaller. +System.InvalidOperationException: Cannot stop PecPcposService service on computer '.'. +The inner exception System.ComponentModel.Win32Exception was thrown with the following error message: The service has not been started. +An exception occurred while uninstalling. This exception will be ignored and the uninstall will continue. However, the application might not be fully uninstalled after the uninstall is complete. +Removing EventLog source PecPcposService. diff --git a/PEC_WindowsServiceSetup/Pec-PCPOS-WindowsService.InstallState b/PEC_WindowsServiceSetup/Pec-PCPOS-WindowsService.InstallState deleted file mode 100644 index d0d1367..0000000 --- a/PEC_WindowsServiceSetup/Pec-PCPOS-WindowsService.InstallState +++ /dev/null @@ -1 +0,0 @@ -0.7223_reserved_nestedSavedStates_reserved_lastInstallerAttempted0.72230.7247AccountLocalSystem-10.7247installedtrue0.7267logExistsalreadyRegisteredbaseInstalledAndPlatformOKtrue-1falsetrue010 \ No newline at end of file diff --git a/posbridge.log b/posbridge.log index 09d392d..0e31981 100644 --- a/posbridge.log +++ b/posbridge.log @@ -208,3 +208,591 @@ POS bridge on http://localhost:9090 Using POS 192.168.100.90:2020 ReqDir: C:\Users\Public\PEC_PCPOS\request ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.90:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +[SALE] amount=110000 invoice=1769871089572 -> 192.168.100.90:2020 +[SALE] ERROR: POS timeout +[SALE] amount=110000 invoice=1769871261817 -> 192.168.100.90:2020 +[SALE] ERROR: POS timeout +POS bridge on http://localhost:9090 +Using POS 192.168.100.153:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.153:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.153:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.153:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.153:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.153:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.153:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response +POS bridge on http://localhost:9090 +Using POS 192.168.100.153:2020 +ReqDir: C:\Users\Public\PEC_PCPOS\request +ResDir: C:\Users\Public\PEC_PCPOS\response diff --git a/server.js b/server.js index 2530312..eb9247a 100644 --- a/server.js +++ b/server.js @@ -134,7 +134,7 @@ function safeCleanup(filePath) { // Core POS Ops (via PEC file-drop) // ----------------------------- -async function doSale(amountRial, invoice, timeoutMs = SALE_TIMEOUT_MS) { +async function doSale(amountRial, invoice, timeoutMs = SALE_TIMEOUT_MS , posIp=POS_IP) { if (!fs.existsSync(REQ_DIR) || !fs.existsSync(RES_DIR)) { throw new Error('POS folders not found. Ensure PEC_PCPOS Windows component is installed and running.'); } @@ -143,10 +143,12 @@ async function doSale(amountRial, invoice, timeoutMs = SALE_TIMEOUT_MS) { const reqFile = path.join(REQ_DIR, `${tag}.txt`); const resFile = path.join(RES_DIR, `${tag}.txt`); + const ipToUse = (typeof posIp === 'string' && posIp.trim()) ? posIp.trim() : POS_IP; + // Build request payload (keys expected by your PEC build) const payloadLines = [ 'TYPE=LAN', - `IP=${POS_IP}`, + `IP=${ipToUse}`, `PORT=${POS_PORT}`, 'OP=SALE', `AMOUNT=${amountRial}`, @@ -250,6 +252,27 @@ app.get('/pos/health', (req, res) => { }); }); +function isValidIPv4(ip) { + if (typeof ip !== 'string') return false; + const s = ip.trim(); + if (!s) return false; + + const parts = s.split('.'); + if (parts.length !== 4) return false; + + for (const p of parts) { + // only digits + if (!/^\d+$/.test(p)) return false; + // no empty, 0-255 + const n = Number(p); + if (n < 0 || n > 255) return false; + // prevent "01" etc. (optional but usually desirable) + if (p.length > 1 && p[0] === '0') return false; + } + return true; +} + + // SALE endpoint app.post('/pos/sale', async (req, res) => { await lock(); @@ -263,8 +286,20 @@ app.post('/pos/sale', async (req, res) => { return res.status(422).json({ ok: false, code: 'INVALID', message: 'Invalid amount' }); } - console.log(`[SALE] amount=${amount} invoice=${invoice} -> ${POS_IP}:${POS_PORT}`); - const result = await doSale(amount, invoice); + const posIpRaw = String(req.body.pos_ip ?? '').trim(); + const posIp = posIpRaw || null; + + if (posIp && !isValidIPv4(posIp)) { + return res.status(422).json({ + ok: false, + code: 'INVALID_IP', + message: 'Invalid posIp (must be IPv4, e.g. 192.168.1.50)' + }); + } + + + console.log(`[SALE] amount=${amount} invoice=${invoice} -> ${posIp}:${POS_PORT}`); + const result = await doSale(amount, invoice, SALE_TIMEOUT_MS, posIp); const ms = Date.now() - startedAt; console.log(`[SALE] done in ${ms}ms ok=${result.ok} code=${result.code} rrn=${result.rrn || '-'} trace=${result.traceNo || '-'}`); res.json(result);