diff --git a/layout.xaml b/layout.xaml
index 2561ded..a677bca 100644
--- a/layout.xaml
+++ b/layout.xaml
@@ -110,15 +110,33 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
diff --git a/main.ps1 b/main.ps1
index 8d2a4f2..0f4e9d1 100644
--- a/main.ps1
+++ b/main.ps1
@@ -17,6 +17,7 @@ Write-Host "[INFO] MSAL.PS module loaded."
$urls = @{
autotask = "https://git.svstools.com/cpayne/InstaClientPS/raw/branch/main/tools/autotask.ps1"
datto = "https://git.svstools.com/cpayne/InstaClientPS/raw/branch/main/tools/dattormm.ps1"
+ pax8 = "https://git.svstools.com/cpayne/InstaClientPS/raw/branch/main/tools/pax8.ps1"
config = "https://git.svstools.com/cpayne/InstaClientPS/raw/branch/main/config.ps1"
}
@@ -59,21 +60,34 @@ Add-Type -AssemblyName WindowsBase
Add-Type -AssemblyName System.Xaml
# Map named UI controls
-$CompanyNameBox = $window.FindName("CompanyNameBox")
-$PhoneBox = $window.FindName("PhoneBox")
-$SelectAllBox = $window.FindName("SelectAllBox")
-$AutotaskBox = $window.FindName("AutotaskBox")
-$DattoBox = $window.FindName("DattoBox")
-$BackupBox = $window.FindName("BackupBox")
-$ITGlueBox = $window.FindName("ITGlueBox")
-$RocketcyberBox = $window.FindName("RocketcyberBox")
-$CyberQPBox = $window.FindName("CyberQPBox")
-$Pax8Box = $window.FindName("Pax8Box")
-$LoginBtn = $window.FindName("LoginBtn")
-$SubmitBtn = $window.FindName("SubmitBtn")
-$StatusBlock = $window.FindName("StatusBlock")
-$phoneLabel = $window.FindName("PhoneLabel")
-$companyLabel = $window.FindName("CompanyLabel")
+$CompanyNameBox = $window.FindName("CompanyNameBox")
+$PhoneBox = $window.FindName("PhoneBox")
+$SelectAllBox = $window.FindName("SelectAllBox")
+$AutotaskBox = $window.FindName("AutotaskBox")
+$DattoBox = $window.FindName("DattoBox")
+$BackupBox = $window.FindName("BackupBox")
+$ITGlueBox = $window.FindName("ITGlueBox")
+$RocketcyberBox = $window.FindName("RocketcyberBox")
+$CyberQPBox = $window.FindName("CyberQPBox")
+$Pax8Box = $window.FindName("Pax8Box")
+$LoginBtn = $window.FindName("LoginBtn")
+$SubmitBtn = $window.FindName("SubmitBtn")
+$StatusBlock = $window.FindName("StatusBlock")
+$phoneLabel = $window.FindName("PhoneLabel")
+$companyLabel = $window.FindName("CompanyLabel")
+$websiteBox = $window.FindName("WebsiteBox")
+$streetBox = $window.FindName("StreetBox")
+$cityBox = $window.FindName("CityBox")
+$provinceBox = $window.FindName("ProvinceBox")
+$postalCodeBox = $window.FindName("PostalCodeBox")
+$countryBox = $window.FindName("CountyBox")
+$websiteLabel = $window.FindName("WebsiteLabel")
+$streetLabel = $window.FindName("StreetLabel")
+$cityLabel = $window.FindName("CityLabel")
+$provinceLabel = $window.FindName("ProvinceLabel")
+$postalCodeLabel = $window.FindName("PostalCodeLabel")
+$countryLabel = $window.FindName("CountyLabel")
+
$PhoneBox.Visibility = 'Collapsed'
$phoneLabel.Visibility = 'Collapsed'
@@ -88,22 +102,68 @@ $Pax8Box.Visibility = 'Collapsed'
$SelectAllBox.Visibility = 'Collapsed'
$CompanyNameBox.Visibility = 'Collapsed'
$companyLabel.Visibility = 'Collapsed'
+$websiteBox.Visibility = 'Collapsed'
+$websiteLabel.Visibility = 'Collapsed'
+$streetBox.Visibility = 'Collapsed'
+$streetLabel.Visibility = 'Collapsed'
+$cityBox.Visibility = 'Collapsed'
+$cityLabel.Visibility = 'Collapsed'
+$provinceBox.Visibility = 'Collapsed'
+$provinceLabel.Visibility = 'Collapsed'
+$postalCodeBox.Visibility = 'Collapsed'
+$postalCodeLabel.Visibility = 'Collapsed'
+$countryBox.Visibility = 'Collapsed'
+$countryLabel.Visibility = 'Collapsed'
$BackupBox.IsEnabled = $false
$ITGlueBox.IsEnabled = $false
$RocketcyberBox.IsEnabled = $false
$CyberQPBox.IsEnabled = $false
-$Pax8Box.IsEnabled = $false
$AutotaskBox.Add_Checked({
$PhoneBox.Visibility = 'Visible'
$phoneLabel.Visibility = 'Visible'
})
+
$AutotaskBox.Add_Unchecked({
$PhoneBox.Visibility = 'Collapsed'
$phoneLabel.Visibility = 'Collapsed'
})
+$Pax8Box.Add_Checked({
+ $PhoneBox.Visibility = 'Visible'
+ $phoneLabel.Visibility = 'Visible'
+ $websiteBox.Visibility = 'Visible'
+ $websiteLabel.Visibility = 'Visible'
+ $streetBox.Visibility = 'Visible'
+ $streetLabel.Visibility = 'Visible'
+ $cityBox.Visibility = 'Visible'
+ $cityLabel.Visibility = 'Visible'
+ $provinceBox.Visibility = 'Visible'
+ $provinceLabel.Visibility = 'Visible'
+ $postalCodeBox.Visibility = 'Visible'
+ $postalCodeLabel.Visibility = 'Visible'
+ $countryBox.Visibility = 'Visible'
+ $countryLabel.Visibility = 'Visible'
+})
+
+$Pax8Box.Add_Unchecked({
+ $PhoneBox.Visibility = 'Collapsed'
+ $phoneLabel.Visibility = 'Collapsed'
+ $websiteBox.Visibility = 'Collapsed'
+ $websiteLabel.Visibility = 'Collapsed'
+ $streetBox.Visibility = 'Collapsed'
+ $streetLabel.Visibility = 'Collapsed'
+ $cityBox.Visibility = 'Collapsed'
+ $cityLabel.Visibility = 'Collapsed'
+ $provinceBox.Visibility = 'Collapsed'
+ $provinceLabel.Visibility = 'Collapsed'
+ $postalCodeBox.Visibility = 'Collapsed'
+ $postalCodeLabel.Visibility = 'Collapsed'
+ $countryBox.Visibility = 'Collapsed'
+ $countryLabel.Visibility = 'Collapsed'
+})
+
Write-Host "[INFO] UI control references assigned."
# Global tool credentials
@@ -223,6 +283,11 @@ $SubmitBtn.Add_Click({
Invoke-DattoProvision -CompanyName $company -Credentials $script:toolCredentials
}
+ if ($Pax8Box.IsChecked) {
+ Write-Host "[INFO] Provisioning Pax8..."
+ Invoke-Pax8Provision -CompanyName $company -Phone $phone -Website $WebsiteBox.Text.Trim() -Street $StreetBox.Text.Trim() -City $CityBox.Text.Trim() -Province $ProvinceBox.Text.Trim() -PostalCode $PostalCodeBox.Text.Trim() -Country $CountryBox.Text.Trim() -Credentials $script:toolCredentials
+ }
+
$StatusBlock.Text = "Provisioning completed successfully."
Write-Host "[SUCCESS] Provisioning complete."
$CompanyNameBox.Text = ""
diff --git a/tools/pax8.ps1 b/tools/pax8.ps1
new file mode 100644
index 0000000..6eb8e2d
--- /dev/null
+++ b/tools/pax8.ps1
@@ -0,0 +1,87 @@
+# pax8.ps1
+
+param (
+ [Parameter(Mandatory = $true)][string]$CompanyName,
+ [Parameter(Mandatory = $true)][string]$Phone,
+ [Parameter(Mandatory = $true)][string]$Website,
+ [Parameter(Mandatory = $true)][string]$Street,
+ [Parameter(Mandatory = $true)][string]$City,
+ [Parameter(Mandatory = $true)][string]$Province,
+ [Parameter(Mandatory = $true)][string]$PostalCode,
+ [Parameter(Mandatory = $true)][string]$Country,
+ [Parameter(Mandatory = $true)][hashtable]$Credentials
+)
+
+function Get-Pax8AccessToken {
+ param (
+ [string]$ClientId,
+ [string]$ClientSecret
+ )
+
+ $body = @{
+ client_id = $ClientId
+ client_secret = $ClientSecret
+ audience = "https://api.pax8.com"
+ grant_type = "client_credentials"
+ } | ConvertTo-Json
+
+ try {
+ $response = Invoke-RestMethod -Method Post -Uri "https://api.pax8.com/v1/token" -ContentType "application/json" -Body $body
+ return $response.access_token
+ } catch {
+ throw "Failed to obtain Pax8 access token: $($_.Exception.Message)"
+ }
+}
+
+function Invoke-Pax8Provision {
+ param (
+ [string]$CompanyName,
+ [string]$Phone,
+ [string]$Website,
+ [string]$Street,
+ [string]$City,
+ [string]$Province,
+ [string]$PostalCode,
+ [string]$Country,
+ [hashtable]$Credentials
+ )
+
+ $clientId = $Credentials.Pax8Client
+ $clientSecret = $Credentials.Pax8Secret
+
+ if (-not $clientId -or -not $clientSecret) {
+ throw "Missing Pax8 credentials."
+ }
+
+ $accessToken = Get-Pax8AccessToken -ClientId $clientId -ClientSecret $clientSecret
+
+ $companyPayload = @{
+ name = $CompanyName
+ phone = $Phone
+ website = $Website
+ externalId = ""
+ billOnBehalfOfEnabled = $true
+ selfServiceAllowed = $true
+ orderApprovalRequired = $false
+ address = @{
+ street = $Street
+ city = $City
+ stateOrProvince = $Province
+ postalCode = $PostalCode
+ country = $Country
+ }
+ } | ConvertTo-Json -Depth 3
+
+ try {
+ $response = Invoke-RestMethod -Method Post -Uri "https://api.pax8.com/v1/companies" `
+ -Headers @{ Authorization = "Bearer $accessToken" } `
+ -ContentType "application/json" -Body $companyPayload
+
+ Write-Host "[PAX8] Company provisioned successfully: $($response.id)"
+ } catch {
+ throw "[PAX8] Company creation failed: $($_.Exception.Message)"
+ }
+}
+
+# Entrypoint if sourced
+Invoke-Pax8Provision -CompanyName $CompanyName -Phone $Phone -Website $Website -Street $Street -City $City -Province $Province -PostalCode $PostalCode -Country $Country -Credentials $Credentials
\ No newline at end of file