@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.
Files changed (65) hide show
  1. package/package.json +7 -12
  2. package/src/index.js +13 -57
  3. package/src/index.d.ts +0 -5
  4. package/src/index.d.ts.map +0 -1
  5. package/src/index.js.map +0 -1
  6. package/src/lib/actions/cancel-subscription.d.ts +0 -21
  7. package/src/lib/actions/cancel-subscription.d.ts.map +0 -1
  8. package/src/lib/actions/cancel-subscription.js +0 -173
  9. package/src/lib/actions/cancel-subscription.js.map +0 -1
  10. package/src/lib/actions/create-customer.d.ts +0 -29
  11. package/src/lib/actions/create-customer.d.ts.map +0 -1
  12. package/src/lib/actions/create-customer.js +0 -174
  13. package/src/lib/actions/create-customer.js.map +0 -1
  14. package/src/lib/actions/create-subscription.d.ts +0 -20
  15. package/src/lib/actions/create-subscription.d.ts.map +0 -1
  16. package/src/lib/actions/create-subscription.js +0 -124
  17. package/src/lib/actions/create-subscription.js.map +0 -1
  18. package/src/lib/actions/get-customer.d.ts +0 -7
  19. package/src/lib/actions/get-customer.d.ts.map +0 -1
  20. package/src/lib/actions/get-customer.js +0 -37
  21. package/src/lib/actions/get-customer.js.map +0 -1
  22. package/src/lib/auth.d.ts +0 -5
  23. package/src/lib/auth.d.ts.map +0 -1
  24. package/src/lib/auth.js +0 -46
  25. package/src/lib/auth.js.map +0 -1
  26. package/src/lib/common/client.d.ts +0 -15
  27. package/src/lib/common/client.d.ts.map +0 -1
  28. package/src/lib/common/client.js +0 -64
  29. package/src/lib/common/client.js.map +0 -1
  30. package/src/lib/common/webhook.d.ts +0 -4
  31. package/src/lib/common/webhook.d.ts.map +0 -1
  32. package/src/lib/common/webhook.js +0 -48
  33. package/src/lib/common/webhook.js.map +0 -1
  34. package/src/lib/triggers/customer-created.d.ts +0 -15
  35. package/src/lib/triggers/customer-created.d.ts.map +0 -1
  36. package/src/lib/triggers/customer-created.js +0 -71
  37. package/src/lib/triggers/customer-created.js.map +0 -1
  38. package/src/lib/triggers/invoice-generated.d.ts +0 -15
  39. package/src/lib/triggers/invoice-generated.d.ts.map +0 -1
  40. package/src/lib/triggers/invoice-generated.js +0 -64
  41. package/src/lib/triggers/invoice-generated.js.map +0 -1
  42. package/src/lib/triggers/payment-failed.d.ts +0 -15
  43. package/src/lib/triggers/payment-failed.d.ts.map +0 -1
  44. package/src/lib/triggers/payment-failed.js +0 -95
  45. package/src/lib/triggers/payment-failed.js.map +0 -1
  46. package/src/lib/triggers/payment-succeeded.d.ts +0 -15
  47. package/src/lib/triggers/payment-succeeded.d.ts.map +0 -1
  48. package/src/lib/triggers/payment-succeeded.js +0 -95
  49. package/src/lib/triggers/payment-succeeded.js.map +0 -1
  50. package/src/lib/triggers/subscription-cancelled.d.ts +0 -15
  51. package/src/lib/triggers/subscription-cancelled.d.ts.map +0 -1
  52. package/src/lib/triggers/subscription-cancelled.js +0 -87
  53. package/src/lib/triggers/subscription-cancelled.js.map +0 -1
  54. package/src/lib/triggers/subscription-changed.d.ts +0 -15
  55. package/src/lib/triggers/subscription-changed.d.ts.map +0 -1
  56. package/src/lib/triggers/subscription-changed.js +0 -87
  57. package/src/lib/triggers/subscription-changed.js.map +0 -1
  58. package/src/lib/triggers/subscription-created.d.ts +0 -15
  59. package/src/lib/triggers/subscription-created.d.ts.map +0 -1
  60. package/src/lib/triggers/subscription-created.js +0 -87
  61. package/src/lib/triggers/subscription-created.js.map +0 -1
  62. package/src/lib/triggers/subscription-renewed.d.ts +0 -15
  63. package/src/lib/triggers/subscription-renewed.d.ts.map +0 -1
  64. package/src/lib/triggers/subscription-renewed.js +0 -87
  65. package/src/lib/triggers/subscription-renewed.js.map +0 -1
