6 Offer-to-Permit policy mapping
| (require commerce/permit) | package: commerce |
Server processes explicitly require commerce/permit. This module imports the published permit/issuer snapshot surface; it is not re-exported from the default facade and never accesses a signing key.
procedure
(permit-grant-policy? value) → boolean?
value : any/c
procedure
(permit-constraints-policy? value) → boolean?
value : any/c
procedure
(permit-entitlement-policy? value) → boolean?
value : any/c
procedure
(permit-policy-catalog? value) → boolean?
value : any/c
procedure
(make-permit-grant-policy [ #:products products #:product-families product-families #:edition edition #:feature-policy feature-policy #:features features #:addons addons #:capabilities capabilities]) → permit-grant-policy? products : (or/c hash? #f) = #f product-families : (or/c hash? #f) = #f edition : (or/c string? #f) = #f feature-policy : (or/c 'explicit 'published-through) = #f features : (or/c hash? #f) = #f addons : (or/c hash? #f) = #f capabilities : (or/c hash? #f) = #f
procedure
(make-permit-constraints-policy [ #:use-expires-at use-expires-at #:use-duration-months use-duration-months #:updates-through updates-through #:features-through features-through #:version-min version-min #:version-max version-max #:named-seats named-seats #:device-activations device-activations #:concurrent-seats concurrent-seats #:installation-id installation-id #:activation-required? activation-required?]) → permit-constraints-policy? use-expires-at : (or/c string? #f) = #f use-duration-months : (or/c exact-positive-integer? #f) = #f updates-through : (or/c string? #f) = #f features-through : (or/c string? #f) = #f version-min : (or/c string? #f) = #f version-max : (or/c string? #f) = #f named-seats : (or/c exact-nonnegative-integer? #f) = #f device-activations : (or/c exact-nonnegative-integer? #f) = #f concurrent-seats : (or/c exact-nonnegative-integer? #f) = #f installation-id : (or/c string? #f) = #f activation-required? : boolean? = #f
procedure
(make-permit-entitlement-policy id version #:subject-type subject-type #:grants grants [ #:constraints constraints #:withdrawal-mode withdrawal-mode]) → permit-entitlement-policy? id : string? version : exact-positive-integer? subject-type : string? grants : permit-grant-policy? constraints : permit-constraints-policy? = #f withdrawal-mode : symbol? = 'expire-at-issuance
procedure
(make-permit-policy-catalog offers policies [ #:deleted-offer-ids deleted-offer-ids]) → permit-policy-catalog? offers : hash? policies : hash? deleted-offer-ids : (listof string?) = '()
procedure
(prepare-permit-snapshot catalog intent #:issuer issuer #:credential-id credential-id #:entitlement-id entitlement-id #:issued-at issued-at [ #:previous previous #:use-expires-at use-expires-at #:paid-at paid-at]) → permit-snapshot-request? catalog : permit-policy-catalog? intent : rights-intent? issuer : string? credential-id : string? entitlement-id : string? issued-at : string? previous : (or/c hash? #f) = #f use-expires-at : (or/c string? #f) = #f paid-at : (or/c exact-positive-integer? #f) = #f
The result exposes policy id/version, action, source idempotency key, the validated complete payload, and permit-snapshot-request-payload-bytes. The payload tree and bytes are immutable copies. Those bytes are Permit’s single serialization and are the only bytes a later signer may sign. Unknown/deleted Offers, invalid policy/catalog/request data, unsupported actions, and missing or conflicting lineage raise typed exn:fail:commerce values. The optional #:use-expires-at overrides the successor’s use_expires_at: a withdrawal for a subscription order expires at the paid-through moment (cancellation at period end), and the 'renew action — a successor over the previous revision of the same lineage — requires it. No outbox mutation, lineage persistence, signing, or delivery happens in this operation.
procedure
(permit-snapshot-request? value) → boolean?
value : any/c
procedure
(permit-snapshot-request-payload-bytes request) → bytes?
request : permit-snapshot-request?
procedure
(permit-policy-for-offer catalog offer-id)
→ permit-entitlement-policy? catalog : permit-policy-catalog? offer-id : string?