1<?php
2/*
3 * Copyright 2014 Google Inc.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
6 * use this file except in compliance with the License. You may obtain a copy of
7 * the License at
8 *
9 * http://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, WITHOUT
13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 * License for the specific language governing permissions and limitations under
15 * the License.
16 */
17
18namespace Google\Service\AndroidPublisher\Resource;
19
20use Google\Service\AndroidPublisher\ProductPurchase;
21use Google\Service\AndroidPublisher\ProductPurchasesAcknowledgeRequest;
22
23/**
24 * The "products" collection of methods.
25 * Typical usage is:
26 *  <code>
27 *   $androidpublisherService = new Google\Service\AndroidPublisher(...);
28 *   $products = $androidpublisherService->products;
29 *  </code>
30 */
31class PurchasesProducts extends \Google\Service\Resource
32{
33  /**
34   * Acknowledges a purchase of an inapp item. (products.acknowledge)
35   *
36   * @param string $packageName The package name of the application the inapp
37   * product was sold in (for example, 'com.some.thing').
38   * @param string $productId The inapp product SKU (for example,
39   * 'com.some.thing.inapp1').
40   * @param string $token The token provided to the user's device when the inapp
41   * product was purchased.
42   * @param ProductPurchasesAcknowledgeRequest $postBody
43   * @param array $optParams Optional parameters.
44   */
45  public function acknowledge($packageName, $productId, $token, ProductPurchasesAcknowledgeRequest $postBody, $optParams = [])
46  {
47    $params = ['packageName' => $packageName, 'productId' => $productId, 'token' => $token, 'postBody' => $postBody];
48    $params = array_merge($params, $optParams);
49    return $this->call('acknowledge', [$params]);
50  }
51  /**
52   * Checks the purchase and consumption status of an inapp item. (products.get)
53   *
54   * @param string $packageName The package name of the application the inapp
55   * product was sold in (for example, 'com.some.thing').
56   * @param string $productId The inapp product SKU (for example,
57   * 'com.some.thing.inapp1').
58   * @param string $token The token provided to the user's device when the inapp
59   * product was purchased.
60   * @param array $optParams Optional parameters.
61   * @return ProductPurchase
62   */
63  public function get($packageName, $productId, $token, $optParams = [])
64  {
65    $params = ['packageName' => $packageName, 'productId' => $productId, 'token' => $token];
66    $params = array_merge($params, $optParams);
67    return $this->call('get', [$params], ProductPurchase::class);
68  }
69}
70
71// Adding a class alias for backwards compatibility with the previous class name.
72class_alias(PurchasesProducts::class, 'Google_Service_AndroidPublisher_Resource_PurchasesProducts');
73