@delopay/sdk 0.393.0 → 0.400.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.js CHANGED
@@ -116,6 +116,7 @@ import {
116
116
  PAYPAL_CARD_LAYOUTS,
117
117
  PAYPAL_LABEL_STYLES,
118
118
  PRESENTATION_CONTRACT_VERSION,
119
+ PayoutDestinations,
119
120
  PaypalDisputes,
120
121
  Persons,
121
122
  PresentationCache,
@@ -305,7 +306,7 @@ import {
305
306
  visibleCustomFields,
306
307
  whopAccentSwatch,
307
308
  whopCardElement
308
- } from "./chunk-VOYGZ2V6.js";
309
+ } from "./chunk-AZRXI3FB.js";
309
310
 
310
311
  // src/internal/resources/admin.ts
311
312
  var Admin = class {
@@ -649,10 +650,29 @@ var AdminPortal = class {
649
650
  query
650
651
  });
651
652
  }
653
+ /**
654
+ * Persons of every merchant account, connected accounts included, or of the
655
+ * one merchant named in `merchant_id`. Each row is one merchant's person
656
+ * and names that merchant; persons of two merchants are never merged,
657
+ * whatever they share. `search` is matched at every merchant listed.
658
+ *
659
+ * A `limit` outside 1 to 100, a `search` longer than 320 characters, or
660
+ * `sort_by: 'captured'` without a three-letter `captured_currency` is a
661
+ * `400`.
662
+ *
663
+ * `GET /admin-portal/persons`
664
+ */
665
+ async listPersonsAcrossMerchants(params) {
666
+ if (params === void 0) {
667
+ return this.request("GET", "/admin-portal/persons");
668
+ }
669
+ return this.request("GET", "/admin-portal/persons", { query: params });
670
+ }
652
671
  /**
653
672
  * One page of ONE merchant's persons: the same query and response as the
654
- * merchant-facing `persons.list`, admin-authenticated. Persons are never
655
- * read across merchants.
673
+ * merchant-facing `persons.list`, admin-authenticated. A person stays one
674
+ * merchant's; `listPersonsAcrossMerchants` lists several merchants' side by
675
+ * side.
656
676
  *
657
677
  * `GET /admin-portal/persons/{merchantId}`
658
678
  */
@@ -698,6 +718,97 @@ var AdminPortal = class {
698
718
  { query: params }
699
719
  );
700
720
  }
