@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/index.cjs CHANGED
@@ -1010,6 +1010,27 @@ var Customers = class {
1010
1010
  constructor(request) {
1011
1011
  this.request = request;
1012
1012
  }
1013
+ /** Issue a shop-scoped buyer portal link for this customer. */
1014
+ async createPortalLink(customerId, params, options) {
1015
+ return this.request("POST", `/customers/${encodeURIComponent(customerId)}/portal-links`, {
1016
+ body: params,
1017
+ ...options
1018
+ });
1019
+ }
1020
+ /** List issued grants without disclosing their secret URLs. */
1021
+ async listPortalLinks(customerId, params, options) {
1022
+ return this.request("GET", `/customers/${encodeURIComponent(customerId)}/portal-links`, {
1023
+ query: params,
1024
+ ...options
1025
+ });
1026
+ }
1027
+ async revokePortalLink(customerId, linkId, options) {
1028
+ return this.request(
1029
+ "DELETE",
1030
+ `/customers/${encodeURIComponent(customerId)}/portal-links/${encodeURIComponent(linkId)}`,
1031
+ { ...options }
1032
+ );
1033
+ }
1013
1034
  /**
1014
1035
  * Create a new customer.
1015
1036
  *
@@ -5273,9 +5294,10 @@ var ExternalRecords = class {
5273
5294
  * same thing is how a caller ends up waiting for something that will never
5274
5295
  * be built.
5275
5296
  *
5276
- * The answer describes the binary rather than anything a merchant owns, so
5277
- * it is the same for every caller of one deployment and is safe to cache for
5278
- * the life of a dashboard session.
5297
+ * The answer includes the current merchant's rollout and storage eligibility.
5298
+ * Read it for the authenticated merchant when deciding whether to offer an
5299
+ * action; do not reuse another merchant's response or a previous session's
5300
+ * answer after eligibility may have changed.
5279
5301
  */
5280
5302
  async capabilities() {
5281
5303
  return this.request("GET", "/external-records/capabilities");
@@ -5959,6 +5981,29 @@ var Subscriptions = class {
5959
5981
  constructor(request) {
5960
5982
  this.request = request;
5961
5983
  }
5984
+ /** Read native enrollment settings. Pass X-Profile-Id in options.headers. */
5985
+ async getNativeConfig(options) {
5986
+ return this.request("GET", "/subscriptions/native/config", { ...options });
5987
+ }
5988
+ /** Replace native enrollment settings. Pass X-Profile-Id in options.headers. */
5989
+ async updateNativeConfig(params, options) {
5990
+ return this.request("PUT", "/subscriptions/native/config", { body: params, ...options });
5991
+ }
5992
+ /** Read merchant-wide renewal recovery settings. */
5993
+ async getNativeDunning(options) {
5994
+ return this.request("GET", "/subscriptions/native/dunning", { ...options });
5995
+ }
5996
+ async updateNativeDunning(params, options) {
5997
+ return this.request("PUT", "/subscriptions/native/dunning", { body: params, ...options });
5998
+ }
5999
+ /** Read supported actions for an owned subscription. Pass X-Profile-Id in options.headers. */
6000
+ async getCapabilities(subscriptionId, options) {
6001
+ return this.request(
6002
+ "GET",
6003
+ `/subscriptions/${encodeURIComponent(subscriptionId)}/capabilities`,
6004
+ { ...options }
6005
+ );
6006
+ }
5962
6007
  /**
5963
6008
  * Create and immediately confirm a subscription. `POST /subscriptions`
5964
6009
  *
@@ -6235,6 +6280,96 @@ var Subscriptions = class {
6235
6280
  }
6236
6281
  };
6237
6282
 
6283
+ // src/resources/buyerPortal.ts
6284
+ var BuyerPortal = class {
6285
+ constructor(request) {
6286
+ this.request = request;
6287
+ }
6288
+ async getSession(options) {
6289
+ return this.request("GET", "/buyer-portal/session", { ...options });
6290
+ }
6291
+ async listInvoices(params, options) {
6292
+ return this.request("GET", "/buyer-portal/invoices", {
6293
+ query: params,
6294
+ ...options
6295
+ });
6296
+ }
6297
+ async retrieveInvoice(invoiceId, options) {
6298
+ return this.request("GET", `/buyer-portal/invoices/${encodeURIComponent(invoiceId)}`, {
6299
+ ...options
6300
+ });
6301
+ }
6302
+ /** Download the owned, published invoice as PDF bytes. */
6303
+ async downloadInvoicePdf(invoiceId, options) {
6304
+ return this.request("GET", `/buyer-portal/invoices/${encodeURIComponent(invoiceId)}/pdf`, {
6305
+ responseType: "blob",
6306
+ ...options
6307
+ });
6308
+ }
6309
+ async listPurchases(params, options) {
6310
+ return this.request("GET", "/buyer-portal/purchases", {
6311
+ query: params,
6312
+ ...options
6313
+ });
6314
+ }
6315
+ async listSubscriptions(params, options) {
6316
+ return this.request("GET", "/buyer-portal/subscriptions", {
6317
+ query: params,
6318
+ ...options
6319
+ });
6320
+ }
6321
+ /** Apply an action allowed by the subscription capabilities and portal grant. */
6322
+ async actOnSubscription(subscriptionId, params, options) {
6323
+ return this.request(
6324
+ "POST",
6325
+ `/buyer-portal/subscriptions/${encodeURIComponent(subscriptionId)}/actions`,
6326
+ { body: params, ...options }
6327
+ );
6328
+ }
6329
+ async listSubscriptionPlans(subscriptionId, params, options) {
6330
+ return this.request(
6331
+ "GET",
6332
+ `/buyer-portal/subscriptions/${encodeURIComponent(subscriptionId)}/plans`,
6333
+ { query: params, ...options }
6334
+ );
6335
+ }
6336
+ async changeSubscriptionPlan(subscriptionId, params, options) {
6337
+ return this.request(
6338
+ "POST",
6339
+ `/buyer-portal/subscriptions/${encodeURIComponent(subscriptionId)}/change-plan`,
6340
+ { body: params, ...options }
6341
+ );
6342
+ }
6343
+ async listNativePlans(profileId, params, options) {
6344
+ return this.request(
6345
+ "GET",
6346
+ `/buyer-portal/subscriptions/native/plans/${encodeURIComponent(profileId)}`,
6347
+ { query: params, ...options }
6348
+ );
6349
+ }
6350
+ /** Retry with the same subscription ID and accepted terms after a lost response. */
6351
+ async enrollNative(params, options) {
6352
+ return this.request("POST", "/buyer-portal/subscriptions/native/enroll", {
6353
+ body: params,
6354
+ ...options
6355
+ });
6356
+ }
6357
+ async getNativeEnrollment(subscriptionId, params, options) {
6358
+ return this.request(
6359
+ "GET",
6360
+ `/buyer-portal/subscriptions/native/enroll/${encodeURIComponent(subscriptionId)}`,
6361
+ { query: { profile_id: params.profile_id }, ...options }
6362
+ );
6363
+ }
6364
+ async abandonNativeEnrollment(subscriptionId, params, options) {
6365
+ return this.request(
6366
+ "POST",
6367
+ `/buyer-portal/subscriptions/native/enroll/${encodeURIComponent(subscriptionId)}/abandon`,
6368
+ { query: { profile_id: params.profile_id }, ...options }
6369
+ );
6370
+ }
6371
+ };
6372
+
6238
6373
  // src/resources/audit.ts
6239
6374
  var Audit = class {
6240
6375
  constructor(request) {
@@ -7212,6 +7347,7 @@ var Delopay = class {
7212
7347
  this.replayRetention = new ReplayRetention(request);
7213
7348
  this.risk = new Risk(request);
7214
7349
  this.subscriptions = new Subscriptions(request);
7350
+ this.buyerPortal = new BuyerPortal(request);
7215
7351
  this.files = new Files(request);
7216
7352
  this.export = new Export(request);
7217
7353
  this.forex = new Forex(request);