@activepieces/piece-stripe 0.6.8 → 0.6.10
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 -13
- package/src/index.js +26 -127
- package/src/index.d.ts +0 -3
- package/src/index.d.ts.map +0 -1
- package/src/index.js.map +0 -1
- package/src/lib/actions/cancel-subscription.d.ts +0 -5
- package/src/lib/actions/cancel-subscription.d.ts.map +0 -1
- package/src/lib/actions/cancel-subscription.js +0 -37
- package/src/lib/actions/cancel-subscription.js.map +0 -1
- package/src/lib/actions/create-customer.d.ts +0 -12
- package/src/lib/actions/create-customer.d.ts.map +0 -1
- package/src/lib/actions/create-customer.js +0 -86
- package/src/lib/actions/create-customer.js.map +0 -1
- package/src/lib/actions/create-invoice.d.ts +0 -6
- package/src/lib/actions/create-invoice.d.ts.map +0 -1
- package/src/lib/actions/create-invoice.js +0 -54
- package/src/lib/actions/create-invoice.js.map +0 -1
- package/src/lib/actions/create-payment-intent.d.ts +0 -11
- package/src/lib/actions/create-payment-intent.d.ts.map +0 -1
- package/src/lib/actions/create-payment-intent.js +0 -108
- package/src/lib/actions/create-payment-intent.js.map +0 -1
- package/src/lib/actions/create-payment-link.d.ts +0 -9
- package/src/lib/actions/create-payment-link.d.ts.map +0 -1
- package/src/lib/actions/create-payment-link.js +0 -92
- package/src/lib/actions/create-payment-link.js.map +0 -1
- package/src/lib/actions/create-price.d.ts +0 -8
- package/src/lib/actions/create-price.d.ts.map +0 -1
- package/src/lib/actions/create-price.js +0 -92
- package/src/lib/actions/create-price.js.map +0 -1
- package/src/lib/actions/create-product.d.ts +0 -9
- package/src/lib/actions/create-product.d.ts.map +0 -1
- package/src/lib/actions/create-product.js +0 -84
- package/src/lib/actions/create-product.js.map +0 -1
- package/src/lib/actions/create-refund.d.ts +0 -7
- package/src/lib/actions/create-refund.d.ts.map +0 -1
- package/src/lib/actions/create-refund.js +0 -72
- package/src/lib/actions/create-refund.js.map +0 -1
- package/src/lib/actions/create-subscription.d.ts +0 -10
- package/src/lib/actions/create-subscription.d.ts.map +0 -1
- package/src/lib/actions/create-subscription.js +0 -105
- package/src/lib/actions/create-subscription.js.map +0 -1
- package/src/lib/actions/deactivate-payment-link.d.ts +0 -4
- package/src/lib/actions/deactivate-payment-link.d.ts.map +0 -1
- package/src/lib/actions/deactivate-payment-link.js +0 -26
- package/src/lib/actions/deactivate-payment-link.js.map +0 -1
- package/src/lib/actions/find-invoice.d.ts +0 -4
- package/src/lib/actions/find-invoice.d.ts.map +0 -1
- package/src/lib/actions/find-invoice.js +0 -32
- package/src/lib/actions/find-invoice.js.map +0 -1
- package/src/lib/actions/retrieve-customer.d.ts +0 -4
- package/src/lib/actions/retrieve-customer.d.ts.map +0 -1
- package/src/lib/actions/retrieve-customer.js +0 -37
- package/src/lib/actions/retrieve-customer.js.map +0 -1
- package/src/lib/actions/retrieve-invoice.d.ts +0 -4
- package/src/lib/actions/retrieve-invoice.d.ts.map +0 -1
- package/src/lib/actions/retrieve-invoice.js +0 -32
- package/src/lib/actions/retrieve-invoice.js.map +0 -1
- package/src/lib/actions/retrieve-payment-intent.d.ts +0 -4
- package/src/lib/actions/retrieve-payment-intent.d.ts.map +0 -1
- package/src/lib/actions/retrieve-payment-intent.js +0 -32
- package/src/lib/actions/retrieve-payment-intent.js.map +0 -1
- package/src/lib/actions/retrieve-payout.d.ts +0 -4
- package/src/lib/actions/retrieve-payout.d.ts.map +0 -1
- package/src/lib/actions/retrieve-payout.js +0 -32
- package/src/lib/actions/retrieve-payout.js.map +0 -1
- package/src/lib/actions/search-customer.d.ts +0 -4
- package/src/lib/actions/search-customer.d.ts.map +0 -1
- package/src/lib/actions/search-customer.js +0 -42
- package/src/lib/actions/search-customer.js.map +0 -1
- package/src/lib/actions/search-subscriptions.d.ts +0 -11
- package/src/lib/actions/search-subscriptions.d.ts.map +0 -1
- package/src/lib/actions/search-subscriptions.js +0 -194
- package/src/lib/actions/search-subscriptions.js.map +0 -1
- package/src/lib/actions/update-customer.d.ts +0 -13
- package/src/lib/actions/update-customer.d.ts.map +0 -1
- package/src/lib/actions/update-customer.js +0 -95
- package/src/lib/actions/update-customer.js.map +0 -1
- package/src/lib/common/index.d.ts +0 -18
- package/src/lib/common/index.d.ts.map +0 -1
- package/src/lib/common/index.js +0 -405
- package/src/lib/common/index.js.map +0 -1
- package/src/lib/common/types.d.ts +0 -59
- package/src/lib/common/types.d.ts.map +0 -1
- package/src/lib/common/types.js +0 -3
- package/src/lib/common/types.js.map +0 -1
- package/src/lib/trigger/canceled-subscription.d.ts +0 -11
- package/src/lib/trigger/canceled-subscription.d.ts.map +0 -1
- package/src/lib/trigger/canceled-subscription.js +0 -113
- package/src/lib/trigger/canceled-subscription.js.map +0 -1
- package/src/lib/trigger/checkout-session-completed.d.ts +0 -11
- package/src/lib/trigger/checkout-session-completed.d.ts.map +0 -1
- package/src/lib/trigger/checkout-session-completed.js +0 -91
- package/src/lib/trigger/checkout-session-completed.js.map +0 -1
- package/src/lib/trigger/invoice-payment-failed.d.ts +0 -11
- package/src/lib/trigger/invoice-payment-failed.d.ts.map +0 -1
- package/src/lib/trigger/invoice-payment-failed.js +0 -101
- package/src/lib/trigger/invoice-payment-failed.js.map +0 -1
- package/src/lib/trigger/new-charge.d.ts +0 -3
- package/src/lib/trigger/new-charge.d.ts.map +0 -1
- package/src/lib/trigger/new-charge.js +0 -96
- package/src/lib/trigger/new-charge.js.map +0 -1
- package/src/lib/trigger/new-customer.d.ts +0 -3
- package/src/lib/trigger/new-customer.d.ts.map +0 -1
- package/src/lib/trigger/new-customer.js +0 -91
- package/src/lib/trigger/new-customer.js.map +0 -1
- package/src/lib/trigger/new-dispute.d.ts +0 -15
- package/src/lib/trigger/new-dispute.d.ts.map +0 -1
- package/src/lib/trigger/new-dispute.js +0 -99
- package/src/lib/trigger/new-dispute.js.map +0 -1
- package/src/lib/trigger/new-invoice.d.ts +0 -19
- package/src/lib/trigger/new-invoice.d.ts.map +0 -1
- package/src/lib/trigger/new-invoice.js +0 -114
- package/src/lib/trigger/new-invoice.js.map +0 -1
- package/src/lib/trigger/new-payment-link.d.ts +0 -3
- package/src/lib/trigger/new-payment-link.d.ts.map +0 -1
- package/src/lib/trigger/new-payment-link.js +0 -76
- package/src/lib/trigger/new-payment-link.js.map +0 -1
- package/src/lib/trigger/new-payment.d.ts +0 -3
- package/src/lib/trigger/new-payment.d.ts.map +0 -1
- package/src/lib/trigger/new-payment.js +0 -158
- package/src/lib/trigger/new-payment.js.map +0 -1
- package/src/lib/trigger/new-refund.d.ts +0 -15
- package/src/lib/trigger/new-refund.d.ts.map +0 -1
- package/src/lib/trigger/new-refund.js +0 -91
- package/src/lib/trigger/new-refund.js.map +0 -1
- package/src/lib/trigger/new-subscription.d.ts +0 -3
- package/src/lib/trigger/new-subscription.d.ts.map +0 -1
- package/src/lib/trigger/new-subscription.js +0 -197
- package/src/lib/trigger/new-subscription.js.map +0 -1
- package/src/lib/trigger/payment-failed.d.ts +0 -3
- package/src/lib/trigger/payment-failed.d.ts.map +0 -1
- package/src/lib/trigger/payment-failed.js +0 -204
- package/src/lib/trigger/payment-failed.js.map +0 -1
- package/src/lib/trigger/updated-subscription.d.ts +0 -15
- package/src/lib/trigger/updated-subscription.d.ts.map +0 -1
- package/src/lib/trigger/updated-subscription.js +0 -127
- package/src/lib/trigger/updated-subscription.js.map +0 -1
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.stripeNewInvoice = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
-
const common_1 = require("../common");
|
|
7
|
-
const __1 = require("../..");
|
|
8
|
-
const shared_1 = require("@activepieces/shared");
|
|
9
|
-
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
10
|
-
exports.stripeNewInvoice = (0, pieces_framework_1.createTrigger)({
|
|
11
|
-
auth: __1.stripeAuth,
|
|
12
|
-
name: 'new_invoice',
|
|
13
|
-
displayName: 'New Invoice',
|
|
14
|
-
description: 'Fires when an invoice is created. Supports filters like status, customer, subscription.',
|
|
15
|
-
props: {
|
|
16
|
-
status: pieces_framework_1.Property.StaticDropdown({
|
|
17
|
-
displayName: 'Status',
|
|
18
|
-
description: 'Only trigger for invoices with this status.',
|
|
19
|
-
required: false,
|
|
20
|
-
options: {
|
|
21
|
-
options: [
|
|
22
|
-
{ label: 'Draft', value: 'draft' },
|
|
23
|
-
{ label: 'Open', value: 'open' },
|
|
24
|
-
{ label: 'Paid', value: 'paid' },
|
|
25
|
-
{ label: 'Uncollectible', value: 'uncollectible' },
|
|
26
|
-
{ label: 'Void', value: 'void' },
|
|
27
|
-
],
|
|
28
|
-
},
|
|
29
|
-
}),
|
|
30
|
-
customer: pieces_framework_1.Property.ShortText({
|
|
31
|
-
displayName: 'Customer ID',
|
|
32
|
-
description: 'Only trigger for invoices belonging to this customer ID (e.g., `cus_...`).',
|
|
33
|
-
required: false,
|
|
34
|
-
}),
|
|
35
|
-
subscription: pieces_framework_1.Property.ShortText({
|
|
36
|
-
displayName: 'Subscription ID',
|
|
37
|
-
description: 'Only trigger for invoices belonging to this subscription ID (e.g., `sub_...`).',
|
|
38
|
-
required: false,
|
|
39
|
-
}),
|
|
40
|
-
},
|
|
41
|
-
sampleData: {
|
|
42
|
-
id: 'in_1MtHbELkdIwHu7ixl4OzzPMv',
|
|
43
|
-
object: 'invoice',
|
|
44
|
-
customer: 'cus_NeZwdNtLEOXuvB',
|
|
45
|
-
subscription: 'sub_12345ABC',
|
|
46
|
-
status: 'paid',
|
|
47
|
-
amount_due: 999,
|
|
48
|
-
amount_paid: 999,
|
|
49
|
-
amount_remaining: 0,
|
|
50
|
-
billing_reason: 'subscription_cycle',
|
|
51
|
-
collection_method: 'charge_automatically',
|
|
52
|
-
created: 1680644467,
|
|
53
|
-
currency: 'usd',
|
|
54
|
-
customer_email: 'jennyrosen@example.com',
|
|
55
|
-
customer_name: 'Jenny Rosen',
|
|
56
|
-
hosted_invoice_url: 'https://invoice.stripe.com/i/acct_...',
|
|
57
|
-
invoice_pdf: 'https://pay.stripe.com/invoice/acct_.../pdf',
|
|
58
|
-
livemode: false,
|
|
59
|
-
number: 'ABC-123-456',
|
|
60
|
-
},
|
|
61
|
-
type: pieces_framework_1.TriggerStrategy.WEBHOOK,
|
|
62
|
-
onEnable(context) {
|
|
63
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
64
|
-
const webhook = yield common_1.stripeCommon.subscribeWebhook('invoice.created', context.webhookUrl, context.auth.secret_text);
|
|
65
|
-
yield context.store.put('_new_invoice_trigger', {
|
|
66
|
-
webhookId: webhook.id,
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
},
|
|
70
|
-
onDisable(context) {
|
|
71
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
72
|
-
const webhookInfo = yield context.store.get('_new_invoice_trigger');
|
|
73
|
-
if (webhookInfo !== null && webhookInfo !== undefined) {
|
|
74
|
-
yield common_1.stripeCommon.unsubscribeWebhook(webhookInfo.webhookId, context.auth.secret_text);
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
},
|
|
78
|
-
test(context) {
|
|
79
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
80
|
-
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
81
|
-
method: pieces_common_1.HttpMethod.GET,
|
|
82
|
-
url: 'https://api.stripe.com/v1/invoices',
|
|
83
|
-
headers: {
|
|
84
|
-
Authorization: 'Bearer ' + context.auth.secret_text,
|
|
85
|
-
'Content-Type': 'application/x-www-form-urlencoded',
|
|
86
|
-
},
|
|
87
|
-
queryParams: {
|
|
88
|
-
limit: '5',
|
|
89
|
-
},
|
|
90
|
-
});
|
|
91
|
-
if ((0, shared_1.isEmpty)(response.body) || (0, shared_1.isEmpty)(response.body.data))
|
|
92
|
-
return [];
|
|
93
|
-
return response.body.data;
|
|
94
|
-
});
|
|
95
|
-
},
|
|
96
|
-
run(context) {
|
|
97
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
98
|
-
const payloadBody = context.payload.body;
|
|
99
|
-
const invoiceObject = payloadBody.data.object;
|
|
100
|
-
const { status, customer, subscription } = context.propsValue;
|
|
101
|
-
if (status && invoiceObject['status'] !== status) {
|
|
102
|
-
return [];
|
|
103
|
-
}
|
|
104
|
-
if (customer && invoiceObject['customer'] !== customer) {
|
|
105
|
-
return [];
|
|
106
|
-
}
|
|
107
|
-
if (subscription && invoiceObject['subscription'] !== subscription) {
|
|
108
|
-
return [];
|
|
109
|
-
}
|
|
110
|
-
return [invoiceObject];
|
|
111
|
-
});
|
|
112
|
-
},
|
|
113
|
-
});
|
|
114
|
-
//# sourceMappingURL=new-invoice.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"new-invoice.js","sourceRoot":"","sources":["../../../../src/lib/trigger/new-invoice.ts"],"names":[],"mappings":";;;;AAAA,qEAIwC;AACxC,sCAAyC;AAEzC,6BAAmC;AACnC,iDAA+C;AAC/C,+DAAqE;AAUxD,QAAA,gBAAgB,GAAG,IAAA,gCAAa,EAAC;IAC5C,IAAI,EAAE,cAAU;IAChB,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,aAAa;IAC1B,WAAW,EACT,yFAAyF;IAC3F,KAAK,EAAE;QACL,MAAM,EAAE,2BAAQ,CAAC,cAAc,CAAC;YAC9B,WAAW,EAAE,QAAQ;YACrB,WAAW,EAAE,6CAA6C;YAC1D,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE;gBACP,OAAO,EAAE;oBACP,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE;oBAClC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE;oBAChC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE;oBAChC,EAAE,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,CAAC,KAAK,QAAQ,EAAE,CAAC;gBACvD,OAAO,EAAE,CAAC;YACZ,CAAC;YACD,IAAI,YAAY,IAAI,aAAa,CAAC,cAAc,CAAC,KAAK,YAAY,EAAE,CAAC;gBACnE,OAAO,EAAE,CAAC;YACZ,CAAC;YAED,OAAO,CAAC,aAAa,CAAC,CAAC;QACzB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { TriggerStrategy } from '@activepieces/pieces-framework';
|
|
2
|
-
export declare const stripeNewPaymentLink: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").SecretTextProperty<true>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@activepieces/pieces-framework").SecretTextProperty<true>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {}>;
|
|
3
|
-
//# sourceMappingURL=new-payment-link.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"new-payment-link.d.ts","sourceRoot":"","sources":["../../../../src/lib/trigger/new-payment-link.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAahF,eAAO,MAAM,oBAAoB,klBAyE/B,CAAC"}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.stripeNewPaymentLink = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
-
const common_1 = require("../common");
|
|
7
|
-
const __1 = require("../..");
|
|
8
|
-
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
9
|
-
const shared_1 = require("@activepieces/shared");
|
|
10
|
-
exports.stripeNewPaymentLink = (0, pieces_framework_1.createTrigger)({
|
|
11
|
-
auth: __1.stripeAuth,
|
|
12
|
-
name: 'new_payment_link',
|
|
13
|
-
displayName: 'New Payment Link',
|
|
14
|
-
description: 'Fires when a new Payment Link is created.',
|
|
15
|
-
props: {},
|
|
16
|
-
sampleData: {
|
|
17
|
-
id: 'plink_1MoC3ULkdIwHu7ixZjtGpVl2',
|
|
18
|
-
object: 'payment_link',
|
|
19
|
-
active: true,
|
|
20
|
-
after_completion: {
|
|
21
|
-
hosted_confirmation: {
|
|
22
|
-
custom_message: null,
|
|
23
|
-
},
|
|
24
|
-
type: 'hosted_confirmation',
|
|
25
|
-
},
|
|
26
|
-
allow_promotion_codes: false,
|
|
27
|
-
currency: 'usd',
|
|
28
|
-
customer_creation: 'if_required',
|
|
29
|
-
livemode: false,
|
|
30
|
-
metadata: {},
|
|
31
|
-
payment_method_collection: 'always',
|
|
32
|
-
url: 'https://buy.stripe.com/test_cN25nr0iZ7bUa7meUY',
|
|
33
|
-
},
|
|
34
|
-
type: pieces_framework_1.TriggerStrategy.WEBHOOK,
|
|
35
|
-
onEnable(context) {
|
|
36
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
37
|
-
const webhook = yield common_1.stripeCommon.subscribeWebhook('payment_link.created', context.webhookUrl, context.auth.secret_text);
|
|
38
|
-
yield context.store.put('_new_payment_link_trigger', {
|
|
39
|
-
webhookId: webhook.id,
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
},
|
|
43
|
-
onDisable(context) {
|
|
44
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
45
|
-
const webhookInfo = yield context.store.get('_new_payment_link_trigger');
|
|
46
|
-
if (webhookInfo !== null && webhookInfo !== undefined) {
|
|
47
|
-
yield common_1.stripeCommon.unsubscribeWebhook(webhookInfo.webhookId, context.auth.secret_text);
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
},
|
|
51
|
-
test(context) {
|
|
52
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
53
|
-
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
54
|
-
method: pieces_common_1.HttpMethod.GET,
|
|
55
|
-
url: 'https://api.stripe.com/v1/payment_links',
|
|
56
|
-
headers: {
|
|
57
|
-
Authorization: 'Bearer ' + context.auth.secret_text,
|
|
58
|
-
'Content-Type': 'application/x-www-form-urlencoded',
|
|
59
|
-
},
|
|
60
|
-
queryParams: {
|
|
61
|
-
limit: '5',
|
|
62
|
-
},
|
|
63
|
-
});
|
|
64
|
-
if ((0, shared_1.isEmpty)(response.body) || (0, shared_1.isEmpty)(response.body.data))
|
|
65
|
-
return [];
|
|
66
|
-
return response.body.data;
|
|
67
|
-
});
|
|
68
|
-
},
|
|
69
|
-
run(context) {
|
|
70
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
71
|
-
const payloadBody = context.payload.body;
|
|
72
|
-
return [payloadBody.data.object];
|
|
73
|
-
});
|
|
74
|
-
},
|
|
75
|
-
});
|
|
76
|
-
//# sourceMappingURL=new-payment-link.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"new-payment-link.js","sourceRoot":"","sources":["../../../../src/lib/trigger/new-payment-link.ts"],"names":[],"mappings":";;;;AAAA,qEAAgF;AAChF,sCAAyC;AAEzC,6BAAmC;AACnC,+DAAqE;AACrE,iDAA+C;AAQlC,QAAA,oBAAoB,GAAG,IAAA,gCAAa,EAAC;IAChD,IAAI,EAAE,cAAU;IAChB,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,kBAAkB;IAC/B,WAAW,EAAE,2CAA2C;IACxD,KAAK,EAAE,EAAE;IACT,UAAU,EAAE;QACV,EAAE,EAAE,gCAAgC;QACpC,MAAM,EAAE,cAAc;QACtB,MAAM,EAAE,IAAI;QACZ,gBAAgB,EAAE;YAChB,mBAAmB,EAAE;g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,IAAI,IAAA,gBAAO,EAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,IAAA,gBAAO,EAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC;gBAAE,OAAO,EAAE,CAAC;YAErE,OAAO,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC;QAC5B,CAAC;KAAA;IAEK,GAAG,CAAC,OAAO;;YACf,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,IAA4B,CAAC;YACjE,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACnC,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { TriggerStrategy } from '@activepieces/pieces-framework';
|
|
2
|
-
export declare const stripeNewPayment: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").SecretTextProperty<true>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@activepieces/pieces-framework").SecretTextProperty<true>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {}>;
|
|
3
|
-
//# sourceMappingURL=new-payment.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"new-payment.d.ts","sourceRoot":"","sources":["../../../../src/lib/trigger/new-payment.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAMjE,eAAO,MAAM,gBAAgB,klBAmJ3B,CAAC"}
|
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.stripeNewPayment = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
-
const pieces_framework_2 = require("@activepieces/pieces-framework");
|
|
7
|
-
const common_1 = require("../common");
|
|
8
|
-
const __1 = require("../..");
|
|
9
|
-
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
10
|
-
const shared_1 = require("@activepieces/shared");
|
|
11
|
-
exports.stripeNewPayment = (0, pieces_framework_1.createTrigger)({
|
|
12
|
-
auth: __1.stripeAuth,
|
|
13
|
-
name: 'new_payment',
|
|
14
|
-
displayName: 'New Payment',
|
|
15
|
-
description: 'Triggers when a new payment is made',
|
|
16
|
-
props: {},
|
|
17
|
-
type: pieces_framework_2.TriggerStrategy.WEBHOOK,
|
|
18
|
-
sampleData: {
|
|
19
|
-
id: 'ch_3MWM7aKZ0dZRqLEK1soCKVrq',
|
|
20
|
-
object: 'charge',
|
|
21
|
-
amount: 10000,
|
|
22
|
-
amount_captured: 10000,
|
|
23
|
-
amount_refunded: 0,
|
|
24
|
-
application: null,
|
|
25
|
-
application_fee: null,
|
|
26
|
-
application_fee_amount: null,
|
|
27
|
-
balance_transaction: 'txn_3MWM7aKZ0dZRqLEK1VyE8QH1',
|
|
28
|
-
billing_details: {
|
|
29
|
-
address: {
|
|
30
|
-
city: null,
|
|
31
|
-
country: 'DE',
|
|
32
|
-
line1: null,
|
|
33
|
-
line2: null,
|
|
34
|
-
postal_code: null,
|
|
35
|
-
state: null,
|
|
36
|
-
},
|
|
37
|
-
email: 'test@gmail.com',
|
|
38
|
-
name: 'Test user',
|
|
39
|
-
phone: null,
|
|
40
|
-
},
|
|
41
|
-
calculated_statement_descriptor: 'WWW.ACTIVEPIECES.COM',
|
|
42
|
-
captured: true,
|
|
43
|
-
created: 1675180355,
|
|
44
|
-
currency: 'usd',
|
|
45
|
-
customer: 'cus_NGtvUQ18FJXcGI',
|
|
46
|
-
description: 'Subscription creation',
|
|
47
|
-
destination: null,
|
|
48
|
-
dispute: null,
|
|
49
|
-
disputed: false,
|
|
50
|
-
failure_balance_transaction: null,
|
|
51
|
-
failure_code: null,
|
|
52
|
-
failure_message: null,
|
|
53
|
-
fraud_details: {},
|
|
54
|
-
invoice: 'in_1MWM7ZKZ0dZRqLEKQbrgSBnh',
|
|
55
|
-
livemode: false,
|
|
56
|
-
metadata: {},
|
|
57
|
-
on_behalf_of: null,
|
|
58
|
-
order: null,
|
|
59
|
-
outcome: {
|
|
60
|
-
network_status: 'approved_by_network',
|
|
61
|
-
reason: null,
|
|
62
|
-
risk_level: 'normal',
|
|
63
|
-
risk_score: 64,
|
|
64
|
-
seller_message: 'Payment complete.',
|
|
65
|
-
type: 'authorized',
|
|
66
|
-
},
|
|
67
|
-
paid: true,
|
|
68
|
-
payment_intent: 'pi_3MWM7aKZ0dZRqLEK1BsblcVI',
|
|
69
|
-
payment_method: 'pm_1MWM8MKZ0dZRqLEKnIH41f76',
|
|
70
|
-
payment_method_details: {
|
|
71
|
-
card: {
|
|
72
|
-
brand: 'visa',
|
|
73
|
-
checks: {
|
|
74
|
-
address_line1_check: null,
|
|
75
|
-
address_postal_code_check: null,
|
|
76
|
-
cvc_check: 'pass',
|
|
77
|
-
},
|
|
78
|
-
country: 'US',
|
|
79
|
-
exp_month: 12,
|
|
80
|
-
exp_year: 2034,
|
|
81
|
-
fingerprint: 't8SMsmS4h2vvODpN',
|
|
82
|
-
funding: 'credit',
|
|
83
|
-
installments: null,
|
|
84
|
-
last4: '4242',
|
|
85
|
-
mandate: null,
|
|
86
|
-
network: 'visa',
|
|
87
|
-
three_d_secure: null,
|
|
88
|
-
wallet: null,
|
|
89
|
-
},
|
|
90
|
-
type: 'card',
|
|
91
|
-
},
|
|
92
|
-
receipt_email: null,
|
|
93
|
-
receipt_number: null,
|
|
94
|
-
receipt_url: 'https://pay.stripe.com/receipts/invoices/CAcaFwoVYWNjdF8xS214ZEtLWjBkWlJxTEVLKMXy5J4GMgZcuppYWF06LBZEoiAhZ6H7EoJ3bN-BMHCXdaW-_i-ywhSIG9wPGTmtE0CdpD75s1hIyprK?s=ap',
|
|
95
|
-
refunded: false,
|
|
96
|
-
refunds: {
|
|
97
|
-
object: 'list',
|
|
98
|
-
data: [],
|
|
99
|
-
has_more: false,
|
|
100
|
-
total_count: 0,
|
|
101
|
-
url: '/v1/charges/ch_3MWM7aKZ0dZRqLEK1soCKVrq/refunds',
|
|
102
|
-
},
|
|
103
|
-
review: null,
|
|
104
|
-
shipping: null,
|
|
105
|
-
source: null,
|
|
106
|
-
source_transfer: null,
|
|
107
|
-
statement_descriptor: null,
|
|
108
|
-
statement_descriptor_suffix: null,
|
|
109
|
-
status: 'succeeded',
|
|
110
|
-
transfer_data: null,
|
|
111
|
-
transfer_group: null,
|
|
112
|
-
},
|
|
113
|
-
onEnable(context) {
|
|
114
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
115
|
-
var _a;
|
|
116
|
-
const webhook = yield common_1.stripeCommon.subscribeWebhook('payment_intent.succeeded', context.webhookUrl, context.auth.secret_text);
|
|
117
|
-
yield ((_a = context.store) === null || _a === void 0 ? void 0 : _a.put('_new_payment_trigger', {
|
|
118
|
-
webhookId: webhook.id,
|
|
119
|
-
}));
|
|
120
|
-
});
|
|
121
|
-
},
|
|
122
|
-
onDisable(context) {
|
|
123
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
124
|
-
var _a;
|
|
125
|
-
const response = yield ((_a = context.store) === null || _a === void 0 ? void 0 : _a.get('_new_payment_trigger'));
|
|
126
|
-
if (response !== null && response !== undefined) {
|
|
127
|
-
yield common_1.stripeCommon.unsubscribeWebhook(response.webhookId, context.auth.secret_text);
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
},
|
|
131
|
-
test(context) {
|
|
132
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
133
|
-
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
134
|
-
method: pieces_common_1.HttpMethod.GET,
|
|
135
|
-
url: 'https://api.stripe.com/v1/payment_intents/search',
|
|
136
|
-
headers: {
|
|
137
|
-
Authorization: 'Bearer ' + context.auth.secret_text,
|
|
138
|
-
'Content-Type': 'application/x-www-form-urlencoded',
|
|
139
|
-
'Stripe-Version': "2026-02-25.clover",
|
|
140
|
-
},
|
|
141
|
-
queryParams: {
|
|
142
|
-
query: 'status:"succeeded"',
|
|
143
|
-
limit: '5',
|
|
144
|
-
},
|
|
145
|
-
});
|
|
146
|
-
if ((0, shared_1.isEmpty)(response.body) || (0, shared_1.isEmpty)(response.body.data))
|
|
147
|
-
return [];
|
|
148
|
-
return response.body.data;
|
|
149
|
-
});
|
|
150
|
-
},
|
|
151
|
-
run(context) {
|
|
152
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
153
|
-
const payloadBody = context.payload.body;
|
|
154
|
-
return [payloadBody.data.object];
|
|
155
|
-
});
|
|
156
|
-
},
|
|
157
|
-
});
|
|
158
|
-
//# sourceMappingURL=new-payment.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"new-payment.js","sourceRoot":"","sources":["../../../../src/lib/trigger/new-payment.ts"],"names":[],"mappings":";;;;AAAA,qEAA+D;AAC/D,qEAAiE;AACjE,sCAAyC;AACzC,6BAAmC;AACnC,+DAAqE;AACrE,iDAA+C;AAElC,QAAA,gBAAgB,GAAG,IAAA,gCAAa,EAAC;IAC5C,IAAI,EAAE,cAAU;IAChB,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,aAAa;IAC1B,WAAW,EAAE,qCAAqC;IAClD,KAAK,EAAE,EAAE;IACT,IAAI,EAAE,kCAAe,CAAC,OAAO;IAC7B,UAAU,EAAE;QACV,EAAE,EAAE,6BAA6B;QACjC,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE,KAAK;QACb,eAAe,EAAE,KAAK;QACtB,eAAe,EAAE,CAAC;QAClB,WAAW,EAAE,IAAI;QACjB,eAAe,EAAE,IAAI;QACrB,sBAAsB,EAAE,IAAI;QAC5B,mBAAmB,EAAE,8BAA8B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nC,QAAQ,CAAC,SAAS,EAClB,OAAO,CAAC,IAAI,CAAC,WAAW,CACzB,CAAC;YACJ,CAAC;QACH,CAAC;KAAA;IACK,IAAI,CAAC,OAAO;;YAChB,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAA6B;gBACxE,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,GAAG,EAAE,kDAAkD;gBACvD,OAAO,EAAE;oBACP,aAAa,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,WAAW;oBACnD,cAAc,EAAE,mCAAmC;oBAClD,gBAAgB,EAAE,mBAAmB;iBACvC;gBACD,WAAW,EAAE;oBACX,KAAK,EAAE,oBAAoB;oBAC3B,KAAK,EAAE,GAAG;iBACX;aACF,CAAC,CAAC;YAEH,IAAI,IAAA,gBAAO,EAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,IAAA,gBAAO,EAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC;gBAAE,OAAO,EAAE,CAAC;YAErE,OAAO,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC;QAC5B,CAAC;KAAA;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,IAAmB,CAAC;YACxD,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACnC,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { TriggerStrategy } from '@activepieces/pieces-framework';
|
|
2
|
-
export declare const stripeNewRefund: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
3
|
-
charge: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
4
|
-
payment_intent: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
5
|
-
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
6
|
-
charge: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
7
|
-
payment_intent: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
8
|
-
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
9
|
-
charge: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
10
|
-
payment_intent: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
11
|
-
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
12
|
-
charge: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
13
|
-
payment_intent: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
14
|
-
}>;
|
|
15
|
-
//# sourceMappingURL=new-refund.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"new-refund.d.ts","sourceRoot":"","sources":["../../../../src/lib/trigger/new-refund.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,eAAe,EAEhB,MAAM,gCAAgC,CAAC;AAexC,eAAO,MAAM,eAAe;;;;;;;;;;;;EAwF1B,CAAC"}
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.stripeNewRefund = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
-
const common_1 = require("../common");
|
|
7
|
-
const __1 = require("../..");
|
|
8
|
-
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
9
|
-
const shared_1 = require("@activepieces/shared");
|
|
10
|
-
exports.stripeNewRefund = (0, pieces_framework_1.createTrigger)({
|
|
11
|
-
auth: __1.stripeAuth,
|
|
12
|
-
name: 'new_refund',
|
|
13
|
-
displayName: 'New Refund',
|
|
14
|
-
description: 'Fires when a charge is refunded (full or partial).',
|
|
15
|
-
props: {
|
|
16
|
-
charge: pieces_framework_1.Property.ShortText({
|
|
17
|
-
displayName: 'Charge ID',
|
|
18
|
-
description: 'Only trigger for refunds related to this Charge ID (e.g., `ch_...`).',
|
|
19
|
-
required: false,
|
|
20
|
-
}),
|
|
21
|
-
payment_intent: pieces_framework_1.Property.ShortText({
|
|
22
|
-
displayName: 'Payment Intent ID',
|
|
23
|
-
description: 'Only trigger for refunds related to this Payment Intent ID (e.g., `pi_...`).',
|
|
24
|
-
required: false,
|
|
25
|
-
}),
|
|
26
|
-
},
|
|
27
|
-
sampleData: {
|
|
28
|
-
id: 're_1Nispe2eZvKYlo2Cd31jOCgZ',
|
|
29
|
-
object: 'refund',
|
|
30
|
-
amount: 1000,
|
|
31
|
-
balance_transaction: 'txn_1Nispe2eZvKYlo2CYezqFhEx',
|
|
32
|
-
charge: 'ch_1NirD82eZvKYlo2CIvbtLWuY',
|
|
33
|
-
created: 1692942318,
|
|
34
|
-
currency: 'usd',
|
|
35
|
-
metadata: {},
|
|
36
|
-
payment_intent: 'pi_1GszsK2eZvKYlo2CfhZyoZLp',
|
|
37
|
-
reason: 'requested_by_customer',
|
|
38
|
-
receipt_number: null,
|
|
39
|
-
status: 'succeeded',
|
|
40
|
-
},
|
|
41
|
-
type: pieces_framework_1.TriggerStrategy.WEBHOOK,
|
|
42
|
-
onEnable(context) {
|
|
43
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
44
|
-
const webhook = yield common_1.stripeCommon.subscribeWebhook('refund.created', context.webhookUrl, context.auth.secret_text);
|
|
45
|
-
yield context.store.put('_new_refund_trigger', {
|
|
46
|
-
webhookId: webhook.id,
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
},
|
|
50
|
-
onDisable(context) {
|
|
51
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
52
|
-
const webhookInfo = yield context.store.get('_new_refund_trigger');
|
|
53
|
-
if (webhookInfo !== null && webhookInfo !== undefined) {
|
|
54
|
-
yield common_1.stripeCommon.unsubscribeWebhook(webhookInfo.webhookId, context.auth.secret_text);
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
},
|
|
58
|
-
test(context) {
|
|
59
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
60
|
-
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
61
|
-
method: pieces_common_1.HttpMethod.GET,
|
|
62
|
-
url: 'https://api.stripe.com/v1/refunds',
|
|
63
|
-
headers: {
|
|
64
|
-
Authorization: 'Bearer ' + context.auth.secret_text,
|
|
65
|
-
'Content-Type': 'application/x-www-form-urlencoded',
|
|
66
|
-
},
|
|
67
|
-
queryParams: {
|
|
68
|
-
limit: '5',
|
|
69
|
-
},
|
|
70
|
-
});
|
|
71
|
-
if ((0, shared_1.isEmpty)(response.body) || (0, shared_1.isEmpty)(response.body.data))
|
|
72
|
-
return [];
|
|
73
|
-
return response.body.data;
|
|
74
|
-
});
|
|
75
|
-
},
|
|
76
|
-
run(context) {
|
|
77
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
78
|
-
const payloadBody = context.payload.body;
|
|
79
|
-
const refundObject = payloadBody.data.object;
|
|
80
|
-
const { charge, payment_intent } = context.propsValue;
|
|
81
|
-
if (charge && refundObject['charge'] !== charge) {
|
|
82
|
-
return [];
|
|
83
|
-
}
|
|
84
|
-
if (payment_intent && refundObject['payment_intent'] !== payment_intent) {
|
|
85
|
-
return [];
|
|
86
|
-
}
|
|
87
|
-
return [refundObject];
|
|
88
|
-
});
|
|
89
|
-
},
|
|
90
|
-
});
|
|
91
|
-
//# sourceMappingURL=new-refund.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"new-refund.js","sourceRoot":"","sources":["../../../../src/lib/trigger/new-refund.ts"],"names":[],"mappings":";;;;AAAA,qEAIwC;AACxC,sCAAyC;AA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C;QACxB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { TriggerStrategy } from '@activepieces/pieces-framework';
|
|
2
|
-
export declare const stripeNewSubscription: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").SecretTextProperty<true>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@activepieces/pieces-framework").SecretTextProperty<true>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {}>;
|
|
3
|
-
//# sourceMappingURL=new-subscription.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"new-subscription.d.ts","sourceRoot":"","sources":["../../../../src/lib/trigger/new-subscription.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAMjE,eAAO,MAAM,qBAAqB,klBAyLhC,CAAC"}
|