Skip to content

Commit 66c3e33

Browse files
Google APIscopybara-github
authored andcommitted
feat: Add CheckoutSettings service
cl/774558711 is submitted PiperOrigin-RevId: 776251023
1 parent 33887f7 commit 66c3e33

File tree

4 files changed

+271
-12
lines changed

4 files changed

+271
-12
lines changed

google/shopping/merchant/accounts/v1beta/BUILD.bazel

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ proto_library(
3333
"automaticimprovements.proto",
3434
"businessidentity.proto",
3535
"businessinfo.proto",
36+
"checkoutsettings.proto",
3637
"customerservice.proto",
3738
"emailpreferences.proto",
3839
"gbpaccounts.proto",
@@ -55,7 +56,6 @@ proto_library(
5556
"//google/api:client_proto",
5657
"//google/api:field_behavior_proto",
5758
"//google/api:resource_proto",
58-
# Manual edit: Types -> Type
5959
"//google/shopping/type:type_proto",
6060
"//google/type:date_proto",
6161
"//google/type:datetime_proto",
@@ -91,7 +91,10 @@ load(
9191

9292
java_proto_library(
9393
name = "accounts_java_proto",
94-
deps = [":accounts_proto"],
94+
deps = [
95+
":accounts_proto",
96+
"//google/shopping/type:type_proto",
97+
],
9598
)
9699

97100
java_grpc_library(
@@ -114,6 +117,7 @@ java_gapic_library(
114117
deps = [
115118
":accounts_java_proto",
116119
"//google/api:api_java_proto",
120+
"//google/shopping/type:type_java_proto",
117121
],
118122
)
119123

@@ -134,6 +138,8 @@ java_gapic_test(
134138
"com.google.shopping.merchant.accounts.v1beta.BusinessIdentityServiceClientTest",
135139
"com.google.shopping.merchant.accounts.v1beta.BusinessInfoServiceClientHttpJsonTest",
136140
"com.google.shopping.merchant.accounts.v1beta.BusinessInfoServiceClientTest",
141+
"com.google.shopping.merchant.accounts.v1beta.CheckoutSettingsServiceClientHttpJsonTest",
142+
"com.google.shopping.merchant.accounts.v1beta.CheckoutSettingsServiceClientTest",
137143
"com.google.shopping.merchant.accounts.v1beta.EmailPreferencesServiceClientHttpJsonTest",
138144
"com.google.shopping.merchant.accounts.v1beta.EmailPreferencesServiceClientTest",
139145
"com.google.shopping.merchant.accounts.v1beta.GbpAccountsServiceClientHttpJsonTest",
@@ -183,16 +189,16 @@ load(
183189
"@com_google_googleapis_imports//:imports.bzl",
184190
"go_gapic_assembly_pkg",
185191
"go_gapic_library",
186-
"go_grpc_library",
192+
"go_proto_library",
187193
)
188194

189-
go_grpc_library(
195+
go_proto_library(
190196
name = "accounts_go_proto",
197+
compilers = ["@io_bazel_rules_go//proto:go_grpc"],
191198
importpath = "cloud.google.com/go/shopping/merchant/accounts/apiv1beta/accountspb",
192199
protos = [":accounts_proto"],
193200
deps = [
194201
"//google/api:annotations_go_proto",
195-
# Manual edit: Types -> Type
196202
"//google/shopping/type:type_go_proto",
197203
"//google/type:date_go_proto",
198204
"//google/type:datetime_go_proto",
@@ -261,7 +267,7 @@ py_gapic_library(
261267
service_yaml = "merchantapi_v1beta.yaml",
262268
transport = "grpc+rest",
263269
deps = [
264-
":shopping_type", # Added manually
270+
":shopping_type",
265271
],
266272
)
267273

@@ -417,7 +423,6 @@ load(
417423

418424
csharp_proto_library(
419425
name = "accounts_csharp_proto",
420-
extra_opts = [],
421426
deps = [":accounts_proto"],
422427
)
423428

google/shopping/merchant/accounts/v1beta/accounts_grpc_service_config.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@
5858
},
5959
{
6060
"service": "google.shopping.merchant.accounts.v1beta.UserService"
61+
},
62+
{
63+
"service": "google.shopping.merchant.accounts.v1beta.CheckoutSettingsService"
6164
}
6265
],
6366
"timeout": "60s",
Lines changed: 250 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,250 @@
1+
// Copyright 2025 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
syntax = "proto3";
16+
17+
package google.shopping.merchant.accounts.v1beta;
18+
19+
import "google/api/annotations.proto";
20+
import "google/api/client.proto";
21+
import "google/api/field_behavior.proto";
22+
import "google/api/resource.proto";
23+
import "google/protobuf/empty.proto";
24+
import "google/protobuf/field_mask.proto";
25+
import "google/shopping/type/types.proto";
26+
27+
option go_package = "cloud.google.com/go/shopping/merchant/accounts/apiv1beta/accountspb;accountspb";
28+
option java_multiple_files = true;
29+
option java_outer_classname = "CheckoutsettingsProto";
30+
option java_package = "com.google.shopping.merchant.accounts.v1beta";
31+
32+
// Service for supporting [checkout
33+
// settings](https://support.google.com/merchants/answer/13945960).
34+
service CheckoutSettingsService {
35+
option (google.api.default_host) = "merchantapi.googleapis.com";
36+
option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/content";
37+
38+
// Gets `CheckoutSettings` for the given merchant. This includes
39+
// information about review state, enrollment state and URL settings.
40+
rpc GetCheckoutSettings(GetCheckoutSettingsRequest)
41+
returns (CheckoutSettings) {
42+
option (google.api.http) = {
43+
get: "/accounts/v1beta/{name=accounts/*/programs/*/checkoutSettings}"
44+
};
45+
option (google.api.method_signature) = "name";
46+
}
47+
48+
// Creates `CheckoutSettings` for the given merchant.
49+
rpc CreateCheckoutSettings(CreateCheckoutSettingsRequest)
50+
returns (CheckoutSettings) {
51+
option (google.api.http) = {
52+
post: "/accounts/v1beta/{parent=accounts/*/programs/*}/checkoutSettings"
53+
body: "checkout_settings"
54+
};
55+
option (google.api.method_signature) = "parent,checkout_settings";
56+
}
57+
58+
// Updates `CheckoutSettings` for the given merchant.
59+
rpc UpdateCheckoutSettings(UpdateCheckoutSettingsRequest)
60+
returns (CheckoutSettings) {
61+
option (google.api.http) = {
62+
patch: "/accounts/v1beta/{checkout_settings.name=accounts/*/programs/*/checkoutSettings}"
63+
body: "checkout_settings"
64+
};
65+
option (google.api.method_signature) = "checkout_settings,update_mask";
66+
}
67+
68+
// Deletes `CheckoutSettings` and unenrolls merchant from
69+
// `Checkout` program.
70+
rpc DeleteCheckoutSettings(DeleteCheckoutSettingsRequest)
71+
returns (google.protobuf.Empty) {
72+
option (google.api.http) = {
73+
delete: "/accounts/v1beta/{name=accounts/*/programs/*/checkoutSettings}"
74+
};
75+
option (google.api.method_signature) = "name";
76+
}
77+
}
78+
79+
// Request message for `GetCheckoutSettings` method.
80+
message GetCheckoutSettingsRequest {
81+
// Required. The name/identifier of the merchant account.
82+
// Format: `accounts/{account}/programs/{program}/checkoutSettings`
83+
string name = 1 [
84+
(google.api.field_behavior) = REQUIRED,
85+
(google.api.resource_reference) = {
86+
type: "merchantapi.googleapis.com/CheckoutSettings"
87+
}
88+
];
89+
}
90+
91+
// Request message for the `CreateCheckoutSettings` method.
92+
message CreateCheckoutSettingsRequest {
93+
// Required. The merchant account for which the `CheckoutSettings` will be
94+
// created.
95+
string parent = 1 [
96+
(google.api.field_behavior) = REQUIRED,
97+
(google.api.resource_reference) = {
98+
child_type: "merchantapi.googleapis.com/CheckoutSettings"
99+
}
100+
];
101+
102+
// Required. The `CheckoutSettings` object to create.
103+
CheckoutSettings checkout_settings = 2
104+
[(google.api.field_behavior) = REQUIRED];
105+
}
106+
107+
// Request message for the `UpdateCheckoutSettings` method.
108+
message UpdateCheckoutSettingsRequest {
109+
// Required. The updated version of the `CheckoutSettings`.
110+
// The `name` field is used to identify the `CheckoutSettings`.
111+
// Format: `accounts/{account}/programs/{program}/checkoutSettings`
112+
CheckoutSettings checkout_settings = 1
113+
[(google.api.field_behavior) = REQUIRED];
114+
115+
// Required. List of fields being updated.
116+
// The following fields are supported (in both `snake_case` and
117+
// `lowerCamelCase`):
118+
//
119+
// - `eligible_destinations`
120+
// - `uri_settings`
121+
google.protobuf.FieldMask update_mask = 2
122+
[(google.api.field_behavior) = REQUIRED];
123+
}
124+
125+
// Request message for the `DeleteCheckoutSettings` method.
126+
message DeleteCheckoutSettingsRequest {
127+
// Required. The name/identifier of the merchant account.
128+
// Format: `accounts/{account}/programs/{program}/checkoutSettings`
129+
string name = 1 [
130+
(google.api.field_behavior) = REQUIRED,
131+
(google.api.resource_reference) = {
132+
type: "merchantapi.googleapis.com/CheckoutSettings"
133+
}
134+
];
135+
}
136+
137+
// [CheckoutSettings](https://support.google.com/merchants/answer/13945960) for
138+
// a specific merchant.
139+
message CheckoutSettings {
140+
option (google.api.resource) = {
141+
type: "merchantapi.googleapis.com/CheckoutSettings"
142+
pattern: "accounts/{account}/programs/{program}/checkoutSettings"
143+
plural: "settings"
144+
singular: "checkoutSettings"
145+
};
146+
147+
// Enum indicating the enrollment state of merchant in `Checkout`
148+
// program.
149+
enum CheckoutEnrollmentState {
150+
// Default enrollment state when enrollment state is not specified.
151+
CHECKOUT_ENROLLMENT_STATE_UNSPECIFIED = 0;
152+
153+
// Merchant has not enrolled into the program.
154+
INACTIVE = 1;
155+
156+
// Merchant has enrolled into the program by providing either an
157+
// account level URL or checkout URLs as part of their feed.
158+
ENROLLED = 2;
159+
160+
// Merchant has previously enrolled but opted out of the program.
161+
OPTED_OUT = 3;
162+
}
163+
164+
// Enum indicating the review state of merchant in `Checkout`
165+
// program.
166+
enum CheckoutReviewState {
167+
// Default review state when review state is not specified.
168+
CHECKOUT_REVIEW_STATE_UNSPECIFIED = 0;
169+
170+
// Merchant provided URLs are being reviewed for data quality issues.
171+
IN_REVIEW = 1;
172+
173+
// Merchant account has been approved. Indicates the data quality checks
174+
// have passed.
175+
APPROVED = 2;
176+
177+
// Merchant account has been disapproved due to data quality issues.
178+
DISAPPROVED = 3;
179+
}
180+
181+
// Identifier. The resource name of the program configuration settings.
182+
// Format: `accounts/{account}/programs/{program}/checkoutSettings`
183+
string name = 1 [(google.api.field_behavior) = IDENTIFIER];
184+
185+
// URI settings for cart or checkout URL.
186+
optional UriSettings uri_settings = 2;
187+
188+
// Optional. The destinations to which the checkout program applies, valid
189+
// destination values are `SHOPPING_ADS`, `FREE_LISTINGS`
190+
repeated google.shopping.type.Destination.DestinationEnum
191+
eligible_destinations = 8 [(google.api.field_behavior) = OPTIONAL];
192+
193+
// Output only. Reflects the merchant enrollment state in `Checkout` program.
194+
optional CheckoutEnrollmentState enrollment_state = 3
195+
[(google.api.field_behavior) = OUTPUT_ONLY];
196+
197+
// Output only. Reflects the merchant review state in `Checkout` program.
198+
// This is set based on the data quality reviews of the URL provided by
199+
// the merchant.
200+
// A merchant with enrollment state
201+
// as `ENROLLED` can be in the following review states: `IN_REVIEW`,
202+
// `APPROVED` or `DISAPPROVED`. A merchant must be in an `enrollment_state` of
203+
// `ENROLLED` before a review can begin for the merchant.For more details,
204+
// check the help center doc.
205+
optional CheckoutReviewState review_state = 4
206+
[(google.api.field_behavior) = OUTPUT_ONLY];
207+
208+
// Output only. The effective value of `uri_settings` for a given merchant. If
209+
// account level settings are present then this value will be a copy of url
210+
// settings. Otherwise, it will have the value of the parent account (for only
211+
// marketplace sellers).
212+
UriSettings effective_uri_settings = 5
213+
[(google.api.field_behavior) = OUTPUT_ONLY];
214+
215+
// Output only. The effective value of enrollment_state for a given merchant
216+
// ID. If account level settings are present then this value will be a copy of
217+
// the account level settings. Otherwise, it will have the value of the parent
218+
// account (for only marketplace sellers).
219+
optional CheckoutEnrollmentState effective_enrollment_state = 6
220+
[(google.api.field_behavior) = OUTPUT_ONLY];
221+
222+
// Output only. The effective value of `review_state` for a given merchant ID.
223+
// If account level settings are present then this value will be a copy of the
224+
// account level settings. Otherwise, it will have the value of the parent
225+
// account (for only marketplace sellers).
226+
optional CheckoutReviewState effective_review_state = 7
227+
[(google.api.field_behavior) = OUTPUT_ONLY];
228+
}
229+
230+
// URL settings for cart or checkout URL.
231+
message UriSettings {
232+
// Specifications related to the `Checkout` URL. The `UriTemplate` is
233+
// of the form `https://www.mystore.com/checkout?item_id={id}`
234+
// where `{id}` will be automatically replaced with [offer_id]
235+
// (https://developers.google.com/shopping-content/reference/rest/v2.1/products#Product.FIELDS.offer_id)
236+
// attribute from the merchant account
237+
oneof uri_template {
238+
// Checkout URL template. When the placeholders are expanded will redirect
239+
// the buyer to the merchant checkout page with the item in the cart. For
240+
// more details, check the [help center
241+
// doc](https://support.google.com/merchants/answer/13945960#method1&zippy=%2Cproduct-level-url-formatting%2Caccount-level-url-formatting)
242+
string checkout_uri_template = 1;
243+
244+
// Cart URL template. When the placeholders are expanded will redirect the
245+
// buyer to the cart page on the merchant website with the selected
246+
// item in cart. For more details, check the [help center
247+
// doc](https://support.google.com/merchants/answer/13945960#method1&zippy=%2Cproduct-level-url-formatting%2Caccount-level-url-formatting)
248+
string cart_uri_template = 2;
249+
}
250+
}

google/shopping/merchant/accounts/v1beta/merchantapi_v1beta.yaml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ apis:
1010
- name: google.shopping.merchant.accounts.v1beta.AutomaticImprovementsService
1111
- name: google.shopping.merchant.accounts.v1beta.BusinessIdentityService
1212
- name: google.shopping.merchant.accounts.v1beta.BusinessInfoService
13+
- name: google.shopping.merchant.accounts.v1beta.CheckoutSettingsService
1314
- name: google.shopping.merchant.accounts.v1beta.EmailPreferencesService
1415
- name: google.shopping.merchant.accounts.v1beta.GbpAccountsService
1516
- name: google.shopping.merchant.accounts.v1beta.HomepageService
@@ -84,6 +85,10 @@ authentication:
8485
oauth:
8586
canonical_scopes: |-
8687
https://www.googleapis.com/auth/content
88+
- selector: 'google.shopping.merchant.accounts.v1beta.CheckoutSettingsService.*'
89+
oauth:
90+
canonical_scopes: |-
91+
https://www.googleapis.com/auth/content
8792
- selector: google.shopping.merchant.accounts.v1beta.EmailPreferencesService.GetEmailPreferences
8893
oauth:
8994
canonical_scopes: |-
@@ -116,11 +121,7 @@ authentication:
116121
oauth:
117122
canonical_scopes: |-
118123
https://www.googleapis.com/auth/content
119-
- selector: google.shopping.merchant.accounts.v1beta.OnlineReturnPolicyService.GetOnlineReturnPolicy
120-
oauth:
121-
canonical_scopes: |-
122-
https://www.googleapis.com/auth/content
123-
- selector: google.shopping.merchant.accounts.v1beta.OnlineReturnPolicyService.ListOnlineReturnPolicies
124+
- selector: 'google.shopping.merchant.accounts.v1beta.OnlineReturnPolicyService.*'
124125
oauth:
125126
canonical_scopes: |-
126127
https://www.googleapis.com/auth/content

0 commit comments

Comments
 (0)