@whooshbang/contracts 2.4.0 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/contract-manifest.json +35 -32
  3. package/dist/generated/artifact-index.d.ts +34 -34
  4. package/dist/generated/artifact-index.js +35 -32
  5. package/dist/generated/artifact-index.js.map +1 -1
  6. package/dist/generated/validators-standalone.d.ts +439 -400
  7. package/dist/generated/validators-standalone.js +6840 -1621
  8. package/dist/generated/validators-standalone.js.map +1 -1
  9. package/dist/generated/validators.d.ts +4 -1
  10. package/dist/generated/validators.js +4 -1
  11. package/dist/generated/validators.js.map +1 -1
  12. package/dist/generated/whooshbang-v1.d.ts +112 -1
  13. package/dist/index.d.ts +2 -2
  14. package/dist/index.js +1 -1
  15. package/dist/index.js.map +1 -1
  16. package/fixtures/core-v1/fixture-index.json +24 -1
  17. package/fixtures/core-v1/requests/redeem-billing-promotion.json +3 -0
  18. package/fixtures/core-v1/scenarios/api-credential-invalid-indistinguishable.json +1 -1
  19. package/fixtures/core-v1/scenarios/api-credential-one-time-reveal.json +1 -1
  20. package/fixtures/core-v1/scenarios/api-credential-revocation-replay.json +1 -1
  21. package/fixtures/core-v1/scenarios/api-credential-rotation-overlap.json +1 -1
  22. package/fixtures/core-v1/scenarios/cancellation-too-late.json +1 -1
  23. package/fixtures/core-v1/scenarios/cross-organization-project.json +1 -1
  24. package/fixtures/core-v1/scenarios/cross-project-resource.json +1 -1
  25. package/fixtures/core-v1/scenarios/environment-mismatch.json +1 -1
  26. package/fixtures/core-v1/scenarios/idempotency-conflict.json +1 -1
  27. package/fixtures/core-v1/scenarios/idempotency-equivalent-replay.json +1 -1
  28. package/fixtures/core-v1/scenarios/malformed-bearer.json +1 -1
  29. package/fixtures/core-v1/scenarios/metadata-overrun.json +1 -1
  30. package/fixtures/core-v1/scenarios/missing-scope.json +1 -1
  31. package/fixtures/core-v1/scenarios/project-create-equivalent-replay.json +1 -1
  32. package/fixtures/core-v1/scenarios/project-slug-conflict.json +1 -1
  33. package/fixtures/core-v1/scenarios/provider-outcome-unknown.json +1 -1
  34. package/fixtures/core-v1/scenarios/subscription-activation-replay.json +1 -1
  35. package/fixtures/core-v1/scenarios/subscription-authorization-capability-opacity.json +1 -1
  36. package/fixtures/core-v1/scenarios/subscription-cross-connection-callback-rejected.json +1 -1
  37. package/fixtures/core-v1/scenarios/subscription-expired-replay.json +1 -1
  38. package/fixtures/core-v1/scenarios/subscription-selected-connection-replay.json +1 -1
  39. package/fixtures/core-v1/success/billing-promotion.json +14 -0
  40. package/fixtures/core-v1/success/billing-promotions.json +64 -0
  41. package/fixtures/core-v1/success/credit-purchase.json +2 -0
  42. package/fixtures/core-v1/success/subscription-change.json +7 -0
  43. package/fixtures/interaction-machine-v1/scenarios/ack-conflict.json +1 -1
  44. package/fixtures/interaction-machine-v1/scenarios/ack-cross-machine.json +1 -1
  45. package/fixtures/interaction-machine-v1/scenarios/ack-out-of-order.json +1 -1
  46. package/fixtures/interaction-machine-v1/scenarios/ack-replay.json +1 -1
  47. package/fixtures/interaction-machine-v1/scenarios/ambiguous-free-text.json +1 -1
  48. package/fixtures/interaction-machine-v1/scenarios/callback-token-opacity.json +1 -1
  49. package/fixtures/interaction-machine-v1/scenarios/credential-registration-conflict.json +1 -1
  50. package/fixtures/interaction-machine-v1/scenarios/credential-registration-replay.json +1 -1
  51. package/fixtures/interaction-machine-v1/scenarios/credential-revocation-replay.json +1 -1
  52. package/fixtures/interaction-machine-v1/scenarios/credential-rotation.json +1 -1
  53. package/fixtures/interaction-machine-v1/scenarios/first-credential-activates.json +1 -1
  54. package/fixtures/interaction-machine-v1/scenarios/interaction-duplicate.json +1 -1
  55. package/fixtures/interaction-machine-v1/scenarios/interaction-expired.json +1 -1
  56. package/fixtures/interaction-machine-v1/scenarios/interaction-mismatch.json +1 -1
  57. package/fixtures/interaction-machine-v1/scenarios/interaction-retired.json +1 -1
  58. package/fixtures/interaction-machine-v1/scenarios/interaction-stale.json +1 -1
  59. package/fixtures/interaction-machine-v1/scenarios/machine-admin-denied.json +1 -1
  60. package/fixtures/interaction-machine-v1/scenarios/machine-bound-message-create.json +1 -1
  61. package/fixtures/interaction-machine-v1/scenarios/machine-cancel-denied.json +1 -1
  62. package/fixtures/interaction-machine-v1/scenarios/machine-crash-before-ack.json +1 -1
  63. package/fixtures/interaction-machine-v1/scenarios/machine-notifier-mismatch.json +1 -1
  64. package/fixtures/interaction-machine-v1/scenarios/machine-other-message-read.json +1 -1
  65. package/fixtures/interaction-machine-v1/scenarios/machine-owned-message-read.json +1 -1
  66. package/fixtures/interaction-machine-v1/scenarios/machine-subscriber-mismatch.json +1 -1
  67. package/fixtures/interaction-machine-v1/scenarios/poll-uncommitted-cursor-rejected.json +1 -1
  68. package/fixtures/interaction-machine-v1/scenarios/project-credential-machine-endpoint-denied.json +1 -1
  69. package/fixtures/interaction-machine-v1/scenarios/quarantine-integrity-rejected.json +1 -1
  70. package/fixtures/interaction-machine-v1/scenarios/quarantine-signature-rejected.json +1 -1
  71. package/fixtures/interaction-machine-v1/scenarios/quarantine-valid.json +1 -1
  72. package/fixtures/interaction-machine-v1/scenarios/revoked-machine-credential.json +1 -1
  73. package/fixtures/recipient-experience-v1/scenarios/membership-broadcast-snapshot.json +1 -1
  74. package/fixtures/recipient-experience-v1/scenarios/preferred-binding-resolution.json +1 -1
  75. package/fixtures/recipient-experience-v1/scenarios/recipient-session-security.json +1 -1
  76. package/fixtures/recipient-experience-v1/scenarios/subscriber-initial-groups-transaction.json +1 -1
  77. package/openapi/generated/whooshbang-v1.bundle.json +386 -3
  78. package/openapi/whooshbang-v1.yaml +95 -2
  79. package/package.json +1 -1
  80. package/schemas/core-scenario.schema.json +1 -1
  81. package/schemas/events/agent-binding-degraded-v1.schema.json +1 -1
  82. package/schemas/events/interaction-expired-v1.schema.json +1 -1
  83. package/schemas/events/interaction-received-v1.schema.json +1 -1
  84. package/schemas/events/message-delivered-v1.schema.json +1 -1
  85. package/schemas/events/message-expired-v1.schema.json +1 -1
  86. package/schemas/events/message-failed-v1.schema.json +1 -1
  87. package/schemas/events/message-provider-accepted-v1.schema.json +1 -1
  88. package/schemas/events/subscription-activated-v1.schema.json +1 -1
  89. package/schemas/events/subscription-revoked-v1.schema.json +1 -1
  90. package/schemas/events/whooshbang-event-v1.schema.json +1 -1
  91. package/schemas/fixture-index.schema.json +1 -1
  92. package/schemas/interaction-machine-scenario.schema.json +1 -1
  93. package/schemas/interaction-v1.schema.json +1 -1
  94. package/schemas/machine-v1.schema.json +1 -1
  95. package/schemas/provider-capabilities-v1.schema.json +1 -1
  96. package/schemas/webhooks/webhook-delivery-case-v1.schema.json +1 -1
  97. package/schemas/webhooks/webhook-signing-vector-v1.schema.json +1 -1
  98. package/schemas/whooshbang-v1.schema.json +370 -1
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "https://whooshbang.flowxo.com/schemas/events/subscription-activated-v1.schema.json",
4
- "x-contract-version": "2.4.0",
4
+ "x-contract-version": "2.5.0",
5
5
  "title": "SubscriptionActivatedEventV1",
