telco

Open-access provisioning

Follow a carrier's S/PRI new-line order through to its first wholesale bill.

On this page

The example Bitstrom tariff charges €31 net per month from the day the network operator completes the line. A requested date, an acknowledgement and a confirmed appointment each leave the line unbilled. The Desk’s Netz view shows the appointment and the first chargeable day side by side.

Connect a gateway

Configure one named carrier principal per gateway in contractd’s TELCO_API_KEYS_FILE, for example north carrier <gateway-secret>, alongside an operator credential. Serve authenticated connections over TLS. The gateway authenticates its SOAP peer and forwards the S/PRI operation body. contractd accepts up to 64 KiB of XML and validates the business message with the upstream S/PRI crate. The XML signature identifier is metadata. Sender identity comes from the bearer credential.

Walk one order

From the repository root, set CONTRACTD and BILLD to the two service URLs and export the operator and gateway keys. This example uses a fresh test estate with both test clocks enabled and a gateway named north.

set_day() {
  for service in "$CONTRACTD" "$BILLD"; do
    curl -fsS -X PUT "$service/clock" -H "Authorization: Bearer $OPERATOR_KEY" \
      -H 'Content-Type: application/json' -d "{\"today\":\"$1\"}" >/dev/null || return 1
  done
}
set_day 2027-03-01
SALE=$(curl --fail-with-body -sS "$CONTRACTD/signups" \
  -H "Authorization: Bearer $OPERATOR_KEY" -H 'Content-Type: application/json' -d '{
    "order_reference":"BITSTROM-DEMO","concluded_on":"2027-03-01",
    "customer":{"name":"Carrier GmbH","street":"Testweg 1","postcode":"12345",
                "city":"Berlin","consumer":false,"salutation":"sie"},
    "account":{"invoice_email":"rechnung@example.org","vat_id":"DE123456789","buyer_reference":"Carrier"},
    "contract":{"start":"2027-03-01","initial_months":12,"notice_months":1,
                "renews":true,"summary_before_conclusion":true},
    "subscriptions":[{"product":"Bitstrom","plan":"example-business@2026-11/bitstrom"}]
  }')
SUB=$(printf '%s' "$SALE" | jq -er '.subscriptions[0].id')
ACCOUNT=$(printf '%s' "$SALE" | jq -er '.billing_account.id')

Bind the line using the two identifiers in the simulator fixtures. The requested date is 1 March.

curl --fail-with-body "$CONTRACTD/carrier-orders" \
  -H "Authorization: Bearer $OPERATOR_KEY" -H 'Content-Type: application/json' \
  -d "{\"subscription\":\"$SUB\",\"carrier\":\"north\",\"customer_number\":\"4711\",\"reference\":\"SB-2027-0001\",\"requested_for\":\"2027-03-01\"}"

set_day 2027-03-22
for stage in qeb abm erlm; do
  curl --fail-with-body "$CONTRACTD/carrier-messages" \
    -H "Authorization: Bearer $CARRIER_KEY" -H 'Content-Type: application/xml' \
    --data-binary "@samples/spri/$stage.xml" || break
done

QEB acknowledges the order. ABM confirms 22 March. ERLM 0010 starts service on 22 March. Advance the estate’s test clocks in the Desk to seal the invoice.

set_day 2027-04-01
curl -fsS "$BILLD/billing-accounts/$ACCOUNT/bills" -H "Authorization: Bearer $OPERATOR_KEY" |
  jq '.[] | {period, net, vat, gross}'

The first March bill charges ten days at €1 net per day, or €11.90 including VAT. To try cancellation in the same estate, bind a second subscription under a different external reference, substitute that reference in samples/spri/storno.xml, then submit the file to the same endpoint. Storno voids that subscription. The two outcomes are mutually exclusive. A retry of an accepted milestone has no additional effect.

GET /carrier-orders returns up to 50 of the caller’s orders. Pass the last subscription UUID as ?before= to load the next page. An operator sees all carriers. Correlation uses the credential’s principal, the Auftraggebernummer and the external order reference. The database retains identifiers and milestones. The original XML, free text and any contact or attachment stay at the gateway.

The supported exchange is NEU/Bereitstellung with QEB 0000, ABM 0000 and ERLM 0010 or 0012. A distinct ENTM billing date, outbound order transport and provider switching are outside this exchange. The fixtures come from the upstream NEU and Storno simulators. telco-interop v0.1.3

Commission the billing handoff

Use a redacted completion supplied by the network operator for an agreed test order. Have the carrier gateway resend that completion, then check the effective date and the single prorated charge on the sealed invoice. Repeat with a cancelled test order and confirm it generates no charge. Keep the carrier order reference, invoice reference, agreed tariff and observed result with the operator. When handing the month to finance, include any later credit or supplemental issue in the month-close review.

Download Markdown