# Server: Advanced Pricing exports

> Reference for Server: Advanced Pricing exports in mechanicjob.

[All exports](/docs/jobs/mechanicjob/reference/exports)

This page documents supported public integration calls and usage examples. It does not expose or reproduce the resource's internal implementation.

## Server Exports

All Advanced Pricing and Billing exports return a result table:

```lua
{
    success = true,
    data = {}
}
```

Rejected requests return `success = false` and a stable `error` code. Player identity, mechanic job, grade, permissions, vehicle distance, configured limits, quote state, invoice ownership, and monetary values are always resolved or validated on the server.

### Advanced Pricing exports

<table>
<thead>
  <tr>
    <th>
      Export
    </th>
    
    <th>
      Arguments
    </th>
    
    <th>
      Purpose
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        CreatePricingQuote
      </code>
    </td>
    
    <td>
      <code>
        source, payload
      </code>
    </td>
    
    <td>
      Calculates a fresh server-authoritative quote for a nearby vehicle and configured tuning options
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        GetPricingQuote
      </code>
    </td>
    
    <td>
      <code>
        source, orderId
      </code>
    </td>
    
    <td>
      Returns the saved quote data for an accessible workshop order
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        ValidatePricingQuote
      </code>
    </td>
    
    <td>
      <code>
        source, orderId, vehicleNetId
      </code>
    </td>
    
    <td>
      Validates order state, expiry, proximity, procurement state, and quoted vehicle model
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        GetSupplierCatalog
      </code>
    </td>
    
    <td>
      <code>
        source
      </code>
    </td>
    
    <td>
      Returns the authorized mechanic's current Dynasty catalog with server-calculated supplier prices
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        GetPricingAnalytics
      </code>
    </td>
    
    <td>
      <code>
        source, periodDays?
      </code>
    </td>
    
    <td>
      Returns workshop pricing analytics when the mechanic has billing-management permission
    </td>
  </tr>
</tbody>
</table>

#### `CreatePricingQuote(source, payload)`

The caller supplies only the requested vehicle and tuning option identifiers. Client or integration values for vehicle price, supplier cost, labor, margin, tax, discount, grade, society, or final price are not accepted as authoritative.

```lua [server.lua]
local result = exports["sky_mechanicjob"]:CreatePricingQuote(source, {
    vehicleNetId = NetworkGetNetworkIdFromEntity(vehicle),
    vehicleClass = 7,
    parts = {
        { id = "mod_11", value = 2 },
        { id = "mod_23", value = 4, wheelType = 7 }
    }
})

if result.success then
    print(("Server quote: $%s"):format(result.data.amount))
end
```

`vehicleClass` is only used as a validated compatibility fallback when the current server artifact cannot resolve the class from the networked vehicle. The server still validates the entity and the player's distance.

#### Reading and validating an order quote

```lua [server.lua]
local quote = exports["sky_mechanicjob"]:GetPricingQuote(source, order_id)
if not quote.success then return end

local validation = exports["sky_mechanicjob"]:ValidatePricingQuote(
    source,
    order_id,
    vehicle_net_id
)

if validation.success then
    print("The quote is valid for this vehicle")
end
```

Only a mechanic belonging to the order's workshop can read or validate its quote.

#### Supplier catalog and analytics

```lua [server.lua]
local catalog = exports["sky_mechanicjob"]:GetSupplierCatalog(source)
local analytics = exports["sky_mechanicjob"]:GetPricingAnalytics(source, 30)
```

The supplier catalog requires Parts Delivery access. Pricing analytics additionally require the billing-management permission and never accept a job name from the caller.
