@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.js CHANGED
@@ -216,7 +216,7 @@ import {
216
216
  validatePanes,
217
217
  verticalGapValue,
218
218
  visibleCustomFields
219
- } from "./chunk-72DLUJCI.js";
219
+ } from "./chunk-OJIATYCP.js";
220
220
  export {
221
221
  AIRWALLEX_AUTOFILL_TREATMENTS,
222
222
  AIRWALLEX_CARD_LAYOUTS,
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
  *
@@ -3913,6 +3935,31 @@ var Users = class {
3913
3935
  async signIn(params) {
3914
3936
  return this.request("POST", "/user/signin", { body: params });
3915
3937
  }
3938
+ /** Providers currently configured for dashboard sign-in. */
3939
+ async listOAuthProviders() {
3940
+ return this.request("GET", "/user/oauth/providers");
3941
+ }
3942
+ /** Current account's links; disabled providers remain visible. */
3943
+ async listLinkedOAuthProviders() {
3944
+ return this.request("GET", "/user/oauth/linked");
3945
+ }
3946
+ async startOAuthSignIn(params) {
3947
+ return this.request("POST", "/user/oauth/start", { body: params });
3948
+ }
3949
+ async startOAuthLink(params) {
3950
+ return this.request("POST", "/user/oauth/link/start", { body: params });
3951
+ }
3952
+ async completeOAuthSignIn(params) {
3953
+ return this.request("POST", "/user/oauth/complete", { body: params });
3954
+ }
3955
+ async completeOAuthLink(params) {
3956
+ return this.request("POST", "/user/oauth/link/complete", { body: params });
3957
+ }
3958
+ async disconnectOAuthProvider(provider, params) {
3959
+ return this.request("DELETE", `/user/oauth/linked/${encodeURIComponent(provider)}`, {
3960
+ body: params
3961
+ });
3962
+ }
3916
3963
  async signOut() {
3917
3964
  return this.request("POST", "/user/signout");
3918
3965
  }
@@ -5947,6 +5994,29 @@ var Subscriptions = class {
5947
5994
  constructor(request) {
5948
5995
  this.request = request;
5949
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
+ }
5950
6020
  /**
5951
6021
  * Create and immediately confirm a subscription. `POST /subscriptions`
5952
6022
  *
@@ -5991,7 +6061,13 @@ var Subscriptions = class {
5991
6061
  ...options
5992
6062
  });
5993
6063
  }
5994
- /** Update a subscription's plan/price. `PUT /subscriptions/{subscriptionId}/update` */
6064
+ /**
6065
+ * Update a subscription's plan/price. `PUT /subscriptions/{subscriptionId}/update`
6066
+ *
6067
+ * From the dashboard this counts against the caller's `subscription_change`
6068
+ * operation limit; an over-limit call fails with `DE_01` and nothing reaches
6069
+ * the processor. Calls made with an API key are not limited.
6070
+ */
5995
6071
  async update(subscriptionId, params, options) {
5996
6072
  return this.request("PUT", `/subscriptions/${encodeURIComponent(subscriptionId)}/update`, {
5997
6073
  body: params,
@@ -6047,6 +6123,10 @@ var Subscriptions = class {
6047
6123
  /**
6048
6124
  * Pause a subscription. `POST /subscriptions/{subscriptionId}/pause`
6049
6125
  *
6126
+ * From the dashboard this counts against the caller's `subscription_change`
6127
+ * operation limit; an over-limit call fails with `DE_01` and nothing reaches
6128
+ * the processor. Calls made with an API key are not limited.
6129
+ *
6050
6130
  * The body defaults to `{}` so the request still carries
6051
6131
  * `Content-Type: application/json` even when no params are passed — the
6052
6132
  * backend rejects the POST otherwise ("Unsupported content type").
@@ -6057,7 +6137,13 @@ var Subscriptions = class {
6057
6137
  ...options
6058
6138
  });
6059
6139
  }
6060
- /** Resume a paused subscription. `POST /subscriptions/{subscriptionId}/resume` */
6140
+ /**
6141
+ * Resume a paused subscription. `POST /subscriptions/{subscriptionId}/resume`
6142
+ *
6143
+ * From the dashboard this counts against the caller's `subscription_change`
6144
+ * operation limit; an over-limit call fails with `DE_01` and nothing reaches
6145
+ * the processor. Calls made with an API key are not limited.
6146
+ */
6061
6147
  async resume(subscriptionId, params, options) {
6062
6148
  return this.request("POST", `/subscriptions/${encodeURIComponent(subscriptionId)}/resume`, {
6063
6149
  body: params ?? {},
@@ -6069,6 +6155,10 @@ var Subscriptions = class {
6069
6155
  *
6070
6156
  * A subscription in a state it cannot be cancelled from is refused with
6071
6157
  * `DE_11`; `error.data.reason` then names why (`SubscriptionActionRefusal`).
6158
+ *
6159
+ * From the dashboard this counts against the caller's `subscription_change`
6160
+ * operation limit; an over-limit call fails with `DE_01` and nothing reaches
6161
+ * the processor. Calls made with an API key are not limited.
6072
6162
  */
6073
6163
  async cancel(subscriptionId, params, options) {
6074
6164
  return this.request("POST", `/subscriptions/${encodeURIComponent(subscriptionId)}/cancel`, {
@@ -6203,6 +6293,96 @@ var Subscriptions = class {
6203
6293
  }
6204
6294
  };
6205
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
+
6206
6386
  // src/resources/audit.ts
6207
6387
  var Audit = class {
6208
6388
  constructor(request) {
@@ -6573,10 +6753,13 @@ var Settlement = class {
6573
6753
  * Add a manual adjustment to a statement. Positive `amount_usd` charges
6574
6754
  * the shop (reducing their payout); negative credits them.
6575
6755
  *
6576
- * Subject to the caller's `settlement_adjustment` operation limit (amount
6577
- * dimensions only): an over-limit call fails with `DE_01` and no adjustment
6578
- * is added. A settlement rule can only block — approval is refund-only, for
6579
- * the reason given on `updateStatementPayout()`.
6756
+ * Subject to the caller's `settlement_adjustment` operation limit: an
6757
+ * over-limit call fails with `DE_01` and no adjustment is added. Both
6758
+ * windows count every add, and a credit counts at its magnitude. A
6759
+ * settlement rule can only block — approval is refund-only, for the reason
6760
+ * given on `updateStatementPayout()`. When another add by the same user
6761
+ * changes the window while this one is being admitted, the call fails with
6762
+ * HTTP 412 and nothing is written; retrying the same request is safe.
6580
6763
  *
6581
6764
  * `POST /settlement/statements/{statementId}/adjustments`
6582
6765
  */
@@ -6590,6 +6773,10 @@ var Settlement = class {
6590
6773
  /**
6591
6774
  * Remove a manual adjustment from a statement.
6592
6775
  *
6776
+ * The adjustment still counts against the caller's `settlement_adjustment`
6777
+ * limit window it was added in: removing it does not give back its count or
6778
+ * amount.
6779
+ *
6593
6780
  * `DELETE /settlement/statements/{statementId}/adjustments/{adjustmentId}`
6594
6781
  */
6595
6782
  async deleteStatementAdjustment(statementId, adjustmentId, options) {
@@ -7173,6 +7360,7 @@ var Delopay = class {
7173
7360
  this.replayRetention = new ReplayRetention(request);
7174
7361
  this.risk = new Risk(request);
7175
7362
  this.subscriptions = new Subscriptions(request);
7363
+ this.buyerPortal = new BuyerPortal(request);
7176
7364
  this.files = new Files(request);
7177
7365
  this.export = new Export(request);
7178
7366
  this.forex = new Forex(request);
@@ -11205,6 +11393,14 @@ var AdminPortal = class {
11205
11393
  constructor(request) {
11206
11394
  this.request = request;
11207
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
+ }
11208
11404
  async listCustomers(params) {
11209
11405
  return this.request("GET", "/admin-portal/customers", {
11210
11406
  query: params
@@ -11998,6 +12194,18 @@ var AdminPortal = class {
11998
12194
  async getPromoConfig() {
11999
12195
  return this.request("GET", "/admin-portal/promo-config");
12000
12196
  }
12197
+ /** OAuth credentials are encrypted server-side and never returned. */
12198
+ async getDashboardOAuthSettings() {
12199
+ return this.request("GET", "/admin-portal/dashboard-oauth");
12200
+ }
12201
+ async updateDashboardOAuthUrls(params) {
12202
+ return this.request("PUT", "/admin-portal/dashboard-oauth/urls", { body: params });
12203
+ }
12204
+ async updateDashboardOAuthProvider(provider, params) {
12205
+ return this.request("PUT", `/admin-portal/dashboard-oauth/${encodeURIComponent(provider)}`, {
12206
+ body: params
12207
+ });
12208
+ }
12001
12209
  /**
12002
12210
  * Update the global welcome promotional-credit config. Any subset of
12003
12211
  * `amount` (minor units) / `message` may be supplied; omitted fields are
@@ -12657,6 +12865,26 @@ var PlatformFeeRulesManager = class {
12657
12865
  }
12658
12866
  };
12659
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
+
12660
12888
  // src/internal/client.ts
12661
12889
  var DelopayInternal = class extends Delopay {
12662
12890
  constructor(...args) {
@@ -12674,6 +12902,7 @@ var DelopayInternal = class extends Delopay {
12674
12902
  this.gsm = new Gsm(request);
12675
12903
  this.platformBilling = new PlatformBilling(request);
12676
12904
  this.platformFees = new PlatformFees(request);
12905
+ this.nativeRenewals = new NativeRenewals(request, args[0] ?? "");
12677
12906
  }
12678
12907
  };
12679
12908
  // Annotate the CommonJS export names for ESM import in node:
@@ -12760,6 +12989,7 @@ var DelopayInternal = class extends Delopay {
12760
12989
  NOTICE_ICON_PATHS,
12761
12990
  NOTICE_LABEL_MAX_LENGTH,
12762
12991
  NOTICE_SECTIONS,
12992
+ NativeRenewals,
12763
12993
  OperationLimits,
12764
12994
  PANES_MAX,
12765
12995
  PANE_CATEGORY_KEYS,