@activepieces/piece-chargebee 0.0.3 → 0.0.4
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/package.json +7 -12
- package/src/index.js +13 -57
- package/src/index.d.ts +0 -5
- package/src/index.d.ts.map +0 -1
- package/src/index.js.map +0 -1
- package/src/lib/actions/cancel-subscription.d.ts +0 -21
- package/src/lib/actions/cancel-subscription.d.ts.map +0 -1
- package/src/lib/actions/cancel-subscription.js +0 -173
- package/src/lib/actions/cancel-subscription.js.map +0 -1
- package/src/lib/actions/create-customer.d.ts +0 -29
- package/src/lib/actions/create-customer.d.ts.map +0 -1
- package/src/lib/actions/create-customer.js +0 -174
- package/src/lib/actions/create-customer.js.map +0 -1
- package/src/lib/actions/create-subscription.d.ts +0 -20
- package/src/lib/actions/create-subscription.d.ts.map +0 -1
- package/src/lib/actions/create-subscription.js +0 -124
- package/src/lib/actions/create-subscription.js.map +0 -1
- package/src/lib/actions/get-customer.d.ts +0 -7
- package/src/lib/actions/get-customer.d.ts.map +0 -1
- package/src/lib/actions/get-customer.js +0 -37
- package/src/lib/actions/get-customer.js.map +0 -1
- package/src/lib/auth.d.ts +0 -5
- package/src/lib/auth.d.ts.map +0 -1
- package/src/lib/auth.js +0 -46
- package/src/lib/auth.js.map +0 -1
- package/src/lib/common/client.d.ts +0 -15
- package/src/lib/common/client.d.ts.map +0 -1
- package/src/lib/common/client.js +0 -64
- package/src/lib/common/client.js.map +0 -1
- package/src/lib/common/webhook.d.ts +0 -4
- package/src/lib/common/webhook.d.ts.map +0 -1
- package/src/lib/common/webhook.js +0 -48
- package/src/lib/common/webhook.js.map +0 -1
- package/src/lib/triggers/customer-created.d.ts +0 -15
- package/src/lib/triggers/customer-created.d.ts.map +0 -1
- package/src/lib/triggers/customer-created.js +0 -71
- package/src/lib/triggers/customer-created.js.map +0 -1
- package/src/lib/triggers/invoice-generated.d.ts +0 -15
- package/src/lib/triggers/invoice-generated.d.ts.map +0 -1
- package/src/lib/triggers/invoice-generated.js +0 -64
- package/src/lib/triggers/invoice-generated.js.map +0 -1
- package/src/lib/triggers/payment-failed.d.ts +0 -15
- package/src/lib/triggers/payment-failed.d.ts.map +0 -1
- package/src/lib/triggers/payment-failed.js +0 -95
- package/src/lib/triggers/payment-failed.js.map +0 -1
- package/src/lib/triggers/payment-succeeded.d.ts +0 -15
- package/src/lib/triggers/payment-succeeded.d.ts.map +0 -1
- package/src/lib/triggers/payment-succeeded.js +0 -95
- package/src/lib/triggers/payment-succeeded.js.map +0 -1
- package/src/lib/triggers/subscription-cancelled.d.ts +0 -15
- package/src/lib/triggers/subscription-cancelled.d.ts.map +0 -1
- package/src/lib/triggers/subscription-cancelled.js +0 -87
- package/src/lib/triggers/subscription-cancelled.js.map +0 -1
- package/src/lib/triggers/subscription-changed.d.ts +0 -15
- package/src/lib/triggers/subscription-changed.d.ts.map +0 -1
- package/src/lib/triggers/subscription-changed.js +0 -87
- package/src/lib/triggers/subscription-changed.js.map +0 -1
- package/src/lib/triggers/subscription-created.d.ts +0 -15
- package/src/lib/triggers/subscription-created.d.ts.map +0 -1
- package/src/lib/triggers/subscription-created.js +0 -87
- package/src/lib/triggers/subscription-created.js.map +0 -1
- package/src/lib/triggers/subscription-renewed.d.ts +0 -15
- package/src/lib/triggers/subscription-renewed.d.ts.map +0 -1
- package/src/lib/triggers/subscription-renewed.js +0 -87
- package/src/lib/triggers/subscription-renewed.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"payment-succeeded.js","sourceRoot":"","sources":["../../../../src/lib/triggers/payment-succeeded.ts"],"names":[],"mappings":";;;;AAAA,qEAAgF;AAEhF,kCAAwC;AACxC,+CAI2B;AAE3B,MAAM,UAAU,GAAG,mBAAmB,CAAC;AACvC,MAAM,SAAS,GAAG,yCAAyC,CAAC;AAE/C,QAAA,gBAAgB,GAAG,IAAA,gCAAa,EAAC;IAC5C,IAAI,EAAE,oBAAa;IACnB,IAAI,EA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ACb;SACF;KACF;IACK,QAAQ,CAAC,OAAO;;YACpB,MAAM,SAAS,GAAG,MAAM,IAAA,mCAAyB,EAC/C,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EACvB,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,EAC1B,OAAO,CAAC,UAAU,EAClB,UAAU,CACX,CAAC;YACF,MAAM,OAAO,CAAC,KAAK,CAAC,GAAG,CAAS,SAAS,EAAE,SAAS,CAAC,CAAC;QACxD,CAAC;KAAA;IACK,SAAS,CAAC,OAAO;;YACrB,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,KAAK,CAAC,GAAG,CAAS,SAAS,CAAC,CAAC;YAC7D,IAAI,SAAS,EAAE,CAAC;gBACd,MAAM,IAAA,qCAA2B,EAC/B,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EACvB,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,EAC1B,SAAS,CACV,CAAC;YACJ,CAAC;QACH,CAAC;KAAA;IACK,IAAI,CAAC,OAAO;;YAChB,OAAO,IAAA,2BAAiB,EACtB,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EACvB,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,EAC1B,UAAU,CACX,CAAC;QACJ,CAAC;KAAA;IACK,GAAG,CAAC,OAAO;;YACf,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { TriggerStrategy } from '@activepieces/pieces-framework';
|
|
2
|
-
export declare const subscriptionCancelled: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
3
|
-
site: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
-
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
5
|
-
}>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
6
|
-
site: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
7
|
-
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
8
|
-
}>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
9
|
-
site: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
10
|
-
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
11
|
-
}>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
12
|
-
site: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
13
|
-
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
14
|
-
}>, {}>;
|
|
15
|
-
//# sourceMappingURL=subscription-cancelled.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"subscription-cancelled.d.ts","sourceRoot":"","sources":["../../../../src/lib/triggers/subscription-cancelled.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAYhF,eAAO,MAAM,qBAAqB;;;;;;;;;;;;OAkFhC,CAAC"}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.subscriptionCancelled = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
-
const auth_1 = require("../auth");
|
|
7
|
-
const webhook_1 = require("../common/webhook");
|
|
8
|
-
const EVENT_TYPE = 'subscription_cancelled';
|
|
9
|
-
const STORE_KEY = '_chargebee_subscription_cancelled_webhook_id';
|
|
10
|
-
exports.subscriptionCancelled = (0, pieces_framework_1.createTrigger)({
|
|
11
|
-
auth: auth_1.chargebeeAuth,
|
|
12
|
-
name: 'subscription_cancelled',
|
|
13
|
-
displayName: 'Subscription Cancelled',
|
|
14
|
-
description: 'Triggers when a subscription is cancelled.',
|
|
15
|
-
aiMetadata: {
|
|
16
|
-
description: 'Fires when Chargebee records a subscription_cancelled event — a subscription has been cancelled (immediately or at end of term). The payload carries the cancelled subscription with its customer and invoice.',
|
|
17
|
-
},
|
|
18
|
-
props: {},
|
|
19
|
-
type: pieces_framework_1.TriggerStrategy.WEBHOOK,
|
|
20
|
-
sampleData: {
|
|
21
|
-
id: 'ev_subscriptiwwy3vs',
|
|
22
|
-
occurred_at: 1776067860,
|
|
23
|
-
source: 'admin_console',
|
|
24
|
-
object: 'event',
|
|
25
|
-
api_version: 'v2',
|
|
26
|
-
event_type: 'subscription_cancelled',
|
|
27
|
-
webhook_status: 'not_applicable',
|
|
28
|
-
content: {
|
|
29
|
-
subscription: {
|
|
30
|
-
activated_at: 1612890920,
|
|
31
|
-
billing_period: 1,
|
|
32
|
-
billing_period_unit: 'month',
|
|
33
|
-
created_at: 1612890920,
|
|
34
|
-
currency_code: 'USD',
|
|
35
|
-
'...': '...',
|
|
36
|
-
},
|
|
37
|
-
customer: {
|
|
38
|
-
allow_direct_debit: false,
|
|
39
|
-
auto_collection: 'on',
|
|
40
|
-
billing_address: {
|
|
41
|
-
city: 'Walnut',
|
|
42
|
-
country: 'US',
|
|
43
|
-
first_name: 'John',
|
|
44
|
-
last_name: 'Doe',
|
|
45
|
-
line1: 'PO Box 9999',
|
|
46
|
-
'...': '...',
|
|
47
|
-
},
|
|
48
|
-
card_status: 'no_card',
|
|
49
|
-
created_at: 1517505731,
|
|
50
|
-
'...': '...',
|
|
51
|
-
},
|
|
52
|
-
invoice: {
|
|
53
|
-
adjustment_credit_notes: {},
|
|
54
|
-
amount_adjusted: 0,
|
|
55
|
-
amount_due: 0,
|
|
56
|
-
amount_paid: 1000,
|
|
57
|
-
amount_to_collect: 0,
|
|
58
|
-
'...': '...',
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
onEnable(context) {
|
|
63
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
64
|
-
const webhookId = yield (0, webhook_1.subscribeChargebeeWebhook)(context.auth.props.site, context.auth.props.api_key, context.webhookUrl, EVENT_TYPE);
|
|
65
|
-
yield context.store.put(STORE_KEY, webhookId);
|
|
66
|
-
});
|
|
67
|
-
},
|
|
68
|
-
onDisable(context) {
|
|
69
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
70
|
-
const webhookId = yield context.store.get(STORE_KEY);
|
|
71
|
-
if (webhookId) {
|
|
72
|
-
yield (0, webhook_1.unsubscribeChargebeeWebhook)(context.auth.props.site, context.auth.props.api_key, webhookId);
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
},
|
|
76
|
-
test(context) {
|
|
77
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
78
|
-
return (0, webhook_1.fetchRecentEvents)(context.auth.props.site, context.auth.props.api_key, EVENT_TYPE);
|
|
79
|
-
});
|
|
80
|
-
},
|
|
81
|
-
run(context) {
|
|
82
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
83
|
-
return [context.payload.body];
|
|
84
|
-
});
|
|
85
|
-
},
|
|
86
|
-
});
|
|
87
|
-
//# sourceMappingURL=subscription-cancelled.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"subscription-cancelled.js","sourceRoot":"","sources":["../../../../src/lib/triggers/subscription-cancelled.ts"],"names":[],"mappings":";;;;AAAA,qEAAgF;AAEhF,kCAAwC;AACxC,+CAI2B;AAE3B,MAAM,UAAU,GAAG,wBAAwB,CAAC;AAC5C,MAAM,SAAS,GAAG,8CAA8C,CAAC;AAEpD,QAAA,qBAAqB,GAAG,IAAA,gCAAa,EAAC;I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B,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,EAC1B,OAAO,CAAC,UAAU,EAClB,UAAU,CACX,CAAC;YACF,MAAM,OAAO,CAAC,KAAK,CAAC,GAAG,CAAS,SAAS,EAAE,SAAS,CAAC,CAAC;QACxD,CAAC;KAAA;IACK,SAAS,CAAC,OAAO;;YACrB,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,KAAK,CAAC,GAAG,CAAS,SAAS,CAAC,CAAC;YAC7D,IAAI,SAAS,EAAE,CAAC;gBACd,MAAM,IAAA,qCAA2B,EAC/B,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EACvB,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,EAC1B,SAAS,CACV,CAAC;YACJ,CAAC;QACH,CAAC;KAAA;IACK,IAAI,CAAC,OAAO;;YAChB,OAAO,IAAA,2BAAiB,EACtB,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EACvB,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,EAC1B,UAAU,CACX,CAAC;QACJ,CAAC;KAAA;IACK,GAAG,CAAC,OAAO;;YACf,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { TriggerStrategy } from '@activepieces/pieces-framework';
|
|
2
|
-
export declare const subscriptionChanged: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
3
|
-
site: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
-
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
5
|
-
}>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
6
|
-
site: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
7
|
-
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
8
|
-
}>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
9
|
-
site: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
10
|
-
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
11
|
-
}>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
12
|
-
site: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
13
|
-
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
14
|
-
}>, {}>;
|
|
15
|
-
//# sourceMappingURL=subscription-changed.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"subscription-changed.d.ts","sourceRoot":"","sources":["../../../../src/lib/triggers/subscription-changed.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAYhF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;OAmF9B,CAAC"}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.subscriptionChanged = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
-
const auth_1 = require("../auth");
|
|
7
|
-
const webhook_1 = require("../common/webhook");
|
|
8
|
-
const EVENT_TYPE = 'subscription_changed';
|
|
9
|
-
const STORE_KEY = '_chargebee_subscription_changed_webhook_id';
|
|
10
|
-
exports.subscriptionChanged = (0, pieces_framework_1.createTrigger)({
|
|
11
|
-
auth: auth_1.chargebeeAuth,
|
|
12
|
-
name: 'subscription_changed',
|
|
13
|
-
displayName: 'Subscription Changed',
|
|
14
|
-
description: 'Triggers when a subscription is updated — plan change, quantity, or add-ons.',
|
|
15
|
-
aiMetadata: {
|
|
16
|
-
description: 'Fires when Chargebee records a subscription_changed event — an existing subscription was modified (plan/item price change, quantity, or add-ons). The payload carries the updated subscription with its customer and invoice.',
|
|
17
|
-
},
|
|
18
|
-
props: {},
|
|
19
|
-
type: pieces_framework_1.TriggerStrategy.WEBHOOK,
|
|
20
|
-
sampleData: {
|
|
21
|
-
id: 'ev_subscriptiwwy6f7',
|
|
22
|
-
occurred_at: 1776067863,
|
|
23
|
-
source: 'admin_console',
|
|
24
|
-
object: 'event',
|
|
25
|
-
api_version: 'v2',
|
|
26
|
-
event_type: 'subscription_changed',
|
|
27
|
-
webhook_status: 'not_applicable',
|
|
28
|
-
content: {
|
|
29
|
-
subscription: {
|
|
30
|
-
activated_at: 1612890920,
|
|
31
|
-
billing_period: 1,
|
|
32
|
-
billing_period_unit: 'month',
|
|
33
|
-
created_at: 1612890920,
|
|
34
|
-
currency_code: 'USD',
|
|
35
|
-
'...': '...',
|
|
36
|
-
},
|
|
37
|
-
customer: {
|
|
38
|
-
allow_direct_debit: false,
|
|
39
|
-
auto_collection: 'on',
|
|
40
|
-
billing_address: {
|
|
41
|
-
city: 'Walnut',
|
|
42
|
-
country: 'US',
|
|
43
|
-
first_name: 'John',
|
|
44
|
-
last_name: 'Doe',
|
|
45
|
-
line1: 'PO Box 9999',
|
|
46
|
-
'...': '...',
|
|
47
|
-
},
|
|
48
|
-
card_status: 'no_card',
|
|
49
|
-
created_at: 1517505731,
|
|
50
|
-
'...': '...',
|
|
51
|
-
},
|
|
52
|
-
invoice: {
|
|
53
|
-
adjustment_credit_notes: {},
|
|
54
|
-
amount_adjusted: 0,
|
|
55
|
-
amount_due: 0,
|
|
56
|
-
amount_paid: 1000,
|
|
57
|
-
amount_to_collect: 0,
|
|
58
|
-
'...': '...',
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
onEnable(context) {
|
|
63
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
64
|
-
const webhookId = yield (0, webhook_1.subscribeChargebeeWebhook)(context.auth.props.site, context.auth.props.api_key, context.webhookUrl, EVENT_TYPE);
|
|
65
|
-
yield context.store.put(STORE_KEY, webhookId);
|
|
66
|
-
});
|
|
67
|
-
},
|
|
68
|
-
onDisable(context) {
|
|
69
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
70
|
-
const webhookId = yield context.store.get(STORE_KEY);
|
|
71
|
-
if (webhookId) {
|
|
72
|
-
yield (0, webhook_1.unsubscribeChargebeeWebhook)(context.auth.props.site, context.auth.props.api_key, webhookId);
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
},
|
|
76
|
-
test(context) {
|
|
77
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
78
|
-
return (0, webhook_1.fetchRecentEvents)(context.auth.props.site, context.auth.props.api_key, EVENT_TYPE);
|
|
79
|
-
});
|
|
80
|
-
},
|
|
81
|
-
run(context) {
|
|
82
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
83
|
-
return [context.payload.body];
|
|
84
|
-
});
|
|
85
|
-
},
|
|
86
|
-
});
|
|
87
|
-
//# sourceMappingURL=subscription-changed.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"subscription-changed.js","sourceRoot":"","sources":["../../../../src/lib/triggers/subscription-changed.ts"],"names":[],"mappings":";;;;AAAA,qEAAgF;AAEhF,kCAAwC;AACxC,+CAI2B;AAE3B,MAAM,UAAU,GAAG,sBAAsB,CAAC;AAC1C,MAAM,SAAS,GAAG,4CAA4C,CAAC;AAElD,QAAA,mBAAmB,GAAG,IAAA,gCAAa,EAAC;IAC/C,IAAI,EAAE,oBAAa;IACnB,IAAI,EAAE,sBAAsB;IAC5B,WAAW,EAAE,sBAAsB;IACnC,WAAW,EACT,8EAA8E;IAChF,UAAU,EAAE;QACV,WAAW,EACT,+NAA+N;KA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E,SAAS,CAAC,CAAC;QACxD,CAAC;KAAA;IACK,SAAS,CAAC,OAAO;;YACrB,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,KAAK,CAAC,GAAG,CAAS,SAAS,CAAC,CAAC;YAC7D,IAAI,SAAS,EAAE,CAAC;gBACd,MAAM,IAAA,qCAA2B,EAC/B,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EACvB,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,EAC1B,SAAS,CACV,CAAC;YACJ,CAAC;QACH,CAAC;KAAA;IACK,IAAI,CAAC,OAAO;;YAChB,OAAO,IAAA,2BAAiB,EACtB,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EACvB,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,EAC1B,UAAU,CACX,CAAC;QACJ,CAAC;KAAA;IACK,GAAG,CAAC,OAAO;;YACf,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { TriggerStrategy } from '@activepieces/pieces-framework';
|
|
2
|
-
export declare const subscriptionCreated: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
3
|
-
site: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
-
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
5
|
-
}>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
6
|
-
site: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
7
|
-
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
8
|
-
}>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
9
|
-
site: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
10
|
-
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
11
|
-
}>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
12
|
-
site: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
13
|
-
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
14
|
-
}>, {}>;
|
|
15
|
-
//# sourceMappingURL=subscription-created.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"subscription-created.d.ts","sourceRoot":"","sources":["../../../../src/lib/triggers/subscription-created.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAYhF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;OAkF9B,CAAC"}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.subscriptionCreated = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
-
const auth_1 = require("../auth");
|
|
7
|
-
const webhook_1 = require("../common/webhook");
|
|
8
|
-
const EVENT_TYPE = 'subscription_created';
|
|
9
|
-
const STORE_KEY = '_chargebee_subscription_created_webhook_id';
|
|
10
|
-
exports.subscriptionCreated = (0, pieces_framework_1.createTrigger)({
|
|
11
|
-
auth: auth_1.chargebeeAuth,
|
|
12
|
-
name: 'subscription_created',
|
|
13
|
-
displayName: 'Subscription Created',
|
|
14
|
-
description: 'Triggers when a new subscription is created for a customer.',
|
|
15
|
-
aiMetadata: {
|
|
16
|
-
description: 'Fires when Chargebee records a subscription_created event — a new subscription has been created for a customer. The payload carries the subscription along with its customer and (if applicable) invoice.',
|
|
17
|
-
},
|
|
18
|
-
props: {},
|
|
19
|
-
type: pieces_framework_1.TriggerStrategy.WEBHOOK,
|
|
20
|
-
sampleData: {
|
|
21
|
-
id: 'ev_subscriptiwwy7vs',
|
|
22
|
-
occurred_at: 1776067865,
|
|
23
|
-
source: 'admin_console',
|
|
24
|
-
object: 'event',
|
|
25
|
-
api_version: 'v2',
|
|
26
|
-
event_type: 'subscription_created',
|
|
27
|
-
webhook_status: 'not_applicable',
|
|
28
|
-
content: {
|
|
29
|
-
subscription: {
|
|
30
|
-
activated_at: 1612890920,
|
|
31
|
-
billing_period: 1,
|
|
32
|
-
billing_period_unit: 'month',
|
|
33
|
-
created_at: 1612890920,
|
|
34
|
-
currency_code: 'USD',
|
|
35
|
-
'...': '...',
|
|
36
|
-
},
|
|
37
|
-
customer: {
|
|
38
|
-
allow_direct_debit: false,
|
|
39
|
-
auto_collection: 'on',
|
|
40
|
-
billing_address: {
|
|
41
|
-
city: 'Walnut',
|
|
42
|
-
country: 'US',
|
|
43
|
-
first_name: 'John',
|
|
44
|
-
last_name: 'Doe',
|
|
45
|
-
line1: 'PO Box 9999',
|
|
46
|
-
'...': '...',
|
|
47
|
-
},
|
|
48
|
-
card_status: 'no_card',
|
|
49
|
-
created_at: 1517505731,
|
|
50
|
-
'...': '...',
|
|
51
|
-
},
|
|
52
|
-
invoice: {
|
|
53
|
-
adjustment_credit_notes: {},
|
|
54
|
-
amount_adjusted: 0,
|
|
55
|
-
amount_due: 0,
|
|
56
|
-
amount_paid: 1000,
|
|
57
|
-
amount_to_collect: 0,
|
|
58
|
-
'...': '...',
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
onEnable(context) {
|
|
63
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
64
|
-
const webhookId = yield (0, webhook_1.subscribeChargebeeWebhook)(context.auth.props.site, context.auth.props.api_key, context.webhookUrl, EVENT_TYPE);
|
|
65
|
-
yield context.store.put(STORE_KEY, webhookId);
|
|
66
|
-
});
|
|
67
|
-
},
|
|
68
|
-
onDisable(context) {
|
|
69
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
70
|
-
const webhookId = yield context.store.get(STORE_KEY);
|
|
71
|
-
if (webhookId) {
|
|
72
|
-
yield (0, webhook_1.unsubscribeChargebeeWebhook)(context.auth.props.site, context.auth.props.api_key, webhookId);
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
},
|
|
76
|
-
test(context) {
|
|
77
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
78
|
-
return (0, webhook_1.fetchRecentEvents)(context.auth.props.site, context.auth.props.api_key, EVENT_TYPE);
|
|
79
|
-
});
|
|
80
|
-
},
|
|
81
|
-
run(context) {
|
|
82
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
83
|
-
return [context.payload.body];
|
|
84
|
-
});
|
|
85
|
-
},
|
|
86
|
-
});
|
|
87
|
-
//# sourceMappingURL=subscription-created.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"subscription-created.js","sourceRoot":"","sources":["../../../../src/lib/triggers/subscription-created.ts"],"names":[],"mappings":";;;;AAAA,qEAAgF;AAEhF,kCAAwC;AACxC,+CAI2B;AAE3B,MAAM,UAAU,GAAG,sBAAsB,CAAC;AAC1C,MAAM,SAAS,GAAG,4CAA4C,CAAC;AAElD,QAAA,mBAAmB,GAAG,IAAA,gCAAa,EAAC;IAC/C,IAAI,EAAE,oBAAa;IACnB,IAAI,EAAE,sBAAsB;IAC5B,WAAW,EAAE,sBAAsB;IACnC,WAAW,EAAE,6DAA6D;IAC1E,UAAU,EAAE;QACV,WAAW,EACT,2MAA2M;KAC9M;IACD,KAAK,EAAE,EAAE;IACT,IAAI,EAAE,kCAAe,CAAC,OAAO;IAC7B,UAAU,EAAE;QACV,EAAE,EAAE,qBAAqB;QACzB,WAAW,EAAE,UAAU;QACvB,MAAM,EAAE,eAAe;QACvB,MAAM,EAAE,OAAO;QACf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,MAAM,IAAA,qCAA2B,EAC/B,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EACvB,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,EAC1B,SAAS,CACV,CAAC;YACJ,CAAC;QACH,CAAC;KAAA;IACK,IAAI,CAAC,OAAO;;YAChB,OAAO,IAAA,2BAAiB,EACtB,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EACvB,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,EAC1B,UAAU,CACX,CAAC;QACJ,CAAC;KAAA;IACK,GAAG,CAAC,OAAO;;YACf,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { TriggerStrategy } from '@activepieces/pieces-framework';
|
|
2
|
-
export declare const subscriptionRenewed: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
3
|
-
site: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
-
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
5
|
-
}>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
6
|
-
site: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
7
|
-
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
8
|
-
}>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
9
|
-
site: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
10
|
-
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
11
|
-
}>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
12
|
-
site: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
13
|
-
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
14
|
-
}>, {}>;
|
|
15
|
-
//# sourceMappingURL=subscription-renewed.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"subscription-renewed.d.ts","sourceRoot":"","sources":["../../../../src/lib/triggers/subscription-renewed.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAYhF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;OAkF9B,CAAC"}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.subscriptionRenewed = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
-
const auth_1 = require("../auth");
|
|
7
|
-
const webhook_1 = require("../common/webhook");
|
|
8
|
-
const EVENT_TYPE = 'subscription_renewed';
|
|
9
|
-
const STORE_KEY = '_chargebee_subscription_renewed_webhook_id';
|
|
10
|
-
exports.subscriptionRenewed = (0, pieces_framework_1.createTrigger)({
|
|
11
|
-
auth: auth_1.chargebeeAuth,
|
|
12
|
-
name: 'subscription_renewed',
|
|
13
|
-
displayName: 'Subscription Renewed',
|
|
14
|
-
description: 'Triggers when a subscription is successfully renewed.',
|
|
15
|
-
aiMetadata: {
|
|
16
|
-
description: 'Fires when Chargebee records a subscription_renewed event — a subscription has advanced into a new billing term. The payload carries the renewed subscription with its customer and invoice.',
|
|
17
|
-
},
|
|
18
|
-
props: {},
|
|
19
|
-
type: pieces_framework_1.TriggerStrategy.WEBHOOK,
|
|
20
|
-
sampleData: {
|
|
21
|
-
id: 'ev_subscriptiwwy5ex',
|
|
22
|
-
occurred_at: 1776067862,
|
|
23
|
-
source: 'admin_console',
|
|
24
|
-
object: 'event',
|
|
25
|
-
api_version: 'v2',
|
|
26
|
-
event_type: 'subscription_renewed',
|
|
27
|
-
webhook_status: 'not_applicable',
|
|
28
|
-
content: {
|
|
29
|
-
subscription: {
|
|
30
|
-
activated_at: 1612890920,
|
|
31
|
-
billing_period: 1,
|
|
32
|
-
billing_period_unit: 'month',
|
|
33
|
-
created_at: 1612890920,
|
|
34
|
-
currency_code: 'USD',
|
|
35
|
-
'...': '...',
|
|
36
|
-
},
|
|
37
|
-
customer: {
|
|
38
|
-
allow_direct_debit: false,
|
|
39
|
-
auto_collection: 'on',
|
|
40
|
-
billing_address: {
|
|
41
|
-
city: 'Walnut',
|
|
42
|
-
country: 'US',
|
|
43
|
-
first_name: 'John',
|
|
44
|
-
last_name: 'Doe',
|
|
45
|
-
line1: 'PO Box 9999',
|
|
46
|
-
'...': '...',
|
|
47
|
-
},
|
|
48
|
-
card_status: 'no_card',
|
|
49
|
-
created_at: 1517505731,
|
|
50
|
-
'...': '...',
|
|
51
|
-
},
|
|
52
|
-
invoice: {
|
|
53
|
-
adjustment_credit_notes: {},
|
|
54
|
-
amount_adjusted: 0,
|
|
55
|
-
amount_due: 0,
|
|
56
|
-
amount_paid: 1000,
|
|
57
|
-
amount_to_collect: 0,
|
|
58
|
-
'...': '...',
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
onEnable(context) {
|
|
63
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
64
|
-
const webhookId = yield (0, webhook_1.subscribeChargebeeWebhook)(context.auth.props.site, context.auth.props.api_key, context.webhookUrl, EVENT_TYPE);
|
|
65
|
-
yield context.store.put(STORE_KEY, webhookId);
|
|
66
|
-
});
|
|
67
|
-
},
|
|
68
|
-
onDisable(context) {
|
|
69
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
70
|
-
const webhookId = yield context.store.get(STORE_KEY);
|
|
71
|
-
if (webhookId) {
|
|
72
|
-
yield (0, webhook_1.unsubscribeChargebeeWebhook)(context.auth.props.site, context.auth.props.api_key, webhookId);
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
},
|
|
76
|
-
test(context) {
|
|
77
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
78
|
-
return (0, webhook_1.fetchRecentEvents)(context.auth.props.site, context.auth.props.api_key, EVENT_TYPE);
|
|
79
|
-
});
|
|
80
|
-
},
|
|
81
|
-
run(context) {
|
|
82
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
83
|
-
return [context.payload.body];
|
|
84
|
-
});
|
|
85
|
-
},
|
|
86
|
-
});
|
|
87
|
-
//# sourceMappingURL=subscription-renewed.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"subscription-renewed.js","sourceRoot":"","sources":["../../../../src/lib/triggers/subscription-renewed.ts"],"names":[],"mappings":";;;;AAAA,qEAAgF;AAEhF,kCAAwC;AACxC,+CAI2B;AAE3B,MAAM,UAAU,GAAG,sBAAsB,CAAC;AAC1C,MAAM,SAAS,GAAG,4CAA4C,CAAC;AAElD,QAAA,mBAAmB,GAAG,IAAA,gCAAa,EAAC;IAC/C,IAAI,EAAE,oBAAa;IACnB,IAAI,EAAE,sBAAsB;IAC5B,WAAW,EAAE,sBAAsB;IACnC,WAAW,EAAE,uDAAuD;IACpE,UAAU,EAAE;QACV,WAAW,EACT,8LAA8L;KACjM;IACD,KAAK,EAAE,EAAE;IACT,IAAI,EAAE,kCAAe,CAAC,OAAO;IAC7B,UAAU,EAAE;QACV,EAAE,EAAE,qBAAqB;QACzB,WAAW,EAAE,UAAU;QACvB,MAAM,EAAE,eAAe;QACvB,MAAM,EAAE,OAAO;QACf,WAAW,EAAE,IAAI;QACjB,UAAU,EAAE,sBAAsB;QAClC,cAAc,EAAE,gBAAgB;QAChC,OAAO,EAAE;YACP,YAAY,EAAE;gBACZ,YAAY,EAAE,UAAU;gBACxB,cAAc,EAAE,CAA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