@delopay/sdk 0.198.0 → 0.201.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
@@ -102,6 +102,7 @@ __export(internal_exports, {
102
102
  NOTICE_ICON_PATHS: () => NOTICE_ICON_PATHS,
103
103
  NOTICE_LABEL_MAX_LENGTH: () => NOTICE_LABEL_MAX_LENGTH,
104
104
  NOTICE_SECTIONS: () => NOTICE_SECTIONS,
105
+ NativeRenewals: () => NativeRenewals,
105
106
  OperationLimits: () => OperationLimits,
106
107
  PANES_MAX: () => PANES_MAX,
107
108
  PANE_CATEGORY_KEYS: () => PANE_CATEGORY_KEYS,
@@ -1023,6 +1024,27 @@ var Customers = class {
1023
1024
  constructor(request) {
1024
1025
  this.request = request;
1025
1026
  }
1027
+ /** Issue a shop-scoped buyer portal link for this customer. */
1028
+ async createPortalLink(customerId, params, options) {
1029
+ return this.request("POST", `/customers/${encodeURIComponent(customerId)}/portal-links`, {
1030
+ body: params,
1031
+ ...options
1032
+ });
1033
+ }
1034
+ /** List issued grants without disclosing their secret URLs. */
1035
+ async listPortalLinks(customerId, params, options) {
1036
+ return this.request("GET", `/customers/${encodeURIComponent(customerId)}/portal-links`, {
1037
+ query: params,
1038
+ ...options
1039
+ });
1040
+ }
1041
+ async revokePortalLink(customerId, linkId, options) {
1042
+ return this.request(
1043
+ "DELETE",
1044
+ `/customers/${encodeURIComponent(customerId)}/portal-links/${encodeURIComponent(linkId)}`,
1045
+ { ...options }
1046
+ );
1047
+ }
1026
1048
  /**
1027
1049
  * Create a new customer.
1028
1050
  *
@@ -5286,9 +5308,10 @@ var ExternalRecords = class {
5286
5308
  * same thing is how a caller ends up waiting for something that will never
5287
5309
  * be built.
5288
5310
  *
5289
- * The answer describes the binary rather than anything a merchant owns, so
5290
- * it is the same for every caller of one deployment and is safe to cache for
5291
- * the life of a dashboard session.
5311
+ * The answer includes the current merchant's rollout and storage eligibility.
5312
+ * Read it for the authenticated merchant when deciding whether to offer an
5313
+ * action; do not reuse another merchant's response or a previous session's
5314
+ * answer after eligibility may have changed.
5292
5315
  */
5293
5316
  async capabilities() {
5294
5317
  return this.request("GET", "/external-records/capabilities");
@@ -5972,6 +5995,29 @@ var Subscriptions = class {
5972
5995
  constructor(request) {
5973
5996
  this.request = request;
5974
5997
  }
5998
+ /** Read native enrollment settings. Pass X-Profile-Id in options.headers. */
5999
+ async getNativeConfig(options) {
6000
+ return this.request("GET", "/subscriptions/native/config", { ...options });
6001
+ }
6002
+ /** Replace native enrollment settings. Pass X-Profile-Id in options.headers. */
6003
+ async updateNativeConfig(params, options) {
6004
+ return this.request("PUT", "/subscriptions/native/config", { body: params, ...options });
6005
+ }
6006
+ /** Read merchant-wide renewal recovery settings. */
6007
+ async getNativeDunning(options) {
6008
+ return this.request("GET", "/subscriptions/native/dunning", { ...options });
6009
+ }
6010
+ async updateNativeDunning(params, options) {
6011
+ return this.request("PUT", "/subscriptions/native/dunning", { body: params, ...options });
6012
+ }
6013
+ /** Read supported actions for an owned subscription. Pass X-Profile-Id in options.headers. */
6014
+ async getCapabilities(subscriptionId, options) {
6015
+ return this.request(
6016
+ "GET",
6017
+ `/subscriptions/${encodeURIComponent(subscriptionId)}/capabilities`,
6018
+ { ...options }
6019
+ );
6020
+ }
5975
6021
  /**
5976
6022
  * Create and immediately confirm a subscription. `POST /subscriptions`
5977
6023
  *
@@ -6248,6 +6294,96 @@ var Subscriptions = class {
6248
6294
  }
6249
6295
  };
6250
6296
 
6297
+ // src/resources/buyerPortal.ts
6298
+ var BuyerPortal = class {
6299
+ constructor(request) {
6300
+ this.request = request;
6301
+ }
6302
+ async getSession(options) {
6303
+ return this.request("GET", "/buyer-portal/session", { ...options });
6304
+ }
6305
+ async listInvoices(params, options) {
6306
+ return this.request("GET", "/buyer-portal/invoices", {
6307
+ query: params,
6308
+ ...options
6309
+ });
6310
+ }
6311
+ async retrieveInvoice(invoiceId, options) {
6312
+ return this.request("GET", `/buyer-portal/invoices/${encodeURIComponent(invoiceId)}`, {
6313
+ ...options
6314
+ });
6315
+ }
6316
+ /** Download the owned, published invoice as PDF bytes. */
6317
+ async downloadInvoicePdf(invoiceId, options) {
6318
+ return this.request("GET", `/buyer-portal/invoices/${encodeURIComponent(invoiceId)}/pdf`, {
6319
+ responseType: "blob",
6320
+ ...options
6321
+ });
6322
+ }
6323
+ async listPurchases(params, options) {
6324
+ return this.request("GET", "/buyer-portal/purchases", {
6325
+ query: params,
6326
+ ...options
6327
+ });
6328
+ }
6329
+ async listSubscriptions(params, options) {
6330
+ return this.request("GET", "/buyer-portal/subscriptions", {
6331
+ query: params,
6332
+ ...options
6333
+ });
6334
+ }
6335
+ /** Apply an action allowed by the subscription capabilities and portal grant. */
6336
+ async actOnSubscription(subscriptionId, params, options) {
6337
+ return this.request(
6338
+ "POST",
6339
+ `/buyer-portal/subscriptions/${encodeURIComponent(subscriptionId)}/actions`,
6340
+ { body: params, ...options }
6341
+ );
6342
+ }
6343
+ async listSubscriptionPlans(subscriptionId, params, options) {
6344
+ return this.request(
6345
+ "GET",
6346
+ `/buyer-portal/subscriptions/${encodeURIComponent(subscriptionId)}/plans`,
6347
+ { query: params, ...options }
6348
+ );
6349
+ }
6350
+ async changeSubscriptionPlan(subscriptionId, params, options) {
6351
+ return this.request(
6352
+ "POST",
6353
+ `/buyer-portal/subscriptions/${encodeURIComponent(subscriptionId)}/change-plan`,
6354
+ { body: params, ...options }
6355
+ );
6356
+ }
6357
+ async listNativePlans(profileId, params, options) {
6358
+ return this.request(
6359
+ "GET",
6360
+ `/buyer-portal/subscriptions/native/plans/${encodeURIComponent(profileId)}`,
6361
+ { query: params, ...options }
6362
+ );
6363
+ }
6364
+ /** Retry with the same subscription ID and accepted terms after a lost response. */
6365
+ async enrollNative(params, options) {
6366
+ return this.request("POST", "/buyer-portal/subscriptions/native/enroll", {
6367
+ body: params,
6368
+ ...options
6369
+ });
6370
+ }
6371
+ async getNativeEnrollment(subscriptionId, params, options) {
6372
+ return this.request(
6373
+ "GET",
6374
+ `/buyer-portal/subscriptions/native/enroll/${encodeURIComponent(subscriptionId)}`,
6375
+ { query: { profile_id: params.profile_id }, ...options }
6376
+ );
6377
+ }
6378
+ async abandonNativeEnrollment(subscriptionId, params, options) {
6379
+ return this.request(
6380
+ "POST",
6381
+ `/buyer-portal/subscriptions/native/enroll/${encodeURIComponent(subscriptionId)}/abandon`,
6382
+ { query: { profile_id: params.profile_id }, ...options }
6383
+ );
6384
+ }
6385
+ };
6386
+
6251
6387
  // src/resources/audit.ts
6252
6388
  var Audit = class {
6253
6389
  constructor(request) {
@@ -7225,6 +7361,7 @@ var Delopay = class {
7225
7361
  this.replayRetention = new ReplayRetention(request);
7226
7362
  this.risk = new Risk(request);
7227
7363
  this.subscriptions = new Subscriptions(request);
7364
+ this.buyerPortal = new BuyerPortal(request);
7228
7365
  this.files = new Files(request);
7229
7366
  this.export = new Export(request);
7230
7367
  this.forex = new Forex(request);
@@ -11257,6 +11394,14 @@ var AdminPortal = class {
11257
11394
  constructor(request) {
11258
11395
  this.request = request;
11259
11396
  }
11397
+ /** Read scoped risk overrides, effective values and inheritance sources. */
11398
+ async getRiskSettings(query) {
11399
+ return this.request("GET", "/admin-portal/risk-settings", { query: { ...query } });
11400
+ }
11401
+ /** Replace overrides with revision checking; null values restore inheritance. */
11402
+ async updateRiskSettings(body) {
11403
+ return this.request("PUT", "/admin-portal/risk-settings", { body });
11404
+ }
11260
11405
  async listCustomers(params) {
11261
11406
  return this.request("GET", "/admin-portal/customers", {
11262
11407
  query: params
@@ -12721,6 +12866,26 @@ var PlatformFeeRulesManager = class {
12721
12866
  }
12722
12867
  };
12723
12868
 
12869
+ // src/internal/resources/nativeRenewals.ts
12870
+ var NativeRenewals = class {
12871
+ constructor(request, serviceKey) {
12872
+ this.request = request;
12873
+ this.serviceKey = serviceKey;
12874
+ }
12875
+ /** Close the previous renewal payment using the internal service key and its owner context. */
12876
+ async close(paymentId, target, options) {
12877
+ return this.request("POST", `/payments/${encodeURIComponent(paymentId)}/native-renewal-close`, {
12878
+ ...options,
12879
+ headers: {
12880
+ ...options?.headers,
12881
+ "X-Internal-API-Key": this.serviceKey,
12882
+ "X-Merchant-Id": target.merchant_id,
12883
+ "X-Profile-Id": target.profile_id
12884
+ }
12885
+ });
12886
+ }
12887
+ };
12888
+
12724
12889
  // src/internal/client.ts
12725
12890
  var DelopayInternal = class extends Delopay {
12726
12891
  constructor(...args) {
@@ -12738,6 +12903,7 @@ var DelopayInternal = class extends Delopay {
12738
12903
  this.gsm = new Gsm(request);
12739
12904
  this.platformBilling = new PlatformBilling(request);
12740
12905
  this.platformFees = new PlatformFees(request);
12906
+ this.nativeRenewals = new NativeRenewals(request, args[0] ?? "");
12741
12907
  }
12742
12908
  };
12743
12909
  // Annotate the CommonJS export names for ESM import in node:
@@ -12824,6 +12990,7 @@ var DelopayInternal = class extends Delopay {
12824
12990
  NOTICE_ICON_PATHS,
12825
12991
  NOTICE_LABEL_MAX_LENGTH,
12826
12992
  NOTICE_SECTIONS,
12993
+ NativeRenewals,
12827
12994
  OperationLimits,
12828
12995
  PANES_MAX,
12829
12996
  PANE_CATEGORY_KEYS,