@bitgen/sdk 1.0.6 → 1.0.8

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 CHANGED
@@ -1,3 +1,22 @@
1
+ ## [1.0.8] - 2026-10-09
2
+
3
+ ### Changed
4
+ - Documentation: the `scope` placeholder in the examples is now `YOUR_ORGANIZATION_SCOPE` (was `YOUR_SCOPE_UUID`) — the uuid of the organization that owns the key
5
+
6
+ ## [1.0.7] - 2026-10-07
7
+
8
+ ### Added
9
+ - `customer.create` accepts `account.canLogin` (`boolean`, default `true`): `false` creates a customer who cannot sign in to the BITGEN web application — the activation then answers only their `uuid` instead of a session. For an organization that drives everything through the API with its own interface
10
+ - `bank.withdraw` accepts `params.idempotencyKey` (`string`, 64 characters max, unique per customer): an identical replay reserves the amount once and returns the same `transaction`, the same key with a different amount is refused with `412 idempotency_amount_mismatch`, an invalid key with `422 invalid_idempotency_key`. A key identifies one withdrawal for good, a failed one included
11
+
12
+ ### Changed
13
+ - `readme/resource/customer.md`: creating a customer from an email that already has an active, KYC-validated account no longer attaches it immediately — the person is invited and the attachment takes effect when they accept, so the customer is not usable on the financial routes until then. `409 user_already_assigned` now fires only when the person is already a **customer** of another organization
14
+ - `readme/resource/customer.md`: the `409 account_unavailable` window is **14 days**, not 15 minutes — an email belonging to an account still being created is refused for two weeks, the time the person has to answer their invitation
15
+ - `readme/resource/bank.md`: `reference` identifies one deposit and one only — same amount, idempotent; different amount, `412 reference_amount_mismatch`; over 218 characters, `416 reference_too_long`
16
+ - `readme/resource/custody.md`: new `409 withdraw_replay_mismatch` — same `idempotencyKey` replayed with a different amount or destination address. An identical replay still returns the existing movement
17
+ - `readme/resource/bank.md`: the `transaction` returned by `bank.withdraw` — its line in the journal is opened by the compliance analysis within a minute of the call, so `transaction.get()` answers `404 unknown_transaction` until then. Bank details sent with a withdrawal are written to the account even when the withdrawal is then refused
18
+ - `readme/resource/staking.md`: `stake` with a customer uuid it cannot use now answers `403 org_forbidden` instead of `404 unknown_user`
19
+
1
20
  ## [1.0.6] - 2026-09-23
2
21
 
3
22
  ### Changed
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # @bitgen/sdk — v1.0.6
1
+ # @bitgen/sdk — v1.0.8
2
2
 
3
3
  Official Node.js SDK for the BITGEN API v4 — server-side, TypeScript, ESM and CommonJS, no runtime dependency.
4
4
  Install it with `npm install @bitgen/sdk` (Node.js 20 or later).
@@ -7,9 +7,9 @@ Install it with `npm install @bitgen/sdk` (Node.js 20 or later).
7
7
  import { BitgenClient, Env } from '@bitgen/sdk'
8
8
 
9
9
  const client = new BitgenClient({
10
- scope: 'YOUR_SCOPE_UUID', // uuid of the organization that owns the key
10
+ scope: 'YOUR_ORGANIZATION_SCOPE', // uuid of the organization that owns the key
11
11
  apiKey: 'YOUR_API_KEY',
12
- env: Env.SANDBOX, // Env.PRODUCTION by default
12
+ env: Env.SANDBOX, // Env.PRODUCTION by default
13
13
  })
14
14
 
15
15
  const account = await client.bank.get('CUSTOMER_UUID')
