@delopay/sdk 0.285.0 → 0.289.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/dist/internal.cjs CHANGED
@@ -36,6 +36,7 @@ __export(internal_exports, {
36
36
  APPLE_PAY_BUTTON_STYLES: () => APPLE_PAY_BUTTON_STYLES,
37
37
  APPLE_PAY_BUTTON_TYPES: () => APPLE_PAY_BUTTON_TYPES,
38
38
  Admin: () => Admin,
39
+ AdminBranding: () => AdminBranding,
39
40
  AdminLive: () => AdminLive,
40
41
  AdminPortal: () => AdminPortal,
41
42
  Analytics: () => Analytics,
@@ -46,6 +47,7 @@ __export(internal_exports, {
46
47
  BRANDING_EXPORT_FORMAT: () => BRANDING_EXPORT_FORMAT,
47
48
  BRANDING_EXPORT_VERSION: () => BRANDING_EXPORT_VERSION,
48
49
  BUILTIN_PAYMENT_ICON_KEYS: () => BUILTIN_PAYMENT_ICON_KEYS,
50
+ Branding: () => Branding,
49
51
  BuyerBlocklist: () => BuyerBlocklist,
50
52
  BuyerConversations: () => BuyerConversations,
51
53
  BuyerEvidenceReviews: () => BuyerEvidenceReviews,
@@ -69,6 +71,7 @@ __export(internal_exports, {
69
71
  CheckoutMethods: () => CheckoutMethods,
70
72
  CheckoutRecovery: () => CheckoutRecovery,
71
73
  CheckoutSession: () => CheckoutSession,
74
+ CheckoutTemplates: () => CheckoutTemplates,
72
75
  Configs: () => Configs,
73
76
  ConnectorRestrictionRules: () => ConnectorRestrictionRules,
74
77
  ConnectorRestrictions: () => ConnectorRestrictions,
@@ -181,6 +184,7 @@ __export(internal_exports, {
181
184
  anyOf: () => anyOf,
182
185
  applyBrandingVariables: () => applyBrandingVariables,
183
186
  asAirwallexCardPreset: () => asAirwallexCardPreset,
187
+ brandingAssetPath: () => brandingAssetPath,
184
188
  buildBrandingExport: () => buildBrandingExport,
185
189
  builtinPaymentIconDataUri: () => builtinPaymentIconDataUri,
186
190
  builtinPaymentIconSvg: () => builtinPaymentIconSvg,
@@ -5268,6 +5272,49 @@ var Users = class {
5268
5272
  body: params
5269
5273
  });
5270
5274
  }
5275
+ /**
5276
+ * A member's permission overrides in your merchant: every area that can be
5277
+ * overridden at their level, with what their roles give, the level set for
5278
+ * them, and what they have. `GET /user/employees/{user_id}/permission-overrides`
5279
+ *
5280
+ * Needs the *Users* read permission, and answers only for a member
5281
+ * `listUsersInLineage` shows you (any other id is a 404 `UR_68`).
5282
+ * `can_edit`, `can_raise` and each area's `grantable_level` say what you
5283
+ * may change.
5284
+ */
5285
+ async getMemberPermissionOverrides(userId) {
5286
+ return this.request(
5287
+ "GET",
5288
+ `/user/employees/${encodeURIComponent(userId)}/permission-overrides`
5289
+ );
5290
+ }
5291
+ /**
5292
+ * Replace a member's permission overrides. An area left out goes back to
5293
+ * what their roles give. `PUT /user/employees/{user_id}/permission-overrides`
5294
+ *
5295
+ * Needs the *Users* write permission and a member within your reach, other
5296
+ * than yourself. Keeping or lowering is always allowed; a gain must stay
5297
+ * within what you hold in that area, and a gain above the member's roles
5298
+ * needs `can_raise`. The change is audited and applies to the member's next
5299
+ * request. A refusal is a `UR_68` whose `data` is
5300
+ * `{ reason: 'permission_overrides', refusal }` (see
5301
+ * {@link PermissionOverrideRefusal}).
5302
+ */
5303
+ async updateMemberPermissionOverrides(userId, params) {
5304
+ return this.request(
5305
+ "PUT",
5306
+ `/user/employees/${encodeURIComponent(userId)}/permission-overrides`,
5307
+ { body: params }
5308
+ );
5309
+ }
5310
+ /**
5311
+ * The permission overrides your own session acts under, sorted by area.
5312
+ * An area named here has exactly that level, whatever a broader legacy area
5313
+ * of the role would suggest. `GET /user/role/permission-overrides`
5314
+ */
5315
+ async getOwnPermissionOverrides() {
5316
+ return this.request("GET", "/user/role/permission-overrides");
5317
+ }
5271
5318
  /** Sign in via OIDC. `POST /user/oidc` */
5272
5319
  async signInOidc(params) {
5273
5320
  return this.request("POST", "/user/oidc", { body: params });
@@ -5492,7 +5539,8 @@ var IdentityVerifications = class {
5492
5539
  }
5493
5540
  /**
5494
5541
  * One verification. With `force_sync: true`, a verification the provider
5495
- * can still change (pending or in review) is read from the provider first.
5542
+ * can still change (pending or in review, or a subject under ongoing AML
5543
+ * monitoring) is read from the provider first.
5496
5544
  *
5497
5545
  * `GET /identity-verifications/{verification_id}`
5498
5546
  */
@@ -5504,8 +5552,9 @@ var IdentityVerifications = class {
5504
5552
  }
5505
5553
  /**
5506
5554
  * A subject's latest verification in one environment (live unless
5507
- * `test_mode: true`), with its checks. This is what risk rules read.
5508
- * `verification` is `null` when the subject has none.
5555
+ * `test_mode: true`), with its checks, and the subject's verification under
5556
+ * ongoing AML monitoring. This is what risk rules read. `verification` and
5557
+ * `aml_monitoring` are `null` when the subject has none.
5509
5558
  *
5510
5559
  * `GET /identity-verifications/subjects/{subject_reference}`
5511
5560
  */
@@ -5530,6 +5579,78 @@ var IdentityVerifications = class {
5530
5579
  { query, ...options }
5531
5580
  );
5532
5581
  }
5582
+ /**
5583
+ * Switch ongoing AML monitoring of a verification's subject. The provider
5584
+ * then keeps re-screening the subject against sanctions, PEP and
5585
+ * adverse-media lists, and every change it reports is recorded. Only a
5586
+ * verified person or business can be enrolled; monitoring can be switched
5587
+ * off at any time. Needs permission to edit customers.
5588
+ *
5589
+ * `POST /identity-verifications/{verification_id}/aml-monitoring`
5590
+ */
5591
+ async setAmlMonitoring(verificationId, params, options) {
5592
+ return this.request(
5593
+ "POST",
5594
+ `/identity-verifications/${encodeURIComponent(verificationId)}/aml-monitoring`,
5595
+ { body: params, ...options }
5596
+ );
5597
+ }
5598
+ /**
5599
+ * Every change of the subject's AML result the provider reported while the
5600
+ * subject was monitored, newest first, at most 100.
5601
+ *
5602
+ * `GET /identity-verifications/{verification_id}/aml-events`
5603
+ */
5604
+ async amlEvents(verificationId, options) {
5605
+ return this.request(
5606
+ "GET",
5607
+ `/identity-verifications/${encodeURIComponent(verificationId)}/aml-events`,
5608
+ options
5609
+ );
5610
+ }
5611
+ /**
5612
+ * A payment's screening by the transaction monitoring of the shop's
5613
+ * screening account. Recorded only: it never holds or refuses the payment.
5614
+ * Answers 404 when the payment has no screening. Needs permission to read
5615
+ * payments.
5616
+ *
5617
+ * `GET /identity-verifications/payment-screenings/{payment_id}`
5618
+ */
5619
+ async paymentScreening(paymentId, options) {
5620
+ return this.request(
5621
+ "GET",
5622
+ `/identity-verifications/payment-screenings/${encodeURIComponent(paymentId)}`,
5623
+ options
5624
+ );
5625
+ }
5626
+ /**
5627
+ * Whether an account screens its shop's payments. Needs permission to read
5628
+ * connectors.
5629
+ *
5630
+ * `GET /identity-verifications/accounts/{merchant_connector_id}/payment-screening`
5631
+ */
5632
+ async paymentScreeningSetting(merchantConnectorId, options) {
5633
+ return this.request(
5634
+ "GET",
5635
+ `/identity-verifications/accounts/${encodeURIComponent(merchantConnectorId)}/payment-screening`,
5636
+ options
5637
+ );
5638
+ }
5639
+ /**
5640
+ * Switch screening of the account's shop's payments. Switched on, every
5641
+ * payment of the shop that succeeds from then on is screened shortly after,
5642
+ * in the payment's own environment. A shop has at most one screening
5643
+ * account. Needs permission to edit connectors.
5644
+ *
5645
+ * `PUT /identity-verifications/accounts/{merchant_connector_id}/payment-screening`
5646
+ */
5647
+ async updatePaymentScreeningSetting(merchantConnectorId, params, options) {
5648
+ return this.request(
5649
+ "PUT",
5650
+ `/identity-verifications/accounts/${encodeURIComponent(merchantConnectorId)}/payment-screening`,
5651
+ { body: params, ...options }
5652
+ );
5653
+ }
5533
5654
  };
5534
5655
 
5535
5656
  // src/resources/webhooks.ts
@@ -6268,6 +6389,110 @@ var ShopLabels = class {
6268
6389
  }
6269
6390
  };
6270
6391
 
6392
+ // src/resources/checkoutTemplates.ts
6393
+ var CheckoutTemplates = class {
6394
+ constructor(request) {
6395
+ this.request = request;
6396
+ }
6397
+ /**
6398
+ * The merchant's templates, each with the shops on it and whether each
6399
+ * runs the template's current settings.
6400
+ * `GET /checkout-templates/{merchantId}`
6401
+ */
6402
+ async list(merchantId) {
6403
+ return this.request("GET", `/checkout-templates/${encodeURIComponent(merchantId)}`);
6404
+ }
6405
+ /**
6406
+ * Create a template, empty or copied from a shop's current settings. The
6407
+ * shop copied from is not changed.
6408
+ * `POST /checkout-templates/{merchantId}`
6409
+ */
6410
+ async create(merchantId, params) {
6411
+ return this.request("POST", `/checkout-templates/${encodeURIComponent(merchantId)}`, {
6412
+ body: params
6413
+ });
6414
+ }
6415
+ /** `GET /checkout-templates/{merchantId}/{templateId}` */
6416
+ async retrieve(merchantId, templateId) {
6417
+ return this.request(
6418
+ "GET",
6419
+ `/checkout-templates/${encodeURIComponent(merchantId)}/${encodeURIComponent(templateId)}`
6420
+ );
6421
+ }
6422
+ /**
6423
+ * Rename a template. A name another template of the merchant holds is
6424
+ * refused.
6425
+ * `POST /checkout-templates/{merchantId}/{templateId}`
6426
+ */
6427
+ async rename(merchantId, templateId, params) {
6428
+ return this.request(
6429
+ "POST",
6430
+ `/checkout-templates/${encodeURIComponent(merchantId)}/${encodeURIComponent(templateId)}`,
6431
+ { body: params }
6432
+ );
6433
+ }
6434
+ /**
6435
+ * Delete a template. Refused while a shop is on it.
6436
+ * `DELETE /checkout-templates/{merchantId}/{templateId}`
6437
+ */
6438
+ async delete(merchantId, templateId) {
6439
+ return this.request(
6440
+ "DELETE",
6441
+ `/checkout-templates/${encodeURIComponent(merchantId)}/${encodeURIComponent(templateId)}`
6442
+ );
6443
+ }
6444
+ /**
6445
+ * Put shops on the template and copy its settings into them; a shop on
6446
+ * another template moves. Each shop is reported on its own: one with
6447
+ * `blockers` is left unchanged. `dry_run` changes nothing and reports what
6448
+ * would change.
6449
+ * `POST /checkout-templates/{merchantId}/{templateId}/shops`
6450
+ */
6451
+ async assign(merchantId, templateId, params) {
6452
+ return this.request(
6453
+ "POST",
6454
+ `/checkout-templates/${encodeURIComponent(merchantId)}/${encodeURIComponent(templateId)}/shops`,
6455
+ {
6456
+ body: params
6457
+ }
6458
+ );
6459
+ }
6460
+ /**
6461
+ * Take a shop off the template. It keeps every setting it has, as its own.
6462
+ * `DELETE /checkout-templates/{merchantId}/{templateId}/shops/{profileId}`
6463
+ */
6464
+ async unassign(merchantId, templateId, profileId) {
6465
+ return this.request(
6466
+ "DELETE",
6467
+ `/checkout-templates/${encodeURIComponent(merchantId)}/${encodeURIComponent(templateId)}/shops/${encodeURIComponent(profileId)}`
6468
+ );
6469
+ }
6470
+ /**
6471
+ * Copy the template's current settings into its shops, all or the ones
6472
+ * named.
6473
+ * `POST /checkout-templates/{merchantId}/{templateId}/apply`
6474
+ */
6475
+ async apply(merchantId, templateId, params = {}) {
6476
+ return this.request(
6477
+ "POST",
6478
+ `/checkout-templates/${encodeURIComponent(merchantId)}/${encodeURIComponent(templateId)}/apply`,
6479
+ {
6480
+ body: params
6481
+ }
6482
+ );
6483
+ }
6484
+ /**
6485
+ * The template a shop is on, if any. Readable by the shop's own members.
6486
+ * `GET /checkout-templates/{merchantId}/shops/{profileId}`
6487
+ */
6488
+ async ofShop(merchantId, profileId) {
6489
+ return this.request(
6490
+ "GET",
6491
+ `/checkout-templates/${encodeURIComponent(merchantId)}/shops/${encodeURIComponent(profileId)}`
6492
+ );
6493
+ }
6494
+ };
6495
+
6271
6496
  // src/resources/buyerConversations.ts
6272
6497
  var BuyerConversations = class {
6273
6498
  constructor(request) {
@@ -9519,6 +9744,41 @@ var Live = class {
9519
9744
  }
9520
9745
  };
9521
9746
 
9747
+ // src/resources/deploymentBranding.ts
9748
+ function brandingAssetPath(asset, version) {
9749
+ const path = `/branding/assets/${encodeURIComponent(asset)}`;
9750
+ return version ? `${path}?v=${encodeURIComponent(version)}` : path;
9751
+ }
9752
+ var Branding = class {
9753
+ constructor(request, baseUrl) {
9754
+ this.request = request;
9755
+ this.baseUrl = baseUrl;
9756
+ }
9757
+ /**
9758
+ * The saved branding. A `null` field means "keep your own default".
9759
+ *
9760
+ * Branding is cosmetic, so treat any failure as "nothing saved": routers
9761
+ * from before this route answer 404, and a page must never wait long for
9762
+ * it. Pass a `signal` (e.g. `AbortSignal.timeout(2500)`) to bound the call
9763
+ * including its retries; a `timeout` alone applies to each attempt.
9764
+ *
9765
+ * `GET /branding`
9766
+ */
9767
+ async retrieve(options) {
9768
+ return this.request("GET", "/branding", { ...options });
9769
+ }
9770
+ /**
9771
+ * The address of one branding image or font file on this client's base
9772
+ * URL, for an `<img src>` or a `@font-face` `src`. See
9773
+ * {@link brandingAssetPath}.
9774
+ *
9775
+ * `GET /branding/assets/{asset}`
9776
+ */
9777
+ assetUrl(asset, version) {
9778
+ return `${this.baseUrl}${brandingAssetPath(asset, version)}`;
9779
+ }
9780
+ };
9781
+
9522
9782
  // src/client.ts
9523
9783
  var PRODUCTION_URL = "https://api.delopay.net";
9524
9784
  var SANDBOX_URL = "https://sandbox.delopay.net";
@@ -9798,6 +10058,7 @@ var Delopay = class {
9798
10058
  this.messageTemplates = new MessageTemplates(request);
9799
10059
  this.risk = new Risk(request);
9800
10060
  this.live = new Live(request, openStream);
10061
+ this.branding = new Branding(request, this.baseUrl);
9801
10062
  this.subscriptions = new Subscriptions(request);
9802
10063
  this.buyerPortal = new BuyerPortal(request);
9803
10064
  this.buyerAccount = new BuyerAccount(request);
@@ -9809,6 +10070,7 @@ var Delopay = class {
9809
10070
  this.sellToRestrictions = new SellToRestrictions(request);
9810
10071
  this.buyerBlocklist = new BuyerBlocklist(request);
9811
10072
  this.shopLabels = new ShopLabels(request);
10073
+ this.checkoutTemplates = new CheckoutTemplates(request);
9812
10074
  this.buyerConversations = new BuyerConversations(request);
9813
10075
  this.buyerEvidence = new BuyerEvidenceReviews(request);
9814
10076
  this.checkoutRecovery = new CheckoutRecovery(request);
@@ -14080,6 +14342,25 @@ var CheckoutSession = class {
14080
14342
  headers: this.bearerHeaders(options?.headers)
14081
14343
  });
14082
14344
  }
14345
+ /**
14346
+ * Reserve this payment attempt before a hosted card form contacts Stripe,
14347
+ * Airwallex, or NomuPay. Send the provider object rendered to this checkout
14348
+ * and retain the same `flow_id` across retries and any 3-D Secure step.
14349
+ *
14350
+ * Only `authorized: true` permits the form to contact its processor. A
14351
+ * competing flow receives `false` and must reload; an unresolved provider
14352
+ * outcome stays reserved, regardless of elapsed time. A buyer-blocklist
14353
+ * refusal throws a `DelopayError` with code `DE_14`.
14354
+ *
14355
+ * `POST /payment-link/{merchantId}/{paymentId}/browser-card-claim`
14356
+ */
14357
+ async claimBrowserCard(params, options) {
14358
+ return this.client.request("POST", `${this.linkBase}/browser-card-claim`, {
14359
+ body: params,
14360
+ ...options,
14361
+ headers: this.bearerHeaders(options?.headers)
14362
+ });
14363
+ }
14083
14364
  /**
14084
14365
  * Confirm the Stripe card form's PaymentIntent through the router, for a
14085
14366
  * checkout payload with `card_connector_server_confirm: true`. Stripe refuses
@@ -14101,6 +14382,10 @@ var CheckoutSession = class {
14101
14382
  * and that secret confirms nothing without the secret key — then call this
14102
14383
  * again without a payment method to finalize.
14103
14384
  *
14385
+ * Reserve the attempt with {@link claimBrowserCard} first. Send its granted
14386
+ * `flow_id` as `browser_flow_id` on both the initial and post-action confirm;
14387
+ * an omitted, null or nonholder flow is refused with `400` and code `IR_16`.
14388
+ *
14104
14389
  * A PaymentMethod rules out what `stripe.createPaymentMethod` cannot
14105
14390
  * produce: Stripe names Amazon Pay and Klarna in the Express Checkout
14106
14391
  * Element, which need `stripe.createConfirmationToken` instead. Neither can
@@ -14981,6 +15266,33 @@ var Admin = class {
14981
15266
  }
14982
15267
  };
14983
15268
 
15269
+ // src/internal/resources/adminBranding.ts
15270
+ var AdminBranding = class {
15271
+ constructor(request) {
15272
+ this.request = request;
15273
+ }
15274
+ /**
15275
+ * What is saved, the value in force for each unset field, and the revision
15276
+ * to send back on the next update.
15277
+ *
15278
+ * `GET /admin-portal/branding`
15279
+ */
15280
+ async retrieve(options) {
15281
+ return this.request("GET", "/admin-portal/branding", { ...options });
15282
+ }
15283
+ /**
15284
+ * Replace the whole branding; all fields `null` clears it. A changed image
15285
+ * or font address is fetched first and refused unless it answers with the
15286
+ * right kind of file. A stale `expected_revision` is refused and changes
15287
+ * nothing.
15288
+ *
15289
+ * `PUT /admin-portal/branding`
15290
+ */
15291
+ async update(params, options) {
15292
+ return this.request("PUT", "/admin-portal/branding", { body: params, ...options });
15293
+ }
15294
+ };
15295
+
14984
15296
  // src/internal/resources/adminLive.ts
14985
15297
  var AdminLive = class {
14986
15298
  constructor(request, openStream) {
@@ -15595,6 +15907,32 @@ var AdminPortal = class {
15595
15907
  { body }
15596
15908
  );
15597
15909
  }
15910
+ /**
15911
+ * A member of `merchantId`'s permission overrides.
15912
+ * `GET /admin-portal/accounts/{merchant_id}/members/{user_id}/permission-overrides`
15913
+ *
15914
+ * Any internal role may read them; `can_edit` is `false` for one without
15915
+ * `UsersManage`. A user holding no role in the merchant is a 404 `UR_68`.
15916
+ */
15917
+ async getMemberPermissionOverrides(merchantId, userId) {
15918
+ return this.request(
15919
+ "GET",
15920
+ `/admin-portal/accounts/${encodeURIComponent(merchantId)}/members/${encodeURIComponent(userId)}/permission-overrides`
15921
+ );
15922
+ }
15923
+ /**
15924
+ * Replace a member of `merchantId`'s permission overrides. Needs
15925
+ * `UsersManage`; an operator is not limited by their own access. Recorded
15926
+ * in the merchant's audit log and applied to the member's next request.
15927
+ * `PUT /admin-portal/accounts/{merchant_id}/members/{user_id}/permission-overrides`
15928
+ */
15929
+ async updateMemberPermissionOverrides(merchantId, userId, body) {
15930
+ return this.request(
15931
+ "PUT",
15932
+ `/admin-portal/accounts/${encodeURIComponent(merchantId)}/members/${encodeURIComponent(userId)}/permission-overrides`,
15933
+ { body }
15934
+ );
15935
+ }
15598
15936
  /**
15599
15937
  * Soft-delete a user globally: deactivates the row, blacklists existing
15600
15938
  * JWTs, and wipes credentials. Distinct from `deleteUserRole`, which
@@ -16721,6 +17059,7 @@ var DelopayInternal = class extends Delopay {
16721
17059
  this.adminPortal = new AdminPortal(request);
16722
17060
  const openStream = this.openEventStream.bind(this);
16723
17061
  this.adminLive = new AdminLive(request, openStream);
17062
+ this.adminBranding = new AdminBranding(request);
16724
17063
  this.auditLogs = new AuditLogs(request);
16725
17064
  this.cache = new Cache(request);
16726
17065
  this.cardIssuers = new CardIssuers(request);
@@ -16754,6 +17093,7 @@ var DelopayInternal = class extends Delopay {
16754
17093
  APPLE_PAY_BUTTON_STYLES,
16755
17094
  APPLE_PAY_BUTTON_TYPES,
16756
17095
  Admin,
17096
+ AdminBranding,
16757
17097
  AdminLive,
16758
17098
  AdminPortal,
16759
17099
  Analytics,
@@ -16764,6 +17104,7 @@ var DelopayInternal = class extends Delopay {
16764
17104
  BRANDING_EXPORT_FORMAT,
16765
17105
  BRANDING_EXPORT_VERSION,
16766
17106
  BUILTIN_PAYMENT_ICON_KEYS,
17107
+ Branding,
16767
17108
  BuyerBlocklist,
16768
17109
  BuyerConversations,
16769
17110
  BuyerEvidenceReviews,
@@ -16787,6 +17128,7 @@ var DelopayInternal = class extends Delopay {
16787
17128
  CheckoutMethods,
16788
17129
  CheckoutRecovery,
16789
17130
  CheckoutSession,
17131
+ CheckoutTemplates,
16790
17132
  Configs,
16791
17133
  ConnectorRestrictionRules,
16792
17134
  ConnectorRestrictions,
@@ -16899,6 +17241,7 @@ var DelopayInternal = class extends Delopay {
16899
17241
  anyOf,
16900
17242
  applyBrandingVariables,
16901
17243
  asAirwallexCardPreset,
17244
+ brandingAssetPath,
16902
17245
  buildBrandingExport,
16903
17246
  builtinPaymentIconDataUri,
16904
17247
  builtinPaymentIconSvg,