Fix pax8 script

This commit is contained in:
Chris Payne
2025-07-08 21:31:43 -04:00
parent 562a8ff33d
commit 8930c7b2bf
2 changed files with 16 additions and 18 deletions

View File

@@ -261,11 +261,12 @@ $SubmitBtn.Add_Click({
-City $city ` -City $city `
-Province $province ` -Province $province `
-PostalCode $postalCode ` -PostalCode $postalCode `
-Country "CA" ` -Country $country `
-Credentials $script:toolCredentials -Credentials $script:toolCredentials
} }
$StatusBlock.Text = "Provisioning completed successfully." $StatusBlock.Text = "Provisioning completed successfully."
Write-Host "[SUCCESS] Provisioning complete." Write-Host "[SUCCESS] Provisioning complete."

View File

@@ -28,8 +28,7 @@ function Get-Pax8AccessToken {
try { try {
$response = Invoke-RestMethod -Method Post -Uri "https://api.pax8.com/v1/token" -ContentType "application/json" -Body $body $response = Invoke-RestMethod -Method Post -Uri "https://api.pax8.com/v1/token" -ContentType "application/json" -Body $body
return $response.access_token return $response.access_token
} } catch {
catch {
throw "Failed to obtain Pax8 access token: $($_.Exception.Message)" throw "Failed to obtain Pax8 access token: $($_.Exception.Message)"
} }
} }
@@ -61,8 +60,8 @@ function Invoke-Pax8Provision {
phone = $Phone phone = $Phone
website = $Website website = $Website
externalId = "" externalId = ""
billOnBehalfOfEnabled = $false billOnBehalfOfEnabled = $true
selfServiceAllowed = $false selfServiceAllowed = $true
orderApprovalRequired = $false orderApprovalRequired = $false
address = @{ address = @{
street = $Street street = $Street
@@ -79,9 +78,7 @@ function Invoke-Pax8Provision {
-ContentType "application/json" -Body $companyPayload -ContentType "application/json" -Body $companyPayload
Write-Host "[PAX8] Company provisioned successfully: $($response.id)" Write-Host "[PAX8] Company provisioned successfully: $($response.id)"
} } catch {
catch { throw "[PAX8] Company creation failed: $($_.Exception.Message)"
Write-Host "[ERROR] Pax8 provisioning failed: $($_.Exception.Message)"
[System.Windows.MessageBox]::Show("Pax8 provisioning failed:`n$($_.Exception.Message)", "Pax8 Error")
} }
} }