@@ -8,7 +8,11 @@ export declare class BankResource {
8
8
  get(user: UserRef): Promise<BankAccount>;
9
9
  /** EUR operations of a customer */
10
10
  operations(user: UserRef, params?: BankOperationsParams): Promise<Page<BankOperation>>;
11
- /** EUR withdrawal to the customer's IBAN — `iban` / `bank` / `bic` update the bank details first */
11
+ /**
12
+ * EUR withdrawal to the customer's IBAN — `iban` / `bank` / `bic` update the bank details first,
13
+ * `idempotencyKey` makes the call safe to replay. `transaction` identifies the withdrawal: its line in
14
+ * the journal is opened by the compliance analysis, within a minute of the call.
15
+ */
12
16
  withdraw(user: UserRef, params: BankWithdrawParams): Promise<{
13
17
  transaction: string;
14
18
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"bank.d.ts","sourceRoot":"","sources":["../../../src/resources/bank.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAC5C,OAAO,KAAK,EACV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AAC,CAAC;IAIhG;;;;OAIG;IACG,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC;IAI3F,qHAAqH;IAC/G,MAAM,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC;CAKzD"}
@@ -16,7 +16,11 @@ class BankResource {
16
16
  async operations(user, params = {}) {
17
17
  return await this.http.get(`/bank/${(0, utils_js_1.pathSegment)((0, utils_js_1.resolveUuid)(user), 'user')}/operations`, { ...params });
18
18
  }
19
- /** EUR withdrawal to the customer's IBAN — `iban` / `bank` / `bic` update the bank details first */
19
+ /**
20
+ * EUR withdrawal to the customer's IBAN — `iban` / `bank` / `bic` update the bank details first,
21
+ * `idempotencyKey` makes the call safe to replay. `transaction` identifies the withdrawal: its line in
22
+ * the journal is opened by the compliance analysis, within a minute of the call.
23
+ */
20
24
  async withdraw(user, params) {
21
25
  return await this.http.put(`/bank/${(0, utils_js_1.pathSegment)((0, utils_js_1.resolveUuid)(user), 'user')}`, { ...params, amount: (0, utils_js_1.amount)(params.amount) });
22
26
  }
@@ -1 +1 @@
1
- {"version":3,"file":"bank.js","sourceRoot":"","sources":["../../../src/resources/bank.ts"],"names":[],"mappings":";;;AAWA,0CAA8D;AAE9D,0GAA0G;AAC1G,MAAa,YAAY;IACM;IAA7B,YAA6B,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;IAAG,CAAC;IAEjD,0FAA0F;IAC1F,KAAK,CAAC,GAAG,CAAC,IAAa;QACrB,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,IAAA,sBAAW,EAAC,IAAA,sBAAW,EAAC,IAAI,CAAC,EAAE,MAAM,CAAC,EAAE,CAAC,CAAA;IAC/E,CAAC;IAED,mCAAmC;IACnC,KAAK,CAAC,UAAU,CAAC,IAAa,EAAE,SAA+B,EAAE;QAC/D,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ank?: string;
46
46
  bic?: string;
47
+ /** ≤ 64 characters, unique per customer: replaying returns the same withdrawal */
48
+ idempotencyKey?: string;
47
49
  }
48
50
  export interface BankCreditParams {
49
51
  amount: Amount;
@@ -1 +1 @@
1
- {"version":3,"file":"bank.d.ts","sourceRoot":"","sources":["../../../src/types/bank.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAE1D,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAEpD,yEAAyE;AACzE,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,yEAAyE;IACzE,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;IAClB,UAAU;IACV,OAAO,EAAE,MAAM,CAAA;IACf,gGAAgG;IAChG,OAAO,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;IACxC,0EAA0E;IAC1E,OAAO,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAA;CACrC;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU;IACV,MAAM,EAAE,MAAM,CAAA;IACd,4DAA4D;IAC5D,SAAS,EAAE,OAAO,CAAC,aAAa,EAAE,OAAO,aAAa,CAAC,GAAG,CAAC,CAAA;IAC3D,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;CACpB;AAED,MAAM,WAAW,oBAAoB;IACnC,oBAAoB;IACpB,SAAS,CAAC,EAAE,aAAa,CAAA;IACzB,qEA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0E;IAC1E,OAAO,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAA;CACrC;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU;IACV,MAAM,EAAE,MAAM,CAAA;IACd,4DAA4D;IAC5D,SAAS,EAAE,OAAO,CAAC,aAAa,EAAE,OAAO,aAAa,CAAC,GAAG,CAAC,CAAA;IAC3D,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;CACpB;AAED,MAAM,WAAW,oBAAoB;IACnC,oBAAoB;IACpB,SAAS,CAAC,EAAE,aAAa,CAAA;IACzB,qEAAqE;IACrE,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,kBAAkB;IACjC,iCAAiC;IACjC,MAAM,EAAE,MAAM,CAAA;IACd,uFAAuF;IACvF,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,kFAAkF;IAClF,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,KAAK,CAAA;IAChB,iEAAiE;IACjE,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,sDAAsD;IACtD,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,uDAAuD;IACvD,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB"}
@@ -161,6 +161,12 @@ export interface CreateCustomerParams {
161
161
  needActivation?: boolean;
162
162
  /** Default `true`: the customer receives BITGEN's emails (newsletter). `false`: none */
163
163
  notify?: boolean;
164
+ /**
165
+ * Default `true`: the customer may sign in to the BITGEN web application. `false`: they cannot, and the
166
+ * activation answers only their `uuid` instead of a session — for an organization that drives everything
167
+ * through the API with its own interface.
168
+ */
169
+ canLogin?: boolean;
164
170
  };
165
171
  /** `manager` = uuid of the collaborator of the organization who follows this customer — the customer is created in the key's organization */
166
172
  group: {
@@ -1 +1 @@
1
- {"version":3,"file":"customer.d.ts","sourceRoot":"","sources":["../../../src/types/customer.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AAC/G,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AAE/G,UAAU,YAAY;IACpB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,aAAa,CAAA;IACpB,kHAAkH;IAClH,IAAI,EAAE;QACJ,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE;YAAE,MAAM,EAAE,MAAM,CAAC;YAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;SAAE,CAAC,CAAA;QACrE,aAAa,EAAE,OAAO,CAAA;QACtB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAA;QAC9B,MAAM,CAAC,EAAE,OAAO,CAAA;KACjB,CAAA;IACD,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAA;CACjC;AAED,gCAAgC;AAChC,MAAM,WAAW,WAAY,SAAQ,YAAY;IAC/C,IAAI,EAAE,OAAO,YAAY,CAAC,GAAG,CAAA;IAC7B,IAAI,EAAE;QACJ,kBAAkB,EAAE,OAAO,CAAA;QAC3B,GAAG,EAAE,OAAO,CAAA;QACZ,GAAG,EAAE,OAAO,CAAA;QACZ,aAAa,EAAE,MAAM,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KAAE,CAAA;IACtD,KAAK,EAAE,aAAa,CAAA;CACrB;AAID,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE;QACP,KAAK,EAAE,MAAM,CAAA;QACb,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,QAAQ,CAAC,EAAE,MAAM,CAAA;QACjB,oDAAoD;QACpD,GAAG,CAAC,EAAE,MAAM,CAAA;QACZ;;;;WAIG;QACH,cAAc,CAAC,EAAE,OAAO,CAAA;QACxB,wFAAwF;QACxF,MAAM,CAAC,EAAE,OAAO,CAAA;QAChB;;;;WAIG;QACH,QAAQ,CAAC,EAAE,OAAO,CAAA;KACnB,CAAA;IACD,6IAA6I;IAC7I,KAAK,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAA;IAC1B,mBAAmB;IACnB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,sFAAsF;IACtF,YAAY,CAAC,EAAE,oBAAoB,CAAA;CACpC;AAED,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,gEAAgE;IAChE,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,4EAA4E;AAC5E,MAAM,WAAW,oBAAoB;IACnC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,aAAa,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAC;QAAC,UAAU,CAAC,EAAE,OAAO,CAAA;KAAE,CAAA;CAC1D"}
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.0.6";
1
+ export declare const VERSION = "1.0.8";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -2,5 +2,5 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
4
  // Generated by scripts/prebuild.js from package.json — do not edit
5
- exports.VERSION = "1.0.6";
5
+ exports.VERSION = "1.0.8";
6
6
  //# sourceMappingURL=version.js.map
@@ -8,7 +8,11 @@ export declare class BankResource {
8
8
  get(user: UserRef): Promise<BankAccount>;
9
9
  /** EUR operations of a customer */
10
10
  operations(user: UserRef, params?: BankOperationsParams): Promise<Page<BankOperation>>;
11
- /** EUR withdrawal to the customer's IBAN — `iban` / `bank` / `bic` update the bank details first */
11
+ /**
12
+ * EUR withdrawal to the customer's IBAN — `iban` / `bank` / `bic` update the bank details first,
13
+ * `idempotencyKey` makes the call safe to replay. `transaction` identifies the withdrawal: its line in
14
+ * the journal is opened by the compliance analysis, within a minute of the call.
15
+ */
12
16
  withdraw(user: UserRef, params: BankWithdrawParams): Promise<{
13
17
  transaction: string;
14
18
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"bank.d.ts","sourceRoot":"","sources":["../../../src/resources/bank.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAC5C,OAAO,KAAK,EACV,WAAW,EACX,gBAAgB,EAChB,aAAa,EACb,oBAAoB,EACpB,kBAAkB,EAClB,OAAO,EACP,IAAI,EACJ,OAAO,EACR,MAAM,mBAAmB,CAAA;AAG1B,0GAA0G;AAC1G,qBAAa,YAAY;IACX,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAE7C,0FAA0F;IACpF,GAAG,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,WAAW,CAAC;IAI9C,mCAAmC;IAC7B,UAAU,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,GAAE,oBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAIhG,oGAAoG;IAC9F,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC;IAI3F,qHAAqH;IAC/G,MAAM,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC;CAKzD"}
1
+ {"version":3,"file":"bank.d.ts","sourceRoot":"","sources":["../../../src/resources/bank.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAC5C,OAAO,KAAK,EACV,WAAW,EACX,gBAAgB,EAChB,aAAa,EACb,oBAAoB,EACpB,kBAAkB,EAClB,OAAO,EACP,IAAI,EACJ,OAAO,EACR,MAAM,mBAAmB,CAAA;AAG1B,0GAA0G;AAC1G,qBAAa,YAAY;IACX,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAE7C,0FAA0F;IACpF,GAAG,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,WAAW,CAAC;IAI9C,mCAAmC;IAC7B,UAAU,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,GAAE,oBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAIhG;;;;OAIG;IACG,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC;IAI3F,qHAAqH;IAC/G,MAAM,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC;CAKzD"}
@@ -13,7 +13,11 @@ export class BankResource {
13
13
  async operations(user, params = {}) {
14
14
  return await this.http.get(`/bank/${pathSegment(resolveUuid(user), 'user')}/operations`, { ...params });
15
15
  }
16
- /** EUR withdrawal to the customer's IBAN — `iban` / `bank` / `bic` update the bank details first */
16
+ /**
17
+ * EUR withdrawal to the customer's IBAN — `iban` / `bank` / `bic` update the bank details first,
18
+ * `idempotencyKey` makes the call safe to replay. `transaction` identifies the withdrawal: its line in
19
+ * the journal is opened by the compliance analysis, within a minute of the call.
20
+ */
17
21
  async withdraw(user, params) {
18
22
  return await this.http.put(`/bank/${pathSegment(resolveUuid(user), 'user')}`, { ...params, amount: amount(params.amount) });
19
23
  }
@@ -1 +1 @@
1
- {"version":3,"file":"bank.js","sourceRoot":"","sources":["../../../src/resources/bank.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAE9D,0GAA0G;AAC1G,MAAM,OAAO,YAAY;IACM;IAA7B,YAA6B,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;IAAG,CAAC;IAEjD,0FAA0F;IAC1F,KAAK,CAAC,GAAG,CAAC,IAAa;QACrB,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,WAAW,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,EAAE,CAAC,CAAA;IAC/E,CAAC;IAED,mCAAmC;IACnC,KAAK,CAAC,UAAU,CAAC,IAAa,EAAE,SAA+B,EAAE;QAC/D,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,WAAW,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,aAAa,EAAE,EAAE,GAAG,MAAM,EAAE,CAAC,CAAA;IACzG,CAAC;IAED,oGAAoG;IACpG,KAAK,CAAC,QAAQ,CAAC,IAAa,EAAE,MAA0B;QACtD,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,WAAW,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,GAAG,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;IAC7H,CAAC;IAED,qHAAqH;IACrH,KAAK,CAAC,MAAM,CAAC,MAAwB;QACnC,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAA;QAChC,kFAAkF;QAClF,OAAO,MAAM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,MAAM,CAAC,EAAE,CAAC,CAAA;IAC7H,CAAC;IAED,qHAAqH;IACrH,KAAK,CAAC,MAAM,CAAC,MAAwB;QACnC,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAA;QAChC,kFAAkF;QAClF,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAC7J,CAAC;CACF"}
@@ -44,6 +44,8 @@ export interface BankWithdrawParams {
44
44
  iban?: string;
45
45
  bank?: string;
46
46
  bic?: string;
47
+ /** ≤ 64 characters, unique per customer: replaying returns the same withdrawal */
48
+ idempotencyKey?: string;
47
49
  }
48
50
  export interface BankCreditParams {
49
51
  amount: Amount;
@@ -1 +1 @@
1
- {"version":3,"file":"bank.d.ts","sourceRoot":"","sources":["../../../src/types/bank.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAE1D,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAEpD,yEAAyE;AACzE,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,yEAAyE;IACzE,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;IAClB,UAAU;IACV,OAAO,EAAE,MAAM,CAAA;IACf,gGAAgG;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AI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,kFAAkF;IAClF,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,KAAK,CAAA;IAChB,iEAAiE;IACjE,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,sDAAsD;IACtD,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,uDAAuD;IACvD,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB"}
@@ -161,6 +161,12 @@ export interface CreateCustomerParams {
161
161
  needActivation?: boolean;
162
162
  /** Default `true`: the customer receives BITGEN's emails (newsletter). `false`: none */
163
163
  notify?: boolean;
164
+ /**
165
+ * Default `true`: the customer may sign in to the BITGEN web application. `false`: they cannot, and the
166
+ * activation answers only their `uuid` instead of a session — for an organization that drives everything
167
+ * through the API with its own interface.
168
+ */
169
+ canLogin?: boolean;
164
170
  };
165
171
  /** `manager` = uuid of the collaborator of the organization who follows this customer — the customer is created in the key's organization */
166
172
  group: {
@@ -1 +1 @@
1
- {"version":3,"file":"customer.d.ts","sourceRoot":"","sources":["../../../src/types/customer.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AAC/G,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AAE/G,UAAU,YAAY;IACpB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,aAAa,CAAA;IACpB,kHAAkH;IAClH,IAAI,EAAE;QACJ,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE;YAAE,MAAM,EAAE,MAAM,CAAC;YAAC,WAAW,EAAE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Aa,CAAC,EAAE,OAAO,CAAA;IACvB,gEAAgE;IAChE,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,4EAA4E;AAC5E,MAAM,WAAW,oBAAoB;IACnC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,aAAa,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAC;QAAC,UAAU,CAAC,EAAE,OAAO,CAAA;KAAE,CAAA;CAC1D"}
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.0.6";
1
+ export declare const VERSION = "1.0.8";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1,3 +1,3 @@
1
1
  // Generated by scripts/prebuild.js from package.json — do not edit
2
- export const VERSION = "1.0.6";
2
+ export const VERSION = "1.0.8";
3
3
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bitgen/sdk",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "license": "UNLICENSED",
5
5
  "author": "BITGEN",
6
6
  "description": "Official Node.js SDK for the BITGEN API v4.0.x",
@@ -121,7 +121,7 @@ The EUR of a customer are held by the bank provider of your organization, on the
121
121
 
122
122
  ![An EUR deposit: the wire to the organization account at the bank provider, its report, the matching by reference, the compliance analysis, the credit of the ledger](media/deposit-flow.svg)
123
123
 
124
- A deposit: the customer wires EUR to the organization's account with the reference `BTGN` followed by the code of their account (`message`) → the provider reports the wire to BITGEN — with a manual bank, you declare it ([credit](resource/bank.md#credit)) — on the sandbox test bank, that declaration is taken and reported back within seconds → BITGEN matches the reference and the amount enters `pending.in` → compliance analysis: a `BANK` `IN` transaction, `bank.transaction` (`PENDING` if an alert holds it — [Transactions](resource/transaction.md)) → `balance` credited, operation `DEPOSIT`, `bank.credited`. The credit is never immediate; without a valid reference the wire is never credited, and the compliance of your organization is notified.
124
+ A deposit: the customer wires EUR to the organization's account with the reference `BTGN` followed by the code of their account (`message`) → the provider reports the wire to BITGEN — with a manual bank, you declare it ([credit](resource/bank.md#credit)) → BITGEN matches the reference and the amount enters `pending.in` → compliance analysis: a `BANK` `IN` transaction, `bank.transaction` (`PENDING` if an alert holds it — [Transactions](resource/transaction.md)) → `balance` credited, operation `DEPOSIT`, `bank.credited`. The credit is never immediate; without a valid reference the wire is never credited, and the compliance of your organization is notified.
125
125
 
126
126
  ![An EUR withdrawal: the reserve on the ledger, the compliance analysis, the wire from the organization account to the customer IBAN, the debit at confirmation](media/withdrawal-flow.svg)
127
127
 
@@ -6,7 +6,7 @@ A `BitgenClient` is built once per API key and reused: it holds the credentials,
6
6
  import { BitgenClient, Env } from '@bitgen/sdk'
7
7
 
8
8
  const client = new BitgenClient({
9
- scope: 'YOUR_SCOPE_UUID',
9
+ scope: 'YOUR_ORGANIZATION_SCOPE',
10
10
  apiKey: 'YOUR_API_KEY',
11
11
  env: Env.PRODUCTION, // default
12
12
  timeout: 30, // seconds, default 30
@@ -31,13 +31,15 @@ A missing key, an unknown, revoked or expired key, or a `scope` that is not the
31
31
 
32
32
  `Env` holds these names as a frozen object (`Object.values(Env)` lists them): pass the constant — the type of its values is `BitgenEnv`. Anything else is refused before any request ([Validation](#validation), [Constants](concepts.md#constants)).
33
33
 
34
+ On `sandbox`, two behaviours differ from production. Purchases are capped per customer and per calendar day — the crypto is bought with test tokens, whose supply is limited: beyond the cap `buy` answers `429 daily_buy_limit_exceeded`. And the bank provider takes the deposit declaration and reports the deposit itself, so `credit` answers `201` with an empty body and no `uuid`, the incoming movement appearing in `pending.in` a second later. Everything else — the routes, the parameters, the answers and the codes — is identical.
35
+
34
36
  ## Custom host
35
37
 
36
38
  To reach the API through another hostname — a container, a tunnel — give `host` instead of `env`:
37
39
 
38
40
  ```ts
39
41
  const client = new BitgenClient({
40
- scope: 'YOUR_SCOPE_UUID',
42
+ scope: 'YOUR_ORGANIZATION_SCOPE',
41
43
  apiKey: 'YOUR_API_KEY',
42
44
  host: 'my-hostname', // bare hostname: no scheme, port or path
43
45
  port: 8080, // default 80
package/readme/errors.md CHANGED
@@ -60,7 +60,7 @@ The errors any call can answer. Each resource page lists its own codes.
60
60
  | `403` | `expired_api_key` | The key has expired |
61
61
  | `403` | `forbidden_permission` | The key does not carry the permission for this call — contact BITGEN |
62
62
  | `400` | `required_index_missing::<field>` | A mandatory field is missing or empty |
63
- | `404` | `unknown_<resource>` | The target does not exist — `unknown_user`, `unknown_asset`, `unknown_bank`… — or the API does not reveal it |
63
+ | `404` | `unknown_<resource>` | The target does not exist **or is outside your organization** — `unknown_user`, `unknown_asset`, `unknown_bank`… The two cases are deliberately indistinguishable, including when you search a customer by email |
64
64
  | `422` | `invalid_<param>` | A boolean filter (`includeClosed`, `includeRevoked`, `includeArchived`) is not a boolean value ([Query booleans](concepts.md#query-booleans)) |
65
65
  | `423` | `blocked_by_alert` | The customer is under an active compliance alert (each resource page lists its `423` codes, with `account_frozen` and the lock codes) |
66
66
 
@@ -8,9 +8,9 @@ Create the client once, then run a first journey: create a customer, read their
8
8
  import { BitgenClient, Env } from '@bitgen/sdk'
9
9
 
10
10
  const client = new BitgenClient({
11
- scope: 'YOUR_SCOPE_UUID', // uuid of the organization that owns the key
11
+ scope: 'YOUR_ORGANIZATION_SCOPE', // uuid of the organization that owns the key
12
12
  apiKey: 'YOUR_API_KEY',
13
- env: Env.SANDBOX, // Env.PRODUCTION by default
13
+ env: Env.SANDBOX, // Env.PRODUCTION by default
14
14
  })
15
15
  ```
16
16
 
@@ -85,18 +85,22 @@ client.bank.withdraw(user: UserRef, params: BankWithdrawParams): Promise<{ trans
85
85
  |---|---|---|
86
86
  | `params.amount` | `Amount` | EUR, rounded to 2 decimals ([Amounts](../concepts.md#amounts)) |
87
87
  | `params.iban`, `params.bank`, `params.bic` | `string` | Optional: update the customer's bank details before the withdrawal |
88
+ | `params.idempotencyKey` | `string` | Optional: 64 characters max, unique per customer — replaying the same key returns the same withdrawal |
88
89
 
89
90
  ```ts
90
91
  const { transaction } = await client.bank.withdraw('CUSTOMER_UUID', {
91
92
  amount: '50.00',
92
- iban: 'FR76…', // optional, sets or replaces the customer's bank details
93
+ iban: 'FR76…', // optional, sets or replaces the customer's bank details
93
94
  bic: 'BNPAFRPP',
95
+ idempotencyKey: 'WITHDRAW-REF-42', // optional, makes the call safe to replay
94
96
  })
95
-
96
- const movement = await client.transaction.get(transaction) // follow the withdrawal in the transaction journal
97
97
  ```
98
98
 
99
- The withdrawal goes to the customer's IBAN: the amount is reserved in `pending.out` and debited from the balance when the provider confirms the wire; the event `bank.debited` reports it then, with `amount`, `fee` and `net` — what the customer receives ([Following a deposit and a withdrawal](../concepts.md#following-a-deposit-and-a-withdrawal)). The account must have bank details (`412 bank_rib_required`), a sufficient balance (`416 requested_amount_error`) and an amount above the fee (`416 amount_below_fee`). `transaction` identifies the withdrawal — its `Transaction` in the journal ([Transactions](transaction.md)).
99
+ The withdrawal goes to the customer's IBAN: the amount is reserved in `pending.out` and debited from the balance when the provider confirms the wire; the event `bank.debited` reports it then, with `amount`, `fee` and `net` — what the customer receives ([Following a deposit and a withdrawal](../concepts.md#following-a-deposit-and-a-withdrawal)). The account must have bank details (`412 bank_rib_required`), a sufficient balance (`416 requested_amount_error`) and an amount above the fee (`416 amount_below_fee`). Bank details sent with the call are written to the account even when the withdrawal is then refused.
100
+
101
+ `idempotencyKey` makes the call safe to replay: the same key with the same amount reserves the amount once and returns the same `transaction`, the same key with a different amount is refused (`412 idempotency_amount_mismatch`), and an invalid key answers `422 invalid_idempotency_key`. A key identifies one withdrawal for good — replayed after the withdrawal has failed, it returns that withdrawal instead of starting a new one.
102
+
103
+ `transaction` identifies the withdrawal. Its `Transaction` in the journal ([Transactions](transaction.md)) is opened by the compliance analysis, within a minute of the call: `transaction.get()` answers `404 unknown_transaction` until then, and reads it with this same identifier once it is opened.
100
104
 
101
105
  ![An EUR withdrawal: the reserve on the ledger, the compliance analysis, the wire from the organization account to the customer IBAN, the debit at confirmation](../media/withdrawal-flow.svg)
102
106
 
@@ -106,7 +110,7 @@ The withdrawal goes to the customer's IBAN: the amount is reserved in `pending.o
106
110
  client.bank.credit(params: BankCreditParams): Promise<Created>
107
111
  ```
108
112
 
109
- `credit` only applies when your organization's bank provider is **manual** — deposits are not reported to BITGEN automatically: you tell BITGEN a wire has arrived on the organization's account. The amount enters `pending.in`, goes through BITGEN's processing and the compliance analysis, and the account is credited then — `bank.credited` at that moment ([Following a deposit and a withdrawal](../concepts.md#following-a-deposit-and-a-withdrawal)). On a provider that **takes the declaration and reports the deposit itself** — the test bank of the sandbox environment — the call answers `201` with an empty body, no `uuid`: the incoming movement appears in `pending.in` a second later, once the provider has reported it, and the `bank.transaction` / `bank.credited` events follow as for any deposit. With an automated provider that refuses declarations, deposits are detected and credited automatically and you are notified by the `bank.credited` webhook ([Webhooks](webhooks.md)) — do not call `credit`: the API refuses it (`412 deposit_reported_by_provider`). The account is designated either by the customer (`user`) or by the wire transfer reference of the account (`message`).
113
+ `credit` only applies when your organization's bank provider is **manual** — deposits are not reported to BITGEN automatically: you tell BITGEN a wire has arrived on the organization's account. The amount enters `pending.in`, goes through BITGEN's processing and the compliance analysis, and the account is credited then — `bank.credited` at that moment ([Following a deposit and a withdrawal](../concepts.md#following-a-deposit-and-a-withdrawal)). On a provider that **takes the declaration and reports the deposit itself**, the call answers `201` with an empty body, no `uuid`: the incoming movement appears in `pending.in` a second later, once the provider has reported it, and the `bank.transaction` / `bank.credited` events follow as for any deposit. With an automated provider that refuses declarations, deposits are detected and credited automatically and you are notified by the `bank.credited` webhook ([Webhooks](webhooks.md)) — do not call `credit`: the API refuses it (`412 deposit_reported_by_provider`). The account is designated either by the customer (`user`) or by the wire transfer reference of the account (`message`).
110
114
 
111
115
  | Parameter | Type | Description |
112
116
  |---|---|---|
@@ -114,7 +118,7 @@ client.bank.credit(params: BankCreditParams): Promise<Created>
114
118
  | `params.currency` | `'EUR'` | Optional |
115
119
  | `params.user` | `UserRef` | The customer — or `message` |
116
120
  | `params.message` | `string` | The wire transfer reference of the account (`BTGN…`) — or `user` |
117
- | `params.reference` | `string` | The bank's transfer reference — it makes the call idempotent: calling twice with the same reference declares once (and returns the same `uuid`) |
121
+ | `params.reference` | `string` | The bank's transfer reference — it identifies one deposit and one only. Calling twice with the same reference **and the same amount** declares once and returns the same `uuid`; calling again with a **different amount** is refused (`412 reference_amount_mismatch`). Your references are private to your organization. 218 characters at most |
118
122
 
119
123
  ```ts
120
124
  const { uuid } = await client.bank.credit({
@@ -144,6 +148,8 @@ In addition to the [common errors](../errors.md#common-errors):
144
148
  | `412` | `bank_rib_required` | `withdraw` without an IBAN or a bank on the account |
145
149
  | `412` | `ramp_not_enabled` | The `CoreType.RAMP` (bank) connector of your organization is not enabled |
146
150
  | `412` | `deposit_reported_by_provider` | `credit` on an automated bank provider that refuses declarations: deposits are reported by the provider itself |
151
+ | `412` | `reference_amount_mismatch` | The same `reference` was already declared for a different amount |
152
+ | `416` | `reference_too_long` | The `reference` is longer than 218 characters |
147
153
  | `412` | `trading_not_enabled` | The `CoreType.TRADING` connector of your organization is not enabled |
148
154
  | `416` | `requested_amount_error` | Insufficient balance |
149
155
  | `416` | `amount_below_fee` | The amount does not cover the fee |
@@ -28,7 +28,7 @@ for (const wallet of wallets) {
28
28
  console.log(wallet.asset.iso, wallet.balance, wallet.address) // 'ETH' '0.5' '0xabc…'
29
29
  }
30
30
 
31
- const treasury = await client.custody.wallets('YOUR_SCOPE_UUID') // the treasury wallets of your organization
31
+ const treasury = await client.custody.wallets('YOUR_ORGANIZATION_SCOPE') // the treasury wallets of your organization
32
32
  ```
33
33
 
34
34
  Returns the wallets without their `history`:
@@ -134,6 +134,7 @@ In addition to the [common errors](../errors.md#common-errors):
134
134
  | `404` | `unknown_organization` | The organization is unknown |
135
135
  | `404` | `withdraw_organization_unresolved` | The organization of the withdrawal is unresolved |
136
136
  | `409` | `duplicate_withdraw` | Duplicate withdrawal |
137
+ | `409` | `withdraw_replay_mismatch` | Same `idempotencyKey` replayed with a different amount or destination address. An identical replay returns the existing movement, without sending anything on chain |
137
138
  | `412` | `custody_not_enabled` | The `CUSTODY` connector of your organization is not enabled |
138
139
  | `415` | `custody_portfolio_treasury_unsupported` | `portfolio` on your organization |
139
140
  | `415` | `custody_treasury_withdraw_unsupported` | `withdraw` on your organization |
@@ -31,6 +31,7 @@ client.customer.create(params: CreateCustomerParams): Promise<Created>
31
31
  | `params.account.fin` | `string` | Tax identification number of the customer — optional, 100 characters max |
32
32
  | `params.account.needActivation` | `boolean` | Default `true`: BITGEN emails the customer an activation link and the account stays `CustomerState.CREATED` (the bank, custody, trading and staking resources refuse it) until they activate. `false`: the account is usable right away and BITGEN sends no email — for an organization that handles activation and notifications with its own system, or through webhooks |
33
33
  | `params.account.notify` | `boolean` | Default `true`: the customer receives BITGEN's emails (newsletter). `false`: none |
34
+ | `params.account.canLogin` | `boolean` | Default `true`: the customer may sign in to the BITGEN web application. `false`: they cannot, and the activation answers only their `uuid` instead of a session |
34
35
  | `params.group.manager` | `string` | uuid of the collaborator of your organization who follows this customer — required; the customer is created in your organization |
35
36
  | `params.locale` | `Locale` | `Locale.FR` (default) or `Locale.EN` |
36
37
  | `params.organization` | `OrganizationCategory` | Category: `OrganizationCategory.CUSTOMER` (default) or `OrganizationCategory.B2B` — `B2B` also opens a KYB file |
@@ -59,7 +60,7 @@ const { uuid } = await client.customer.create({
59
60
 
60
61
  With `needActivation: false` the account is usable right away and BITGEN sends no activation email — for an organization that handles activation and notifications with its own system, or through webhooks ([Webhooks](webhooks.md)); with `notify: false` the customer receives no BITGEN email at all.
61
62
 
62
- When the email already belongs to an active account whose KYC is validated, that account is **attached** to your organization instead of being created. An active account without a validated KYC cannot be attached (`412 user_not_attachable`), an account already attached to another organization is refused (`409 user_already_assigned`), and so is an account still being created, for 15 minutes (`409 account_unavailable`).
63
+ When the email already belongs to an active account whose KYC is validated, that account is **invited** to your organization instead of being created: a pending collaboration appears, a `customer.invitation.create` webhook is sent, and the attachment only takes effect once the person accepts. This holds whatever role you ask for. An active account without a validated KYC cannot be invited (`412 user_not_attachable`), a person who is already a **customer** of another organization is refused (`409 user_already_assigned`) — being an employee elsewhere does not block anything — and so is an account still being created, for 14 days (`409 account_unavailable`).
63
64
 
64
65
  ## List
65
66
 
@@ -196,8 +197,8 @@ In addition to the [common errors](../errors.md#common-errors):
196
197
  | `400` | `invalid_fin` | `account.fin` (tax identification number) is longer than 100 characters, or not a scalar |
197
198
  | `403` | `missing_group_organization_or_manager` | `group.manager` is missing |
198
199
  | `404` | `unknown_user` | Unknown customer (`get`), or unknown `manager` (`list`) |
199
- | `409` | `user_already_assigned` | The email belongs to an account attached to another organization |
200
- | `409` | `account_unavailable` | The email belongs to an account still being created (less than 15 minutes ago) |
200
+ | `409` | `user_already_assigned` | The person is already a **customer** of another organization. Being an employee elsewhere does not block anything: only the customer role is exclusive |
201
+ | `409` | `account_unavailable` | The email belongs to an account still being created (less than 14 days ago) |
201
202
  | `412` | `user_not_attachable` | The email belongs to an active account without a validated KYC |
202
203
  | `422` | `invalid_include_closed` | `includeClosed` is not a boolean value |
203
204
 
@@ -251,7 +251,7 @@ In addition to the [common errors](../errors.md#common-errors), and the custody
251
251
  | `403` | `account_frozen` | The customer's account is frozen |
252
252
  | `403` | `kyc_not_validated` | Your organization uses BITGEN's identity verification and the customer's identity is not validated ([Activation and identity](../concepts.md#activation-and-identity)) |
253
253
  | `403` | `user_actions_disabled` | Customer actions are disabled for your organization (`user_can_actions` flag) |
254
- | `404` | `unknown_user` | `stake`: unknown customer; `list`, `movements`: unknown `user` |
254
+ | `404` | `unknown_user` | `list`, `movements`: unknown `user`. **`stake` no longer answers this code**: an unknown customer and a customer outside your organization both answer `403 org_forbidden` |
255
255
  | `404` | `unknown_core` | `stake`: unknown `provider` |
256
256
  | `404` | `unknown_asset` | Unknown asset |
257
257
  | `404` | `unknown_organization` | The organization is unknown |
@@ -242,7 +242,7 @@ Answer with a 2xx status: a delivery that does not get one is retried 4 times (a
242
242
  import { createServer } from 'node:http'
243
243
  import { BitgenClient, BitgenError, WebhookEventName } from '@bitgen/sdk'
244
244
 
245
- const client = new BitgenClient({ scope: 'YOUR_SCOPE_UUID', apiKey: 'YOUR_API_KEY' })
245
+ const client = new BitgenClient({ scope: 'YOUR_ORGANIZATION_SCOPE', apiKey: 'YOUR_API_KEY' })
246
246
  const { secret } = await client.webhooks.list()
247
247
 
248
248
  createServer((req, res) => {
@@ -25,7 +25,11 @@ export class BankResource {
25
25
  return await this.http.get(`/bank/${pathSegment(resolveUuid(user), 'user')}/operations`, { ...params })
26
26
  }
27
27
 
28
- /** EUR withdrawal to the customer's IBAN — `iban` / `bank` / `bic` update the bank details first */
28
+ /**
29
+ * EUR withdrawal to the customer's IBAN — `iban` / `bank` / `bic` update the bank details first,
30
+ * `idempotencyKey` makes the call safe to replay. `transaction` identifies the withdrawal: its line in
31
+ * the journal is opened by the compliance analysis, within a minute of the call.
32
+ */
29
33
  async withdraw(user: UserRef, params: BankWithdrawParams): Promise<{ transaction: string }> {
30
34
  return await this.http.put(`/bank/${pathSegment(resolveUuid(user), 'user')}`, { ...params, amount: amount(params.amount) })
31
35
  }
package/src/types/bank.ts CHANGED
@@ -46,6 +46,8 @@ export interface BankWithdrawParams {
46
46
  iban?: string
47
47
  bank?: string
48
48
  bic?: string
49
+ /** ≤ 64 characters, unique per customer: replaying returns the same withdrawal */
50
+ idempotencyKey?: string
49
51
  }
50
52
 
51
53
  export interface BankCreditParams {
@@ -164,6 +164,12 @@ export interface CreateCustomerParams {
164
164
  needActivation?: boolean
165
165
  /** Default `true`: the customer receives BITGEN's emails (newsletter). `false`: none */
166
166
  notify?: boolean
167
+ /**
168
+ * Default `true`: the customer may sign in to the BITGEN web application. `false`: they cannot, and the
169
+ * activation answers only their `uuid` instead of a session — for an organization that drives everything
170
+ * through the API with its own interface.
171
+ */
172
+ canLogin?: boolean
167
173
  }
168
174
  /** `manager` = uuid of the collaborator of the organization who follows this customer — the customer is created in the key's organization */
169
175
  group: { manager: string }
package/src/version.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  // Generated by scripts/prebuild.js from package.json — do not edit
2
- export const VERSION = "1.0.6"
2
+ export const VERSION = "1.0.8"