@delopay/sdk 0.193.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/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
  *
@@ -3900,6 +3921,31 @@ var Users = class {
3900
3921
  async signIn(params) {
3901
3922
  return this.request("POST", "/user/signin", { body: params });
3902
3923
  }
3924
+ /** Providers currently configured for dashboard sign-in. */
3925
+ async listOAuthProviders() {
3926
+ return this.request("GET", "/user/oauth/providers");
3927
+ }
3928
+ /** Current account's links; disabled providers remain visible. */
3929
+ async listLinkedOAuthProviders() {
3930
+ return this.request("GET", "/user/oauth/linked");
3931
+ }
3932
+ async startOAuthSignIn(params) {
3933
+ return this.request("POST", "/user/oauth/start", { body: params });
3934
+ }
3935
+ async startOAuthLink(params) {
3936
+ return this.request("POST", "/user/oauth/link/start", { body: params });
3937
+ }
3938
+ async completeOAuthSignIn(params) {
3939
+ return this.request("POST", "/user/oauth/complete", { body: params });
3940
+ }
3941
+ async completeOAuthLink(params) {
3942
+ return this.request("POST", "/user/oauth/link/complete", { body: params });
3943
+ }
3944
+ async disconnectOAuthProvider(provider, params) {
3945
+ return this.request("DELETE", `/user/oauth/linked/${encodeURIComponent(provider)}`, {
3946
+ body: params
3947
+ });
3948
+ }
3903
3949
  async signOut() {
3904
3950
  return this.request("POST", "/user/signout");
3905
3951
  }
@@ -5934,6 +5980,29 @@ var Subscriptions = class {
5934
5980
  constructor(request) {
5935
5981
  this.request = request;
5936
5982
  }
5983
+ /** Read native enrollment settings. Pass X-Profile-Id in options.headers. */
5984
+ async getNativeConfig(options) {
5985
+ return this.request("GET", "/subscriptions/native/config", { ...options });
5986
+ }
5987
+ /** Replace native enrollment settings. Pass X-Profile-Id in options.headers. */
5988
+ async updateNativeConfig(params, options) {
5989
+ return this.request("PUT", "/subscriptions/native/config", { body: params, ...options });
5990
+ }
5991
+ /** Read merchant-wide renewal recovery settings. */
5992
+ async getNativeDunning(options) {
5993
+ return this.request("GET", "/subscriptions/native/dunning", { ...options });
5994
+ }
5995
+ async updateNativeDunning(params, options) {
5996
+ return this.request("PUT", "/subscriptions/native/dunning", { body: params, ...options });
5997
+ }
5998
+ /** Read supported actions for an owned subscription. Pass X-Profile-Id in options.headers. */
5999
+ async getCapabilities(subscriptionId, options) {
6000
+ return this.request(
6001
+ "GET",
6002
+ `/subscriptions/${encodeURIComponent(subscriptionId)}/capabilities`,
6003
+ { ...options }
6004
+ );
6005
+ }
5937
6006
  /**
5938
6007
  * Create and immediately confirm a subscription. `POST /subscriptions`
5939
6008
  *
@@ -5978,7 +6047,13 @@ var Subscriptions = class {
5978
6047
  ...options
5979
6048
  });
5980
6049
  }
5981
- /** Update a subscription's plan/price. `PUT /subscriptions/{subscriptionId}/update` */
6050
+ /**
6051
+ * Update a subscription's plan/price. `PUT /subscriptions/{subscriptionId}/update`
6052
+ *
6053
+ * From the dashboard this counts against the caller's `subscription_change`
6054
+ * operation limit; an over-limit call fails with `DE_01` and nothing reaches
6055
+ * the processor. Calls made with an API key are not limited.
6056
+ */
5982
6057
  async update(subscriptionId, params, options) {
5983
6058
  return this.request("PUT", `/subscriptions/${encodeURIComponent(subscriptionId)}/update`, {
5984
6059
  body: params,
@@ -6034,6 +6109,10 @@ var Subscriptions = class {
6034
6109
  /**
6035
6110
  * Pause a subscription. `POST /subscriptions/{subscriptionId}/pause`
6036
6111
  *
6112
+ * From the dashboard this counts against the caller's `subscription_change`
6113
+ * operation limit; an over-limit call fails with `DE_01` and nothing reaches
6114
+ * the processor. Calls made with an API key are not limited.
6115
+ *
6037
6116
  * The body defaults to `{}` so the request still carries
6038
6117
  * `Content-Type: application/json` even when no params are passed — the
6039
6118
  * backend rejects the POST otherwise ("Unsupported content type").
@@ -6044,7 +6123,13 @@ var Subscriptions = class {
6044
6123
  ...options
6045
6124
  });
6046
6125
  }
6047
- /** Resume a paused subscription. `POST /subscriptions/{subscriptionId}/resume` */
6126
+ /**
6127
+ * Resume a paused subscription. `POST /subscriptions/{subscriptionId}/resume`
6128
+ *
6129
+ * From the dashboard this counts against the caller's `subscription_change`
6130
+ * operation limit; an over-limit call fails with `DE_01` and nothing reaches
6131
+ * the processor. Calls made with an API key are not limited.
6132
+ */
6048
6133
  async resume(subscriptionId, params, options) {
6049
6134
  return this.request("POST", `/subscriptions/${encodeURIComponent(subscriptionId)}/resume`, {
6050
6135
  body: params ?? {},
@@ -6056,6 +6141,10 @@ var Subscriptions = class {
6056
6141
  *
6057
6142
  * A subscription in a state it cannot be cancelled from is refused with
6058
6143
  * `DE_11`; `error.data.reason` then names why (`SubscriptionActionRefusal`).
6144
+ *
6145
+ * From the dashboard this counts against the caller's `subscription_change`
6146
+ * operation limit; an over-limit call fails with `DE_01` and nothing reaches
6147
+ * the processor. Calls made with an API key are not limited.
6059
6148
  */
6060
6149
  async cancel(subscriptionId, params, options) {
6061
6150
  return this.request("POST", `/subscriptions/${encodeURIComponent(subscriptionId)}/cancel`, {
@@ -6190,6 +6279,96 @@ var Subscriptions = class {
6190
6279
  }
6191
6280
  };
6192
6281
 
6282
+ // src/resources/buyerPortal.ts
6283
+ var BuyerPortal = class {
6284
+ constructor(request) {
6285
+ this.request = request;
6286
+ }
6287
+ async getSession(options) {
6288
+ return this.request("GET", "/buyer-portal/session", { ...options });
6289
+ }
6290
+ async listInvoices(params, options) {
6291
+ return this.request("GET", "/buyer-portal/invoices", {
6292
+ query: params,
6293
+ ...options
6294
+ });
6295
+ }
6296
+ async retrieveInvoice(invoiceId, options) {
6297
+ return this.request("GET", `/buyer-portal/invoices/${encodeURIComponent(invoiceId)}`, {
6298
+ ...options
6299
+ });
6300
+ }
6301
+ /** Download the owned, published invoice as PDF bytes. */
6302
+ async downloadInvoicePdf(invoiceId, options) {
6303
+ return this.request("GET", `/buyer-portal/invoices/${encodeURIComponent(invoiceId)}/pdf`, {
6304
+ responseType: "blob",
6305
+ ...options
6306
+ });
6307
+ }
6308
+ async listPurchases(params, options) {
6309
+ return this.request("GET", "/buyer-portal/purchases", {
6310
+ query: params,
6311
+ ...options
6312
+ });
6313
+ }
6314
+ async listSubscriptions(params, options) {
6315
+ return this.request("GET", "/buyer-portal/subscriptions", {
6316
+ query: params,
6317
+ ...options
6318
+ });
6319
+ }
6320
+ /** Apply an action allowed by the subscription capabilities and portal grant. */
6321
+ async actOnSubscription(subscriptionId, params, options) {
6322
+ return this.request(
6323
+ "POST",
6324
+ `/buyer-portal/subscriptions/${encodeURIComponent(subscriptionId)}/actions`,
6325
+ { body: params, ...options }
6326
+ );
6327
+ }
6328
+ async listSubscriptionPlans(subscriptionId, params, options) {
6329
+ return this.request(
6330
+ "GET",
6331
+ `/buyer-portal/subscriptions/${encodeURIComponent(subscriptionId)}/plans`,
6332
+ { query: params, ...options }
6333
+ );
6334
+ }
6335
+ async changeSubscriptionPlan(subscriptionId, params, options) {
6336
+ return this.request(
6337
+ "POST",
6338
+ `/buyer-portal/subscriptions/${encodeURIComponent(subscriptionId)}/change-plan`,
6339
+ { body: params, ...options }
6340
+ );
6341
+ }
6342
+ async listNativePlans(profileId, params, options) {
6343
+ return this.request(
6344
+ "GET",
6345
+ `/buyer-portal/subscriptions/native/plans/${encodeURIComponent(profileId)}`,
6346
+ { query: params, ...options }
6347
+ );
6348
+ }
6349
+ /** Retry with the same subscription ID and accepted terms after a lost response. */
6350
+ async enrollNative(params, options) {
6351
+ return this.request("POST", "/buyer-portal/subscriptions/native/enroll", {
6352
+ body: params,
6353
+ ...options
6354
+ });
6355
+ }
6356
+ async getNativeEnrollment(subscriptionId, params, options) {
6357
+ return this.request(
6358
+ "GET",
6359
+ `/buyer-portal/subscriptions/native/enroll/${encodeURIComponent(subscriptionId)}`,
6360
+ { query: { profile_id: params.profile_id }, ...options }
6361
+ );
6362
+ }
6363
+ async abandonNativeEnrollment(subscriptionId, params, options) {
6364
+ return this.request(
6365
+ "POST",
6366
+ `/buyer-portal/subscriptions/native/enroll/${encodeURIComponent(subscriptionId)}/abandon`,
6367
+ { query: { profile_id: params.profile_id }, ...options }
6368
+ );
6369
+ }
6370
+ };
6371
+
6193
6372
  // src/resources/audit.ts
6194
6373
  var Audit = class {
6195
6374
  constructor(request) {
@@ -6560,10 +6739,13 @@ var Settlement = class {
6560
6739
  * Add a manual adjustment to a statement. Positive `amount_usd` charges
6561
6740
  * the shop (reducing their payout); negative credits them.
6562
6741
  *
6563
- * Subject to the caller's `settlement_adjustment` operation limit (amount
6564
- * dimensions only): an over-limit call fails with `DE_01` and no adjustment
6565
- * is added. A settlement rule can only block — approval is refund-only, for
6566
- * the reason given on `updateStatementPayout()`.
6742
+ * Subject to the caller's `settlement_adjustment` operation limit: an
6743
+ * over-limit call fails with `DE_01` and no adjustment is added. Both
6744
+ * windows count every add, and a credit counts at its magnitude. A
6745
+ * settlement rule can only block — approval is refund-only, for the reason
6746
+ * given on `updateStatementPayout()`. When another add by the same user
6747
+ * changes the window while this one is being admitted, the call fails with
6748
+ * HTTP 412 and nothing is written; retrying the same request is safe.
6567
6749
  *
6568
6750
  * `POST /settlement/statements/{statementId}/adjustments`
6569
6751
  */
@@ -6577,6 +6759,10 @@ var Settlement = class {
6577
6759
  /**
6578
6760
  * Remove a manual adjustment from a statement.
6579
6761
  *
6762
+ * The adjustment still counts against the caller's `settlement_adjustment`
6763
+ * limit window it was added in: removing it does not give back its count or
6764
+ * amount.
6765
+ *
6580
6766
  * `DELETE /settlement/statements/{statementId}/adjustments/{adjustmentId}`
6581
6767
  */
6582
6768
  async deleteStatementAdjustment(statementId, adjustmentId, options) {
@@ -7160,6 +7346,7 @@ var Delopay = class {
7160
7346
  this.replayRetention = new ReplayRetention(request);
7161
7347
  this.risk = new Risk(request);
7162
7348
  this.subscriptions = new Subscriptions(request);
7349
+ this.buyerPortal = new BuyerPortal(request);
7163
7350
  this.files = new Files(request);
7164
7351
  this.export = new Export(request);
7165
7352
  this.forex = new Forex(request);