@delopay/sdk 0.6.0 → 0.8.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
@@ -26,6 +26,7 @@ __export(internal_exports, {
26
26
  AnalyticsDashboard: () => AnalyticsDashboard,
27
27
  AuditLogs: () => AuditLogs,
28
28
  Cache: () => Cache,
29
+ CardIssuers: () => CardIssuers,
29
30
  Cards: () => Cards,
30
31
  Configs: () => Configs,
31
32
  Delopay: () => Delopay,
@@ -36,6 +37,9 @@ __export(internal_exports, {
36
37
  FeatureMatrix: () => FeatureMatrix,
37
38
  Files: () => Files,
38
39
  Forex: () => Forex,
40
+ Gsm: () => Gsm,
41
+ PlatformBilling: () => PlatformBilling,
42
+ PlatformFees: () => PlatformFees,
39
43
  Regions: () => Regions,
40
44
  Subscriptions: () => Subscriptions,
41
45
  Webhooks: () => Webhooks
@@ -327,30 +331,6 @@ var Billing = class {
327
331
  body: params
328
332
  });
329
333
  }
330
- /**
331
- * Admin: manually credit a merchant's balance (e.g. promotional credit).
332
- *
333
- * @param merchantId - The merchant account ID.
334
- * @param params - Credit amount and reason.
335
- * @returns The adjustment result.
336
- */
337
- async adminCredit(merchantId, params) {
338
- return this.request("POST", `/billing/${encodeURIComponent(merchantId)}/admin/credit`, {
339
- body: params
340
- });
341
- }
342
- /**
343
- * Admin: manually debit a merchant's balance.
344
- *
345
- * @param merchantId - The merchant account ID.
346
- * @param params - Debit amount and reason.
347
- * @returns The adjustment result.
348
- */
349
- async adminDebit(merchantId, params) {
350
- return this.request("POST", `/billing/${encodeURIComponent(merchantId)}/admin/debit`, {
351
- body: params
352
- });
353
- }
354
334
  };
355
335
 
356
336
  // src/resources/blocklist.ts
@@ -374,22 +354,6 @@ var Blocklist = class {
374
354
  }
375
355
  };
376
356
 
377
- // src/resources/cardIssuers.ts
378
- var CardIssuers = class {
379
- constructor(request) {
380
- this.request = request;
381
- }
382
- async create(params) {
383
- return this.request("POST", "/card_issuers", { body: params });
384
- }
385
- async update(issuerId, params) {
386
- return this.request("PUT", `/card_issuers/${encodeURIComponent(issuerId)}`, { body: params });
387
- }
388
- async list() {
389
- return this.request("GET", "/card_issuers");
390
- }
391
- };
392
-
393
357
  // src/resources/connectors.ts
