@shware/purchase 0.1.6 → 0.1.8
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/app-store/index.cjs +2 -0
- package/dist/app-store/index.cjs.map +1 -0
- package/dist/app-store/index.d.cts +2 -0
- package/dist/app-store/index.d.ts +2 -0
- package/dist/app-store/index.mjs +1 -0
- package/dist/app-store/index.mjs.map +1 -0
- package/dist/google-play/index.cjs +39 -0
- package/dist/google-play/index.cjs.map +1 -0
- package/dist/google-play/index.d.cts +1 -0
- package/dist/google-play/index.d.ts +1 -0
- package/dist/google-play/index.mjs +16 -0
- package/dist/google-play/index.mjs.map +1 -0
- package/dist/google-play/real-time-developer-notification.cjs +83 -0
- package/dist/google-play/real-time-developer-notification.cjs.map +1 -0
- package/dist/google-play/real-time-developer-notification.d.cts +148 -0
- package/dist/google-play/real-time-developer-notification.d.ts +148 -0
- package/dist/google-play/real-time-developer-notification.mjs +54 -0
- package/dist/google-play/real-time-developer-notification.mjs.map +1 -0
- package/dist/stripe/metadata.cjs +1 -0
- package/dist/stripe/metadata.cjs.map +1 -1
- package/dist/stripe/metadata.d.cts +1 -0
- package/dist/stripe/metadata.d.ts +1 -0
- package/dist/stripe/metadata.mjs +1 -0
- package/dist/stripe/metadata.mjs.map +1 -1
- package/package.json +14 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/google-play/index.ts
|
|
21
|
+
var google_play_exports = {};
|
|
22
|
+
__export(google_play_exports, {
|
|
23
|
+
GooglePlaySubscriptionState: () => import_real_time_developer_notification.GooglePlaySubscriptionState,
|
|
24
|
+
OneTimeProductNotificationType: () => import_real_time_developer_notification.OneTimeProductNotificationType,
|
|
25
|
+
SubscriptionNotificationType: () => import_real_time_developer_notification.SubscriptionNotificationType,
|
|
26
|
+
VoidedPurchaseProductType: () => import_real_time_developer_notification.VoidedPurchaseProductType,
|
|
27
|
+
VoidedPurchaseRefundType: () => import_real_time_developer_notification.VoidedPurchaseRefundType
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(google_play_exports);
|
|
30
|
+
var import_real_time_developer_notification = require("./real-time-developer-notification.cjs");
|
|
31
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
32
|
+
0 && (module.exports = {
|
|
33
|
+
GooglePlaySubscriptionState,
|
|
34
|
+
OneTimeProductNotificationType,
|
|
35
|
+
SubscriptionNotificationType,
|
|
36
|
+
VoidedPurchaseProductType,
|
|
37
|
+
VoidedPurchaseRefundType
|
|
38
|
+
});
|
|
39
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/google-play/index.ts"],"sourcesContent":["export {\n type PubsubMessage,\n type DeveloperNotification,\n type SubscriptionNotification,\n type OneTimeProductNotification,\n type VoidedPurchaseNotification,\n type TestNotification,\n GooglePlaySubscriptionState,\n SubscriptionNotificationType,\n OneTimeProductNotificationType,\n VoidedPurchaseProductType,\n VoidedPurchaseRefundType,\n} from './real-time-developer-notification';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,8CAYO;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DeveloperNotification, GooglePlaySubscriptionState, OneTimeProductNotification, OneTimeProductNotificationType, PubsubMessage, SubscriptionNotification, SubscriptionNotificationType, TestNotification, VoidedPurchaseNotification, VoidedPurchaseProductType, VoidedPurchaseRefundType } from './real-time-developer-notification.cjs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DeveloperNotification, GooglePlaySubscriptionState, OneTimeProductNotification, OneTimeProductNotificationType, PubsubMessage, SubscriptionNotification, SubscriptionNotificationType, TestNotification, VoidedPurchaseNotification, VoidedPurchaseProductType, VoidedPurchaseRefundType } from './real-time-developer-notification.js';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// src/google-play/index.ts
|
|
2
|
+
import {
|
|
3
|
+
GooglePlaySubscriptionState,
|
|
4
|
+
SubscriptionNotificationType,
|
|
5
|
+
OneTimeProductNotificationType,
|
|
6
|
+
VoidedPurchaseProductType,
|
|
7
|
+
VoidedPurchaseRefundType
|
|
8
|
+
} from "./real-time-developer-notification.mjs";
|
|
9
|
+
export {
|
|
10
|
+
GooglePlaySubscriptionState,
|
|
11
|
+
OneTimeProductNotificationType,
|
|
12
|
+
SubscriptionNotificationType,
|
|
13
|
+
VoidedPurchaseProductType,
|
|
14
|
+
VoidedPurchaseRefundType
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/google-play/index.ts"],"sourcesContent":["export {\n type PubsubMessage,\n type DeveloperNotification,\n type SubscriptionNotification,\n type OneTimeProductNotification,\n type VoidedPurchaseNotification,\n type TestNotification,\n GooglePlaySubscriptionState,\n SubscriptionNotificationType,\n OneTimeProductNotificationType,\n VoidedPurchaseProductType,\n VoidedPurchaseRefundType,\n} from './real-time-developer-notification';\n"],"mappings":";AAAA;AAAA,EAOE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;","names":[]}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/google-play/real-time-developer-notification.ts
|
|
21
|
+
var real_time_developer_notification_exports = {};
|
|
22
|
+
__export(real_time_developer_notification_exports, {
|
|
23
|
+
GooglePlaySubscriptionState: () => GooglePlaySubscriptionState,
|
|
24
|
+
OneTimeProductNotificationType: () => OneTimeProductNotificationType,
|
|
25
|
+
SubscriptionNotificationType: () => SubscriptionNotificationType,
|
|
26
|
+
VoidedPurchaseProductType: () => VoidedPurchaseProductType,
|
|
27
|
+
VoidedPurchaseRefundType: () => VoidedPurchaseRefundType
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(real_time_developer_notification_exports);
|
|
30
|
+
var SubscriptionNotificationType = /* @__PURE__ */ ((SubscriptionNotificationType2) => {
|
|
31
|
+
SubscriptionNotificationType2[SubscriptionNotificationType2["SUBSCRIPTION_RECOVERED"] = 1] = "SUBSCRIPTION_RECOVERED";
|
|
32
|
+
SubscriptionNotificationType2[SubscriptionNotificationType2["SUBSCRIPTION_RENEWED"] = 2] = "SUBSCRIPTION_RENEWED";
|
|
33
|
+
SubscriptionNotificationType2[SubscriptionNotificationType2["SUBSCRIPTION_CANCELED"] = 3] = "SUBSCRIPTION_CANCELED";
|
|
34
|
+
SubscriptionNotificationType2[SubscriptionNotificationType2["SUBSCRIPTION_PURCHASED"] = 4] = "SUBSCRIPTION_PURCHASED";
|
|
35
|
+
SubscriptionNotificationType2[SubscriptionNotificationType2["SUBSCRIPTION_ON_HOLD"] = 5] = "SUBSCRIPTION_ON_HOLD";
|
|
36
|
+
SubscriptionNotificationType2[SubscriptionNotificationType2["SUBSCRIPTION_IN_GRACE_PERIOD"] = 6] = "SUBSCRIPTION_IN_GRACE_PERIOD";
|
|
37
|
+
SubscriptionNotificationType2[SubscriptionNotificationType2["SUBSCRIPTION_RESTARTED"] = 7] = "SUBSCRIPTION_RESTARTED";
|
|
38
|
+
SubscriptionNotificationType2[SubscriptionNotificationType2["SUBSCRIPTION_PRICE_CHANGE_CONFIRMED"] = 8] = "SUBSCRIPTION_PRICE_CHANGE_CONFIRMED";
|
|
39
|
+
SubscriptionNotificationType2[SubscriptionNotificationType2["SUBSCRIPTION_DEFERRED"] = 9] = "SUBSCRIPTION_DEFERRED";
|
|
40
|
+
SubscriptionNotificationType2[SubscriptionNotificationType2["SUBSCRIPTION_PAUSED"] = 10] = "SUBSCRIPTION_PAUSED";
|
|
41
|
+
SubscriptionNotificationType2[SubscriptionNotificationType2["SUBSCRIPTION_PAUSE_SCHEDULE_CHANGED"] = 11] = "SUBSCRIPTION_PAUSE_SCHEDULE_CHANGED";
|
|
42
|
+
SubscriptionNotificationType2[SubscriptionNotificationType2["SUBSCRIPTION_REVOKED"] = 12] = "SUBSCRIPTION_REVOKED";
|
|
43
|
+
SubscriptionNotificationType2[SubscriptionNotificationType2["SUBSCRIPTION_EXPIRED"] = 13] = "SUBSCRIPTION_EXPIRED";
|
|
44
|
+
SubscriptionNotificationType2[SubscriptionNotificationType2["SUBSCRIPTION_PRICE_CHANGE_UPDATED"] = 19] = "SUBSCRIPTION_PRICE_CHANGE_UPDATED";
|
|
45
|
+
SubscriptionNotificationType2[SubscriptionNotificationType2["SUBSCRIPTION_PENDING_PURCHASE_CANCELED"] = 20] = "SUBSCRIPTION_PENDING_PURCHASE_CANCELED";
|
|
46
|
+
return SubscriptionNotificationType2;
|
|
47
|
+
})(SubscriptionNotificationType || {});
|
|
48
|
+
var OneTimeProductNotificationType = /* @__PURE__ */ ((OneTimeProductNotificationType2) => {
|
|
49
|
+
OneTimeProductNotificationType2[OneTimeProductNotificationType2["ONE_TIME_PRODUCT_PURCHASED"] = 1] = "ONE_TIME_PRODUCT_PURCHASED";
|
|
50
|
+
OneTimeProductNotificationType2[OneTimeProductNotificationType2["ONE_TIME_PRODUCT_CANCELED"] = 2] = "ONE_TIME_PRODUCT_CANCELED";
|
|
51
|
+
return OneTimeProductNotificationType2;
|
|
52
|
+
})(OneTimeProductNotificationType || {});
|
|
53
|
+
var VoidedPurchaseProductType = /* @__PURE__ */ ((VoidedPurchaseProductType2) => {
|
|
54
|
+
VoidedPurchaseProductType2[VoidedPurchaseProductType2["PRODUCT_TYPE_SUBSCRIPTION"] = 1] = "PRODUCT_TYPE_SUBSCRIPTION";
|
|
55
|
+
VoidedPurchaseProductType2[VoidedPurchaseProductType2["PRODUCT_TYPE_ONE_TIME"] = 2] = "PRODUCT_TYPE_ONE_TIME";
|
|
56
|
+
return VoidedPurchaseProductType2;
|
|
57
|
+
})(VoidedPurchaseProductType || {});
|
|
58
|
+
var VoidedPurchaseRefundType = /* @__PURE__ */ ((VoidedPurchaseRefundType2) => {
|
|
59
|
+
VoidedPurchaseRefundType2[VoidedPurchaseRefundType2["REFUND_TYPE_FULL_REFUND"] = 1] = "REFUND_TYPE_FULL_REFUND";
|
|
60
|
+
VoidedPurchaseRefundType2[VoidedPurchaseRefundType2["REFUND_TYPE_QUANTITY_BASED_PARTIAL_REFUND"] = 2] = "REFUND_TYPE_QUANTITY_BASED_PARTIAL_REFUND";
|
|
61
|
+
return VoidedPurchaseRefundType2;
|
|
62
|
+
})(VoidedPurchaseRefundType || {});
|
|
63
|
+
var GooglePlaySubscriptionState = /* @__PURE__ */ ((GooglePlaySubscriptionState2) => {
|
|
64
|
+
GooglePlaySubscriptionState2["SUBSCRIPTION_STATE_UNSPECIFIED"] = "SUBSCRIPTION_STATE_UNSPECIFIED";
|
|
65
|
+
GooglePlaySubscriptionState2["SUBSCRIPTION_STATE_PENDING"] = "SUBSCRIPTION_STATE_PENDING";
|
|
66
|
+
GooglePlaySubscriptionState2["SUBSCRIPTION_STATE_ACTIVE"] = "SUBSCRIPTION_STATE_ACTIVE";
|
|
67
|
+
GooglePlaySubscriptionState2["SUBSCRIPTION_STATE_PAUSED"] = "SUBSCRIPTION_STATE_PAUSED";
|
|
68
|
+
GooglePlaySubscriptionState2["SUBSCRIPTION_STATE_IN_GRACE_PERIOD"] = "SUBSCRIPTION_STATE_IN_GRACE_PERIOD";
|
|
69
|
+
GooglePlaySubscriptionState2["SUBSCRIPTION_STATE_ON_HOLD"] = "SUBSCRIPTION_STATE_ON_HOLD";
|
|
70
|
+
GooglePlaySubscriptionState2["SUBSCRIPTION_STATE_CANCELED"] = "SUBSCRIPTION_STATE_CANCELED";
|
|
71
|
+
GooglePlaySubscriptionState2["SUBSCRIPTION_STATE_EXPIRED"] = "SUBSCRIPTION_STATE_EXPIRED";
|
|
72
|
+
GooglePlaySubscriptionState2["SUBSCRIPTION_STATE_PENDING_PURCHASE_CANCELED"] = "SUBSCRIPTION_STATE_PENDING_PURCHASE_CANCELED";
|
|
73
|
+
return GooglePlaySubscriptionState2;
|
|
74
|
+
})(GooglePlaySubscriptionState || {});
|
|
75
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
76
|
+
0 && (module.exports = {
|
|
77
|
+
GooglePlaySubscriptionState,
|
|
78
|
+
OneTimeProductNotificationType,
|
|
79
|
+
SubscriptionNotificationType,
|
|
80
|
+
VoidedPurchaseProductType,
|
|
81
|
+
VoidedPurchaseRefundType
|
|
82
|
+
});
|
|
83
|
+
//# sourceMappingURL=real-time-developer-notification.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/google-play/real-time-developer-notification.ts"],"sourcesContent":["// ref: https://cloud.google.com/pubsub/docs/reference/rest/v1/PubsubMessage\nexport type PubsubMessage = {\n data: string;\n attributes: Record<string, string>;\n messageId: string;\n publishTime: string;\n orderingKey: string;\n};\n\n/** https://developer.android.com/google/play/billing/rtdn-reference */\nexport interface DeveloperNotification {\n version: string;\n packageName: string;\n eventTimeMillis: number;\n subscriptionNotification: SubscriptionNotification;\n oneTimeProductNotification: OneTimeProductNotification;\n voidedPurchaseNotification: VoidedPurchaseNotification;\n testNotification: TestNotification;\n}\n\n/**\n * [Real-time developer notifications reference guide](https://developer.android.com/google/play/billing/rtdn-reference)\n * */\nexport enum SubscriptionNotificationType {\n /** A subscription was recovered from account hold. */\n SUBSCRIPTION_RECOVERED = 1,\n\n /** An active subscription was renewed. */\n SUBSCRIPTION_RENEWED = 2,\n\n /**\n * A subscription was either voluntarily or involuntarily cancelled. For voluntary cancellation,\n * sent when the user cancels.\n */\n SUBSCRIPTION_CANCELED = 3,\n\n /** A new subscription was purchased. */\n SUBSCRIPTION_PURCHASED = 4,\n\n /** A subscription has entered account hold (if enabled). */\n SUBSCRIPTION_ON_HOLD = 5,\n\n /** A subscription has entered grace period (if enabled). */\n SUBSCRIPTION_IN_GRACE_PERIOD = 6,\n\n /**\n * User has restored their subscription from Play > Account > Subscriptions. The subscription was\n * canceled but had not expired yet when the user restores. For more information, see Restorations.\n */\n SUBSCRIPTION_RESTARTED = 7,\n\n /** (DEPRECATED) A subscription price change has successfully been confirmed by the user. */\n SUBSCRIPTION_PRICE_CHANGE_CONFIRMED = 8,\n\n /** A subscription's recurrence time has been extended. */\n SUBSCRIPTION_DEFERRED = 9,\n\n /** A subscription has been paused. */\n SUBSCRIPTION_PAUSED = 10,\n\n /** A subscription pause schedule has been changed. */\n SUBSCRIPTION_PAUSE_SCHEDULE_CHANGED = 11,\n\n /** A subscription has been revoked from the user before the expiration time. */\n SUBSCRIPTION_REVOKED = 12,\n\n /** A subscription has expired. */\n SUBSCRIPTION_EXPIRED = 13,\n\n /** A subscription item's price change details are updated. */\n SUBSCRIPTION_PRICE_CHANGE_UPDATED = 19,\n\n /** A pending transaction of a subscription has been canceled. */\n SUBSCRIPTION_PENDING_PURCHASE_CANCELED = 20,\n}\n\nexport interface SubscriptionNotification {\n version: string;\n purchaseToken: string;\n notificationType: SubscriptionNotificationType;\n}\n\nexport enum OneTimeProductNotificationType {\n /** A one-time product was successfully purchased by a user. */\n ONE_TIME_PRODUCT_PURCHASED = 1,\n\n /** A pending one-time product purchase has been canceled by the user. */\n ONE_TIME_PRODUCT_CANCELED = 2,\n}\n\nexport interface OneTimeProductNotification {\n version: string;\n sku: string;\n purchaseToken: string;\n notificationType: OneTimeProductNotificationType;\n}\n\nexport enum VoidedPurchaseProductType {\n /** A subscription purchase has been voided. */\n PRODUCT_TYPE_SUBSCRIPTION = 1,\n\n /** A one-time purchase has been voided. */\n PRODUCT_TYPE_ONE_TIME = 2,\n}\n\n/**\n * Note when the remaining total quantity of a multi-quantity purchase is refunded, the refundType\n * will be REFUND_TYPE_FULL_REFUND.\n */\nexport enum VoidedPurchaseRefundType {\n /** The purchase has been fully voided. */\n REFUND_TYPE_FULL_REFUND = 1,\n\n /**\n * The purchase has been partially voided by a quantity-based partial refund, applicable only to\n * multi-quantity purchases. A purchase can be partially voided multiple times.\n */\n REFUND_TYPE_QUANTITY_BASED_PARTIAL_REFUND = 2,\n}\n\nexport interface VoidedPurchaseNotification {\n purchaseToken: string;\n orderId: string;\n productType: VoidedPurchaseProductType;\n refundType: VoidedPurchaseRefundType;\n}\n\nexport interface TestNotification {\n version: string;\n}\n\n/** ref: https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptionsv2#SubscriptionState */\nexport enum GooglePlaySubscriptionState {\n /** Unspecified subscription state. */\n SUBSCRIPTION_STATE_UNSPECIFIED = 'SUBSCRIPTION_STATE_UNSPECIFIED',\n\n /**\n * Subscription was created but awaiting payment during signup. In this state, all items are\n * awaiting payment.\n */\n SUBSCRIPTION_STATE_PENDING = 'SUBSCRIPTION_STATE_PENDING',\n\n /**\n * Subscription is active.\n * (1) If the subscription is an auto renewing plan, at least one item is autoRenewEnabled and not expired.\n * (2) If the subscription is a prepaid plan, at least one item is not expired.\n */\n SUBSCRIPTION_STATE_ACTIVE = 'SUBSCRIPTION_STATE_ACTIVE',\n\n /**\n * Subscription is paused. The state is only available when the subscription is an auto renewing\n * plan. In this state, all items are in paused state.\n */\n SUBSCRIPTION_STATE_PAUSED = 'SUBSCRIPTION_STATE_PAUSED',\n\n /**\n * Subscription is in grace period. The state is only available when the subscription is an auto\n * renewing plan. In this state, all items are in grace period.\n */\n SUBSCRIPTION_STATE_IN_GRACE_PERIOD = 'SUBSCRIPTION_STATE_IN_GRACE_PERIOD',\n\n /**\n * Subscription is on hold (suspended). The state is only available when the subscription is an\n * auto renewing plan. In this state, all items are on hold.\n */\n SUBSCRIPTION_STATE_ON_HOLD = 'SUBSCRIPTION_STATE_ON_HOLD',\n\n /**\n * Subscription is canceled but not expired yet. The state is only available when the subscription\n * is an auto renewing plan. All items have autoRenewEnabled set to false.\n */\n SUBSCRIPTION_STATE_CANCELED = 'SUBSCRIPTION_STATE_CANCELED',\n\n /** Subscription is expired. All items have expiryTime in the past. */\n SUBSCRIPTION_STATE_EXPIRED = 'SUBSCRIPTION_STATE_EXPIRED',\n\n /**\n * Pending transaction for subscription is canceled. If this pending purchase was for an existing\n * subscription, use linkedPurchaseToken to get the current state of that subscription.\n */\n SUBSCRIPTION_STATE_PENDING_PURCHASE_CANCELED = 'SUBSCRIPTION_STATE_PENDING_PURCHASE_CANCELED',\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAuBO,IAAK,+BAAL,kBAAKA,kCAAL;AAEL,EAAAA,4DAAA,4BAAyB,KAAzB;AAGA,EAAAA,4DAAA,0BAAuB,KAAvB;AAMA,EAAAA,4DAAA,2BAAwB,KAAxB;AAGA,EAAAA,4DAAA,4BAAyB,KAAzB;AAGA,EAAAA,4DAAA,0BAAuB,KAAvB;AAGA,EAAAA,4DAAA,kCAA+B,KAA/B;AAMA,EAAAA,4DAAA,4BAAyB,KAAzB;AAGA,EAAAA,4DAAA,yCAAsC,KAAtC;AAGA,EAAAA,4DAAA,2BAAwB,KAAxB;AAGA,EAAAA,4DAAA,yBAAsB,MAAtB;AAGA,EAAAA,4DAAA,yCAAsC,MAAtC;AAGA,EAAAA,4DAAA,0BAAuB,MAAvB;AAGA,EAAAA,4DAAA,0BAAuB,MAAvB;AAGA,EAAAA,4DAAA,uCAAoC,MAApC;AAGA,EAAAA,4DAAA,4CAAyC,MAAzC;AAlDU,SAAAA;AAAA,GAAA;AA2DL,IAAK,iCAAL,kBAAKC,oCAAL;AAEL,EAAAA,gEAAA,gCAA6B,KAA7B;AAGA,EAAAA,gEAAA,+BAA4B,KAA5B;AALU,SAAAA;AAAA,GAAA;AAeL,IAAK,4BAAL,kBAAKC,+BAAL;AAEL,EAAAA,sDAAA,+BAA4B,KAA5B;AAGA,EAAAA,sDAAA,2BAAwB,KAAxB;AALU,SAAAA;AAAA,GAAA;AAYL,IAAK,2BAAL,kBAAKC,8BAAL;AAEL,EAAAA,oDAAA,6BAA0B,KAA1B;AAMA,EAAAA,oDAAA,+CAA4C,KAA5C;AARU,SAAAA;AAAA,GAAA;AAuBL,IAAK,8BAAL,kBAAKC,iCAAL;AAEL,EAAAA,6BAAA,oCAAiC;AAMjC,EAAAA,6BAAA,gCAA6B;AAO7B,EAAAA,6BAAA,+BAA4B;AAM5B,EAAAA,6BAAA,+BAA4B;AAM5B,EAAAA,6BAAA,wCAAqC;AAMrC,EAAAA,6BAAA,gCAA6B;AAM7B,EAAAA,6BAAA,iCAA8B;AAG9B,EAAAA,6BAAA,gCAA6B;AAM7B,EAAAA,6BAAA,kDAA+C;AAhDrC,SAAAA;AAAA,GAAA;","names":["SubscriptionNotificationType","OneTimeProductNotificationType","VoidedPurchaseProductType","VoidedPurchaseRefundType","GooglePlaySubscriptionState"]}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
type PubsubMessage = {
|
|
2
|
+
data: string;
|
|
3
|
+
attributes: Record<string, string>;
|
|
4
|
+
messageId: string;
|
|
5
|
+
publishTime: string;
|
|
6
|
+
orderingKey: string;
|
|
7
|
+
};
|
|
8
|
+
/** https://developer.android.com/google/play/billing/rtdn-reference */
|
|
9
|
+
interface DeveloperNotification {
|
|
10
|
+
version: string;
|
|
11
|
+
packageName: string;
|
|
12
|
+
eventTimeMillis: number;
|
|
13
|
+
subscriptionNotification: SubscriptionNotification;
|
|
14
|
+
oneTimeProductNotification: OneTimeProductNotification;
|
|
15
|
+
voidedPurchaseNotification: VoidedPurchaseNotification;
|
|
16
|
+
testNotification: TestNotification;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* [Real-time developer notifications reference guide](https://developer.android.com/google/play/billing/rtdn-reference)
|
|
20
|
+
* */
|
|
21
|
+
declare enum SubscriptionNotificationType {
|
|
22
|
+
/** A subscription was recovered from account hold. */
|
|
23
|
+
SUBSCRIPTION_RECOVERED = 1,
|
|
24
|
+
/** An active subscription was renewed. */
|
|
25
|
+
SUBSCRIPTION_RENEWED = 2,
|
|
26
|
+
/**
|
|
27
|
+
* A subscription was either voluntarily or involuntarily cancelled. For voluntary cancellation,
|
|
28
|
+
* sent when the user cancels.
|
|
29
|
+
*/
|
|
30
|
+
SUBSCRIPTION_CANCELED = 3,
|
|
31
|
+
/** A new subscription was purchased. */
|
|
32
|
+
SUBSCRIPTION_PURCHASED = 4,
|
|
33
|
+
/** A subscription has entered account hold (if enabled). */
|
|
34
|
+
SUBSCRIPTION_ON_HOLD = 5,
|
|
35
|
+
/** A subscription has entered grace period (if enabled). */
|
|
36
|
+
SUBSCRIPTION_IN_GRACE_PERIOD = 6,
|
|
37
|
+
/**
|
|
38
|
+
* User has restored their subscription from Play > Account > Subscriptions. The subscription was
|
|
39
|
+
* canceled but had not expired yet when the user restores. For more information, see Restorations.
|
|
40
|
+
*/
|
|
41
|
+
SUBSCRIPTION_RESTARTED = 7,
|
|
42
|
+
/** (DEPRECATED) A subscription price change has successfully been confirmed by the user. */
|
|
43
|
+
SUBSCRIPTION_PRICE_CHANGE_CONFIRMED = 8,
|
|
44
|
+
/** A subscription's recurrence time has been extended. */
|
|
45
|
+
SUBSCRIPTION_DEFERRED = 9,
|
|
46
|
+
/** A subscription has been paused. */
|
|
47
|
+
SUBSCRIPTION_PAUSED = 10,
|
|
48
|
+
/** A subscription pause schedule has been changed. */
|
|
49
|
+
SUBSCRIPTION_PAUSE_SCHEDULE_CHANGED = 11,
|
|
50
|
+
/** A subscription has been revoked from the user before the expiration time. */
|
|
51
|
+
SUBSCRIPTION_REVOKED = 12,
|
|
52
|
+
/** A subscription has expired. */
|
|
53
|
+
SUBSCRIPTION_EXPIRED = 13,
|
|
54
|
+
/** A subscription item's price change details are updated. */
|
|
55
|
+
SUBSCRIPTION_PRICE_CHANGE_UPDATED = 19,
|
|
56
|
+
/** A pending transaction of a subscription has been canceled. */
|
|
57
|
+
SUBSCRIPTION_PENDING_PURCHASE_CANCELED = 20
|
|
58
|
+
}
|
|
59
|
+
interface SubscriptionNotification {
|
|
60
|
+
version: string;
|
|
61
|
+
purchaseToken: string;
|
|
62
|
+
notificationType: SubscriptionNotificationType;
|
|
63
|
+
}
|
|
64
|
+
declare enum OneTimeProductNotificationType {
|
|
65
|
+
/** A one-time product was successfully purchased by a user. */
|
|
66
|
+
ONE_TIME_PRODUCT_PURCHASED = 1,
|
|
67
|
+
/** A pending one-time product purchase has been canceled by the user. */
|
|
68
|
+
ONE_TIME_PRODUCT_CANCELED = 2
|
|
69
|
+
}
|
|
70
|
+
interface OneTimeProductNotification {
|
|
71
|
+
version: string;
|
|
72
|
+
sku: string;
|
|
73
|
+
purchaseToken: string;
|
|
74
|
+
notificationType: OneTimeProductNotificationType;
|
|
75
|
+
}
|
|
76
|
+
declare enum VoidedPurchaseProductType {
|
|
77
|
+
/** A subscription purchase has been voided. */
|
|
78
|
+
PRODUCT_TYPE_SUBSCRIPTION = 1,
|
|
79
|
+
/** A one-time purchase has been voided. */
|
|
80
|
+
PRODUCT_TYPE_ONE_TIME = 2
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Note when the remaining total quantity of a multi-quantity purchase is refunded, the refundType
|
|
84
|
+
* will be REFUND_TYPE_FULL_REFUND.
|
|
85
|
+
*/
|
|
86
|
+
declare enum VoidedPurchaseRefundType {
|
|
87
|
+
/** The purchase has been fully voided. */
|
|
88
|
+
REFUND_TYPE_FULL_REFUND = 1,
|
|
89
|
+
/**
|
|
90
|
+
* The purchase has been partially voided by a quantity-based partial refund, applicable only to
|
|
91
|
+
* multi-quantity purchases. A purchase can be partially voided multiple times.
|
|
92
|
+
*/
|
|
93
|
+
REFUND_TYPE_QUANTITY_BASED_PARTIAL_REFUND = 2
|
|
94
|
+
}
|
|
95
|
+
interface VoidedPurchaseNotification {
|
|
96
|
+
purchaseToken: string;
|
|
97
|
+
orderId: string;
|
|
98
|
+
productType: VoidedPurchaseProductType;
|
|
99
|
+
refundType: VoidedPurchaseRefundType;
|
|
100
|
+
}
|
|
101
|
+
interface TestNotification {
|
|
102
|
+
version: string;
|
|
103
|
+
}
|
|
104
|
+
/** ref: https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptionsv2#SubscriptionState */
|
|
105
|
+
declare enum GooglePlaySubscriptionState {
|
|
106
|
+
/** Unspecified subscription state. */
|
|
107
|
+
SUBSCRIPTION_STATE_UNSPECIFIED = "SUBSCRIPTION_STATE_UNSPECIFIED",
|
|
108
|
+
/**
|
|
109
|
+
* Subscription was created but awaiting payment during signup. In this state, all items are
|
|
110
|
+
* awaiting payment.
|
|
111
|
+
*/
|
|
112
|
+
SUBSCRIPTION_STATE_PENDING = "SUBSCRIPTION_STATE_PENDING",
|
|
113
|
+
/**
|
|
114
|
+
* Subscription is active.
|
|
115
|
+
* (1) If the subscription is an auto renewing plan, at least one item is autoRenewEnabled and not expired.
|
|
116
|
+
* (2) If the subscription is a prepaid plan, at least one item is not expired.
|
|
117
|
+
*/
|
|
118
|
+
SUBSCRIPTION_STATE_ACTIVE = "SUBSCRIPTION_STATE_ACTIVE",
|
|
119
|
+
/**
|
|
120
|
+
* Subscription is paused. The state is only available when the subscription is an auto renewing
|
|
121
|
+
* plan. In this state, all items are in paused state.
|
|
122
|
+
*/
|
|
123
|
+
SUBSCRIPTION_STATE_PAUSED = "SUBSCRIPTION_STATE_PAUSED",
|
|
124
|
+
/**
|
|
125
|
+
* Subscription is in grace period. The state is only available when the subscription is an auto
|
|
126
|
+
* renewing plan. In this state, all items are in grace period.
|
|
127
|
+
*/
|
|
128
|
+
SUBSCRIPTION_STATE_IN_GRACE_PERIOD = "SUBSCRIPTION_STATE_IN_GRACE_PERIOD",
|
|
129
|
+
/**
|
|
130
|
+
* Subscription is on hold (suspended). The state is only available when the subscription is an
|
|
131
|
+
* auto renewing plan. In this state, all items are on hold.
|
|
132
|
+
*/
|
|
133
|
+
SUBSCRIPTION_STATE_ON_HOLD = "SUBSCRIPTION_STATE_ON_HOLD",
|
|
134
|
+
/**
|
|
135
|
+
* Subscription is canceled but not expired yet. The state is only available when the subscription
|
|
136
|
+
* is an auto renewing plan. All items have autoRenewEnabled set to false.
|
|
137
|
+
*/
|
|
138
|
+
SUBSCRIPTION_STATE_CANCELED = "SUBSCRIPTION_STATE_CANCELED",
|
|
139
|
+
/** Subscription is expired. All items have expiryTime in the past. */
|
|
140
|
+
SUBSCRIPTION_STATE_EXPIRED = "SUBSCRIPTION_STATE_EXPIRED",
|
|
141
|
+
/**
|
|
142
|
+
* Pending transaction for subscription is canceled. If this pending purchase was for an existing
|
|
143
|
+
* subscription, use linkedPurchaseToken to get the current state of that subscription.
|
|
144
|
+
*/
|
|
145
|
+
SUBSCRIPTION_STATE_PENDING_PURCHASE_CANCELED = "SUBSCRIPTION_STATE_PENDING_PURCHASE_CANCELED"
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export { type DeveloperNotification, GooglePlaySubscriptionState, type OneTimeProductNotification, OneTimeProductNotificationType, type PubsubMessage, type SubscriptionNotification, SubscriptionNotificationType, type TestNotification, type VoidedPurchaseNotification, VoidedPurchaseProductType, VoidedPurchaseRefundType };
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
type PubsubMessage = {
|
|
2
|
+
data: string;
|
|
3
|
+
attributes: Record<string, string>;
|
|
4
|
+
messageId: string;
|
|
5
|
+
publishTime: string;
|
|
6
|
+
orderingKey: string;
|
|
7
|
+
};
|
|
8
|
+
/** https://developer.android.com/google/play/billing/rtdn-reference */
|
|
9
|
+
interface DeveloperNotification {
|
|
10
|
+
version: string;
|
|
11
|
+
packageName: string;
|
|
12
|
+
eventTimeMillis: number;
|
|
13
|
+
subscriptionNotification: SubscriptionNotification;
|
|
14
|
+
oneTimeProductNotification: OneTimeProductNotification;
|
|
15
|
+
voidedPurchaseNotification: VoidedPurchaseNotification;
|
|
16
|
+
testNotification: TestNotification;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* [Real-time developer notifications reference guide](https://developer.android.com/google/play/billing/rtdn-reference)
|
|
20
|
+
* */
|
|
21
|
+
declare enum SubscriptionNotificationType {
|
|
22
|
+
/** A subscription was recovered from account hold. */
|
|
23
|
+
SUBSCRIPTION_RECOVERED = 1,
|
|
24
|
+
/** An active subscription was renewed. */
|
|
25
|
+
SUBSCRIPTION_RENEWED = 2,
|
|
26
|
+
/**
|
|
27
|
+
* A subscription was either voluntarily or involuntarily cancelled. For voluntary cancellation,
|
|
28
|
+
* sent when the user cancels.
|
|
29
|
+
*/
|
|
30
|
+
SUBSCRIPTION_CANCELED = 3,
|
|
31
|
+
/** A new subscription was purchased. */
|
|
32
|
+
SUBSCRIPTION_PURCHASED = 4,
|
|
33
|
+
/** A subscription has entered account hold (if enabled). */
|
|
34
|
+
SUBSCRIPTION_ON_HOLD = 5,
|
|
35
|
+
/** A subscription has entered grace period (if enabled). */
|
|
36
|
+
SUBSCRIPTION_IN_GRACE_PERIOD = 6,
|
|
37
|
+
/**
|
|
38
|
+
* User has restored their subscription from Play > Account > Subscriptions. The subscription was
|
|
39
|
+
* canceled but had not expired yet when the user restores. For more information, see Restorations.
|
|
40
|
+
*/
|
|
41
|
+
SUBSCRIPTION_RESTARTED = 7,
|
|
42
|
+
/** (DEPRECATED) A subscription price change has successfully been confirmed by the user. */
|
|
43
|
+
SUBSCRIPTION_PRICE_CHANGE_CONFIRMED = 8,
|
|
44
|
+
/** A subscription's recurrence time has been extended. */
|
|
45
|
+
SUBSCRIPTION_DEFERRED = 9,
|
|
46
|
+
/** A subscription has been paused. */
|
|
47
|
+
SUBSCRIPTION_PAUSED = 10,
|
|
48
|
+
/** A subscription pause schedule has been changed. */
|
|
49
|
+
SUBSCRIPTION_PAUSE_SCHEDULE_CHANGED = 11,
|
|
50
|
+
/** A subscription has been revoked from the user before the expiration time. */
|
|
51
|
+
SUBSCRIPTION_REVOKED = 12,
|
|
52
|
+
/** A subscription has expired. */
|
|
53
|
+
SUBSCRIPTION_EXPIRED = 13,
|
|
54
|
+
/** A subscription item's price change details are updated. */
|
|
55
|
+
SUBSCRIPTION_PRICE_CHANGE_UPDATED = 19,
|
|
56
|
+
/** A pending transaction of a subscription has been canceled. */
|
|
57
|
+
SUBSCRIPTION_PENDING_PURCHASE_CANCELED = 20
|
|
58
|
+
}
|
|
59
|
+
interface SubscriptionNotification {
|
|
60
|
+
version: string;
|
|
61
|
+
purchaseToken: string;
|
|
62
|
+
notificationType: SubscriptionNotificationType;
|
|
63
|
+
}
|
|
64
|
+
declare enum OneTimeProductNotificationType {
|
|
65
|
+
/** A one-time product was successfully purchased by a user. */
|
|
66
|
+
ONE_TIME_PRODUCT_PURCHASED = 1,
|
|
67
|
+
/** A pending one-time product purchase has been canceled by the user. */
|
|
68
|
+
ONE_TIME_PRODUCT_CANCELED = 2
|
|
69
|
+
}
|
|
70
|
+
interface OneTimeProductNotification {
|
|
71
|
+
version: string;
|
|
72
|
+
sku: string;
|
|
73
|
+
purchaseToken: string;
|
|
74
|
+
notificationType: OneTimeProductNotificationType;
|
|
75
|
+
}
|
|
76
|
+
declare enum VoidedPurchaseProductType {
|
|
77
|
+
/** A subscription purchase has been voided. */
|
|
78
|
+
PRODUCT_TYPE_SUBSCRIPTION = 1,
|
|
79
|
+
/** A one-time purchase has been voided. */
|
|
80
|
+
PRODUCT_TYPE_ONE_TIME = 2
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Note when the remaining total quantity of a multi-quantity purchase is refunded, the refundType
|
|
84
|
+
* will be REFUND_TYPE_FULL_REFUND.
|
|
85
|
+
*/
|
|
86
|
+
declare enum VoidedPurchaseRefundType {
|
|
87
|
+
/** The purchase has been fully voided. */
|
|
88
|
+
REFUND_TYPE_FULL_REFUND = 1,
|
|
89
|
+
/**
|
|
90
|
+
* The purchase has been partially voided by a quantity-based partial refund, applicable only to
|
|
91
|
+
* multi-quantity purchases. A purchase can be partially voided multiple times.
|
|
92
|
+
*/
|
|
93
|
+
REFUND_TYPE_QUANTITY_BASED_PARTIAL_REFUND = 2
|
|
94
|
+
}
|
|
95
|
+
interface VoidedPurchaseNotification {
|
|
96
|
+
purchaseToken: string;
|
|
97
|
+
orderId: string;
|
|
98
|
+
productType: VoidedPurchaseProductType;
|
|
99
|
+
refundType: VoidedPurchaseRefundType;
|
|
100
|
+
}
|
|
101
|
+
interface TestNotification {
|
|
102
|
+
version: string;
|
|
103
|
+
}
|
|
104
|
+
/** ref: https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptionsv2#SubscriptionState */
|
|
105
|
+
declare enum GooglePlaySubscriptionState {
|
|
106
|
+
/** Unspecified subscription state. */
|
|
107
|
+
SUBSCRIPTION_STATE_UNSPECIFIED = "SUBSCRIPTION_STATE_UNSPECIFIED",
|
|
108
|
+
/**
|
|
109
|
+
* Subscription was created but awaiting payment during signup. In this state, all items are
|
|
110
|
+
* awaiting payment.
|
|
111
|
+
*/
|
|
112
|
+
SUBSCRIPTION_STATE_PENDING = "SUBSCRIPTION_STATE_PENDING",
|
|
113
|
+
/**
|
|
114
|
+
* Subscription is active.
|
|
115
|
+
* (1) If the subscription is an auto renewing plan, at least one item is autoRenewEnabled and not expired.
|
|
116
|
+
* (2) If the subscription is a prepaid plan, at least one item is not expired.
|
|
117
|
+
*/
|
|
118
|
+
SUBSCRIPTION_STATE_ACTIVE = "SUBSCRIPTION_STATE_ACTIVE",
|
|
119
|
+
/**
|
|
120
|
+
* Subscription is paused. The state is only available when the subscription is an auto renewing
|
|
121
|
+
* plan. In this state, all items are in paused state.
|
|
122
|
+
*/
|
|
123
|
+
SUBSCRIPTION_STATE_PAUSED = "SUBSCRIPTION_STATE_PAUSED",
|
|
124
|
+
/**
|
|
125
|
+
* Subscription is in grace period. The state is only available when the subscription is an auto
|
|
126
|
+
* renewing plan. In this state, all items are in grace period.
|
|
127
|
+
*/
|
|
128
|
+
SUBSCRIPTION_STATE_IN_GRACE_PERIOD = "SUBSCRIPTION_STATE_IN_GRACE_PERIOD",
|
|
129
|
+
/**
|
|
130
|
+
* Subscription is on hold (suspended). The state is only available when the subscription is an
|
|
131
|
+
* auto renewing plan. In this state, all items are on hold.
|
|
132
|
+
*/
|
|
133
|
+
SUBSCRIPTION_STATE_ON_HOLD = "SUBSCRIPTION_STATE_ON_HOLD",
|
|
134
|
+
/**
|
|
135
|
+
* Subscription is canceled but not expired yet. The state is only available when the subscription
|
|
136
|
+
* is an auto renewing plan. All items have autoRenewEnabled set to false.
|
|
137
|
+
*/
|
|
138
|
+
SUBSCRIPTION_STATE_CANCELED = "SUBSCRIPTION_STATE_CANCELED",
|
|
139
|
+
/** Subscription is expired. All items have expiryTime in the past. */
|
|
140
|
+
SUBSCRIPTION_STATE_EXPIRED = "SUBSCRIPTION_STATE_EXPIRED",
|
|
141
|
+
/**
|
|
142
|
+
* Pending transaction for subscription is canceled. If this pending purchase was for an existing
|
|
143
|
+
* subscription, use linkedPurchaseToken to get the current state of that subscription.
|
|
144
|
+
*/
|
|
145
|
+
SUBSCRIPTION_STATE_PENDING_PURCHASE_CANCELED = "SUBSCRIPTION_STATE_PENDING_PURCHASE_CANCELED"
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export { type DeveloperNotification, GooglePlaySubscriptionState, type OneTimeProductNotification, OneTimeProductNotificationType, type PubsubMessage, type SubscriptionNotification, SubscriptionNotificationType, type TestNotification, type VoidedPurchaseNotification, VoidedPurchaseProductType, VoidedPurchaseRefundType };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// src/google-play/real-time-developer-notification.ts
|
|
2
|
+
var SubscriptionNotificationType = /* @__PURE__ */ ((SubscriptionNotificationType2) => {
|
|
3
|
+
SubscriptionNotificationType2[SubscriptionNotificationType2["SUBSCRIPTION_RECOVERED"] = 1] = "SUBSCRIPTION_RECOVERED";
|
|
4
|
+
SubscriptionNotificationType2[SubscriptionNotificationType2["SUBSCRIPTION_RENEWED"] = 2] = "SUBSCRIPTION_RENEWED";
|
|
5
|
+
SubscriptionNotificationType2[SubscriptionNotificationType2["SUBSCRIPTION_CANCELED"] = 3] = "SUBSCRIPTION_CANCELED";
|
|
6
|
+
SubscriptionNotificationType2[SubscriptionNotificationType2["SUBSCRIPTION_PURCHASED"] = 4] = "SUBSCRIPTION_PURCHASED";
|
|
7
|
+
SubscriptionNotificationType2[SubscriptionNotificationType2["SUBSCRIPTION_ON_HOLD"] = 5] = "SUBSCRIPTION_ON_HOLD";
|
|
8
|
+
SubscriptionNotificationType2[SubscriptionNotificationType2["SUBSCRIPTION_IN_GRACE_PERIOD"] = 6] = "SUBSCRIPTION_IN_GRACE_PERIOD";
|
|
9
|
+
SubscriptionNotificationType2[SubscriptionNotificationType2["SUBSCRIPTION_RESTARTED"] = 7] = "SUBSCRIPTION_RESTARTED";
|
|
10
|
+
SubscriptionNotificationType2[SubscriptionNotificationType2["SUBSCRIPTION_PRICE_CHANGE_CONFIRMED"] = 8] = "SUBSCRIPTION_PRICE_CHANGE_CONFIRMED";
|
|
11
|
+
SubscriptionNotificationType2[SubscriptionNotificationType2["SUBSCRIPTION_DEFERRED"] = 9] = "SUBSCRIPTION_DEFERRED";
|
|
12
|
+
SubscriptionNotificationType2[SubscriptionNotificationType2["SUBSCRIPTION_PAUSED"] = 10] = "SUBSCRIPTION_PAUSED";
|
|
13
|
+
SubscriptionNotificationType2[SubscriptionNotificationType2["SUBSCRIPTION_PAUSE_SCHEDULE_CHANGED"] = 11] = "SUBSCRIPTION_PAUSE_SCHEDULE_CHANGED";
|
|
14
|
+
SubscriptionNotificationType2[SubscriptionNotificationType2["SUBSCRIPTION_REVOKED"] = 12] = "SUBSCRIPTION_REVOKED";
|
|
15
|
+
SubscriptionNotificationType2[SubscriptionNotificationType2["SUBSCRIPTION_EXPIRED"] = 13] = "SUBSCRIPTION_EXPIRED";
|
|
16
|
+
SubscriptionNotificationType2[SubscriptionNotificationType2["SUBSCRIPTION_PRICE_CHANGE_UPDATED"] = 19] = "SUBSCRIPTION_PRICE_CHANGE_UPDATED";
|
|
17
|
+
SubscriptionNotificationType2[SubscriptionNotificationType2["SUBSCRIPTION_PENDING_PURCHASE_CANCELED"] = 20] = "SUBSCRIPTION_PENDING_PURCHASE_CANCELED";
|
|
18
|
+
return SubscriptionNotificationType2;
|
|
19
|
+
})(SubscriptionNotificationType || {});
|
|
20
|
+
var OneTimeProductNotificationType = /* @__PURE__ */ ((OneTimeProductNotificationType2) => {
|
|
21
|
+
OneTimeProductNotificationType2[OneTimeProductNotificationType2["ONE_TIME_PRODUCT_PURCHASED"] = 1] = "ONE_TIME_PRODUCT_PURCHASED";
|
|
22
|
+
OneTimeProductNotificationType2[OneTimeProductNotificationType2["ONE_TIME_PRODUCT_CANCELED"] = 2] = "ONE_TIME_PRODUCT_CANCELED";
|
|
23
|
+
return OneTimeProductNotificationType2;
|
|
24
|
+
})(OneTimeProductNotificationType || {});
|
|
25
|
+
var VoidedPurchaseProductType = /* @__PURE__ */ ((VoidedPurchaseProductType2) => {
|
|
26
|
+
VoidedPurchaseProductType2[VoidedPurchaseProductType2["PRODUCT_TYPE_SUBSCRIPTION"] = 1] = "PRODUCT_TYPE_SUBSCRIPTION";
|
|
27
|
+
VoidedPurchaseProductType2[VoidedPurchaseProductType2["PRODUCT_TYPE_ONE_TIME"] = 2] = "PRODUCT_TYPE_ONE_TIME";
|
|
28
|
+
return VoidedPurchaseProductType2;
|
|
29
|
+
})(VoidedPurchaseProductType || {});
|
|
30
|
+
var VoidedPurchaseRefundType = /* @__PURE__ */ ((VoidedPurchaseRefundType2) => {
|
|
31
|
+
VoidedPurchaseRefundType2[VoidedPurchaseRefundType2["REFUND_TYPE_FULL_REFUND"] = 1] = "REFUND_TYPE_FULL_REFUND";
|
|
32
|
+
VoidedPurchaseRefundType2[VoidedPurchaseRefundType2["REFUND_TYPE_QUANTITY_BASED_PARTIAL_REFUND"] = 2] = "REFUND_TYPE_QUANTITY_BASED_PARTIAL_REFUND";
|
|
33
|
+
return VoidedPurchaseRefundType2;
|
|
34
|
+
})(VoidedPurchaseRefundType || {});
|
|
35
|
+
var GooglePlaySubscriptionState = /* @__PURE__ */ ((GooglePlaySubscriptionState2) => {
|
|
36
|
+
GooglePlaySubscriptionState2["SUBSCRIPTION_STATE_UNSPECIFIED"] = "SUBSCRIPTION_STATE_UNSPECIFIED";
|
|
37
|
+
GooglePlaySubscriptionState2["SUBSCRIPTION_STATE_PENDING"] = "SUBSCRIPTION_STATE_PENDING";
|
|
38
|
+
GooglePlaySubscriptionState2["SUBSCRIPTION_STATE_ACTIVE"] = "SUBSCRIPTION_STATE_ACTIVE";
|
|
39
|
+
GooglePlaySubscriptionState2["SUBSCRIPTION_STATE_PAUSED"] = "SUBSCRIPTION_STATE_PAUSED";
|
|
40
|
+
GooglePlaySubscriptionState2["SUBSCRIPTION_STATE_IN_GRACE_PERIOD"] = "SUBSCRIPTION_STATE_IN_GRACE_PERIOD";
|
|
41
|
+
GooglePlaySubscriptionState2["SUBSCRIPTION_STATE_ON_HOLD"] = "SUBSCRIPTION_STATE_ON_HOLD";
|
|
42
|
+
GooglePlaySubscriptionState2["SUBSCRIPTION_STATE_CANCELED"] = "SUBSCRIPTION_STATE_CANCELED";
|
|
43
|
+
GooglePlaySubscriptionState2["SUBSCRIPTION_STATE_EXPIRED"] = "SUBSCRIPTION_STATE_EXPIRED";
|
|
44
|
+
GooglePlaySubscriptionState2["SUBSCRIPTION_STATE_PENDING_PURCHASE_CANCELED"] = "SUBSCRIPTION_STATE_PENDING_PURCHASE_CANCELED";
|
|
45
|
+
return GooglePlaySubscriptionState2;
|
|
46
|
+
})(GooglePlaySubscriptionState || {});
|
|
47
|
+
export {
|
|
48
|
+
GooglePlaySubscriptionState,
|
|
49
|
+
OneTimeProductNotificationType,
|
|
50
|
+
SubscriptionNotificationType,
|
|
51
|
+
VoidedPurchaseProductType,
|
|
52
|
+
VoidedPurchaseRefundType
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=real-time-developer-notification.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/google-play/real-time-developer-notification.ts"],"sourcesContent":["// ref: https://cloud.google.com/pubsub/docs/reference/rest/v1/PubsubMessage\nexport type PubsubMessage = {\n data: string;\n attributes: Record<string, string>;\n messageId: string;\n publishTime: string;\n orderingKey: string;\n};\n\n/** https://developer.android.com/google/play/billing/rtdn-reference */\nexport interface DeveloperNotification {\n version: string;\n packageName: string;\n eventTimeMillis: number;\n subscriptionNotification: SubscriptionNotification;\n oneTimeProductNotification: OneTimeProductNotification;\n voidedPurchaseNotification: VoidedPurchaseNotification;\n testNotification: TestNotification;\n}\n\n/**\n * [Real-time developer notifications reference guide](https://developer.android.com/google/play/billing/rtdn-reference)\n * */\nexport enum SubscriptionNotificationType {\n /** A subscription was recovered from account hold. */\n SUBSCRIPTION_RECOVERED = 1,\n\n /** An active subscription was renewed. */\n SUBSCRIPTION_RENEWED = 2,\n\n /**\n * A subscription was either voluntarily or involuntarily cancelled. For voluntary cancellation,\n * sent when the user cancels.\n */\n SUBSCRIPTION_CANCELED = 3,\n\n /** A new subscription was purchased. */\n SUBSCRIPTION_PURCHASED = 4,\n\n /** A subscription has entered account hold (if enabled). */\n SUBSCRIPTION_ON_HOLD = 5,\n\n /** A subscription has entered grace period (if enabled). */\n SUBSCRIPTION_IN_GRACE_PERIOD = 6,\n\n /**\n * User has restored their subscription from Play > Account > Subscriptions. The subscription was\n * canceled but had not expired yet when the user restores. For more information, see Restorations.\n */\n SUBSCRIPTION_RESTARTED = 7,\n\n /** (DEPRECATED) A subscription price change has successfully been confirmed by the user. */\n SUBSCRIPTION_PRICE_CHANGE_CONFIRMED = 8,\n\n /** A subscription's recurrence time has been extended. */\n SUBSCRIPTION_DEFERRED = 9,\n\n /** A subscription has been paused. */\n SUBSCRIPTION_PAUSED = 10,\n\n /** A subscription pause schedule has been changed. */\n SUBSCRIPTION_PAUSE_SCHEDULE_CHANGED = 11,\n\n /** A subscription has been revoked from the user before the expiration time. */\n SUBSCRIPTION_REVOKED = 12,\n\n /** A subscription has expired. */\n SUBSCRIPTION_EXPIRED = 13,\n\n /** A subscription item's price change details are updated. */\n SUBSCRIPTION_PRICE_CHANGE_UPDATED = 19,\n\n /** A pending transaction of a subscription has been canceled. */\n SUBSCRIPTION_PENDING_PURCHASE_CANCELED = 20,\n}\n\nexport interface SubscriptionNotification {\n version: string;\n purchaseToken: string;\n notificationType: SubscriptionNotificationType;\n}\n\nexport enum OneTimeProductNotificationType {\n /** A one-time product was successfully purchased by a user. */\n ONE_TIME_PRODUCT_PURCHASED = 1,\n\n /** A pending one-time product purchase has been canceled by the user. */\n ONE_TIME_PRODUCT_CANCELED = 2,\n}\n\nexport interface OneTimeProductNotification {\n version: string;\n sku: string;\n purchaseToken: string;\n notificationType: OneTimeProductNotificationType;\n}\n\nexport enum VoidedPurchaseProductType {\n /** A subscription purchase has been voided. */\n PRODUCT_TYPE_SUBSCRIPTION = 1,\n\n /** A one-time purchase has been voided. */\n PRODUCT_TYPE_ONE_TIME = 2,\n}\n\n/**\n * Note when the remaining total quantity of a multi-quantity purchase is refunded, the refundType\n * will be REFUND_TYPE_FULL_REFUND.\n */\nexport enum VoidedPurchaseRefundType {\n /** The purchase has been fully voided. */\n REFUND_TYPE_FULL_REFUND = 1,\n\n /**\n * The purchase has been partially voided by a quantity-based partial refund, applicable only to\n * multi-quantity purchases. A purchase can be partially voided multiple times.\n */\n REFUND_TYPE_QUANTITY_BASED_PARTIAL_REFUND = 2,\n}\n\nexport interface VoidedPurchaseNotification {\n purchaseToken: string;\n orderId: string;\n productType: VoidedPurchaseProductType;\n refundType: VoidedPurchaseRefundType;\n}\n\nexport interface TestNotification {\n version: string;\n}\n\n/** ref: https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptionsv2#SubscriptionState */\nexport enum GooglePlaySubscriptionState {\n /** Unspecified subscription state. */\n SUBSCRIPTION_STATE_UNSPECIFIED = 'SUBSCRIPTION_STATE_UNSPECIFIED',\n\n /**\n * Subscription was created but awaiting payment during signup. In this state, all items are\n * awaiting payment.\n */\n SUBSCRIPTION_STATE_PENDING = 'SUBSCRIPTION_STATE_PENDING',\n\n /**\n * Subscription is active.\n * (1) If the subscription is an auto renewing plan, at least one item is autoRenewEnabled and not expired.\n * (2) If the subscription is a prepaid plan, at least one item is not expired.\n */\n SUBSCRIPTION_STATE_ACTIVE = 'SUBSCRIPTION_STATE_ACTIVE',\n\n /**\n * Subscription is paused. The state is only available when the subscription is an auto renewing\n * plan. In this state, all items are in paused state.\n */\n SUBSCRIPTION_STATE_PAUSED = 'SUBSCRIPTION_STATE_PAUSED',\n\n /**\n * Subscription is in grace period. The state is only available when the subscription is an auto\n * renewing plan. In this state, all items are in grace period.\n */\n SUBSCRIPTION_STATE_IN_GRACE_PERIOD = 'SUBSCRIPTION_STATE_IN_GRACE_PERIOD',\n\n /**\n * Subscription is on hold (suspended). The state is only available when the subscription is an\n * auto renewing plan. In this state, all items are on hold.\n */\n SUBSCRIPTION_STATE_ON_HOLD = 'SUBSCRIPTION_STATE_ON_HOLD',\n\n /**\n * Subscription is canceled but not expired yet. The state is only available when the subscription\n * is an auto renewing plan. All items have autoRenewEnabled set to false.\n */\n SUBSCRIPTION_STATE_CANCELED = 'SUBSCRIPTION_STATE_CANCELED',\n\n /** Subscription is expired. All items have expiryTime in the past. */\n SUBSCRIPTION_STATE_EXPIRED = 'SUBSCRIPTION_STATE_EXPIRED',\n\n /**\n * Pending transaction for subscription is canceled. If this pending purchase was for an existing\n * subscription, use linkedPurchaseToken to get the current state of that subscription.\n */\n SUBSCRIPTION_STATE_PENDING_PURCHASE_CANCELED = 'SUBSCRIPTION_STATE_PENDING_PURCHASE_CANCELED',\n}\n"],"mappings":";AAuBO,IAAK,+BAAL,kBAAKA,kCAAL;AAEL,EAAAA,4DAAA,4BAAyB,KAAzB;AAGA,EAAAA,4DAAA,0BAAuB,KAAvB;AAMA,EAAAA,4DAAA,2BAAwB,KAAxB;AAGA,EAAAA,4DAAA,4BAAyB,KAAzB;AAGA,EAAAA,4DAAA,0BAAuB,KAAvB;AAGA,EAAAA,4DAAA,kCAA+B,KAA/B;AAMA,EAAAA,4DAAA,4BAAyB,KAAzB;AAGA,EAAAA,4DAAA,yCAAsC,KAAtC;AAGA,EAAAA,4DAAA,2BAAwB,KAAxB;AAGA,EAAAA,4DAAA,yBAAsB,MAAtB;AAGA,EAAAA,4DAAA,yCAAsC,MAAtC;AAGA,EAAAA,4DAAA,0BAAuB,MAAvB;AAGA,EAAAA,4DAAA,0BAAuB,MAAvB;AAGA,EAAAA,4DAAA,uCAAoC,MAApC;AAGA,EAAAA,4DAAA,4CAAyC,MAAzC;AAlDU,SAAAA;AAAA,GAAA;AA2DL,IAAK,iCAAL,kBAAKC,oCAAL;AAEL,EAAAA,gEAAA,gCAA6B,KAA7B;AAGA,EAAAA,gEAAA,+BAA4B,KAA5B;AALU,SAAAA;AAAA,GAAA;AAeL,IAAK,4BAAL,kBAAKC,+BAAL;AAEL,EAAAA,sDAAA,+BAA4B,KAA5B;AAGA,EAAAA,sDAAA,2BAAwB,KAAxB;AALU,SAAAA;AAAA,GAAA;AAYL,IAAK,2BAAL,kBAAKC,8BAAL;AAEL,EAAAA,oDAAA,6BAA0B,KAA1B;AAMA,EAAAA,oDAAA,+CAA4C,KAA5C;AARU,SAAAA;AAAA,GAAA;AAuBL,IAAK,8BAAL,kBAAKC,iCAAL;AAEL,EAAAA,6BAAA,oCAAiC;AAMjC,EAAAA,6BAAA,gCAA6B;AAO7B,EAAAA,6BAAA,+BAA4B;AAM5B,EAAAA,6BAAA,+BAA4B;AAM5B,EAAAA,6BAAA,wCAAqC;AAMrC,EAAAA,6BAAA,gCAA6B;AAM7B,EAAAA,6BAAA,iCAA8B;AAG9B,EAAAA,6BAAA,gCAA6B;AAM7B,EAAAA,6BAAA,kDAA+C;AAhDrC,SAAAA;AAAA,GAAA;","names":["SubscriptionNotificationType","OneTimeProductNotificationType","VoidedPurchaseProductType","VoidedPurchaseRefundType","GooglePlaySubscriptionState"]}
|
package/dist/stripe/metadata.cjs
CHANGED
|
@@ -25,6 +25,7 @@ __export(metadata_exports, {
|
|
|
25
25
|
module.exports = __toCommonJS(metadata_exports);
|
|
26
26
|
var METADATA_KEYS = {
|
|
27
27
|
USER_ID: "user_id",
|
|
28
|
+
USER_ACCOUNT_TOKEN: "user_account_token",
|
|
28
29
|
PRODUCT_ID: "product_id"
|
|
29
30
|
};
|
|
30
31
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/stripe/metadata.ts"],"sourcesContent":["export const METADATA_KEYS = {\n USER_ID: 'user_id',\n PRODUCT_ID: 'product_id',\n} as const;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,IAAM,gBAAgB;AAAA,EAC3B,SAAS;AAAA,EACT,YAAY;AACd;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/stripe/metadata.ts"],"sourcesContent":["export const METADATA_KEYS = {\n USER_ID: 'user_id',\n USER_ACCOUNT_TOKEN: 'user_account_token',\n PRODUCT_ID: 'product_id',\n} as const;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,IAAM,gBAAgB;AAAA,EAC3B,SAAS;AAAA,EACT,oBAAoB;AAAA,EACpB,YAAY;AACd;","names":[]}
|
package/dist/stripe/metadata.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/stripe/metadata.ts"],"sourcesContent":["export const METADATA_KEYS = {\n USER_ID: 'user_id',\n PRODUCT_ID: 'product_id',\n} as const;\n"],"mappings":";AAAO,IAAM,gBAAgB;AAAA,EAC3B,SAAS;AAAA,EACT,YAAY;AACd;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/stripe/metadata.ts"],"sourcesContent":["export const METADATA_KEYS = {\n USER_ID: 'user_id',\n USER_ACCOUNT_TOKEN: 'user_account_token',\n PRODUCT_ID: 'product_id',\n} as const;\n"],"mappings":";AAAO,IAAM,gBAAgB;AAAA,EAC3B,SAAS;AAAA,EACT,oBAAoB;AAAA,EACpB,YAAY;AACd;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shware/purchase",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -25,6 +25,16 @@
|
|
|
25
25
|
"import": "./dist/client/index.mjs",
|
|
26
26
|
"require": "./dist/client/index.cjs"
|
|
27
27
|
},
|
|
28
|
+
"./app-store": {
|
|
29
|
+
"types": "./dist/app-store/index.d.ts",
|
|
30
|
+
"import": "./dist/app-store/index.mjs",
|
|
31
|
+
"require": "./dist/app-store/index.cjs"
|
|
32
|
+
},
|
|
33
|
+
"./google-play": {
|
|
34
|
+
"types": "./dist/google-play/index.d.ts",
|
|
35
|
+
"import": "./dist/google-play/index.mjs",
|
|
36
|
+
"require": "./dist/google-play/index.cjs"
|
|
37
|
+
},
|
|
28
38
|
"./stripe": {
|
|
29
39
|
"types": "./dist/stripe/index.d.ts",
|
|
30
40
|
"import": "./dist/stripe/index.mjs",
|
|
@@ -38,13 +48,13 @@
|
|
|
38
48
|
"@repo/eslint-config": "workspace:*",
|
|
39
49
|
"@repo/typescript-config": "workspace:*",
|
|
40
50
|
"@types/jest": "^30.0.0",
|
|
41
|
-
"@types/node": "^24.
|
|
42
|
-
"jest": "^30.
|
|
51
|
+
"@types/node": "^24.3.0",
|
|
52
|
+
"jest": "^30.1.3",
|
|
43
53
|
"ts-jest": "^29.4.1",
|
|
44
54
|
"typescript": "^5.9.2"
|
|
45
55
|
},
|
|
46
56
|
"dependencies": {
|
|
47
|
-
"zod": "^4.
|
|
57
|
+
"zod": "^4.1.5"
|
|
48
58
|
},
|
|
49
59
|
"peerDependencies": {
|
|
50
60
|
"stripe": "^18.0.0"
|