diff --git a/main.ps1 b/main.ps1 index e35d942..c5ea227 100644 --- a/main.ps1 +++ b/main.ps1 @@ -261,11 +261,12 @@ $SubmitBtn.Add_Click({ -City $city ` -Province $province ` -PostalCode $postalCode ` - -Country "CA" ` + -Country $country ` -Credentials $script:toolCredentials } + $StatusBlock.Text = "Provisioning completed successfully." Write-Host "[SUCCESS] Provisioning complete." diff --git a/tools/pax8.ps1 b/tools/pax8.ps1 index 37db59a..6423cbc 100644 --- a/tools/pax8.ps1 +++ b/tools/pax8.ps1 @@ -28,8 +28,7 @@ function Get-Pax8AccessToken { try { $response = Invoke-RestMethod -Method Post -Uri "https://api.pax8.com/v1/token" -ContentType "application/json" -Body $body return $response.access_token - } - catch { + } catch { throw "Failed to obtain Pax8 access token: $($_.Exception.Message)" } } @@ -57,19 +56,19 @@ function Invoke-Pax8Provision { $accessToken = Get-Pax8AccessToken -ClientId $clientId -ClientSecret $clientSecret $companyPayload = @{ - name = $CompanyName - phone = $Phone - website = $Website - externalId = "" - billOnBehalfOfEnabled = $false - selfServiceAllowed = $false + name = $CompanyName + phone = $Phone + website = $Website + externalId = "" + billOnBehalfOfEnabled = $true + selfServiceAllowed = $true orderApprovalRequired = $false - address = @{ - street = $Street - city = $City + address = @{ + street = $Street + city = $City stateOrProvince = $Province - postalCode = $PostalCode - country = $Country + postalCode = $PostalCode + country = $Country } } | ConvertTo-Json -Depth 3 @@ -79,9 +78,7 @@ function Invoke-Pax8Provision { -ContentType "application/json" -Body $companyPayload Write-Host "[PAX8] Company provisioned successfully: $($response.id)" - } - catch { - Write-Host "[ERROR] Pax8 provisioning failed: $($_.Exception.Message)" - [System.Windows.MessageBox]::Show("Pax8 provisioning failed:`n$($_.Exception.Message)", "Pax8 Error") + } catch { + throw "[PAX8] Company creation failed: $($_.Exception.Message)" } } \ No newline at end of file