backend-manager 5.0.166 → 5.0.168

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.
package/CHANGELOG.md CHANGED
@@ -14,6 +14,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
14
14
  - `Fixed` for any bug fixes.
15
15
  - `Security` in case of vulnerabilities.
16
16
 
17
+ # [5.0.168] - 2026-03-21
18
+ ### Fixed
19
+ - Immediately suspend subscription on payment denial (PAYMENT.SALE.DENIED, invoice.payment_failed) instead of waiting for the processor to give up retrying — recovery via PAYMENT.SALE.COMPLETED restores active status
20
+
21
+ # [5.0.167] - 2026-03-20
22
+ ### Changed
23
+ - Extracted `resolveTemperature()` helper for consistency with `resolveFormatting()` and `resolveReasoning()`
24
+
17
25
  # [5.0.166] - 2026-03-20
18
26
  ### Added
19
27
  - `reasoning: true` feature flag to GPT-5.x and o-series models in MODEL_TABLE
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "backend-manager",
3
- "version": "5.0.166",
3
+ "version": "5.0.168",
4
4
  "description": "Quick tools for developing Firebase functions",
5
5
  "main": "src/manager/index.js",
6
6
  "bin": {
@@ -218,6 +218,16 @@ async function processPaymentEvent({ category, library, resource, resourceType,
218
218
  ? library.toUnifiedSubscription(resource, transformOptions)
219
219
  : library.toUnifiedOneTime(resource, transformOptions);
220
220
 
221
+ // Override: immediately suspend on payment denial
222
+ // Processors keep the sub active while retrying, but we revoke access right away.
223
+ // If the retry succeeds (e.g. PAYMENT.SALE.COMPLETED), it will restore active status.
224
+ // PayPal: PAYMENT.SALE.DENIED, Stripe: invoice.payment_failed, Chargebee: payment_failed
225
+ const PAYMENT_DENIED_EVENTS = ['PAYMENT.SALE.DENIED', 'invoice.payment_failed', 'payment_failed'];
226
+ if (isSubscription && PAYMENT_DENIED_EVENTS.includes(eventType) && unified.status === 'active') {
227
+ assistant.log(`Overriding status to suspended: ${eventType} received but provider still says active`);
228
+ unified.status = 'suspended';
229
+ }
230
+
221
231
  assistant.log(`Unified ${category}: product=${unified.product.id}, status=${unified.status}`, unified);
222
232
 
223
233
  // Read checkout context from payments-intents (attribution, discount, supplemental)
@@ -821,8 +821,6 @@ function makeRequest(mode, options, self, prompt, message, user, _log) {
821
821
  const history = formatHistory(options, prompt, message, _log);
822
822
 
823
823
  // Set request
824
- const modelConfig = getModelConfig(options.model);
825
-
826
824
  request.url = 'https://api.openai.com/v1/responses';
827
825
  request.body = {
828
826
  model: options.model,
@@ -833,8 +831,9 @@ function makeRequest(mode, options, self, prompt, message, user, _log) {
833
831
  }
834
832
 
835
833
  // Only include temperature if the model supports it
836
- if (modelConfig.features?.temperature !== false) {
837
- request.body.temperature = options.temperature;
834
+ const temperature = resolveTemperature(options);
835
+ if (temperature !== undefined) {
836
+ request.body.temperature = temperature;
838
837
  }
839
838
 
840
839
  // Only include reasoning if the model supports it
@@ -901,6 +900,16 @@ function resolveFormatting(options) {
901
900
  return undefined;
902
901
  }
903
902
 
903
+ function resolveTemperature(options) {
904
+ // Check if the model supports temperature
905
+ const modelConfig = getModelConfig(options.model);
906
+ if (modelConfig.features?.temperature === false) {
907
+ return undefined;
908
+ }
909
+
910
+ return options.temperature;
911
+ }
912
+
904
913
  function resolveReasoning(options) {
905
914
  // If reasoning is not requested, return undefined
906
915
  if (!options.reasoning) {