6
6
  "description": "A subscription became active with a safe public channel binding.",
7
7
  "$ref": "whooshbang-event-v1.schema.json#/$defs/SubscriptionActivatedEvent"
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "https://whooshbang.flowxo.com/schemas/events/subscription-revoked-v1.schema.json",
4
- "x-contract-version": "2.4.0",
4
+ "x-contract-version": "2.5.0",
5
5
  "title": "SubscriptionRevokedEventV1",
6
6
  "description": "A subscription and its safe public channel binding were revoked.",
7
7
  "$ref": "whooshbang-event-v1.schema.json#/$defs/SubscriptionRevokedEvent"
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "https://whooshbang.flowxo.com/schemas/events/whooshbang-event-v1.schema.json",
4
- "x-contract-version": "2.4.0",
4
+ "x-contract-version": "2.5.0",
5
5
  "title": "WhooshBangEventV1ContractDocument",
6
6
  "description": "Strict public customer-event envelope and initial WhooshBang event union.",
7
7
  "oneOf": [
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "https://whooshbang.flowxo.com/schemas/fixture-index.schema.json",
4
- "x-contract-version": "2.4.0",
4
+ "x-contract-version": "2.5.0",
5
5
  "title": "CoreFixtureIndex",
6
6
  "description": "The machine-readable index of deterministic C0-02 through C0-04 golden fixtures.",
7
7
  "type": "object",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "https://whooshbang.flowxo.com/schemas/interaction-machine-scenario.schema.json",
4
- "x-contract-version": "2.4.0",
4
+ "x-contract-version": "2.5.0",
5
5
  "title": "InteractionMachineScenario",
6
6
  "description": "A deterministic C0-03 interaction, credential, authorization, polling, acknowledgement, or quarantine scenario.",
7
7
  "type": "object",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "https://whooshbang.flowxo.com/schemas/interaction-v1.schema.json",
4
- "x-contract-version": "2.4.0",
4
+ "x-contract-version": "2.5.0",
5
5
  "title": "InteractionV1ContractDocument",
6
6
  "description": "Provider-neutral confirm, single-select, input, lifecycle, callback-token, and authenticated answer-event contracts.",
7
7
  "$defs": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "https://whooshbang.flowxo.com/schemas/machine-v1.schema.json",
4
- "x-contract-version": "2.4.0",
4
+ "x-contract-version": "2.5.0",
5
5
  "title": "MachineV1ContractDocument",
6
6
  "description": "Machine-client administration, locally generated credential metadata, durable long-poll, and contiguous acknowledgement contracts.",
7
7
  "oneOf": [
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "https://whooshbang.flowxo.com/schemas/provider-capabilities-v1.schema.json",
4
- "x-contract-version": "2.4.0",
4
+ "x-contract-version": "2.5.0",
5
5
  "title": "ProviderCapabilitiesV1",
6
6
  "description": "Provider-neutral, renderer-facing delivery and interaction capabilities with explicit degradation.",
7
7
  "type": "object",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "https://whooshbang.flowxo.com/schemas/webhooks/webhook-delivery-case-v1.schema.json",
4
- "x-contract-version": "2.4.0",
4
+ "x-contract-version": "2.5.0",
5
5
  "title": "WebhookDeliveryCaseSetV1",
6
6
  "description": "Deterministic customer webhook response classification, Retry-After, and delivery-bound cases.",
7
7
  "type": "object",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "https://whooshbang.flowxo.com/schemas/webhooks/webhook-signing-vector-v1.schema.json",
4
- "x-contract-version": "2.4.0",
4
+ "x-contract-version": "2.5.0",
5
5
  "title": "WebhookSigningVectorSetV1",
6
6
  "description": "Language-neutral deterministic Standard Webhooks V1 verification vectors. All key material is public synthetic test data and must never be used outside fixtures.",
7
7
  "type": "object",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "https://whooshbang.flowxo.com/schemas/whooshbang-v1.schema.json",
4
- "x-contract-version": "2.4.0",
4
+ "x-contract-version": "2.5.0",
5
5
  "title": "WhooshBangV1ContractDocument",
6
6
  "description": "Public request, resource, summary, and Problem Details models for the WhooshBang V1 REST API.",
7
7
  "anyOf": [
@@ -394,6 +394,15 @@
394
394
  },
395
395
  {
396
396
  "$ref": "#/$defs/WhoAmI"
397
+ },
398
+ {
399
+ "$ref": "#/$defs/BillingPromotions"
400
+ },
401
+ {
402
+ "$ref": "#/$defs/BillingPromotion"
403
+ },
404
+ {
405
+ "$ref": "#/$defs/RedeemBillingPromotionRequest"
397
406
  }
398
407
  ],
399
408
  "$defs": {
@@ -10782,6 +10791,12 @@
10782
10791
  "purchase_cents": {
10783
10792
  "type": "integer",
10784
10793
  "enum": [500, 1000, 2500, 5000, 10000]
10794
+ },
10795
+ "approved_charge_usd": {
10796
+ "type": "string",
10797
+ "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{6}$",
10798
+ "maxLength": 40,
10799
+ "description": "Optional. The card charge the customer approved: the pack price less any promotion shown to them. When it differs from what would be charged, the purchase is refused with credit_purchase_price_changed and nothing is charged."
10785
10800
  }
10786
10801
  },
10787
10802
  "description": "Buy one credit pack now with the default card. The amount is the explicit approval of the charge."
@@ -10793,6 +10808,8 @@
10793
10808
  "id",
10794
10809
  "purchase_cents",
10795
10810
  "credit_usd",
10811
+ "charged_usd",
10812
+ "discount_usd",
10796
10813
  "status",
10797
10814
  "failure",
10798
10815
  "client_secret",
@@ -10813,6 +10830,18 @@
10813
10830
  "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{6}$",
10814
10831
  "maxLength": 40
10815
10832
  },
