// Copyright 2022 Luca Casonato. All rights reserved. MIT license. /** * Payments Reseller Subscription API Client for Deno * ================================================== * * * * Docs: https://developers.google.com/payments/reseller/subscription/ * Source: https://googleapis.deno.dev/v1/paymentsresellersubscription:v1.ts */ import { auth, CredentialsClient, GoogleAuth, request } from "/_/base@v1/mod.ts"; export { auth, GoogleAuth }; export type { CredentialsClient }; export class PaymentsResellerSubscription { #client: CredentialsClient | undefined; #baseUrl: string; constructor(client?: CredentialsClient, baseUrl: string = "https://paymentsresellersubscription.googleapis.com/") { this.#client = client; this.#baseUrl = baseUrl; } /** * To retrieve the products that can be resold by the partner. It should be * autenticated with a service account. - This API doesn't apply to YouTube * products currently. * * @param parent Required. The parent, the partner that can resell. Format: partners/{partner} */ async partnersProductsList(parent: string, opts: PartnersProductsListOptions = {}): Promise { const url = new URL(`${this.#baseUrl}v1/${ parent }/products`); if (opts.filter !== undefined) { url.searchParams.append("filter", String(opts.filter)); } if (opts.pageSize !== undefined) { url.searchParams.append("pageSize", String(opts.pageSize)); } if (opts.pageToken !== undefined) { url.searchParams.append("pageToken", String(opts.pageToken)); } const data = await request(url.href, { client: this.#client, method: "GET", }); return deserializeGoogleCloudPaymentsResellerSubscriptionV1ListProductsResponse(data); } /** * To find eligible promotions for the current user. The API requires user * authorization via OAuth. The bare minimum oauth scope `openid` is * sufficient, which will skip the consent screen. * * @param parent Required. The parent, the partner that can resell. Format: partners/{partner} */ async partnersPromotionsFindEligible(parent: string, req: GoogleCloudPaymentsResellerSubscriptionV1FindEligiblePromotionsRequest): Promise { const url = new URL(`${this.#baseUrl}v1/${ parent }/promotions:findEligible`); const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "POST", body, }); return deserializeGoogleCloudPaymentsResellerSubscriptionV1FindEligiblePromotionsResponse(data); } /** * Retrieves the promotions, such as free trial, that can be used by the * partner. - This API doesn't apply to YouTube promotions currently. It * should be autenticated with a service account. * * @param parent Required. The parent, the partner that can resell. Format: partners/{partner} */ async partnersPromotionsList(parent: string, opts: PartnersPromotionsListOptions = {}): Promise { const url = new URL(`${this.#baseUrl}v1/${ parent }/promotions`); if (opts.filter !== undefined) { url.searchParams.append("filter", String(opts.filter)); } if (opts.pageSize !== undefined) { url.searchParams.append("pageSize", String(opts.pageSize)); } if (opts.pageToken !== undefined) { url.searchParams.append("pageToken", String(opts.pageToken)); } const data = await request(url.href, { client: this.#client, method: "GET", }); return deserializeGoogleCloudPaymentsResellerSubscriptionV1ListPromotionsResponse(data); } /** * Used by partners to cancel a subscription service either immediately or by * the end of the current billing cycle for their customers. It should be * called directly by the partner using service accounts. * * @param name Required. The name of the subscription resource to be cancelled. It will have the format of "partners/{partner_id}/subscriptions/{subscription_id}" */ async partnersSubscriptionsCancel(name: string, req: GoogleCloudPaymentsResellerSubscriptionV1CancelSubscriptionRequest): Promise { const url = new URL(`${this.#baseUrl}v1/${ name }:cancel`); const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "POST", body, }); return deserializeGoogleCloudPaymentsResellerSubscriptionV1CancelSubscriptionResponse(data); } /** * Used by partners to create a subscription for their customers. The created * subscription is associated with the end user inferred from the end user * credentials. This API must be authorized by the end user using OAuth. * * @param parent Required. The parent resource name, which is the identifier of the partner. It will have the format of "partners/{partner_id}". */ async partnersSubscriptionsCreate(parent: string, req: GoogleCloudPaymentsResellerSubscriptionV1Subscription, opts: PartnersSubscriptionsCreateOptions = {}): Promise { req = serializeGoogleCloudPaymentsResellerSubscriptionV1Subscription(req); const url = new URL(`${this.#baseUrl}v1/${ parent }/subscriptions`); if (opts.subscriptionId !== undefined) { url.searchParams.append("subscriptionId", String(opts.subscriptionId)); } const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "POST", body, }); return deserializeGoogleCloudPaymentsResellerSubscriptionV1Subscription(data); } /** * Used by partners to entitle a previously provisioned subscription to the * current end user. The end user identity is inferred from the authorized * credential of the request. This API must be authorized by the end user * using OAuth. * * @param name Required. The name of the subscription resource that is entitled to the current end user. It will have the format of "partners/{partner_id}/subscriptions/{subscription_id}" */ async partnersSubscriptionsEntitle(name: string, req: GoogleCloudPaymentsResellerSubscriptionV1EntitleSubscriptionRequest): Promise { const url = new URL(`${this.#baseUrl}v1/${ name }:entitle`); const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "POST", body, }); return deserializeGoogleCloudPaymentsResellerSubscriptionV1EntitleSubscriptionResponse(data); } /** * [Opt-in only] Most partners should be on auto-extend by default. Used by * partners to extend a subscription service for their customers on an ongoing * basis for the subscription to remain active and renewable. It should be * called directly by the partner using service accounts. * * @param name Required. The name of the subscription resource to be extended. It will have the format of "partners/{partner_id}/subscriptions/{subscription_id}". */ async partnersSubscriptionsExtend(name: string, req: GoogleCloudPaymentsResellerSubscriptionV1ExtendSubscriptionRequest): Promise { const url = new URL(`${this.#baseUrl}v1/${ name }:extend`); const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "POST", body, }); return deserializeGoogleCloudPaymentsResellerSubscriptionV1ExtendSubscriptionResponse(data); } /** * Used by partners to get a subscription by id. It should be called directly * by the partner using service accounts. * * @param name Required. The name of the subscription resource to retrieve. It will have the format of "partners/{partner_id}/subscriptions/{subscription_id}" */ async partnersSubscriptionsGet(name: string): Promise { const url = new URL(`${this.#baseUrl}v1/${ name }`); const data = await request(url.href, { client: this.#client, method: "GET", }); return deserializeGoogleCloudPaymentsResellerSubscriptionV1Subscription(data); } /** * Used by partners to provision a subscription for their customers. This * creates a subscription without associating it with the end user account. * EntitleSubscription must be called separately using OAuth in order for the * end user account to be associated with the subscription. It should be * called directly by the partner using service accounts. * * @param parent Required. The parent resource name, which is the identifier of the partner. It will have the format of "partners/{partner_id}". */ async partnersSubscriptionsProvision(parent: string, req: GoogleCloudPaymentsResellerSubscriptionV1Subscription, opts: PartnersSubscriptionsProvisionOptions = {}): Promise { req = serializeGoogleCloudPaymentsResellerSubscriptionV1Subscription(req); const url = new URL(`${this.#baseUrl}v1/${ parent }/subscriptions:provision`); if (opts.subscriptionId !== undefined) { url.searchParams.append("subscriptionId", String(opts.subscriptionId)); } const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "POST", body, }); return deserializeGoogleCloudPaymentsResellerSubscriptionV1Subscription(data); } /** * Revokes the pending cancellation of a subscription, which is currently in * `STATE_CANCEL_AT_END_OF_CYCLE` state. If the subscription is already * cancelled, the request will fail. - **This API doesn't apply to YouTube * subscriptions.** It should be called directly by the partner using service * accounts. * * @param name Required. The name of the subscription resource whose pending cancellation needs to be undone. It will have the format of "partners/{partner_id}/subscriptions/{subscription_id}" */ async partnersSubscriptionsUndoCancel(name: string, req: GoogleCloudPaymentsResellerSubscriptionV1UndoCancelSubscriptionRequest): Promise { const url = new URL(`${this.#baseUrl}v1/${ name }:undoCancel`); const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "POST", body, }); return deserializeGoogleCloudPaymentsResellerSubscriptionV1UndoCancelSubscriptionResponse(data); } /** * This API replaces user authorized OAuth consent based APIs (Create, * Entitle). Generates a short-lived token for a user session based on the * user intent. You can use the session token to redirect the user to Google * to finish the signup flow. You can re-generate new session token repeatedly * for the same request if necessary, regardless of the previous tokens being * expired or not. * * @param parent Required. The parent, the partner that can resell. Format: partners/{partner} */ async partnersUserSessionsGenerate(parent: string, req: GoogleCloudPaymentsResellerSubscriptionV1GenerateUserSessionRequest): Promise { req = serializeGoogleCloudPaymentsResellerSubscriptionV1GenerateUserSessionRequest(req); const url = new URL(`${this.#baseUrl}v1/${ parent }/userSessions:generate`); const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "POST", body, }); return data as GoogleCloudPaymentsResellerSubscriptionV1GenerateUserSessionResponse; } } /** * Describes the amount unit including the currency code. */ export interface GoogleCloudPaymentsResellerSubscriptionV1Amount { /** * Required. Amount in micros (1_000_000 micros = 1 currency unit) */ amountMicros?: bigint; /** * Required. Currency codes in accordance with [ISO-4217 Currency Codes] * (https://en.wikipedia.org/wiki/ISO_4217). For example, USD. */ currencyCode?: string; } function serializeGoogleCloudPaymentsResellerSubscriptionV1Amount(data: any): GoogleCloudPaymentsResellerSubscriptionV1Amount { return { ...data, amountMicros: data["amountMicros"] !== undefined ? String(data["amountMicros"]) : undefined, }; } function deserializeGoogleCloudPaymentsResellerSubscriptionV1Amount(data: any): GoogleCloudPaymentsResellerSubscriptionV1Amount { return { ...data, amountMicros: data["amountMicros"] !== undefined ? BigInt(data["amountMicros"]) : undefined, }; } /** * Request to cancel a subscription. */ export interface GoogleCloudPaymentsResellerSubscriptionV1CancelSubscriptionRequest { /** * Optional. If true, Google will cancel the subscription immediately, and * may or may not (based on the contract) issue a prorated refund for the * remainder of the billing cycle. Otherwise, Google defers the cancelation at * renewal_time, and will not issue a refund. - YouTube subscriptions must use * this option currently. However, the user will still have access to the * subscription until the end of the billing cycle. */ cancelImmediately?: boolean; /** * Specifies the reason for the cancellation. */ cancellationReason?: | "CANCELLATION_REASON_UNSPECIFIED" | "CANCELLATION_REASON_FRAUD" | "CANCELLATION_REASON_REMORSE" | "CANCELLATION_REASON_ACCIDENTAL_PURCHASE" | "CANCELLATION_REASON_PAST_DUE" | "CANCELLATION_REASON_ACCOUNT_CLOSED" | "CANCELLATION_REASON_UPGRADE_DOWNGRADE" | "CANCELLATION_REASON_USER_DELINQUENCY" | "CANCELLATION_REASON_SYSTEM_ERROR" | "CANCELLATION_REASON_SYSTEM_CANCEL" | "CANCELLATION_REASON_OTHER"; } /** * Response that contains the cancelled subscription resource. */ export interface GoogleCloudPaymentsResellerSubscriptionV1CancelSubscriptionResponse { /** * The cancelled subscription resource. */ subscription?: GoogleCloudPaymentsResellerSubscriptionV1Subscription; } function serializeGoogleCloudPaymentsResellerSubscriptionV1CancelSubscriptionResponse(data: any): GoogleCloudPaymentsResellerSubscriptionV1CancelSubscriptionResponse { return { ...data, subscription: data["subscription"] !== undefined ? serializeGoogleCloudPaymentsResellerSubscriptionV1Subscription(data["subscription"]) : undefined, }; } function deserializeGoogleCloudPaymentsResellerSubscriptionV1CancelSubscriptionResponse(data: any): GoogleCloudPaymentsResellerSubscriptionV1CancelSubscriptionResponse { return { ...data, subscription: data["subscription"] !== undefined ? deserializeGoogleCloudPaymentsResellerSubscriptionV1Subscription(data["subscription"]) : undefined, }; } /** * Intent message for creating a Subscription resource. */ export interface GoogleCloudPaymentsResellerSubscriptionV1CreateSubscriptionIntent { /** * Required. The parent resource name, which is the identifier of the * partner. */ parent?: string; /** * Required. The Subscription to be created. */ subscription?: GoogleCloudPaymentsResellerSubscriptionV1Subscription; /** * Required. Identifies the subscription resource on the Partner side. The * value is restricted to 63 ASCII characters at the maximum. If a * subscription was previously created with the same subscription_id, we will * directly return that one. */ subscriptionId?: string; } function serializeGoogleCloudPaymentsResellerSubscriptionV1CreateSubscriptionIntent(data: any): GoogleCloudPaymentsResellerSubscriptionV1CreateSubscriptionIntent { return { ...data, subscription: data["subscription"] !== undefined ? serializeGoogleCloudPaymentsResellerSubscriptionV1Subscription(data["subscription"]) : undefined, }; } function deserializeGoogleCloudPaymentsResellerSubscriptionV1CreateSubscriptionIntent(data: any): GoogleCloudPaymentsResellerSubscriptionV1CreateSubscriptionIntent { return { ...data, subscription: data["subscription"] !== undefined ? deserializeGoogleCloudPaymentsResellerSubscriptionV1Subscription(data["subscription"]) : undefined, }; } /** * Describes the length of a period of a time. */ export interface GoogleCloudPaymentsResellerSubscriptionV1Duration { /** * number of duration units to be included. */ count?: number; /** * The unit used for the duration */ unit?: | "UNIT_UNSPECIFIED" | "MONTH" | "DAY" | "HOUR"; } /** * Intent for entitling the previously provisioned subscription to an end user. */ export interface GoogleCloudPaymentsResellerSubscriptionV1EntitleSubscriptionIntent { /** * Required. The name of the subscription resource that is entitled to the * current end user. */ name?: string; } /** * Partner request for entitling the previously provisioned subscription to an * end user. The end user identity is inferred from the request OAuth context. */ export interface GoogleCloudPaymentsResellerSubscriptionV1EntitleSubscriptionRequest { /** * Optional. The line items to be entitled. If unspecified, all line items * will be entitled. */ lineItemEntitlementDetails?: GoogleCloudPaymentsResellerSubscriptionV1EntitleSubscriptionRequestLineItemEntitlementDetails[]; } /** * The details of the line item to be entitled. */ export interface GoogleCloudPaymentsResellerSubscriptionV1EntitleSubscriptionRequestLineItemEntitlementDetails { /** * Required. The index of the line item to be entitled. */ lineItemIndex?: number; /** * Optional. Only applicable if the line item corresponds to a hard bundle. * Product resource names that identify the bundle elements to be entitled in * the line item. If unspecified, all bundle elements will be entitled. The * format is 'partners/{partner_id}/products/{product_id}'. */ products?: string[]; } /** * Response that contains the entitled subscription resource. */ export interface GoogleCloudPaymentsResellerSubscriptionV1EntitleSubscriptionResponse { /** * The subscription that has user linked to it. */ subscription?: GoogleCloudPaymentsResellerSubscriptionV1Subscription; } function serializeGoogleCloudPaymentsResellerSubscriptionV1EntitleSubscriptionResponse(data: any): GoogleCloudPaymentsResellerSubscriptionV1EntitleSubscriptionResponse { return { ...data, subscription: data["subscription"] !== undefined ? serializeGoogleCloudPaymentsResellerSubscriptionV1Subscription(data["subscription"]) : undefined, }; } function deserializeGoogleCloudPaymentsResellerSubscriptionV1EntitleSubscriptionResponse(data: any): GoogleCloudPaymentsResellerSubscriptionV1EntitleSubscriptionResponse { return { ...data, subscription: data["subscription"] !== undefined ? deserializeGoogleCloudPaymentsResellerSubscriptionV1Subscription(data["subscription"]) : undefined, }; } /** * Request message for extending a Subscription resource. A new recurrence will * be made based on the subscription schedule defined by the original product. */ export interface GoogleCloudPaymentsResellerSubscriptionV1ExtendSubscriptionRequest { /** * Required. Specifies details of the extension. Currently, the duration of * the extension must be exactly one billing cycle of the original * subscription. */ extension?: GoogleCloudPaymentsResellerSubscriptionV1Extension; /** * Required. Restricted to 36 ASCII characters. A random UUID is recommended. * The idempotency key for the request. The ID generation logic is controlled * by the partner. request_id should be the same as on retries of the same * request. A different request_id must be used for a extension of a different * cycle. */ requestId?: string; } /** * Response that contains the timestamps after the extension. */ export interface GoogleCloudPaymentsResellerSubscriptionV1ExtendSubscriptionResponse { /** * The time at which the subscription is expected to be extended, in ISO 8061 * format. UTC timezone. Example, "cycleEndTime":"2019-08-31T17:28:54.564Z" */ cycleEndTime?: Date; /** * End of the free trial period, in ISO 8061 format. UTC timezone. Example, * "freeTrialEndTime":"2019-08-31T17:28:54.564Z" This time will be set the * same as initial subscription creation time if no free trial period is * offered to the partner. */ freeTrialEndTime?: Date; /** * Output only. The time at which the subscription is expected to be renewed * by Google - a new charge will be incurred and the service entitlement will * be renewed. A non-immediate cancellation will take place at this time too, * before which, the service entitlement for the end user will remain valid. * UTC timezone in ISO 8061 format. For example: "2019-08-31T17:28:54.564Z" */ readonly renewalTime?: Date; } function serializeGoogleCloudPaymentsResellerSubscriptionV1ExtendSubscriptionResponse(data: any): GoogleCloudPaymentsResellerSubscriptionV1ExtendSubscriptionResponse { return { ...data, cycleEndTime: data["cycleEndTime"] !== undefined ? data["cycleEndTime"].toISOString() : undefined, freeTrialEndTime: data["freeTrialEndTime"] !== undefined ? data["freeTrialEndTime"].toISOString() : undefined, }; } function deserializeGoogleCloudPaymentsResellerSubscriptionV1ExtendSubscriptionResponse(data: any): GoogleCloudPaymentsResellerSubscriptionV1ExtendSubscriptionResponse { return { ...data, cycleEndTime: data["cycleEndTime"] !== undefined ? new Date(data["cycleEndTime"]) : undefined, freeTrialEndTime: data["freeTrialEndTime"] !== undefined ? new Date(data["freeTrialEndTime"]) : undefined, renewalTime: data["renewalTime"] !== undefined ? new Date(data["renewalTime"]) : undefined, }; } /** * Describes the details of an extension request. */ export interface GoogleCloudPaymentsResellerSubscriptionV1Extension { /** * Required. Specifies the period of access the subscription should grant. */ duration?: GoogleCloudPaymentsResellerSubscriptionV1Duration; /** * Required. Identifier of the end-user in partner’s system. */ partnerUserToken?: string; } /** * Request to find eligible promotions for the current user. */ export interface GoogleCloudPaymentsResellerSubscriptionV1FindEligiblePromotionsRequest { /** * Optional. Specifies the filters for the promotion results. The syntax is * defined in https://google.aip.dev/160 with the following caveats: 1. Only * the following features are supported: - Logical operator `AND` - Comparison * operator `=` (no wildcards `*`) - Traversal operator `.` - Has operator `:` * (no wildcards `*`) 2. Only the following fields are supported: - * `applicableProducts` - `regionCodes` - * `youtubePayload.partnerEligibilityId` - `youtubePayload.postalCode` 3. * Unless explicitly mentioned above, other features are not supported. * Example: `applicableProducts:partners/partner1/products/product1 AND * regionCodes:US AND youtubePayload.postalCode=94043 AND * youtubePayload.partnerEligibilityId=eligibility-id` */ filter?: string; /** * Optional. The maximum number of promotions to return. The service may * return fewer than this value. If unspecified, at most 50 products will be * returned. The maximum value is 1000; values above 1000 will be coerced to * 1000. */ pageSize?: number; /** * Optional. A page token, received from a previous `ListPromotions` call. * Provide this to retrieve the subsequent page. When paginating, all other * parameters provided to `ListPromotions` must match the call that provided * the page token. */ pageToken?: string; } /** * Response containing the found promotions for the current user. */ export interface GoogleCloudPaymentsResellerSubscriptionV1FindEligiblePromotionsResponse { /** * A token, which can be sent as `page_token` to retrieve the next page. If * this field is empty, there are no subsequent pages. */ nextPageToken?: string; /** * The promotions for the current user. */ promotions?: GoogleCloudPaymentsResellerSubscriptionV1Promotion[]; } function serializeGoogleCloudPaymentsResellerSubscriptionV1FindEligiblePromotionsResponse(data: any): GoogleCloudPaymentsResellerSubscriptionV1FindEligiblePromotionsResponse { return { ...data, promotions: data["promotions"] !== undefined ? data["promotions"].map((item: any) => (serializeGoogleCloudPaymentsResellerSubscriptionV1Promotion(item))) : undefined, }; } function deserializeGoogleCloudPaymentsResellerSubscriptionV1FindEligiblePromotionsResponse(data: any): GoogleCloudPaymentsResellerSubscriptionV1FindEligiblePromotionsResponse { return { ...data, promotions: data["promotions"] !== undefined ? data["promotions"].map((item: any) => (deserializeGoogleCloudPaymentsResellerSubscriptionV1Promotion(item))) : undefined, }; } /** * Details for a subscriptiin line item with finite billing cycles. */ export interface GoogleCloudPaymentsResellerSubscriptionV1FiniteBillingCycleDetails { /** * Required. The number of a subscription line item billing cycles after * which billing will stop automatically. */ billingCycleCountLimit?: bigint; } function serializeGoogleCloudPaymentsResellerSubscriptionV1FiniteBillingCycleDetails(data: any): GoogleCloudPaymentsResellerSubscriptionV1FiniteBillingCycleDetails { return { ...data, billingCycleCountLimit: data["billingCycleCountLimit"] !== undefined ? String(data["billingCycleCountLimit"]) : undefined, }; } function deserializeGoogleCloudPaymentsResellerSubscriptionV1FiniteBillingCycleDetails(data: any): GoogleCloudPaymentsResellerSubscriptionV1FiniteBillingCycleDetails { return { ...data, billingCycleCountLimit: data["billingCycleCountLimit"] !== undefined ? BigInt(data["billingCycleCountLimit"]) : undefined, }; } /** * [Preview only] Request to generate a user session. */ export interface GoogleCloudPaymentsResellerSubscriptionV1GenerateUserSessionRequest { /** * The user intent to generate the user session. */ intentPayload?: GoogleCloudPaymentsResellerSubscriptionV1IntentPayload; } function serializeGoogleCloudPaymentsResellerSubscriptionV1GenerateUserSessionRequest(data: any): GoogleCloudPaymentsResellerSubscriptionV1GenerateUserSessionRequest { return { ...data, intentPayload: data["intentPayload"] !== undefined ? serializeGoogleCloudPaymentsResellerSubscriptionV1IntentPayload(data["intentPayload"]) : undefined, }; } function deserializeGoogleCloudPaymentsResellerSubscriptionV1GenerateUserSessionRequest(data: any): GoogleCloudPaymentsResellerSubscriptionV1GenerateUserSessionRequest { return { ...data, intentPayload: data["intentPayload"] !== undefined ? deserializeGoogleCloudPaymentsResellerSubscriptionV1IntentPayload(data["intentPayload"]) : undefined, }; } /** * [Preview only] Response that contains the details for generated user * session. */ export interface GoogleCloudPaymentsResellerSubscriptionV1GenerateUserSessionResponse { /** * The generated user session. The token size is proportional to the size of * the intent payload. */ userSession?: GoogleCloudPaymentsResellerSubscriptionV1UserSession; } /** * Payload specific to Google One products. */ export interface GoogleCloudPaymentsResellerSubscriptionV1GoogleOnePayload { /** * Campaign attributed to sales of this subscription. */ campaigns?: string[]; /** * The type of offering the subscription was sold by the partner. e.g. VAS. */ offering?: | "OFFERING_UNSPECIFIED" | "OFFERING_VAS_BUNDLE" | "OFFERING_VAS_STANDALONE" | "OFFERING_HARD_BUNDLE" | "OFFERING_SOFT_BUNDLE"; /** * The type of sales channel through which the subscription was sold. */ salesChannel?: | "CHANNEL_UNSPECIFIED" | "CHANNEL_RETAIL" | "CHANNEL_ONLINE_WEB" | "CHANNEL_ONLINE_ANDROID_APP" | "CHANNEL_ONLINE_IOS_APP"; /** * The identifier for the partner store where the subscription was sold. */ storeId?: string; } /** * The payload that describes the user intent. */ export interface GoogleCloudPaymentsResellerSubscriptionV1IntentPayload { /** * The request to create a subscription. */ createIntent?: GoogleCloudPaymentsResellerSubscriptionV1CreateSubscriptionIntent; /** * The request to entitle a subscription. */ entitleIntent?: GoogleCloudPaymentsResellerSubscriptionV1EntitleSubscriptionIntent; } function serializeGoogleCloudPaymentsResellerSubscriptionV1IntentPayload(data: any): GoogleCloudPaymentsResellerSubscriptionV1IntentPayload { return { ...data, createIntent: data["createIntent"] !== undefined ? serializeGoogleCloudPaymentsResellerSubscriptionV1CreateSubscriptionIntent(data["createIntent"]) : undefined, }; } function deserializeGoogleCloudPaymentsResellerSubscriptionV1IntentPayload(data: any): GoogleCloudPaymentsResellerSubscriptionV1IntentPayload { return { ...data, createIntent: data["createIntent"] !== undefined ? deserializeGoogleCloudPaymentsResellerSubscriptionV1CreateSubscriptionIntent(data["createIntent"]) : undefined, }; } /** * Response that contains the products. */ export interface GoogleCloudPaymentsResellerSubscriptionV1ListProductsResponse { /** * A token, which can be sent as `page_token` to retrieve the next page. If * this field is empty, there are no subsequent pages. */ nextPageToken?: string; /** * The products for the specified partner. */ products?: GoogleCloudPaymentsResellerSubscriptionV1Product[]; } function serializeGoogleCloudPaymentsResellerSubscriptionV1ListProductsResponse(data: any): GoogleCloudPaymentsResellerSubscriptionV1ListProductsResponse { return { ...data, products: data["products"] !== undefined ? data["products"].map((item: any) => (serializeGoogleCloudPaymentsResellerSubscriptionV1Product(item))) : undefined, }; } function deserializeGoogleCloudPaymentsResellerSubscriptionV1ListProductsResponse(data: any): GoogleCloudPaymentsResellerSubscriptionV1ListProductsResponse { return { ...data, products: data["products"] !== undefined ? data["products"].map((item: any) => (deserializeGoogleCloudPaymentsResellerSubscriptionV1Product(item))) : undefined, }; } /** * Response that contains the promotions. */ export interface GoogleCloudPaymentsResellerSubscriptionV1ListPromotionsResponse { /** * A token, which can be sent as `page_token` to retrieve the next page. If * this field is empty, there are no subsequent pages. */ nextPageToken?: string; /** * The promotions for the specified partner. */ promotions?: GoogleCloudPaymentsResellerSubscriptionV1Promotion[]; } function serializeGoogleCloudPaymentsResellerSubscriptionV1ListPromotionsResponse(data: any): GoogleCloudPaymentsResellerSubscriptionV1ListPromotionsResponse { return { ...data, promotions: data["promotions"] !== undefined ? data["promotions"].map((item: any) => (serializeGoogleCloudPaymentsResellerSubscriptionV1Promotion(item))) : undefined, }; } function deserializeGoogleCloudPaymentsResellerSubscriptionV1ListPromotionsResponse(data: any): GoogleCloudPaymentsResellerSubscriptionV1ListPromotionsResponse { return { ...data, promotions: data["promotions"] !== undefined ? data["promotions"].map((item: any) => (deserializeGoogleCloudPaymentsResellerSubscriptionV1Promotion(item))) : undefined, }; } /** * Describes a location of an end user. */ export interface GoogleCloudPaymentsResellerSubscriptionV1Location { /** * The postal code this location refers to. Ex. "94043" */ postalCode?: string; /** * 2-letter ISO region code for current content region. Ex. “US” Please * refers to: https://en.wikipedia.org/wiki/ISO_3166-1 */ regionCode?: string; } /** * A Product resource that defines a subscription service that can be resold. */ export interface GoogleCloudPaymentsResellerSubscriptionV1Product { /** * Output only. Output Only. Specifies the details for a bundle product. */ readonly bundleDetails?: ProductBundleDetails; /** * Optional. Details for a subscription line item with finite billing cycles. * If unset, the line item will be charged indefinitely. */ finiteBillingCycleDetails?: GoogleCloudPaymentsResellerSubscriptionV1FiniteBillingCycleDetails; /** * Identifier. Response only. Resource name of the product. It will have the * format of "partners/{partner_id}/products/{product_id}" */ name?: string; /** * Output only. Price configs for the product in the available regions. */ readonly priceConfigs?: GoogleCloudPaymentsResellerSubscriptionV1ProductPriceConfig[]; /** * Output only. Output Only. Specifies the type of the product. */ readonly productType?: | "PRODUCT_TYPE_UNSPECIFIED" | "PRODUCT_TYPE_SUBSCRIPTION" | "PRODUCT_TYPE_BUNDLE_SUBSCRIPTION"; /** * Output only. 2-letter ISO region code where the product is available in. * Ex. "US" Please refers to: https://en.wikipedia.org/wiki/ISO_3166-1 */ readonly regionCodes?: string[]; /** * Output only. Specifies the length of the billing cycle of the * subscription. */ readonly subscriptionBillingCycleDuration?: GoogleCloudPaymentsResellerSubscriptionV1Duration; /** * Output only. Localized human readable name of the product. */ readonly titles?: GoogleTypeLocalizedText[]; } function serializeGoogleCloudPaymentsResellerSubscriptionV1Product(data: any): GoogleCloudPaymentsResellerSubscriptionV1Product { return { ...data, finiteBillingCycleDetails: data["finiteBillingCycleDetails"] !== undefined ? serializeGoogleCloudPaymentsResellerSubscriptionV1FiniteBillingCycleDetails(data["finiteBillingCycleDetails"]) : undefined, }; } function deserializeGoogleCloudPaymentsResellerSubscriptionV1Product(data: any): GoogleCloudPaymentsResellerSubscriptionV1Product { return { ...data, finiteBillingCycleDetails: data["finiteBillingCycleDetails"] !== undefined ? deserializeGoogleCloudPaymentsResellerSubscriptionV1FiniteBillingCycleDetails(data["finiteBillingCycleDetails"]) : undefined, }; } /** * The individual product that is included in the bundle. */ export interface GoogleCloudPaymentsResellerSubscriptionV1ProductBundleDetailsBundleElement { /** * Required. Output only. Product resource name that identifies the bundle * element. The format is 'partners/{partner_id}/products/{product_id}'. */ readonly product?: string; } /** * Specifies product specific payload. */ export interface GoogleCloudPaymentsResellerSubscriptionV1ProductPayload { /** * Product-specific payloads. Payload specific to Google One products. */ googleOnePayload?: GoogleCloudPaymentsResellerSubscriptionV1GoogleOnePayload; /** * Payload specific to Youtube products. */ youtubePayload?: GoogleCloudPaymentsResellerSubscriptionV1YoutubePayload; } /** * Configs the prices in an available region. */ export interface GoogleCloudPaymentsResellerSubscriptionV1ProductPriceConfig { /** * Output only. The price in the region. */ readonly amount?: GoogleCloudPaymentsResellerSubscriptionV1Amount; /** * Output only. 2-letter ISO region code where the product is available in. * Ex. "US". */ readonly regionCode?: string; } /** * A Promotion resource that defines a promotion for a subscription that can be * resold. */ export interface GoogleCloudPaymentsResellerSubscriptionV1Promotion { /** * Output only. The product ids this promotion can be applied to. */ readonly applicableProducts?: string[]; /** * Optional. Specifies the end time (exclusive) of the period that the * promotion is available in. If unset, the promotion is available * indefinitely. */ endTime?: Date; /** * Optional. Specifies the duration of the free trial of the subscription * when promotion_type is PROMOTION_TYPE_FREE_TRIAL */ freeTrialDuration?: GoogleCloudPaymentsResellerSubscriptionV1Duration; /** * Optional. Specifies the introductory pricing details when the * promotion_type is PROMOTION_TYPE_INTRODUCTORY_PRICING. */ introductoryPricingDetails?: GoogleCloudPaymentsResellerSubscriptionV1PromotionIntroductoryPricingDetails; /** * Identifier. Response only. Resource name of the subscription promotion. It * will have the format of "partners/{partner_id}/promotion/{promotion_id}" */ name?: string; /** * Output only. Output Only. Specifies the type of the promotion. */ readonly promotionType?: | "PROMOTION_TYPE_UNSPECIFIED" | "PROMOTION_TYPE_FREE_TRIAL" | "PROMOTION_TYPE_INTRODUCTORY_PRICING"; /** * Output only. 2-letter ISO region code where the promotion is available in. * Ex. "US" Please refers to: https://en.wikipedia.org/wiki/ISO_3166-1 */ readonly regionCodes?: string[]; /** * Optional. Specifies the start time (inclusive) of the period that the * promotion is available in. */ startTime?: Date; /** * Output only. Localized human readable name of the promotion. */ readonly titles?: GoogleTypeLocalizedText[]; } function serializeGoogleCloudPaymentsResellerSubscriptionV1Promotion(data: any): GoogleCloudPaymentsResellerSubscriptionV1Promotion { return { ...data, endTime: data["endTime"] !== undefined ? data["endTime"].toISOString() : undefined, startTime: data["startTime"] !== undefined ? data["startTime"].toISOString() : undefined, }; } function deserializeGoogleCloudPaymentsResellerSubscriptionV1Promotion(data: any): GoogleCloudPaymentsResellerSubscriptionV1Promotion { return { ...data, endTime: data["endTime"] !== undefined ? new Date(data["endTime"]) : undefined, startTime: data["startTime"] !== undefined ? new Date(data["startTime"]) : undefined, }; } /** * The details of a introductory pricing promotion. */ export interface GoogleCloudPaymentsResellerSubscriptionV1PromotionIntroductoryPricingDetails { /** * Output only. Specifies the introductory pricing periods. */ readonly introductoryPricingSpecs?: GoogleCloudPaymentsResellerSubscriptionV1PromotionIntroductoryPricingDetailsIntroductoryPricingSpec[]; } /** * The duration of an introductory pricing promotion. */ export interface GoogleCloudPaymentsResellerSubscriptionV1PromotionIntroductoryPricingDetailsIntroductoryPricingSpec { /** * Output only. The discount amount. The value is positive. */ readonly discountAmount?: GoogleCloudPaymentsResellerSubscriptionV1Amount; /** * Output only. The discount percentage in micros. For example, 50,000 * represents 5%. */ readonly discountRatioMicros?: bigint; /** * Output only. Output Only. The duration of an introductory offer in billing * cycles. */ readonly recurrenceCount?: number; /** * Output only. 2-letter ISO region code where the product is available in. * Ex. "US". */ readonly regionCode?: string; } /** * A description of what time period or moment in time the product or service * is being delivered over. */ export interface GoogleCloudPaymentsResellerSubscriptionV1ServicePeriod { /** * Optional. The end time of the service period. Time is exclusive. */ endTime?: Date; /** * Required. The start time of the service period. Time is inclusive. */ startTime?: Date; } function serializeGoogleCloudPaymentsResellerSubscriptionV1ServicePeriod(data: any): GoogleCloudPaymentsResellerSubscriptionV1ServicePeriod { return { ...data, endTime: data["endTime"] !== undefined ? data["endTime"].toISOString() : undefined, startTime: data["startTime"] !== undefined ? data["startTime"].toISOString() : undefined, }; } function deserializeGoogleCloudPaymentsResellerSubscriptionV1ServicePeriod(data: any): GoogleCloudPaymentsResellerSubscriptionV1ServicePeriod { return { ...data, endTime: data["endTime"] !== undefined ? new Date(data["endTime"]) : undefined, startTime: data["startTime"] !== undefined ? new Date(data["startTime"]) : undefined, }; } /** * A subscription serves as a central billing entity between an external * partner and Google. The underlying Google services rely on the subscription * state to grant or revoke the user's service entitlement. It's important to * note that the subscription state may not always perfectly align with the * user's service entitlement. For example, some Google services may continue * providing access to the user until the current billing cycle ends, even if * the subscription has been immediately canceled. However, other services may * not do the same. To fully understand the specific details, please consult the * relevant contract or product policy. */ export interface GoogleCloudPaymentsResellerSubscriptionV1Subscription { /** * Output only. Describes the details of a cancelled subscription. Only * applicable to subscription of state `STATE_CANCELLED`. */ readonly cancellationDetails?: GoogleCloudPaymentsResellerSubscriptionV1SubscriptionCancellationDetails; /** * Output only. System generated timestamp when the subscription is created. * UTC timezone. */ readonly createTime?: Date; /** * Output only. The time at which the subscription is expected to be * extended, in ISO 8061 format. UTC timezone. For example: * "2019-08-31T17:28:54.564Z" */ readonly cycleEndTime?: Date; /** * Output only. Indicates if the subscription is entitled to the end user. */ readonly endUserEntitled?: boolean; /** * Output only. End of the free trial period, in ISO 8061 format. For * example, "2019-08-31T17:28:54.564Z". It will be set the same as createTime * if no free trial promotion is specified. */ readonly freeTrialEndTime?: Date; /** * Required. The line items of the subscription. */ lineItems?: GoogleCloudPaymentsResellerSubscriptionV1SubscriptionLineItem[]; /** * Identifier. Resource name of the subscription. It will have the format of * "partners/{partner_id}/subscriptions/{subscription_id}". This is available * for authorizeAddon, but otherwise is response only. */ name?: string; /** * Required. Identifier of the end-user in partner’s system. The value is * restricted to 63 ASCII characters at the maximum. */ partnerUserToken?: string; /** * Output only. Describes the processing state of the subscription. See more * details at [the lifecycle of a * subscription](/payments/reseller/subscription/reference/index/Receive.Notifications#payments-subscription-lifecycle). */ readonly processingState?: | "PROCESSING_STATE_UNSPECIFIED" | "PROCESSING_STATE_CANCELLING" | "PROCESSING_STATE_RECURRING"; /** * Optional. Deprecated: consider using `line_items` as the input. Required. * Resource name that identifies the purchased products. The format will be * 'partners/{partner_id}/products/{product_id}'. */ products?: string[]; /** * Optional. Deprecated: consider using the top-level `promotion_specs` as * the input. Optional. Resource name that identifies one or more promotions * that can be applied on the product. A typical promotion for a subscription * is Free trial. The format will be * 'partners/{partner_id}/promotions/{promotion_id}'. */ promotions?: string[]; /** * Optional. Subscription-level promotions. Only free trial is supported on * this level. It determines the first renewal time of the subscription to be * the end of the free trial period. Specify the promotion resource name only * when used as input. */ promotionSpecs?: GoogleCloudPaymentsResellerSubscriptionV1SubscriptionPromotionSpec[]; /** * Optional. The timestamp when the user transaction was made with the * Partner. Specify for the case of "bundle with choice", and it must be * before the provision_time (when the user makes a selection). */ purchaseTime?: Date; /** * Output only. The place where partners should redirect the end-user to * after creation. This field might also be populated when creation failed. * However, Partners should always prepare a default URL to redirect the user * in case this field is empty. */ readonly redirectUri?: string; /** * Output only. The time at which the subscription is expected to be renewed * by Google - a new charge will be incurred and the service entitlement will * be renewed. A non-immediate cancellation will take place at this time too, * before which, the service entitlement for the end user will remain valid. * UTC timezone in ISO 8061 format. For example: "2019-08-31T17:28:54.564Z" */ readonly renewalTime?: Date; /** * Required. The location that the service is provided as indicated by the * partner. */ serviceLocation?: GoogleCloudPaymentsResellerSubscriptionV1Location; /** * Output only. Describes the state of the subscription. See more details at * [the lifecycle of a * subscription](/payments/reseller/subscription/reference/index/Receive.Notifications#payments-subscription-lifecycle). */ readonly state?: | "STATE_UNSPECIFIED" | "STATE_CREATED" | "STATE_ACTIVE" | "STATE_CANCELLED" | "STATE_IN_GRACE_PERIOD" | "STATE_CANCEL_AT_END_OF_CYCLE" | "STATE_SUSPENDED"; /** * Output only. System generated timestamp when the subscription is most * recently updated. UTC timezone. */ readonly updateTime?: Date; /** * Optional. Details about the previous subscription that this new * subscription upgrades/downgrades from. Only populated if this subscription * is an upgrade/downgrade from another subscription. */ upgradeDowngradeDetails?: GoogleCloudPaymentsResellerSubscriptionV1SubscriptionUpgradeDowngradeDetails; } function serializeGoogleCloudPaymentsResellerSubscriptionV1Subscription(data: any): GoogleCloudPaymentsResellerSubscriptionV1Subscription { return { ...data, lineItems: data["lineItems"] !== undefined ? data["lineItems"].map((item: any) => (serializeGoogleCloudPaymentsResellerSubscriptionV1SubscriptionLineItem(item))) : undefined, purchaseTime: data["purchaseTime"] !== undefined ? data["purchaseTime"].toISOString() : undefined, }; } function deserializeGoogleCloudPaymentsResellerSubscriptionV1Subscription(data: any): GoogleCloudPaymentsResellerSubscriptionV1Subscription { return { ...data, createTime: data["createTime"] !== undefined ? new Date(data["createTime"]) : undefined, cycleEndTime: data["cycleEndTime"] !== undefined ? new Date(data["cycleEndTime"]) : undefined, freeTrialEndTime: data["freeTrialEndTime"] !== undefined ? new Date(data["freeTrialEndTime"]) : undefined, lineItems: data["lineItems"] !== undefined ? data["lineItems"].map((item: any) => (deserializeGoogleCloudPaymentsResellerSubscriptionV1SubscriptionLineItem(item))) : undefined, purchaseTime: data["purchaseTime"] !== undefined ? new Date(data["purchaseTime"]) : undefined, renewalTime: data["renewalTime"] !== undefined ? new Date(data["renewalTime"]) : undefined, updateTime: data["updateTime"] !== undefined ? new Date(data["updateTime"]) : undefined, }; } /** * Describes the details of a cancelled or cancelling subscription. */ export interface GoogleCloudPaymentsResellerSubscriptionV1SubscriptionCancellationDetails { /** * Output only. The reason of the cancellation. */ readonly reason?: | "CANCELLATION_REASON_UNSPECIFIED" | "CANCELLATION_REASON_FRAUD" | "CANCELLATION_REASON_REMORSE" | "CANCELLATION_REASON_ACCIDENTAL_PURCHASE" | "CANCELLATION_REASON_PAST_DUE" | "CANCELLATION_REASON_ACCOUNT_CLOSED" | "CANCELLATION_REASON_UPGRADE_DOWNGRADE" | "CANCELLATION_REASON_USER_DELINQUENCY" | "CANCELLATION_REASON_SYSTEM_ERROR" | "CANCELLATION_REASON_SYSTEM_CANCEL" | "CANCELLATION_REASON_OTHER"; } /** * Individual line item definition of a subscription. */ export interface GoogleCloudPaymentsResellerSubscriptionV1SubscriptionLineItem { /** * Output only. The price of the product/service in this line item. The * amount could be the wholesale price, or it can include a cost of sale based * on the contract. */ readonly amount?: GoogleCloudPaymentsResellerSubscriptionV1Amount; /** * Output only. The bundle details for the line item. Only populated if the * line item corresponds to a hard bundle. */ readonly bundleDetails?: SubscriptionLineItemBundleDetails; /** * Output only. Description of this line item. */ readonly description?: string; /** * Optional. Details for a subscription line item with finite billing cycles. * If unset, the line item will be charged indefinitely. Used only with * LINE_ITEM_RECURRENCE_TYPE_PERIODIC. */ finiteBillingCycleDetails?: GoogleCloudPaymentsResellerSubscriptionV1FiniteBillingCycleDetails; /** * Output only. The free trial end time will be populated after the line item * is successfully processed. End time of the line item free trial period, in * ISO 8061 format. For example, "2019-08-31T17:28:54.564Z". It will be set * the same as createTime if no free trial promotion is specified. */ readonly lineItemFreeTrialEndTime?: Date; /** * Output only. A unique index of the subscription line item. */ readonly lineItemIndex?: number; /** * Optional. The promotions applied on the line item. It can be: - an * introductory pricing promotion. - a free trial promotion. This feature is * not enabled. If used, the request will be rejected. When used as input in * Create or Provision API, specify its resource name only. */ lineItemPromotionSpecs?: GoogleCloudPaymentsResellerSubscriptionV1SubscriptionPromotionSpec[]; /** * Output only. Details only set for a ONE_TIME recurrence line item. */ readonly oneTimeRecurrenceDetails?: GoogleCloudPaymentsResellerSubscriptionV1SubscriptionLineItemOneTimeRecurrenceDetails; /** * Required. Product resource name that identifies one the line item The * format is 'partners/{partner_id}/products/{product_id}'. */ product?: string; /** * Optional. Product specific payload for this line item. */ productPayload?: GoogleCloudPaymentsResellerSubscriptionV1ProductPayload; /** * Output only. The recurrence type of the line item. */ readonly recurrenceType?: | "LINE_ITEM_RECURRENCE_TYPE_UNSPECIFIED" | "LINE_ITEM_RECURRENCE_TYPE_PERIODIC" | "LINE_ITEM_RECURRENCE_TYPE_ONE_TIME"; /** * Output only. The state of the line item. */ readonly state?: | "LINE_ITEM_STATE_UNSPECIFIED" | "LINE_ITEM_STATE_ACTIVE" | "LINE_ITEM_STATE_INACTIVE" | "LINE_ITEM_STATE_NEW" | "LINE_ITEM_STATE_ACTIVATING" | "LINE_ITEM_STATE_DEACTIVATING" | "LINE_ITEM_STATE_WAITING_TO_DEACTIVATE" | "LINE_ITEM_STATE_OFF_CYCLE_CHARGING"; } function serializeGoogleCloudPaymentsResellerSubscriptionV1SubscriptionLineItem(data: any): GoogleCloudPaymentsResellerSubscriptionV1SubscriptionLineItem { return { ...data, finiteBillingCycleDetails: data["finiteBillingCycleDetails"] !== undefined ? serializeGoogleCloudPaymentsResellerSubscriptionV1FiniteBillingCycleDetails(data["finiteBillingCycleDetails"]) : undefined, }; } function deserializeGoogleCloudPaymentsResellerSubscriptionV1SubscriptionLineItem(data: any): GoogleCloudPaymentsResellerSubscriptionV1SubscriptionLineItem { return { ...data, amount: data["amount"] !== undefined ? deserializeGoogleCloudPaymentsResellerSubscriptionV1Amount(data["amount"]) : undefined, finiteBillingCycleDetails: data["finiteBillingCycleDetails"] !== undefined ? deserializeGoogleCloudPaymentsResellerSubscriptionV1FiniteBillingCycleDetails(data["finiteBillingCycleDetails"]) : undefined, lineItemFreeTrialEndTime: data["lineItemFreeTrialEndTime"] !== undefined ? new Date(data["lineItemFreeTrialEndTime"]) : undefined, }; } /** * The details for an element in the hard bundle. */ export interface GoogleCloudPaymentsResellerSubscriptionV1SubscriptionLineItemBundleDetailsBundleElementDetails { /** * Output only. Product resource name that identifies the bundle element. The * format is 'partners/{partner_id}/products/{product_id}'. */ readonly product?: string; /** * Output only. The time when this product is linked to an end user. */ readonly userAccountLinkedTime?: Date; } /** * Details for a ONE_TIME recurrence line item. */ export interface GoogleCloudPaymentsResellerSubscriptionV1SubscriptionLineItemOneTimeRecurrenceDetails { /** * Output only. The service period of the ONE_TIME line item. */ readonly servicePeriod?: GoogleCloudPaymentsResellerSubscriptionV1ServicePeriod; } /** * Describes the spec for one promotion. */ export interface GoogleCloudPaymentsResellerSubscriptionV1SubscriptionPromotionSpec { /** * Output only. The duration of the free trial if the promotion is of type * FREE_TRIAL. */ readonly freeTrialDuration?: GoogleCloudPaymentsResellerSubscriptionV1Duration; /** * Output only. The details of the introductory pricing spec if the promotion * is of type INTRODUCTORY_PRICING. */ readonly introductoryPricingDetails?: GoogleCloudPaymentsResellerSubscriptionV1PromotionIntroductoryPricingDetails; /** * Required. Promotion resource name that identifies a promotion. The format * is 'partners/{partner_id}/promotions/{promotion_id}'. */ promotion?: string; /** * Output only. The type of the promotion for the spec. */ readonly type?: | "PROMOTION_TYPE_UNSPECIFIED" | "PROMOTION_TYPE_FREE_TRIAL" | "PROMOTION_TYPE_INTRODUCTORY_PRICING"; } /** * Details about the previous subscription that this new subscription * upgrades/downgrades from. */ export interface GoogleCloudPaymentsResellerSubscriptionV1SubscriptionUpgradeDowngradeDetails { /** * Required. Specifies the billing cycle spec for the new upgraded/downgraded * subscription. */ billingCycleSpec?: | "BILLING_CYCLE_SPEC_UNSPECIFIED" | "BILLING_CYCLE_SPEC_ALIGN_WITH_PREVIOUS_SUBSCRIPTION" | "BILLING_CYCLE_SPEC_START_IMMEDIATELY"; /** * Required. The previous subscription id to be replaced. This is not the * full resource name, use the subscription_id segment only. */ previousSubscriptionId?: string; } /** * Request to revoke a cancellation request. */ export interface GoogleCloudPaymentsResellerSubscriptionV1UndoCancelSubscriptionRequest { } /** * Response that contains the updated subscription resource. */ export interface GoogleCloudPaymentsResellerSubscriptionV1UndoCancelSubscriptionResponse { /** * The updated subscription resource. */ subscription?: GoogleCloudPaymentsResellerSubscriptionV1Subscription; } function serializeGoogleCloudPaymentsResellerSubscriptionV1UndoCancelSubscriptionResponse(data: any): GoogleCloudPaymentsResellerSubscriptionV1UndoCancelSubscriptionResponse { return { ...data, subscription: data["subscription"] !== undefined ? serializeGoogleCloudPaymentsResellerSubscriptionV1Subscription(data["subscription"]) : undefined, }; } function deserializeGoogleCloudPaymentsResellerSubscriptionV1UndoCancelSubscriptionResponse(data: any): GoogleCloudPaymentsResellerSubscriptionV1UndoCancelSubscriptionResponse { return { ...data, subscription: data["subscription"] !== undefined ? deserializeGoogleCloudPaymentsResellerSubscriptionV1Subscription(data["subscription"]) : undefined, }; } /** * A user session contains a short-lived token that includes information * required to interact with Google Payments Reseller Platform using the * following web endpoints. - A user session token should be generated * dynamically for an authenticated user. You should refrain from sharing a * token directly with a user in an unauthenticated context, such as SMS, or * email. - You can re-generate new session tokens repeatedly for same * `generate` request if necessary, regardless of the previous tokens being * expired or not. You don't need to worry about multiple sessions resulting in * duplicate fulfillments as guaranteed by the same subscription id. Please * refer to the [Google Managed * Signup](/payments/reseller/subscription/reference/index/User.Signup.Integration/Google.Managed.Signup.\(In.Preview\)) * documentation for additional integration details. */ export interface GoogleCloudPaymentsResellerSubscriptionV1UserSession { /** * Output only. The time at which the user session expires. */ readonly expireTime?: Date; /** * Output only. The encrypted token of the user session, including the * information of the user's intent and request. This token should be provided * when redirecting the user to Google. */ readonly token?: string; } /** * Payload specific to Youtube products. */ export interface GoogleCloudPaymentsResellerSubscriptionV1YoutubePayload { /** * Output only. The access expiration time for this line item. */ readonly accessEndTime?: Date; /** * The list of eligibility_ids which are applicable for the line item. */ partnerEligibilityIds?: string[]; /** * Optional. Specifies the plan type offered to the end user by the partner. */ partnerPlanType?: | "PARTNER_PLAN_TYPE_UNSPECIFIED" | "PARTNER_PLAN_TYPE_STANDALONE" | "PARTNER_PLAN_TYPE_HARD_BUNDLE" | "PARTNER_PLAN_TYPE_SOFT_BUNDLE"; } /** * Localized variant of a text in a particular language. */ export interface GoogleTypeLocalizedText { /** * The text's BCP-47 language code, such as "en-US" or "sr-Latn". For more * information, see * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. */ languageCode?: string; /** * Localized string in the language corresponding to language_code below. */ text?: string; } /** * Additional options for PaymentsResellerSubscription#partnersProductsList. */ export interface PartnersProductsListOptions { /** * Optional. Specifies the filters for the product results. The syntax is * defined in https://google.aip.dev/160 with the following caveats: 1. Only * the following features are supported: - Logical operator `AND` - Comparison * operator `=` (no wildcards `*`) - Traversal operator `.` - Has operator `:` * (no wildcards `*`) 2. Only the following fields are supported: - * `regionCodes` - `youtubePayload.partnerEligibilityId` - * `youtubePayload.postalCode` 3. Unless explicitly mentioned above, other * features are not supported. Example: `regionCodes:US AND * youtubePayload.postalCode=94043 AND * youtubePayload.partnerEligibilityId=eligibility-id` */ filter?: string; /** * Optional. The maximum number of products to return. The service may return * fewer than this value. If unspecified, at most 50 products will be * returned. The maximum value is 1000; values above 1000 will be coerced to * 1000. */ pageSize?: number; /** * Optional. A page token, received from a previous `ListProducts` call. * Provide this to retrieve the subsequent page. When paginating, all other * parameters provided to `ListProducts` must match the call that provided the * page token. */ pageToken?: string; } /** * Additional options for PaymentsResellerSubscription#partnersPromotionsList. */ export interface PartnersPromotionsListOptions { /** * Optional. Specifies the filters for the promotion results. The syntax is * defined in https://google.aip.dev/160 with the following caveats: 1. Only * the following features are supported: - Logical operator `AND` - Comparison * operator `=` (no wildcards `*`) - Traversal operator `.` - Has operator `:` * (no wildcards `*`) 2. Only the following fields are supported: - * `applicableProducts` - `regionCodes` - * `youtubePayload.partnerEligibilityId` - `youtubePayload.postalCode` 3. * Unless explicitly mentioned above, other features are not supported. * Example: `applicableProducts:partners/partner1/products/product1 AND * regionCodes:US AND youtubePayload.postalCode=94043 AND * youtubePayload.partnerEligibilityId=eligibility-id` */ filter?: string; /** * Optional. The maximum number of promotions to return. The service may * return fewer than this value. If unspecified, at most 50 products will be * returned. The maximum value is 1000; values above 1000 will be coerced to * 1000. */ pageSize?: number; /** * Optional. A page token, received from a previous `ListPromotions` call. * Provide this to retrieve the subsequent page. When paginating, all other * parameters provided to `ListPromotions` must match the call that provided * the page token. */ pageToken?: string; } /** * Additional options for * PaymentsResellerSubscription#partnersSubscriptionsCreate. */ export interface PartnersSubscriptionsCreateOptions { /** * Required. Identifies the subscription resource on the Partner side. The * value is restricted to 63 ASCII characters at the maximum. If a * subscription was previously created with the same subscription_id, we will * directly return that one. */ subscriptionId?: string; } /** * Additional options for * PaymentsResellerSubscription#partnersSubscriptionsProvision. */ export interface PartnersSubscriptionsProvisionOptions { /** * Required. Identifies the subscription resource on the Partner side. The * value is restricted to 63 ASCII characters at the maximum. If a * subscription was previously created with the same subscription_id, we will * directly return that one. */ subscriptionId?: string; } /** * Details for a bundle product. */ export interface ProductBundleDetails { /** * The individual products that are included in the bundle. */ bundleElements?: GoogleCloudPaymentsResellerSubscriptionV1ProductBundleDetailsBundleElement[]; /** * The entitlement mode of the bundle product. */ entitlementMode?: | "ENTITLEMENT_MODE_UNSPECIFIED" | "ENTITLEMENT_MODE_FULL" | "ENTITLEMENT_MODE_INCREMENTAL"; } /** * The bundle details for a line item corresponding to a hard bundle. */ export interface SubscriptionLineItemBundleDetails { /** * Output only. The details for each element in the hard bundle. */ readonly bundleElementDetails?: GoogleCloudPaymentsResellerSubscriptionV1SubscriptionLineItemBundleDetailsBundleElementDetails[]; }