Skip to content

Commit c2bdf9e

Browse files
Merge remote-tracking branch 'upstream/main' into LuizDMM/issue9011
2 parents 2b020c5 + d46d626 commit c2bdf9e

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"name": "@activepieces/piece-stripe",
3-
"version": "0.5.13"
3+
"version": "0.5.14"
44
}

packages/pieces/community/stripe/src/lib/trigger/new-subscription.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import { createTrigger } from '@activepieces/pieces-framework';
22
import { TriggerStrategy } from '@activepieces/pieces-framework';
33
import { stripeCommon } from '../common';
44
import { stripeAuth } from '../..';
5+
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
6+
import { isEmpty } from '@activepieces/shared';
57

68
export const stripeNewSubscription = createTrigger({
79
auth: stripeAuth,
@@ -167,6 +169,23 @@ export const stripeNewSubscription = createTrigger({
167169
await stripeCommon.unsubscribeWebhook(response.webhookId, context.auth);
168170
}
169171
},
172+
async test(context) {
173+
const response = await httpClient.sendRequest<{ data: { id: string }[] }>({
174+
method: HttpMethod.GET,
175+
url: 'https://api.stripe.com/v1/subscriptions',
176+
headers: {
177+
Authorization: 'Bearer ' + context.auth,
178+
'Content-Type': 'application/x-www-form-urlencoded',
179+
},
180+
queryParams: {
181+
limit: '5',
182+
},
183+
});
184+
185+
if (isEmpty(response.body) || isEmpty(response.body.data)) return [];
186+
187+
return response.body.data;
188+
},
170189
async run(context) {
171190
const payloadBody = context.payload.body as PayloadBody;
172191
return [payloadBody.data.object];

0 commit comments

Comments
 (0)