Skip to content

Commit 398aefa

Browse files
feat: [ShoppingMerchantAccounts] Add CheckoutSettings service (#8407)
* feat: Add CheckoutSettings service cl/774558711 is submitted PiperOrigin-RevId: 776251023 Source-Link: googleapis/googleapis@66c3e33 Source-Link: googleapis/googleapis-gen@9bf65b0 Copy-Tag: eyJwIjoiU2hvcHBpbmdNZXJjaGFudEFjY291bnRzLy5Pd2xCb3QueWFtbCIsImgiOiI5YmY2NWIwMjZiMWVhMjE3ZTEwMTE5MmRmN2RjOWZiYjJiYWQ4Zjc5In0= * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent e61b01b commit 398aefa

19 files changed

Lines changed: 2467 additions & 0 deletions
4.38 KB
Binary file not shown.
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
<?php
2+
/*
3+
* Copyright 2025 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* https://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
/*
19+
* GENERATED CODE WARNING
20+
* This file was automatically generated - do not edit!
21+
*/
22+
23+
require_once __DIR__ . '/../../../vendor/autoload.php';
24+
25+
// [START merchantapi_v1beta_generated_CheckoutSettingsService_CreateCheckoutSettings_sync]
26+
use Google\ApiCore\ApiException;
27+
use Google\Shopping\Merchant\Accounts\V1beta\CheckoutSettings;
28+
use Google\Shopping\Merchant\Accounts\V1beta\Client\CheckoutSettingsServiceClient;
29+
use Google\Shopping\Merchant\Accounts\V1beta\CreateCheckoutSettingsRequest;
30+
31+
/**
32+
* Creates `CheckoutSettings` for the given merchant.
33+
*
34+
* @param string $formattedParent The merchant account for which the `CheckoutSettings` will be
35+
* created. Please see
36+
* {@see CheckoutSettingsServiceClient::programName()} for help formatting this field.
37+
*/
38+
function create_checkout_settings_sample(string $formattedParent): void
39+
{
40+
// Create a client.
41+
$checkoutSettingsServiceClient = new CheckoutSettingsServiceClient();
42+
43+
// Prepare the request message.
44+
$checkoutSettings = new CheckoutSettings();
45+
$request = (new CreateCheckoutSettingsRequest())
46+
->setParent($formattedParent)
47+
->setCheckoutSettings($checkoutSettings);
48+
49+
// Call the API and handle any network failures.
50+
try {
51+
/** @var CheckoutSettings $response */
52+
$response = $checkoutSettingsServiceClient->createCheckoutSettings($request);
53+
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
54+
} catch (ApiException $ex) {
55+
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
56+
}
57+
}
58+
59+
/**
60+
* Helper to execute the sample.
61+
*
62+
* This sample has been automatically generated and should be regarded as a code
63+
* template only. It will require modifications to work:
64+
* - It may require correct/in-range values for request initialization.
65+
* - It may require specifying regional endpoints when creating the service client,
66+
* please see the apiEndpoint client configuration option for more details.
67+
*/
68+
function callSample(): void
69+
{
70+
$formattedParent = CheckoutSettingsServiceClient::programName('[ACCOUNT]', '[PROGRAM]');
71+
72+
create_checkout_settings_sample($formattedParent);
73+
}
74+
// [END merchantapi_v1beta_generated_CheckoutSettingsService_CreateCheckoutSettings_sync]
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
<?php
2+
/*
3+
* Copyright 2025 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* https://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
/*
19+
* GENERATED CODE WARNING
20+
* This file was automatically generated - do not edit!
21+
*/
22+
23+
require_once __DIR__ . '/../../../vendor/autoload.php';
24+
25+
// [START merchantapi_v1beta_generated_CheckoutSettingsService_DeleteCheckoutSettings_sync]
26+
use Google\ApiCore\ApiException;
27+
use Google\Shopping\Merchant\Accounts\V1beta\Client\CheckoutSettingsServiceClient;
28+
use Google\Shopping\Merchant\Accounts\V1beta\DeleteCheckoutSettingsRequest;
29+
30+
/**
31+
* Deletes `CheckoutSettings` and unenrolls merchant from
32+
* `Checkout` program.
33+
*
34+
* @param string $formattedName The name/identifier of the merchant account.
35+
* Format: `accounts/{account}/programs/{program}/checkoutSettings`
36+
* Please see {@see CheckoutSettingsServiceClient::checkoutSettingsName()} for help formatting this field.
37+
*/
38+
function delete_checkout_settings_sample(string $formattedName): void
39+
{
40+
// Create a client.
41+
$checkoutSettingsServiceClient = new CheckoutSettingsServiceClient();
42+
43+
// Prepare the request message.
44+
$request = (new DeleteCheckoutSettingsRequest())
45+
->setName($formattedName);
46+
47+
// Call the API and handle any network failures.
48+
try {
49+
$checkoutSettingsServiceClient->deleteCheckoutSettings($request);
50+
printf('Call completed successfully.' . PHP_EOL);
51+
} catch (ApiException $ex) {
52+
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
53+
}
54+
}
55+
56+
/**
57+
* Helper to execute the sample.
58+
*
59+
* This sample has been automatically generated and should be regarded as a code
60+
* template only. It will require modifications to work:
61+
* - It may require correct/in-range values for request initialization.
62+
* - It may require specifying regional endpoints when creating the service client,
63+
* please see the apiEndpoint client configuration option for more details.
64+
*/
65+
function callSample(): void
66+
{
67+
$formattedName = CheckoutSettingsServiceClient::checkoutSettingsName('[ACCOUNT]', '[PROGRAM]');
68+
69+
delete_checkout_settings_sample($formattedName);
70+
}
71+
// [END merchantapi_v1beta_generated_CheckoutSettingsService_DeleteCheckoutSettings_sync]
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<?php
2+
/*
3+
* Copyright 2025 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* https://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
/*
19+
* GENERATED CODE WARNING
20+
* This file was automatically generated - do not edit!
21+
*/
22+
23+
require_once __DIR__ . '/../../../vendor/autoload.php';
24+
25+
// [START merchantapi_v1beta_generated_CheckoutSettingsService_GetCheckoutSettings_sync]
26+
use Google\ApiCore\ApiException;
27+
use Google\Shopping\Merchant\Accounts\V1beta\CheckoutSettings;
28+
use Google\Shopping\Merchant\Accounts\V1beta\Client\CheckoutSettingsServiceClient;
29+
use Google\Shopping\Merchant\Accounts\V1beta\GetCheckoutSettingsRequest;
30+
31+
/**
32+
* Gets `CheckoutSettings` for the given merchant. This includes
33+
* information about review state, enrollment state and URL settings.
34+
*
35+
* @param string $formattedName The name/identifier of the merchant account.
36+
* Format: `accounts/{account}/programs/{program}/checkoutSettings`
37+
* Please see {@see CheckoutSettingsServiceClient::checkoutSettingsName()} for help formatting this field.
38+
*/
39+
function get_checkout_settings_sample(string $formattedName): void
40+
{
41+
// Create a client.
42+
$checkoutSettingsServiceClient = new CheckoutSettingsServiceClient();
43+
44+
// Prepare the request message.
45+
$request = (new GetCheckoutSettingsRequest())
46+
->setName($formattedName);
47+
48+
// Call the API and handle any network failures.
49+
try {
50+
/** @var CheckoutSettings $response */
51+
$response = $checkoutSettingsServiceClient->getCheckoutSettings($request);
52+
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
53+
} catch (ApiException $ex) {
54+
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
55+
}
56+
}
57+
58+
/**
59+
* Helper to execute the sample.
60+
*
61+
* This sample has been automatically generated and should be regarded as a code
62+
* template only. It will require modifications to work:
63+
* - It may require correct/in-range values for request initialization.
64+
* - It may require specifying regional endpoints when creating the service client,
65+
* please see the apiEndpoint client configuration option for more details.
66+
*/
67+
function callSample(): void
68+
{
69+
$formattedName = CheckoutSettingsServiceClient::checkoutSettingsName('[ACCOUNT]', '[PROGRAM]');
70+
71+
get_checkout_settings_sample($formattedName);
72+
}
73+
// [END merchantapi_v1beta_generated_CheckoutSettingsService_GetCheckoutSettings_sync]
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<?php
2+
/*
3+
* Copyright 2025 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* https://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
/*
19+
* GENERATED CODE WARNING
20+
* This file was automatically generated - do not edit!
21+
*/
22+
23+
require_once __DIR__ . '/../../../vendor/autoload.php';
24+
25+
// [START merchantapi_v1beta_generated_CheckoutSettingsService_UpdateCheckoutSettings_sync]
26+
use Google\ApiCore\ApiException;
27+
use Google\Protobuf\FieldMask;
28+
use Google\Shopping\Merchant\Accounts\V1beta\CheckoutSettings;
29+
use Google\Shopping\Merchant\Accounts\V1beta\Client\CheckoutSettingsServiceClient;
30+
use Google\Shopping\Merchant\Accounts\V1beta\UpdateCheckoutSettingsRequest;
31+
32+
/**
33+
* Updates `CheckoutSettings` for the given merchant.
34+
*
35+
* This sample has been automatically generated and should be regarded as a code
36+
* template only. It will require modifications to work:
37+
* - It may require correct/in-range values for request initialization.
38+
* - It may require specifying regional endpoints when creating the service client,
39+
* please see the apiEndpoint client configuration option for more details.
40+
*/
41+
function update_checkout_settings_sample(): void
42+
{
43+
// Create a client.
44+
$checkoutSettingsServiceClient = new CheckoutSettingsServiceClient();
45+
46+
// Prepare the request message.
47+
$checkoutSettings = new CheckoutSettings();
48+
$updateMask = new FieldMask();
49+
$request = (new UpdateCheckoutSettingsRequest())
50+
->setCheckoutSettings($checkoutSettings)
51+
->setUpdateMask($updateMask);
52+
53+
// Call the API and handle any network failures.
54+
try {
55+
/** @var CheckoutSettings $response */
56+
$response = $checkoutSettingsServiceClient->updateCheckoutSettings($request);
57+
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
58+
} catch (ApiException $ex) {
59+
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
60+
}
61+
}
62+
// [END merchantapi_v1beta_generated_CheckoutSettingsService_UpdateCheckoutSettings_sync]

0 commit comments

Comments
 (0)