CreateLease 方法

「建立保留」為選用項目,適用於有意導入這項支援功能的合作夥伴。開始之前,請先與 Actions Center 聯絡,確認您是否符合使用資格。

如果採用「保留」支援服務,則建立預訂的第一步是建立保留。 合作夥伴後端會確認要求的預約時段是否有效且可供預訂。合作夥伴可於內部針對要求的時段建立暫時性保留,並設為在 lease_expiration_time 後自動到期。後端可修改 lease_expiration_time;舉例來說,要求的保留時間過長時,則可從後端修改。 系統會將已建立的保留傳回用戶端,接著用戶端就會要求為該保留建立預訂。

如果因任何商業邏輯錯誤而導致保留建立失敗,則應在回應中填入該錯誤。詳情請參閱預訂失敗

要求

CreateLeaseRequest

傳回值

CreateLeaseResponse

相關規定如下:

  • lease_id 必須由合作夥伴後端建立,並在 CreateLeaseResponse 中設定。
  • lease_expiration_time 必須在 CreateLeaseResponse 中設定。
  • 若在 CreateLeaseRequest 中指定了資源欄位,則該欄位必須在 CreateLeaseResponse 中設定,並與 CreateLeaseRequest 相符。
  • 必須設定 CreateLeaseResponse 中的所有其他欄位,而且這些欄位都與 CreateLeaseRequest 相符。

標準 gRPC 錯誤代碼

  • INVALID_ARGUMENT:商家 ID、服務 ID 或時段的時間規格無效
// Request to create a [ext.maps.booking.partner.v2.Lease] for a slot in the
// inventory.  The expiration time in the returned Lease may be modified by the
// backend, e.g. if the requested lease period is too long.
message CreateLeaseRequest {
  // The lease to be created with information about the appointment slot
  // (required)
  Lease lease = 1;
}

// Response for the [ext.maps.booking.partner.v2.CreateLease] RPC with the
// created [ext.maps.booking.partner.v2.Lease]
message CreateLeaseResponse {
  // The created [ext.maps.booking.partner.v2.Lease] (required)
  Lease lease = 1;

  // If creating a lease fails, this field should reflect the business logic
  // error (e.g., slot has become unavailable) and lease field is expected to be
  // unset. (required if failure occurs)
  BookingFailure booking_failure = 2;
}