@thorprovider/medusa-extended 1.2.3 → 1.3.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.mjs CHANGED
@@ -397,6 +397,20 @@ var DropshipperClient = class {
397
397
  return response.json();
398
398
  }
399
399
  // -------------------------------------------------------------------------
400
+ // Capabilities
401
+ // -------------------------------------------------------------------------
402
+ /**
403
+ * Fetch dashboard capabilities from the backend.
404
+ *
405
+ * `GET /admin/thor/dropshipper/capabilities`
406
+ */
407
+ async getCapabilities() {
408
+ return this.request(
409
+ "GET",
410
+ "/admin/thor/dropshipper/capabilities"
411
+ );
412
+ }
413
+ // -------------------------------------------------------------------------
400
414
  // Onboarding (Solo X)
401
415
  // -------------------------------------------------------------------------
402
416
  /**
@@ -563,7 +577,9 @@ var DropshipperClient = class {
563
577
  async getOrderShippingOptions(params) {
564
578
  const qs = new URLSearchParams({
565
579
  currency_code: params.currency_code.toLowerCase(),
566
- ...params.country_code ? { country_code: params.country_code.toLowerCase() } : {}
580
+ ...params.country_code ? { country_code: params.country_code.toLowerCase() } : {},
581
+ ...params.province ? { province: params.province } : {},
582
+ ...params.city ? { city: params.city } : {}
567
583
  });
568
584
  return this.request(
569
585
  "GET",
@@ -735,8 +751,6 @@ var DropshipperClient = class {
735
751
  /**
736
752
  * Delete a custom category.
737
753
  *
738
- * Pass `{ force: true }` to cascade-delete child categories.
739
- *
740
754
  * `DELETE /admin/thor/dropshipper/categories/:id`
741
755
  */
742
756
  async deleteCategory(categoryId, options = {}) {
@@ -766,7 +780,7 @@ var DropshipperClient = class {
766
780
  async createCategoryMapping(body) {
767
781
  return this.request(
768
782
  "POST",
769
- "/admin/thor/dropshipper/category-mappings",
783
+ `/admin/thor/dropshipper/category-mappings`,
770
784
  body
771
785
  );
772
786
  }
@@ -947,6 +961,36 @@ var DropshipperClient = class {
947
961
  `/admin/thor/dropshipper/settlements/${settlementId}`
948
962
  );
949
963
  }
964
+ /**
965
+ * Consolidated financial balance for the authenticated dropshipper.
966
+ *
967
+ * `GET /admin/thor/dropshipper/account/balance`
968
+ */
969
+ async getAccountBalance() {
970
+ return this.request(
971
+ "GET",
972
+ "/admin/thor/dropshipper/account/balance"
973
+ );
974
+ }
975
+ /**
976
+ * Unified financial order list for the authenticated dropshipper.
977
+ *
978
+ * `GET /admin/thor/dropshipper/account/orders`
979
+ */
980
+ async getAccountOrders(options = {}) {
981
+ const { tab, status, limit = 20, offset = 0, q } = options;
982
+ const qs = new URLSearchParams({
983
+ limit: String(limit),
984
+ offset: String(offset),
985
+ ...tab ? { tab } : {},
986
+ ...status ? { status } : {},
987
+ ...q ? { q } : {}
988
+ });
989
+ return this.request(
990
+ "GET",
991
+ `/admin/thor/dropshipper/account/orders?${qs}`
992
+ );
993
+ }
950
994
  // -------------------------------------------------------------------------
951
995
  // Admin Settlements (Solo X)
952
996
  // -------------------------------------------------------------------------
@@ -1056,6 +1100,168 @@ var DropshipperClient = class {
1056
1100
  );
1057
1101
  }
1058
1102
  // -------------------------------------------------------------------------
