@activepieces/piece-chargebee 0.0.2 → 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 -168
- 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 -169
- 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 -119
- 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 -32
- 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 -68
- 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 -61
- 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 -92
- 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 -92
- 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 -84
- 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 -84
- 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 -84
- 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 -84
- 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
|
package/src/lib/auth.js.map
DELETED
|
@@ -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"}
|
package/src/lib/common/client.js
DELETED
|
@@ -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,oBAAoB,GAAG,SAAS,CAAC;AAkBvC,SAAgB,mBAAmB,CAAC,IAAY;IAC9C,OAAO,WAAW,IAAI,CAAC,IAAI,EAAE,iBAAiB,oBAAoB,EAAE,CAAC;AACvE,CAAC;AAED,SAAgB,sBAAsB,CAAC,MAAc;IACnD,OAAO,SAAS,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,GAAG,CAAC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AI,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;;;;;;;;;;;;OA8D1B,CAAC"}
|
|
@@ -1,68 +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
|
-
props: {},
|
|
16
|
-
type: pieces_framework_1.TriggerStrategy.WEBHOOK,
|
|
17
|
-
sampleData: {
|
|
18
|
-
id: 'ev_customercwwy6nq',
|
|
19
|
-
occurred_at: 1776067864,
|
|
20
|
-
source: 'admin_console',
|
|
21
|
-
object: 'event',
|
|
22
|
-
api_version: 'v2',
|
|
23
|
-
event_type: 'customer_created',
|
|
24
|
-
webhook_status: 'not_applicable',
|
|
25
|
-
content: {
|
|
26
|
-
customer: {
|
|
27
|
-
allow_direct_debit: false,
|
|
28
|
-
auto_collection: 'on',
|
|
29
|
-
billing_address: {
|
|
30
|
-
city: 'Walnut',
|
|
31
|
-
country: 'US',
|
|
32
|
-
first_name: 'John',
|
|
33
|
-
last_name: 'Doe',
|
|
34
|
-
line1: 'PO Box 9999',
|
|
35
|
-
'...': '...',
|
|
36
|
-
},
|
|
37
|
-
card_status: 'no_card',
|
|
38
|
-
created_at: 1517505731,
|
|
39
|
-
'...': '...',
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
onEnable(context) {
|
|
44
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
45
|
-
const webhookId = yield (0, webhook_1.subscribeChargebeeWebhook)(context.auth.props.site, context.auth.props.api_key, context.webhookUrl, EVENT_TYPE);
|
|
46
|
-
yield context.store.put(STORE_KEY, webhookId);
|
|
47
|
-
});
|
|
48
|
-
},
|
|
49
|
-
onDisable(context) {
|
|
50
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
51
|
-
const webhookId = yield context.store.get(STORE_KEY);
|
|
52
|
-
if (webhookId) {
|
|
53
|
-
yield (0, webhook_1.unsubscribeChargebeeWebhook)(context.auth.props.site, context.auth.props.api_key, webhookId);
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
},
|
|
57
|
-
test(context) {
|
|
58
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
59
|
-
return (0, webhook_1.fetchRecentEvents)(context.auth.props.site, context.auth.props.api_key, EVENT_TYPE);
|
|
60
|
-
});
|
|
61
|
-
},
|
|
62
|
-
run(context) {
|
|
63
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
64
|
-
return [context.payload.body];
|
|
65
|
-
});
|
|
66
|
-
},
|
|
67
|
-
});
|
|
68
|
-
//# sourceMappingURL=customer-created.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"customer-created.js","sourceRoot":"","sources":["../../../../src/lib/triggers/customer-created.ts"],"names":[],"mapp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,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;;;;;;;;;;;;OAuD3B,CAAC"}
|
|
@@ -1,61 +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
|
-
props: {},
|
|
16
|
-
type: pieces_framework_1.TriggerStrategy.WEBHOOK,
|
|
17
|
-
sampleData: {
|
|
18
|
-
id: 'ev_invoicegewwy4m2',
|
|
19
|
-
occurred_at: 1776067861,
|
|
20
|
-
source: 'admin_console',
|
|
21
|
-
object: 'event',
|
|
22
|
-
api_version: 'v2',
|
|
23
|
-
event_type: 'invoice_generated',
|
|
24
|
-
webhook_status: 'not_applicable',
|
|
25
|
-
content: {
|
|
26
|
-
invoice: {
|
|
27
|
-
adjustment_credit_notes: {},
|
|
28
|
-
amount_adjusted: 0,
|
|
29
|
-
amount_due: 0,
|
|
30
|
-
amount_paid: 1000,
|
|
31
|
-
amount_to_collect: 0,
|
|
32
|
-
'...': '...',
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
onEnable(context) {
|
|
37
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
38
|
-
const webhookId = yield (0, webhook_1.subscribeChargebeeWebhook)(context.auth.props.site, context.auth.props.api_key, context.webhookUrl, EVENT_TYPE);
|
|
39
|
-
yield context.store.put(STORE_KEY, webhookId);
|
|
40
|
-
});
|
|
41
|
-
},
|
|
42
|
-
onDisable(context) {
|
|
43
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
44
|
-
const webhookId = yield context.store.get(STORE_KEY);
|
|
45
|
-
if (webhookId) {
|
|
46
|
-
yield (0, webhook_1.unsubscribeChargebeeWebhook)(context.auth.props.site, context.auth.props.api_key, webhookId);
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
},
|
|
50
|
-
test(context) {
|
|
51
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
52
|
-
return (0, webhook_1.fetchRecentEvents)(context.auth.props.site, context.auth.props.api_key, EVENT_TYPE);
|
|
53
|
-
});
|
|
54
|
-
},
|
|
55
|
-
run(context) {
|
|
56
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
57
|
-
return [context.payload.body];
|
|
58
|
-
});
|
|
59
|
-
},
|
|
60
|
-
});
|
|
61
|
-
//# sourceMappingURL=invoice-generated.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"invoice-generated.js","sourceRoot":"","sources":["../../../../src/lib/triggers/inv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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 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;;;;;;;;;;;;OAuFxB,CAAC"}
|
|
@@ -1,92 +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
|
-
props: {},
|
|
16
|
-
type: pieces_framework_1.TriggerStrategy.WEBHOOK,
|
|
17
|
-
sampleData: {
|
|
18
|
-
id: 'ev_paymentfawwy6gd',
|
|
19
|
-
occurred_at: 1776067863,
|
|
20
|
-
source: 'admin_console',
|
|
21
|
-
object: 'event',
|
|
22
|
-
api_version: 'v2',
|
|
23
|
-
event_type: 'payment_failed',
|
|
24
|
-
webhook_status: 'not_applicable',
|
|
25
|
-
content: {
|
|
26
|
-
transaction: {
|
|
27
|
-
amount: 1395,
|
|
28
|
-
amount_unused: 0,
|
|
29
|
-
currency_code: 'USD',
|
|
30
|
-
customer_id: '__test__KyVnHhSBWlv242pN',
|
|
31
|
-
date: 1517505921,
|
|
32
|
-
'...': '...',
|
|
33
|
-
},
|
|
34
|
-
invoice: {
|
|
35
|
-
adjustment_credit_notes: {},
|
|
36
|
-
amount_adjusted: 0,
|
|
37
|
-
amount_due: 0,
|
|
38
|
-
amount_paid: 1000,
|
|
39
|
-
amount_to_collect: 0,
|
|
40
|
-
'...': '...',
|
|
41
|
-
},
|
|
42
|
-
customer: {
|
|
43
|
-
allow_direct_debit: false,
|
|
44
|
-
auto_collection: 'on',
|
|
45
|
-
billing_address: {
|
|
46
|
-
city: 'Walnut',
|
|
47
|
-
country: 'US',
|
|
48
|
-
first_name: 'John',
|
|
49
|
-
last_name: 'Doe',
|
|
50
|
-
line1: 'PO Box 9999',
|
|
51
|
-
'...': '...',
|
|
52
|
-
},
|
|
53
|
-
card_status: 'no_card',
|
|
54
|
-
created_at: 1517505731,
|
|
55
|
-
'...': '...',
|
|
56
|
-
},
|
|
57
|
-
subscription: {
|
|
58
|
-
activated_at: 1612890920,
|
|
59
|
-
billing_period: 1,
|
|
60
|
-
billing_period_unit: 'month',
|
|
61
|
-
created_at: 1612890920,
|
|
62
|
-
currency_code: 'USD',
|
|
63
|
-
'...': '...',
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
onEnable(context) {
|
|
68
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
69
|
-
const webhookId = yield (0, webhook_1.subscribeChargebeeWebhook)(context.auth.props.site, context.auth.props.api_key, context.webhookUrl, EVENT_TYPE);
|
|
70
|
-
yield context.store.put(STORE_KEY, webhookId);
|
|
71
|
-
});
|
|
72
|
-
},
|
|
73
|
-
onDisable(context) {
|
|
74
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
75
|
-
const webhookId = yield context.store.get(STORE_KEY);
|
|
76
|
-
if (webhookId) {
|
|
77
|
-
yield (0, webhook_1.unsubscribeChargebeeWebhook)(context.auth.props.site, context.auth.props.api_key, webhookId);
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
},
|
|
81
|
-
test(context) {
|
|
82
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
83
|
-
return (0, webhook_1.fetchRecentEvents)(context.auth.props.site, context.auth.props.api_key, EVENT_TYPE);
|
|
84
|
-
});
|
|
85
|
-
},
|
|
86
|
-
run(context) {
|
|
87
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
88
|
-
return [context.payload.body];
|
|
89
|
-
});
|
|
90
|
-
},
|
|
91
|
-
});
|
|
92
|
-
//# 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,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,gBAAgB;QAC5B,cAAc,EAAE,gBAAgB;QAChC,OAAO,EAAE;YACP,WAAW,EAAE;gBACX,MAAM,EAAE,IAAI;gBACZ,aAAa,EAAE,CAAC;gBAChB,aAAa,EAAE,KAAK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,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;;;;;;;;;;;;OAsF3B,CAAC"}
|
|
@@ -1,92 +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
|
-
props: {},
|
|
16
|
-
type: pieces_framework_1.TriggerStrategy.WEBHOOK,
|
|
17
|
-
sampleData: {
|
|
18
|
-
id: 'ev_paymentsuwwy8bw',
|
|
19
|
-
occurred_at: 1776067866,
|
|
20
|
-
source: 'admin_console',
|
|
21
|
-
object: 'event',
|
|
22
|
-
api_version: 'v2',
|
|
23
|
-
event_type: 'payment_succeeded',
|
|
24
|
-
webhook_status: 'not_applicable',
|
|
25
|
-
content: {
|
|
26
|
-
transaction: {
|
|
27
|
-
amount: 1395,
|
|
28
|
-
amount_unused: 0,
|
|
29
|
-
currency_code: 'USD',
|
|
30
|
-
customer_id: '__test__KyVnHhSBWlv242pN',
|
|
31
|
-
date: 1517505921,
|
|
32
|
-
'...': '...',
|
|
33
|
-
},
|
|
34
|
-
invoice: {
|
|
35
|
-
adjustment_credit_notes: {},
|
|
36
|
-
amount_adjusted: 0,
|
|
37
|
-
amount_due: 0,
|
|
38
|
-
amount_paid: 1000,
|
|
39
|
-
amount_to_collect: 0,
|
|
40
|
-
'...': '...',
|
|
41
|
-
},
|
|
42
|
-
customer: {
|
|
43
|
-
allow_direct_debit: false,
|
|
44
|
-
auto_collection: 'on',
|
|
45
|
-
billing_address: {
|
|
46
|
-
city: 'Walnut',
|
|
47
|
-
country: 'US',
|
|
48
|
-
first_name: 'John',
|
|
49
|
-
last_name: 'Doe',
|
|
50
|
-
line1: 'PO Box 9999',
|
|
51
|
-
'...': '...',
|
|
52
|
-
},
|
|
53
|
-
card_status: 'no_card',
|
|
54
|
-
created_at: 1517505731,
|
|
55
|
-
'...': '...',
|
|
56
|
-
},
|
|
57
|
-
subscription: {
|
|
58
|
-
activated_at: 1612890920,
|
|
59
|
-
billing_period: 1,
|
|
60
|
-
billing_period_unit: 'month',
|
|
61
|
-
created_at: 1612890920,
|
|
62
|
-
currency_code: 'USD',
|
|
63
|
-
'...': '...',
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
onEnable(context) {
|
|
68
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
69
|
-
const webhookId = yield (0, webhook_1.subscribeChargebeeWebhook)(context.auth.props.site, context.auth.props.api_key, context.webhookUrl, EVENT_TYPE);
|
|
70
|
-
yield context.store.put(STORE_KEY, webhookId);
|
|
71
|
-
});
|
|
72
|
-
},
|
|
73
|
-
onDisable(context) {
|
|
74
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
75
|
-
const webhookId = yield context.store.get(STORE_KEY);
|
|
76
|
-
if (webhookId) {
|
|
77
|
-
yield (0, webhook_1.unsubscribeChargebeeWebhook)(context.auth.props.site, context.auth.props.api_key, webhookId);
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
},
|
|
81
|
-
test(context) {
|
|
82
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
83
|
-
return (0, webhook_1.fetchRecentEvents)(context.auth.props.site, context.auth.props.api_key, EVENT_TYPE);
|
|
84
|
-
});
|
|
85
|
-
},
|
|
86
|
-
run(context) {
|
|
87
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
88
|
-
return [context.payload.body];
|
|
89
|
-
});
|
|
90
|
-
},
|
|
91
|
-
});
|
|
92
|
-
//# sourceMappingURL=payment-succeeded.js.map
|
|
@@ -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,EAAE,mBAAmB;IACzB,WAAW,EAAE,mBAAmB;IAChC,WAAW,EAAE,oDAAoD;IACjE,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,mBAAmB;QAC/B,cAAc,EAAE,gBAAgB;QAChC,OAAO,EAAE;YACP,WAAW,EAAE;gBACX,MAAM,EAAE,IAAI;gBACZ,aAAa,EAA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