@sylphx/sdk 0.32.18 → 0.32.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/money.d.ts CHANGED
@@ -956,6 +956,11 @@ export interface GetStoreConnectionRequest {
956
956
  /** The name of the store connection to get. */
957
957
  name: string;
958
958
  }
959
+ /** The request of GetStoreConsumptionRequest. */
960
+ export interface GetStoreConsumptionRequestRequest {
961
+ /** The name of the store consumption request to get. */
962
+ name: string;
963
+ }
959
964
  /** The request of GetStorePurchase. */
960
965
  export interface GetStorePurchaseRequest {
961
966
  /** The name of the store purchase to get. */
@@ -1396,6 +1401,24 @@ export interface ListStoreConnectionsResponse {
1396
1401
  /** The token of the next page; empty on the last page. */
1397
1402
  nextPageToken?: string;
1398
1403
  }
1404
+ /** The request of ListStoreConsumptionRequests. */
1405
+ export interface ListStoreConsumptionRequestsRequest {
1406
+ /** The parent to list in. */
1407
+ parent: string;
1408
+ /** At most this many; default 50, clamped to 1000. */
1409
+ pageSize?: number;
1410
+ /** `next_page_token` of the previous page. */
1411
+ pageToken?: string;
1412
+ /** AIP-160 filter over `store`, `transaction_id`, `store_purchase`, `status`. */
1413
+ filter?: string;
1414
+ }
1415
+ /** The response of ListStoreConsumptionRequests. */
1416
+ export interface ListStoreConsumptionRequestsResponse {
1417
+ /** The page. */
1418
+ storeConsumptionRequests?: StoreConsumptionRequest[];
1419
+ /** The token of the next page; empty on the last page. */
1420
+ nextPageToken?: string;
1421
+ }
1399
1422
  /** The request of ListStorePurchases. */
1400
1423
  export interface ListStorePurchasesRequest {
1401
1424
  /** The parent to list in. */
@@ -1727,6 +1750,19 @@ export interface Product {
1727
1750
  * consumable product and on a product with a recurring price.
1728
1751
  */
1729
1752
  licence?: LicencePolicy;
1753
+ /** Exact App Store product id. Set together with `appstore_bundle_id`. */
1754
+ appstoreSku?: string;
1755
+ /** Exact Apple bundle id that scopes `appstore_sku`. */
1756
+ appstoreBundleId?: string;
1757
+ /** Exact Google Play product id. Set together with `googleplay_package_name`. */
1758
+ googleplaySku?: string;
1759
+ /** Exact Google Play package name that scopes `googleplay_sku`. */
1760
+ googleplayPackageName?: string;
1761
+ /**
1762
+ * Additional exact store/app/product bindings for this same product.
1763
+ * A binding may repeat on this product, but never on another product.
1764
+ */
1765
+ storeProductAliases?: StoreProductAlias[];
1730
1766
  }
1731
1767
  /** Records statement evidence and confirms only an exact, timely, unambiguous payment. */
1732
1768
  export interface RecordBankReceiptRequest {
@@ -1797,6 +1833,50 @@ export interface ReleaseUsageReservationRequest {
1797
1833
  /** The reservation to release. */
1798
1834
  name: string;
1799
1835
  }
1836
+ /** The request of ReportStorePurchaseUsage. */
1837
+ export interface ReportStorePurchaseUsageRequest {
1838
+ /** The store purchase to report usage for. */
1839
+ name: string;
1840
+ /**
1841
+ * Optional consumption request resource name when targeting a specific
1842
+ * captured `CONSUMPTION_REQUEST`.
1843
+ */
1844
+ consumptionRequest?: string;
1845
+ /**
1846
+ * Apple `deliveryStatus`: `DELIVERED`, `UNDELIVERED_QUALITY_ISSUE`,
1847
+ * `UNDELIVERED_WRONG_ITEM`, `UNDELIVERED_SERVER_OUTAGE`, or
1848
+ * `UNDELIVERED_OTHER`.
1849
+ */
1850
+ deliveryStatus: string;
1851
+ /**
1852
+ * Apple `sampleContentProvided`: whether a free sample or trial was offered.
1853
+ * Explicit presence is required so an omitted value is never defaulted.
1854
+ */
1855
+ sampleContentProvided: boolean;
1856
+ /**
1857
+ * Apple `consumptionPercentage` in milliunits (0..=100000, where 25000 is
1858
+ * 25%). Required for non-subscription purchases (0 when undelivered) and
1859
+ * omitted for auto-renewable subscriptions.
1860
+ */
1861
+ consumptionPercentage?: number;
1862
+ /**
1863
+ * Optional Apple `refundPreference`: `DECLINE`, `GRANT_FULL`, or
1864
+ * `GRANT_PRORATED`.
1865
+ */
1866
+ refundPreference?: string;
1867
+ /**
1868
+ * Non-empty attestation confirming the caller holds exclusive reporting
1869
+ * custody for this purchase (never a consent override).
1870
+ */
1871
+ custodyAttestation: string;
1872
+ }
1873
+ /** The response of ReportStorePurchaseUsage. */
1874
+ export interface ReportStorePurchaseUsageResponse {
1875
+ /** The updated store consumption request record. */
1876
+ storeConsumptionRequest?: StoreConsumptionRequest;
1877
+ /** The store purchase that was answered. */
1878
+ storePurchase?: StorePurchase;
1879
+ }
1800
1880
  /** Resolves held evidence without altering its original receipt. */
1801
1881
  export interface ResolveBankReceiptRequest {
1802
1882
  /** Receipt name. */
@@ -2203,6 +2283,69 @@ export interface StoreConnectionStatus {
2203
2283
  /** The service account's email, read from the stored key (Play only). */
2204
2284
  readonly serviceAccountEmail?: string;
2205
2285
  }
2286
+ /**
2287
+ * A Store Consumption Request is an Apple App Store Server Notifications V2
2288
+ * `CONSUMPTION_REQUEST` observed by Money, with its 12-hour deadline and
2289
+ * immutable dispatch status. Money never invents usage or consent facts and
2290
+ * sends nothing to Apple without a verified buyer consent grant.
2291
+ */
2292
+ export interface StoreConsumptionRequest {
2293
+ /** `orgs/{org}/projects/{project}/envs/{env}/store_consumption_requests/{store_consumption_request}`. */
2294
+ name?: string;
2295
+ /** `scr_<cell><ulid>`; never reused. */
2296
+ readonly uid?: string;
2297
+ /** Resource metadata. */
2298
+ meta?: common.ResourceMeta;
2299
+ /** Store name (`app_store`). */
2300
+ readonly store?: string;
2301
+ /** App Store bundle identifier. */
2302
+ readonly bundleId?: string;
2303
+ /** `production` or `sandbox`. */
2304
+ readonly environment?: string;
2305
+ /** App Store transaction identifier. */
2306
+ readonly transactionId?: string;
2307
+ /** App Store original transaction identifier. */
2308
+ readonly originalTransactionId?: string;
2309
+ /** Store notification UUID that opened this request. */
2310
+ readonly notificationId?: string;
2311
+ /** Apple's `consumptionRequestReason`, when present. */
2312
+ readonly consumptionRequestReason?: string;
2313
+ /** Linked StorePurchase resource name, when verified in Money. */
2314
+ readonly storePurchase?: string;
2315
+ /** Linked buyer subject, when known. */
2316
+ readonly subject?: Subject;
2317
+ /**
2318
+ * Current state: `pending`, `consent_missing`, `consent_withdrawn`,
2319
+ * `in_flight`, `sent`, `failed_retryable`, `failed_terminal`, or
2320
+ * `expired`.
2321
+ */
2322
+ readonly status?: string;
2323
+ /** When Money observed the notification. */
2324
+ readonly observedTime?: string;
2325
+ /** 12-hour Apple response deadline. */
2326
+ readonly deadlineTime?: string;
2327
+ /** Number of outbound Apple Send Consumption attempts started. */
2328
+ readonly attemptCount?: number;
2329
+ /** Timestamp of the last outbound Apple Send Consumption attempt. */
2330
+ readonly lastAttemptTime?: string;
2331
+ /** Timestamp when Apple accepted the consumption report (HTTP 202). */
2332
+ readonly sentTime?: string;
2333
+ /** HTTP status code returned by Apple's consumption endpoint (202 when sent). */
2334
+ readonly appleHttpStatus?: number;
2335
+ /** Last fail-closed refusal reason, when blocked before calling Apple. */
2336
+ readonly lastRefusalReason?: string;
2337
+ /** Consent ledger event id evaluated for the dispatch, when present. */
2338
+ readonly consentId?: string;
2339
+ }
2340
+ /** One exact provider namespace: no inferred suffixes or cross-app fallback. */
2341
+ export interface StoreProductAlias {
2342
+ /** app_store or google_play. */
2343
+ store?: string;
2344
+ /** Verified bundle id (Apple) or package name (Google Play). */
2345
+ appId?: string;
2346
+ /** Exact provider product id, not the catalog product key. */
2347
+ productId?: string;
2348
+ }
2206
2349
  /**
2207
2350
  * A Store Purchase is one store transaction Money verified with the store and
2208
2351
  * bound to one subject. Re-verifying it returns the same record and grant.
@@ -2836,6 +2979,8 @@ export declare class MoneyApi {
2836
2979
  readonly storeConnections: StoreConnectionsCollection;
2837
2980
  /** The `store_purchases` collection. */
2838
2981
  readonly storePurchases: StorePurchasesCollection;
2982
+ /** The `store_consumption_requests` collection. */
2983
+ readonly storeConsumptionRequests: StoreConsumptionRequestsCollection;
2839
2984
  /** The `customer_subscriptions` collection. */
2840
2985
  readonly customerSubscriptions: CustomerSubscriptionsCollection;
2841
2986
  /** The `entitlement_grants` collection. */
@@ -3196,6 +3341,41 @@ export declare class StorePurchasesCollection {
3196
3341
  list(request: ListStorePurchasesRequest): Promise<ListStorePurchasesResponse>;
3197
3342
  /** Every item of every page of `list`. */
3198
3343
  listAll(request: ListStorePurchasesRequest): AsyncGenerator<StorePurchase>;
3344
+ /**
3345
+ * Reports verified delivery and usage facts for an App Store purchase in
3346
+ * answer to an observed `CONSUMPTION_REQUEST`. Strictly fails closed (0
3347
+ * outbound Apple calls) unless Money's append-only buyer-authenticated
3348
+ * consent ledger holds an unwithdrawn `granted` decision for this purchase
3349
+ * or app.
3350
+ *
3351
+ * `POST /v1/{name=orgs/*\/projects/*\/envs/*\/store_purchases/*}:reportUsage` · permission `billing:write` · effect `write`
3352
+ *
3353
+ * Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `RESOURCE_NOT_FOUND`, `INVALID_FIELD`, `INVALID_STATE`, `UNAVAILABLE`, `IDEMPOTENCY_KEY_REUSED`, `IDEMPOTENCY_IN_PROGRESS`.
3354
+ */
3355
+ reportUsage(request: ReportStorePurchaseUsageRequest): Promise<ReportStorePurchaseUsageResponse>;
3356
+ }
3357
+ /** `store_consumption_requests` of Sylphx Money: Resource type `money.sylphx.com/StoreConsumptionRequest`. */
3358
+ export declare class StoreConsumptionRequestsCollection {
3359
+ private readonly client;
3360
+ constructor(client: runtime.Client);
3361
+ /**
3362
+ * Gets a captured store consumption request.
3363
+ *
3364
+ * `GET /v1/{name=orgs/*\/projects/*\/envs/*\/store_consumption_requests/*}` · permission `billing:read` · effect `read`
3365
+ *
3366
+ * Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `RESOURCE_NOT_FOUND`.
3367
+ */
3368
+ get(request: GetStoreConsumptionRequestRequest): Promise<StoreConsumptionRequest>;
3369
+ /**
3370
+ * Lists captured store consumption requests, newest first.
3371
+ *
3372
+ * `GET /v1/{parent=orgs/*\/projects/*\/envs/*}/store_consumption_requests` · permission `billing:read` · effect `read`
3373
+ *
3374
+ * Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `INVALID_FIELD`, `PAGE_TOKEN_MISMATCH`.
3375
+ */
3376
+ list(request: ListStoreConsumptionRequestsRequest): Promise<ListStoreConsumptionRequestsResponse>;
3377
+ /** Every item of every page of `list`. */
3378
+ listAll(request: ListStoreConsumptionRequestsRequest): AsyncGenerator<StoreConsumptionRequest>;
3199
3379
  }
3200
3380
  /** `customer_subscriptions` of Sylphx Money: Resource type `money.sylphx.com/CustomerSubscription`. */
3201
3381
  export declare class CustomerSubscriptionsCollection {
package/dist/money.js CHANGED
@@ -268,6 +268,7 @@ runtime.registerSchemas({
268
268
  ['currencyCode', 'currency_code'],
269
269
  ],
270
270
  'sylphx.money.v1.GetStoreConnectionRequest': [],
271
+ 'sylphx.money.v1.GetStoreConsumptionRequestRequest': [],
271
272
  'sylphx.money.v1.GetStorePurchaseRequest': [],
272
273
  'sylphx.money.v1.GetTestClockRequest': [],
273
274
  'sylphx.money.v1.GetUsageInvoiceRequest': [],
@@ -416,6 +417,14 @@ runtime.registerSchemas({
416
417
  ['storeConnections', 'store_connections', 'sylphx.money.v1.StoreConnection'],
417
418
  ['nextPageToken', 'next_page_token'],
418
419
  ],
420
+ 'sylphx.money.v1.ListStoreConsumptionRequestsRequest': [
421
+ ['pageSize', 'page_size'],
422
+ ['pageToken', 'page_token'],
423
+ ],
424
+ 'sylphx.money.v1.ListStoreConsumptionRequestsResponse': [
425
+ ['storeConsumptionRequests', 'store_consumption_requests', 'sylphx.money.v1.StoreConsumptionRequest'],
426
+ ['nextPageToken', 'next_page_token'],
427
+ ],
419
428
  'sylphx.money.v1.ListStorePurchasesRequest': [
420
429
  ['pageSize', 'page_size'],
421
430
  ['pageToken', 'page_token'],
@@ -521,6 +530,11 @@ runtime.registerSchemas({
521
530
  ['storeProductIds', 'store_product_ids', undefined, 'map'],
522
531
  ['grants', 'grants', undefined, 'map'],
523
532
  ['licence', 'licence', 'sylphx.money.v1.LicencePolicy'],
533
+ ['appstoreSku', 'appstore_sku'],
534
+ ['appstoreBundleId', 'appstore_bundle_id'],
535
+ ['googleplaySku', 'googleplay_sku'],
536
+ ['googleplayPackageName', 'googleplay_package_name'],
537
+ ['storeProductAliases', 'store_product_aliases', 'sylphx.money.v1.StoreProductAlias'],
524
538
  ],
525
539
  'sylphx.money.v1.RecordBankReceiptRequest': [
526
540
  ['checkoutSession', 'checkout_session'],
@@ -546,6 +560,18 @@ runtime.registerSchemas({
546
560
  ],
547
561
  'sylphx.money.v1.ReleaseUsageInvoiceCollectionRequest': [],
548
562
  'sylphx.money.v1.ReleaseUsageReservationRequest': [],
563
+ 'sylphx.money.v1.ReportStorePurchaseUsageRequest': [
564
+ ['consumptionRequest', 'consumption_request'],
565
+ ['deliveryStatus', 'delivery_status'],
566
+ ['sampleContentProvided', 'sample_content_provided'],
567
+ ['consumptionPercentage', 'consumption_percentage'],
568
+ ['refundPreference', 'refund_preference'],
569
+ ['custodyAttestation', 'custody_attestation'],
570
+ ],
571
+ 'sylphx.money.v1.ReportStorePurchaseUsageResponse': [
572
+ ['storeConsumptionRequest', 'store_consumption_request', 'sylphx.money.v1.StoreConsumptionRequest'],
573
+ ['storePurchase', 'store_purchase', 'sylphx.money.v1.StorePurchase'],
574
+ ],
549
575
  'sylphx.money.v1.ResolveBankReceiptRequest': [],
550
576
  'sylphx.money.v1.ResumeCustomerSubscriptionRequest': [],
551
577
  'sylphx.money.v1.RetireLicenceKeyRequest': [],
@@ -647,6 +673,28 @@ runtime.registerSchemas({
647
673
  ['notificationUrl', 'notification_url'],
648
674
  ['serviceAccountEmail', 'service_account_email'],
649
675
  ],
676
+ 'sylphx.money.v1.StoreConsumptionRequest': [
677
+ ['meta', 'meta', 'sylphx.common.v1.ResourceMeta'],
678
+ ['bundleId', 'bundle_id'],
679
+ ['transactionId', 'transaction_id'],
680
+ ['originalTransactionId', 'original_transaction_id'],
681
+ ['notificationId', 'notification_id'],
682
+ ['consumptionRequestReason', 'consumption_request_reason'],
683
+ ['storePurchase', 'store_purchase'],
684
+ ['subject', 'subject', 'sylphx.money.v1.Subject'],
685
+ ['observedTime', 'observed_time'],
686
+ ['deadlineTime', 'deadline_time'],
687
+ ['attemptCount', 'attempt_count'],
688
+ ['lastAttemptTime', 'last_attempt_time'],
689
+ ['sentTime', 'sent_time'],
690
+ ['appleHttpStatus', 'apple_http_status'],
691
+ ['lastRefusalReason', 'last_refusal_reason'],
692
+ ['consentId', 'consent_id'],
693
+ ],
694
+ 'sylphx.money.v1.StoreProductAlias': [
695
+ ['appId', 'app_id'],
696
+ ['productId', 'product_id'],
697
+ ],
650
698
  'sylphx.money.v1.StorePurchase': [
651
699
  ['meta', 'meta', 'sylphx.common.v1.ResourceMeta'],
652
700
  ['subject', 'subject', 'sylphx.money.v1.Subject'],
@@ -856,6 +904,8 @@ export class MoneyApi {
856
904
  storeConnections;
857
905
  /** The `store_purchases` collection. */
858
906
  storePurchases;
907
+ /** The `store_consumption_requests` collection. */
908
+ storeConsumptionRequests;
859
909
  /** The `customer_subscriptions` collection. */
860
910
  customerSubscriptions;
861
911
  /** The `entitlement_grants` collection. */
@@ -905,6 +955,7 @@ export class MoneyApi {
905
955
  this.checkoutPolicies = new CheckoutPoliciesCollection(client);
906
956
  this.storeConnections = new StoreConnectionsCollection(client);
907
957
  this.storePurchases = new StorePurchasesCollection(client);
958
+ this.storeConsumptionRequests = new StoreConsumptionRequestsCollection(client);
908
959
  this.customerSubscriptions = new CustomerSubscriptionsCollection(client);
909
960
  this.entitlementGrants = new EntitlementGrantsCollection(client);
910
961
  this.testClocks = new TestClocksCollection(client);
@@ -1575,6 +1626,76 @@ export class StorePurchasesCollection {
1575
1626
  next = { ...request, pageToken: page.nextPageToken };
1576
1627
  }
1577
1628
  }
1629
+ /**
1630
+ * Reports verified delivery and usage facts for an App Store purchase in
1631
+ * answer to an observed `CONSUMPTION_REQUEST`. Strictly fails closed (0
1632
+ * outbound Apple calls) unless Money's append-only buyer-authenticated
1633
+ * consent ledger holds an unwithdrawn `granted` decision for this purchase
1634
+ * or app.
1635
+ *
1636
+ * `POST /v1/{name=orgs/*\/projects/*\/envs/*\/store_purchases/*}:reportUsage` · permission `billing:write` · effect `write`
1637
+ *
1638
+ * Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `RESOURCE_NOT_FOUND`, `INVALID_FIELD`, `INVALID_STATE`, `UNAVAILABLE`, `IDEMPOTENCY_KEY_REUSED`, `IDEMPOTENCY_IN_PROGRESS`.
1639
+ */
1640
+ async reportUsage(request) {
1641
+ return this.client.call({
1642
+ method: 'POST',
1643
+ path: `/v1/${runtime.pathParam(request.name, 'orgs/*/projects/*/envs/*/store_purchases/*', 'name')}:reportUsage`,
1644
+ body: runtime.omit(request, ['name']),
1645
+ bodyType: 'sylphx.money.v1.ReportStorePurchaseUsageRequest',
1646
+ responseType: 'sylphx.money.v1.ReportStorePurchaseUsageResponse',
1647
+ mutation: true,
1648
+ });
1649
+ }
1650
+ }
1651
+ /** `store_consumption_requests` of Sylphx Money: Resource type `money.sylphx.com/StoreConsumptionRequest`. */
1652
+ export class StoreConsumptionRequestsCollection {
1653
+ client;
1654
+ constructor(client) {
1655
+ this.client = client;
1656
+ }
1657
+ /**
1658
+ * Gets a captured store consumption request.
1659
+ *
1660
+ * `GET /v1/{name=orgs/*\/projects/*\/envs/*\/store_consumption_requests/*}` · permission `billing:read` · effect `read`
1661
+ *
1662
+ * Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `RESOURCE_NOT_FOUND`.
1663
+ */
1664
+ async get(request) {
1665
+ return this.client.call({
1666
+ method: 'GET',
1667
+ path: `/v1/${runtime.pathParam(request.name, 'orgs/*/projects/*/envs/*/store_consumption_requests/*', 'name')}`,
1668
+ responseType: 'sylphx.money.v1.StoreConsumptionRequest',
1669
+ mutation: false,
1670
+ });
1671
+ }
1672
+ /**
1673
+ * Lists captured store consumption requests, newest first.
1674
+ *
1675
+ * `GET /v1/{parent=orgs/*\/projects/*\/envs/*}/store_consumption_requests` · permission `billing:read` · effect `read`
1676
+ *
1677
+ * Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `INVALID_FIELD`, `PAGE_TOKEN_MISMATCH`.
1678
+ */
1679
+ async list(request) {
1680
+ return this.client.call({
1681
+ method: 'GET',
1682
+ path: `/v1/${runtime.pathParam(request.parent, 'orgs/*/projects/*/envs/*', 'parent')}/store_consumption_requests`,
1683
+ query: { page_size: request.pageSize, page_token: request.pageToken, filter: request.filter },
1684
+ responseType: 'sylphx.money.v1.ListStoreConsumptionRequestsResponse',
1685
+ mutation: false,
1686
+ });
1687
+ }
1688
+ /** Every item of every page of `list`. */
1689
+ async *listAll(request) {
1690
+ let next = request;
1691
+ for (;;) {
1692
+ const page = await this.list(next);
1693
+ yield* page.storeConsumptionRequests ?? [];
1694
+ if (page.nextPageToken === undefined || page.nextPageToken === '')
1695
+ return;
1696
+ next = { ...request, pageToken: page.nextPageToken };
1697
+ }
1698
+ }
1578
1699
  }
1579
1700
  /** `customer_subscriptions` of Sylphx Money: Resource type `money.sylphx.com/CustomerSubscription`. */
1580
1701
  export class CustomerSubscriptionsCollection {