@delopay/sdk 0.198.0 → 0.200.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
  *
@@ -5972,6 +5994,29 @@ var Subscriptions = class {
5972
5994
  constructor(request) {
5973
5995
  this.request = request;
5974
5996
  }
5997
+ /** Read native enrollment settings. Pass X-Profile-Id in options.headers. */
5998
+ async getNativeConfig(options) {
5999
+ return this.request("GET", "/subscriptions/native/config", { ...options });
6000
+ }
6001
+ /** Replace native enrollment settings. Pass X-Profile-Id in options.headers. */
6002
+ async updateNativeConfig(params, options) {
6003
+ return this.request("PUT", "/subscriptions/native/config", { body: params, ...options });
6004
+ }
6005
+ /** Read merchant-wide renewal recovery settings. */
6006
+ async getNativeDunning(options) {
6007
+ return this.request("GET", "/subscriptions/native/dunning", { ...options });
6008
+ }
6009
+ async updateNativeDunning(params, options) {
6010
+ return this.request("PUT", "/subscriptions/native/dunning", { body: params, ...options });
6011
+ }
6012
+ /** Read supported actions for an owned subscription. Pass X-Profile-Id in options.headers. */
6013
+ async getCapabilities(subscriptionId, options) {
6014
+ return this.request(
6015
+ "GET",
6016
+ `/subscriptions/${encodeURIComponent(subscriptionId)}/capabilities`,
6017
+ { ...options }
6018
+ );
6019
+ }
5975
6020
  /**
5976
6021
  * Create and immediately confirm a subscription. `POST /subscriptions`
5977
6022
  *
@@ -6248,6 +6293,96 @@ var Subscriptions = class {
6248
6293
  }
6249
6294
  };
6250
6295
 
6296
+ // src/resources/buyerPortal.ts
6297
+ var BuyerPortal = class {
6298
+ constructor(request) {
6299
+ this.request = request;
6300
+ }
6301
+ async getSession(options) {
6302
+ return this.request("GET", "/buyer-portal/session", { ...options });
6303
+ }
6304
+ async listInvoices(params, options) {
6305
+ return this.request("GET", "/buyer-portal/invoices", {
6306
+ query: params,
6307
+ ...options
6308
+ });
6309
+ }
6310
+ async retrieveInvoice(invoiceId, options) {
6311
+ return this.request("GET", `/buyer-portal/invoices/${encodeURIComponent(invoiceId)}`, {
6312
+ ...options
6313
+ });
6314
+ }
6315
+ /** Download the owned, published invoice as PDF bytes. */
6316
+ async downloadInvoicePdf(invoiceId, options) {
6317
+ return this.request("GET", `/buyer-portal/invoices/${encodeURIComponent(invoiceId)}/pdf`, {
6318
+ responseType: "blob",
6319
+ ...options
6320
+ });
6321
+ }
6322
+ async listPurchases(params, options) {
6323
+ return this.request("GET", "/buyer-portal/purchases", {
6324
+ query: params,
6325
+ ...options
6326
+ });
6327
+ }
6328
+ async listSubscriptions(params, options) {
6329
+ return this.request("GET", "/buyer-portal/subscriptions", {
6330
+ query: params,
6331
+ ...options
6332
+ });
6333
+ }
6334
+ /** Apply an action allowed by the subscription capabilities and portal grant. */
6335
+ async actOnSubscription(subscriptionId, params, options) {
6336
+ return this.request(
6337
+ "POST",
6338
+ `/buyer-portal/subscriptions/${encodeURIComponent(subscriptionId)}/actions`,
6339
+ { body: params, ...options }
6340
+ );
6341
+ }
6342
+ async listSubscriptionPlans(subscriptionId, params, options) {
6343
+ return this.request(
6344
+ "GET",
6345
+ `/buyer-portal/subscriptions/${encodeURIComponent(subscriptionId)}/plans`,
6346
+ { query: params, ...options }
6347
+ );
6348
+ }
6349
+ async changeSubscriptionPlan(subscriptionId, params, options) {
6350
+ return this.request(
6351
+ "POST",
6352
+ `/buyer-portal/subscriptions/${encodeURIComponent(subscriptionId)}/change-plan`,
6353
+ { body: params, ...options }
6354
+ );
6355
+ }
6356
+ async listNativePlans(profileId, params, options) {
6357
+ return this.request(
6358
+ "GET",
6359
+ `/buyer-portal/subscriptions/native/plans/${encodeURIComponent(profileId)}`,
6360
+ { query: params, ...options }
6361
+ );
6362
+ }
6363
+ /** Retry with the same subscription ID and accepted terms after a lost response. */
6364
+ async enrollNative(params, options) {
6365
+ return this.request("POST", "/buyer-portal/subscriptions/native/enroll", {
6366
+ body: params,
6367
+ ...options
6368
+ });
6369
+ }
6370
+ async getNativeEnrollment(subscriptionId, params, options) {
6371
+ return this.request(
6372
+ "GET",
6373
+ `/buyer-portal/subscriptions/native/enroll/${encodeURIComponent(subscriptionId)}`,
6374
+ { query: { profile_id: params.profile_id }, ...options }
6375
+ );
6376
+ }
6377
+ async abandonNativeEnrollment(subscriptionId, params, options) {
6378
+ return this.request(
6379
+ "POST",
6380
+ `/buyer-portal/subscriptions/native/enroll/${encodeURIComponent(subscriptionId)}/abandon`,
6381
+ { query: { profile_id: params.profile_id }, ...options }
6382
+ );
6383
+ }
6384
+ };
6385
+
6251
6386
  // src/resources/audit.ts
