[e3d4e0a] | 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 |
|
---|
| 18 | namespace Google\Service\AndroidPublisher\Resource;
|
---|
| 19 |
|
---|
| 20 | use Google\Service\AndroidPublisher\SubscriptionPurchase;
|
---|
| 21 | use Google\Service\AndroidPublisher\SubscriptionPurchasesAcknowledgeRequest;
|
---|
| 22 | use Google\Service\AndroidPublisher\SubscriptionPurchasesDeferRequest;
|
---|
| 23 | use Google\Service\AndroidPublisher\SubscriptionPurchasesDeferResponse;
|
---|
| 24 |
|
---|
| 25 | /**
|
---|
| 26 | * The "subscriptions" collection of methods.
|
---|
| 27 | * Typical usage is:
|
---|
| 28 | * <code>
|
---|
| 29 | * $androidpublisherService = new Google\Service\AndroidPublisher(...);
|
---|
| 30 | * $subscriptions = $androidpublisherService->purchases_subscriptions;
|
---|
| 31 | * </code>
|
---|
| 32 | */
|
---|
| 33 | class PurchasesSubscriptions extends \Google\Service\Resource
|
---|
| 34 | {
|
---|
| 35 | /**
|
---|
| 36 | * Acknowledges a subscription purchase. (subscriptions.acknowledge)
|
---|
| 37 | *
|
---|
| 38 | * @param string $packageName The package name of the application for which this
|
---|
| 39 | * subscription was purchased (for example, 'com.some.thing').
|
---|
| 40 | * @param string $subscriptionId The purchased subscription ID (for example,
|
---|
| 41 | * 'monthly001').
|
---|
| 42 | * @param string $token The token provided to the user's device when the
|
---|
| 43 | * subscription was purchased.
|
---|
| 44 | * @param SubscriptionPurchasesAcknowledgeRequest $postBody
|
---|
| 45 | * @param array $optParams Optional parameters.
|
---|
| 46 | * @throws \Google\Service\Exception
|
---|
| 47 | */
|
---|
| 48 | public function acknowledge($packageName, $subscriptionId, $token, SubscriptionPurchasesAcknowledgeRequest $postBody, $optParams = [])
|
---|
| 49 | {
|
---|
| 50 | $params = ['packageName' => $packageName, 'subscriptionId' => $subscriptionId, 'token' => $token, 'postBody' => $postBody];
|
---|
| 51 | $params = array_merge($params, $optParams);
|
---|
| 52 | return $this->call('acknowledge', [$params]);
|
---|
| 53 | }
|
---|
| 54 | /**
|
---|
| 55 | * Cancels a user's subscription purchase. The subscription remains valid until
|
---|
| 56 | * its expiration time. (subscriptions.cancel)
|
---|
| 57 | *
|
---|
| 58 | * @param string $packageName The package name of the application for which this
|
---|
| 59 | * subscription was purchased (for example, 'com.some.thing').
|
---|
| 60 | * @param string $subscriptionId The purchased subscription ID (for example,
|
---|
| 61 | * 'monthly001').
|
---|
| 62 | * @param string $token The token provided to the user's device when the
|
---|
| 63 | * subscription was purchased.
|
---|
| 64 | * @param array $optParams Optional parameters.
|
---|
| 65 | * @throws \Google\Service\Exception
|
---|
| 66 | */
|
---|
| 67 | public function cancel($packageName, $subscriptionId, $token, $optParams = [])
|
---|
| 68 | {
|
---|
| 69 | $params = ['packageName' => $packageName, 'subscriptionId' => $subscriptionId, 'token' => $token];
|
---|
| 70 | $params = array_merge($params, $optParams);
|
---|
| 71 | return $this->call('cancel', [$params]);
|
---|
| 72 | }
|
---|
| 73 | /**
|
---|
| 74 | * Defers a user's subscription purchase until a specified future expiration
|
---|
| 75 | * time. (subscriptions.defer)
|
---|
| 76 | *
|
---|
| 77 | * @param string $packageName The package name of the application for which this
|
---|
| 78 | * subscription was purchased (for example, 'com.some.thing').
|
---|
| 79 | * @param string $subscriptionId The purchased subscription ID (for example,
|
---|
| 80 | * 'monthly001').
|
---|
| 81 | * @param string $token The token provided to the user's device when the
|
---|
| 82 | * subscription was purchased.
|
---|
| 83 | * @param SubscriptionPurchasesDeferRequest $postBody
|
---|
| 84 | * @param array $optParams Optional parameters.
|
---|
| 85 | * @return SubscriptionPurchasesDeferResponse
|
---|
| 86 | * @throws \Google\Service\Exception
|
---|
| 87 | */
|
---|
| 88 | public function defer($packageName, $subscriptionId, $token, SubscriptionPurchasesDeferRequest $postBody, $optParams = [])
|
---|
| 89 | {
|
---|
| 90 | $params = ['packageName' => $packageName, 'subscriptionId' => $subscriptionId, 'token' => $token, 'postBody' => $postBody];
|
---|
| 91 | $params = array_merge($params, $optParams);
|
---|
| 92 | return $this->call('defer', [$params], SubscriptionPurchasesDeferResponse::class);
|
---|
| 93 | }
|
---|
| 94 | /**
|
---|
| 95 | * Checks whether a user's subscription purchase is valid and returns its expiry
|
---|
| 96 | * time. (subscriptions.get)
|
---|
| 97 | *
|
---|
| 98 | * @param string $packageName The package name of the application for which this
|
---|
| 99 | * subscription was purchased (for example, 'com.some.thing').
|
---|
| 100 | * @param string $subscriptionId The purchased subscription ID (for example,
|
---|
| 101 | * 'monthly001').
|
---|
| 102 | * @param string $token The token provided to the user's device when the
|
---|
| 103 | * subscription was purchased.
|
---|
| 104 | * @param array $optParams Optional parameters.
|
---|
| 105 | * @return SubscriptionPurchase
|
---|
| 106 | * @throws \Google\Service\Exception
|
---|
| 107 | */
|
---|
| 108 | public function get($packageName, $subscriptionId, $token, $optParams = [])
|
---|
| 109 | {
|
---|
| 110 | $params = ['packageName' => $packageName, 'subscriptionId' => $subscriptionId, 'token' => $token];
|
---|
| 111 | $params = array_merge($params, $optParams);
|
---|
| 112 | return $this->call('get', [$params], SubscriptionPurchase::class);
|
---|
| 113 | }
|
---|
| 114 | /**
|
---|
| 115 | * Refunds a user's subscription purchase, but the subscription remains valid
|
---|
| 116 | * until its expiration time and it will continue to recur.
|
---|
| 117 | * (subscriptions.refund)
|
---|
| 118 | *
|
---|
| 119 | * @param string $packageName The package name of the application for which this
|
---|
| 120 | * subscription was purchased (for example, 'com.some.thing').
|
---|
| 121 | * @param string $subscriptionId "The purchased subscription ID (for example,
|
---|
| 122 | * 'monthly001').
|
---|
| 123 | * @param string $token The token provided to the user's device when the
|
---|
| 124 | * subscription was purchased.
|
---|
| 125 | * @param array $optParams Optional parameters.
|
---|
| 126 | * @throws \Google\Service\Exception
|
---|
| 127 | */
|
---|
| 128 | public function refund($packageName, $subscriptionId, $token, $optParams = [])
|
---|
| 129 | {
|
---|
| 130 | $params = ['packageName' => $packageName, 'subscriptionId' => $subscriptionId, 'token' => $token];
|
---|
| 131 | $params = array_merge($params, $optParams);
|
---|
| 132 | return $this->call('refund', [$params]);
|
---|
| 133 | }
|
---|
| 134 | /**
|
---|
| 135 | * Refunds and immediately revokes a user's subscription purchase. Access to the
|
---|
| 136 | * subscription will be terminated immediately and it will stop recurring.
|
---|
| 137 | * (subscriptions.revoke)
|
---|
| 138 | *
|
---|
| 139 | * @param string $packageName The package name of the application for which this
|
---|
| 140 | * subscription was purchased (for example, 'com.some.thing').
|
---|
| 141 | * @param string $subscriptionId The purchased subscription ID (for example,
|
---|
| 142 | * 'monthly001').
|
---|
| 143 | * @param string $token The token provided to the user's device when the
|
---|
| 144 | * subscription was purchased.
|
---|
| 145 | * @param array $optParams Optional parameters.
|
---|
| 146 | * @throws \Google\Service\Exception
|
---|
| 147 | */
|
---|
| 148 | public function revoke($packageName, $subscriptionId, $token, $optParams = [])
|
---|
| 149 | {
|
---|
| 150 | $params = ['packageName' => $packageName, 'subscriptionId' => $subscriptionId, 'token' => $token];
|
---|
| 151 | $params = array_merge($params, $optParams);
|
---|
| 152 | return $this->call('revoke', [$params]);
|
---|
| 153 | }
|
---|
| 154 | }
|
---|
| 155 |
|
---|
| 156 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 157 | class_alias(PurchasesSubscriptions::class, 'Google_Service_AndroidPublisher_Resource_PurchasesSubscriptions');
|
---|