Phương thức CreateLease
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Bạn không bắt buộc phải hỗ trợ việc tạo hợp đồng thuê. Chính sách này áp dụng cho những đối tác quan tâm đến việc triển khai chức năng này. Vui lòng liên hệ với Trung tâm hành động để xác định điều kiện trước khi bắt đầu.
Tạo hợp đồng thuê là bước đầu tiên khi tạo một yêu cầu đặt phòng có hỗ trợ về Hợp đồng thuê.
Phần phụ trợ của đối tác xác minh rằng khung giờ nhận đặt hẹn được yêu cầu là hợp lệ và có sẵn. Trong nội bộ, đối tác sẽ tạo một khoản tiền tạm giữ cho khung giờ được yêu cầu. Khoản tiền này được thiết lập để tự động hết hạn tại thời điểm lease_expiration_time. Phần phụ trợ được phép sửa đổi lease_expiration_time, ví dụ: nếu thời gian thuê được yêu cầu quá dài. Hợp đồng thuê đã tạo sẽ được trả về cho ứng dụng khách. Sau đó, ứng dụng sẽ yêu cầu tạo một yêu cầu đặt trước cho hợp đồng thuê.
Nếu không tạo được hợp đồng thuê do lỗi logic nghiệp vụ, lỗi sẽ được điền vào phản hồi. Hãy xem phần Lỗi đặt phòng để biết thông tin chi tiết.
Yêu cầu
CreateLeaseRequest
Giá trị trả về
CreateLeaseResponse
Yêu cầu:
- lease_id phải do phần phụ trợ của đối tác tạo và đặt trong CreateLeaseResponse.
- Bạn phải đặt lease_expiration_time trong CreateLeaseResponse.
- Nếu trường tài nguyên được chỉ định trong CreateLeaseRequest, thì bạn phải đặt trường này trong CreateLeaseResponse và khớp với CreateLeaseRequest.
- Bạn phải đặt và so khớp tất cả các trường khác trong CreateLeaseResponse với
CreateLeaseRequest.
Mã lỗi gRPC chuẩn
INVALID_ARGUMENT
(mã người bán, mã dịch vụ hoặc thông số kỹ thuật về thời gian của khung giờ không hợp lệ)
// 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;
}
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-07-26 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-07-26 UTC."],[[["\u003cp\u003eLease creation is an optional feature for partners to implement booking functionality.\u003c/p\u003e\n"],["\u003cp\u003ePartners must contact Actions Center for eligibility before implementing lease creation.\u003c/p\u003e\n"],["\u003cp\u003eCreating a lease involves a temporary hold on an appointment slot, which is later used for booking creation.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eCreateLeaseRequest\u003c/code\u003e initiates the process, and \u003ccode\u003eCreateLeaseResponse\u003c/code\u003e returns the lease details or error information.\u003c/p\u003e\n"],["\u003cp\u003ePartners must adhere to specific requirements when setting values in the \u003ccode\u003eCreateLeaseResponse\u003c/code\u003e.\u003c/p\u003e\n"]]],["Lease creation is an optional feature for partners. Partners must contact the Actions Center to determine eligibility. The process involves creating a temporary hold on a valid appointment slot, with an automatic expiration time that can be modified by the backend. Partners create a `lease_id` and `lease_expiration_time`, which are returned in the `CreateLeaseResponse`. If a lease fails due to business logic errors, an error response is populated. The response fields must match the request fields, and `INVALID_ARGUMENT` error can occur.\n"],null,["# CreateLease method\n\nSupport for lease creation is **optional**. It applies to partners that are\ninterested in implementing this functionality. Please contact the Actions Center to determine eligibility before you start.\n\nCreating the lease is the first step when creating a booking with Lease support.\nThe partner backend verifies that the requested appointment slot is valid and\navailable. Internally, the partner creates a temporary hold for the requested\nslot, which is set up to expire automatically at lease_expiration_time. The\nbackend is allowed to modify lease_expiration_time, e.g. if the requested lease\ntime is excessively long. The created lease is returned to the client. Then the\nclient requests to create a booking for the lease.\n\nIf creating a lease fails due to any business logic error, the error should be\npopulated in the response. See [Booking\nFailure](/actions-center/reference/grpc-api-v2/booking-failure-specification) for\ndetailed information.\n\n**Request**\n\nCreateLeaseRequest\n\n**Return value**\n\nCreateLeaseResponse\n\nRequirements:\n\n- lease_id must be created by the partner backend and set in the CreateLeaseResponse.\n- lease_expiration_time must be set in the CreateLeaseResponse.\n- If the resources field is specified in the CreateLeaseRequest, then it must be set in the CreateLeaseResponse, and match the CreateLeaseRequest.\n- All other fields in the CreateLeaseResponse must be set and match the CreateLeaseRequest.\n\n**Canonical gRPC error codes**\n\n- `INVALID_ARGUMENT` (invalid merchant ID, service ID, or slot time specification)\n\n```scilab\n// Request to create a [ext.maps.booking.partner.v2.Lease] for a slot in the\n// inventory. The expiration time in the returned Lease may be modified by the\n// backend, e.g. if the requested lease period is too long.\nmessage CreateLeaseRequest {\n // The lease to be created with information about the appointment slot\n // (required)\n Lease lease = 1;\n}\n\n// Response for the [ext.maps.booking.partner.v2.CreateLease] RPC with the\n// created [ext.maps.booking.partner.v2.Lease]\nmessage CreateLeaseResponse {\n // The created [ext.maps.booking.partner.v2.Lease] (required)\n Lease lease = 1;\n\n // If creating a lease fails, this field should reflect the business logic\n // error (e.g., slot has become unavailable) and lease field is expected to be\n // unset. (required if failure occurs)\n BookingFailure booking_failure = 2;\n}\n```"]]