6252
6387
  var Audit = class {
6253
6388
  constructor(request) {
@@ -7225,6 +7360,7 @@ var Delopay = class {
7225
7360
  this.replayRetention = new ReplayRetention(request);
7226
7361
  this.risk = new Risk(request);
7227
7362
  this.subscriptions = new Subscriptions(request);
7363
+ this.buyerPortal = new BuyerPortal(request);
7228
7364
  this.files = new Files(request);
7229
7365
  this.export = new Export(request);
7230
7366
  this.forex = new Forex(request);
@@ -11257,6 +11393,14 @@ var AdminPortal = class {
11257
11393
  constructor(request) {
11258
11394
  this.request = request;
11259
11395
  }
11396
+ /** Read scoped risk overrides, effective values and inheritance sources. */
11397
+ async getRiskSettings(query) {
11398
+ return this.request("GET", "/admin-portal/risk-settings", { query: { ...query } });
11399
+ }
11400
+ /** Replace overrides with revision checking; null values restore inheritance. */
11401
+ async updateRiskSettings(body) {
11402
+ return this.request("PUT", "/admin-portal/risk-settings", { body });
11403
+ }
11260
11404
  async listCustomers(params) {
11261
11405
  return this.request("GET", "/admin-portal/customers", {
11262
11406
  query: params
@@ -12721,6 +12865,26 @@ var PlatformFeeRulesManager = class {
12721
12865
  }
12722
12866
  };
12723
12867
 
12868
+ // src/internal/resources/nativeRenewals.ts
12869
+ var NativeRenewals = class {
12870
+ constructor(request, serviceKey) {
12871
+ this.request = request;
12872
+ this.serviceKey = serviceKey;
12873
+ }
12874
+ /** Close the previous renewal payment using the internal service key and its owner context. */
12875
+ async close(paymentId, target, options) {
12876
+ return this.request("POST", `/payments/${encodeURIComponent(paymentId)}/native-renewal-close`, {
12877
+ ...options,
12878
+ headers: {
12879
+ ...options?.headers,
12880
+ "X-Internal-API-Key": this.serviceKey,
12881
+ "X-Merchant-Id": target.merchant_id,
12882
+ "X-Profile-Id": target.profile_id
12883
+ }
12884
+ });
12885
+ }
12886
+ };
12887
+
12724
12888
  // src/internal/client.ts
12725
12889
  var DelopayInternal = class extends Delopay {
12726
12890
  constructor(...args) {
@@ -12738,6 +12902,7 @@ var DelopayInternal = class extends Delopay {
12738
12902
  this.gsm = new Gsm(request);
12739
12903
  this.platformBilling = new PlatformBilling(request);
12740
12904
  this.platformFees = new PlatformFees(request);
12905
+ this.nativeRenewals = new NativeRenewals(request, args[0] ?? "");
12741
12906
  }
12742
12907
  };
12743
12908
  // Annotate the CommonJS export names for ESM import in node:
@@ -12824,6 +12989,7 @@ var DelopayInternal = class extends Delopay {
12824
12989
  NOTICE_ICON_PATHS,
12825
12990
  NOTICE_LABEL_MAX_LENGTH,
12826
12991
  NOTICE_SECTIONS,
12992
+ NativeRenewals,
12827
12993
  OperationLimits,
12828
12994
  PANES_MAX,
12829
12995
  PANE_CATEGORY_KEYS,