@getmanza/sdk 1.1.0 → 2.1.0
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/CHANGELOG.md +213 -0
- package/README.md +58 -9
- package/dist/client.d.ts +14 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/errors.d.ts +12 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/index.cjs +417 -7
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +417 -7
- package/dist/resources/checkout_sessions.d.ts.map +1 -1
- package/dist/resources/invoices.d.ts +0 -1
- package/dist/resources/invoices.d.ts.map +1 -1
- package/dist/resources/payment_links.d.ts.map +1 -1
- package/dist/resources/payments.d.ts.map +1 -1
- package/dist/resources/transfer_authorizer.d.ts.map +1 -1
- package/dist/resources/webhook_deliveries.d.ts +13 -0
- package/dist/resources/webhook_deliveries.d.ts.map +1 -0
- package/dist/resources/webhook_endpoints.d.ts +1 -0
- package/dist/resources/webhook_endpoints.d.ts.map +1 -1
- package/dist/resources/webhook_listeners.d.ts +17 -0
- package/dist/resources/webhook_listeners.d.ts.map +1 -0
- package/dist/transfer_authorization.d.ts +3 -2
- package/dist/transfer_authorization.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/webhook_events.d.ts +17 -0
- package/dist/webhook_events.d.ts.map +1 -0
- package/dist/webhook_listener_stream.d.ts +38 -0
- package/dist/webhook_listener_stream.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -53,12 +53,27 @@ class ManzaAuthenticationError extends ManzaError {
|
|
|
53
53
|
class ManzaForbiddenError extends ManzaError {
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
class ManzaEntityRestrictedError extends ManzaForbiddenError {
|
|
57
|
+
}
|
|
58
|
+
|
|
56
59
|
class ManzaNotFoundError extends ManzaError {
|
|
57
60
|
}
|
|
58
61
|
|
|
59
62
|
class ManzaValidationError extends ManzaError {
|
|
60
63
|
}
|
|
61
64
|
|
|
65
|
+
class ManzaPlanLimitReachedError extends ManzaValidationError {
|
|
66
|
+
kind;
|
|
67
|
+
current;
|
|
68
|
+
max;
|
|
69
|
+
constructor(message, options = {}) {
|
|
70
|
+
super(message, options);
|
|
71
|
+
this.kind = options.kind ?? null;
|
|
72
|
+
this.current = options.current ?? null;
|
|
73
|
+
this.max = options.max ?? null;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
62
77
|
class ManzaRateLimitError extends ManzaError {
|
|
63
78
|
retryAfter;
|
|
64
79
|
constructor(message, options = {}) {
|
|
@@ -295,9 +310,6 @@ class Invoices extends ResourceBase {
|
|
|
295
310
|
creditNote(id, attributes = {}) {
|
|
296
311
|
return this.httpPost(this.encodePath("api/invoices", id, "credit_note"), attributes);
|
|
297
312
|
}
|
|
298
|
-
createPaymentLink(id, attributes = {}) {
|
|
299
|
-
return this.httpPost(this.encodePath("api/invoices", id, "payment_link"), attributes);
|
|
300
|
-
}
|
|
301
313
|
}
|
|
302
314
|
|
|
303
315
|
// src/resources/payee_trust_requests.ts
|
|
@@ -361,6 +373,21 @@ class TransferAuthorizer extends ResourceBase {
|
|
|
361
373
|
}
|
|
362
374
|
}
|
|
363
375
|
|
|
376
|
+
// src/resources/webhook_deliveries.ts
|
|
377
|
+
class WebhookDeliveries extends ResourceBase {
|
|
378
|
+
static STATUSES = ["pending", "succeeded", "failed"];
|
|
379
|
+
list(endpointId, params = {}) {
|
|
380
|
+
const { limit, cursor, status } = params;
|
|
381
|
+
return this.listPage(this.encodePath("api/webhook_endpoints", endpointId, "deliveries"), { status }, { limit, cursor });
|
|
382
|
+
}
|
|
383
|
+
get(id) {
|
|
384
|
+
return this.httpGet(this.encodePath("api/webhook_deliveries", id));
|
|
385
|
+
}
|
|
386
|
+
retry(id) {
|
|
387
|
+
return this.httpPost(this.encodePath("api/webhook_deliveries", id, "retry"));
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
|
|
364
391
|
// src/resources/webhook_endpoints.ts
|
|
365
392
|
class WebhookEndpoints extends ResourceBase {
|
|
366
393
|
list(params = {}) {
|
|
@@ -388,6 +415,9 @@ class WebhookEndpoints extends ResourceBase {
|
|
|
388
415
|
enable(id) {
|
|
389
416
|
return this.httpPost(this.encodePath("api/webhook_endpoints", id, "enable"));
|
|
390
417
|
}
|
|
418
|
+
retryFailed(id) {
|
|
419
|
+
return this.httpPost(this.encodePath("api/webhook_endpoints", id, "retry_failed"));
|
|
420
|
+
}
|
|
391
421
|
disable(id) {
|
|
392
422
|
return this.httpPost(this.encodePath("api/webhook_endpoints", id, "disable"));
|
|
393
423
|
}
|
|
@@ -413,8 +443,306 @@ class ManzaResponse {
|
|
|
413
443
|
}
|
|
414
444
|
}
|
|
415
445
|
|
|
446
|
+
// src/webhook_listener_stream.ts
|
|
447
|
+
class ListenerEvent {
|
|
448
|
+
type = "webhook";
|
|
449
|
+
id;
|
|
450
|
+
eventType;
|
|
451
|
+
eventId;
|
|
452
|
+
body;
|
|
453
|
+
streamId;
|
|
454
|
+
constructor(fields) {
|
|
455
|
+
this.id = fields.id;
|
|
456
|
+
this.eventType = fields.eventType;
|
|
457
|
+
this.eventId = fields.eventId;
|
|
458
|
+
this.body = fields.body;
|
|
459
|
+
this.streamId = fields.streamId;
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
class ListenerClosed {
|
|
464
|
+
type = "listener_closed";
|
|
465
|
+
id;
|
|
466
|
+
reason;
|
|
467
|
+
constructor(fields) {
|
|
468
|
+
this.id = fields.id;
|
|
469
|
+
this.reason = fields.reason;
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
var BACKOFF_INITIAL = 500;
|
|
473
|
+
var BACKOFF_MAX = 1e4;
|
|
474
|
+
var READ_TIMEOUT = 60000;
|
|
475
|
+
var CONNECT_TIMEOUT_MAX = 1e4;
|
|
476
|
+
|
|
477
|
+
class FrameParser {
|
|
478
|
+
lastId;
|
|
479
|
+
#buffer = "";
|
|
480
|
+
#afterCr = false;
|
|
481
|
+
#decoder = new TextDecoder;
|
|
482
|
+
#event = null;
|
|
483
|
+
#data = [];
|
|
484
|
+
#id = null;
|
|
485
|
+
constructor(lastId) {
|
|
486
|
+
this.lastId = lastId;
|
|
487
|
+
}
|
|
488
|
+
*feed(chunk) {
|
|
489
|
+
this.#buffer += this.#decoder.decode(chunk, { stream: true });
|
|
490
|
+
if (this.#afterCr && this.#buffer !== "") {
|
|
491
|
+
if (this.#buffer.startsWith(`
|
|
492
|
+
`))
|
|
493
|
+
this.#buffer = this.#buffer.slice(1);
|
|
494
|
+
this.#afterCr = false;
|
|
495
|
+
}
|
|
496
|
+
for (;; ) {
|
|
497
|
+
const end = /\r\n|\r|\n/.exec(this.#buffer);
|
|
498
|
+
if (!end)
|
|
499
|
+
return;
|
|
500
|
+
if (end[0] === "\r" && end.index === this.#buffer.length - 1)
|
|
501
|
+
this.#afterCr = true;
|
|
502
|
+
const line = this.#buffer.slice(0, end.index);
|
|
503
|
+
this.#buffer = this.#buffer.slice(end.index + end[0].length);
|
|
504
|
+
if (line === "")
|
|
505
|
+
yield* this.#dispatch();
|
|
506
|
+
else
|
|
507
|
+
this.#field(line);
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
#field(line) {
|
|
511
|
+
if (line.startsWith(":"))
|
|
512
|
+
return;
|
|
513
|
+
const colon = line.indexOf(":");
|
|
514
|
+
const name = colon === -1 ? line : line.slice(0, colon);
|
|
515
|
+
const value = colon === -1 ? "" : line.slice(colon + 1).replace(/^ /, "");
|
|
516
|
+
if (name === "event")
|
|
517
|
+
this.#event = value;
|
|
518
|
+
else if (name === "data")
|
|
519
|
+
this.#data.push(value);
|
|
520
|
+
else if (name === "id" && !value.includes("\x00"))
|
|
521
|
+
this.#id = value;
|
|
522
|
+
}
|
|
523
|
+
*#dispatch() {
|
|
524
|
+
const streamId = this.#id ?? this.lastId;
|
|
525
|
+
if (this.#event === "webhook")
|
|
526
|
+
yield this.#webhookEvent(streamId);
|
|
527
|
+
else if (this.#event === "listener_closed")
|
|
528
|
+
yield this.#listenerClosed();
|
|
529
|
+
this.lastId = streamId;
|
|
530
|
+
this.#event = null;
|
|
531
|
+
this.#data = [];
|
|
532
|
+
this.#id = null;
|
|
533
|
+
}
|
|
534
|
+
#webhookEvent(streamId) {
|
|
535
|
+
const frame = this.#parseData();
|
|
536
|
+
const { id, event_type: eventType, event_id: eventId, body } = frame;
|
|
537
|
+
const present = (v) => typeof v === "string" && v.length > 0;
|
|
538
|
+
if (!present(id) || !present(eventType) || !present(eventId) || !present(body)) {
|
|
539
|
+
throw new ManzaError(`malformed webhook frame ${JSON.stringify(streamId)}: missing id, event_type, event_id or body`);
|
|
540
|
+
}
|
|
541
|
+
return new ListenerEvent({ id, eventType, eventId, body, streamId });
|
|
542
|
+
}
|
|
543
|
+
#listenerClosed() {
|
|
544
|
+
const frame = this.#parseData();
|
|
545
|
+
const text = (v) => typeof v === "string" ? v : null;
|
|
546
|
+
return new ListenerClosed({ id: text(frame.id), reason: text(frame.reason) });
|
|
547
|
+
}
|
|
548
|
+
#parseData() {
|
|
549
|
+
let parsed;
|
|
550
|
+
try {
|
|
551
|
+
parsed = JSON.parse(this.#data.join(`
|
|
552
|
+
`));
|
|
553
|
+
} catch (err) {
|
|
554
|
+
throw new ManzaError(`malformed frame: ${err instanceof Error ? err.message : String(err)}`);
|
|
555
|
+
}
|
|
556
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
557
|
+
throw new ManzaError("malformed frame: data is not a JSON object");
|
|
558
|
+
}
|
|
559
|
+
return parsed;
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
class WebhookListenerStream {
|
|
564
|
+
#client;
|
|
565
|
+
#streamUrl;
|
|
566
|
+
#signal;
|
|
567
|
+
#lastId;
|
|
568
|
+
constructor(client, streamUrl, options = {}) {
|
|
569
|
+
this.#client = client;
|
|
570
|
+
this.#streamUrl = streamUrl;
|
|
571
|
+
this.#lastId = options.lastEventId ?? null;
|
|
572
|
+
this.#signal = options.signal;
|
|
573
|
+
}
|
|
574
|
+
async* [Symbol.asyncIterator]() {
|
|
575
|
+
const path = this.#targetPath();
|
|
576
|
+
let backoff = BACKOFF_INITIAL;
|
|
577
|
+
let opened = false;
|
|
578
|
+
for (;; ) {
|
|
579
|
+
this.#signal?.throwIfAborted();
|
|
580
|
+
let wait = backoff;
|
|
581
|
+
let delivered = false;
|
|
582
|
+
let connectedAt = 0;
|
|
583
|
+
try {
|
|
584
|
+
const onOpen = () => {
|
|
585
|
+
opened = true;
|
|
586
|
+
connectedAt = performance.now();
|
|
587
|
+
};
|
|
588
|
+
for await (const item of this.#readConnection(path, onOpen)) {
|
|
589
|
+
if (item instanceof ListenerEvent)
|
|
590
|
+
delivered = true;
|
|
591
|
+
yield item;
|
|
592
|
+
if (item instanceof ListenerClosed)
|
|
593
|
+
return;
|
|
594
|
+
}
|
|
595
|
+
if (delivered || performance.now() - connectedAt >= BACKOFF_MAX) {
|
|
596
|
+
backoff = BACKOFF_INITIAL;
|
|
597
|
+
wait = BACKOFF_INITIAL;
|
|
598
|
+
}
|
|
599
|
+
} catch (err) {
|
|
600
|
+
this.#signal?.throwIfAborted();
|
|
601
|
+
const retriable = err instanceof ManzaConnectionError || err instanceof ManzaRateLimitError || err instanceof ManzaServerError;
|
|
602
|
+
if (!retriable || !opened)
|
|
603
|
+
throw err;
|
|
604
|
+
if (err instanceof ManzaRateLimitError && err.retryAfter && err.retryAfter > 0) {
|
|
605
|
+
wait = Math.max(wait, err.retryAfter * 1000);
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
await this.sleep(wait);
|
|
609
|
+
backoff = Math.min(backoff * 2, BACKOFF_MAX);
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
sleep(ms) {
|
|
613
|
+
return new Promise((resolve, reject) => {
|
|
614
|
+
const signal = this.#signal;
|
|
615
|
+
if (signal?.aborted) {
|
|
616
|
+
reject(signal.reason);
|
|
617
|
+
return;
|
|
618
|
+
}
|
|
619
|
+
const onAbort = () => {
|
|
620
|
+
clearTimeout(timer);
|
|
621
|
+
reject(signal?.reason);
|
|
622
|
+
};
|
|
623
|
+
const timer = setTimeout(() => {
|
|
624
|
+
signal?.removeEventListener("abort", onAbort);
|
|
625
|
+
resolve();
|
|
626
|
+
}, ms);
|
|
627
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
628
|
+
});
|
|
629
|
+
}
|
|
630
|
+
async* #readConnection(path, onOpen) {
|
|
631
|
+
const controller = new AbortController;
|
|
632
|
+
const onAbort = () => controller.abort(this.#signal?.reason);
|
|
633
|
+
this.#signal?.addEventListener("abort", onAbort, { once: true });
|
|
634
|
+
let timer;
|
|
635
|
+
const arm = (ms) => {
|
|
636
|
+
clearTimeout(timer);
|
|
637
|
+
timer = setTimeout(() => controller.abort(), ms);
|
|
638
|
+
};
|
|
639
|
+
let parser = null;
|
|
640
|
+
let reader;
|
|
641
|
+
try {
|
|
642
|
+
arm(Math.min(this.#client.timeoutMs, CONNECT_TIMEOUT_MAX));
|
|
643
|
+
const response = await this.#client.openStream(path, this.#headers(), controller.signal);
|
|
644
|
+
assertEventStream(response);
|
|
645
|
+
onOpen();
|
|
646
|
+
parser = new FrameParser(this.#lastId);
|
|
647
|
+
if (!response.body)
|
|
648
|
+
return;
|
|
649
|
+
reader = response.body.getReader();
|
|
650
|
+
for (;; ) {
|
|
651
|
+
arm(READ_TIMEOUT);
|
|
652
|
+
let chunk;
|
|
653
|
+
try {
|
|
654
|
+
const read = await reader.read();
|
|
655
|
+
if (read.done)
|
|
656
|
+
return;
|
|
657
|
+
chunk = read.value;
|
|
658
|
+
} catch {
|
|
659
|
+
this.#signal?.throwIfAborted();
|
|
660
|
+
return;
|
|
661
|
+
}
|
|
662
|
+
for (const item of parser.feed(chunk)) {
|
|
663
|
+
clearTimeout(timer);
|
|
664
|
+
this.#signal?.throwIfAborted();
|
|
665
|
+
yield item;
|
|
666
|
+
if (item instanceof ListenerClosed)
|
|
667
|
+
return;
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
} finally {
|
|
671
|
+
clearTimeout(timer);
|
|
672
|
+
this.#signal?.removeEventListener("abort", onAbort);
|
|
673
|
+
if (parser)
|
|
674
|
+
this.#lastId = parser.lastId;
|
|
675
|
+
controller.abort();
|
|
676
|
+
reader?.cancel().catch(() => {
|
|
677
|
+
return;
|
|
678
|
+
});
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
#headers() {
|
|
682
|
+
const headers = {
|
|
683
|
+
Accept: "text/event-stream",
|
|
684
|
+
"Cache-Control": "no-cache",
|
|
685
|
+
"Accept-Encoding": "identity"
|
|
686
|
+
};
|
|
687
|
+
if (this.#lastId)
|
|
688
|
+
headers["Last-Event-ID"] = this.#lastId;
|
|
689
|
+
return headers;
|
|
690
|
+
}
|
|
691
|
+
#targetPath() {
|
|
692
|
+
if (!this.#streamUrl)
|
|
693
|
+
throw new ManzaArgumentError("webhook listener has no stream_url");
|
|
694
|
+
let ref;
|
|
695
|
+
try {
|
|
696
|
+
ref = new URL(this.#streamUrl, "http://stream-url.invalid");
|
|
697
|
+
} catch {
|
|
698
|
+
throw new ManzaArgumentError("webhook listener stream_url is not a URL");
|
|
699
|
+
}
|
|
700
|
+
if (ref.pathname.replace(/^\/+/, "") === "") {
|
|
701
|
+
throw new ManzaArgumentError("webhook listener stream_url has no path");
|
|
702
|
+
}
|
|
703
|
+
return `${ref.pathname}${ref.search}`;
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
function assertEventStream(response) {
|
|
707
|
+
const contentType = response.headers.get("content-type");
|
|
708
|
+
const mediaType = (contentType ?? "").split(";")[0]?.trim().toLowerCase();
|
|
709
|
+
if (mediaType === "text/event-stream")
|
|
710
|
+
return;
|
|
711
|
+
response.body?.cancel().catch(() => {
|
|
712
|
+
return;
|
|
713
|
+
});
|
|
714
|
+
throw new ManzaError(`Stream answered ${response.status} with Content-Type ${JSON.stringify(contentType)}, not text/event-stream`, { status: response.status });
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
// src/resources/webhook_listeners.ts
|
|
718
|
+
class WebhookListeners extends ResourceBase {
|
|
719
|
+
static SCOPE = "webhook_listeners:write";
|
|
720
|
+
create(params = {}) {
|
|
721
|
+
return this.httpPost("api/webhook_listeners", {
|
|
722
|
+
events: params.events ?? [],
|
|
723
|
+
authorizer: params.authorizer ?? false
|
|
724
|
+
});
|
|
725
|
+
}
|
|
726
|
+
close(id) {
|
|
727
|
+
return this.httpDelete(this.encodePath("api/webhook_listeners", id));
|
|
728
|
+
}
|
|
729
|
+
stream(listener, options = {}) {
|
|
730
|
+
return new WebhookListenerStream(this.client, streamUrlOf(listener), options);
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
function streamUrlOf(listener) {
|
|
734
|
+
const source = listener instanceof ManzaResponse ? listener.body : listener;
|
|
735
|
+
if (typeof source === "string")
|
|
736
|
+
return source;
|
|
737
|
+
if (source && typeof source === "object") {
|
|
738
|
+
const url = source.stream_url;
|
|
739
|
+
return typeof url === "string" ? url : "";
|
|
740
|
+
}
|
|
741
|
+
return "";
|
|
742
|
+
}
|
|
743
|
+
|
|
416
744
|
// src/version.ts
|
|
417
|
-
var VERSION = "
|
|
745
|
+
var VERSION = "2.1.0";
|
|
418
746
|
|
|
419
747
|
// src/client.ts
|
|
420
748
|
var DEFAULT_BASE_URL = "https://ma.manza.finance";
|
|
@@ -438,7 +766,9 @@ class Manza {
|
|
|
438
766
|
payments;
|
|
439
767
|
transferAuthorizer;
|
|
440
768
|
transferDrafts;
|
|
769
|
+
webhookDeliveries;
|
|
441
770
|
webhookEndpoints;
|
|
771
|
+
webhookListeners;
|
|
442
772
|
constructor(options = {}) {
|
|
443
773
|
const apiKey = options.apiKey ?? readEnv("API_KEY");
|
|
444
774
|
if (!apiKey) {
|
|
@@ -460,7 +790,9 @@ class Manza {
|
|
|
460
790
|
this.payments = new Payments(this);
|
|
461
791
|
this.transferAuthorizer = new TransferAuthorizer(this);
|
|
462
792
|
this.transferDrafts = this.payments;
|
|
793
|
+
this.webhookDeliveries = new WebhookDeliveries(this);
|
|
463
794
|
this.webhookEndpoints = new WebhookEndpoints(this);
|
|
795
|
+
this.webhookListeners = new WebhookListeners(this);
|
|
464
796
|
}
|
|
465
797
|
async request(method, path, options = {}) {
|
|
466
798
|
const url = this.#buildUrl(path, options.params);
|
|
@@ -500,6 +832,43 @@ class Manza {
|
|
|
500
832
|
return response;
|
|
501
833
|
throw buildError(response);
|
|
502
834
|
}
|
|
835
|
+
async openStream(path, headers, signal) {
|
|
836
|
+
const url = `${this.baseUrl}/${path.replace(/^\/+/, "")}`;
|
|
837
|
+
const requestHeaders = new Headers({
|
|
838
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
839
|
+
"User-Agent": USER_AGENT
|
|
840
|
+
});
|
|
841
|
+
if (this.apiVersion)
|
|
842
|
+
requestHeaders.set("Manza-Version", this.apiVersion);
|
|
843
|
+
for (const [k, v] of Object.entries(headers))
|
|
844
|
+
requestHeaders.set(k, v);
|
|
845
|
+
let raw;
|
|
846
|
+
try {
|
|
847
|
+
raw = await this.#fetch(url, {
|
|
848
|
+
method: "GET",
|
|
849
|
+
headers: requestHeaders,
|
|
850
|
+
redirect: "manual",
|
|
851
|
+
signal
|
|
852
|
+
});
|
|
853
|
+
} catch (err) {
|
|
854
|
+
throw new ManzaConnectionError(`Stream connection failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
855
|
+
}
|
|
856
|
+
if (raw.status >= 200 && raw.status < 300)
|
|
857
|
+
return raw;
|
|
858
|
+
const text = await raw.text().catch(() => "");
|
|
859
|
+
let body = text;
|
|
860
|
+
try {
|
|
861
|
+
body = JSON.parse(text);
|
|
862
|
+
} catch {}
|
|
863
|
+
const response = new ManzaResponse(raw, body);
|
|
864
|
+
if (raw.status === 0) {
|
|
865
|
+
throw new ManzaError("Stream answered with a redirect, which is never followed", {
|
|
866
|
+
status: 0,
|
|
867
|
+
body
|
|
868
|
+
});
|
|
869
|
+
}
|
|
870
|
+
throw buildError(response);
|
|
871
|
+
}
|
|
503
872
|
#buildUrl(path, params) {
|
|
504
873
|
const trimmed = path.replace(/^\/+/, "");
|
|
505
874
|
const url = new URL(`${this.baseUrl}/${trimmed}`);
|
|
@@ -545,6 +914,17 @@ function buildError(response) {
|
|
|
545
914
|
body: response.body,
|
|
546
915
|
headers: response.headers
|
|
547
916
|
};
|
|
917
|
+
if (response.status === 422 && payload.type === "plan_limit_reached") {
|
|
918
|
+
return new ManzaPlanLimitReachedError(message ?? "Plan limit reached", {
|
|
919
|
+
...opts,
|
|
920
|
+
kind: payload.kind ?? null,
|
|
921
|
+
current: payload.current ?? null,
|
|
922
|
+
max: payload.max ?? null
|
|
923
|
+
});
|
|
924
|
+
}
|
|
925
|
+
if (response.status === 403 && payload.type === "entity_restricted") {
|
|
926
|
+
return new ManzaEntityRestrictedError(message ?? "Entity is restricted", opts);
|
|
927
|
+
}
|
|
548
928
|
switch (response.status) {
|
|
549
929
|
case 400:
|
|
550
930
|
return new ManzaValidationError(message ?? "Bad request", opts);
|
|
@@ -577,11 +957,14 @@ function buildError(response) {
|
|
|
577
957
|
// src/resources/transfer_drafts.ts
|
|
578
958
|
var TransferDrafts = Payments;
|
|
579
959
|
// src/transfer_authorization.ts
|
|
580
|
-
var SIGNATURE_VERSION = "manza.transfer-authorization.
|
|
960
|
+
var SIGNATURE_VERSION = "manza.transfer-authorization.v2";
|
|
581
961
|
function signatureInput(fields) {
|
|
582
962
|
if (typeof fields.amount !== "string") {
|
|
583
963
|
throw new ManzaArgumentError(`amount must be the API's decimal string (got ${JSON.stringify(fields.amount)})`);
|
|
584
964
|
}
|
|
965
|
+
if (fields.transfer_method === undefined) {
|
|
966
|
+
throw new ManzaArgumentError("transfer_method is required (null where the market offers no choice)");
|
|
967
|
+
}
|
|
585
968
|
return [
|
|
586
969
|
SIGNATURE_VERSION,
|
|
587
970
|
fields.payment_id,
|
|
@@ -590,7 +973,8 @@ function signatureInput(fields) {
|
|
|
590
973
|
fields.currency_code,
|
|
591
974
|
fields.account_id,
|
|
592
975
|
fields.payee,
|
|
593
|
-
fields.client_reference ?? ""
|
|
976
|
+
fields.client_reference ?? "",
|
|
977
|
+
fields.transfer_method ?? ""
|
|
594
978
|
].join("|");
|
|
595
979
|
}
|
|
596
980
|
async function sign(params) {
|
|
@@ -716,6 +1100,23 @@ var Webhook = {
|
|
|
716
1100
|
verify,
|
|
717
1101
|
constructEvent
|
|
718
1102
|
};
|
|
1103
|
+
// src/webhook_events.ts
|
|
1104
|
+
var WebhookEvents = {
|
|
1105
|
+
PAYMENT_LINK_REFUNDED: "payment_link.refunded",
|
|
1106
|
+
PAYMENT_LINK_CHARGED_BACK: "payment_link.charged_back",
|
|
1107
|
+
PAYMENT_LINK_DISPUTE_OPENED: "payment_link.dispute_opened",
|
|
1108
|
+
CHECKOUT_SESSION_REFUNDED: "checkout_session.refunded",
|
|
1109
|
+
CHECKOUT_SESSION_CHARGED_BACK: "checkout_session.charged_back",
|
|
1110
|
+
CHECKOUT_SESSION_DISPUTE_OPENED: "checkout_session.dispute_opened"
|
|
1111
|
+
};
|
|
1112
|
+
var Reversal = {
|
|
1113
|
+
KIND_REFUND: "refund",
|
|
1114
|
+
KIND_CHARGEBACK: "chargeback",
|
|
1115
|
+
STATUS_PENDING: "pending",
|
|
1116
|
+
STATUS_COMPLETED: "completed",
|
|
1117
|
+
STATUS_CANCELLED: "cancelled",
|
|
1118
|
+
RESOLUTION_WON: "won"
|
|
1119
|
+
};
|
|
719
1120
|
export {
|
|
720
1121
|
Accounts,
|
|
721
1122
|
Beneficiaries,
|
|
@@ -723,6 +1124,8 @@ export {
|
|
|
723
1124
|
Customers,
|
|
724
1125
|
Entity,
|
|
725
1126
|
Invoices,
|
|
1127
|
+
ListenerClosed,
|
|
1128
|
+
ListenerEvent,
|
|
726
1129
|
MAX_PER_PAGE,
|
|
727
1130
|
Manza,
|
|
728
1131
|
ManzaArgumentError,
|
|
@@ -730,9 +1133,11 @@ export {
|
|
|
730
1133
|
ManzaConfigurationError,
|
|
731
1134
|
ManzaConflictError,
|
|
732
1135
|
ManzaConnectionError,
|
|
1136
|
+
ManzaEntityRestrictedError,
|
|
733
1137
|
ManzaError,
|
|
734
1138
|
ManzaForbiddenError,
|
|
735
1139
|
ManzaNotFoundError,
|
|
1140
|
+
ManzaPlanLimitReachedError,
|
|
736
1141
|
ManzaRateLimitError,
|
|
737
1142
|
ManzaResponse,
|
|
738
1143
|
ManzaServerError,
|
|
@@ -741,10 +1146,15 @@ export {
|
|
|
741
1146
|
PayeeTrustRequests,
|
|
742
1147
|
PaymentLinks,
|
|
743
1148
|
Payments,
|
|
1149
|
+
Reversal,
|
|
744
1150
|
TransferAuthorization,
|
|
745
1151
|
TransferAuthorizer,
|
|
746
1152
|
TransferDrafts,
|
|
747
1153
|
VERSION,
|
|
748
1154
|
Webhook,
|
|
749
|
-
|
|
1155
|
+
WebhookDeliveries,
|
|
1156
|
+
WebhookEndpoints,
|
|
1157
|
+
WebhookEvents,
|
|
1158
|
+
WebhookListenerStream,
|
|
1159
|
+
WebhookListeners
|
|
750
1160
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkout_sessions.d.ts","sourceRoot":"","sources":["../../src/resources/checkout_sessions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"checkout_sessions.d.ts","sourceRoot":"","sources":["../../src/resources/checkout_sessions.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,qBAAa,gBAAiB,SAAQ,YAAY;IAChD,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAIvC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,aAAa,CAAC;CAGpE"}
|
|
@@ -15,6 +15,5 @@ export declare class Invoices extends ResourceBase {
|
|
|
15
15
|
markAsPaid(id: string, attributes?: Record<string, unknown>): Promise<ManzaResponse>;
|
|
16
16
|
cancel(id: string): Promise<ManzaResponse>;
|
|
17
17
|
creditNote(id: string, attributes?: Record<string, unknown>): Promise<ManzaResponse>;
|
|
18
|
-
createPaymentLink(id: string, attributes?: Record<string, unknown>): Promise<ManzaResponse>;
|
|
19
18
|
}
|
|
20
19
|
//# sourceMappingURL=invoices.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invoices.d.ts","sourceRoot":"","sources":["../../src/resources/invoices.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,KAAK,UAAU,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAE1D,MAAM,WAAW,iBAAkB,SAAQ,UAAU;
|
|
1
|
+
{"version":3,"file":"invoices.d.ts","sourceRoot":"","sources":["../../src/resources/invoices.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,KAAK,UAAU,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAE1D,MAAM,WAAW,iBAAkB,SAAQ,UAAU;IAGnD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,qBAAa,QAAS,SAAQ,YAAY;IACxC,IAAI,CAAC,MAAM,GAAE,iBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAK5D,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IA+BvC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,aAAa,CAAC;IASnE,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,aAAa,CAAC;IAS/E,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAa1C,IAAI,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAQxC,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,UAAU,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAIxF,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAU1C,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,UAAU,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GAAG,OAAO,CAAC,aAAa,CAAC;CAGzF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payment_links.d.ts","sourceRoot":"","sources":["../../src/resources/payment_links.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"payment_links.d.ts","sourceRoot":"","sources":["../../src/resources/payment_links.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,KAAK,UAAU,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAE1D,qBAAa,YAAa,SAAQ,YAAY;IAC5C,IAAI,CAAC,MAAM,GAAE,UAAe,GAAG,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAKrD,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAIvC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,aAAa,CAAC;IAInE,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;CAG3C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payments.d.ts","sourceRoot":"","sources":["../../src/resources/payments.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"payments.d.ts","sourceRoot":"","sources":["../../src/resources/payments.ts"],"names":[],"mappings":"AA2CA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,qBAAa,QAAS,SAAQ,YAAY;IAiBxC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,aAAa,CAAC;IAKnE,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAsBvC,SAAS,CACP,EAAE,EAAE,MAAM,EACV,MAAM,EAAE;QAAE,gBAAgB,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,GACtD,OAAO,CAAC,aAAa,CAAC;IAezB,OAAO,CACL,EAAE,EAAE,MAAM,EACV,MAAM,EAAE;QAAE,gBAAgB,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;KAAE,GACvE,OAAO,CAAC,aAAa,CAAC;CAK1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transfer_authorizer.d.ts","sourceRoot":"","sources":["../../src/resources/transfer_authorizer.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,qBAAa,kBAAmB,SAAQ,YAAY;
|
|
1
|
+
{"version":3,"file":"transfer_authorizer.d.ts","sourceRoot":"","sources":["../../src/resources/transfer_authorizer.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,qBAAa,kBAAmB,SAAQ,YAAY;IAalD,GAAG,IAAI,OAAO,CAAC,aAAa,CAAC;CAG9B"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Page } from "../page.js";
|
|
2
|
+
import type { ManzaResponse } from "../response.js";
|
|
3
|
+
import { type ListParams, ResourceBase } from "./base.js";
|
|
4
|
+
export interface WebhookDeliveryListParams extends ListParams {
|
|
5
|
+
status?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare class WebhookDeliveries extends ResourceBase {
|
|
8
|
+
static readonly STATUSES: readonly ["pending", "succeeded", "failed"];
|
|
9
|
+
list(endpointId: string, params?: WebhookDeliveryListParams): Promise<Page<unknown>>;
|
|
10
|
+
get(id: string): Promise<ManzaResponse>;
|
|
11
|
+
retry(id: string): Promise<ManzaResponse>;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=webhook_deliveries.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webhook_deliveries.d.ts","sourceRoot":"","sources":["../../src/resources/webhook_deliveries.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,KAAK,UAAU,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAE1D,MAAM,WAAW,yBAA0B,SAAQ,UAAU;IAE3D,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,qBAAa,iBAAkB,SAAQ,YAAY;IAEjD,MAAM,CAAC,QAAQ,CAAC,QAAQ,8CAA+C;IAOvE,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,GAAE,yBAA8B,GAAG,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAcxF,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAYvC,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;CAG1C"}
|
|
@@ -15,6 +15,7 @@ export declare class WebhookEndpoints extends ResourceBase {
|
|
|
15
15
|
test(id: string): Promise<ManzaResponse>;
|
|
16
16
|
regenerateSecret(id: string): Promise<ManzaResponse>;
|
|
17
17
|
enable(id: string): Promise<ManzaResponse>;
|
|
18
|
+
retryFailed(id: string): Promise<ManzaResponse>;
|
|
18
19
|
disable(id: string): Promise<ManzaResponse>;
|
|
19
20
|
}
|
|
20
21
|
//# sourceMappingURL=webhook_endpoints.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhook_endpoints.d.ts","sourceRoot":"","sources":["../../src/resources/webhook_endpoints.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,KAAK,UAAU,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAE1D,MAAM,WAAW,2BAA2B;IAC1C,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,qBAAa,gBAAiB,SAAQ,YAAY;IAChD,IAAI,CAAC,MAAM,GAAE,UAAe,GAAG,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAKrD,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAIvC,MAAM,CAAC,MAAM,EAAE,2BAA2B,GAAG,OAAO,CAAC,aAAa,CAAC;IAInE,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,aAAa,CAAC;IAI/E,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAI1C,IAAI,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAIxC,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAIpD,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"webhook_endpoints.d.ts","sourceRoot":"","sources":["../../src/resources/webhook_endpoints.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,KAAK,UAAU,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAE1D,MAAM,WAAW,2BAA2B;IAC1C,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,qBAAa,gBAAiB,SAAQ,YAAY;IAChD,IAAI,CAAC,MAAM,GAAE,UAAe,GAAG,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAKrD,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAIvC,MAAM,CAAC,MAAM,EAAE,2BAA2B,GAAG,OAAO,CAAC,aAAa,CAAC;IAInE,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,aAAa,CAAC;IAI/E,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAI1C,IAAI,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAIxC,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAIpD,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAU1C,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAI/C,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;CAG5C"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ManzaResponse } from "../response.js";
|
|
2
|
+
import { WebhookListenerStream, type WebhookListenerStreamOptions } from "../webhook_listener_stream.js";
|
|
3
|
+
import { ResourceBase } from "./base.js";
|
|
4
|
+
export interface WebhookListenerCreateParams {
|
|
5
|
+
events?: string[];
|
|
6
|
+
authorizer?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export type WebhookListenerSource = ManzaResponse | {
|
|
9
|
+
stream_url?: unknown;
|
|
10
|
+
} | string;
|
|
11
|
+
export declare class WebhookListeners extends ResourceBase {
|
|
12
|
+
static readonly SCOPE = "webhook_listeners:write";
|
|
13
|
+
create(params?: WebhookListenerCreateParams): Promise<ManzaResponse>;
|
|
14
|
+
close(id: string): Promise<ManzaResponse>;
|
|
15
|
+
stream(listener: WebhookListenerSource, options?: WebhookListenerStreamOptions): WebhookListenerStream;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=webhook_listeners.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webhook_listeners.d.ts","sourceRoot":"","sources":["../../src/resources/webhook_listeners.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EACL,qBAAqB,EACrB,KAAK,4BAA4B,EAClC,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,MAAM,WAAW,2BAA2B;IAG1C,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAGlB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAID,MAAM,MAAM,qBAAqB,GAAG,aAAa,GAAG;IAAE,UAAU,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,MAAM,CAAC;AAEtF,qBAAa,gBAAiB,SAAQ,YAAY;IAEhD,MAAM,CAAC,QAAQ,CAAC,KAAK,6BAA6B;IAUlD,MAAM,CAAC,MAAM,GAAE,2BAAgC,GAAG,OAAO,CAAC,aAAa,CAAC;IAYxE,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAiCzC,MAAM,CACJ,QAAQ,EAAE,qBAAqB,EAC/B,OAAO,GAAE,4BAAiC,GACzC,qBAAqB;CAGzB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const SIGNATURE_VERSION = "manza.transfer-authorization.
|
|
1
|
+
export declare const SIGNATURE_VERSION = "manza.transfer-authorization.v2";
|
|
2
2
|
export interface SignatureInputFields {
|
|
3
3
|
payment_id: string;
|
|
4
4
|
nonce: string;
|
|
@@ -7,6 +7,7 @@ export interface SignatureInputFields {
|
|
|
7
7
|
account_id: string;
|
|
8
8
|
payee: string;
|
|
9
9
|
client_reference?: string | null | undefined;
|
|
10
|
+
transfer_method: string | null;
|
|
10
11
|
}
|
|
11
12
|
export interface PayeeForParams {
|
|
12
13
|
external_account_id?: string | null | undefined;
|
|
@@ -19,7 +20,7 @@ export declare function sign(params: {
|
|
|
19
20
|
}): Promise<string>;
|
|
20
21
|
export declare function payeeFor(params: PayeeForParams): string;
|
|
21
22
|
export declare const TransferAuthorization: {
|
|
22
|
-
readonly SIGNATURE_VERSION: "manza.transfer-authorization.
|
|
23
|
+
readonly SIGNATURE_VERSION: "manza.transfer-authorization.v2";
|
|
23
24
|
readonly signatureInput: typeof signatureInput;
|
|
24
25
|
readonly sign: typeof sign;
|
|
25
26
|
readonly payeeFor: typeof payeeFor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transfer_authorization.d.ts","sourceRoot":"","sources":["../src/transfer_authorization.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"transfer_authorization.d.ts","sourceRoot":"","sources":["../src/transfer_authorization.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,iBAAiB,oCAAoC,CAAC;AAEnE,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IAGd,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAI7C,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED,MAAM,WAAW,cAAc;IAC7B,mBAAmB,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAChD,sBAAsB,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;CACpD;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,oBAAoB,GAAG,MAAM,CAwBnE;AAKD,wBAAsB,IAAI,CAAC,MAAM,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,eAAe,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAW/F;AAED,wBAAgB,QAAQ,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,CASvD;AAED,eAAO,MAAM,qBAAqB;;;;;CAKxB,CAAC"}
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "
|
|
1
|
+
export declare const VERSION = "2.1.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|