MCP Control
Обзор  ›  CRM
CRM · Изменение

Клиенты · Предложения · Сторнирование · Использование

customer_offers_reverse_use
Контактные карточки и телефон

Попробуйте три запроса

Подготовить
  1. Вы указываетеКлиент
  2. ПомощникПодготовка
  3. Вы получаетеПредпросмотр
Запрос в чат
Подготовь «Клиенты / Предложения / Сторнирование / Использование». Для изменения нужны клиент, offerId. Покажи объект и ожидаемый эффект до выполнения.
Что входит в подготовку
customerId
Клиент
offerId
Параметр
sourceId
Параметр
Применить
  1. Вы указываетеСогласованные значения
  2. ПомощникОдин вызов
  3. Вы получаетеОтвет операции
Запрос в чат
На учебной записи подготовь «Клиенты / Предложения / Сторнирование / Использование» с параметром reason = canceled. Покажи остальные обязательные значения и выполни действие, когда согласованы все поля.
Фрагмент учебных параметров
reason
canceled
customerId
DEMO-101
offerId
DEMO-101
Проверить итог
  1. Вы указываетеИсходный ответ
  2. ПомощникСверка результата
  3. Вы получаетеПодтверждение
Запрос в чат
Проверь результат «Клиенты / Предложения / Сторнирование / Использование» по исходному ответу. Покажи клиент, offerId. Объясни, чем подтвердить эффект для выбранного объекта.
Как проследить одну попытку
  1. ЗапросСохранить исходный ключ
  2. ОтветПроверить статус
  3. ПроверкаСверить эффект операции
Как работает действие

Этот вызов может изменить рабочие данные. Согласуйте точный объект, новые значения и ожидаемый результат. Присвойте операции стабильный requestId. При повторе той же операции используйте прежний ключ и те же значения.

Описание разработчика

Reverse one exact previously recorded personal-offer use after its sale was canceled, failed or corrected. The same sourceId restores its recorded quantity and reduces usageCount once in an atomic Firestore transaction; used returns to active only when capacity is restored. This Action does not cancel or refund an order and does not check provider or payment state. The authorized caller must use the existing order lifecycle first. Repeating a sourceId cannot reverse twice; recover uncertain results with customer_offers_get_use_operation.

Параметры запроса
customerId
Идентификатор клиента, выбранного по результату поиска. обязательно по схеме · string · до символов 160
offerId
Exact users/{customerId}/offers document ID returned by a create or list action. обязательно по схеме · string · до символов 160
sourceId
Stable identifier of the confirmed sale or other completed use. The caller supplies the actual business event ID; this Action does not create or check out an order. One source may consume one offer only once. обязательно по схеме · string · до символов 160
reason
Why the previously recorded use must be undone. Only use after the sale was canceled, failed, or corrected. обязательно по схеме · string · варианты canceled, failed, correction
requestId
Ключ этой операции. Для повтора с теми же аргументами сохраните исходное значение. обязательно по схеме · string · до символов 128
Что вернёт команда
customerId
Existing users document ID. The server verifies its company and allowed location. обязательно по схеме · string · до символов 160
offerId
Exact users/{customerId}/offers document ID returned by a create or list action. обязательно по схеме · string · до символов 160
sourceId
Stable identifier of the confirmed sale or other completed use. The caller supplies the actual business event ID; this Action does not create or check out an order. One source may consume one offer only once. обязательно по схеме · string · до символов 160
operation
Committed usage counter operation. обязательно по схеме · string · варианты record, reverse
quantity
Units recorded or returned by this exact operation. обязательно по схеме · number
usageCount
Server maintained integer count of completed customer_offers_record_use events. Created as zero; quotes and failed sales do not increment it. Reversed events decrement it. обязательно по схеме · integer · минимум 0 · максимум 9007199254740991
remainingQuantity
Server maintained eligible units left when quantity > 0; record_use consumes units and reverse_use restores them. Ignored for unlimited quantity. обязательно по схеме · number / null
status
Offer status after the committed counter change. обязательно по схеме · string · варианты active, inactive, expired, used
at
Server time when this exact usage operation committed. обязательно по схеме · string
Поля и технические схемы
Входные поля и поля ответа customer_offers_reverse_use
Вход · JSON Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "customerId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160,
      "pattern": "^[A-Za-z0-9_~:@+.-]+$",
      "description": "Existing users document ID. The server verifies its company and allowed location."
    },
    "offerId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160,
      "pattern": "^[A-Za-z0-9_~:@+.-]+$",
      "description": "Exact users/{customerId}/offers document ID returned by a create or list action."
    },
    "sourceId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160,
      "pattern": "^[A-Za-z0-9_~:@+.-]+$",
      "description": "Stable identifier of the confirmed sale or other completed use. The caller supplies the actual business event ID; this Action does not create or check out an order. One source may consume one offer only once."
    },
    "reason": {
      "type": "string",
      "enum": [
        "canceled",
        "failed",
        "correction"
      ],
      "description": "Why the previously recorded use must be undone. Only use after the sale was canceled, failed, or corrected."
    },
    "requestId": {
      "type": "string",
      "minLength": 8,
      "maxLength": 128,
      "pattern": "^[A-Za-z0-9_-]+$",
      "description": "Stable ID for exactly this mutation and arguments. Retry the same request after uncertainty."
    }
  },
  "required": [
    "customerId",
    "offerId",
    "sourceId",
    "reason",
    "requestId"
  ],
  "additionalProperties": false
}
Выход · JSON Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "customerId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160,
      "pattern": "^[A-Za-z0-9_~:@+.-]+$",
      "description": "Existing users document ID. The server verifies its company and allowed location."
    },
    "offerId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160,
      "pattern": "^[A-Za-z0-9_~:@+.-]+$",
      "description": "Exact users/{customerId}/offers document ID returned by a create or list action."
    },
    "sourceId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160,
      "pattern": "^[A-Za-z0-9_~:@+.-]+$",
      "description": "Stable identifier of the confirmed sale or other completed use. The caller supplies the actual business event ID; this Action does not create or check out an order. One source may consume one offer only once."
    },
    "operation": {
      "type": "string",
      "enum": [
        "record",
        "reverse"
      ],
      "description": "Committed usage counter operation."
    },
    "quantity": {
      "type": "number",
      "exclusiveMinimum": 0,
      "description": "Units recorded or returned by this exact operation."
    },
    "usageCount": {
      "type": "integer",
      "minimum": 0,
      "maximum": 9007199254740991,
      "description": "Server maintained integer count of completed customer_offers_record_use events. Created as zero; quotes and failed sales do not increment it. Reversed events decrement it."
    },
    "remainingQuantity": {
      "anyOf": [
        {
          "type": "number",
          "minimum": 0
        },
        {
          "type": "null"
        }
      ],
      "description": "Server maintained eligible units left when quantity > 0; record_use consumes units and reverse_use restores them. Ignored for unlimited quantity."
    },
    "status": {
      "type": "string",
      "enum": [
        "active",
        "inactive",
        "expired",
        "used"
      ],
      "description": "Offer status after the committed counter change."
    },
    "at": {
      "type": "string",
      "format": "date-time",
      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
      "description": "Server time when this exact usage operation committed."
    }
  },
  "required": [
    "customerId",
    "offerId",
    "sourceId",
    "operation",
    "quantity",
    "usageCount",
    "remainingQuantity",
    "status",
    "at"
  ],
  "additionalProperties": false
}