1103
+ // Financial Endpoints — Group A (Admin X)
1104
+ // -------------------------------------------------------------------------
1105
+ /**
1106
+ * List orders with financial detail for a dropshipper account (Admin only).
1107
+ *
1108
+ * `GET /admin/thor/dropshipper/admin/accounts/:id/orders`
1109
+ */
1110
+ async getAdminAccountOrders(accountId, options = {}) {
1111
+ const { tab, status, limit = 20, offset = 0, q } = options;
1112
+ const qs = new URLSearchParams({
1113
+ limit: String(limit),
1114
+ offset: String(offset),
1115
+ ...tab ? { tab } : {},
1116
+ ...status ? { status } : {},
1117
+ ...q ? { q } : {}
1118
+ });
1119
+ return this.request(
1120
+ "GET",
1121
+ `/admin/thor/dropshipper/admin/accounts/${accountId}/orders?${qs}`
1122
+ );
1123
+ }
1124
+ /**
1125
+ * List financial movements for a dropshipper account (Admin only).
1126
+ *
1127
+ * `GET /admin/thor/dropshipper/admin/accounts/:id/settlements`
1128
+ */
1129
+ async getAdminAccountSettlements(accountId, options = {}) {
1130
+ const { type, status, limit = 20, offset = 0 } = options;
1131
+ const qs = new URLSearchParams({
1132
+ limit: String(limit),
1133
+ offset: String(offset),
1134
+ ...type ? { type } : {},
1135
+ ...status ? { status } : {}
1136
+ });
1137
+ return this.request(
1138
+ "GET",
1139
+ `/admin/thor/dropshipper/admin/accounts/${accountId}/settlements?${qs}`
1140
+ );
1141
+ }
1142
+ /**
1143
+ * Manually resolve a guarantee on an order (Admin only).
1144
+ *
1145
+ * `POST /admin/thor/dropshipper/admin/accounts/:id/guarantee/:order_id`
1146
+ */
1147
+ async resolveGuarantee(accountId, orderId, body) {
1148
+ return this.request(
1149
+ "POST",
1150
+ `/admin/thor/dropshipper/admin/accounts/${accountId}/guarantee/${orderId}`,
1151
+ body
1152
+ );
1153
+ }
1154
+ /**
1155
+ * Create an internal compensation (netting) between DS and Thor debts (Admin only).
1156
+ *
1157
+ * `POST /admin/thor/dropshipper/admin/accounts/:id/settlements/compensacion`
1158
+ */
1159
+ async createCompensacion(accountId, body) {
1160
+ return this.request(
1161
+ "POST",
1162
+ `/admin/thor/dropshipper/admin/accounts/${accountId}/settlements/compensacion`,
1163
+ body
1164
+ );
1165
+ }
1166
+ /**
1167
+ * Create a financial adjustment (Admin only).
1168
+ *
1169
+ * `POST /admin/thor/dropshipper/admin/accounts/:id/settlements/ajuste`
1170
+ */
1171
+ async createAjuste(accountId, body) {
1172
+ return this.request(
1173
+ "POST",
1174
+ `/admin/thor/dropshipper/admin/accounts/${accountId}/settlements/ajuste`,
1175
+ body
1176
+ );
1177
+ }
1178
+ // -------------------------------------------------------------------------
1179
+ // Financial Endpoints — Group B (Admin X)
1180
+ // -------------------------------------------------------------------------
1181
+ /**
1182
+ * Register a cobro — DS pays Thor the product cost (Admin only).
1183
+ *
1184
+ * `POST /admin/thor/dropshipper/admin/accounts/:id/settlements/cobro`
1185
+ */
1186
+ async createCobro(accountId, body) {
1187
+ return this.request(
1188
+ "POST",
1189
+ `/admin/thor/dropshipper/admin/accounts/${accountId}/settlements/cobro`,
1190
+ body
1191
+ );
1192
+ }
1193
+ /**
1194
+ * Register a pago — Thor pays the dropshipper their commission (Admin only).
1195
+ *
1196
+ * `POST /admin/thor/dropshipper/admin/accounts/:id/settlements/pago`
1197
+ */
1198
+ async createPago(accountId, body) {
1199
+ return this.request(
1200
+ "POST",
1201
+ `/admin/thor/dropshipper/admin/accounts/${accountId}/settlements/pago`,
1202
+ body
1203
+ );
1204
+ }
1205
+ /**
1206
+ * Reverse a confirmed financial movement (Admin only).
1207
+ *
1208
+ * `POST /admin/thor/dropshipper/admin/accounts/:id/settlements/:mov_id/reverso`
1209
+ */
1210
+ async reverseSettlement(accountId, movementId, body) {
1211
+ return this.request(
1212
+ "POST",
1213
+ `/admin/thor/dropshipper/admin/accounts/${accountId}/settlements/${movementId}/reverso`,
1214
+ body
1215
+ );
1216
+ }
1217
+ /**
1218
+ * Confirm a pending financial movement (Admin only).
1219
+ *
1220
+ * `POST /admin/thor/dropshipper/admin/accounts/:id/settlements/:mov_id/confirm`
1221
+ */
1222
+ async confirmSettlementMovement(accountId, movementId, body = {}) {
1223
+ return this.request(
1224
+ "POST",
1225
+ `/admin/thor/dropshipper/admin/accounts/${accountId}/settlements/${movementId}/confirm`,
1226
+ body
1227
+ );
1228
+ }
1229
+ /**
1230
+ * Cancel a pending financial movement draft (Admin only).
1231
+ *
1232
+ * `POST /admin/thor/dropshipper/admin/accounts/:id/settlements/:mov_id/cancel`
1233
+ */
1234
+ async cancelSettlementMovement(accountId, movementId, body) {
1235
+ return this.request(
1236
+ "POST",
1237
+ `/admin/thor/dropshipper/admin/accounts/${accountId}/settlements/${movementId}/cancel`,
1238
+ body
1239
+ );
1240
+ }
1241
+ /**
1242
+ * Get financial analysis for a dropshipper order (Admin only).
1243
+ *
1244
+ * `GET /admin/thor/dropshipper/admin/orders/:id/financial-analysis`
1245
+ */
1246
+ async getOrderFinancialAnalysis(orderId) {
1247
+ return this.request(
1248
+ "GET",
1249
+ `/admin/thor/dropshipper/admin/orders/${orderId}/financial-analysis`
1250
+ );
1251
+ }
1252
+ /**
1253
+ * Register a partial or full payment for an order.
1254
+ *
1255
+ * `POST /admin/thor/dropshipper/orders/:id/payment`
1256
+ */
1257
+ async registerOrderPayment(orderId, body) {
1258
+ return this.request(
1259
+ "POST",
1260
+ `/admin/thor/dropshipper/orders/${orderId}/payment`,
1261
+ body
1262
+ );
1263
+ }
1264
+ // -------------------------------------------------------------------------
1059
1265
  // Promotions (Solo Y)
1060
1266
  // -------------------------------------------------------------------------
1061
1267
  /**