File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11{
22 "name" : " @activepieces/piece-stripe" ,
3- "version" : " 0.5.13 "
3+ "version" : " 0.5.14 "
44}
Original file line number Diff line number Diff line change @@ -2,6 +2,8 @@ import { createTrigger } from '@activepieces/pieces-framework';
22import { TriggerStrategy } from '@activepieces/pieces-framework' ;
33import { stripeCommon } from '../common' ;
44import { stripeAuth } from '../..' ;
5+ import { httpClient , HttpMethod } from '@activepieces/pieces-common' ;
6+ import { isEmpty } from '@activepieces/shared' ;
57
68export 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 ] ;
You can’t perform that action at this time.
0 commit comments