@activepieces/piece-stripe 0.6.9 → 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 -42
- 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 -91
- 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 -59
- 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 -113
- 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 -97
- 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 -97
- 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 -89
- 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 -77
- 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 -110
- 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 -31
- 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 -37
- 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 -42
- 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 -37
- 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 -37
- 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 -37
- 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 -47
- 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 -199
- 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 -100
- 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 -116
- 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 -94
- 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 -104
- 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 -99
- 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 -94
- 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 -102
- 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 -117
- 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 -79
- 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 -161
- 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 -94
- 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 -200
- 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 -207
- 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 -130
- package/src/lib/trigger/updated-subscription.js.map +0 -1
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.stripeRetrievePayout = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
-
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
-
const __1 = require("../..");
|
|
8
|
-
const common_1 = require("../common");
|
|
9
|
-
exports.stripeRetrievePayout = (0, pieces_framework_1.createAction)({
|
|
10
|
-
name: 'retrieve_payout',
|
|
11
|
-
auth: __1.stripeAuth,
|
|
12
|
-
displayName: 'Retrieve a Payout',
|
|
13
|
-
description: 'Retrieves the details of an existing payout by its ID.',
|
|
14
|
-
audience: 'both',
|
|
15
|
-
aiMetadata: {
|
|
16
|
-
description: 'Fetches the full details of a single Stripe payout (funds sent to your bank account) by its payout ID (e.g., po_...). Use to check a payout\'s status, amount, or arrival date. Read-only and idempotent.',
|
|
17
|
-
idempotent: true,
|
|
18
|
-
},
|
|
19
|
-
props: {
|
|
20
|
-
payout_id: common_1.stripeCommon.payout,
|
|
21
|
-
},
|
|
22
|
-
run(context) {
|
|
23
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
24
|
-
const { payout_id } = context.propsValue;
|
|
25
|
-
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
26
|
-
method: pieces_common_1.HttpMethod.GET,
|
|
27
|
-
url: `${common_1.stripeCommon.baseUrl}/payouts/${payout_id}`,
|
|
28
|
-
authentication: {
|
|
29
|
-
type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
|
|
30
|
-
token: context.auth.secret_text,
|
|
31
|
-
},
|
|
32
|
-
});
|
|
33
|
-
return response.body;
|
|
34
|
-
});
|
|
35
|
-
},
|
|
36
|
-
});
|
|
37
|
-
//# sourceMappingURL=retrieve-payout.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"retrieve-payout.js","sourceRoot":"","sources":["../../../../src/lib/actions/retrieve-payout.ts"],"names":[],"mappings":";;;;AAAA,qEAA8D;AAC9D,+DAIqC;AACrC,6BAAmC;AACnC,sCAAyC;AAE5B,QAAA,oBAAoB,GAAG,IAAA,+BAAY,EAAC;IAC/C,IAAI,EAAE,iBAAiB;IACvB,IAAI,EAAE,cAAU;IAChB,WAAW,EAAE,mBAAmB;IAChC,WAAW,EAAE,wDAAwD;IACrE,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE;QACV,WAAW,EACT,2MAA2M;QAC7M,UAAU,EAAE,IAAI;KACjB;IACD,KAAK,EAAE;QACL,SAAS,EAAE,qBAAY,CAAC,MAAM;KAC/B;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAEzC,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC5C,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,GAAG,EAAE,GAAG,qBAAY,CAAC,OAAO,YAAY,SAAS,EAAE;gBACnD,cAAc,EAAE;oBACd,IAAI,EAAE,kCAAkB,CAAC,YAAY;oBACrC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,WAAW;iBAChC;aACF,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export declare const stripeSearchCustomer: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
-
email: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
-
}>;
|
|
4
|
-
//# sourceMappingURL=search-customer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"search-customer.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/search-customer.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,oBAAoB;;EAoC/B,CAAC"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.stripeSearchCustomer = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
-
const __1 = require("../..");
|
|
7
|
-
const common_1 = require("../common");
|
|
8
|
-
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
9
|
-
exports.stripeSearchCustomer = (0, pieces_framework_1.createAction)({
|
|
10
|
-
name: 'search_customer',
|
|
11
|
-
auth: __1.stripeAuth,
|
|
12
|
-
displayName: 'Search Customer',
|
|
13
|
-
description: 'Search for a customer in stripe by email',
|
|
14
|
-
audience: 'both',
|
|
15
|
-
aiMetadata: {
|
|
16
|
-
description: 'Looks up Stripe customers matching a given email address. Use to find an existing customer record before creating, updating, or charging one, to avoid duplicates. Read-only and idempotent; matches on the exact email.',
|
|
17
|
-
idempotent: true,
|
|
18
|
-
},
|
|
19
|
-
props: {
|
|
20
|
-
email: pieces_framework_1.Property.ShortText({
|
|
21
|
-
displayName: 'Email',
|
|
22
|
-
description: undefined,
|
|
23
|
-
required: true,
|
|
24
|
-
}),
|
|
25
|
-
},
|
|
26
|
-
run(context) {
|
|
27
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
28
|
-
const customer = {
|
|
29
|
-
email: context.propsValue.email,
|
|
30
|
-
};
|
|
31
|
-
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
32
|
-
method: pieces_common_1.HttpMethod.GET,
|
|
33
|
-
url: `${common_1.stripeCommon.baseUrl}/customers/search`,
|
|
34
|
-
headers: {
|
|
35
|
-
Authorization: 'Bearer ' + context.auth.secret_text,
|
|
36
|
-
'Content-Type': 'application/x-www-form-urlencoded',
|
|
37
|
-
'Stripe-Version': '2026-02-25.clover',
|
|
38
|
-
},
|
|
39
|
-
body: {
|
|
40
|
-
query: `email:'${customer.email}'`,
|
|
41
|
-
},
|
|
42
|
-
});
|
|
43
|
-
return response.body;
|
|
44
|
-
});
|
|
45
|
-
},
|
|
46
|
-
});
|
|
47
|
-
//# sourceMappingURL=search-customer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"search-customer.js","sourceRoot":"","sources":["../../../../src/lib/actions/search-customer.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,6BAAmC;AACnC,sCAAyC;AACzC,+DAAqE;AAExD,QAAA,oBAAoB,GAAG,IAAA,+BAAY,EAAC;IAC/C,IAAI,EAAE,iBAAiB;IACvB,IAAI,EAAE,cAAU;IAChB,WAAW,EAAE,iBAAiB;IAC9B,WAAW,EAAE,0CAA0C;IACvD,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE;QACV,WAAW,EACT,0NAA0N;QAC5N,UAAU,EAAE,IAAI;KACjB;IACD,KAAK,EAAE;QACL,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACxB,WAAW,EAAE,OAAO;YACpB,WAAW,EAAE,SAAS;YACtB,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,QAAQ,GAAG;gBACf,KAAK,EAAE,OAAO,CAAC,UAAU,CAAC,KAAK;aAChC,CAAC;YACF,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC5C,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,GAAG,EAAE,GAAG,qBAAY,CAAC,OAAO,mBAAmB;gBAC/C,OAAO,EAAE;oBACP,aAAa,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,WAAW;oBACnD,cAAc,EAAE,mCAAmC;oBACnD,gBAAgB,EAAE,mBAAmB;iBACtC;gBACD,IAAI,EAAE;oBACJ,KAAK,EAAE,UAAU,QAAQ,CAAC,KAAK,GAAG;iBACnC;aACF,CAAC,CAAC;YACH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export declare const stripeSearchSubscriptions: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
-
price_ids: import("@activepieces/pieces-framework").LongTextProperty<false>;
|
|
3
|
-
status: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
|
|
4
|
-
customer_id: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
5
|
-
created_after: import("@activepieces/pieces-framework").DateTimeProperty<false>;
|
|
6
|
-
created_before: import("@activepieces/pieces-framework").DateTimeProperty<false>;
|
|
7
|
-
limit: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
8
|
-
fetch_all: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
9
|
-
include_customer_details: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
10
|
-
}>;
|
|
11
|
-
//# sourceMappingURL=search-subscriptions.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"search-subscriptions.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/search-subscriptions.ts"],"names":[],"mappings":"AAsBA,eAAO,MAAM,yBAAyB;;;;;;;;;EAqNpC,CAAC"}
|
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.stripeSearchSubscriptions = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
-
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
-
const __1 = require("../..");
|
|
8
|
-
const common_1 = require("../common");
|
|
9
|
-
const statusOptions = [
|
|
10
|
-
{ label: 'All Statuses', value: '' },
|
|
11
|
-
{ label: 'Active', value: 'active' },
|
|
12
|
-
{ label: 'Past Due', value: 'past_due' },
|
|
13
|
-
{ label: 'Unpaid', value: 'unpaid' },
|
|
14
|
-
{ label: 'Canceled', value: 'canceled' },
|
|
15
|
-
{ label: 'Incomplete', value: 'incomplete' },
|
|
16
|
-
{ label: 'Incomplete Expired', value: 'incomplete_expired' },
|
|
17
|
-
{ label: 'Trialing', value: 'trialing' },
|
|
18
|
-
{ label: 'Paused', value: 'paused' },
|
|
19
|
-
];
|
|
20
|
-
exports.stripeSearchSubscriptions = (0, pieces_framework_1.createAction)({
|
|
21
|
-
name: 'search_subscriptions',
|
|
22
|
-
auth: __1.stripeAuth,
|
|
23
|
-
displayName: 'Search Subscriptions',
|
|
24
|
-
description: 'Search for subscriptions by price ID, status, customer ID and other filters, including customer details',
|
|
25
|
-
audience: 'both',
|
|
26
|
-
aiMetadata: {
|
|
27
|
-
description: 'Lists and filters Stripe subscriptions by price ID, status, customer ID, and creation date range, optionally expanding full customer details for each. Use to find subscriptions matching criteria or to audit a customer\'s subscriptions; supports paging through all results. Read-only and idempotent.',
|
|
28
|
-
idempotent: true,
|
|
29
|
-
},
|
|
30
|
-
props: {
|
|
31
|
-
price_ids: pieces_framework_1.Property.LongText({
|
|
32
|
-
displayName: 'Price IDs',
|
|
33
|
-
description: 'Comma-separated list of price IDs to filter by (e.g., price_1ABC123, price_2DEF456)',
|
|
34
|
-
required: false,
|
|
35
|
-
}),
|
|
36
|
-
status: pieces_framework_1.Property.StaticDropdown({
|
|
37
|
-
displayName: 'Subscription Status',
|
|
38
|
-
description: 'Filter by subscription status',
|
|
39
|
-
required: false,
|
|
40
|
-
options: {
|
|
41
|
-
options: statusOptions
|
|
42
|
-
},
|
|
43
|
-
}),
|
|
44
|
-
customer_id: pieces_framework_1.Property.ShortText({
|
|
45
|
-
displayName: 'Customer ID',
|
|
46
|
-
description: 'Filter by specific customer ID (optional)',
|
|
47
|
-
required: false,
|
|
48
|
-
}),
|
|
49
|
-
created_after: pieces_framework_1.Property.DateTime({
|
|
50
|
-
displayName: 'Created After',
|
|
51
|
-
description: 'Filter subscriptions created after this date (YYYY-MM-DD format)',
|
|
52
|
-
required: false,
|
|
53
|
-
}),
|
|
54
|
-
created_before: pieces_framework_1.Property.DateTime({
|
|
55
|
-
displayName: 'Created Before',
|
|
56
|
-
description: 'Filter subscriptions created before this date (YYYY-MM-DD format)',
|
|
57
|
-
required: false,
|
|
58
|
-
}),
|
|
59
|
-
limit: pieces_framework_1.Property.Number({
|
|
60
|
-
displayName: 'Limit',
|
|
61
|
-
description: 'Maximum number of subscriptions to return (default: 100, set to 0 for all)',
|
|
62
|
-
required: false,
|
|
63
|
-
defaultValue: 100,
|
|
64
|
-
}),
|
|
65
|
-
fetch_all: pieces_framework_1.Property.Checkbox({
|
|
66
|
-
displayName: 'Fetch All Results',
|
|
67
|
-
description: 'Fetch all matching subscriptions (ignores limit, may take longer for large datasets)',
|
|
68
|
-
required: false,
|
|
69
|
-
defaultValue: false,
|
|
70
|
-
}),
|
|
71
|
-
include_customer_details: pieces_framework_1.Property.Checkbox({
|
|
72
|
-
displayName: 'Include Customer Details',
|
|
73
|
-
description: 'Fetch detailed customer information for each subscription',
|
|
74
|
-
required: false,
|
|
75
|
-
defaultValue: true,
|
|
76
|
-
}),
|
|
77
|
-
},
|
|
78
|
-
run(context) {
|
|
79
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
80
|
-
const { price_ids, status, customer_id, created_after, created_before, limit = 100, fetch_all = false, include_customer_details = true, } = context.propsValue;
|
|
81
|
-
const buildQueryParams = (startingAfter) => {
|
|
82
|
-
const queryParams = new URLSearchParams();
|
|
83
|
-
queryParams.append('limit', '100');
|
|
84
|
-
queryParams.append('expand[]', 'data.items.data.price');
|
|
85
|
-
if (include_customer_details) {
|
|
86
|
-
queryParams.append('expand[]', 'data.customer');
|
|
87
|
-
}
|
|
88
|
-
if (status) {
|
|
89
|
-
queryParams.append('status', status);
|
|
90
|
-
}
|
|
91
|
-
if (customer_id) {
|
|
92
|
-
queryParams.append('customer', customer_id);
|
|
93
|
-
}
|
|
94
|
-
if (created_after) {
|
|
95
|
-
const afterTimestamp = Math.floor(new Date(created_after).getTime() / 1000);
|
|
96
|
-
queryParams.append('created[gte]', afterTimestamp.toString());
|
|
97
|
-
}
|
|
98
|
-
if (created_before) {
|
|
99
|
-
const beforeTimestamp = Math.floor(new Date(created_before).getTime() / 1000);
|
|
100
|
-
queryParams.append('created[lte]', beforeTimestamp.toString());
|
|
101
|
-
}
|
|
102
|
-
if (startingAfter) {
|
|
103
|
-
queryParams.append('starting_after', startingAfter);
|
|
104
|
-
}
|
|
105
|
-
return queryParams;
|
|
106
|
-
};
|
|
107
|
-
let allSubscriptions = [];
|
|
108
|
-
let hasMore = true;
|
|
109
|
-
let startingAfter;
|
|
110
|
-
let requestCount = 0;
|
|
111
|
-
const maxRequests = fetch_all ? 50 : Math.ceil(limit / 100);
|
|
112
|
-
while (hasMore && requestCount < maxRequests) {
|
|
113
|
-
const queryParams = buildQueryParams(startingAfter);
|
|
114
|
-
const subscriptionsResponse = yield pieces_common_1.httpClient.sendRequest({
|
|
115
|
-
method: pieces_common_1.HttpMethod.GET,
|
|
116
|
-
url: `${common_1.stripeCommon.baseUrl}/subscriptions?${queryParams.toString()}`,
|
|
117
|
-
headers: {
|
|
118
|
-
Authorization: 'Bearer ' + context.auth.secret_text,
|
|
119
|
-
'Content-Type': 'application/x-www-form-urlencoded',
|
|
120
|
-
},
|
|
121
|
-
});
|
|
122
|
-
if (!subscriptionsResponse.body) {
|
|
123
|
-
throw new Error('Failed to fetch subscriptions from Stripe');
|
|
124
|
-
}
|
|
125
|
-
const subscriptions = subscriptionsResponse.body.data;
|
|
126
|
-
allSubscriptions = allSubscriptions.concat(subscriptions);
|
|
127
|
-
hasMore = subscriptionsResponse.body.has_more;
|
|
128
|
-
requestCount++;
|
|
129
|
-
if (hasMore && subscriptions.length > 0) {
|
|
130
|
-
startingAfter = subscriptions[subscriptions.length - 1].id;
|
|
131
|
-
}
|
|
132
|
-
if (!fetch_all && allSubscriptions.length >= limit) {
|
|
133
|
-
allSubscriptions = allSubscriptions.slice(0, limit);
|
|
134
|
-
break;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
let filteredSubscriptions = allSubscriptions;
|
|
138
|
-
if (price_ids && price_ids.trim()) {
|
|
139
|
-
const priceIdArray = price_ids
|
|
140
|
-
.split(',')
|
|
141
|
-
.map(id => id.trim())
|
|
142
|
-
.filter(id => id.length > 0);
|
|
143
|
-
if (priceIdArray.length > 0) {
|
|
144
|
-
filteredSubscriptions = filteredSubscriptions.filter((subscription) => {
|
|
145
|
-
return subscription.items.data.some((item) => item.price && typeof item.price === 'object' && priceIdArray.includes(item.price.id));
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
const finalSubscriptions = yield Promise.all(filteredSubscriptions.map((subscription) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
150
|
-
const resultSubscription = Object.assign({}, subscription);
|
|
151
|
-
if (include_customer_details) {
|
|
152
|
-
if (typeof subscription.customer === 'object' && subscription.customer !== null && !('deleted' in subscription.customer && subscription.customer.deleted)) {
|
|
153
|
-
resultSubscription.customer = subscription.customer;
|
|
154
|
-
}
|
|
155
|
-
else if (typeof subscription.customer === 'string') {
|
|
156
|
-
try {
|
|
157
|
-
const customerResponse = yield pieces_common_1.httpClient.sendRequest({
|
|
158
|
-
method: pieces_common_1.HttpMethod.GET,
|
|
159
|
-
url: `${common_1.stripeCommon.baseUrl}/customers/${subscription.customer}`,
|
|
160
|
-
headers: {
|
|
161
|
-
Authorization: 'Bearer ' + context.auth.secret_text,
|
|
162
|
-
},
|
|
163
|
-
});
|
|
164
|
-
resultSubscription.customer = customerResponse.body;
|
|
165
|
-
}
|
|
166
|
-
catch (error) {
|
|
167
|
-
console.warn(`Failed to fetch customer details for ${subscription.customer}:`, error);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
return resultSubscription;
|
|
172
|
-
})));
|
|
173
|
-
return {
|
|
174
|
-
success: true,
|
|
175
|
-
count: finalSubscriptions.length,
|
|
176
|
-
total_fetched: allSubscriptions.length,
|
|
177
|
-
requests_made: requestCount,
|
|
178
|
-
has_more_available: hasMore && !fetch_all,
|
|
179
|
-
pagination_info: {
|
|
180
|
-
limit_requested: fetch_all ? 'All' : limit,
|
|
181
|
-
fetch_all_enabled: fetch_all,
|
|
182
|
-
max_requests_limit: maxRequests,
|
|
183
|
-
},
|
|
184
|
-
subscriptions: finalSubscriptions,
|
|
185
|
-
filters_applied: {
|
|
186
|
-
price_ids: price_ids ? price_ids.split(',').map(id => id.trim()).filter(id => id.length > 0) : null,
|
|
187
|
-
status: status || null,
|
|
188
|
-
customer_id: customer_id || null,
|
|
189
|
-
created_after: created_after || null,
|
|
190
|
-
created_before: created_before || null,
|
|
191
|
-
limit: limit,
|
|
192
|
-
fetch_all: fetch_all,
|
|
193
|
-
include_customer_details: include_customer_details,
|
|
194
|
-
},
|
|
195
|
-
};
|
|
196
|
-
});
|
|
197
|
-
},
|
|
198
|
-
});
|
|
199
|
-
//# sourceMappingURL=search-subscriptions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"search-subscriptions.js","sourceRoot":"","sources":["../../../../src/lib/actions/search-subscriptions.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAqE;AAGrE,6BAAmC;AACnC,sCAAyC;AAKzC,MAAM,aAAa,GAAG;IACpB,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,EAAE,EAAE;IACpC,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;IACpC,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE;IACxC,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;IACpC,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE;IACxC,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE;IAC5C,EAAE,KAAK,EAAE,oBAAoB,EAAE,KAAK,EAAE,oBAAoB,EAAE;IAC5D,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE;IACxC,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;CACrC,CAAA;AAEY,QAAA,yBAAyB,GAAG,IAAA,+BAAY,EAAC;IACpD,IAAI,EAAE,sBAAsB;IAC5B,IAAI,EAAE,cAAU;IAChB,WAAW,EAAE,sBAAsB;IACnC,WAAW,EAAE,yGAA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EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK;oBAC1C,iBAAiB,EAAE,SAAS;oBAC5B,kBAAkB,EAAE,WAAW;iBAChC;gBACD,aAAa,EAAE,kBAAkB;gBACjC,eAAe,EAAE;oBACf,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI;oBACnG,MAAM,EAAE,MAAM,IAAI,IAAI;oBACtB,WAAW,EAAE,WAAW,IAAI,IAAI;oBAChC,aAAa,EAAE,aAAa,IAAI,IAAI;oBACpC,cAAc,EAAE,cAAc,IAAI,IAAI;oBACtC,KAAK,EAAE,KAAK;oBACZ,SAAS,EAAE,SAAS;oBACpB,wBAAwB,EAAE,wBAAwB;iBACnD;aACF,CAAC;QACJ,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export declare const stripeUpdateCustomer: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
-
customer: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
|
3
|
-
email: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
4
|
-
name: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
5
|
-
description: import("@activepieces/pieces-framework").LongTextProperty<false>;
|
|
6
|
-
phone: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
7
|
-
line1: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
8
|
-
postal_code: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
9
|
-
city: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
10
|
-
state: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
11
|
-
country: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
12
|
-
}>;
|
|
13
|
-
//# sourceMappingURL=update-customer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"update-customer.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/update-customer.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,oBAAoB;;;;;;;;;;;EAwF/B,CAAC"}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.stripeUpdateCustomer = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
-
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
-
const __1 = require("../..");
|
|
8
|
-
const common_1 = require("../common");
|
|
9
|
-
exports.stripeUpdateCustomer = (0, pieces_framework_1.createAction)({
|
|
10
|
-
name: 'update_customer',
|
|
11
|
-
auth: __1.stripeAuth,
|
|
12
|
-
displayName: 'Update Customer',
|
|
13
|
-
description: 'Modify an existing customer’s details.',
|
|
14
|
-
audience: 'both',
|
|
15
|
-
aiMetadata: {
|
|
16
|
-
description: 'Updates fields on an existing Stripe customer (email, name, description, phone, address); only the fields you provide are changed. Use to correct or enrich a customer record identified by its customer ID. Idempotent in effect: repeating the same update yields the same final state.',
|
|
17
|
-
idempotent: true,
|
|
18
|
-
},
|
|
19
|
-
props: {
|
|
20
|
-
customer: common_1.stripeCommon.customer,
|
|
21
|
-
email: pieces_framework_1.Property.ShortText({
|
|
22
|
-
displayName: 'Email',
|
|
23
|
-
required: false,
|
|
24
|
-
}),
|
|
25
|
-
name: pieces_framework_1.Property.ShortText({
|
|
26
|
-
displayName: 'Name',
|
|
27
|
-
required: false,
|
|
28
|
-
}),
|
|
29
|
-
description: pieces_framework_1.Property.LongText({
|
|
30
|
-
displayName: 'Description',
|
|
31
|
-
required: false,
|
|
32
|
-
}),
|
|
33
|
-
phone: pieces_framework_1.Property.ShortText({
|
|
34
|
-
displayName: 'Phone',
|
|
35
|
-
required: false,
|
|
36
|
-
}),
|
|
37
|
-
line1: pieces_framework_1.Property.ShortText({
|
|
38
|
-
displayName: 'Address Line 1',
|
|
39
|
-
required: false,
|
|
40
|
-
}),
|
|
41
|
-
postal_code: pieces_framework_1.Property.ShortText({
|
|
42
|
-
displayName: 'Postal Code',
|
|
43
|
-
required: false,
|
|
44
|
-
}),
|
|
45
|
-
city: pieces_framework_1.Property.ShortText({
|
|
46
|
-
displayName: 'City',
|
|
47
|
-
required: false,
|
|
48
|
-
}),
|
|
49
|
-
state: pieces_framework_1.Property.ShortText({
|
|
50
|
-
displayName: 'State',
|
|
51
|
-
required: false,
|
|
52
|
-
}),
|
|
53
|
-
country: pieces_framework_1.Property.ShortText({
|
|
54
|
-
displayName: 'Country',
|
|
55
|
-
required: false,
|
|
56
|
-
}),
|
|
57
|
-
},
|
|
58
|
-
run(context) {
|
|
59
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
60
|
-
const _a = context.propsValue, { customer } = _a, propsValue = tslib_1.__rest(_a, ["customer"]);
|
|
61
|
-
const body = {};
|
|
62
|
-
if (propsValue.name)
|
|
63
|
-
body.name = propsValue.name;
|
|
64
|
-
if (propsValue.email)
|
|
65
|
-
body.email = propsValue.email;
|
|
66
|
-
if (propsValue.description)
|
|
67
|
-
body.description = propsValue.description;
|
|
68
|
-
if (propsValue.phone)
|
|
69
|
-
body.phone = propsValue.phone;
|
|
70
|
-
const address = {};
|
|
71
|
-
if (propsValue.line1)
|
|
72
|
-
address.line1 = propsValue.line1;
|
|
73
|
-
if (propsValue.city)
|
|
74
|
-
address.city = propsValue.city;
|
|
75
|
-
if (propsValue.state)
|
|
76
|
-
address.state = propsValue.state;
|
|
77
|
-
if (propsValue.postal_code)
|
|
78
|
-
address.postal_code = propsValue.postal_code;
|
|
79
|
-
if (propsValue.country)
|
|
80
|
-
address.country = propsValue.country;
|
|
81
|
-
if (Object.keys(address).length > 0) {
|
|
82
|
-
body.address = address;
|
|
83
|
-
}
|
|
84
|
-
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
85
|
-
method: pieces_common_1.HttpMethod.POST,
|
|
86
|
-
url: `https://api.stripe.com/v1/customers/${customer}`,
|
|
87
|
-
authentication: {
|
|
88
|
-
type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
|
|
89
|
-
token: context.auth.secret_text,
|
|
90
|
-
},
|
|
91
|
-
headers: {
|
|
92
|
-
'Content-Type': 'application/x-www-form-urlencoded',
|
|
93
|
-
},
|
|
94
|
-
body: body,
|
|
95
|
-
});
|
|
96
|
-
return response.body;
|
|
97
|
-
});
|
|
98
|
-
},
|
|
99
|
-
});
|
|
100
|
-
//# sourceMappingURL=update-customer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"update-customer.js","sourceRoot":"","sources":["../../../../src/lib/actions/update-customer.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAIqC;AACrC,6BAAmC;AACnC,sCAAyC;AAE5B,QAAA,oBAAoB,GAAG,IAAA,+BAAY,EAAC;IAC/C,IAAI,EAAE,iBAAiB;IACvB,IAAI,EAAE,cAAU;IAChB,WAAW,EAAE,iBAAiB;IAC9B,WAAW,EAAE,wCAAwC;IACrD,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE;QACV,WAAW,EACT,2RAA2R;QAC7R,UAAU,EAAE,IAAI;KACjB;IACD,KAAK,EAAE;QACL,QAAQ,EAAE,qBAAY,CAAC,QAAQ;QAE/B,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACxB,WAAW,EAAE,OAAO;YACpB,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,IAAI,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACv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: {
|
|
4
|
-
baseUrl: string;
|
|
5
|
-
subscribeWebhook: (eventName: string, webhookUrl: string, apiKey: string) => Promise<{
|
|
6
|
-
id: string;
|
|
7
|
-
}>;
|
|
8
|
-
unsubscribeWebhook: (webhookId: string, apiKey: string) => Promise<import("@activepieces/pieces-common").HttpResponse<any>>;
|
|
9
|
-
invoice: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
|
10
|
-
customer: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
|
11
|
-
product: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
|
12
|
-
price: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
|
13
|
-
subscription: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
|
14
|
-
payout: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
|
15
|
-
paymentIntent: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
|
16
|
-
paymentLink: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
|
17
|
-
};
|
|
18
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/common/index.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAWhC,eAAO,MAAM,SAAS,WAAY,MAAM,KAAG,MAI1C,CAAC;AAEF,eAAO,MAAM,YAAY;;kCAIV,MAAM,cACL,MAAM,UACV,MAAM,KACb,OAAO,CAAC;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;oCAwBY,MAAM,UAAU,MAAM;;;;;;;;;CA2a7D,CAAC"}
|