package/src/lib/auth.js DELETED
@@ -1,46 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.chargebeeAuth = void 0;
4
- const tslib_1 = require("tslib");
5
- const pieces_common_1 = require("@activepieces/pieces-common");
6
- const pieces_framework_1 = require("@activepieces/pieces-framework");
7
- const client_1 = require("./common/client");
8
- exports.chargebeeAuth = pieces_framework_1.PieceAuth.CustomAuth({
9
- displayName: 'Chargebee',
10
- description: 'Go to Settings > Configure Chargebee > API Keys and Webhooks > API Keys tab. Click Add an API Key, select Full-Access Key, and copy the generated key.',
11
- required: true,
12
- props: {
13
- site: pieces_framework_1.Property.ShortText({
14
- displayName: 'Site',
15
- description: 'Your Chargebee site subdomain. For acme.chargebee.com, enter acme.',
16
- required: true,
17
- }),
18
- api_key: pieces_framework_1.PieceAuth.SecretText({
19
- displayName: 'API Key',
20
- description: 'Go to Settings > Configure Chargebee > API Keys and Webhooks > API Keys tab. Click Add an API Key, select Full-Access Key, and copy the generated key.',
21
- required: true,
22
- }),
23
- },
24
- validate: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
25
- try {
26
- yield (0, client_1.chargebeeRequest)({
27
- site: auth.site,
28
- apiKey: auth.api_key,
29
- method: pieces_common_1.HttpMethod.GET,
30
- path: '/customers?limit=1',
31
- });
32
- return {
33
- valid: true,
34
- };
35
- }
36
- catch (error) {
37
- return {
38
- valid: false,
39
- error: error instanceof Error
40
- ? error.message
41
- : 'Failed to validate Chargebee credentials.',
42
- };
43
- }
44
- }),
45
- });
46
- //# sourceMappingURL=auth.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/lib/auth.ts"],"names":[],"mappings":";;;;AAAA,+DAAyD;AACzD,qEAAqE;AAErE,4CAAmD;AAEtC,QAAA,aAAa,GAAG,4BAAS,CAAC,UAAU,CAAC;IAChD,WAAW,EAAE,WAAW;IACxB,WAAW,EACT,wJAAwJ;IAC1J,QAAQ,EAAE,IAAI;IACd,KAAK,EAAE;QACL,IAAI,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACvB,WAAW,EAAE,MAAM;YACnB,WAAW,EACT,oEAAoE;YACtE,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,OAAO,EAAE,4BAAS,CAAC,UAAU,CAAC;YAC5B,WAAW,EAAE,SAAS;YACtB,WAAW,EACT,wJAAwJ;YAC1J,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACD,QAAQ,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;QACvB,IAAI,CAAC;YACH,MAAM,IAAA,yBAAgB,EAAC;gBACrB,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,MAAM,EAAE,IAAI,CAAC,OAAO;gBACpB,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,IAAI,EAAE,oBAAoB;aAC3B,CAAC,CAAC;YACH,OAAO;gBACL,KAAK,EAAE,IAAI;aACZ,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO;gBACL,KAAK,EAAE,KAAK;gBACZ,KAAK,EACH,KAAK,YAAY,KAAK;oBACpB,CAAC,CAAC,KAAK,CAAC,OAAO;oBACf,CAAC,CAAC,2CAA2C;aAClD,CAAC;QACJ,CAAC;IACH,CAAC,CAAA;CACF,CAAC,CAAC"}
@@ -1,15 +0,0 @@
1
- import { HttpMethod } from '@activepieces/pieces-common';
2
- type ChargebeeRequestParams = {
3
- site: string;
4
- apiKey: string;
5
- method: HttpMethod;
6
- path: string;
7
- body?: Record<string, unknown>;
8
- contentType?: 'application/json' | 'application/x-www-form-urlencoded';
9
- };
10
- export declare function getChargebeeBaseUrl(site: string): string;
11
- export declare function getChargebeeAuthHeader(apiKey: string): string;
12
- export declare function cleanObject(value: Record<string, unknown>): Record<string, unknown>;
13
- export declare function chargebeeRequest<TResponse>({ site, apiKey, method, path, body, contentType, }: ChargebeeRequestParams): Promise<TResponse>;
14
- export {};
15
- //# sourceMappingURL=client.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/lib/common/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAc,MAAM,6BAA6B,CAAC;AAWrE,KAAK,sBAAsB,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,UAAU,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,WAAW,CAAC,EAAE,kBAAkB,GAAG,mCAAmC,CAAC;CACxE,CAAC;AAEF,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAExD;AAED,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE7D;AAED,wBAAgB,WAAW,CACzB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAYzB;AAgBD,wBAAsB,gBAAgB,CAAC,SAAS,EAAE,EAChD,IAAI,EACJ,MAAM,EACN,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,WAAiD,GAClD,EAAE,sBAAsB,GAAG,OAAO,CAAC,SAAS,CAAC,CAiC7C"}
@@ -1,64 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getChargebeeBaseUrl = getChargebeeBaseUrl;
4
- exports.getChargebeeAuthHeader = getChargebeeAuthHeader;
5
- exports.cleanObject = cleanObject;
6
- exports.chargebeeRequest = chargebeeRequest;
7
- const tslib_1 = require("tslib");
8
- const pieces_common_1 = require("@activepieces/pieces-common");
9
- const CHARGEBEE_API_SUFFIX = '/api/v2';
10
- function getChargebeeBaseUrl(site) {
11
- return `https://${site.trim()}.chargebee.com${CHARGEBEE_API_SUFFIX}`;
12
- }
13
- function getChargebeeAuthHeader(apiKey) {
14
- return `Basic ${Buffer.from(`${apiKey}:`).toString('base64')}`;
15
- }
16
- function cleanObject(value) {
17
- return Object.fromEntries(Object.entries(value).filter(([, entry]) => {
18
- if (entry === undefined || entry === null) {
19
- return false;
20
- }
21
- if (typeof entry === 'string') {
22
- return entry.trim().length > 0;
23
- }
24
- return true;
25
- }));
26
- }
27
- /**
28
- * Serialize a plain object to an application/x-www-form-urlencoded string.
29
- * Keys are passed through as-is (so bracket notation like
30
- * `subscription_items[item_price_id][0]` is preserved), while values are
31
- * percent-encoded manually with encodeURIComponent.
32
- */
33
- function toFormEncoded(body) {
34
- return Object.entries(body)
35
- .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
36
- .join('&');
37
- }
38
- function chargebeeRequest(_a) {
39
- return tslib_1.__awaiter(this, arguments, void 0, function* ({ site, apiKey, method, path, body, contentType = 'application/x-www-form-urlencoded', }) {
40
- var _b, _c, _d, _e, _f;
41
- try {
42
- const isFormEncoded = contentType === 'application/x-www-form-urlencoded';
43
- const serializedBody = body && isFormEncoded ? toFormEncoded(body) : body;
44
- const response = yield pieces_common_1.httpClient.sendRequest({
45
- method,
46
- url: `${getChargebeeBaseUrl(site)}${path}`,
47
- headers: {
48
- Accept: 'application/json',
49
- Authorization: getChargebeeAuthHeader(apiKey),
50
- 'Content-Type': contentType,
51
- },
52
- body: serializedBody,
53
- });
54
- return response.body;
55
- }
56
- catch (error) {
57
- const chargebeeError = error;
58
- const status = (_b = chargebeeError.response) === null || _b === void 0 ? void 0 : _b.status;
59
- const message = (_f = (_e = (_d = (_c = chargebeeError.response) === null || _c === void 0 ? void 0 : _c.body) === null || _d === void 0 ? void 0 : _d.message) !== null && _e !== void 0 ? _e : chargebeeError.message) !== null && _f !== void 0 ? _f : 'Chargebee API request failed.';
60
- throw new Error(status ? `${message} (status ${status})` : message);
61
- }
62
- });
63
- }
64
- //# sourceMappingURL=client.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../src/lib/common/client.ts"],"names":[],"mappings":";;AAoBA,kDAEC;AAED,wDAEC;AAED,kCAcC;AAgBD,4CAwCC;;AAlGD,+DAAqE;AAErE,MAAM,oBAAo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,MAAM,cAAc,GAClB,IAAI,IAAI,aAAa,CAAC,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;YAErD,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAY;gBACvD,MAAM;gBACN,GAAG,EAAE,GAAG,mBAAmB,CAAC,IAAI,CAAC,GAAG,IAAI,EAAE;gBAC1C,OAAO,EAAE;oBACP,MAAM,EAAE,kBAAkB;oBAC1B,aAAa,EAAE,sBAAsB,CAAC,MAAM,CAAC;oBAC7C,cAAc,EAAE,WAAW;iBAC5B;gBACD,IAAI,EAAE,cAAc;aACrB,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,cAAc,GAAG,KAGtB,CAAC;YACF,MAAM,MAAM,GAAG,MAAA,cAAc,CAAC,QAAQ,0CAAE,MAAM,CAAC;YAC/C,MAAM,OAAO,GACX,MAAA,MAAA,MAAA,MAAA,cAAc,CAAC,QAAQ,0CAAE,IAAI,0CAAE,OAAO,mCACtC,cAAc,CAAC,OAAO,mCACtB,+BAA+B,CAAC;YAElC,MAAM,IAAI,KAAK,CACb,MAAM,CAAC,CAAC,CAAC,GAAG,OAAO,YAAY,MAAM,GAAG,CAAC,CAAC,CAAC,OAAO,CACnD,CAAC;QACJ,CAAC;IACH,CAAC;CAAA"}
@@ -1,4 +0,0 @@
1
- export declare function subscribeChargebeeWebhook(site: string, apiKey: string, webhookUrl: string, eventType: string): Promise<string>;
2
- export declare function unsubscribeChargebeeWebhook(site: string, apiKey: string, webhookId: string): Promise<void>;
3
- export declare function fetchRecentEvents(site: string, apiKey: string, eventType: string): Promise<unknown[]>;
4
- //# sourceMappingURL=webhook.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"webhook.d.ts","sourceRoot":"","sources":["../../../../src/lib/common/webhook.ts"],"names":[],"mappings":"AAQA,wBAAsB,yBAAyB,CAC7C,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,MAAM,CAAC,CAcjB;AAED,wBAAsB,2BAA2B,CAC/C,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,IAAI,CAAC,CAOf;AAED,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,OAAO,EAAE,CAAC,CAUpB"}
@@ -1,48 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.subscribeChargebeeWebhook = subscribeChargebeeWebhook;
4
- exports.unsubscribeChargebeeWebhook = unsubscribeChargebeeWebhook;
5
- exports.fetchRecentEvents = fetchRecentEvents;
6
- const tslib_1 = require("tslib");
7
- const pieces_common_1 = require("@activepieces/pieces-common");
8
- const client_1 = require("./client");
9
- function subscribeChargebeeWebhook(site, apiKey, webhookUrl, eventType) {
10
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
11
- const response = yield (0, client_1.chargebeeRequest)({
12
- site,
13
- apiKey,
14
- method: pieces_common_1.HttpMethod.POST,
15
- path: '/webhook_endpoints',
16
- contentType: 'application/x-www-form-urlencoded',
17
- body: {
18
- webhook_url: webhookUrl,
19
- 'subscribed_events[0]': eventType,
20
- is_active: true,
21
- },
22
- });
23
- return response.webhook.id;
24
- });
25
- }
26
- function unsubscribeChargebeeWebhook(site, apiKey, webhookId) {
27
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
28
- yield (0, client_1.chargebeeRequest)({
29
- site,
30
- apiKey,
31
- method: pieces_common_1.HttpMethod.POST,
32
- path: `/webhook_endpoints/${webhookId}/delete`,
33
- });
34
- });
35
- }
36
- function fetchRecentEvents(site, apiKey, eventType) {
37
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
38
- var _a;
39
- const response = yield (0, client_1.chargebeeRequest)({
40
- site,
41
- apiKey,
42
- method: pieces_common_1.HttpMethod.GET,
43
- path: `/events?limit=5&event_type[is]=${eventType}`,
44
- });
45
- return ((_a = response.list) !== null && _a !== void 0 ? _a : []).map((item) => item.event);
46
- });
47
- }
48
- //# sourceMappingURL=webhook.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"webhook.js","sourceRoot":"","sources":["../../../../src/lib/common/webhook.ts"],"names":[],"mappings":";;AAQA,8DAmBC;AAED,kEAWC;AAED,8CAcC;;AAxDD,+DAAyD;AAEzD,qCAA4C;AAM5C,SAAsB,yBAAyB,CAC7C,IAAY,EACZ,MAAc,EACd,UAAkB,EAClB,SAAiB;;QAEjB,MAAM,QAAQ,GAAG,MAAM,IAAA,yBAAgB,EAAkB;YACvD,IAAI;YACJ,MAAM;YACN,MAAM,EAAE,0BAAU,CAAC,IAAI;YACvB,IAAI,EAAE,oBAAoB;YAC1B,WAAW,EAAE,mCAAmC;YAChD,IAAI,EAAE;gBACJ,WAAW,EAAE,UAAU;gBACvB,sBAAsB,EAAE,SAAS;gBACjC,SAAS,EAAE,IAAI;aAChB;SACF,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;IAC7B,CAAC;CAAA;AAED,SAAsB,2BAA2B,CAC/C,IAAY,EACZ,MAAc,EACd,SAAiB;;QAEjB,MAAM,IAAA,yBAAgB,EAAC;YACrB,IAAI;YACJ,MAAM;YACN,MAAM,EAAE,0BAAU,CAAC,IAAI;YACvB,IAAI,EAAE,sBAAsB,SAAS,SAAS;SAC/C,CAAC,CAAC;IACL,CAAC;CAAA;AAED,SAAsB,iBAAiB,CACrC,IAAY,EACZ,MAAc,EACd,SAAiB;;;QAEjB,MAAM,QAAQ,GAAG,MAAM,IAAA,yBAAgB,EAEpC;YACD,IAAI;YACJ,MAAM;YACN,MAAM,EAAE,0BAAU,CAAC,GAAG;YACtB,IAAI,EAAE,kCAAkC,SAAS,EAAE;SACpD,CAAC,CAAC;QACH,OAAO,CAAC,MAAA,QAAQ,CAAC,IAAI,mCAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACzD,CAAC;CAAA"}
@@ -1,15 +0,0 @@
1
- import { TriggerStrategy } from '@activepieces/pieces-framework';
2
- export declare const customerCreated: 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=customer-created.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"customer-created.d.ts","sourceRoot":"","sources":["../../../../src/lib/triggers/customer-created.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAYhF,eAAO,MAAM,eAAe;;;;;;;;;;;;OAkE1B,CAAC"}
@@ -1,71 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.customerCreated = 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 = 'customer_created';
9
- const STORE_KEY = '_chargebee_customer_created_webhook_id';
10
- exports.customerCreated = (0, pieces_framework_1.createTrigger)({
11
- auth: auth_1.chargebeeAuth,
12
- name: 'customer_created',
13
- displayName: 'Customer Created',
14
- description: 'Triggers when a new customer is created in Chargebee.',
15
- aiMetadata: {
16
- description: 'Fires when Chargebee records a customer_created event — a new customer record has been created. The payload carries the created customer.',
17
- },
18
- props: {},
19
- type: pieces_framework_1.TriggerStrategy.WEBHOOK,
20
- sampleData: {
21
- id: 'ev_customercwwy6nq',
22
- occurred_at: 1776067864,
23
- source: 'admin_console',
24
- object: 'event',
25
- api_version: 'v2',
26
- event_type: 'customer_created',
27
- webhook_status: 'not_applicable',
28
- content: {
29
- customer: {
30
- allow_direct_debit: false,
31
- auto_collection: 'on',
32
- billing_address: {
33
- city: 'Walnut',
34
- country: 'US',
35
- first_name: 'John',
36
- last_name: 'Doe',
37
- line1: 'PO Box 9999',
38
- '...': '...',
39
- },
40
- card_status: 'no_card',
41
- created_at: 1517505731,
42
- '...': '...',
43
- },
44
- },
45
- },
46
- onEnable(context) {
47
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
48
- const webhookId = yield (0, webhook_1.subscribeChargebeeWebhook)(context.auth.props.site, context.auth.props.api_key, context.webhookUrl, EVENT_TYPE);
49
- yield context.store.put(STORE_KEY, webhookId);
50
- });
51
- },
52
- onDisable(context) {
53
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
54
- const webhookId = yield context.store.get(STORE_KEY);
55
- if (webhookId) {
56
- yield (0, webhook_1.unsubscribeChargebeeWebhook)(context.auth.props.site, context.auth.props.api_key, webhookId);
57
- }
58
- });
59
- },
60
- test(context) {
61
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
62
- return (0, webhook_1.fetchRecentEvents)(context.auth.props.site, context.auth.props.api_key, EVENT_TYPE);
63
- });
64
- },
65
- run(context) {
66
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
67
- return [context.payload.body];
68
- });
69
- },
70
- });
71
- //# sourceMappingURL=customer-created.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"customer-created.js","sourceRoot":"","sources":["../../../../src/lib/triggers/customer-created.ts"],"names":[],"mappings":";;;;AAAA,qEAAgF;AAEhF,kCAAwC;AACxC,+CAI2B;AAE3B,MAAM,UAAU,GAAG,kBAAkB,CAAC;AACtC,MAAM,SAAS,GAAG,wCAAwC,CAAC;AAE9C,QAAA,eAAe,GAAG,IAAA,gCAAa,EAAC;IAC3C,IAAI,EAAE,oBAAa;IACnB,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,kBAAkB;IAC/B,WAAW,EAAE,uDAAuD;IACpE,UAAU,EAAE;QACV,WAAW,EACT,2IAA2I;KAC9I;IACD,KAAK,EAAE,EAAE;IACT,IAAI,EAAE,kCAAe,CAAC,OAAO;IAC7B,UAAU,EAAE;QACV,EAAE,EAAE,oBAAoB;QACxB,WAAW,EAAE,UAAU;QACvB,MAAM,EAAE,eAAe;QACvB,MAAM,EAAE,OAAO;QACf,WAAW,EAAE,IAAI;QACjB,UAAU,EAAE,kBAAkB;QAC9B,cAAc,EAAE,gBAAgB;QAChC,OAAO,EAAE;YACP,QAAQ,EAAE;gBACR,kBAAkB,EAAE,KAAK;gBACzB,eAAe,EAAE,IAAI;gBACrB,eAAe,EAAE;oBACf,IAAI,EAAE,QAAQ;oBACd,OAAO,EAAE,IAAI;oBACb,UAAU,EAAE,MAAM;oBAClB,SAAS,EAAE,KAAK;oBAChB,KAAK,EAAE,aAAa;oBACpB,KAAK,EAAE,KAAK;iBACb;gBACD,WAAW,EAAE,SAAS;gBACtB,UAAU,EAAE,UAAU;gBACtB,KAAK,EAAE,KAAK;aACb;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 invoiceGenerated: 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=invoice-generated.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"invoice-generated.d.ts","sourceRoot":"","sources":["../../../../src/lib/triggers/invoice-generated.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAYhF,eAAO,MAAM,gBAAgB;;;;;;;;;;;;OA2D3B,CAAC"}
@@ -1,64 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.invoiceGenerated = 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 = 'invoice_generated';
9
- const STORE_KEY = '_chargebee_invoice_generated_webhook_id';
10
- exports.invoiceGenerated = (0, pieces_framework_1.createTrigger)({
11
- auth: auth_1.chargebeeAuth,
12
- name: 'invoice_generated',
13
- displayName: 'Invoice Generated',
14
- description: 'Triggers when a new invoice is generated for a subscription.',
15
- aiMetadata: {
16
- description: 'Fires when Chargebee records an invoice_generated event — a new invoice has been created (for a subscription or one-time charge). The payload carries the generated invoice.',
17
- },
18
- props: {},
19
- type: pieces_framework_1.TriggerStrategy.WEBHOOK,
20
- sampleData: {
21
- id: 'ev_invoicegewwy4m2',
22
- occurred_at: 1776067861,
23
- source: 'admin_console',
24
- object: 'event',
25
- api_version: 'v2',
26
- event_type: 'invoice_generated',
27
- webhook_status: 'not_applicable',
28
- content: {
29
- invoice: {
30
- adjustment_credit_notes: {},
31
- amount_adjusted: 0,
32
- amount_due: 0,
33
- amount_paid: 1000,
34
- amount_to_collect: 0,
35
- '...': '...',
36
- },
37
- },
38
- },
39
- onEnable(context) {
40
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
41
- const webhookId = yield (0, webhook_1.subscribeChargebeeWebhook)(context.auth.props.site, context.auth.props.api_key, context.webhookUrl, EVENT_TYPE);
42
- yield context.store.put(STORE_KEY, webhookId);
43
- });
44
- },
45
- onDisable(context) {
46
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
47
- const webhookId = yield context.store.get(STORE_KEY);
48
- if (webhookId) {
49
- yield (0, webhook_1.unsubscribeChargebeeWebhook)(context.auth.props.site, context.auth.props.api_key, webhookId);
50
- }
51
- });
52
- },
53
- test(context) {
54
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
55
- return (0, webhook_1.fetchRecentEvents)(context.auth.props.site, context.auth.props.api_key, EVENT_TYPE);
56
- });
57
- },
58
- run(context) {
59
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
60
- return [context.payload.body];
61
- });
62
- },
63
- });
64
- //# sourceMappingURL=invoice-generated.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"invoice-generated.js","sourceRoot":"","sources":["../../../../src/lib/triggers/invoice-generated.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;I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O;;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 paymentFailed: 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=payment-failed.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"payment-failed.d.ts","sourceRoot":"","sources":["../../../../src/lib/triggers/payment-failed.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAYhF,eAAO,MAAM,aAAa;;;;;;;;;;;;OA2FxB,CAAC"}
@@ -1,95 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.paymentFailed = 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 = 'payment_failed';
9
- const STORE_KEY = '_chargebee_payment_failed_webhook_id';
10
- exports.paymentFailed = (0, pieces_framework_1.createTrigger)({
11
- auth: auth_1.chargebeeAuth,
12
- name: 'payment_failed',
13
- displayName: 'Payment Failed',
14
- description: 'Triggers when a payment attempt fails. Useful for dunning and retry workflows.',
15
- aiMetadata: {
16
- description: 'Fires when Chargebee records a payment_failed event — an attempt to collect a payment failed. Useful for driving dunning and retry workflows. The payload carries the failed transaction with the related invoice, customer, and subscription.',
17
- },
18
- props: {},
19
- type: pieces_framework_1.TriggerStrategy.WEBHOOK,
20
- sampleData: {
21
- id: 'ev_paymentfawwy6gd',
22
- occurred_at: 1776067863,
23
- source: 'admin_console',
24
- object: 'event',
25
- api_version: 'v2',
26
- event_type: 'payment_failed',
27
- webhook_status: 'not_applicable',
28
- content: {
29
- transaction: {
30
- amount: 1395,
31
- amount_unused: 0,
32
- currency_code: 'USD',
33
- customer_id: '__test__KyVnHhSBWlv242pN',
34
- date: 1517505921,
35
- '...': '...',
36
- },
37
- invoice: {
38
- adjustment_credit_notes: {},
39
- amount_adjusted: 0,
40
- amount_due: 0,
41
- amount_paid: 1000,
42
- amount_to_collect: 0,
43
- '...': '...',
44
- },
45
- customer: {
46
- allow_direct_debit: false,
47
- auto_collection: 'on',
48
- billing_address: {
49
- city: 'Walnut',
50
- country: 'US',
51
- first_name: 'John',
52
- last_name: 'Doe',
53
- line1: 'PO Box 9999',
54
- '...': '...',
55
- },
56
- card_status: 'no_card',
57
- created_at: 1517505731,
58
- '...': '...',
59
- },
60
- subscription: {
61
- activated_at: 1612890920,
62
- billing_period: 1,
63
- billing_period_unit: 'month',
64
- created_at: 1612890920,
65
- currency_code: 'USD',
66
- '...': '...',
67
- },
68
- },
69
- },
70
- onEnable(context) {
71
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
72
- const webhookId = yield (0, webhook_1.subscribeChargebeeWebhook)(context.auth.props.site, context.auth.props.api_key, context.webhookUrl, EVENT_TYPE);
73
- yield context.store.put(STORE_KEY, webhookId);
74
- });
75
- },
76
- onDisable(context) {
77
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
78
- const webhookId = yield context.store.get(STORE_KEY);
79
- if (webhookId) {
80
- yield (0, webhook_1.unsubscribeChargebeeWebhook)(context.auth.props.site, context.auth.props.api_key, webhookId);
81
- }
82
- });
83
- },
84
- test(context) {
85
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
86
- return (0, webhook_1.fetchRecentEvents)(context.auth.props.site, context.auth.props.api_key, EVENT_TYPE);
87
- });
88
- },
89
- run(context) {
90
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
91
- return [context.payload.body];
92
- });
93
- },
94
- });
95
- //# sourceMappingURL=payment-failed.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"payment-failed.js","sourceRoot":"","sources":["../../../../src/lib/triggers/payment-failed.ts"],"names":[],"mappings":";;;;AAAA,qEAAgF;AAEhF,kCAAwC;AACxC,+CAI2B;AAE3B,MAAM,UAAU,GAAG,gBAAgB,CAAC;AACpC,MAAM,SAAS,GAAG,sCAAsC,CAAC;AAE5C,QAAA,aAAa,GAAG,IAAA,gCAAa,EAAC;IACzC,IAAI,EAAE,oBAAa;IACnB,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,gBAAgB;IAC7B,WAAW,EACT,gFAAgF;IAClF,UAAU,EAAE;QACV,WAAW,EACT,gPAAgP;KACnP;IACD,KAAK,EAAE,EAAE;IACT,IAAI,EAAE,kCAAe,CAAC,OAAO;IAC7B,UAAU,EAAE;QACV,EAAE,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AU,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 paymentSucceeded: 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=payment-succeeded.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"payment-succeeded.d.ts","sourceRoot":"","sources":["../../../../src/lib/triggers/payment-succeeded.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAYhF,eAAO,MAAM,gBAAgB;;;;;;;;;;;;OA0F3B,CAAC"}
@@ -1,95 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.paymentSucceeded = 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 = 'payment_succeeded';
9
- const STORE_KEY = '_chargebee_payment_succeeded_webhook_id';
10
- exports.paymentSucceeded = (0, pieces_framework_1.createTrigger)({
11
- auth: auth_1.chargebeeAuth,
12
- name: 'payment_succeeded',
13
- displayName: 'Payment Succeeded',
14
- description: 'Triggers when a payment is successfully collected.',
15
- aiMetadata: {
16
- description: 'Fires when Chargebee records a payment_succeeded event — a payment was successfully collected. The payload carries the transaction along with the related invoice, customer, and subscription.',
17
- },
18
- props: {},
19
- type: pieces_framework_1.TriggerStrategy.WEBHOOK,
20
- sampleData: {
21
- id: 'ev_paymentsuwwy8bw',
22
- occurred_at: 1776067866,
23
- source: 'admin_console',
24
- object: 'event',
25
- api_version: 'v2',
26
- event_type: 'payment_succeeded',
27
- webhook_status: 'not_applicable',
28
- content: {
29
- transaction: {
30
- amount: 1395,
31
- amount_unused: 0,
32
- currency_code: 'USD',
33
- customer_id: '__test__KyVnHhSBWlv242pN',
34
- date: 1517505921,
35
- '...': '...',
36
- },
37
- invoice: {
38
- adjustment_credit_notes: {},
39
- amount_adjusted: 0,
40
- amount_due: 0,
41
- amount_paid: 1000,
42
- amount_to_collect: 0,
43
- '...': '...',
44
- },
45
- customer: {
46
- allow_direct_debit: false,
47
- auto_collection: 'on',
48
- billing_address: {
49
- city: 'Walnut',
50
- country: 'US',
51
- first_name: 'John',
52
- last_name: 'Doe',
53
- line1: 'PO Box 9999',
54
- '...': '...',
55
- },
56
- card_status: 'no_card',
57
- created_at: 1517505731,
58
- '...': '...',
59
- },
60
- subscription: {
61
- activated_at: 1612890920,
62
- billing_period: 1,
63
- billing_period_unit: 'month',
64
- created_at: 1612890920,
65
- currency_code: 'USD',
66
- '...': '...',
67
- },
68
- },
69
- },
70
- onEnable(context) {
71
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
72
- const webhookId = yield (0, webhook_1.subscribeChargebeeWebhook)(context.auth.props.site, context.auth.props.api_key, context.webhookUrl, EVENT_TYPE);
73
- yield context.store.put(STORE_KEY, webhookId);
74
- });
75
- },
76
- onDisable(context) {
77
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
78
- const webhookId = yield context.store.get(STORE_KEY);
79
- if (webhookId) {
80
- yield (0, webhook_1.unsubscribeChargebeeWebhook)(context.auth.props.site, context.auth.props.api_key, webhookId);
81
- }
82
- });
83
- },
84
- test(context) {
85
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
86
- return (0, webhook_1.fetchRecentEvents)(context.auth.props.site, context.auth.props.api_key, EVENT_TYPE);
87
- });
88
- },
89
- run(context) {
90
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
91
- return [context.payload.body];
92
- });
93
- },
94
- });
95
- //# sourceMappingURL=payment-succeeded.js.map