721
+ /**
722
+ * Every staff flag of a person, active and removed, newest first, with
723
+ * those of the persons merged into it. A merged person reads as the person
724
+ * it merged into. Staff only; a flag changes no payment.
725
+ *
726
+ * `GET /admin-portal/persons/{merchantId}/{personId}/flags`
727
+ */
728
+ async listPersonFlags(merchantId, personId) {
729
+ return this.request("GET", personFlags(merchantId, personId));
730
+ }
731
+ /**
732
+ * Flags a person for staff. The flag changes no payment and the merchant
733
+ * never sees it. A merged person's flag goes on the person it merged into.
734
+ * A person already flagged is refused with `IR_38` (400); a staff role that
735
+ * may not flag buyers gets a `403`.
736
+ *
737
+ * `POST /admin-portal/persons/{merchantId}/{personId}/flags`
738
+ */
739
+ async flagPerson(merchantId, personId, body) {
740
+ return this.request("POST", personFlags(merchantId, personId), { body });
741
+ }
742
+ /**
743
+ * Replaces an active flag's reason and note at the `version` read. A
744
+ * colleague's newer change, or a removal, since that read is refused with
745
+ * `IR_16` (400) rather than overwritten.
746
+ *
747
+ * `PUT /admin-portal/persons/{merchantId}/{personId}/flags/{flagId}`
748
+ */
749
+ async updatePersonFlag(merchantId, personId, flagId, body) {
750
+ return this.request(
751
+ "PUT",
752
+ `${personFlags(merchantId, personId)}/${encodeURIComponent(flagId)}`,
753
+ { body }
754
+ );
755
+ }
756
+ /**
757
+ * Removes a flag at the `version` read: the flag stops and stays in the
758
+ * history with who removed it and when, which is what this answers. A
759
+ * colleague's change since that read is refused with `IR_16` (400).
760
+ *
761
+ * `DELETE /admin-portal/persons/{merchantId}/{personId}/flags/{flagId}?version=`
762
+ */
763
+ async removePersonFlag(merchantId, personId, flagId, version) {
764
+ return this.request(
765
+ "DELETE",
766
+ `${personFlags(merchantId, personId)}/${encodeURIComponent(flagId)}`,
767
+ { query: { version } }
768
+ );
769
+ }
770
+ /**
771
+ * One page of a merchant's persons with an active flag, newest flag first.
772
+ * A flag on a merged person is listed under the person it merged into, and
773
+ * a person with two active flags is listed once, with the newer one.
774
+ *
775
+ * `GET /admin-portal/persons/{merchantId}/flagged`
776
+ */
777
+ async listFlaggedPersons(merchantId, params) {
778
+ if (params === void 0) {
779
+ return this.request("GET", `${adminPersons(merchantId)}/flagged`);
780
+ }
781
+ return this.request("GET", `${adminPersons(merchantId)}/flagged`, {
782
+ query: params
783
+ });
784
+ }
785
+ /**
786
+ * Whether each of 1 to 100 persons of a merchant is flagged, one answer
787
+ * per asked person in the order asked. A merged person answers for the
788
+ * person it merged into; an unknown person is not flagged. No id, or more
789
+ * than 100, is a `400`.
790
+ *
791
+ * `GET /admin-portal/persons/{merchantId}/flag-status?person_ids=`
792
+ */
793
+ async personFlagStatus(merchantId, personIds) {
794
+ return this.request("GET", `${adminPersons(merchantId)}/flag-status`, {
795
+ query: { person_ids: personIds.join(",") }
796
+ });
797
+ }
798
+ /**
799
+ * Persons flagged by staff at other merchants who share an email address
800
+ * or a device id with this person's 100 most recent payments, each once,
801
+ * newest flag first. A card, an IP address or device traits never match.
802
+ * A hint only: the persons stay separate and nothing is written.
803
+ *
804
+ * `GET /admin-portal/persons/{merchantId}/{personId}/flagged-elsewhere`
805
+ */
806
+ async listFlaggedElsewhere(merchantId, personId) {
807
+ return this.request(
808
+ "GET",
809
+ `${adminPersons(merchantId)}/${encodeURIComponent(personId)}/flagged-elsewhere`
810
+ );
811
+ }
701
812
  async exportTransactions(params, options) {
702
813
  return runExport(
703
814
  this.request,
@@ -718,7 +829,8 @@ var AdminPortal = class {
718
829
  }
719
830
  /**
720
831
  * Full detail for a single transaction of ANY merchant — the same
721
- * `PaymentResponse` the merchant `payments.retrieve` returns. Admin-scoped:
832
+ * `PaymentResponse` the merchant `payments.retrieve` returns, with what only
833
+ * staff see beside it (`person_flagged`, `flagged_elsewhere`). Admin-scoped:
722
834
  * the JWT (or admin API key) does not need to belong to the payment's
723
835
  * merchant; the backend resolves the owning merchant and reads it read-only
724
836
  * (no connector sync).
@@ -1192,6 +1304,31 @@ var AdminPortal = class {
1192
1304
  query: params
1193
1305
  });
1194
1306
  }
1307
+ /**
1308
+ * How accurate buyer risk scores were in a period, against what later
1309
+ * happened to the payments: fraud, clean, pending and never charged, how
1310
+ * well the flagged bands caught the fraud, each band and signal, and the
1311
+ * buyers the score stopped who later paid with no fraud. Stores nothing.
1312
+ * `GET /admin-portal/buyer-risk/accuracy`
1313
+ */
1314
+ async buyerRiskAccuracy(params = {}) {
1315
+ return this.request("GET", "/admin-portal/buyer-risk/accuracy", {
1316
+ query: params
1317
+ });
1318
+ }
1319
+ /**
1320
+ * The payments behind one number of {@link AdminPortal.buyerRiskAccuracy}:
1321
+ * the payments a signal fired on, those in a band, a flagged × outcome cell,
1322
+ * the interventions or the false declines. Paged, sorted and searchable
1323
+ * like the analytics drills, and answered in the same shape, with each
1324
+ * row's band, score, outcome and applied action.
1325
+ * `GET /admin-portal/buyer-risk/accuracy/payments`
1326
+ */
1327
+ async buyerRiskAccuracyPayments(params = {}) {
1328
+ return this.request("GET", "/admin-portal/buyer-risk/accuracy/payments", {
1329
+ query: params
1330
+ });
1331
+ }
1195
1332
  /**
1196
1333
  * Platform billing dashboard: total balance across all ledger accounts (+
1197
1334
  * the net change), top-ups, fees collected, and the day-by-day ledger flow.
@@ -1273,6 +1410,70 @@ var AdminPortal = class {
1273
1410
  async updateUser(userId, body) {
1274
1411
  return this.request("PATCH", `/admin-portal/users/${encodeURIComponent(userId)}`, { body });
1275
1412
  }
1413
+ /**
1414
+ * One user's account and its health: whether it is active and verified,
1415
+ * whether two-factor authentication is set up, when the password last
1416
+ * changed, the linked single sign-on providers, the newest successful and
1417
+ * failed sign-in, when the user was last seen and how many sessions are
1418
+ * live. Lists every membership the user holds in this tenant, invitations
1419
+ * and expired ones included, with its role and status. Never returns a
1420
+ * credential. `GET /admin-portal/users/{user_id}`
1421
+ *
1422
+ * Needs an internal role holding `ProfileUserRead`, or the admin API key.
1423
+ * A user with no membership in this tenant is a `404`.
1424
+ */
1425
+ async getUser(userId) {
1426
+ return this.request("GET", `/admin-portal/users/${encodeURIComponent(userId)}`);
1427
+ }
1428
+ /**
1429
+ * One user's sign-in history (successes and failures, method, address,
1430
+ * location and device), filtered, sorted and paged as
1431
+ * `users.listLoginActivity` is. Same access and `404` rule as `getUser`.
1432
+ * `GET /admin-portal/users/{user_id}/login-activity`
1433
+ */
1434
+ async listUserLoginActivity(userId, params) {
1435
+ const path3 = `/admin-portal/users/${encodeURIComponent(userId)}/login-activity`;
1436
+ if (params === void 0) {
1437
+ return this.request("GET", path3);
1438
+ }
1439
+ return this.request("GET", path3, {
1440
+ query: csvQuery(params, ["event_type", "auth_method"])
1441
+ });
1442
+ }
1443
+ /**
1444
+ * One user's live sessions: neither signed out nor expired. `is_current`
1445
+ * marks the caller's own session only, when the caller looks at themselves.
1446
+ * Same access and `404` rule as `getUser`.
1447
+ * `GET /admin-portal/users/{user_id}/sessions`
1448
+ */
1449
+ async listUserSessions(userId) {
1450
+ return this.request("GET", `/admin-portal/users/${encodeURIComponent(userId)}/sessions`);
1451
+ }
1452
+ /**
1453
+ * End one session of the user: its token is refused on its next request.
1454
+ * Needs `UsersManage`. Recorded in the audit log. A session that has
1455
+ * already ended answers `revoked: false` and records nothing. A session of
1456
+ * another user is a `404`, as an unknown id is.
1457
+ * `POST /admin-portal/users/{user_id}/sessions/{session_id}/revoke`
1458
+ */
1459
+ async revokeUserSession(userId, sessionId) {
1460
+ return this.request(
1461
+ "POST",
1462
+ `/admin-portal/users/${encodeURIComponent(userId)}/sessions/${encodeURIComponent(sessionId)}/revoke`
1463
+ );
1464
+ }
1465
+ /**
1466
+ * Sign the user out of every session and token, wherever they signed in.
1467
+ * Needs `UsersManage`. The account stays active and the user can sign in
1468
+ * again at once. Answers how many live sessions were ended. Recorded in the
1469
+ * audit log. `POST /admin-portal/users/{user_id}/sessions/revoke-all`
1470
+ */
1471
+ async revokeAllUserSessions(userId) {
1472
+ return this.request(
1473
+ "POST",
1474
+ `/admin-portal/users/${encodeURIComponent(userId)}/sessions/revoke-all`
1475
+ );
1476
+ }
1276
1477
  /**
1277
1478
  * Which checkout payment methods a member of `merchantId` may change.
1278
1479
  * `GET /admin-portal/accounts/{merchant_id}/members/{user_id}/method-access`
@@ -1921,6 +2122,9 @@ function transactionListQuery(params) {
1921
2122
  function adminPersons(merchantId) {
1922
2123
  return `/admin-portal/persons/${encodeURIComponent(merchantId)}`;
1923
2124
  }
2125
+ function personFlags(merchantId, personId) {
2126
+ return `${adminPersons(merchantId)}/${encodeURIComponent(personId)}/flags`;
2127
+ }
1924
2128
  function adminAccount(merchantId) {
1925
2129
  return `/admin-portal/accounts/${encodeURIComponent(merchantId)}`;
1926
2130
  }
@@ -2942,6 +3146,7 @@ export {
2942
3146
  PAYPAL_CARD_LAYOUTS,
2943
3147
  PAYPAL_LABEL_STYLES,
2944
3148
  PRESENTATION_CONTRACT_VERSION,
3149
+ PayoutDestinations,
2945
3150
  PaypalDisputes,
2946
3151
  Persons,
2947
3152
  PlatformBilling,