@mandateops/audit 0.3.0 → 0.4.2

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/dist/index.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import type { CapacityReading, HistoryReading, ReadingProfile } from "./reading.js";
2
2
  import type { ProviderWire, StagedWire } from "./providers/index.js";
3
- export { bridge, circleMint, adyen, airwallex, checkout, dwolla, fireblocks, flutterwave, modernTreasury, molliePayouts, paypal, paystack, peach, razorpayx, revolut, stitch, stripePayouts, stripeTransfers, wise, } from "./providers/index.js";
4
- export type { CheckoutTerms, CurrencyTerms, BridgeTerms, FireblocksTerms, LedgerTerms, MollieTerms, OwnAccountTerms, ProviderWire, SourcedTerms, StagedWire, TermDefaults, WiseRoutes, WiseTerms, } from "./providers/index.js";
3
+ export * from "./providers/index.js";
5
4
  export { parseCapacityReading, parseHistoryReading, ReadingError, requireHistoryFits, } from "./reading.js";
6
5
  export type { AttemptEnd, AttemptResult, CapacityReading, Flow, HistoryEvent, HistoryReading, Instruction, MinorUnits, Payout, PayoutState, ReadingProfile, HistoryConsistency, CapacityConsistency, } from "./reading.js";
7
6
  /**
package/dist/index.js CHANGED
@@ -13,7 +13,8 @@ import { tmpdir } from "node:os";
13
13
  import { dirname, join, resolve } from "node:path";
14
14
  import { setTimeout as sleep } from "node:timers/promises";
15
15
  import { parseCapacityReading, parseHistoryReading, requireHistoryFits, } from "./reading.js";
16
- export { bridge, circleMint, adyen, airwallex, checkout, dwolla, fireblocks, flutterwave, modernTreasury, molliePayouts, paypal, paystack, peach, razorpayx, revolut, stitch, stripePayouts, stripeTransfers, wise, } from "./providers/index.js";
16
+ // Every provider format and its types, from the one list that names them.
17
+ export * from "./providers/index.js";
17
18
  export { parseCapacityReading, parseHistoryReading, ReadingError, requireHistoryFits, } from "./reading.js";
18
19
  const MINOR_UNITS = /^[1-9][0-9]*$/;
19
20
  /**
@@ -16,6 +16,15 @@ export declare const stripePayouts: (terms: LedgerTerms) => ProviderWire;
16
16
  * replay with `Idempotent-Replayed`, which this format does not send.
17
17
  */
18
18
  export declare const stripeTransfers: (terms: LedgerTerms) => ProviderWire;
19
+ /**
20
+ * Stripe Connect payouts: `POST /v1/accounts` and `POST /v1/accounts/:accountId/external_accounts`
21
+ * set up the recipient, `POST /v1/transfers` moves the money to it (the
22
+ * payment, as `stripeTransfers`), and `POST /v1/payouts` with a
23
+ * `Stripe-Account` header pays out of the connected account's balance. The
24
+ * key is optional, as at Stripe: a transfer sent without `Idempotency-Key`
25
+ * is a new transfer each time, so a retry after a lost reply pays again.
26
+ */
27
+ export declare const stripeConnect: (terms: LedgerTerms) => ProviderWire;
19
28
  /**
20
29
  * `POST /v3/transfers`. Keyed on the unique `reference`, as v3 coverage of
21
30
  * `X-Idempotency-Key` and v3 reference reuse are unverified. The amount is a
@@ -152,6 +152,23 @@ export const stripeTransfers = (terms) => stripe("/v1/transfers", terms, {
152
152
  reversals: { object: "list", data: [], has_more: false },
153
153
  reversed: false,
154
154
  });
155
+ /**
156
+ * Stripe Connect payouts: `POST /v1/accounts` and `POST /v1/accounts/:accountId/external_accounts`
157
+ * set up the recipient, `POST /v1/transfers` moves the money to it (the
158
+ * payment, as `stripeTransfers`), and `POST /v1/payouts` with a
159
+ * `Stripe-Account` header pays out of the connected account's balance. The
160
+ * key is optional, as at Stripe: a transfer sent without `Idempotency-Key`
161
+ * is a new transfer each time, so a retry after a lost reply pays again.
162
+ */
163
+ export const stripeConnect = (terms) => ({
164
+ ...stripeTransfers(terms),
165
+ key: { header: "idempotency-key", maxLength: 255, optional: true },
166
+ connect: {
167
+ accounts: "/v1/accounts",
168
+ externalAccounts: "/v1/accounts/:accountId/external_accounts",
169
+ payouts: "/v1/payouts",
170
+ },
171
+ });
155
172
  /**
156
173
  * `POST /v3/transfers`. Keyed on the unique `reference`, as v3 coverage of
157
174
  * `X-Idempotency-Key` and v3 reference reuse are unverified. The amount is a
@@ -5,5 +5,5 @@
5
5
  * that provider behaves.
6
6
  */
7
7
  export { bridge, circleMint, fireblocks } from "./crypto.js";
8
- export { adyen, airwallex, checkout, dwolla, flutterwave, modernTreasury, molliePayouts, paypal, paystack, peach, razorpayx, revolut, stitch, stripePayouts, stripeTransfers, wise, } from "./fiat.js";
8
+ export { adyen, airwallex, checkout, dwolla, flutterwave, modernTreasury, molliePayouts, paypal, paystack, peach, razorpayx, revolut, stitch, stripeConnect, stripePayouts, stripeTransfers, wise, } from "./fiat.js";
9
9
  export type * from "./types.js";
@@ -5,4 +5,4 @@
5
5
  * that provider behaves.
6
6
  */
7
7
  export { bridge, circleMint, fireblocks } from "./crypto.js";
8
- export { adyen, airwallex, checkout, dwolla, flutterwave, modernTreasury, molliePayouts, paypal, paystack, peach, razorpayx, revolut, stitch, stripePayouts, stripeTransfers, wise, } from "./fiat.js";
8
+ export { adyen, airwallex, checkout, dwolla, flutterwave, modernTreasury, molliePayouts, paypal, paystack, peach, razorpayx, revolut, stitch, stripeConnect, stripePayouts, stripeTransfers, wise, } from "./fiat.js";
@@ -57,6 +57,7 @@ export type WireKeyShape = "uuid_v4" | "lowercase_slug";
57
57
  export type WireKey = Readonly<{
58
58
  header: string;
59
59
  maxLength?: number;
60
+ optional?: boolean;
60
61
  } | {
61
62
  field: string;
62
63
  maxLength?: number;
@@ -106,6 +107,14 @@ export type ProviderWire = Readonly<{
106
107
  conflict: Reply;
107
108
  duplicate?: Reply;
108
109
  }>;
110
+ /** Stripe Connect's setup and payout calls around a transfer. */
111
+ connect?: ConnectRoutes;
112
+ }>;
113
+ /** Where Stripe Connect's account setup and payout calls sit. */
114
+ export type ConnectRoutes = Readonly<{
115
+ accounts: string;
116
+ externalAccounts: string;
117
+ payouts: string;
109
118
  }>;
110
119
  /** A format of several calls, which the stand-in holds as its own flow. */
111
120
  export type StagedWire = Readonly<{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mandateops/audit",
3
- "version": "0.3.0",
3
+ "version": "0.4.2",
4
4
  "description": "Write audit tests that check a payout backend keeps one payment identity, money limits and commitments when a provider commits but the reply is lost. Needs the mandateops CLI.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://getmandateops.com",