@delopay/sdk 0.42.0 → 0.43.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
@@ -1682,6 +1682,7 @@ var Routing = class {
1682
1682
  constructor(request) {
1683
1683
  this.request = request;
1684
1684
  this.decision = new RoutingDecisionManager(request);
1685
+ this.surchargeRules = new SurchargeRules(request);
1685
1686
  }
1686
1687
  /**
1687
1688
  * Create a new routing algorithm.
@@ -1824,6 +1825,53 @@ var RoutingDecisionManager = class {
1824
1825
  return this.request("DELETE", "/routing/decision/surcharge");
1825
1826
  }
1826
1827
  };
1828
+ var SurchargeRules = class {
1829
+ constructor(request) {
1830
+ this.request = request;
1831
+ }
1832
+ /**
1833
+ * Create or replace the surcharge program for a scope.
1834
+ *
1835
+ * `PUT /routing/surcharge/rules`
1836
+ *
1837
+ * @example
1838
+ * ```typescript
1839
+ * await delopay.routing.surchargeRules.upsert({
1840
+ * surcharges: [
1841
+ * { payment_method: 'crypto', surcharge: { rate: { percent: 1.0 } } },
1842
+ * { payment_method: 'card', surcharge: { fixed: { amount: 35 } } },
1843
+ * ],
1844
+ * });
1845
+ * ```
1846
+ */
1847
+ async upsert(params) {
1848
+ return this.request("PUT", "/routing/surcharge/rules", { body: params });
1849
+ }
1850
+ /**
1851
+ * Retrieve the active surcharge program for a scope, or `null` when none is set.
1852
+ *
1853
+ * `GET /routing/surcharge/rules?profile_id={profileId}`
1854
+ *
1855
+ * @param profileId - Shop scope. Omit for the merchant-wide rule.
1856
+ */
1857
+ async retrieve(profileId) {
1858
+ return this.request("GET", "/routing/surcharge/rules", {
1859
+ query: { profile_id: profileId }
1860
+ });
1861
+ }
1862
+ /**
1863
+ * Deactivate the active surcharge program for a scope.
1864
+ *
1865
+ * `DELETE /routing/surcharge/rules?profile_id={profileId}`
1866
+ *
1867
+ * @param profileId - Shop scope. Omit for the merchant-wide rule.
1868
+ */
1869
+ async delete(profileId) {
1870
+ return this.request("DELETE", "/routing/surcharge/rules", {
1871
+ query: { profile_id: profileId }
1872
+ });
1873
+ }
1874
+ };
1827
1875
 
1828
1876
  // src/resources/search.ts
1829
1877
  var Search = class {