1
|
|
|
package stubs |
2
|
|
|
|
3
|
|
|
// SubscriptionGetResponse returns a dummy response to GET /v1/subscriptions/:id endpoint |
4
|
|
|
func SubscriptionGetResponse() []byte { |
5
|
|
|
return []byte(` |
6
|
|
|
{ |
7
|
|
|
"jsonapi": { |
8
|
|
|
"version": "1.0" |
9
|
|
|
}, |
10
|
|
|
"links": { |
11
|
|
|
"self": "https://api.lemonsqueezy.com/v1/subscriptions/1" |
12
|
|
|
}, |
13
|
|
|
"data": { |
14
|
|
|
"type": "subscriptions", |
15
|
|
|
"id": "1", |
16
|
|
|
"attributes": { |
17
|
|
|
"store_id": 1, |
18
|
|
|
"order_id": 1, |
19
|
|
|
"order_item_id": 1, |
20
|
|
|
"product_id": 1, |
21
|
|
|
"variant_id": 1, |
22
|
|
|
"product_name": "Example Product", |
23
|
|
|
"variant_name": "Example Variant", |
24
|
|
|
"user_name": "Darlene Daugherty", |
25
|
|
|
"user_email": "[email protected]", |
26
|
|
|
"status": "active", |
27
|
|
|
"status_formatted": "Active", |
28
|
|
|
"pause": null, |
29
|
|
|
"cancelled": false, |
30
|
|
|
"trial_ends_at": null, |
31
|
|
|
"billing_anchor": 12, |
32
|
|
|
"urls": { |
33
|
|
|
"update_payment_method": "https://app.lemonsqueezy.com/my-orders/2ba92a4e-a00a-45d2-a128-16856ffa8cdf/subscription/8/update-payment-method?expires=1666869343&signature=9985e3bf9007840aeb3951412be475abc17439c449c1af3e56e08e45e1345413" |
34
|
|
|
}, |
35
|
|
|
"renews_at": "2022-11-12T00:00:00.000000Z", |
36
|
|
|
"ends_at": null, |
37
|
|
|
"created_at": "2021-08-11T13:47:27.000000Z", |
38
|
|
|
"updated_at": "2021-08-11T13:54:19.000000Z", |
39
|
|
|
"test_mode": false |
40
|
|
|
}, |
41
|
|
|
"relationships": { |
42
|
|
|
"store": { |
43
|
|
|
"links": { |
44
|
|
|
"related": "https://api.lemonsqueezy.com/v1/subscriptions/1/store", |
45
|
|
|
"self": "https://api.lemonsqueezy.com/v1/subscriptions/1/relationships/store" |
46
|
|
|
} |
47
|
|
|
}, |
48
|
|
|
"order": { |
49
|
|
|
"links": { |
50
|
|
|
"related": "https://api.lemonsqueezy.com/v1/subscriptions/1/order", |
51
|
|
|
"self": "https://api.lemonsqueezy.com/v1/subscriptions/1/relationships/order" |
52
|
|
|
} |
53
|
|
|
}, |
54
|
|
|
"order-item": { |
55
|
|
|
"links": { |
56
|
|
|
"related": "https://api.lemonsqueezy.com/v1/subscriptions/1/order-item", |
57
|
|
|
"self": "https://api.lemonsqueezy.com/v1/subscriptions/1/relationships/order-item" |
58
|
|
|
} |
59
|
|
|
}, |
60
|
|
|
"product": { |
61
|
|
|
"links": { |
62
|
|
|
"related": "https://api.lemonsqueezy.com/v1/subscriptions/1/product", |
63
|
|
|
"self": "https://api.lemonsqueezy.com/v1/subscriptions/1/relationships/product" |
64
|
|
|
} |
65
|
|
|
}, |
66
|
|
|
"variant": { |
67
|
|
|
"links": { |
68
|
|
|
"related": "https://api.lemonsqueezy.com/v1/subscriptions/1/variant", |
69
|
|
|
"self": "https://api.lemonsqueezy.com/v1/subscriptions/1/relationships/variant" |
70
|
|
|
} |
71
|
|
|
} |
72
|
|
|
}, |
73
|
|
|
"links": { |
74
|
|
|
"self": "https://api.lemonsqueezy.com/v1/subscriptions/1" |
75
|
|
|
} |
76
|
|
|
} |
77
|
|
|
} |
78
|
|
|
`) |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
// SubscriptionUpdateResponse is a dummy response to the PATCH /v1/subscriptions/:id endpoint |
82
|
|
|
func SubscriptionUpdateResponse() []byte { |
83
|
|
|
return []byte(` |
84
|
|
|
{ |
85
|
|
|
"type": "subscriptions", |
86
|
|
|
"id": "1", |
87
|
|
|
"attributes": { |
88
|
|
|
"store_id": 1, |
89
|
|
|
"order_id": 1, |
90
|
|
|
"order_item_id": 1, |
91
|
|
|
"product_id": 9, |
92
|
|
|
"variant_id": 11, |
93
|
|
|
"product_name": "New Plan Product", |
94
|
|
|
"variant_name": "New Plan Variant", |
95
|
|
|
"user_name": "Darlene Daugherty", |
96
|
|
|
"user_email": "[email protected]", |
97
|
|
|
"status": "active", |
98
|
|
|
"status_formatted": "Active", |
99
|
|
|
"pause": null, |
100
|
|
|
"cancelled": false, |
101
|
|
|
"trial_ends_at": null, |
102
|
|
|
"billing_anchor": 29, |
103
|
|
|
"urls": { |
104
|
|
|
"update_payment_method": "https://app.lemonsqueezy.com/my-orders/2ba92a4e-a00a-45d2-a128-16856ffa8cdf/subscription/8/update-payment-method?expires=1666869343&signature=9985e3bf9007840aeb3951412be475abc17439c449c1af3e56e08e45e1345413" |
105
|
|
|
}, |
106
|
|
|
"renews_at": "2022-11-12T00:00:00.000000Z", |
107
|
|
|
"ends_at": null, |
108
|
|
|
"created_at": "2021-08-11T13:47:27.000000Z", |
109
|
|
|
"updated_at": "2021-08-11T13:54:19.000000Z", |
110
|
|
|
"test_mode": false |
111
|
|
|
} |
112
|
|
|
} |
113
|
|
|
`) |
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
// SubscriptionsListResponse returns a list of subscription responses ordered by created at |
117
|
|
|
func SubscriptionsListResponse() []byte { |
118
|
|
|
return []byte(` |
119
|
|
|
{ |
120
|
|
|
"meta":{ |
121
|
|
|
"page":{ |
122
|
|
|
"currentPage":1, |
123
|
|
|
"from":1, |
124
|
|
|
"lastPage":1, |
125
|
|
|
"perPage":10, |
126
|
|
|
"to":10, |
127
|
|
|
"total":10 |
128
|
|
|
} |
129
|
|
|
}, |
130
|
|
|
"jsonapi":{ |
131
|
|
|
"version":"1.0" |
132
|
|
|
}, |
133
|
|
|
"links":{ |
134
|
|
|
"first":"https://api.lemonsqueezy.com/v1/subscriptions?page%5Bnumber%5D=1&page%5Bsize%5D=10&sort=-createdAt", |
135
|
|
|
"last":"https://api.lemonsqueezy.com/v1/subscriptions?page%5Bnumber%5D=1&page%5Bsize%5D=10&sort=-createdAt" |
136
|
|
|
}, |
137
|
|
|
"data":[ |
138
|
|
|
{ |
139
|
|
|
"type":"subscriptions", |
140
|
|
|
"id":"1", |
141
|
|
|
"attributes":{ |
142
|
|
|
"store_id":1, |
143
|
|
|
"order_id":1, |
144
|
|
|
"order_item_id":1, |
145
|
|
|
"product_id":1, |
146
|
|
|
"variant_id":1, |
147
|
|
|
"product_name":"Example Product", |
148
|
|
|
"variant_name":"Example Variant", |
149
|
|
|
"user_name":"Darlene Daugherty", |
150
|
|
|
"user_email":"[email protected]", |
151
|
|
|
"status":"active", |
152
|
|
|
"status_formatted":"Active", |
153
|
|
|
"pause":null, |
154
|
|
|
"cancelled":false, |
155
|
|
|
"trial_ends_at":null, |
156
|
|
|
"billing_anchor":12, |
157
|
|
|
"urls":{ |
158
|
|
|
"update_payment_method":"https://app.lemonsqueezy.com/my-orders/2ba92a4e-a00a-45d2-a128-16856ffa8cdf/subscription/8/update-payment-method?expires=1666869343&signature=9985e3bf9007840aeb3951412be475abc17439c449c1af3e56e08e45e1345413" |
159
|
|
|
}, |
160
|
|
|
"renews_at":"2022-11-12T00:00:00.000000Z", |
161
|
|
|
"ends_at":null, |
162
|
|
|
"created_at":"2021-08-11T13:47:27.000000Z", |
163
|
|
|
"updated_at":"2021-08-11T13:54:19.000000Z", |
164
|
|
|
"test_mode":false |
165
|
|
|
}, |
166
|
|
|
"relationships":{ |
167
|
|
|
"store":{ |
168
|
|
|
"links":{ |
169
|
|
|
"related":"https://api.lemonsqueezy.com/v1/subscriptions/1/store", |
170
|
|
|
"self":"https://api.lemonsqueezy.com/v1/subscriptions/1/relationships/store" |
171
|
|
|
} |
172
|
|
|
}, |
173
|
|
|
"order":{ |
174
|
|
|
"links":{ |
175
|
|
|
"related":"https://api.lemonsqueezy.com/v1/subscriptions/1/order", |
176
|
|
|
"self":"https://api.lemonsqueezy.com/v1/subscriptions/1/relationships/order" |
177
|
|
|
} |
178
|
|
|
}, |
179
|
|
|
"order-item":{ |
180
|
|
|
"links":{ |
181
|
|
|
"related":"https://api.lemonsqueezy.com/v1/subscriptions/1/order-item", |
182
|
|
|
"self":"https://api.lemonsqueezy.com/v1/subscriptions/1/relationships/order-item" |
183
|
|
|
} |
184
|
|
|
}, |
185
|
|
|
"product":{ |
186
|
|
|
"links":{ |
187
|
|
|
"related":"https://api.lemonsqueezy.com/v1/subscriptions/1/product", |
188
|
|
|
"self":"https://api.lemonsqueezy.com/v1/subscriptions/1/relationships/product" |
189
|
|
|
} |
190
|
|
|
}, |
191
|
|
|
"variant":{ |
192
|
|
|
"links":{ |
193
|
|
|
"related":"https://api.lemonsqueezy.com/v1/subscriptions/1/variant", |
194
|
|
|
"self":"https://api.lemonsqueezy.com/v1/subscriptions/1/relationships/variant" |
195
|
|
|
} |
196
|
|
|
} |
197
|
|
|
}, |
198
|
|
|
"links":{ |
199
|
|
|
"self":"https://api.lemonsqueezy.com/v1/subscriptions/1" |
200
|
|
|
} |
201
|
|
|
}, |
202
|
|
|
{ |
203
|
|
|
"type":"subscriptions", |
204
|
|
|
"id":"2", |
205
|
|
|
"attributes":{ |
206
|
|
|
"store_id":2, |
207
|
|
|
"order_id":2, |
208
|
|
|
"order_item_id":2, |
209
|
|
|
"product_id":2, |
210
|
|
|
"variant_id":2, |
211
|
|
|
"product_name":"Example Product 2", |
212
|
|
|
"variant_name":"Example Variant 2", |
213
|
|
|
"user_name":"Darlene Daugherty 2", |
214
|
|
|
"user_email":"[email protected]", |
215
|
|
|
"status":"active", |
216
|
|
|
"status_formatted":"Active", |
217
|
|
|
"pause":null, |
218
|
|
|
"cancelled":false, |
219
|
|
|
"trial_ends_at":null, |
220
|
|
|
"billing_anchor":13, |
221
|
|
|
"urls":{ |
222
|
|
|
"update_payment_method":"https://app.lemonsqueezy.com/my-orders/2ba92a4e-a00a-45d2-a128-16856ffa8cdf/subscription/8/update-payment-method?expires=1666869343&signature=9985e3bf9007840aeb3951412be475abc17439c449c1af3e56e08e45e1345413" |
223
|
|
|
}, |
224
|
|
|
"renews_at":"2022-11-12T00:00:00.000000Z", |
225
|
|
|
"ends_at":null, |
226
|
|
|
"created_at":"2021-08-11T13:47:27.000000Z", |
227
|
|
|
"updated_at":"2021-08-11T13:54:19.000000Z", |
228
|
|
|
"test_mode":false |
229
|
|
|
}, |
230
|
|
|
"relationships":{ |
231
|
|
|
"store":{ |
232
|
|
|
"links":{ |
233
|
|
|
"related":"https://api.lemonsqueezy.com/v1/subscriptions/1/store", |
234
|
|
|
"self":"https://api.lemonsqueezy.com/v1/subscriptions/1/relationships/store" |
235
|
|
|
} |
236
|
|
|
}, |
237
|
|
|
"order":{ |
238
|
|
|
"links":{ |
239
|
|
|
"related":"https://api.lemonsqueezy.com/v1/subscriptions/1/order", |
240
|
|
|
"self":"https://api.lemonsqueezy.com/v1/subscriptions/1/relationships/order" |
241
|
|
|
} |
242
|
|
|
}, |
243
|
|
|
"order-item":{ |
244
|
|
|
"links":{ |
245
|
|
|
"related":"https://api.lemonsqueezy.com/v1/subscriptions/1/order-item", |
246
|
|
|
"self":"https://api.lemonsqueezy.com/v1/subscriptions/1/relationships/order-item" |
247
|
|
|
} |
248
|
|
|
}, |
249
|
|
|
"product":{ |
250
|
|
|
"links":{ |
251
|
|
|
"related":"https://api.lemonsqueezy.com/v1/subscriptions/1/product", |
252
|
|
|
"self":"https://api.lemonsqueezy.com/v1/subscriptions/1/relationships/product" |
253
|
|
|
} |
254
|
|
|
}, |
255
|
|
|
"variant":{ |
256
|
|
|
"links":{ |
257
|
|
|
"related":"https://api.lemonsqueezy.com/v1/subscriptions/1/variant", |
258
|
|
|
"self":"https://api.lemonsqueezy.com/v1/subscriptions/1/relationships/variant" |
259
|
|
|
} |
260
|
|
|
} |
261
|
|
|
}, |
262
|
|
|
"links":{ |
263
|
|
|
"self":"https://api.lemonsqueezy.com/v1/subscriptions/1" |
264
|
|
|
} |
265
|
|
|
} |
266
|
|
|
] |
267
|
|
|
} |
268
|
|
|
`) |
269
|
|
|
} |
270
|
|
|
|
271
|
|
|
// SubscriptionCancelResponse returns a dummy response to DELETE /v1/subscriptions/:id endpoint |
272
|
|
|
func SubscriptionCancelResponse() []byte { |
273
|
|
|
return []byte(` |
274
|
|
|
{ |
275
|
|
|
"jsonapi": { |
276
|
|
|
"version": "1.0" |
277
|
|
|
}, |
278
|
|
|
"links": { |
279
|
|
|
"self": "https://api.lemonsqueezy.com/v1/subscriptions/1" |
280
|
|
|
}, |
281
|
|
|
"data": { |
282
|
|
|
"type": "subscriptions", |
283
|
|
|
"id": "1", |
284
|
|
|
"attributes": { |
285
|
|
|
"store_id": 1, |
286
|
|
|
"order_id": 1, |
287
|
|
|
"order_item_id": 1, |
288
|
|
|
"product_id": 1, |
289
|
|
|
"variant_id": 1, |
290
|
|
|
"product_name": "Example Product", |
291
|
|
|
"variant_name": "Example Variant", |
292
|
|
|
"user_name": "Darlene Daugherty", |
293
|
|
|
"user_email": "[email protected]", |
294
|
|
|
"status": "cancelled", |
295
|
|
|
"status_formatted": "Cancelled", |
296
|
|
|
"pause": null, |
297
|
|
|
"cancelled": true, |
298
|
|
|
"trial_ends_at": null, |
299
|
|
|
"billing_anchor": 12, |
300
|
|
|
"urls": { |
301
|
|
|
"update_payment_method": "https://app.lemonsqueezy.com/my-orders/2ba92a4e-a00a-45d2-a128-16856ffa8cdf/subscription/8/update-payment-method?expires=1666869343&signature=9985e3bf9007840aeb3951412be475abc17439c449c1af3e56e08e45e1345413" |
302
|
|
|
}, |
303
|
|
|
"renews_at": "2022-11-12T00:00:00.000000Z", |
304
|
|
|
"ends_at": "2022-11-12T00:00:00.000000Z", |
305
|
|
|
"created_at": "2021-08-11T13:47:27.000000Z", |
306
|
|
|
"updated_at": "2021-08-11T13:54:19.000000Z", |
307
|
|
|
"test_mode": false |
308
|
|
|
}, |
309
|
|
|
"relationships": { |
310
|
|
|
"store": { |
311
|
|
|
"links": { |
312
|
|
|
"related": "https://api.lemonsqueezy.com/v1/subscriptions/1/store", |
313
|
|
|
"self": "https://api.lemonsqueezy.com/v1/subscriptions/1/relationships/store" |
314
|
|
|
} |
315
|
|
|
}, |
316
|
|
|
"order": { |
317
|
|
|
"links": { |
318
|
|
|
"related": "https://api.lemonsqueezy.com/v1/subscriptions/1/order", |
319
|
|
|
"self": "https://api.lemonsqueezy.com/v1/subscriptions/1/relationships/order" |
320
|
|
|
} |
321
|
|
|
}, |
322
|
|
|
"order-item": { |
323
|
|
|
"links": { |
324
|
|
|
"related": "https://api.lemonsqueezy.com/v1/subscriptions/1/order-item", |
325
|
|
|
"self": "https://api.lemonsqueezy.com/v1/subscriptions/1/relationships/order-item" |
326
|
|
|
} |
327
|
|
|
}, |
328
|
|
|
"product": { |
329
|
|
|
"links": { |
330
|
|
|
"related": "https://api.lemonsqueezy.com/v1/subscriptions/1/product", |
331
|
|
|
"self": "https://api.lemonsqueezy.com/v1/subscriptions/1/relationships/product" |
332
|
|
|
} |
333
|
|
|
}, |
334
|
|
|
"variant": { |
335
|
|
|
"links": { |
336
|
|
|
"related": "https://api.lemonsqueezy.com/v1/subscriptions/1/variant", |
337
|
|
|
"self": "https://api.lemonsqueezy.com/v1/subscriptions/1/relationships/variant" |
338
|
|
|
} |
339
|
|
|
} |
340
|
|
|
}, |
341
|
|
|
"links": { |
342
|
|
|
"self": "https://api.lemonsqueezy.com/v1/subscriptions/1" |
343
|
|
|
} |
344
|
|
|
} |
345
|
|
|
} |
346
|
|
|
`) |
347
|
|
|
} |
348
|
|
|
|