10833
+ "charged_usd": {
10834
+ "type": "string",
10835
+ "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{6}$",
10836
+ "maxLength": 40,
10837
+ "description": "What the card is charged: the pack price less any promotional discount. The pack's credit is unchanged."
10838
+ },
10839
+ "discount_usd": {
10840
+ "type": "string",
10841
+ "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{6}$",
10842
+ "maxLength": 40,
10843
+ "description": "The promotional discount taken off the pack price, or 0.000000."
10844
+ },
10816
10845
  "status": {
10817
10846
  "type": "string",
10818
10847
  "enum": ["processing", "requires_action", "paid", "failed"]
@@ -11406,6 +11435,8 @@
11406
11435
  "monthly_price_usd",
11407
11436
  "charge_now_usd",
11408
11437
  "unused_time_credit_usd",
11438
+ "promotion",
11439
+ "renewal_promotion",
11409
11440
  "effective_at",
11410
11441
  "expires_at",
11411
11442
  "client_secret",
@@ -11467,6 +11498,95 @@
11467
11498
  ],
11468
11499
  "description": "Compatibility field: new upgrades return 0.000000; starts and boundary changes return null. Historical quotes can retain their recorded unused-time credit. No new automatic unused-time refunds or offsets."
11469
11500
  },
11501
+ "promotion": {
11502
+ "anyOf": [
11503
+ {
11504
+ "type": "object",
11505
+ "required": ["percent_off", "duration", "months", "discount_usd"],
11506
+ "properties": {
11507
+ "percent_off": {
11508
+ "type": "integer",
11509
+ "minimum": 1,
11510
+ "maximum": 90
11511
+ },
11512
+ "duration": {
11513
+ "type": "string",
11514
+ "enum": ["once", "repeating"]
11515
+ },
11516
+ "months": {
11517
+ "anyOf": [
11518
+ {
11519
+ "type": "integer",
11520
+ "minimum": 1,
11521
+ "maximum": 12
11522
+ },
11523
+ {
11524
+ "type": "null"
11525
+ }
11526
+ ]
11527
+ },
11528
+ "discount_usd": {
11529
+ "type": "string",
11530
+ "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{6}$",
11531
+ "maxLength": 40,
11532
+ "description": "What the promotion takes off charge_now_usd."
11533
+ }
11534
+ },
11535
+ "additionalProperties": false
11536
+ },
11537
+ {
11538
+ "type": "null"
11539
+ }
11540
+ ],
11541
+ "description": "A promotion code's plan discount applied to this first plan or add-on purchase: charge_now_usd is already reduced by it, and the monthly charges keep it for its months. Null when no plan discount applies."
11542
+ },
11543
+ "renewal_promotion": {
11544
+ "anyOf": [
11545
+ {
11546
+ "type": "object",
11547
+ "required": [
11548
+ "percent_off",
11549
+ "duration",
11550
+ "renewal_price_usd",
11551
+ "ends_at"
11552
+ ],
11553
+ "properties": {
11554
+ "percent_off": {
11555
+ "type": "integer",
11556
+ "minimum": 1,
11557
+ "maximum": 90
11558
+ },
11559
+ "duration": {
11560
+ "type": "string",
11561
+ "enum": ["once", "repeating"]
11562
+ },
11563
+ "renewal_price_usd": {
11564
+ "type": "string",
11565
+ "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{6}$",
11566
+ "maxLength": 40,
11567
+ "description": "What the next monthly charge for this selection comes to with the promotion: monthly_price_usd less its percentage."
11568
+ },
11569
+ "ends_at": {
11570
+ "anyOf": [
11571
+ {
11572
+ "type": "string",
11573
+ "format": "date-time"
11574
+ },
11575
+ {
11576
+ "type": "null"
11577
+ }
11578
+ ],
11579
+ "description": "When a repeating promotion stops applying. Null for a once promotion, which applies to the next monthly charge only."
11580
+ }
11581
+ },
11582
+ "additionalProperties": false
11583
+ },
11584
+ {
11585
+ "type": "null"
11586
+ }
11587
+ ],
11588
+ "description": "A plan discount already running on the subscription, which keeps lowering the monthly charges after this change. It never reduces charge_now_usd. Null when none applies to the next monthly charge, and once a change is no longer a quote."
11589
+ },
11470
11590
  "effective_at": {
11471
11591
  "anyOf": [
11472
11592
  {
@@ -11895,6 +12015,255 @@
11895
12015
  }
11896
12016
  },
11897
12017
  "additionalProperties": false
12018
+ },
12019
+ "BillingPromotion": {
12020
+ "type": "object",
12021
+ "required": [
12022
+ "id",
12023
+ "source",
12024
+ "name",
12025
+ "status",
12026
+ "starts_at",
12027
+ "ends_at",
12028
+ "ended_at",
12029
+ "benefit"
12030
+ ],
12031
+ "properties": {
12032
+ "id": {
12033
+ "type": "string",
12034
+ "pattern": "^grn_[0-9a-z]{26}$"
12035
+ },
12036
+ "source": {
12037
+ "type": "string",
12038
+ "enum": ["whooshbang", "code"],
12039
+ "description": "`whooshbang` for a reward WhooshBang gave the organization directly; `code` for a promotion code the organization redeemed."
12040
+ },
12041
+ "name": {
12042
+ "anyOf": [
12043
+ {
12044
+ "type": "string",
12045
+ "minLength": 1,
12046
+ "maxLength": 120
12047
+ },
12048
+ {
12049
+ "type": "null"
12050
+ }
12051
+ ],
12052
+ "description": "The promotion's name for a redeemed code. Null for a direct reward."
12053
+ },
12054
+ "status": {
12055
+ "type": "string",
12056
+ "enum": ["active", "pending", "expired", "used", "revoked"],
12057
+ "description": "`pending` is a credit pack discount carried by a payment still waiting for the customer's bank; it is not available to another purchase. `used` applies only to a discount that has been applied to a purchase or put on a plan. `revoked` means WhooshBang withdrew what remained."
12058
+ },
12059
+ "starts_at": {
12060
+ "type": "string",
12061
+ "format": "date-time"
12062
+ },
12063
+ "ends_at": {
12064
+ "anyOf": [
12065
+ {
12066
+ "type": "string",
12067
+ "format": "date-time"
12068
+ },
12069
+ {
12070
+ "type": "null"
12071
+ }
12072
+ ],
12073
+ "description": "When the benefit stops. Null for a discount, which ends when it is used or, for a plan discount, after its months."
12074
+ },
12075
+ "ended_at": {
12076
+ "anyOf": [
12077
+ {
12078
+ "type": "string",
12079
+ "format": "date-time"
12080
+ },
12081
+ {
12082
+ "type": "null"
12083
+ }
12084
+ ],
12085
+ "description": "When the promotion was used or withdrawn, if it was."
12086
+ },
12087
+ "benefit": {
12088
+ "oneOf": [
12089
+ {
12090
+ "type": "object",
12091
+ "required": ["kind", "credit_usd", "remaining_usd"],
12092
+ "properties": {
12093
+ "kind": {
12094
+ "const": "message_credit"
12095
+ },
12096
+ "credit_usd": {
12097
+ "type": "string",
12098
+ "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{6}$",
12099
+ "maxLength": 40
12100
+ },
12101
+ "remaining_usd": {
12102
+ "type": "string",
12103
+ "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{6}$",
12104
+ "maxLength": 40
12105
+ }
12106
+ },
12107
+ "additionalProperties": false,
12108
+ "description": "Promotional credit for messages. Spent before purchased, bonus and welcome credit; it never pays the shared-email charge."
12109
+ },
12110
+ {
12111
+ "type": "object",
12112
+ "required": ["kind", "shared_emails", "remaining"],
12113
+ "properties": {
12114
+ "kind": {
12115
+ "const": "shared_emails"
12116
+ },
12117
+ "shared_emails": {
12118
+ "type": "integer",
12119
+ "minimum": 1,
12120
+ "maximum": 1000000
12121
+ },
12122
+ "remaining": {
12123
+ "type": "integer",
12124
+ "minimum": 0,
12125
+ "maximum": 1000000
12126
+ }
12127
+ },
12128
+ "additionalProperties": false,
12129
+ "description": "Emails through WhooshBang's shared email service with no shared-email charge. The message itself is still paid for."
12130
+ },
12131
+ {
12132
+ "type": "object",
12133
+ "required": ["kind"],
12134
+ "properties": {
12135
+ "kind": {
12136
+ "const": "branding"
12137
+ }
12138
+ },
12139
+ "additionalProperties": false,
12140
+ "description": "WhooshBang branding can be removed from recipient messages until ends_at."
12141
+ },
12142
+ {
12143
+ "type": "object",
12144
+ "required": [
12145
+ "kind",
12146
+ "applies_to",
12147
+ "percent_off",
12148
+ "amount_off_usd",
12149
+ "duration",
12150
+ "months"
12151
+ ],
12152
+ "properties": {
12153
+ "kind": {
12154
+ "const": "discount"
12155
+ },
12156
+ "applies_to": {
12157
+ "type": "string",
12158
+ "enum": ["credit_packs", "subscriptions"]
12159
+ },
12160
+ "percent_off": {
12161
+ "anyOf": [
12162
+ {
12163
+ "type": "integer",
12164
+ "minimum": 1,
12165
+ "maximum": 90
12166
+ },
12167
+ {
12168
+ "type": "null"
12169
+ }
12170
+ ]
12171
+ },
12172
+ "amount_off_usd": {
12173
+ "anyOf": [
12174
+ {
12175
+ "type": "string",
12176
+ "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{6}$",
12177
+ "maxLength": 40
12178
+ },
12179
+ {
12180
+ "type": "null"
12181
+ }
12182
+ ]
12183
+ },
12184
+ "duration": {
12185
+ "type": "string",
12186
+ "enum": ["once", "repeating"]
12187
+ },
12188
+ "months": {
12189
+ "anyOf": [
12190
+ {
12191
+ "type": "integer",
12192
+ "minimum": 1,
12193
+ "maximum": 12
12194
+ },
12195
+ {
12196
+ "type": "null"
12197
+ }
12198
+ ]
12199
+ }
12200
+ },
12201
+ "additionalProperties": false,
12202
+ "description": "Money off the next credit pack, or off plan and add-on charges for one charge or a number of months."
12203
+ }
12204
+ ]
12205
+ }
12206
+ },
12207
+ "additionalProperties": false,
12208
+ "description": "One promotion an organization holds. Promotional value has no cash value, is never refunded and cannot move to another organization."
12209
+ },
12210
+ "BillingPromotions": {
12211
+ "type": "object",
12212
+ "required": [
12213
+ "promotional_credit_usd",
12214
+ "free_shared_emails",
12215
+ "branding_removed_until",
12216
+ "promotions"
12217
+ ],
12218
+ "properties": {
12219
+ "promotional_credit_usd": {
12220
+ "type": "string",
12221
+ "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{6}$",
12222
+ "maxLength": 40,
12223
+ "description": "Unexpired promotional message credit available now."
12224
+ },
12225
+ "free_shared_emails": {
12226
+ "type": "integer",
12227
+ "minimum": 0,
12228
+ "maximum": 2147483647,
12229
+ "description": "Unexpired free shared emails available now."
12230
+ },
12231
+ "branding_removed_until": {
12232
+ "anyOf": [
12233
+ {
12234
+ "type": "string",
12235
+ "format": "date-time"
12236
+ },
12237
+ {
12238
+ "type": "null"
12239
+ }
12240
+ ],
12241
+ "description": "When the latest active branding promotion ends, if one is active."
12242
+ },
12243
+ "promotions": {
12244
+ "type": "array",
12245
+ "items": {
12246
+ "$ref": "#/$defs/BillingPromotion"
12247
+ },
12248
+ "maxItems": 200
12249
+ }
12250
+ },
12251
+ "additionalProperties": false,
12252
+ "description": "An organization's promotions: rewards WhooshBang gave it and promotion codes it redeemed, newest first."
12253
+ },
12254
+ "RedeemBillingPromotionRequest": {
12255
+ "type": "object",
12256
+ "required": ["code"],
12257
+ "properties": {
12258
+ "code": {
12259
+ "type": "string",
12260
+ "minLength": 4,
12261
+ "maxLength": 64,
12262
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9 _-]*$",
12263
+ "description": "The promotion code. Case, spaces, hyphens and underscores are ignored."
12264
+ }
12265
+ },
12266
+ "additionalProperties": false
11898
12267
  }
11899
12268
  }
11900
12269
  }