394
358
  var Connectors = class {
395
359
  constructor(request) {
@@ -693,73 +657,15 @@ var Events = class {
693
657
  };
694
658
 
695
659
  // src/resources/fees.ts
696
- var PlatformFees = class {
697
- constructor(request) {
698
- this.request = request;
699
- }
700
- /**
701
- * Create a new platform fee schedule for a merchant (admin only).
702
- *
703
- * @param params - Fee schedule parameters (percentage, flat fee, min/max).
704
- * @param merchantId - The merchant account to attach the schedule to.
705
- * @returns The created fee schedule.
706
- */
707
- async create(params, merchantId) {
708
- return this.request("POST", "/admin/fees", {
709
- body: params,
710
- query: { merchant_id: merchantId }
711
- });
712
- }
713
- /**
714
- * List all platform fee schedules for a merchant (admin only).
715
- *
716
- * @param merchantId - The merchant account ID.
717
- * @returns Array of fee schedules.
718
- */
719
- async list(merchantId) {
720
- return this.request("GET", "/admin/fees/list", {
721
- query: { merchant_id: merchantId }
722
- });
723
- }
724
- /**
725
- * Retrieve a single fee schedule by ID (admin only).
726
- *
727
- * @param feeId - The fee schedule ID.
728
- * @returns The fee schedule.
729
- */
730
- async retrieve(feeId) {
731
- return this.request("GET", `/admin/fees/${encodeURIComponent(feeId)}`);
732
- }
733
- /**
734
- * Update a fee schedule (admin only).
735
- *
736
- * @param feeId - The fee schedule ID to update.
737
- * @param params - Fields to update.
738
- * @returns The updated fee schedule.
739
- */
740
- async update(feeId, params) {
741
- return this.request("PUT", `/admin/fees/${encodeURIComponent(feeId)}`, { body: params });
742
- }
743
- /**
744
- * Delete a fee schedule (admin only).
745
- *
746
- * @param feeId - The fee schedule ID to delete.
747
- * @returns The deleted fee schedule.
748
- */
749
- async delete(feeId) {
750
- return this.request("DELETE", `/admin/fees/${encodeURIComponent(feeId)}`);
751
- }
752
- };
753
- var MerchantFees = class {
660
+ var Fees = class {
754
661
  constructor(request) {
755
662
  this.request = request;
756
663
  }
757
664
  /**
758
- * Create a merchant-scoped fee schedule override for a specific shop.
665
+ * Create a merchant-scoped fee schedule (optionally per-shop).
759
666
  *
760
667
  * @param params - Fee schedule parameters.
761
668
  * @param merchantId - The merchant account ID.
762
- * @returns The created fee schedule.
763
669
  */
764
670
  async create(params, merchantId) {
765
671
  return this.request("POST", "/merchant_fees", {
@@ -768,10 +674,9 @@ var MerchantFees = class {
768
674
  });
769
675
  }
770
676
  /**
771
- * List merchant-scoped fee schedules.
677
+ * List the merchant's own fee schedules.
772
678
  *
773
679
  * @param merchantId - The merchant account ID.
774
- * @returns Array of fee schedules.
775
680
  */
776
681
  async list(merchantId) {
777
682
  return this.request("GET", "/merchant_fees/list", {
@@ -781,9 +686,8 @@ var MerchantFees = class {
781
686
  /**
782
687
  * Update a merchant-scoped fee schedule.
783
688
  *
784
- * @param feeId - The fee schedule ID to update.
689
+ * @param feeId - The fee schedule ID.
785
690
  * @param params - Fields to update.
786
- * @returns The updated fee schedule.
787
691
  */
788
692
  async update(feeId, params) {
789
693
  return this.request("PUT", `/merchant_fees/${encodeURIComponent(feeId)}`, { body: params });
@@ -791,38 +695,12 @@ var MerchantFees = class {
791
695
  /**
792
696
  * Delete a merchant-scoped fee schedule.
793
697
  *
794
- * @param feeId - The fee schedule ID to delete.
795
- * @returns The deleted fee schedule.
698
+ * @param feeId - The fee schedule ID.
796
699
  */
797
700
  async delete(feeId) {
798
701
  return this.request("DELETE", `/merchant_fees/${encodeURIComponent(feeId)}`);
799
702
  }
800
703
  };
801
- var Fees = class {
802
- constructor(request) {
803
- this.platform = new PlatformFees(request);
804
- this.merchant = new MerchantFees(request);
805
- }
806
- };
807
-
808
- // src/resources/gsm.ts
809
- var Gsm = class {
810
- constructor(request) {
811
- this.request = request;
812
- }
813
- async create(params) {
814
- return this.request("POST", "/gsm", { body: params });
815
- }
816
- async retrieve(params) {
817
- return this.request("POST", "/gsm/get", { body: params });
818
- }
819
- async update(params) {
820
- return this.request("POST", "/gsm/update", { body: params });
821
- }
822
- async delete(params) {
823
- return this.request("POST", "/gsm/delete", { body: params });
824
- }
825
- };
826
704
 
827
705
  // src/resources/mandates.ts
828
706
  var Mandates = class {
@@ -2424,17 +2302,6 @@ var AnalyticsDashboard = class {
2424
2302
  }
2425
2303
  };
2426
2304
 
2427
- // src/resources/cache.ts
2428
- var Cache = class {
2429
- constructor(request) {
2430
- this.request = request;
2431
- }
2432
- /** Invalidate a cache entry by key. `POST /cache/invalidate/{key}` */
2433
- async invalidate(key) {
2434
- return this.request("POST", `/cache/invalidate/${encodeURIComponent(key)}`);
2435
- }
2436
- };
2437
-
2438
2305
  // src/resources/cards.ts
2439
2306
  var Cards = class {
2440
2307
  constructor(request) {
@@ -2454,29 +2321,6 @@ var Cards = class {
2454
2321
  }
2455
2322
  };
2456
2323
 
2457
- // src/resources/configs.ts
2458
- var Configs = class {
2459
- constructor(request) {
2460
- this.request = request;
2461
- }
2462
- /** Create a config. `POST /configs` */
2463
- async create(params) {
2464
- return this.request("POST", "/configs", { body: params });
2465
- }
2466
- /** Retrieve a config by key. `GET /configs/{key}` */
2467
- async retrieve(key) {
2468
- return this.request("GET", `/configs/${encodeURIComponent(key)}`);
2469
- }
2470
- /** Update a config. `PUT /configs/{key}` */
2471
- async update(key, params) {
2472
- return this.request("PUT", `/configs/${encodeURIComponent(key)}`, { body: params });
2473
- }
2474
- /** Delete a config. `DELETE /configs/{key}` */
2475
- async delete(key) {
2476
- return this.request("DELETE", `/configs/${encodeURIComponent(key)}`);
2477
- }
2478
- };
2479
-
2480
2324
  // src/resources/export.ts
2481
2325
  var Export = class {
2482
2326
  constructor(request) {
@@ -2738,9 +2582,7 @@ var Delopay = class {
2738
2582
  this.apiKeys = new ApiKeys(request);
2739
2583
  this.billing = new Billing(request);
2740
2584
  this.blocklist = new Blocklist(request);
2741
- this.cardIssuers = new CardIssuers(request);
2742
2585
  this.fees = new Fees(request);
2743
- this.gsm = new Gsm(request);
2744
2586
  this.merchantAccounts = new MerchantAccounts(request);
2745
2587
  this.projects = new Projects(request);
2746
2588
  this.relay = new Relay(request);
@@ -2755,8 +2597,6 @@ var Delopay = class {
2755
2597
  this.analyticsDashboard = new AnalyticsDashboard(request);
2756
2598
  this.featureMatrix = new FeatureMatrix(request);
2757
2599
  this.cards = new Cards(request);
2758
- this.configs = new Configs(request);
2759
- this.cache = new Cache(request);
2760
2600
  }
2761
2601
  /**
2762
2602
  * Set a JWT token for subsequent requests.
@@ -2983,7 +2823,7 @@ var Delopay = class {
2983
2823
  /** Utility for verifying incoming webhook signatures (static, no instance needed). */
2984
2824
  Delopay.webhooks = Webhooks;
2985
2825
 
2986
- // src/resources/admin.ts
2826
+ // src/internal/resources/admin.ts
2987
2827
  var Admin = class {
2988
2828
  constructor(request) {
2989
2829
  this.request = request;
@@ -3023,7 +2863,7 @@ var Admin = class {
3023
2863
  }
3024
2864
  };
3025
2865
 
3026
- // src/resources/adminPortal.ts
2866
+ // src/internal/resources/adminPortal.ts
3027
2867
  var AdminPortal = class {
3028
2868
  constructor(request) {
3029
2869
  this.request = request;
@@ -3080,7 +2920,7 @@ var AdminPortal = class {
3080
2920
  }
3081
2921
  };
3082
2922
 
3083
- // src/resources/auditLogs.ts
2923
+ // src/internal/resources/auditLogs.ts
3084
2924
  var AuditLogs = class {
3085
2925
  constructor(request) {
3086
2926
  this.request = request;
@@ -3095,6 +2935,137 @@ var AuditLogs = class {
3095
2935
  }
3096
2936
  };
3097
2937
 
2938
+ // src/internal/resources/cache.ts
2939
+ var Cache = class {
2940
+ constructor(request) {
2941
+ this.request = request;
2942
+ }
2943
+ /** Invalidate a cache entry by key. `POST /cache/invalidate/{key}` */
2944
+ async invalidate(key) {
2945
+ return this.request("POST", `/cache/invalidate/${encodeURIComponent(key)}`);
2946
+ }
2947
+ };
2948
+
2949
+ // src/internal/resources/cardIssuers.ts
2950
+ var CardIssuers = class {
2951
+ constructor(request) {
2952
+ this.request = request;
2953
+ }
2954
+ async create(params) {
2955
+ return this.request("POST", "/card_issuers", { body: params });
2956
+ }
2957
+ async update(issuerId, params) {
2958
+ return this.request("PUT", `/card_issuers/${encodeURIComponent(issuerId)}`, { body: params });
2959
+ }
2960
+ async list() {
2961
+ return this.request("GET", "/card_issuers");
2962
+ }
2963
+ };
2964
+
2965
+ // src/internal/resources/configs.ts
2966
+ var Configs = class {
2967
+ constructor(request) {
2968
+ this.request = request;
2969
+ }
2970
+ /** Create a config. `POST /configs` */
2971
+ async create(params) {
2972
+ return this.request("POST", "/configs", { body: params });
2973
+ }
2974
+ /** Retrieve a config by key. `GET /configs/{key}` */
2975
+ async retrieve(key) {
2976
+ return this.request("GET", `/configs/${encodeURIComponent(key)}`);
2977
+ }
2978
+ /** Update a config. `PUT /configs/{key}` */
2979
+ async update(key, params) {
2980
+ return this.request("PUT", `/configs/${encodeURIComponent(key)}`, { body: params });
2981
+ }
2982
+ /** Delete a config. `DELETE /configs/{key}` */
2983
+ async delete(key) {
2984
+ return this.request("DELETE", `/configs/${encodeURIComponent(key)}`);
2985
+ }
2986
+ };
2987
+
2988
+ // src/internal/resources/gsm.ts
2989
+ var Gsm = class {
2990
+ constructor(request) {
2991
+ this.request = request;
2992
+ }
2993
+ async create(params) {
2994
+ return this.request("POST", "/gsm", { body: params });
2995
+ }
2996
+ async retrieve(params) {
2997
+ return this.request("POST", "/gsm/get", { body: params });
2998
+ }
2999
+ async update(params) {
3000
+ return this.request("POST", "/gsm/update", { body: params });
3001
+ }
3002
+ async delete(params) {
3003
+ return this.request("POST", "/gsm/delete", { body: params });
3004
+ }
3005
+ };
3006
+
3007
+ // src/internal/resources/platformBilling.ts
3008
+ var PlatformBilling = class {
3009
+ constructor(request) {
3010
+ this.request = request;
3011
+ }
3012
+ /**
3013
+ * Manually credit a merchant's balance (e.g. promotional credit,
3014
+ * dispute reversal, manual correction).
3015
+ *
3016
+ * @param merchantId - The merchant account ID.
3017
+ * @param params - Credit amount and reason.
3018
+ */
3019
+ async credit(merchantId, params) {
3020
+ return this.request("POST", `/billing/${encodeURIComponent(merchantId)}/admin/credit`, {
3021
+ body: params
3022
+ });
3023
+ }
3024
+ /**
3025
+ * Manually debit a merchant's balance.
3026
+ *
3027
+ * @param merchantId - The merchant account ID.
3028
+ * @param params - Debit amount and reason.
3029
+ */
3030
+ async debit(merchantId, params) {
3031
+ return this.request("POST", `/billing/${encodeURIComponent(merchantId)}/admin/debit`, {
3032
+ body: params
3033
+ });
3034
+ }
3035
+ };
3036
+
3037
+ // src/internal/resources/platformFees.ts
3038
+ var PlatformFees = class {
3039
+ constructor(request) {
3040
+ this.request = request;
3041
+ }
3042
+ /** Create a platform fee schedule for a specific merchant. */
3043
+ async create(params, merchantId) {
3044
+ return this.request("POST", "/admin/fees", {
3045
+ body: params,
3046
+ query: { merchant_id: merchantId }
3047
+ });
3048
+ }
3049
+ /** List every platform fee schedule assigned to a merchant. */
3050
+ async list(merchantId) {
3051
+ return this.request("GET", "/admin/fees/list", {
3052
+ query: { merchant_id: merchantId }
3053
+ });
3054
+ }
3055
+ /** Retrieve a single platform fee schedule by ID. */
3056
+ async retrieve(feeId) {
3057
+ return this.request("GET", `/admin/fees/${encodeURIComponent(feeId)}`);
3058
+ }
3059
+ /** Update a platform fee schedule. */
3060
+ async update(feeId, params) {
3061
+ return this.request("PUT", `/admin/fees/${encodeURIComponent(feeId)}`, { body: params });
3062
+ }
3063
+ /** Delete a platform fee schedule. */
3064
+ async delete(feeId) {
3065
+ return this.request("DELETE", `/admin/fees/${encodeURIComponent(feeId)}`);
3066
+ }
3067
+ };
3068
+
3098
3069
  // src/internal/client.ts
3099
3070
  var DelopayInternal = class extends Delopay {
3100
3071
  constructor(...args) {
@@ -3103,6 +3074,12 @@ var DelopayInternal = class extends Delopay {
3103
3074
  this.admin = new Admin(request);
3104
3075
  this.adminPortal = new AdminPortal(request);
3105
3076
  this.auditLogs = new AuditLogs(request);
3077
+ this.cache = new Cache(request);
3078
+ this.cardIssuers = new CardIssuers(request);
3079
+ this.configs = new Configs(request);
3080
+ this.gsm = new Gsm(request);
3081
+ this.platformBilling = new PlatformBilling(request);
3082
+ this.platformFees = new PlatformFees(request);
3106
3083
  }
3107
3084
  };
3108
3085
  // Annotate the CommonJS export names for ESM import in node:
@@ -3113,6 +3090,7 @@ var DelopayInternal = class extends Delopay {
3113
3090
  AnalyticsDashboard,
3114
3091
  AuditLogs,
3115
3092
  Cache,
3093
+ CardIssuers,
3116
3094
  Cards,
3117
3095
  Configs,
3118
3096
  Delopay,
@@ -3123,6 +3101,9 @@ var DelopayInternal = class extends Delopay {
3123
3101
  FeatureMatrix,
3124
3102
  Files,
3125
3103
  Forex,
3104
+ Gsm,
3105
+ PlatformBilling,
3106
+ PlatformFees,
3126
3107
  Regions,
3127
3108
  Subscriptions,
3128
3109
  Webhooks