@@ -28,7 +28,7 @@ describe('PaddleIntegration', () => {
28
28
it ( 'creates an aactive subscription' , async ( ) => {
29
29
const createPayload = Object . assign ( { } , subscriptionCreated , { passthrough : JSON . stringify ( { ids } ) } )
30
30
31
- await paddleIntegration . addSubscription ( createPayload )
31
+ await paddleIntegration . addSubscriptionCreatedStatus ( createPayload )
32
32
const sub = await storage . get ( ids )
33
33
const isActive = await paddleIntegration . isSubscriptionActive ( sub )
34
34
expect ( isActive ) . to . be . true
@@ -39,7 +39,7 @@ describe('PaddleIntegration', () => {
39
39
subscription_id : uuid ( ) , passthrough : JSON . stringify ( { ids } )
40
40
}
41
41
)
42
- await paddleIntegration . addSubscription ( createPayload )
42
+ await paddleIntegration . addSubscriptionCreatedStatus ( createPayload )
43
43
44
44
const sub = await storage . get ( ids )
45
45
expect ( sub . cancel_url ) . to . equal ( createPayload . cancel_url )
@@ -63,7 +63,7 @@ describe('PaddleIntegration', () => {
63
63
expect ( status . start_at ) . to . equal ( createPayload . event_time )
64
64
} )
65
65
it ( 'throws if subscription is falsy' , ( ) => {
66
- return paddleIntegration . addSubscription ( null ) . then ( ( ) => {
66
+ return paddleIntegration . addSubscriptionCreatedStatus ( null ) . then ( ( ) => {
67
67
return Promise . reject ( 'Must throw an error' )
68
68
} , ( error ) => {
69
69
if ( error . message !== 'INVALID_ARGUMENTS' ) {
@@ -82,14 +82,14 @@ describe('PaddleIntegration', () => {
82
82
subscription_id : subscriptionId , passthrough : JSON . stringify ( { ids } )
83
83
}
84
84
)
85
- await paddleIntegration . addSubscription ( createPayload )
85
+ await paddleIntegration . addSubscriptionCreatedStatus ( createPayload )
86
86
87
87
const updatePayload = Object . assign ( { } , subscriptionUpdated ,
88
88
{
89
89
subscription_id : subscriptionId , passthrough : JSON . stringify ( { ids } )
90
90
}
91
91
)
92
- await paddleIntegration . updateSubscription ( updatePayload )
92
+ await paddleIntegration . addSubscriptionUpdatedStatus ( updatePayload )
93
93
94
94
const sub = await storage . get ( ids )
95
95
expect ( sub . cancel_url ) . to . equal ( updatePayload . cancel_url )
@@ -133,7 +133,7 @@ describe('PaddleIntegration', () => {
133
133
expect ( status2 . start_at ) . to . equal ( updatePayload . event_time )
134
134
} )
135
135
it ( 'throws if subscription is falsy' , ( ) => {
136
- return paddleIntegration . updateSubscription ( null ) . then ( ( ) => {
136
+ return paddleIntegration . addSubscriptionUpdatedStatus ( null ) . then ( ( ) => {
137
137
return Promise . reject ( 'Must throw an error' )
138
138
} , ( error ) => {
139
139
if ( error . message !== 'INVALID_ARGUMENTS' ) {
@@ -143,7 +143,7 @@ describe('PaddleIntegration', () => {
143
143
} )
144
144
} )
145
145
146
- describe ( '.cancelSubscription ' , ( ) => {
146
+ describe ( '.addSubscriptionCancelledStatus ' , ( ) => {
147
147
it ( 'cancels a subscription' , async ( ) => {
148
148
const subscriptionId = uuid ( )
149
149
@@ -152,7 +152,7 @@ describe('PaddleIntegration', () => {
152
152
subscription_id : subscriptionId , passthrough : JSON . stringify ( { ids } )
153
153
}
154
154
)
155
- await paddleIntegration . addSubscription ( createPayload )
155
+ await paddleIntegration . addSubscriptionCreatedStatus ( createPayload )
156
156
157
157
const payload = Object . assign ( { } , subscriptionCancelled ,
158
158
{
@@ -161,7 +161,7 @@ describe('PaddleIntegration', () => {
161
161
cancellation_effective_date : new Date ( new Date ( ) . getTime ( ) - 1000 ) . toISOString ( )
162
162
}
163
163
)
164
- await paddleIntegration . cancelSubscription ( payload )
164
+ await paddleIntegration . addSubscriptionCancelledStatus ( payload )
165
165
166
166
const sub = await storage . get ( ids )
167
167
const isActive = await paddleIntegration . isSubscriptionActive ( sub )
@@ -175,7 +175,7 @@ describe('PaddleIntegration', () => {
175
175
subscription_id : subscriptionId , passthrough : JSON . stringify ( { ids } )
176
176
}
177
177
)
178
- await paddleIntegration . addSubscription ( createPayload )
178
+ await paddleIntegration . addSubscriptionCreatedStatus ( createPayload )
179
179
180
180
const cancelPayload = Object . assign ( { } , subscriptionCancelled ,
181
181
{
@@ -184,7 +184,7 @@ describe('PaddleIntegration', () => {
184
184
cancellation_effective_date : new Date ( new Date ( ) . getTime ( ) - 1000 ) . toISOString ( )
185
185
}
186
186
)
187
- await paddleIntegration . cancelSubscription ( cancelPayload )
187
+ await paddleIntegration . addSubscriptionCancelledStatus ( cancelPayload )
188
188
189
189
const sub = await storage . get ( ids )
190
190
expect ( sub . cancel_url ) . to . equal ( createPayload . cancel_url )
@@ -209,7 +209,7 @@ describe('PaddleIntegration', () => {
209
209
expect ( status . start_at ) . to . equal ( cancelPayload . cancellation_effective_date )
210
210
} )
211
211
it ( 'throws if subscription is falsy' , ( ) => {
212
- return paddleIntegration . cancelSubscription ( null ) . then ( ( ) => {
212
+ return paddleIntegration . addSubscriptionCancelledStatus ( null ) . then ( ( ) => {
213
213
return Promise . reject ( 'Must throw an error' )
214
214
} , ( error ) => {
215
215
if ( error . message !== 'INVALID_ARGUMENTS' ) {
@@ -226,7 +226,7 @@ describe('PaddleIntegration', () => {
226
226
subscription_id : subscriptionId ,
227
227
passthrough : JSON . stringify ( { ids } ) ,
228
228
} )
229
- await paddleIntegration . addSubscription ( createPayload )
229
+ await paddleIntegration . addSubscriptionCreatedStatus ( createPayload )
230
230
231
231
let sub = await storage . get ( ids )
232
232
expect ( sub . payments ) . to . have . length ( 0 )
@@ -252,7 +252,7 @@ describe('PaddleIntegration', () => {
252
252
subscription_id : subscriptionId ,
253
253
passthrough : JSON . stringify ( { ids } ) ,
254
254
} )
255
- await paddleIntegration . addSubscription ( createPayload )
255
+ await paddleIntegration . addSubscriptionCreatedStatus ( createPayload )
256
256
257
257
const paymentPayload = Object . assign ( { } , paymentRefunded , {
258
258
subscription_id : subscriptionId ,
@@ -276,7 +276,7 @@ describe('PaddleIntegration', () => {
276
276
subscription_id : subscriptionId ,
277
277
passthrough : JSON . stringify ( { ids } ) ,
278
278
} )
279
- await paddleIntegration . addSubscription ( createPayload )
279
+ await paddleIntegration . addSubscriptionCreatedStatus ( createPayload )
280
280
281
281
const paymentPayload = Object . assign ( { } , paymentFailed , {
282
282
subscription_id : subscriptionId ,
@@ -301,7 +301,7 @@ describe('PaddleIntegration', () => {
301
301
event_time : new Date ( ) . toISOString ( )
302
302
}
303
303
)
304
- await paddleIntegration . addSubscription ( createPayload )
304
+ await paddleIntegration . addSubscriptionCreatedStatus ( createPayload )
305
305
306
306
const payload = Object . assign ( { } , subscriptionCancelled ,
307
307
{
@@ -310,7 +310,7 @@ describe('PaddleIntegration', () => {
310
310
cancellation_effective_date : new Date ( new Date ( ) . getTime ( ) ) . toISOString ( )
311
311
}
312
312
)
313
- await paddleIntegration . cancelSubscription ( payload )
313
+ await paddleIntegration . addSubscriptionCancelledStatus ( payload )
314
314
315
315
const sub = await storage . get ( ids )
316
316
const isActive = await paddleIntegration . isSubscriptionActive ( sub )
@@ -324,7 +324,7 @@ describe('PaddleIntegration', () => {
324
324
event_time : new Date ( ) . toISOString ( )
325
325
}
326
326
)
327
- await paddleIntegration . addSubscription ( createPayload )
327
+ await paddleIntegration . addSubscriptionCreatedStatus ( createPayload )
328
328
329
329
const payload = Object . assign ( { } , subscriptionCancelled ,
330
330
{
@@ -333,7 +333,7 @@ describe('PaddleIntegration', () => {
333
333
cancellation_effective_date : new Date ( new Date ( ) . getTime ( ) + 1000 ) . toISOString ( )
334
334
}
335
335
)
336
- await paddleIntegration . cancelSubscription ( payload )
336
+ await paddleIntegration . addSubscriptionCancelledStatus ( payload )
337
337
338
338
const sub = await storage . get ( ids )
339
339
const isActive = await paddleIntegration . isSubscriptionActive ( sub )
@@ -347,7 +347,7 @@ describe('PaddleIntegration', () => {
347
347
event_time : new Date ( ) . toISOString ( )
348
348
}
349
349
)
350
- await paddleIntegration . addSubscription ( createPayload )
350
+ await paddleIntegration . addSubscriptionCreatedStatus ( createPayload )
351
351
352
352
const payload = Object . assign ( { } , subscriptionCancelled ,
353
353
{
@@ -356,7 +356,7 @@ describe('PaddleIntegration', () => {
356
356
cancellation_effective_date : new Date ( new Date ( ) . getTime ( ) + 1000 ) . toISOString ( )
357
357
}
358
358
)
359
- await paddleIntegration . cancelSubscription ( payload )
359
+ await paddleIntegration . addSubscriptionCancelledStatus ( payload )
360
360
361
361
const sub = await storage . get ( ids )
362
362
const isActive = await paddleIntegration . isSubscriptionActive ( sub , new Date ( new Date ( ) . getTime ( ) + 5000 ) )
0 commit comments