@activepieces/piece-stripe 0.0.0-pre1

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/README.md ADDED
@@ -0,0 +1,7 @@
1
+ # pieces-stripe
2
+
3
+ This library was generated with [Nx](https://nx.dev).
4
+
5
+ ## Running lint
6
+
7
+ Run `nx lint pieces-stripe` to execute the lint via [ESLint](https://eslint.org/).
package/package.json ADDED
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "@activepieces/piece-stripe",
3
+ "version": "0.0.0-pre1",
4
+ "dependencies": {
5
+ "@sinclair/typebox": "0.24.51",
6
+ "axios": "1.2.4",
7
+ "cron-validator": "1.3.1",
8
+ "nanoid": "3.3.4"
9
+ },
10
+ "peerDependencies": {
11
+ "@activepieces/framework": "0.0.1",
12
+ "@activepieces/shared": "0.0.1",
13
+ "tslib": "2.4.1"
14
+ },
15
+ "main": "./src/index.js",
16
+ "types": "./src/index.d.ts"
17
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare const stripe: import("@activepieces/framework").Piece;
package/src/index.js ADDED
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.stripe = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const package_json_1 = tslib_1.__importDefault(require("../package.json"));
6
+ const framework_1 = require("@activepieces/framework");
7
+ const new_payment_1 = require("./lib/trigger/new-payment");
8
+ const new_customer_1 = require("./lib/trigger/new-customer");
9
+ const payment_failed_1 = require("./lib/trigger/payment-failed");
10
+ const new_subscription_1 = require("./lib/trigger/new-subscription");
11
+ exports.stripe = (0, framework_1.createPiece)({
12
+ name: 'stripe',
13
+ displayName: "Stripe",
14
+ logoUrl: 'https://cdn.activepieces.com/pieces/stripe.png',
15
+ version: package_json_1.default.version,
16
+ authors: ['ashrafsamhouri'],
17
+ actions: [],
18
+ triggers: [new_payment_1.stripeNewPayment, new_customer_1.stripeNewCustomer, payment_failed_1.stripePaymentFailed, new_subscription_1.stripeNewSubscription],
19
+ });
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/pieces/stripe/src/index.ts"],"names":[],"mappings":";;;;AAAA,2EAA0C;AAC1C,uDAAsD;AACtD,2DAA2D;AAC3D,6DAA6D;AAC7D,iEAAiE;AACjE,qEAAuE;AAE1D,QAAA,MAAM,GAAG,IAAA,uBAAW,EAAC;IACjC,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,QAAQ;IACrB,OAAO,EAAE,gDAAgD;IACxD,OAAO,EAAE,sBAAW,CAAC,OAAO;IAC7B,OAAO,EAAE,CAAC,gBAAgB,CAAC;IAC3B,OAAO,EAAE,EAAE;IACX,QAAQ,EAAE,CAAC,8BAAgB,EAAE,gCAAiB,EAAE,oCAAmB,EAAE,wCAAqB,CAAC;CAC3F,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ export declare const stripeCommon: {
2
+ baseUrl: string;
3
+ authentication: import("@activepieces/framework").SecretTextProperty<true>;
4
+ subscribeWebhook: (eventName: string, webhookUrl: string, apiKey: string) => Promise<{
5
+ id: string;
6
+ }>;
7
+ unsubscribeWebhook: (webhookId: string, apiKey: string) => Promise<import("@activepieces/framework").HttpResponse<import("@activepieces/framework").HttpMessageBody>>;
8
+ };
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.stripeCommon = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const framework_1 = require("@activepieces/framework");
6
+ exports.stripeCommon = {
7
+ baseUrl: "https://api.stripe.com/v1",
8
+ authentication: framework_1.Property.SecretText({
9
+ displayName: "API Key",
10
+ required: true,
11
+ description: "API key acquired from your Stripe dashboard"
12
+ }),
13
+ subscribeWebhook: (eventName, webhookUrl, apiKey) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
14
+ const request = {
15
+ method: framework_1.HttpMethod.POST,
16
+ url: `${exports.stripeCommon.baseUrl}/webhook_endpoints`,
17
+ headers: {
18
+ "Content-Type": "application/x-www-form-urlencoded"
19
+ },
20
+ body: {
21
+ enabled_events: [
22
+ eventName
23
+ ],
24
+ url: webhookUrl
25
+ },
26
+ authentication: {
27
+ type: framework_1.AuthenticationType.BEARER_TOKEN,
28
+ token: apiKey,
29
+ },
30
+ queryParams: {},
31
+ };
32
+ const { body: webhook } = yield framework_1.httpClient.sendRequest(request);
33
+ return webhook;
34
+ }),
35
+ unsubscribeWebhook: (webhookId, apiKey) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
36
+ const request = {
37
+ method: framework_1.HttpMethod.DELETE,
38
+ url: `${exports.stripeCommon.baseUrl}/webhook_endpoints/${webhookId}`,
39
+ headers: {
40
+ "Content-Type": "application/x-www-form-urlencoded"
41
+ },
42
+ authentication: {
43
+ type: framework_1.AuthenticationType.BEARER_TOKEN,
44
+ token: apiKey,
45
+ },
46
+ };
47
+ return yield framework_1.httpClient.sendRequest(request);
48
+ })
49
+ };
50
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/stripe/src/lib/common/index.ts"],"names":[],"mappings":";;;;AAAA,uDAA4G;AAE/F,QAAA,YAAY,GAAG;IACxB,OAAO,EAAG,2BAA2B;IACrC,cAAc,EAAE,oBAAQ,CAAC,UAAU,CAAC;QAChC,WAAW,EAAC,SAAS;QACrB,QAAQ,EAAC,IAAI;QACb,WAAW,EAAC,6CAA6C;KAE5D,CAAC;IACF,gBAAgB,EAAE,CAAO,SAAiB,EAAE,UAAkB,EAAE,MAAc,EAAE,EAAE;QAC9E,MAAM,OAAO,GAAgB;YACzB,MAAM,EAAE,sBAAU,CAAC,IAAI;YACvB,GAAG,EAAE,GAAG,oBAAY,CAAC,OAAO,oBAAoB;YAChD,OAAO,EAAE;gBACL,cAAc,EAAE,mCAAmC;aACtD;YACD,IAAI,EAAE;gBACF,cAAc,EAAE;oBAChB,SAAS;iBACR;gBACD,GAAG,EAAE,UAAU;aAClB;YACD,cAAc,EAAE;gBACZ,IAAI,EAAE,8BAAkB,CAAC,YAAY;gBACrC,KAAK,EAAE,MAAM;aAChB;YACD,WAAW,EAAE,EAAE;SAClB,CAAC;QAEF,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,MAAM,sBAAU,CAAC,WAAW,CAAiB,OAAO,CAAC,CAAC;QAChF,OAAO,OAAO,CAAC;IACnB,CAAC,CAAA;IACD,kBAAkB,EAAE,CAAO,SAAiB,EAAE,MAAc,EAAE,EAAE;QAC5D,MAAM,OAAO,GAAgB;YACzB,MAAM,EAAE,sBAAU,CAAC,MAAM;YACzB,GAAG,EAAE,GAAG,oBAAY,CAAC,OAAO,sBAAsB,SAAS,EAAE;YAC7D,OAAO,EAAE;gBACL,cAAc,EAAE,mCAAmC;aACtD;YACD,cAAc,EAAE;gBACZ,IAAI,EAAE,8BAAkB,CAAC,YAAY;gBACrC,KAAK,EAAE,MAAM;aAChB;SACJ,CAAC;QACF,OAAO,MAAM,sBAAU,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IACjD,CAAC,CAAA;CACJ,CAAA"}
@@ -0,0 +1 @@
1
+ export declare const stripeNewCustomer: import("@activepieces/framework").Trigger;
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.stripeNewCustomer = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const framework_1 = require("@activepieces/framework");
6
+ const common_1 = require("../common");
7
+ exports.stripeNewCustomer = (0, framework_1.createTrigger)({
8
+ name: 'new_customer',
9
+ displayName: 'New Customer',
10
+ description: 'Triggers when a new customer is created',
11
+ props: {
12
+ api_key: common_1.stripeCommon.authentication
13
+ },
14
+ sampleData: {
15
+ "id": "cus_NGtyEf4hNGTj3p",
16
+ "object": "customer",
17
+ "address": null,
18
+ "balance": 0,
19
+ "created": 1675180509,
20
+ "currency": null,
21
+ "default_currency": null,
22
+ "default_source": null,
23
+ "delinquent": false,
24
+ "description": null,
25
+ "discount": null,
26
+ "email": "jane@example.com",
27
+ "invoice_prefix": "B7162248",
28
+ "invoice_settings": {
29
+ "custom_fields": null,
30
+ "default_payment_method": null,
31
+ "footer": null,
32
+ "rendering_options": null
33
+ },
34
+ "livemode": false,
35
+ "metadata": {},
36
+ "name": "John Doe",
37
+ "next_invoice_sequence": 1,
38
+ "phone": null,
39
+ "preferred_locales": [],
40
+ "shipping": null,
41
+ "tax_exempt": "none",
42
+ "test_clock": null
43
+ },
44
+ type: framework_1.TriggerStrategy.WEBHOOK,
45
+ onEnable(context) {
46
+ var _a;
47
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
48
+ const webhook = yield common_1.stripeCommon.subscribeWebhook('customer.created', context.webhookUrl, context.propsValue['api_key']);
49
+ yield ((_a = context.store) === null || _a === void 0 ? void 0 : _a.put('_new_customer_trigger', {
50
+ webhookId: webhook.id
51
+ }));
52
+ });
53
+ },
54
+ onDisable(context) {
55
+ var _a;
56
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
57
+ const response = yield ((_a = context.store) === null || _a === void 0 ? void 0 : _a.get('_new_customer_trigger'));
58
+ if (response !== null && response !== undefined) {
59
+ yield common_1.stripeCommon.unsubscribeWebhook(response.webhookId, context.propsValue['api_key']);
60
+ }
61
+ });
62
+ },
63
+ run(context) {
64
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
65
+ return [context.payload.body.data.object];
66
+ });
67
+ },
68
+ });
69
+ //# sourceMappingURL=new-customer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"new-customer.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/stripe/src/lib/trigger/new-customer.ts"],"names":[],"mappings":";;;;AAAA,uDAAyE;AACzE,sCAAyC;AAE5B,QAAA,iBAAiB,GAAG,IAAA,yBAAa,EAAC;IAC7C,IAAI,EAAE,cAAc;IACpB,WAAW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AC,KAAK,0CAAE,GAAG,CAAqB,uBAAuB,CAAC,CAAA,CAAC;YACvF,IAAI,QAAQ,KAAK,IAAI,IAAI,QAAQ,KAAK,SAAS,EAAE;gBAC/C,MAAM,qBAAY,CAAC,kBAAkB,CAAC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC,UAAU,CAAC,SAAS,CAAE,CAAC,CAAC;aAC3F;;KACF;IACK,GAAG,CAAC,OAAO;;YACf,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC5C,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export declare const stripeNewPayment: import("@activepieces/framework").Trigger;
@@ -0,0 +1,134 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.stripeNewPayment = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const framework_1 = require("@activepieces/framework");
6
+ const common_1 = require("../common");
7
+ exports.stripeNewPayment = (0, framework_1.createTrigger)({
8
+ name: 'new_payment',
9
+ displayName: 'New Payment',
10
+ description: 'Triggers when a new payment is made',
11
+ props: {
12
+ api_key: common_1.stripeCommon.authentication
13
+ },
14
+ type: framework_1.TriggerStrategy.WEBHOOK,
15
+ sampleData: {
16
+ "id": "ch_3MWM7aKZ0dZRqLEK1soCKVrq",
17
+ "object": "charge",
18
+ "amount": 10000,
19
+ "amount_captured": 10000,
20
+ "amount_refunded": 0,
21
+ "application": null,
22
+ "application_fee": null,
23
+ "application_fee_amount": null,
24
+ "balance_transaction": "txn_3MWM7aKZ0dZRqLEK1VyE8QH1",
25
+ "billing_details": {
26
+ "address": {
27
+ "city": null,
28
+ "country": "DE",
29
+ "line1": null,
30
+ "line2": null,
31
+ "postal_code": null,
32
+ "state": null
33
+ },
34
+ "email": "test@gmail.com",
35
+ "name": "Test user",
36
+ "phone": null
37
+ },
38
+ "calculated_statement_descriptor": "WWW.ACTIVEPIECES.COM",
39
+ "captured": true,
40
+ "created": 1675180355,
41
+ "currency": "usd",
42
+ "customer": "cus_NGtvUQ18FJXcGI",
43
+ "description": "Subscription creation",
44
+ "destination": null,
45
+ "dispute": null,
46
+ "disputed": false,
47
+ "failure_balance_transaction": null,
48
+ "failure_code": null,
49
+ "failure_message": null,
50
+ "fraud_details": {},
51
+ "invoice": "in_1MWM7ZKZ0dZRqLEKQbrgSBnh",
52
+ "livemode": false,
53
+ "metadata": {},
54
+ "on_behalf_of": null,
55
+ "order": null,
56
+ "outcome": {
57
+ "network_status": "approved_by_network",
58
+ "reason": null,
59
+ "risk_level": "normal",
60
+ "risk_score": 64,
61
+ "seller_message": "Payment complete.",
62
+ "type": "authorized"
63
+ },
64
+ "paid": true,
65
+ "payment_intent": "pi_3MWM7aKZ0dZRqLEK1BsblcVI",
66
+ "payment_method": "pm_1MWM8MKZ0dZRqLEKnIH41f76",
67
+ "payment_method_details": {
68
+ "card": {
69
+ "brand": "visa",
70
+ "checks": {
71
+ "address_line1_check": null,
72
+ "address_postal_code_check": null,
73
+ "cvc_check": "pass"
74
+ },
75
+ "country": "US",
76
+ "exp_month": 12,
77
+ "exp_year": 2034,
78
+ "fingerprint": "t8SMsmS4h2vvODpN",
79
+ "funding": "credit",
80
+ "installments": null,
81
+ "last4": "4242",
82
+ "mandate": null,
83
+ "network": "visa",
84
+ "three_d_secure": null,
85
+ "wallet": null
86
+ },
87
+ "type": "card"
88
+ },
89
+ "receipt_email": null,
90
+ "receipt_number": null,
91
+ "receipt_url": "https://pay.stripe.com/receipts/invoices/CAcaFwoVYWNjdF8xS214ZEtLWjBkWlJxTEVLKMXy5J4GMgZcuppYWF06LBZEoiAhZ6H7EoJ3bN-BMHCXdaW-_i-ywhSIG9wPGTmtE0CdpD75s1hIyprK?s=ap",
92
+ "refunded": false,
93
+ "refunds": {
94
+ "object": "list",
95
+ "data": [],
96
+ "has_more": false,
97
+ "total_count": 0,
98
+ "url": "/v1/charges/ch_3MWM7aKZ0dZRqLEK1soCKVrq/refunds"
99
+ },
100
+ "review": null,
101
+ "shipping": null,
102
+ "source": null,
103
+ "source_transfer": null,
104
+ "statement_descriptor": null,
105
+ "statement_descriptor_suffix": null,
106
+ "status": "succeeded",
107
+ "transfer_data": null,
108
+ "transfer_group": null
109
+ },
110
+ onEnable(context) {
111
+ var _a;
112
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
113
+ const webhook = yield common_1.stripeCommon.subscribeWebhook('charge.succeeded', context.webhookUrl, context.propsValue['api_key']);
114
+ yield ((_a = context.store) === null || _a === void 0 ? void 0 : _a.put('_new_payment_trigger', {
115
+ webhookId: webhook.id
116
+ }));
117
+ });
118
+ },
119
+ onDisable(context) {
120
+ var _a;
121
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
122
+ const response = yield ((_a = context.store) === null || _a === void 0 ? void 0 : _a.get('_new_payment_trigger'));
123
+ if (response !== null && response !== undefined) {
124
+ yield common_1.stripeCommon.unsubscribeWebhook(response.webhookId, context.propsValue['api_key']);
125
+ }
126
+ });
127
+ },
128
+ run(context) {
129
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
130
+ return [context.payload.body.data.object];
131
+ });
132
+ },
133
+ });
134
+ //# sourceMappingURL=new-payment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"new-payment.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/stripe/src/lib/trigger/new-payment.ts"],"names":[],"mappings":";;;;AAAA,uDAAyE;AACzE,sCAAyC;AAE5B,QAAA,gBAAgB,GAAG,IAAA,yBAAa,EAAC;IAC5C,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,aAAa;IAC1B,WAAW,EAAE,qCAAqC;IAClD,KAAK,EAAE;QACL,OAAO,EAAE,qBAAY,CAAC,cAAc;KACrC;IACD,IAAI,EAAE,2BAAe,CAAC,OAAO;IAC7B,UAAU,EAAE;QACV,IAAI,EAAE,6BAA6B;QACnC,QAAQ,EAAE,QAAQ;QAClB,QAAQ,EAAE,KAAK;QAC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,CAAA,MAAA,OAAO,CAAC,KAAK,0CAAE,GAAG,CAAqB,sBAAsB,CAAC,CAAA,CAAC;YACtF,IAAI,QAAQ,KAAK,IAAI,IAAI,QAAQ,KAAK,SAAS,EAAE;gBAChD,MAAM,qBAAY,CAAC,kBAAkB,CAAC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC,UAAU,CAAC,SAAS,CAAE,CAAC,CAAC;aAC1F;;KACF;IACK,GAAG,CAAC,OAAO;;YACf,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC5C,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export declare const stripeNewSubscription: import("@activepieces/framework").Trigger;
@@ -0,0 +1,175 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.stripeNewSubscription = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const framework_1 = require("@activepieces/framework");
6
+ const common_1 = require("../common");
7
+ exports.stripeNewSubscription = (0, framework_1.createTrigger)({
8
+ name: 'new_subscription',
9
+ displayName: 'New Subscription',
10
+ description: 'Triggers when a new subscription is made',
11
+ props: {
12
+ api_key: common_1.stripeCommon.authentication
13
+ },
14
+ type: framework_1.TriggerStrategy.WEBHOOK,
15
+ sampleData: {
16
+ "id": "sub_1MWMJXKZ0dZRqLEKJX80JXfv",
17
+ "object": "subscription",
18
+ "application": null,
19
+ "application_fee_percent": null,
20
+ "automatic_tax": {
21
+ "enabled": true
22
+ },
23
+ "billing_cycle_anchor": 1675181047,
24
+ "billing_thresholds": null,
25
+ "cancel_at": null,
26
+ "cancel_at_period_end": false,
27
+ "canceled_at": null,
28
+ "collection_method": "charge_automatically",
29
+ "created": 1675181047,
30
+ "currency": "usd",
31
+ "current_period_end": 1677600247,
32
+ "current_period_start": 1675181047,
33
+ "customer": "cus_NGtvUQ18FJXcGI",
34
+ "days_until_due": null,
35
+ "default_payment_method": "pm_1MWM8MKZ0dZRqLEKnIH41f76",
36
+ "default_source": null,
37
+ "default_tax_rates": [],
38
+ "description": null,
39
+ "discount": null,
40
+ "ended_at": null,
41
+ "items": {
42
+ "object": "list",
43
+ "data": [
44
+ {
45
+ "id": "si_NGu7pb7hS3Rps3",
46
+ "object": "subscription_item",
47
+ "billing_thresholds": null,
48
+ "created": 1675181048,
49
+ "metadata": {},
50
+ "plan": {
51
+ "id": "price_1MWLz3KZ0dZRqLEK06gRMHCF",
52
+ "object": "plan",
53
+ "active": true,
54
+ "aggregate_usage": null,
55
+ "amount": 10000,
56
+ "amount_decimal": "10000",
57
+ "billing_scheme": "per_unit",
58
+ "created": 1675179777,
59
+ "currency": "usd",
60
+ "interval": "month",
61
+ "interval_count": 1,
62
+ "livemode": false,
63
+ "metadata": {},
64
+ "nickname": null,
65
+ "product": "prod_NGtm3AlvaGjaLN",
66
+ "tiers_mode": null,
67
+ "transform_usage": null,
68
+ "trial_period_days": null,
69
+ "usage_type": "licensed"
70
+ },
71
+ "price": {
72
+ "id": "price_1MWLz3KZ0dZRqLEK06gRMHCF",
73
+ "object": "price",
74
+ "active": true,
75
+ "billing_scheme": "per_unit",
76
+ "created": 1675179777,
77
+ "currency": "usd",
78
+ "custom_unit_amount": null,
79
+ "livemode": false,
80
+ "lookup_key": null,
81
+ "metadata": {},
82
+ "nickname": null,
83
+ "product": "prod_NGtm3AlvaGjaLN",
84
+ "recurring": {
85
+ "aggregate_usage": null,
86
+ "interval": "month",
87
+ "interval_count": 1,
88
+ "trial_period_days": null,
89
+ "usage_type": "licensed"
90
+ },
91
+ "tax_behavior": "exclusive",
92
+ "tiers_mode": null,
93
+ "transform_quantity": null,
94
+ "type": "recurring",
95
+ "unit_amount": 10000,
96
+ "unit_amount_decimal": "10000"
97
+ },
98
+ "quantity": 1,
99
+ "subscription": "sub_1MWMJXKZ0dZRqLEKJX80JXfv",
100
+ "tax_rates": []
101
+ }
102
+ ],
103
+ "has_more": false,
104
+ "total_count": 1,
105
+ "url": "/v1/subscription_items?subscription=sub_1MWMJXKZ0dZRqLEKJX80JXfv"
106
+ },
107
+ "latest_invoice": "in_1MWMJXKZ0dZRqLEKIu4a51u7",
108
+ "livemode": false,
109
+ "metadata": {},
110
+ "next_pending_invoice_item_invoice": null,
111
+ "on_behalf_of": null,
112
+ "pause_collection": null,
113
+ "payment_settings": {
114
+ "payment_method_options": null,
115
+ "payment_method_types": null,
116
+ "save_default_payment_method": "off"
117
+ },
118
+ "pending_invoice_item_interval": null,
119
+ "pending_setup_intent": null,
120
+ "pending_update": null,
121
+ "plan": {
122
+ "id": "price_1MWLz3KZ0dZRqLEK06gRMHCF",
123
+ "object": "plan",
124
+ "active": true,
125
+ "aggregate_usage": null,
126
+ "amount": 10000,
127
+ "amount_decimal": "10000",
128
+ "billing_scheme": "per_unit",
129
+ "created": 1675179777,
130
+ "currency": "usd",
131
+ "interval": "month",
132
+ "interval_count": 1,
133
+ "livemode": false,
134
+ "metadata": {},
135
+ "nickname": null,
136
+ "product": "prod_NGtm3AlvaGjaLN",
137
+ "tiers_mode": null,
138
+ "transform_usage": null,
139
+ "trial_period_days": null,
140
+ "usage_type": "licensed"
141
+ },
142
+ "quantity": 1,
143
+ "schedule": null,
144
+ "start_date": 1675181047,
145
+ "status": "active",
146
+ "test_clock": null,
147
+ "transfer_data": null,
148
+ "trial_end": null,
149
+ "trial_start": null
150
+ },
151
+ onEnable(context) {
152
+ var _a;
153
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
154
+ const webhook = yield common_1.stripeCommon.subscribeWebhook('customer.subscription.created', context.webhookUrl, context.propsValue['api_key']);
155
+ yield ((_a = context.store) === null || _a === void 0 ? void 0 : _a.put('_new_customer_subscription_trigger', {
156
+ webhookId: webhook.id
157
+ }));
158
+ });
159
+ },
160
+ onDisable(context) {
161
+ var _a;
162
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
163
+ const response = yield ((_a = context.store) === null || _a === void 0 ? void 0 : _a.get('_new_customer_subscription_trigger'));
164
+ if (response !== null && response !== undefined) {
165
+ yield common_1.stripeCommon.unsubscribeWebhook(response.webhookId, context.propsValue['api_key']);
166
+ }
167
+ });
168
+ },
169
+ run(context) {
170
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
171
+ return [context.payload.body.data.object];
172
+ });
173
+ },
174
+ });
175
+ //# sourceMappingURL=new-subscription.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"new-subscription.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/stripe/src/lib/trigger/new-subscription.ts"],"names":[],"mappings":";;;;AAAA,uDAAyE;AACzE,sCAAyC;AAE5B,QAAA,qBAAqB,GAAG,IAAA,yBAAa,EAAC;IACjD,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,kBAAkB;IAC/B,WAAW,EAAE,0CAA0C;IACvD,KAAK,EAAE;QACL,OAAO,EAAE,qBAAY,CAAC,cAAc;KACrC;IACD,IAAI,EAAE,2BAAe,CAAC,OAAO;IAC7B,UAAU,EAAE;QACV,IAAI,EAAE,8BAA8B;QACpC,QAAQ,EAAE,cAAc;QACxB,aAAa,EAAE,IAAI;QACnB,yBAAyB,EAAE,IAAI;QAC/B,eAAe,EAAE;YACf,SAAS,EAAE,IAAI;SAChB;QACD,sBAAsB,EAAE,UAAU;QAClC,oBAAoB,EAAE,IAAI;QAC1B,WAAW,EAAE,IAAI;QACjB,sBAAsB,EAAE,KAAK;QAC7B,aAAa,EAAE,IAAI;QACnB,mBAAmB,EAAE,sBAAsB;QAC3C,SAAS,EAAE,UAAU;QACrB,UAAU,EAAE,KAAK;QACjB,oBAAoB,EAAE,UAAU;QAChC,sBAAsB,EAAE,UAAU;QAClC,UAAU,EAAE,oBAAoB;QAChC,gBAAgB,EAAE,IAAI;QACtB,wBAAwB,EAAE,6BAA6B;QACvD,gBAAgB,EAAE,IAAI;QACtB,mBAAmB,EAAE,EAAE;QACvB,aAAa,EAAE,IAAI;QACnB,UAAU,EAAE,IAAI;QAChB,UAAU,EAA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E,UAAU;QACxB,QAAQ,EAAE,QAAQ;QAClB,YAAY,EAAE,IAAI;QAClB,eAAe,EAAE,IAAI;QACrB,WAAW,EAAE,IAAI;QACjB,aAAa,EAAE,IAAI;KACpB;IACK,QAAQ,CAAC,OAAO;;;YACpB,MAAM,OAAO,GAAG,MAAM,qBAAY,CAAC,gBAAgB,CAAC,+BAA+B,EAAE,OAAO,CAAC,UAAW,EAAE,OAAO,CAAC,UAAU,CAAC,SAAS,CAAE,CAAC,CAAC;YAC1I,MAAM,CAAA,MAAA,OAAO,CAAC,KAAK,0CAAE,GAAG,CAAqB,oCAAoC,EAAE;gBACjF,SAAS,EAAE,OAAO,CAAC,EAAE;aACtB,CAAC,CAAA,CAAC;;KACJ;IACK,SAAS,CAAC,OAAO;;;YACrB,MAAM,QAAQ,GAAG,MAAM,CAAA,MAAA,OAAO,CAAC,KAAK,0CAAE,GAAG,CAAqB,oCAAoC,CAAC,CAAA,CAAC;YACpG,IAAI,QAAQ,KAAK,IAAI,IAAI,QAAQ,KAAK,SAAS,EAAE;gBAC/C,MAAM,qBAAY,CAAC,kBAAkB,CAAC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC;aAC1F;;KACF;IACK,GAAG,CAAC,OAAO;;YACf,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC5C,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export declare const stripePaymentFailed: import("@activepieces/framework").Trigger;
@@ -0,0 +1,181 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.stripePaymentFailed = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const framework_1 = require("@activepieces/framework");
6
+ const common_1 = require("../common");
7
+ exports.stripePaymentFailed = (0, framework_1.createTrigger)({
8
+ name: 'payment_failed',
9
+ displayName: 'Payment Failed',
10
+ description: 'Triggers when a payment fails',
11
+ props: {
12
+ api_key: common_1.stripeCommon.authentication
13
+ },
14
+ sampleData: {
15
+ "id": "ch_3MWMPQKZ0dZRqLEK063rxD7q",
16
+ "object": "charge",
17
+ "amount": 100000,
18
+ "amount_captured": 0,
19
+ "amount_refunded": 0,
20
+ "application": null,
21
+ "application_fee": null,
22
+ "application_fee_amount": null,
23
+ "balance_transaction": null,
24
+ "billing_details": {
25
+ "address": {
26
+ "city": null,
27
+ "country": null,
28
+ "line1": null,
29
+ "line2": null,
30
+ "postal_code": "12321",
31
+ "state": null
32
+ },
33
+ "email": null,
34
+ "name": null,
35
+ "phone": null
36
+ },
37
+ "calculated_statement_descriptor": "WWW.ACTIVEPIECES.COM",
38
+ "captured": false,
39
+ "created": 1675181413,
40
+ "currency": "usd",
41
+ "customer": "cus_NGtvUQ18FJXcGI",
42
+ "description": "Failed Payment",
43
+ "destination": null,
44
+ "dispute": null,
45
+ "disputed": false,
46
+ "failure_balance_transaction": null,
47
+ "failure_code": "card_declined",
48
+ "failure_message": "Your card was declined.",
49
+ "fraud_details": {},
50
+ "invoice": null,
51
+ "livemode": false,
52
+ "metadata": {},
53
+ "on_behalf_of": null,
54
+ "order": null,
55
+ "outcome": {
56
+ "network_status": "declined_by_network",
57
+ "reason": "generic_decline",
58
+ "risk_level": "normal",
59
+ "risk_score": 60,
60
+ "seller_message": "The bank did not return any further details with this decline.",
61
+ "type": "issuer_declined"
62
+ },
63
+ "paid": false,
64
+ "payment_intent": "pi_3MWMPQKZ0dZRqLEK0Nsc6WhL",
65
+ "payment_method": "src_1MWMPQKZ0dZRqLEKuQ83wmZI",
66
+ "payment_method_details": {
67
+ "card": {
68
+ "brand": "visa",
69
+ "checks": {
70
+ "address_line1_check": null,
71
+ "address_postal_code_check": "pass",
72
+ "cvc_check": "pass"
73
+ },
74
+ "country": "US",
75
+ "exp_month": 12,
76
+ "exp_year": 2031,
77
+ "fingerprint": "mtYxM2Q4edpEt8Pw",
78
+ "funding": "credit",
79
+ "installments": null,
80
+ "last4": "0341",
81
+ "mandate": null,
82
+ "network": "visa",
83
+ "three_d_secure": null,
84
+ "wallet": null
85
+ },
86
+ "type": "card"
87
+ },
88
+ "receipt_email": null,
89
+ "receipt_number": null,
90
+ "receipt_url": null,
91
+ "refunded": false,
92
+ "refunds": {
93
+ "object": "list",
94
+ "data": [],
95
+ "has_more": false,
96
+ "total_count": 0,
97
+ "url": "/v1/charges/ch_3MWMPQKZ0dZRqLEK063rxD7q/refunds"
98
+ },
99
+ "review": null,
100
+ "shipping": null,
101
+ "source": {
102
+ "id": "src_1MWMPQKZ0dZRqLEKuQ83wmZI",
103
+ "object": "source",
104
+ "amount": null,
105
+ "card": {
106
+ "exp_month": 12,
107
+ "exp_year": 2031,
108
+ "last4": "0341",
109
+ "country": "US",
110
+ "brand": "Visa",
111
+ "address_zip_check": "pass",
112
+ "cvc_check": "pass",
113
+ "funding": "credit",
114
+ "fingerprint": "mtYxM2Q4edpEt8Pw",
115
+ "three_d_secure": "optional",
116
+ "name": null,
117
+ "address_line1_check": null,
118
+ "tokenization_method": null,
119
+ "dynamic_last4": null
120
+ },
121
+ "client_secret": "src_client_secret_TlLkl6IvhCvmbx8Cz12YNDVb",
122
+ "created": 1675181413,
123
+ "currency": null,
124
+ "flow": "none",
125
+ "livemode": false,
126
+ "metadata": {},
127
+ "owner": {
128
+ "address": {
129
+ "city": null,
130
+ "country": null,
131
+ "line1": null,
132
+ "line2": null,
133
+ "postal_code": "12321",
134
+ "state": null
135
+ },
136
+ "email": null,
137
+ "name": null,
138
+ "phone": null,
139
+ "verified_address": null,
140
+ "verified_email": null,
141
+ "verified_name": null,
142
+ "verified_phone": null
143
+ },
144
+ "statement_descriptor": null,
145
+ "status": "chargeable",
146
+ "type": "card",
147
+ "usage": "reusable"
148
+ },
149
+ "source_transfer": null,
150
+ "statement_descriptor": "www.activepieces.com",
151
+ "statement_descriptor_suffix": null,
152
+ "status": "failed",
153
+ "transfer_data": null,
154
+ "transfer_group": null
155
+ },
156
+ type: framework_1.TriggerStrategy.WEBHOOK,
157
+ onEnable(context) {
158
+ var _a;
159
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
160
+ const webhook = yield common_1.stripeCommon.subscribeWebhook('charge.failed', context.webhookUrl, context.propsValue['api_key']);
161
+ yield ((_a = context.store) === null || _a === void 0 ? void 0 : _a.put('_payment_failed_trigger', {
162
+ webhookId: webhook.id
163
+ }));
164
+ });
165
+ },
166
+ onDisable(context) {
167
+ var _a;
168
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
169
+ const response = yield ((_a = context.store) === null || _a === void 0 ? void 0 : _a.get('_payment_failed_trigger'));
170
+ if (response !== null && response !== undefined) {
171
+ yield common_1.stripeCommon.unsubscribeWebhook(response.webhookId, context.propsValue['api_key']);
172
+ }
173
+ });
174
+ },
175
+ run(context) {
176
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
177
+ return [context.payload.body.data.object];
178
+ });
179
+ },
180
+ });
181
+ //# sourceMappingURL=payment-failed.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payment-failed.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/stripe/src/lib/trigger/payment-failed.ts"],"names":[],"mappings":";;;;AAAA,uDAAyE;AACzE,sCAAyC;AAE5B,QAAA,mBAAmB,GAAG,IAAA,yBAAa,EAAC;IAC/C,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,gBAAgB;IAC7B,WAAW,EAAE,+BAA+B;IAC5C,KAAK,EAAE;QACL,OAAO,EAAE,qBAAY,CAAC,cAAc;KACrC;IACD,UAAU,EAAE;QACV,IAAI,EAAE,6BAA6B;QACnC,QAAQ,EAAE,QAAQ;QAClB,QAAQ,EAAE,MAAM;QAChB,iBAAiB,EAAE,CAAC;QACpB,iBAAiB,EAAE,CAAC;QACpB,aAAa,EAAE,IAAI;QACnB,iBAAiB,EAAE,IAAI;QACvB,wBAAwB,EAAE,IAAI;QAC9B,qBAAqB,EAAE,IAAI;QAC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