@payark/sdk-effect 0.1.6 → 0.1.9
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/README.md +9 -10
- package/dist/api-spec.d.mts +385 -38
- package/dist/api-spec.d.ts +385 -38
- package/dist/api-spec.js +237 -16
- package/dist/api-spec.js.map +1 -1
- package/dist/api-spec.mjs +229 -17
- package/dist/api-spec.mjs.map +1 -1
- package/dist/index.d.mts +919 -99
- package/dist/index.d.ts +919 -99
- package/dist/index.js +615 -23
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +601 -25
- package/dist/index.mjs.map +1 -1
- package/dist/schemas.d.mts +91 -13
- package/dist/schemas.d.ts +91 -13
- package/dist/schemas.js +97 -6
- package/dist/schemas.js.map +1 -1
- package/dist/schemas.mjs +91 -7
- package/dist/schemas.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -12,11 +12,17 @@ var UrlString = effect.Schema.String.pipe(
|
|
|
12
12
|
effect.Schema.pattern(/^https?:\/\/.+/),
|
|
13
13
|
effect.Schema.brand("UrlString")
|
|
14
14
|
);
|
|
15
|
-
|
|
15
|
+
effect.Schema.Number.pipe(
|
|
16
16
|
effect.Schema.int(),
|
|
17
17
|
effect.Schema.greaterThan(0),
|
|
18
18
|
effect.Schema.brand("MinorUnitsInt")
|
|
19
19
|
);
|
|
20
|
+
var NprAmount = effect.Schema.Number.pipe(
|
|
21
|
+
effect.Schema.filter(
|
|
22
|
+
(n) => Number.isFinite(n) && n > 0 && Math.round(n * 100) === n * 100
|
|
23
|
+
),
|
|
24
|
+
effect.Schema.brand("NprAmount")
|
|
25
|
+
);
|
|
20
26
|
|
|
21
27
|
// src/schemas.ts
|
|
22
28
|
var Id = effect.Schema.String.pipe(effect.Schema.brand("Id"));
|
|
@@ -28,6 +34,10 @@ var CheckoutSessionId = effect.Schema.String.pipe(
|
|
|
28
34
|
var SubscriptionId = effect.Schema.String.pipe(
|
|
29
35
|
effect.Schema.brand("SubscriptionId")
|
|
30
36
|
);
|
|
37
|
+
var MandateId = effect.Schema.String.pipe(effect.Schema.brand("MandateId"));
|
|
38
|
+
var AgentSessionId = effect.Schema.String.pipe(
|
|
39
|
+
effect.Schema.brand("AgentSessionId")
|
|
40
|
+
);
|
|
31
41
|
var CustomerId = effect.Schema.String.pipe(effect.Schema.brand("CustomerId"));
|
|
32
42
|
var TokenId = effect.Schema.String.pipe(effect.Schema.brand("TokenId"));
|
|
33
43
|
var Email = effect.Schema.String.pipe(
|
|
@@ -46,6 +56,7 @@ var Timestamps = effect.Schema.Struct({
|
|
|
46
56
|
var Provider = effect.Schema.Literal(
|
|
47
57
|
"esewa",
|
|
48
58
|
"khalti",
|
|
59
|
+
"hamropay",
|
|
49
60
|
"connectips",
|
|
50
61
|
"imepay",
|
|
51
62
|
"fonepay",
|
|
@@ -53,12 +64,27 @@ var Provider = effect.Schema.Literal(
|
|
|
53
64
|
);
|
|
54
65
|
var PaymentStatus = effect.Schema.Literal("pending", "success", "failed");
|
|
55
66
|
var SubscriptionStatus = effect.Schema.Literal(
|
|
67
|
+
"pending_checkout",
|
|
56
68
|
"active",
|
|
57
69
|
"past_due",
|
|
58
70
|
"canceled",
|
|
59
71
|
"paused"
|
|
60
72
|
);
|
|
61
73
|
var SubscriptionInterval = effect.Schema.Literal("month", "year", "week");
|
|
74
|
+
var CustomerLifecycle = effect.Schema.Literal(
|
|
75
|
+
"new",
|
|
76
|
+
"active",
|
|
77
|
+
"loyal",
|
|
78
|
+
"at_risk",
|
|
79
|
+
"churned"
|
|
80
|
+
);
|
|
81
|
+
var MandateType = effect.Schema.Literal("intent", "cart");
|
|
82
|
+
var MandateStatus = effect.Schema.Literal(
|
|
83
|
+
"active",
|
|
84
|
+
"consumed",
|
|
85
|
+
"expired",
|
|
86
|
+
"violated"
|
|
87
|
+
);
|
|
62
88
|
var Customer = effect.Schema.Struct({
|
|
63
89
|
id: CustomerId,
|
|
64
90
|
merchant_customer_id: NonEmptyString,
|
|
@@ -67,12 +93,18 @@ var Customer = effect.Schema.Struct({
|
|
|
67
93
|
phone: effect.Schema.NullOr(effect.Schema.String),
|
|
68
94
|
project_id: ProjectId,
|
|
69
95
|
metadata: effect.Schema.NullOr(Metadata),
|
|
96
|
+
total_ltv: effect.Schema.optional(effect.Schema.Number),
|
|
97
|
+
is_high_value: effect.Schema.optional(effect.Schema.Boolean),
|
|
98
|
+
lifecycle_stage: effect.Schema.optional(CustomerLifecycle),
|
|
99
|
+
ltv_cents: effect.Schema.optional(effect.Schema.Number),
|
|
100
|
+
tier: effect.Schema.NullOr(effect.Schema.String),
|
|
70
101
|
created_at: Timestamp,
|
|
71
102
|
updated_at: effect.Schema.optional(Timestamp)
|
|
72
103
|
});
|
|
73
104
|
var Payment = effect.Schema.Struct({
|
|
74
105
|
id: PaymentId,
|
|
75
106
|
project_id: ProjectId,
|
|
107
|
+
customer_id: effect.Schema.optional(effect.Schema.NullOr(CustomerId)),
|
|
76
108
|
amount: effect.Schema.Number,
|
|
77
109
|
currency: effect.Schema.String,
|
|
78
110
|
status: PaymentStatus,
|
|
@@ -94,7 +126,9 @@ var Subscription = effect.Schema.Struct({
|
|
|
94
126
|
current_period_start: Timestamp,
|
|
95
127
|
current_period_end: Timestamp,
|
|
96
128
|
payment_link: UrlString,
|
|
129
|
+
customer_email: effect.Schema.optional(effect.Schema.NullOr(effect.Schema.String)),
|
|
97
130
|
auto_send_link: effect.Schema.Boolean,
|
|
131
|
+
grace_days: effect.Schema.optional(effect.Schema.Number),
|
|
98
132
|
metadata: effect.Schema.optional(effect.Schema.NullOr(Metadata)),
|
|
99
133
|
canceled_at: effect.Schema.optional(effect.Schema.NullOr(Timestamp)),
|
|
100
134
|
created_at: Timestamp,
|
|
@@ -104,6 +138,13 @@ var Project = effect.Schema.Struct({
|
|
|
104
138
|
id: ProjectId,
|
|
105
139
|
name: NonEmptyString,
|
|
106
140
|
api_key_secret: effect.Schema.String,
|
|
141
|
+
subscription_tier: effect.Schema.optional(
|
|
142
|
+
effect.Schema.Literal("free", "pro", "enterprise")
|
|
143
|
+
),
|
|
144
|
+
subscription_status: effect.Schema.optional(
|
|
145
|
+
effect.Schema.Literal("active", "past_due", "canceled", "incomplete")
|
|
146
|
+
),
|
|
147
|
+
expires_at: effect.Schema.optional(effect.Schema.NullOr(Timestamp)),
|
|
107
148
|
created_at: Timestamp
|
|
108
149
|
});
|
|
109
150
|
var Token = effect.Schema.Struct({
|
|
@@ -114,6 +155,38 @@ var Token = effect.Schema.Struct({
|
|
|
114
155
|
expires_at: effect.Schema.NullOr(Timestamp),
|
|
115
156
|
created_at: Timestamp
|
|
116
157
|
});
|
|
158
|
+
var Mandate = effect.Schema.Struct({
|
|
159
|
+
id: MandateId,
|
|
160
|
+
project_id: ProjectId,
|
|
161
|
+
customer_id: effect.Schema.NullOr(CustomerId),
|
|
162
|
+
type: MandateType,
|
|
163
|
+
status: MandateStatus,
|
|
164
|
+
principal_id: effect.Schema.String,
|
|
165
|
+
max_amount: effect.Schema.Number,
|
|
166
|
+
currency: effect.Schema.String,
|
|
167
|
+
permitted_vendors: effect.Schema.NullOr(effect.Schema.Array(effect.Schema.String)),
|
|
168
|
+
valid_from: Timestamp,
|
|
169
|
+
valid_until: Timestamp,
|
|
170
|
+
credential_jwt: effect.Schema.String,
|
|
171
|
+
public_key: effect.Schema.String,
|
|
172
|
+
signature: effect.Schema.String,
|
|
173
|
+
parent_mandate_id: effect.Schema.NullOr(MandateId),
|
|
174
|
+
payment_id: effect.Schema.NullOr(PaymentId),
|
|
175
|
+
created_at: Timestamp,
|
|
176
|
+
consumed_at: effect.Schema.NullOr(Timestamp),
|
|
177
|
+
metadata_json: Metadata
|
|
178
|
+
});
|
|
179
|
+
var AgentSession = effect.Schema.Struct({
|
|
180
|
+
id: AgentSessionId,
|
|
181
|
+
project_id: ProjectId,
|
|
182
|
+
context_id: effect.Schema.String,
|
|
183
|
+
agent_card_url: UrlString,
|
|
184
|
+
capabilities: effect.Schema.Any,
|
|
185
|
+
auth_scheme: effect.Schema.Literal("bearer", "mandate"),
|
|
186
|
+
status: effect.Schema.String,
|
|
187
|
+
created_at: Timestamp,
|
|
188
|
+
expires_at: Timestamp
|
|
189
|
+
});
|
|
117
190
|
var PaginationMeta = effect.Schema.Struct({
|
|
118
191
|
total: effect.Schema.NullOr(effect.Schema.Number),
|
|
119
192
|
limit: effect.Schema.Number,
|
|
@@ -127,6 +200,8 @@ var WebhookEventType = effect.Schema.Literal(
|
|
|
127
200
|
"payment.success",
|
|
128
201
|
"payment.failed",
|
|
129
202
|
"subscription.created",
|
|
203
|
+
"subscription.activated",
|
|
204
|
+
"subscription.renewed",
|
|
130
205
|
"subscription.payment_succeeded",
|
|
131
206
|
"subscription.payment_failed",
|
|
132
207
|
"subscription.renewal_due",
|
|
@@ -151,13 +226,15 @@ var WebhookEvent = effect.Schema.Struct({
|
|
|
151
226
|
created: effect.Schema.optional(effect.Schema.Number)
|
|
152
227
|
});
|
|
153
228
|
var CreateCheckoutParams = effect.Schema.Struct({
|
|
154
|
-
amount: effect.Schema.optional(
|
|
229
|
+
amount: effect.Schema.optional(NprAmount),
|
|
155
230
|
currency: effect.Schema.optionalWith(effect.Schema.String, { default: () => "NPR" }),
|
|
156
231
|
provider: Provider,
|
|
157
232
|
returnUrl: UrlString,
|
|
158
233
|
cancelUrl: effect.Schema.optional(UrlString),
|
|
159
234
|
metadata: effect.Schema.optional(Metadata),
|
|
160
|
-
subscriptionId: effect.Schema.optional(SubscriptionId)
|
|
235
|
+
subscriptionId: effect.Schema.optional(SubscriptionId),
|
|
236
|
+
customerId: effect.Schema.optional(CustomerId),
|
|
237
|
+
mandate_id: effect.Schema.optional(MandateId)
|
|
161
238
|
}).pipe(
|
|
162
239
|
effect.Schema.filter((data) => {
|
|
163
240
|
if (!data.subscriptionId && !data.amount) {
|
|
@@ -169,6 +246,7 @@ var CreateCheckoutParams = effect.Schema.Struct({
|
|
|
169
246
|
var CheckoutSession = effect.Schema.Struct({
|
|
170
247
|
id: CheckoutSessionId,
|
|
171
248
|
checkout_url: UrlString,
|
|
249
|
+
qr_string: effect.Schema.optional(effect.Schema.String),
|
|
172
250
|
payment_method: effect.Schema.Struct({
|
|
173
251
|
type: Provider,
|
|
174
252
|
url: effect.Schema.optional(UrlString),
|
|
@@ -202,22 +280,27 @@ var UpdateCustomerParams = effect.Schema.Struct({
|
|
|
202
280
|
email: effect.Schema.optional(Email),
|
|
203
281
|
name: effect.Schema.optional(NonEmptyString),
|
|
204
282
|
phone: effect.Schema.optional(effect.Schema.String),
|
|
283
|
+
tier: effect.Schema.optional(effect.Schema.String),
|
|
284
|
+
merchant_customer_id: effect.Schema.optional(effect.Schema.String),
|
|
205
285
|
metadata: effect.Schema.optional(Metadata)
|
|
206
286
|
});
|
|
207
287
|
var CreateSubscriptionParams = effect.Schema.Struct({
|
|
208
288
|
customer_id: CustomerId,
|
|
209
|
-
amount:
|
|
289
|
+
amount: NprAmount,
|
|
210
290
|
currency: effect.Schema.optionalWith(effect.Schema.String, { default: () => "NPR" }),
|
|
211
291
|
interval: SubscriptionInterval,
|
|
212
292
|
interval_count: effect.Schema.optional(effect.Schema.Number),
|
|
213
293
|
project_id: effect.Schema.optional(ProjectId),
|
|
294
|
+
customer_email: effect.Schema.optional(effect.Schema.String),
|
|
214
295
|
auto_send_link: effect.Schema.optional(effect.Schema.Boolean),
|
|
215
296
|
metadata: effect.Schema.optional(Metadata)
|
|
216
297
|
});
|
|
217
298
|
var CallbackQueryParams = effect.Schema.Struct({
|
|
218
299
|
payment_id: effect.Schema.optional(effect.Schema.String),
|
|
219
300
|
data: effect.Schema.optional(effect.Schema.String),
|
|
220
|
-
pidx: effect.Schema.optional(effect.Schema.String)
|
|
301
|
+
pidx: effect.Schema.optional(effect.Schema.String),
|
|
302
|
+
/** HamroPay-specific: the gateway's own transactionId returned on callback. */
|
|
303
|
+
ref_id: effect.Schema.optional(effect.Schema.String)
|
|
221
304
|
});
|
|
222
305
|
var ListSubscriptionsParams = effect.Schema.Struct({
|
|
223
306
|
limit: effect.Schema.optional(effect.Schema.NumberFromString),
|
|
@@ -235,7 +318,8 @@ var PayArkConfig = effect.Schema.Struct({
|
|
|
235
318
|
baseUrl: effect.Schema.optional(effect.Schema.String),
|
|
236
319
|
timeout: effect.Schema.optional(effect.Schema.Number),
|
|
237
320
|
maxRetries: effect.Schema.optional(effect.Schema.Number),
|
|
238
|
-
sandbox: effect.Schema.optional(effect.Schema.Boolean)
|
|
321
|
+
sandbox: effect.Schema.optional(effect.Schema.Boolean),
|
|
322
|
+
signingPrivateKey: effect.Schema.optional(effect.Schema.String)
|
|
239
323
|
});
|
|
240
324
|
var PayArkErrorBody = effect.Schema.Struct({
|
|
241
325
|
error: effect.Schema.String,
|
|
@@ -245,21 +329,30 @@ var IndustrialError = class extends effect.Schema.TaggedError()(
|
|
|
245
329
|
"IndustrialError",
|
|
246
330
|
{
|
|
247
331
|
error: effect.Schema.String,
|
|
248
|
-
details: effect.Schema.optional(effect.Schema.Any)
|
|
332
|
+
details: effect.Schema.optional(effect.Schema.Any),
|
|
333
|
+
code: effect.Schema.optional(effect.Schema.String),
|
|
334
|
+
doc_url: effect.Schema.optional(effect.Schema.String),
|
|
335
|
+
suggestion: effect.Schema.optional(effect.Schema.String)
|
|
249
336
|
}
|
|
250
337
|
) {
|
|
251
338
|
};
|
|
252
339
|
var AuthenticationError = class extends effect.Schema.TaggedError()(
|
|
253
340
|
"AuthenticationError",
|
|
254
341
|
{
|
|
255
|
-
error: effect.Schema.String
|
|
342
|
+
error: effect.Schema.String,
|
|
343
|
+
code: effect.Schema.optional(effect.Schema.String),
|
|
344
|
+
doc_url: effect.Schema.optional(effect.Schema.String),
|
|
345
|
+
suggestion: effect.Schema.optional(effect.Schema.String)
|
|
256
346
|
}
|
|
257
347
|
) {
|
|
258
348
|
};
|
|
259
349
|
var NotFoundError = class extends effect.Schema.TaggedError()(
|
|
260
350
|
"NotFoundError",
|
|
261
351
|
{
|
|
262
|
-
error: effect.Schema.String
|
|
352
|
+
error: effect.Schema.String,
|
|
353
|
+
code: effect.Schema.optional(effect.Schema.String),
|
|
354
|
+
doc_url: effect.Schema.optional(effect.Schema.String),
|
|
355
|
+
suggestion: effect.Schema.optional(effect.Schema.String)
|
|
263
356
|
}
|
|
264
357
|
) {
|
|
265
358
|
};
|
|
@@ -267,14 +360,43 @@ var InternalServerError = class extends effect.Schema.TaggedError()(
|
|
|
267
360
|
"InternalServerError",
|
|
268
361
|
{
|
|
269
362
|
error: effect.Schema.String,
|
|
270
|
-
details: effect.Schema.optional(effect.Schema.Any)
|
|
363
|
+
details: effect.Schema.optional(effect.Schema.Any),
|
|
364
|
+
code: effect.Schema.optional(effect.Schema.String),
|
|
365
|
+
doc_url: effect.Schema.optional(effect.Schema.String),
|
|
366
|
+
suggestion: effect.Schema.optional(effect.Schema.String)
|
|
271
367
|
}
|
|
272
368
|
) {
|
|
273
369
|
};
|
|
274
370
|
var ConflictError = class extends effect.Schema.TaggedError()(
|
|
275
371
|
"ConflictError",
|
|
276
372
|
{
|
|
277
|
-
error: effect.Schema.String
|
|
373
|
+
error: effect.Schema.String,
|
|
374
|
+
code: effect.Schema.optional(effect.Schema.String),
|
|
375
|
+
doc_url: effect.Schema.optional(effect.Schema.String),
|
|
376
|
+
suggestion: effect.Schema.optional(effect.Schema.String)
|
|
377
|
+
}
|
|
378
|
+
) {
|
|
379
|
+
};
|
|
380
|
+
var MandateViolationError = class extends effect.Schema.TaggedError()(
|
|
381
|
+
"MandateViolationError",
|
|
382
|
+
{
|
|
383
|
+
error: effect.Schema.String,
|
|
384
|
+
mandateId: effect.Schema.optional(effect.Schema.String),
|
|
385
|
+
code: effect.Schema.optional(effect.Schema.String),
|
|
386
|
+
doc_url: effect.Schema.optional(effect.Schema.String),
|
|
387
|
+
suggestion: effect.Schema.optional(effect.Schema.String)
|
|
388
|
+
}
|
|
389
|
+
) {
|
|
390
|
+
};
|
|
391
|
+
var MandateExpiredError = class extends effect.Schema.TaggedError()(
|
|
392
|
+
"MandateExpiredError",
|
|
393
|
+
{
|
|
394
|
+
error: effect.Schema.String,
|
|
395
|
+
mandateId: MandateId,
|
|
396
|
+
expiredAt: Timestamp,
|
|
397
|
+
code: effect.Schema.optional(effect.Schema.String),
|
|
398
|
+
doc_url: effect.Schema.optional(effect.Schema.String),
|
|
399
|
+
suggestion: effect.Schema.optional(effect.Schema.String)
|
|
278
400
|
}
|
|
279
401
|
) {
|
|
280
402
|
};
|
|
@@ -365,7 +487,22 @@ var AutomationGroup = platform.HttpApiGroup.make("automation").add(
|
|
|
365
487
|
platform.HttpApiEndpoint.post("reaper", "/reaper").addSuccess(
|
|
366
488
|
effect.Schema.Struct({
|
|
367
489
|
message: effect.Schema.String,
|
|
368
|
-
count: effect.Schema.Number
|
|
490
|
+
count: effect.Schema.Number,
|
|
491
|
+
purged_projects: effect.Schema.Number
|
|
492
|
+
})
|
|
493
|
+
).addError(InternalServerError, { status: 500 })
|
|
494
|
+
).add(
|
|
495
|
+
platform.HttpApiEndpoint.post("processRenewals", "/process-renewals").addSuccess(
|
|
496
|
+
effect.Schema.Struct({
|
|
497
|
+
message: effect.Schema.String,
|
|
498
|
+
emails_sent: effect.Schema.Number
|
|
499
|
+
})
|
|
500
|
+
).addError(InternalServerError, { status: 500 })
|
|
501
|
+
).add(
|
|
502
|
+
platform.HttpApiEndpoint.post("processGracePeriod", "/process-grace-period").addSuccess(
|
|
503
|
+
effect.Schema.Struct({
|
|
504
|
+
message: effect.Schema.String,
|
|
505
|
+
marked_past_due: effect.Schema.Number
|
|
369
506
|
})
|
|
370
507
|
).addError(InternalServerError, { status: 500 })
|
|
371
508
|
).prefix("/v1/automation").middleware(CronSecurity);
|
|
@@ -391,10 +528,30 @@ var TokensGroup = platform.HttpApiGroup.make("tokens").add(
|
|
|
391
528
|
).prefix("/v1/tokens").middleware(UserSecurity);
|
|
392
529
|
var ProjectsGroup = platform.HttpApiGroup.make("projects").add(
|
|
393
530
|
platform.HttpApiEndpoint.get("list", "/").addSuccess(effect.Schema.Array(Project)).addError(AuthenticationError, { status: 401 }).addError(InternalServerError, { status: 500 })
|
|
394
|
-
).
|
|
531
|
+
).add(
|
|
532
|
+
platform.HttpApiEndpoint.post("upgrade", "/:id/upgrade").addSuccess(Project).setPath(effect.Schema.Struct({ id: ProjectId })).setPayload(effect.Schema.Struct({ tier: effect.Schema.Literal("pro", "enterprise") })).addError(AuthenticationError, { status: 401 }).addError(InternalServerError, { status: 500 })
|
|
533
|
+
).prefix("/v1/projects").middleware(UserSecurity);
|
|
534
|
+
var PaymentCallbackQueryParams = effect.Schema.Struct({
|
|
535
|
+
payment_id: effect.Schema.optional(effect.Schema.String),
|
|
536
|
+
data: effect.Schema.optional(effect.Schema.String),
|
|
537
|
+
pidx: effect.Schema.optional(effect.Schema.String),
|
|
538
|
+
/** HamroPay-specific: the gateway's own transactionId returned on callback. */
|
|
539
|
+
ref_id: effect.Schema.optional(effect.Schema.String),
|
|
540
|
+
/** Supabase Auth: access_token and refresh_token can be in the fragment or query */
|
|
541
|
+
access_token: effect.Schema.optional(effect.Schema.String),
|
|
542
|
+
refresh_token: effect.Schema.optional(effect.Schema.String),
|
|
543
|
+
code: effect.Schema.optional(effect.Schema.String)
|
|
544
|
+
});
|
|
395
545
|
var CallbacksGroup = platform.HttpApiGroup.make("callbacks").add(
|
|
396
|
-
platform.HttpApiEndpoint.get("handle", "/:provider").addSuccess(effect.Schema.Any).setPath(effect.Schema.Struct({ provider: effect.Schema.String })).setUrlParams(
|
|
546
|
+
platform.HttpApiEndpoint.get("handle", "/:provider").addSuccess(effect.Schema.Any).setPath(effect.Schema.Struct({ provider: effect.Schema.String })).setUrlParams(PaymentCallbackQueryParams).addError(NotFoundError, { status: 404 }).addError(InternalServerError, { status: 500 }).addError(IndustrialError, { status: 400 })
|
|
397
547
|
).prefix("/v1/callback");
|
|
548
|
+
var AuthCallbackQueryParams = effect.Schema.Struct({
|
|
549
|
+
code: effect.Schema.optional(effect.Schema.String),
|
|
550
|
+
next: effect.Schema.optional(effect.Schema.String)
|
|
551
|
+
});
|
|
552
|
+
var AuthGroup = platform.HttpApiGroup.make("auth").add(
|
|
553
|
+
platform.HttpApiEndpoint.post("callback", "/callback").addSuccess(effect.Schema.Any).setUrlParams(AuthCallbackQueryParams).addError(AuthenticationError, { status: 401 }).addError(InternalServerError, { status: 500 })
|
|
554
|
+
).prefix("/auth");
|
|
398
555
|
var RealtimeGroup = platform.HttpApiGroup.make("realtime").add(
|
|
399
556
|
platform.HttpApiEndpoint.get("connect", "/").addSuccess(effect.Schema.Any).setUrlParams(effect.Schema.Struct({ token: effect.Schema.String })).addError(AuthenticationError, { status: 401 }).addError(InternalServerError, { status: 500 })
|
|
400
557
|
).add(
|
|
@@ -405,22 +562,92 @@ var RealtimeGroup = platform.HttpApiGroup.make("realtime").add(
|
|
|
405
562
|
})
|
|
406
563
|
).setPayload(RealtimeTriggerPayload).setUrlParams(effect.Schema.Struct({ token: effect.Schema.optional(effect.Schema.String) })).addError(AuthenticationError, { status: 401 }).addError(InternalServerError, { status: 500 })
|
|
407
564
|
).prefix("/v1/realtime");
|
|
408
|
-
var
|
|
565
|
+
var MandatesGroup = platform.HttpApiGroup.make("mandates").add(
|
|
566
|
+
platform.HttpApiEndpoint.post("registerIntent", "/intent").addSuccess(Mandate, { status: 201 }).setPayload(
|
|
567
|
+
effect.Schema.Struct({
|
|
568
|
+
principal_id: effect.Schema.String,
|
|
569
|
+
max_amount: effect.Schema.Number,
|
|
570
|
+
currency: effect.Schema.String,
|
|
571
|
+
valid_until: Timestamp,
|
|
572
|
+
permitted_vendors: effect.Schema.optional(effect.Schema.Array(effect.Schema.String)),
|
|
573
|
+
credential_jwt: effect.Schema.String,
|
|
574
|
+
public_key: effect.Schema.String,
|
|
575
|
+
customer_id: effect.Schema.optional(CustomerId)
|
|
576
|
+
})
|
|
577
|
+
).addError(AuthenticationError, { status: 401 }).addError(IndustrialError, { status: 400 })
|
|
578
|
+
).add(
|
|
579
|
+
platform.HttpApiEndpoint.get("retrieve", "/:id").addSuccess(Mandate).setPath(effect.Schema.Struct({ id: MandateId })).addError(AuthenticationError, { status: 401 }).addError(NotFoundError, { status: 404 })
|
|
580
|
+
).prefix("/v1/mandates").middleware(SecurityMiddleware);
|
|
581
|
+
var SandboxGroup = platform.HttpApiGroup.make("sandbox").add(
|
|
582
|
+
platform.HttpApiEndpoint.post("init", "/init").addSuccess(
|
|
583
|
+
effect.Schema.Struct({
|
|
584
|
+
projectId: effect.Schema.String,
|
|
585
|
+
apiKey: effect.Schema.optional(effect.Schema.String),
|
|
586
|
+
expiresAt: Timestamp,
|
|
587
|
+
session: effect.Schema.optional(
|
|
588
|
+
effect.Schema.Struct({
|
|
589
|
+
access_token: effect.Schema.String,
|
|
590
|
+
refresh_token: effect.Schema.String
|
|
591
|
+
})
|
|
592
|
+
)
|
|
593
|
+
})
|
|
594
|
+
).addError(InternalServerError, { status: 500 })
|
|
595
|
+
).prefix("/v1/sandbox").middleware(UserSecurity);
|
|
596
|
+
var DiscoveryGroup = platform.HttpApiGroup.make("discovery").add(
|
|
597
|
+
platform.HttpApiEndpoint.get("agentCard", "/agent.json").addSuccess(effect.Schema.Any).addError(InternalServerError, { status: 500 })
|
|
598
|
+
).prefix("/.well-known");
|
|
599
|
+
var SigningKeysGroup = platform.HttpApiGroup.make("signingKeys").add(
|
|
600
|
+
platform.HttpApiEndpoint.post("generate", "/").addSuccess(
|
|
601
|
+
effect.Schema.Struct({
|
|
602
|
+
id: effect.Schema.String,
|
|
603
|
+
publicKey: effect.Schema.String,
|
|
604
|
+
privateKey: effect.Schema.String,
|
|
605
|
+
algorithm: effect.Schema.String,
|
|
606
|
+
createdAt: Timestamp
|
|
607
|
+
}),
|
|
608
|
+
{ status: 201 }
|
|
609
|
+
).setPath(effect.Schema.Struct({ id: ProjectId })).addError(AuthenticationError, { status: 401 }).addError(NotFoundError, { status: 404 }).addError(InternalServerError, { status: 500 })
|
|
610
|
+
).add(
|
|
611
|
+
platform.HttpApiEndpoint.get("get", "/").addSuccess(
|
|
612
|
+
effect.Schema.Struct({
|
|
613
|
+
id: effect.Schema.String,
|
|
614
|
+
publicKey: effect.Schema.String,
|
|
615
|
+
algorithm: effect.Schema.String,
|
|
616
|
+
createdAt: Timestamp
|
|
617
|
+
})
|
|
618
|
+
).setPath(effect.Schema.Struct({ id: ProjectId })).addError(AuthenticationError, { status: 401 }).addError(NotFoundError, { status: 404 }).addError(InternalServerError, { status: 500 })
|
|
619
|
+
).prefix("/v1/projects/:id/signing-keys").middleware(UserSecurity);
|
|
620
|
+
var PayArkApi = platform.HttpApi.make("PayArkApi").add(CheckoutGroup).add(PaymentsGroup).add(CustomersGroup).add(SubscriptionsGroup).add(AutomationGroup).add(TokensGroup).add(ProjectsGroup).add(CallbacksGroup).add(AuthGroup).add(MandatesGroup).add(DiscoveryGroup).add(RealtimeGroup).add(SandboxGroup).add(SigningKeysGroup).addError(AuthenticationError, { status: 401 }).addError(NotFoundError, { status: 404 }).addError(MandateViolationError, { status: 403 }).addError(MandateExpiredError, { status: 410 }).addError(ConflictError, { status: 409 }).addError(InternalServerError, { status: 500 }).addError(IndustrialError, { status: 400 });
|
|
409
621
|
var PayArkEffectError = class extends effect.Data.TaggedError("PayArkEffectError") {
|
|
410
622
|
/** Human-readable representation for logging/debugging. */
|
|
411
623
|
toString() {
|
|
412
|
-
return `[PayArkEffectError: ${this.code}] ${this.message} (HTTP ${this.statusCode})`;
|
|
624
|
+
return `[PayArkEffectError: ${this.code}] ${this.localizedMessage || this.message} (HTTP ${this.statusCode})`;
|
|
413
625
|
}
|
|
414
626
|
};
|
|
627
|
+
var MandateViolationError2 = class extends effect.Data.TaggedError(
|
|
628
|
+
"MandateViolationError"
|
|
629
|
+
) {
|
|
630
|
+
statusCode = 403;
|
|
631
|
+
code = "mandate_violation";
|
|
632
|
+
};
|
|
633
|
+
var MandateExpiredError2 = class extends effect.Data.TaggedError(
|
|
634
|
+
"MandateExpiredError"
|
|
635
|
+
) {
|
|
636
|
+
statusCode = 410;
|
|
637
|
+
code = "mandate_expired";
|
|
638
|
+
};
|
|
415
639
|
|
|
416
640
|
// src/http.ts
|
|
417
|
-
var SDK_VERSION = "0.1.
|
|
641
|
+
var SDK_VERSION = "0.1.8";
|
|
418
642
|
var PayArkConfigService = class extends effect.Context.Tag("PayArkConfigService")() {
|
|
419
643
|
};
|
|
420
644
|
var request = (method, path, options) => effect.Effect.gen(function* (_) {
|
|
421
645
|
const config = yield* _(PayArkConfigService);
|
|
422
646
|
const client = yield* _(platform.HttpClient.HttpClient);
|
|
423
|
-
const baseUrl = (config.baseUrl ?? "https://
|
|
647
|
+
const baseUrl = (config.baseUrl ?? "https://api.payark.dev").replace(
|
|
648
|
+
/\/+$/,
|
|
649
|
+
""
|
|
650
|
+
);
|
|
424
651
|
const url = new URL(`${baseUrl}${path}`);
|
|
425
652
|
if (options?.query) {
|
|
426
653
|
for (const [key, value] of Object.entries(options.query)) {
|
|
@@ -449,7 +676,8 @@ var request = (method, path, options) => effect.Effect.gen(function* (_) {
|
|
|
449
676
|
(e) => new PayArkEffectError({
|
|
450
677
|
message: `Invalid request body: ${String(e)}`,
|
|
451
678
|
statusCode: 400,
|
|
452
|
-
code: "invalid_request_error"
|
|
679
|
+
code: "invalid_request_error",
|
|
680
|
+
localizedMessage: getLocalizedError("invalid_request_error")
|
|
453
681
|
})
|
|
454
682
|
)
|
|
455
683
|
)
|
|
@@ -461,7 +689,8 @@ var request = (method, path, options) => effect.Effect.gen(function* (_) {
|
|
|
461
689
|
(e) => new PayArkEffectError({
|
|
462
690
|
message: `Network error: ${e.message}`,
|
|
463
691
|
statusCode: 0,
|
|
464
|
-
code: "connection_error"
|
|
692
|
+
code: "connection_error",
|
|
693
|
+
localizedMessage: getLocalizedError("connection_error")
|
|
465
694
|
})
|
|
466
695
|
)
|
|
467
696
|
)
|
|
@@ -474,7 +703,8 @@ var request = (method, path, options) => effect.Effect.gen(function* (_) {
|
|
|
474
703
|
(e) => new PayArkEffectError({
|
|
475
704
|
message: `Failed to parse response: ${String(e)}`,
|
|
476
705
|
statusCode: response.status,
|
|
477
|
-
code: "api_error"
|
|
706
|
+
code: "api_error",
|
|
707
|
+
localizedMessage: getLocalizedError("api_error")
|
|
478
708
|
})
|
|
479
709
|
)
|
|
480
710
|
)
|
|
@@ -491,11 +721,22 @@ var request = (method, path, options) => effect.Effect.gen(function* (_) {
|
|
|
491
721
|
message: errorBody?.error || `Request failed with status ${response.status}`,
|
|
492
722
|
statusCode: response.status,
|
|
493
723
|
code: mapStatusToCode(response.status),
|
|
494
|
-
raw: errorBody
|
|
724
|
+
raw: errorBody,
|
|
725
|
+
localizedMessage: getLocalizedError(mapStatusToCode(response.status))
|
|
495
726
|
})
|
|
496
727
|
)
|
|
497
728
|
);
|
|
498
|
-
})
|
|
729
|
+
}).pipe(
|
|
730
|
+
effect.Effect.retry(
|
|
731
|
+
effect.Schedule.exponential("200 millis").pipe(
|
|
732
|
+
effect.Schedule.upTo("5 seconds"),
|
|
733
|
+
// Only retry connection-level or 429/5xx transient errors:
|
|
734
|
+
effect.Schedule.check((error) => {
|
|
735
|
+
return error.code === "connection_error" || error.code === "rate_limit_error" || error.statusCode >= 500;
|
|
736
|
+
})
|
|
737
|
+
)
|
|
738
|
+
)
|
|
739
|
+
);
|
|
499
740
|
function mapStatusToCode(status) {
|
|
500
741
|
if (status === 401) return "authentication_error";
|
|
501
742
|
if (status === 403) return "permission_error";
|
|
@@ -505,6 +746,26 @@ function mapStatusToCode(status) {
|
|
|
505
746
|
if (status >= 500) return "api_error";
|
|
506
747
|
return "unknown_error";
|
|
507
748
|
}
|
|
749
|
+
function getLocalizedError(code) {
|
|
750
|
+
switch (code) {
|
|
751
|
+
case "authentication_error":
|
|
752
|
+
return "Your API key is missing or invalid. Please check your PayArk credentials.";
|
|
753
|
+
case "permission_error":
|
|
754
|
+
return "You don't have permission to perform this action.";
|
|
755
|
+
case "invalid_request_error":
|
|
756
|
+
return "The request is missing required parameters or they are invalid. Please check your implementation.";
|
|
757
|
+
case "not_found_error":
|
|
758
|
+
return "The requested resource could not be found.";
|
|
759
|
+
case "rate_limit_error":
|
|
760
|
+
return "You are making too many requests to PayArk. Please wait a moment before trying again.";
|
|
761
|
+
case "api_error":
|
|
762
|
+
return "PayArk servers are currently experiencing issues. Please try again later.";
|
|
763
|
+
case "connection_error":
|
|
764
|
+
return "Could not connect to PayArk. Please check your internet connection.";
|
|
765
|
+
default:
|
|
766
|
+
return "An unexpected error occurred. Please contact support if the issue persists.";
|
|
767
|
+
}
|
|
768
|
+
}
|
|
508
769
|
|
|
509
770
|
// src/resources/checkout.ts
|
|
510
771
|
var CheckoutEffect = class {
|
|
@@ -578,6 +839,261 @@ var ProjectsEffect = class {
|
|
|
578
839
|
);
|
|
579
840
|
}
|
|
580
841
|
};
|
|
842
|
+
var CustomersEffect = class {
|
|
843
|
+
constructor(config) {
|
|
844
|
+
this.config = config;
|
|
845
|
+
}
|
|
846
|
+
/**
|
|
847
|
+
* Create a new customer for a project.
|
|
848
|
+
*/
|
|
849
|
+
create(params) {
|
|
850
|
+
return request("POST", "/v1/customers", { body: params }).pipe(
|
|
851
|
+
effect.Effect.flatMap(effect.Schema.decodeUnknown(Customer)),
|
|
852
|
+
effect.Effect.provideService(PayArkConfigService, this.config)
|
|
853
|
+
);
|
|
854
|
+
}
|
|
855
|
+
/**
|
|
856
|
+
* List customers for the authenticated project.
|
|
857
|
+
*/
|
|
858
|
+
list(params = {}) {
|
|
859
|
+
return request("GET", "/v1/customers", {
|
|
860
|
+
query: {
|
|
861
|
+
limit: params.limit,
|
|
862
|
+
offset: params.offset,
|
|
863
|
+
projectId: params.projectId,
|
|
864
|
+
email: params.email,
|
|
865
|
+
merchant_customer_id: params.merchant_customer_id
|
|
866
|
+
}
|
|
867
|
+
}).pipe(
|
|
868
|
+
effect.Effect.flatMap(effect.Schema.decodeUnknown(PaginatedResponse(Customer))),
|
|
869
|
+
effect.Effect.provideService(PayArkConfigService, this.config)
|
|
870
|
+
);
|
|
871
|
+
}
|
|
872
|
+
/**
|
|
873
|
+
* Retrieve a single customer by ID.
|
|
874
|
+
*/
|
|
875
|
+
retrieve(id) {
|
|
876
|
+
return request(
|
|
877
|
+
"GET",
|
|
878
|
+
`/v1/customers/${encodeURIComponent(id)}`
|
|
879
|
+
).pipe(
|
|
880
|
+
effect.Effect.flatMap(effect.Schema.decodeUnknown(Customer)),
|
|
881
|
+
effect.Effect.provideService(PayArkConfigService, this.config)
|
|
882
|
+
);
|
|
883
|
+
}
|
|
884
|
+
/**
|
|
885
|
+
* Update a customer.
|
|
886
|
+
*/
|
|
887
|
+
update(id, params) {
|
|
888
|
+
return request(
|
|
889
|
+
"PATCH",
|
|
890
|
+
`/v1/customers/${encodeURIComponent(id)}`,
|
|
891
|
+
{
|
|
892
|
+
body: params
|
|
893
|
+
}
|
|
894
|
+
).pipe(
|
|
895
|
+
effect.Effect.flatMap(effect.Schema.decodeUnknown(Customer)),
|
|
896
|
+
effect.Effect.provideService(PayArkConfigService, this.config)
|
|
897
|
+
);
|
|
898
|
+
}
|
|
899
|
+
/**
|
|
900
|
+
* Delete a customer.
|
|
901
|
+
*/
|
|
902
|
+
delete(id) {
|
|
903
|
+
return request(
|
|
904
|
+
"DELETE",
|
|
905
|
+
`/v1/customers/${encodeURIComponent(id)}`
|
|
906
|
+
).pipe(effect.Effect.provideService(PayArkConfigService, this.config));
|
|
907
|
+
}
|
|
908
|
+
};
|
|
909
|
+
var SubscriptionsEffect = class {
|
|
910
|
+
constructor(config) {
|
|
911
|
+
this.config = config;
|
|
912
|
+
}
|
|
913
|
+
/**
|
|
914
|
+
* Create a new subscription.
|
|
915
|
+
*/
|
|
916
|
+
create(params) {
|
|
917
|
+
return request("POST", "/v1/subscriptions", { body: params }).pipe(
|
|
918
|
+
effect.Effect.flatMap(effect.Schema.decodeUnknown(Subscription)),
|
|
919
|
+
effect.Effect.provideService(PayArkConfigService, this.config)
|
|
920
|
+
);
|
|
921
|
+
}
|
|
922
|
+
/**
|
|
923
|
+
* List subscriptions for the authenticated project.
|
|
924
|
+
*/
|
|
925
|
+
list(params = {}) {
|
|
926
|
+
return request("GET", "/v1/subscriptions", {
|
|
927
|
+
query: {
|
|
928
|
+
limit: params.limit,
|
|
929
|
+
offset: params.offset,
|
|
930
|
+
projectId: params.projectId,
|
|
931
|
+
customerId: params.customerId,
|
|
932
|
+
status: params.status
|
|
933
|
+
}
|
|
934
|
+
}).pipe(
|
|
935
|
+
effect.Effect.flatMap(effect.Schema.decodeUnknown(PaginatedResponse(Subscription))),
|
|
936
|
+
effect.Effect.provideService(PayArkConfigService, this.config)
|
|
937
|
+
);
|
|
938
|
+
}
|
|
939
|
+
/**
|
|
940
|
+
* Retrieve a single subscription by ID.
|
|
941
|
+
*/
|
|
942
|
+
retrieve(id) {
|
|
943
|
+
return request(
|
|
944
|
+
"GET",
|
|
945
|
+
`/v1/subscriptions/${encodeURIComponent(id)}`
|
|
946
|
+
).pipe(
|
|
947
|
+
effect.Effect.flatMap(effect.Schema.decodeUnknown(Subscription)),
|
|
948
|
+
effect.Effect.provideService(PayArkConfigService, this.config)
|
|
949
|
+
);
|
|
950
|
+
}
|
|
951
|
+
/**
|
|
952
|
+
* Cancel a subscription.
|
|
953
|
+
*/
|
|
954
|
+
cancel(id) {
|
|
955
|
+
return request(
|
|
956
|
+
"POST",
|
|
957
|
+
`/v1/subscriptions/${encodeURIComponent(id)}/cancel`
|
|
958
|
+
).pipe(
|
|
959
|
+
effect.Effect.flatMap(effect.Schema.decodeUnknown(Subscription)),
|
|
960
|
+
effect.Effect.provideService(PayArkConfigService, this.config)
|
|
961
|
+
);
|
|
962
|
+
}
|
|
963
|
+
/**
|
|
964
|
+
* Activate a subscription (returns payment info).
|
|
965
|
+
*/
|
|
966
|
+
activate(id, params) {
|
|
967
|
+
const activateSchema = effect.Schema.Struct({
|
|
968
|
+
checkout_url: effect.Schema.String,
|
|
969
|
+
payment_id: effect.Schema.String
|
|
970
|
+
});
|
|
971
|
+
return request(
|
|
972
|
+
"POST",
|
|
973
|
+
`/v1/subscriptions/${encodeURIComponent(id)}/activate`,
|
|
974
|
+
{ body: params }
|
|
975
|
+
).pipe(
|
|
976
|
+
effect.Effect.flatMap(effect.Schema.decodeUnknown(activateSchema)),
|
|
977
|
+
effect.Effect.provideService(PayArkConfigService, this.config)
|
|
978
|
+
);
|
|
979
|
+
}
|
|
980
|
+
};
|
|
981
|
+
var MandatesEffect = class {
|
|
982
|
+
constructor(config) {
|
|
983
|
+
this.config = config;
|
|
984
|
+
}
|
|
985
|
+
/**
|
|
986
|
+
* Register a mandate intent.
|
|
987
|
+
*/
|
|
988
|
+
registerIntent(params) {
|
|
989
|
+
return request("POST", "/v1/mandates/intent", {
|
|
990
|
+
body: params
|
|
991
|
+
}).pipe(
|
|
992
|
+
effect.Effect.flatMap(effect.Schema.decodeUnknown(Mandate)),
|
|
993
|
+
effect.Effect.provideService(PayArkConfigService, this.config)
|
|
994
|
+
);
|
|
995
|
+
}
|
|
996
|
+
/**
|
|
997
|
+
* Retrieve a mandate.
|
|
998
|
+
*/
|
|
999
|
+
retrieve(id) {
|
|
1000
|
+
return request(
|
|
1001
|
+
"GET",
|
|
1002
|
+
`/v1/mandates/${encodeURIComponent(id)}`
|
|
1003
|
+
).pipe(
|
|
1004
|
+
effect.Effect.flatMap(effect.Schema.decodeUnknown(Mandate)),
|
|
1005
|
+
effect.Effect.provideService(PayArkConfigService, this.config)
|
|
1006
|
+
);
|
|
1007
|
+
}
|
|
1008
|
+
};
|
|
1009
|
+
var TokensEffect = class {
|
|
1010
|
+
constructor(config) {
|
|
1011
|
+
this.config = config;
|
|
1012
|
+
}
|
|
1013
|
+
/**
|
|
1014
|
+
* Create a new token.
|
|
1015
|
+
*/
|
|
1016
|
+
create(params) {
|
|
1017
|
+
const createTokenSchema = effect.Schema.Struct({
|
|
1018
|
+
...Token.fields,
|
|
1019
|
+
token: effect.Schema.String
|
|
1020
|
+
});
|
|
1021
|
+
return request("POST", "/v1/tokens", { body: params }).pipe(
|
|
1022
|
+
effect.Effect.flatMap(effect.Schema.decodeUnknown(createTokenSchema)),
|
|
1023
|
+
effect.Effect.provideService(PayArkConfigService, this.config)
|
|
1024
|
+
);
|
|
1025
|
+
}
|
|
1026
|
+
/**
|
|
1027
|
+
* List all tokens.
|
|
1028
|
+
*/
|
|
1029
|
+
list() {
|
|
1030
|
+
return request("GET", "/v1/tokens").pipe(
|
|
1031
|
+
effect.Effect.flatMap(effect.Schema.decodeUnknown(effect.Schema.Array(Token))),
|
|
1032
|
+
effect.Effect.provideService(PayArkConfigService, this.config)
|
|
1033
|
+
);
|
|
1034
|
+
}
|
|
1035
|
+
/**
|
|
1036
|
+
* Delete/revoke a token.
|
|
1037
|
+
*/
|
|
1038
|
+
delete(id) {
|
|
1039
|
+
return request("DELETE", `/v1/tokens/${encodeURIComponent(id)}`).pipe(
|
|
1040
|
+
effect.Effect.provideService(PayArkConfigService, this.config)
|
|
1041
|
+
);
|
|
1042
|
+
}
|
|
1043
|
+
};
|
|
1044
|
+
var RealtimeEffect = class {
|
|
1045
|
+
constructor(config) {
|
|
1046
|
+
this.config = config;
|
|
1047
|
+
}
|
|
1048
|
+
/**
|
|
1049
|
+
* Manually trigger a realtime event.
|
|
1050
|
+
*/
|
|
1051
|
+
trigger(params) {
|
|
1052
|
+
const triggerSchema = effect.Schema.Struct({
|
|
1053
|
+
status: effect.Schema.String,
|
|
1054
|
+
event: effect.Schema.optional(effect.Schema.String)
|
|
1055
|
+
});
|
|
1056
|
+
return request("POST", "/v1/realtime/trigger", {
|
|
1057
|
+
body: params,
|
|
1058
|
+
query: { token: params.token }
|
|
1059
|
+
}).pipe(
|
|
1060
|
+
effect.Effect.flatMap(effect.Schema.decodeUnknown(triggerSchema)),
|
|
1061
|
+
effect.Effect.provideService(PayArkConfigService, this.config)
|
|
1062
|
+
);
|
|
1063
|
+
}
|
|
1064
|
+
};
|
|
1065
|
+
var AutomationEffect = class {
|
|
1066
|
+
constructor(config) {
|
|
1067
|
+
this.config = config;
|
|
1068
|
+
}
|
|
1069
|
+
/**
|
|
1070
|
+
* Send reminders.
|
|
1071
|
+
*/
|
|
1072
|
+
reminders() {
|
|
1073
|
+
const automationSchema = effect.Schema.Struct({
|
|
1074
|
+
message: effect.Schema.String,
|
|
1075
|
+
count: effect.Schema.Number
|
|
1076
|
+
});
|
|
1077
|
+
return request("POST", "/v1/automation/reminders").pipe(
|
|
1078
|
+
effect.Effect.flatMap(effect.Schema.decodeUnknown(automationSchema)),
|
|
1079
|
+
effect.Effect.provideService(PayArkConfigService, this.config)
|
|
1080
|
+
);
|
|
1081
|
+
}
|
|
1082
|
+
/**
|
|
1083
|
+
* Run reaper.
|
|
1084
|
+
*/
|
|
1085
|
+
reaper() {
|
|
1086
|
+
const reaperSchema = effect.Schema.Struct({
|
|
1087
|
+
message: effect.Schema.String,
|
|
1088
|
+
count: effect.Schema.Number,
|
|
1089
|
+
purged_projects: effect.Schema.Number
|
|
1090
|
+
});
|
|
1091
|
+
return request("POST", "/v1/automation/reaper").pipe(
|
|
1092
|
+
effect.Effect.flatMap(effect.Schema.decodeUnknown(reaperSchema)),
|
|
1093
|
+
effect.Effect.provideService(PayArkConfigService, this.config)
|
|
1094
|
+
);
|
|
1095
|
+
}
|
|
1096
|
+
};
|
|
581
1097
|
|
|
582
1098
|
// src/index.ts
|
|
583
1099
|
var makeClient = (options) => platform.HttpApiClient.make(PayArkApi, options);
|
|
@@ -593,6 +1109,12 @@ var PayArkEffect = class {
|
|
|
593
1109
|
_checkout;
|
|
594
1110
|
_payments;
|
|
595
1111
|
_projects;
|
|
1112
|
+
_customers;
|
|
1113
|
+
_subscriptions;
|
|
1114
|
+
_mandates;
|
|
1115
|
+
_tokens;
|
|
1116
|
+
_realtime;
|
|
1117
|
+
_automation;
|
|
596
1118
|
/**
|
|
597
1119
|
* Checkout sessions resource (Effect).
|
|
598
1120
|
*/
|
|
@@ -620,6 +1142,60 @@ var PayArkEffect = class {
|
|
|
620
1142
|
}
|
|
621
1143
|
return this._projects;
|
|
622
1144
|
}
|
|
1145
|
+
/**
|
|
1146
|
+
* Customers resource (Effect).
|
|
1147
|
+
*/
|
|
1148
|
+
get customers() {
|
|
1149
|
+
if (!this._customers) {
|
|
1150
|
+
this._customers = new CustomersEffect(this.config);
|
|
1151
|
+
}
|
|
1152
|
+
return this._customers;
|
|
1153
|
+
}
|
|
1154
|
+
/**
|
|
1155
|
+
* Subscriptions resource (Effect).
|
|
1156
|
+
*/
|
|
1157
|
+
get subscriptions() {
|
|
1158
|
+
if (!this._subscriptions) {
|
|
1159
|
+
this._subscriptions = new SubscriptionsEffect(this.config);
|
|
1160
|
+
}
|
|
1161
|
+
return this._subscriptions;
|
|
1162
|
+
}
|
|
1163
|
+
/**
|
|
1164
|
+
* Mandates resource (Effect).
|
|
1165
|
+
*/
|
|
1166
|
+
get mandates() {
|
|
1167
|
+
if (!this._mandates) {
|
|
1168
|
+
this._mandates = new MandatesEffect(this.config);
|
|
1169
|
+
}
|
|
1170
|
+
return this._mandates;
|
|
1171
|
+
}
|
|
1172
|
+
/**
|
|
1173
|
+
* Tokens resource (Effect).
|
|
1174
|
+
*/
|
|
1175
|
+
get tokens() {
|
|
1176
|
+
if (!this._tokens) {
|
|
1177
|
+
this._tokens = new TokensEffect(this.config);
|
|
1178
|
+
}
|
|
1179
|
+
return this._tokens;
|
|
1180
|
+
}
|
|
1181
|
+
/**
|
|
1182
|
+
* Realtime resource (Effect).
|
|
1183
|
+
*/
|
|
1184
|
+
get realtime() {
|
|
1185
|
+
if (!this._realtime) {
|
|
1186
|
+
this._realtime = new RealtimeEffect(this.config);
|
|
1187
|
+
}
|
|
1188
|
+
return this._realtime;
|
|
1189
|
+
}
|
|
1190
|
+
/**
|
|
1191
|
+
* Automation resource (Effect).
|
|
1192
|
+
*/
|
|
1193
|
+
get automation() {
|
|
1194
|
+
if (!this._automation) {
|
|
1195
|
+
this._automation = new AutomationEffect(this.config);
|
|
1196
|
+
}
|
|
1197
|
+
return this._automation;
|
|
1198
|
+
}
|
|
623
1199
|
};
|
|
624
1200
|
var PayArk = class _PayArk extends effect.Context.Tag("@payark/sdk-effect/PayArk")() {
|
|
625
1201
|
/**
|
|
@@ -628,7 +1204,11 @@ var PayArk = class _PayArk extends effect.Context.Tag("@payark/sdk-effect/PayArk
|
|
|
628
1204
|
static Live = (config) => effect.Layer.succeed(_PayArk, new PayArkEffect(config));
|
|
629
1205
|
};
|
|
630
1206
|
|
|
1207
|
+
exports.AgentSession = AgentSession;
|
|
1208
|
+
exports.AgentSessionId = AgentSessionId;
|
|
1209
|
+
exports.AuthCallbackQueryParams = AuthCallbackQueryParams;
|
|
631
1210
|
exports.AuthContext = AuthContext;
|
|
1211
|
+
exports.AuthGroup = AuthGroup;
|
|
632
1212
|
exports.AuthenticationError = AuthenticationError;
|
|
633
1213
|
exports.AutomationGroup = AutomationGroup;
|
|
634
1214
|
exports.CallbackQueryParams = CallbackQueryParams;
|
|
@@ -643,7 +1223,9 @@ exports.CreateSubscriptionParams = CreateSubscriptionParams;
|
|
|
643
1223
|
exports.CronSecurity = CronSecurity;
|
|
644
1224
|
exports.Customer = Customer;
|
|
645
1225
|
exports.CustomerId = CustomerId;
|
|
1226
|
+
exports.CustomerLifecycle = CustomerLifecycle;
|
|
646
1227
|
exports.CustomersGroup = CustomersGroup;
|
|
1228
|
+
exports.DiscoveryGroup = DiscoveryGroup;
|
|
647
1229
|
exports.Email = Email;
|
|
648
1230
|
exports.Id = Id;
|
|
649
1231
|
exports.IndustrialError = IndustrialError;
|
|
@@ -651,6 +1233,13 @@ exports.InternalServerError = InternalServerError;
|
|
|
651
1233
|
exports.ListCustomersParams = ListCustomersParams;
|
|
652
1234
|
exports.ListPaymentsParams = ListPaymentsParams;
|
|
653
1235
|
exports.ListSubscriptionsParams = ListSubscriptionsParams;
|
|
1236
|
+
exports.Mandate = Mandate;
|
|
1237
|
+
exports.MandateExpiredError = MandateExpiredError2;
|
|
1238
|
+
exports.MandateId = MandateId;
|
|
1239
|
+
exports.MandateStatus = MandateStatus;
|
|
1240
|
+
exports.MandateType = MandateType;
|
|
1241
|
+
exports.MandateViolationError = MandateViolationError2;
|
|
1242
|
+
exports.MandatesGroup = MandatesGroup;
|
|
654
1243
|
exports.Metadata = Metadata;
|
|
655
1244
|
exports.NotFoundError = NotFoundError;
|
|
656
1245
|
exports.PaginatedResponse = PaginatedResponse;
|
|
@@ -663,6 +1252,7 @@ exports.PayArkEffect = PayArkEffect;
|
|
|
663
1252
|
exports.PayArkEffectError = PayArkEffectError;
|
|
664
1253
|
exports.PayArkErrorBody = PayArkErrorBody;
|
|
665
1254
|
exports.Payment = Payment;
|
|
1255
|
+
exports.PaymentCallbackQueryParams = PaymentCallbackQueryParams;
|
|
666
1256
|
exports.PaymentId = PaymentId;
|
|
667
1257
|
exports.PaymentStatus = PaymentStatus;
|
|
668
1258
|
exports.PaymentsGroup = PaymentsGroup;
|
|
@@ -672,7 +1262,9 @@ exports.ProjectsGroup = ProjectsGroup;
|
|
|
672
1262
|
exports.Provider = Provider;
|
|
673
1263
|
exports.RealtimeGroup = RealtimeGroup;
|
|
674
1264
|
exports.RealtimeTriggerPayload = RealtimeTriggerPayload;
|
|
1265
|
+
exports.SandboxGroup = SandboxGroup;
|
|
675
1266
|
exports.SecurityMiddleware = SecurityMiddleware;
|
|
1267
|
+
exports.SigningKeysGroup = SigningKeysGroup;
|
|
676
1268
|
exports.Subscription = Subscription;
|
|
677
1269
|
exports.SubscriptionId = SubscriptionId;
|
|
678
1270
|
exports.SubscriptionInterval = SubscriptionInterval;
|