@thorprovider/medusa-extended 1.2.3 → 1.4.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/.turbo/turbo-build.log +18 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/index.d.mts +91 -3
- package/dist/index.d.ts +91 -3
- package/dist/index.js +210 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +210 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/dropshipper.test.ts +272 -0
- package/src/dropshipper.ts +307 -13
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GetChannelCustomersOptions, GetChannelCustomersResponse, GetChannelApiKeysResponse, GetChannelCategoriesOptions, GetChannelCategoriesResponse, GetCategorySalesChannelsResponse, AssignCategoriesToChannelsBody, AssignCategoriesToChannelsResponse, UnassignCategoriesFromChannelsBody, UnassignCategoriesFromChannelsResponse, GetCollectionSalesChannelsResponse, AssignCollectionsToChannelsBody, AssignCollectionsToChannelsResponse, UnassignCollectionsFromChannelsBody, UnassignCollectionsFromChannelsResponse, GetAdminStorefrontConfigResponse, UpdateStorefrontConfigBody, UpdateStorefrontConfigResponse, GetAdminSiteConfigResponse, UpdateSiteConfigBody, UpdateSiteConfigResponse, GetAdminSiteConfigHistoryOptions, GetAdminSiteConfigHistoryResponse, RestoreSiteConfigResponse, OnboardDropshipperBody, OnboardDropshipperResponse, GetVariantCostsOptions, GetVariantCostsResponse, CreateVariantCostBody, CreateVariantCostResponse, BatchVariantCostsBody, BatchVariantCostsResponse, DeleteVariantCostResponse, GetDropshipperProductsOptions, GetDropshipperProductsResponse, UpdateDropshipperProductStatusBody, UpdateDropshipperProductStatusResponse, UpdateDropshipperPricesBody, UpdateDropshipperPricesResponse, GetDropshipperOrdersOptions, GetDropshipperOrdersResponse, GetDropshipperOrderDetailResponse, GetDropshipperShippingOptionsParams, GetDropshipperShippingOptionsResponse, ExtendedCreateDropshipperOrderBody, ExtendedCreateDropshipperOrderResponse, SetPaymentCollectorBody, SetPaymentCollectorResponse, CancelDropshipperOrderResponse, CreateOrderEditBody, CreateOrderEditResponse, AddOrderEditItemBody, AddOrderEditItemResponse, ConfirmOrderEditResponse, GetOrderNotesResponse, CreateOrderNoteBody, OrderNote, DeleteOrderNoteResponse, GetProviderCategoriesResponse, GetDropshipperCategoriesOptions, GetDropshipperCategoriesResponse, CreateDropshipperCategoryBody, DropshipperCategory, UpdateDropshipperCategoryBody, DeleteDropshipperCategoryResponse, GetCategoryMappingsOptions, GetCategoryMappingsResponse, CreateCategoryMappingBody, CreateCategoryMappingResponse, DeleteCategoryMappingResponse, GetDropshipperCustomersOptions, GetDropshipperCustomersResponse, GetDropshipperCustomerDetailResponse, CreateDropshipperCustomerBody, CreateDropshipperCustomerResponse, GetDropshipperAddressesResponse, DropshipperAddressBody, DropshipperAddressResponse, GetDropshipperAccountResponse, GetDropshipperPayableResponse, GetDropshipperReceivableResponse, GetSettlementsOptions, GetSettlementsResponse, GetSettlementDetailResponse, CreateSettlementBody, CreateSettlementResponse, ConfirmSettlementBody, UpdateSettlementStatusResponse, CancelSettlementBody, GetAdminDropshipperAccountsResponse, GetAdminAccountBalanceResponse, GetAdminPriceListsResponse, GetUserChannelResponse, GetDropshipperPromotionsOptions, GetDropshipperPromotionsResponse, CreateDropshipperPromotionBody, DropshipperPromotion, UpdateDropshipperPromotionBody, DeleteDropshipperPromotionResponse, GetDashboardStatsOptions, GetDashboardStatsResponse, GetStorefrontDropshipperCategoriesResponse } from '@thorprovider/types';
|
|
1
|
+
import { GetChannelCustomersOptions, GetChannelCustomersResponse, GetChannelApiKeysResponse, GetChannelCategoriesOptions, GetChannelCategoriesResponse, GetCategorySalesChannelsResponse, AssignCategoriesToChannelsBody, AssignCategoriesToChannelsResponse, UnassignCategoriesFromChannelsBody, UnassignCategoriesFromChannelsResponse, GetCollectionSalesChannelsResponse, AssignCollectionsToChannelsBody, AssignCollectionsToChannelsResponse, UnassignCollectionsFromChannelsBody, UnassignCollectionsFromChannelsResponse, GetAdminStorefrontConfigResponse, UpdateStorefrontConfigBody, UpdateStorefrontConfigResponse, GetAdminSiteConfigResponse, UpdateSiteConfigBody, UpdateSiteConfigResponse, GetAdminSiteConfigHistoryOptions, GetAdminSiteConfigHistoryResponse, RestoreSiteConfigResponse, DropshipperDashboardCapabilities, OnboardDropshipperBody, OnboardDropshipperResponse, GetVariantCostsOptions, GetVariantCostsResponse, CreateVariantCostBody, CreateVariantCostResponse, BatchVariantCostsBody, BatchVariantCostsResponse, DeleteVariantCostResponse, GetDropshipperProductsOptions, GetDropshipperProductsResponse, UpdateDropshipperProductStatusBody, UpdateDropshipperProductStatusResponse, UpdateDropshipperPricesBody, UpdateDropshipperPricesResponse, GetDropshipperOrdersOptions, GetDropshipperOrdersResponse, GetDropshipperOrderDetailResponse, GetDropshipperShippingOptionsParams, GetDropshipperShippingOptionsResponse, ExtendedCreateDropshipperOrderBody, ExtendedCreateDropshipperOrderResponse, SetPaymentCollectorBody, SetPaymentCollectorResponse, CancelDropshipperOrderResponse, CreateOrderEditBody, CreateOrderEditResponse, AddOrderEditItemBody, AddOrderEditItemResponse, ConfirmOrderEditResponse, GetOrderNotesResponse, CreateOrderNoteBody, OrderNote, DeleteOrderNoteResponse, GetProviderCategoriesResponse, GetDropshipperCategoriesOptions, GetDropshipperCategoriesResponse, CreateDropshipperCategoryBody, DropshipperCategory, UpdateDropshipperCategoryBody, DeleteDropshipperCategoryResponse, GetCategoryMappingsOptions, GetCategoryMappingsResponse, CreateCategoryMappingBody, CreateCategoryMappingResponse, DeleteCategoryMappingResponse, GetDropshipperCustomersOptions, GetDropshipperCustomersResponse, GetDropshipperCustomerDetailResponse, CreateDropshipperCustomerBody, CreateDropshipperCustomerResponse, GetDropshipperAddressesResponse, DropshipperAddressBody, DropshipperAddressResponse, GetDropshipperAccountResponse, GetDropshipperPayableResponse, GetDropshipperReceivableResponse, GetSettlementsOptions, GetSettlementsResponse, GetSettlementDetailResponse, GetDropshipperAccountBalanceResponse, GetDropshipperAccountOrdersOptions, GetDropshipperAccountOrdersResponse, CreateSettlementBody, CreateSettlementResponse, ConfirmSettlementBody, UpdateSettlementStatusResponse, CancelSettlementBody, GetAdminDropshipperAccountsResponse, GetAdminAccountBalanceResponse, GetAdminPriceListsResponse, GetUserChannelResponse, GetAdminDropshipperAccountOrdersResponse, GetAdminDropshipperAccountSettlementsOptions, GetAdminDropshipperAccountSettlementsResponse, ResolveGuaranteeBody, ResolveGuaranteeResponse, CreateCompensacionBody, CreateCompensacionResponse, CreateAjusteBody, CreateAjusteResponse, CreateCobroBody, CreateCobroResponse, CreatePagoBody, CreatePagoResponse, CreateReversoBody, CreateReversoResponse, ConfirmMovementBody, ConfirmMovementResponse, CancelMovementBody, CancelMovementResponse, GetFinancialAnalysisResponse, RegisterPaymentBody, RegisterPaymentResponse, GetDropshipperPromotionsOptions, GetDropshipperPromotionsResponse, CreateDropshipperPromotionBody, DropshipperPromotion, UpdateDropshipperPromotionBody, DeleteDropshipperPromotionResponse, GetDashboardStatsOptions, GetDashboardStatsResponse, GetStorefrontDropshipperCategoriesResponse } from '@thorprovider/types';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @fileoverview Medusa Multi-Tenant Admin Client
|
|
@@ -202,6 +202,12 @@ declare class DropshipperClient {
|
|
|
202
202
|
private logger;
|
|
203
203
|
constructor(config: DropshipperClientConfig);
|
|
204
204
|
private request;
|
|
205
|
+
/**
|
|
206
|
+
* Fetch dashboard capabilities from the backend.
|
|
207
|
+
*
|
|
208
|
+
* `GET /admin/thor/dropshipper/capabilities`
|
|
209
|
+
*/
|
|
210
|
+
getCapabilities(): Promise<DropshipperDashboardCapabilities>;
|
|
205
211
|
/**
|
|
206
212
|
* Create a new dropshipper account (sales channel + user + price list).
|
|
207
213
|
*
|
|
@@ -350,8 +356,6 @@ declare class DropshipperClient {
|
|
|
350
356
|
/**
|
|
351
357
|
* Delete a custom category.
|
|
352
358
|
*
|
|
353
|
-
* Pass `{ force: true }` to cascade-delete child categories.
|
|
354
|
-
*
|
|
355
359
|
* `DELETE /admin/thor/dropshipper/categories/:id`
|
|
356
360
|
*/
|
|
357
361
|
deleteCategory(categoryId: string, options?: {
|
|
@@ -454,6 +458,18 @@ declare class DropshipperClient {
|
|
|
454
458
|
* `GET /admin/thor/dropshipper/settlements/:id`
|
|
455
459
|
*/
|
|
456
460
|
getSettlement(settlementId: string): Promise<GetSettlementDetailResponse>;
|
|
461
|
+
/**
|
|
462
|
+
* Consolidated financial balance for the authenticated dropshipper.
|
|
463
|
+
*
|
|
464
|
+
* `GET /admin/thor/dropshipper/account/balance`
|
|
465
|
+
*/
|
|
466
|
+
getAccountBalance(): Promise<GetDropshipperAccountBalanceResponse>;
|
|
467
|
+
/**
|
|
468
|
+
* Unified financial order list for the authenticated dropshipper.
|
|
469
|
+
*
|
|
470
|
+
* `GET /admin/thor/dropshipper/account/orders`
|
|
471
|
+
*/
|
|
472
|
+
getAccountOrders(options?: GetDropshipperAccountOrdersOptions): Promise<GetDropshipperAccountOrdersResponse>;
|
|
457
473
|
/**
|
|
458
474
|
* Create a settlement record for a dropshipper account.
|
|
459
475
|
*
|
|
@@ -502,6 +518,78 @@ declare class DropshipperClient {
|
|
|
502
518
|
* `GET /admin/thor/dropshipper/admin/user-channel`
|
|
503
519
|
*/
|
|
504
520
|
getUserChannel(): Promise<GetUserChannelResponse>;
|
|
521
|
+
/**
|
|
522
|
+
* List orders with financial detail for a dropshipper account (Admin only).
|
|
523
|
+
*
|
|
524
|
+
* `GET /admin/thor/dropshipper/admin/accounts/:id/orders`
|
|
525
|
+
*/
|
|
526
|
+
getAdminAccountOrders(accountId: string, options?: GetDropshipperAccountOrdersOptions): Promise<GetAdminDropshipperAccountOrdersResponse>;
|
|
527
|
+
/**
|
|
528
|
+
* List financial movements for a dropshipper account (Admin only).
|
|
529
|
+
*
|
|
530
|
+
* `GET /admin/thor/dropshipper/admin/accounts/:id/settlements`
|
|
531
|
+
*/
|
|
532
|
+
getAdminAccountSettlements(accountId: string, options?: GetAdminDropshipperAccountSettlementsOptions): Promise<GetAdminDropshipperAccountSettlementsResponse>;
|
|
533
|
+
/**
|
|
534
|
+
* Manually resolve a guarantee on an order (Admin only).
|
|
535
|
+
*
|
|
536
|
+
* `POST /admin/thor/dropshipper/admin/accounts/:id/guarantee/:order_id`
|
|
537
|
+
*/
|
|
538
|
+
resolveGuarantee(accountId: string, orderId: string, body: ResolveGuaranteeBody): Promise<ResolveGuaranteeResponse>;
|
|
539
|
+
/**
|
|
540
|
+
* Create an internal compensation (netting) between DS and Thor debts (Admin only).
|
|
541
|
+
*
|
|
542
|
+
* `POST /admin/thor/dropshipper/admin/accounts/:id/settlements/compensacion`
|
|
543
|
+
*/
|
|
544
|
+
createCompensacion(accountId: string, body: CreateCompensacionBody): Promise<CreateCompensacionResponse>;
|
|
545
|
+
/**
|
|
546
|
+
* Create a financial adjustment (Admin only).
|
|
547
|
+
*
|
|
548
|
+
* `POST /admin/thor/dropshipper/admin/accounts/:id/settlements/ajuste`
|
|
549
|
+
*/
|
|
550
|
+
createAjuste(accountId: string, body: CreateAjusteBody): Promise<CreateAjusteResponse>;
|
|
551
|
+
/**
|
|
552
|
+
* Register a cobro — DS pays Thor the product cost (Admin only).
|
|
553
|
+
*
|
|
554
|
+
* `POST /admin/thor/dropshipper/admin/accounts/:id/settlements/cobro`
|
|
555
|
+
*/
|
|
556
|
+
createCobro(accountId: string, body: CreateCobroBody): Promise<CreateCobroResponse>;
|
|
557
|
+
/**
|
|
558
|
+
* Register a pago — Thor pays the dropshipper their commission (Admin only).
|
|
559
|
+
*
|
|
560
|
+
* `POST /admin/thor/dropshipper/admin/accounts/:id/settlements/pago`
|
|
561
|
+
*/
|
|
562
|
+
createPago(accountId: string, body: CreatePagoBody): Promise<CreatePagoResponse>;
|
|
563
|
+
/**
|
|
564
|
+
* Reverse a confirmed financial movement (Admin only).
|
|
565
|
+
*
|
|
566
|
+
* `POST /admin/thor/dropshipper/admin/accounts/:id/settlements/:mov_id/reverso`
|
|
567
|
+
*/
|
|
568
|
+
reverseSettlement(accountId: string, movementId: string, body: CreateReversoBody): Promise<CreateReversoResponse>;
|
|
569
|
+
/**
|
|
570
|
+
* Confirm a pending financial movement (Admin only).
|
|
571
|
+
*
|
|
572
|
+
* `POST /admin/thor/dropshipper/admin/accounts/:id/settlements/:mov_id/confirm`
|
|
573
|
+
*/
|
|
574
|
+
confirmSettlementMovement(accountId: string, movementId: string, body?: ConfirmMovementBody): Promise<ConfirmMovementResponse>;
|
|
575
|
+
/**
|
|
576
|
+
* Cancel a pending financial movement draft (Admin only).
|
|
577
|
+
*
|
|
578
|
+
* `POST /admin/thor/dropshipper/admin/accounts/:id/settlements/:mov_id/cancel`
|
|
579
|
+
*/
|
|
580
|
+
cancelSettlementMovement(accountId: string, movementId: string, body: CancelMovementBody): Promise<CancelMovementResponse>;
|
|
581
|
+
/**
|
|
582
|
+
* Get financial analysis for a dropshipper order (Admin only).
|
|
583
|
+
*
|
|
584
|
+
* `GET /admin/thor/dropshipper/admin/orders/:id/financial-analysis`
|
|
585
|
+
*/
|
|
586
|
+
getOrderFinancialAnalysis(orderId: string): Promise<GetFinancialAnalysisResponse>;
|
|
587
|
+
/**
|
|
588
|
+
* Register a partial or full payment for an order.
|
|
589
|
+
*
|
|
590
|
+
* `POST /admin/thor/dropshipper/orders/:id/payment`
|
|
591
|
+
*/
|
|
592
|
+
registerOrderPayment(orderId: string, body: RegisterPaymentBody): Promise<RegisterPaymentResponse>;
|
|
505
593
|
/**
|
|
506
594
|
* List Y's promotions (discount codes).
|
|
507
595
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GetChannelCustomersOptions, GetChannelCustomersResponse, GetChannelApiKeysResponse, GetChannelCategoriesOptions, GetChannelCategoriesResponse, GetCategorySalesChannelsResponse, AssignCategoriesToChannelsBody, AssignCategoriesToChannelsResponse, UnassignCategoriesFromChannelsBody, UnassignCategoriesFromChannelsResponse, GetCollectionSalesChannelsResponse, AssignCollectionsToChannelsBody, AssignCollectionsToChannelsResponse, UnassignCollectionsFromChannelsBody, UnassignCollectionsFromChannelsResponse, GetAdminStorefrontConfigResponse, UpdateStorefrontConfigBody, UpdateStorefrontConfigResponse, GetAdminSiteConfigResponse, UpdateSiteConfigBody, UpdateSiteConfigResponse, GetAdminSiteConfigHistoryOptions, GetAdminSiteConfigHistoryResponse, RestoreSiteConfigResponse, OnboardDropshipperBody, OnboardDropshipperResponse, GetVariantCostsOptions, GetVariantCostsResponse, CreateVariantCostBody, CreateVariantCostResponse, BatchVariantCostsBody, BatchVariantCostsResponse, DeleteVariantCostResponse, GetDropshipperProductsOptions, GetDropshipperProductsResponse, UpdateDropshipperProductStatusBody, UpdateDropshipperProductStatusResponse, UpdateDropshipperPricesBody, UpdateDropshipperPricesResponse, GetDropshipperOrdersOptions, GetDropshipperOrdersResponse, GetDropshipperOrderDetailResponse, GetDropshipperShippingOptionsParams, GetDropshipperShippingOptionsResponse, ExtendedCreateDropshipperOrderBody, ExtendedCreateDropshipperOrderResponse, SetPaymentCollectorBody, SetPaymentCollectorResponse, CancelDropshipperOrderResponse, CreateOrderEditBody, CreateOrderEditResponse, AddOrderEditItemBody, AddOrderEditItemResponse, ConfirmOrderEditResponse, GetOrderNotesResponse, CreateOrderNoteBody, OrderNote, DeleteOrderNoteResponse, GetProviderCategoriesResponse, GetDropshipperCategoriesOptions, GetDropshipperCategoriesResponse, CreateDropshipperCategoryBody, DropshipperCategory, UpdateDropshipperCategoryBody, DeleteDropshipperCategoryResponse, GetCategoryMappingsOptions, GetCategoryMappingsResponse, CreateCategoryMappingBody, CreateCategoryMappingResponse, DeleteCategoryMappingResponse, GetDropshipperCustomersOptions, GetDropshipperCustomersResponse, GetDropshipperCustomerDetailResponse, CreateDropshipperCustomerBody, CreateDropshipperCustomerResponse, GetDropshipperAddressesResponse, DropshipperAddressBody, DropshipperAddressResponse, GetDropshipperAccountResponse, GetDropshipperPayableResponse, GetDropshipperReceivableResponse, GetSettlementsOptions, GetSettlementsResponse, GetSettlementDetailResponse, CreateSettlementBody, CreateSettlementResponse, ConfirmSettlementBody, UpdateSettlementStatusResponse, CancelSettlementBody, GetAdminDropshipperAccountsResponse, GetAdminAccountBalanceResponse, GetAdminPriceListsResponse, GetUserChannelResponse, GetDropshipperPromotionsOptions, GetDropshipperPromotionsResponse, CreateDropshipperPromotionBody, DropshipperPromotion, UpdateDropshipperPromotionBody, DeleteDropshipperPromotionResponse, GetDashboardStatsOptions, GetDashboardStatsResponse, GetStorefrontDropshipperCategoriesResponse } from '@thorprovider/types';
|
|
1
|
+
import { GetChannelCustomersOptions, GetChannelCustomersResponse, GetChannelApiKeysResponse, GetChannelCategoriesOptions, GetChannelCategoriesResponse, GetCategorySalesChannelsResponse, AssignCategoriesToChannelsBody, AssignCategoriesToChannelsResponse, UnassignCategoriesFromChannelsBody, UnassignCategoriesFromChannelsResponse, GetCollectionSalesChannelsResponse, AssignCollectionsToChannelsBody, AssignCollectionsToChannelsResponse, UnassignCollectionsFromChannelsBody, UnassignCollectionsFromChannelsResponse, GetAdminStorefrontConfigResponse, UpdateStorefrontConfigBody, UpdateStorefrontConfigResponse, GetAdminSiteConfigResponse, UpdateSiteConfigBody, UpdateSiteConfigResponse, GetAdminSiteConfigHistoryOptions, GetAdminSiteConfigHistoryResponse, RestoreSiteConfigResponse, DropshipperDashboardCapabilities, OnboardDropshipperBody, OnboardDropshipperResponse, GetVariantCostsOptions, GetVariantCostsResponse, CreateVariantCostBody, CreateVariantCostResponse, BatchVariantCostsBody, BatchVariantCostsResponse, DeleteVariantCostResponse, GetDropshipperProductsOptions, GetDropshipperProductsResponse, UpdateDropshipperProductStatusBody, UpdateDropshipperProductStatusResponse, UpdateDropshipperPricesBody, UpdateDropshipperPricesResponse, GetDropshipperOrdersOptions, GetDropshipperOrdersResponse, GetDropshipperOrderDetailResponse, GetDropshipperShippingOptionsParams, GetDropshipperShippingOptionsResponse, ExtendedCreateDropshipperOrderBody, ExtendedCreateDropshipperOrderResponse, SetPaymentCollectorBody, SetPaymentCollectorResponse, CancelDropshipperOrderResponse, CreateOrderEditBody, CreateOrderEditResponse, AddOrderEditItemBody, AddOrderEditItemResponse, ConfirmOrderEditResponse, GetOrderNotesResponse, CreateOrderNoteBody, OrderNote, DeleteOrderNoteResponse, GetProviderCategoriesResponse, GetDropshipperCategoriesOptions, GetDropshipperCategoriesResponse, CreateDropshipperCategoryBody, DropshipperCategory, UpdateDropshipperCategoryBody, DeleteDropshipperCategoryResponse, GetCategoryMappingsOptions, GetCategoryMappingsResponse, CreateCategoryMappingBody, CreateCategoryMappingResponse, DeleteCategoryMappingResponse, GetDropshipperCustomersOptions, GetDropshipperCustomersResponse, GetDropshipperCustomerDetailResponse, CreateDropshipperCustomerBody, CreateDropshipperCustomerResponse, GetDropshipperAddressesResponse, DropshipperAddressBody, DropshipperAddressResponse, GetDropshipperAccountResponse, GetDropshipperPayableResponse, GetDropshipperReceivableResponse, GetSettlementsOptions, GetSettlementsResponse, GetSettlementDetailResponse, GetDropshipperAccountBalanceResponse, GetDropshipperAccountOrdersOptions, GetDropshipperAccountOrdersResponse, CreateSettlementBody, CreateSettlementResponse, ConfirmSettlementBody, UpdateSettlementStatusResponse, CancelSettlementBody, GetAdminDropshipperAccountsResponse, GetAdminAccountBalanceResponse, GetAdminPriceListsResponse, GetUserChannelResponse, GetAdminDropshipperAccountOrdersResponse, GetAdminDropshipperAccountSettlementsOptions, GetAdminDropshipperAccountSettlementsResponse, ResolveGuaranteeBody, ResolveGuaranteeResponse, CreateCompensacionBody, CreateCompensacionResponse, CreateAjusteBody, CreateAjusteResponse, CreateCobroBody, CreateCobroResponse, CreatePagoBody, CreatePagoResponse, CreateReversoBody, CreateReversoResponse, ConfirmMovementBody, ConfirmMovementResponse, CancelMovementBody, CancelMovementResponse, GetFinancialAnalysisResponse, RegisterPaymentBody, RegisterPaymentResponse, GetDropshipperPromotionsOptions, GetDropshipperPromotionsResponse, CreateDropshipperPromotionBody, DropshipperPromotion, UpdateDropshipperPromotionBody, DeleteDropshipperPromotionResponse, GetDashboardStatsOptions, GetDashboardStatsResponse, GetStorefrontDropshipperCategoriesResponse } from '@thorprovider/types';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @fileoverview Medusa Multi-Tenant Admin Client
|
|
@@ -202,6 +202,12 @@ declare class DropshipperClient {
|
|
|
202
202
|
private logger;
|
|
203
203
|
constructor(config: DropshipperClientConfig);
|
|
204
204
|
private request;
|
|
205
|
+
/**
|
|
206
|
+
* Fetch dashboard capabilities from the backend.
|
|
207
|
+
*
|
|
208
|
+
* `GET /admin/thor/dropshipper/capabilities`
|
|
209
|
+
*/
|
|
210
|
+
getCapabilities(): Promise<DropshipperDashboardCapabilities>;
|
|
205
211
|
/**
|
|
206
212
|
* Create a new dropshipper account (sales channel + user + price list).
|
|
207
213
|
*
|
|
@@ -350,8 +356,6 @@ declare class DropshipperClient {
|
|
|
350
356
|
/**
|
|
351
357
|
* Delete a custom category.
|
|
352
358
|
*
|
|
353
|
-
* Pass `{ force: true }` to cascade-delete child categories.
|
|
354
|
-
*
|
|
355
359
|
* `DELETE /admin/thor/dropshipper/categories/:id`
|
|
356
360
|
*/
|
|
357
361
|
deleteCategory(categoryId: string, options?: {
|
|
@@ -454,6 +458,18 @@ declare class DropshipperClient {
|
|
|
454
458
|
* `GET /admin/thor/dropshipper/settlements/:id`
|
|
455
459
|
*/
|
|
456
460
|
getSettlement(settlementId: string): Promise<GetSettlementDetailResponse>;
|
|
461
|
+
/**
|
|
462
|
+
* Consolidated financial balance for the authenticated dropshipper.
|
|
463
|
+
*
|
|
464
|
+
* `GET /admin/thor/dropshipper/account/balance`
|
|
465
|
+
*/
|
|
466
|
+
getAccountBalance(): Promise<GetDropshipperAccountBalanceResponse>;
|
|
467
|
+
/**
|
|
468
|
+
* Unified financial order list for the authenticated dropshipper.
|
|
469
|
+
*
|
|
470
|
+
* `GET /admin/thor/dropshipper/account/orders`
|
|
471
|
+
*/
|
|
472
|
+
getAccountOrders(options?: GetDropshipperAccountOrdersOptions): Promise<GetDropshipperAccountOrdersResponse>;
|
|
457
473
|
/**
|
|
458
474
|
* Create a settlement record for a dropshipper account.
|
|
459
475
|
*
|
|
@@ -502,6 +518,78 @@ declare class DropshipperClient {
|
|
|
502
518
|
* `GET /admin/thor/dropshipper/admin/user-channel`
|
|
503
519
|
*/
|
|
504
520
|
getUserChannel(): Promise<GetUserChannelResponse>;
|
|
521
|
+
/**
|
|
522
|
+
* List orders with financial detail for a dropshipper account (Admin only).
|
|
523
|
+
*
|
|
524
|
+
* `GET /admin/thor/dropshipper/admin/accounts/:id/orders`
|
|
525
|
+
*/
|
|
526
|
+
getAdminAccountOrders(accountId: string, options?: GetDropshipperAccountOrdersOptions): Promise<GetAdminDropshipperAccountOrdersResponse>;
|
|
527
|
+
/**
|
|
528
|
+
* List financial movements for a dropshipper account (Admin only).
|
|
529
|
+
*
|
|
530
|
+
* `GET /admin/thor/dropshipper/admin/accounts/:id/settlements`
|
|
531
|
+
*/
|
|
532
|
+
getAdminAccountSettlements(accountId: string, options?: GetAdminDropshipperAccountSettlementsOptions): Promise<GetAdminDropshipperAccountSettlementsResponse>;
|
|
533
|
+
/**
|
|
534
|
+
* Manually resolve a guarantee on an order (Admin only).
|
|
535
|
+
*
|
|
536
|
+
* `POST /admin/thor/dropshipper/admin/accounts/:id/guarantee/:order_id`
|
|
537
|
+
*/
|
|
538
|
+
resolveGuarantee(accountId: string, orderId: string, body: ResolveGuaranteeBody): Promise<ResolveGuaranteeResponse>;
|
|
539
|
+
/**
|
|
540
|
+
* Create an internal compensation (netting) between DS and Thor debts (Admin only).
|
|
541
|
+
*
|
|
542
|
+
* `POST /admin/thor/dropshipper/admin/accounts/:id/settlements/compensacion`
|
|
543
|
+
*/
|
|
544
|
+
createCompensacion(accountId: string, body: CreateCompensacionBody): Promise<CreateCompensacionResponse>;
|
|
545
|
+
/**
|
|
546
|
+
* Create a financial adjustment (Admin only).
|
|
547
|
+
*
|
|
548
|
+
* `POST /admin/thor/dropshipper/admin/accounts/:id/settlements/ajuste`
|
|
549
|
+
*/
|
|
550
|
+
createAjuste(accountId: string, body: CreateAjusteBody): Promise<CreateAjusteResponse>;
|
|
551
|
+
/**
|
|
552
|
+
* Register a cobro — DS pays Thor the product cost (Admin only).
|
|
553
|
+
*
|
|
554
|
+
* `POST /admin/thor/dropshipper/admin/accounts/:id/settlements/cobro`
|
|
555
|
+
*/
|
|
556
|
+
createCobro(accountId: string, body: CreateCobroBody): Promise<CreateCobroResponse>;
|
|
557
|
+
/**
|
|
558
|
+
* Register a pago — Thor pays the dropshipper their commission (Admin only).
|
|
559
|
+
*
|
|
560
|
+
* `POST /admin/thor/dropshipper/admin/accounts/:id/settlements/pago`
|
|
561
|
+
*/
|
|
562
|
+
createPago(accountId: string, body: CreatePagoBody): Promise<CreatePagoResponse>;
|
|
563
|
+
/**
|
|
564
|
+
* Reverse a confirmed financial movement (Admin only).
|
|
565
|
+
*
|
|
566
|
+
* `POST /admin/thor/dropshipper/admin/accounts/:id/settlements/:mov_id/reverso`
|
|
567
|
+
*/
|
|
568
|
+
reverseSettlement(accountId: string, movementId: string, body: CreateReversoBody): Promise<CreateReversoResponse>;
|
|
569
|
+
/**
|
|
570
|
+
* Confirm a pending financial movement (Admin only).
|
|
571
|
+
*
|
|
572
|
+
* `POST /admin/thor/dropshipper/admin/accounts/:id/settlements/:mov_id/confirm`
|
|
573
|
+
*/
|
|
574
|
+
confirmSettlementMovement(accountId: string, movementId: string, body?: ConfirmMovementBody): Promise<ConfirmMovementResponse>;
|
|
575
|
+
/**
|
|
576
|
+
* Cancel a pending financial movement draft (Admin only).
|
|
577
|
+
*
|
|
578
|
+
* `POST /admin/thor/dropshipper/admin/accounts/:id/settlements/:mov_id/cancel`
|
|
579
|
+
*/
|
|
580
|
+
cancelSettlementMovement(accountId: string, movementId: string, body: CancelMovementBody): Promise<CancelMovementResponse>;
|
|
581
|
+
/**
|
|
582
|
+
* Get financial analysis for a dropshipper order (Admin only).
|
|
583
|
+
*
|
|
584
|
+
* `GET /admin/thor/dropshipper/admin/orders/:id/financial-analysis`
|
|
585
|
+
*/
|
|
586
|
+
getOrderFinancialAnalysis(orderId: string): Promise<GetFinancialAnalysisResponse>;
|
|
587
|
+
/**
|
|
588
|
+
* Register a partial or full payment for an order.
|
|
589
|
+
*
|
|
590
|
+
* `POST /admin/thor/dropshipper/orders/:id/payment`
|
|
591
|
+
*/
|
|
592
|
+
registerOrderPayment(orderId: string, body: RegisterPaymentBody): Promise<RegisterPaymentResponse>;
|
|
505
593
|
/**
|
|
506
594
|
* List Y's promotions (discount codes).
|
|
507
595
|
*
|
package/dist/index.js
CHANGED
|
@@ -424,6 +424,20 @@ var DropshipperClient = class {
|
|
|
424
424
|
return response.json();
|
|
425
425
|
}
|
|
426
426
|
// -------------------------------------------------------------------------
|
|
427
|
+
// Capabilities
|
|
428
|
+
// -------------------------------------------------------------------------
|
|
429
|
+
/**
|
|
430
|
+
* Fetch dashboard capabilities from the backend.
|
|
431
|
+
*
|
|
432
|
+
* `GET /admin/thor/dropshipper/capabilities`
|
|
433
|
+
*/
|
|
434
|
+
async getCapabilities() {
|
|
435
|
+
return this.request(
|
|
436
|
+
"GET",
|
|
437
|
+
"/admin/thor/dropshipper/capabilities"
|
|
438
|
+
);
|
|
439
|
+
}
|
|
440
|
+
// -------------------------------------------------------------------------
|
|
427
441
|
// Onboarding (Solo X)
|
|
428
442
|
// -------------------------------------------------------------------------
|
|
429
443
|
/**
|
|
@@ -590,7 +604,9 @@ var DropshipperClient = class {
|
|
|
590
604
|
async getOrderShippingOptions(params) {
|
|
591
605
|
const qs = new URLSearchParams({
|
|
592
606
|
currency_code: params.currency_code.toLowerCase(),
|
|
593
|
-
...params.country_code ? { country_code: params.country_code.toLowerCase() } : {}
|
|
607
|
+
...params.country_code ? { country_code: params.country_code.toLowerCase() } : {},
|
|
608
|
+
...params.province ? { province: params.province } : {},
|
|
609
|
+
...params.city ? { city: params.city } : {}
|
|
594
610
|
});
|
|
595
611
|
return this.request(
|
|
596
612
|
"GET",
|
|
@@ -762,8 +778,6 @@ var DropshipperClient = class {
|
|
|
762
778
|
/**
|
|
763
779
|
* Delete a custom category.
|
|
764
780
|
*
|
|
765
|
-
* Pass `{ force: true }` to cascade-delete child categories.
|
|
766
|
-
*
|
|
767
781
|
* `DELETE /admin/thor/dropshipper/categories/:id`
|
|
768
782
|
*/
|
|
769
783
|
async deleteCategory(categoryId, options = {}) {
|
|
@@ -793,7 +807,7 @@ var DropshipperClient = class {
|
|
|
793
807
|
async createCategoryMapping(body) {
|
|
794
808
|
return this.request(
|
|
795
809
|
"POST",
|
|
796
|
-
|
|
810
|
+
`/admin/thor/dropshipper/category-mappings`,
|
|
797
811
|
body
|
|
798
812
|
);
|
|
799
813
|
}
|
|
@@ -974,6 +988,36 @@ var DropshipperClient = class {
|
|
|
974
988
|
`/admin/thor/dropshipper/settlements/${settlementId}`
|
|
975
989
|
);
|
|
976
990
|
}
|
|
991
|
+
/**
|
|
992
|
+
* Consolidated financial balance for the authenticated dropshipper.
|
|
993
|
+
*
|
|
994
|
+
* `GET /admin/thor/dropshipper/account/balance`
|
|
995
|
+
*/
|
|
996
|
+
async getAccountBalance() {
|
|
997
|
+
return this.request(
|
|
998
|
+
"GET",
|
|
999
|
+
"/admin/thor/dropshipper/account/balance"
|
|
1000
|
+
);
|
|
1001
|
+
}
|
|
1002
|
+
/**
|
|
1003
|
+
* Unified financial order list for the authenticated dropshipper.
|
|
1004
|
+
*
|
|
1005
|
+
* `GET /admin/thor/dropshipper/account/orders`
|
|
1006
|
+
*/
|
|
1007
|
+
async getAccountOrders(options = {}) {
|
|
1008
|
+
const { tab, status, limit = 20, offset = 0, q } = options;
|
|
1009
|
+
const qs = new URLSearchParams({
|
|
1010
|
+
limit: String(limit),
|
|
1011
|
+
offset: String(offset),
|
|
1012
|
+
...tab ? { tab } : {},
|
|
1013
|
+
...status ? { status } : {},
|
|
1014
|
+
...q ? { q } : {}
|
|
1015
|
+
});
|
|
1016
|
+
return this.request(
|
|
1017
|
+
"GET",
|
|
1018
|
+
`/admin/thor/dropshipper/account/orders?${qs}`
|
|
1019
|
+
);
|
|
1020
|
+
}
|
|
977
1021
|
// -------------------------------------------------------------------------
|
|
978
1022
|
// Admin Settlements (Solo X)
|
|
979
1023
|
// -------------------------------------------------------------------------
|
|
@@ -1083,6 +1127,168 @@ var DropshipperClient = class {
|
|
|
1083
1127
|
);
|
|
1084
1128
|
}
|
|
1085
1129
|
// -------------------------------------------------------------------------
|
|
1130
|
+
// Financial Endpoints — Group A (Admin X)
|
|
1131
|
+
// -------------------------------------------------------------------------
|
|
1132
|
+
/**
|
|
1133
|
+
* List orders with financial detail for a dropshipper account (Admin only).
|
|
1134
|
+
*
|
|
1135
|
+
* `GET /admin/thor/dropshipper/admin/accounts/:id/orders`
|
|
1136
|
+
*/
|
|
1137
|
+
async getAdminAccountOrders(accountId, options = {}) {
|
|
1138
|
+
const { tab, status, limit = 20, offset = 0, q } = options;
|
|
1139
|
+
const qs = new URLSearchParams({
|
|
1140
|
+
limit: String(limit),
|
|
1141
|
+
offset: String(offset),
|
|
1142
|
+
...tab ? { tab } : {},
|
|
1143
|
+
...status ? { status } : {},
|
|
1144
|
+
...q ? { q } : {}
|
|
1145
|
+
});
|
|
1146
|
+
return this.request(
|
|
1147
|
+
"GET",
|
|
1148
|
+
`/admin/thor/dropshipper/admin/accounts/${accountId}/orders?${qs}`
|
|
1149
|
+
);
|
|
1150
|
+
}
|
|
1151
|
+
/**
|
|
1152
|
+
* List financial movements for a dropshipper account (Admin only).
|
|
1153
|
+
*
|
|
1154
|
+
* `GET /admin/thor/dropshipper/admin/accounts/:id/settlements`
|
|
1155
|
+
*/
|
|
1156
|
+
async getAdminAccountSettlements(accountId, options = {}) {
|
|
1157
|
+
const { type, status, limit = 20, offset = 0 } = options;
|
|
1158
|
+
const qs = new URLSearchParams({
|
|
1159
|
+
limit: String(limit),
|
|
1160
|
+
offset: String(offset),
|
|
1161
|
+
...type ? { type } : {},
|
|
1162
|
+
...status ? { status } : {}
|
|
1163
|
+
});
|
|
1164
|
+
return this.request(
|
|
1165
|
+
"GET",
|
|
1166
|
+
`/admin/thor/dropshipper/admin/accounts/${accountId}/settlements?${qs}`
|
|
1167
|
+
);
|
|
1168
|
+
}
|
|
1169
|
+
/**
|
|
1170
|
+
* Manually resolve a guarantee on an order (Admin only).
|
|
1171
|
+
*
|
|
1172
|
+
* `POST /admin/thor/dropshipper/admin/accounts/:id/guarantee/:order_id`
|
|
1173
|
+
*/
|
|
1174
|
+
async resolveGuarantee(accountId, orderId, body) {
|
|
1175
|
+
return this.request(
|
|
1176
|
+
"POST",
|
|
1177
|
+
`/admin/thor/dropshipper/admin/accounts/${accountId}/guarantee/${orderId}`,
|
|
1178
|
+
body
|
|
1179
|
+
);
|
|
1180
|
+
}
|
|
1181
|
+
/**
|
|
1182
|
+
* Create an internal compensation (netting) between DS and Thor debts (Admin only).
|
|
1183
|
+
*
|
|
1184
|
+
* `POST /admin/thor/dropshipper/admin/accounts/:id/settlements/compensacion`
|
|
1185
|
+
*/
|
|
1186
|
+
async createCompensacion(accountId, body) {
|
|
1187
|
+
return this.request(
|
|
1188
|
+
"POST",
|
|
1189
|
+
`/admin/thor/dropshipper/admin/accounts/${accountId}/settlements/compensacion`,
|
|
1190
|
+
body
|
|
1191
|
+
);
|
|
1192
|
+
}
|
|
1193
|
+
/**
|
|
1194
|
+
* Create a financial adjustment (Admin only).
|
|
1195
|
+
*
|
|
1196
|
+
* `POST /admin/thor/dropshipper/admin/accounts/:id/settlements/ajuste`
|
|
1197
|
+
*/
|
|
1198
|
+
async createAjuste(accountId, body) {
|
|
1199
|
+
return this.request(
|
|
1200
|
+
"POST",
|
|
1201
|
+
`/admin/thor/dropshipper/admin/accounts/${accountId}/settlements/ajuste`,
|
|
1202
|
+
body
|
|
1203
|
+
);
|
|
1204
|
+
}
|
|
1205
|
+
// -------------------------------------------------------------------------
|
|
1206
|
+
// Financial Endpoints — Group B (Admin X)
|
|
1207
|
+
// -------------------------------------------------------------------------
|
|
1208
|
+
/**
|
|
1209
|
+
* Register a cobro — DS pays Thor the product cost (Admin only).
|
|
1210
|
+
*
|
|
1211
|
+
* `POST /admin/thor/dropshipper/admin/accounts/:id/settlements/cobro`
|
|
1212
|
+
*/
|
|
1213
|
+
async createCobro(accountId, body) {
|
|
1214
|
+
return this.request(
|
|
1215
|
+
"POST",
|
|
1216
|
+
`/admin/thor/dropshipper/admin/accounts/${accountId}/settlements/cobro`,
|
|
1217
|
+
body
|
|
1218
|
+
);
|
|
1219
|
+
}
|
|
1220
|
+
/**
|
|
1221
|
+
* Register a pago — Thor pays the dropshipper their commission (Admin only).
|
|
1222
|
+
*
|
|
1223
|
+
* `POST /admin/thor/dropshipper/admin/accounts/:id/settlements/pago`
|
|
1224
|
+
*/
|
|
1225
|
+
async createPago(accountId, body) {
|
|
1226
|
+
return this.request(
|
|
1227
|
+
"POST",
|
|
1228
|
+
`/admin/thor/dropshipper/admin/accounts/${accountId}/settlements/pago`,
|
|
1229
|
+
body
|
|
1230
|
+
);
|
|
1231
|
+
}
|
|
1232
|
+
/**
|
|
1233
|
+
* Reverse a confirmed financial movement (Admin only).
|
|
1234
|
+
*
|
|
1235
|
+
* `POST /admin/thor/dropshipper/admin/accounts/:id/settlements/:mov_id/reverso`
|
|
1236
|
+
*/
|
|
1237
|
+
async reverseSettlement(accountId, movementId, body) {
|
|
1238
|
+
return this.request(
|
|
1239
|
+
"POST",
|
|
1240
|
+
`/admin/thor/dropshipper/admin/accounts/${accountId}/settlements/${movementId}/reverso`,
|
|
1241
|
+
body
|
|
1242
|
+
);
|
|
1243
|
+
}
|
|
1244
|
+
/**
|
|
1245
|
+
* Confirm a pending financial movement (Admin only).
|
|
1246
|
+
*
|
|
1247
|
+
* `POST /admin/thor/dropshipper/admin/accounts/:id/settlements/:mov_id/confirm`
|
|
1248
|
+
*/
|
|
1249
|
+
async confirmSettlementMovement(accountId, movementId, body = {}) {
|
|
1250
|
+
return this.request(
|
|
1251
|
+
"POST",
|
|
1252
|
+
`/admin/thor/dropshipper/admin/accounts/${accountId}/settlements/${movementId}/confirm`,
|
|
1253
|
+
body
|
|
1254
|
+
);
|
|
1255
|
+
}
|
|
1256
|
+
/**
|
|
1257
|
+
* Cancel a pending financial movement draft (Admin only).
|
|
1258
|
+
*
|
|
1259
|
+
* `POST /admin/thor/dropshipper/admin/accounts/:id/settlements/:mov_id/cancel`
|
|
1260
|
+
*/
|
|
1261
|
+
async cancelSettlementMovement(accountId, movementId, body) {
|
|
1262
|
+
return this.request(
|
|
1263
|
+
"POST",
|
|
1264
|
+
`/admin/thor/dropshipper/admin/accounts/${accountId}/settlements/${movementId}/cancel`,
|
|
1265
|
+
body
|
|
1266
|
+
);
|
|
1267
|
+
}
|
|
1268
|
+
/**
|
|
1269
|
+
* Get financial analysis for a dropshipper order (Admin only).
|
|
1270
|
+
*
|
|
1271
|
+
* `GET /admin/thor/dropshipper/admin/orders/:id/financial-analysis`
|
|
1272
|
+
*/
|
|
1273
|
+
async getOrderFinancialAnalysis(orderId) {
|
|
1274
|
+
return this.request(
|
|
1275
|
+
"GET",
|
|
1276
|
+
`/admin/thor/dropshipper/admin/orders/${orderId}/financial-analysis`
|
|
1277
|
+
);
|
|
1278
|
+
}
|
|
1279
|
+
/**
|
|
1280
|
+
* Register a partial or full payment for an order.
|
|
1281
|
+
*
|
|
1282
|
+
* `POST /admin/thor/dropshipper/orders/:id/payment`
|
|
1283
|
+
*/
|
|
1284
|
+
async registerOrderPayment(orderId, body) {
|
|
1285
|
+
return this.request(
|
|
1286
|
+
"POST",
|
|
1287
|
+
`/admin/thor/dropshipper/orders/${orderId}/payment`,
|
|
1288
|
+
body
|
|
1289
|
+
);
|
|
1290
|
+
}
|
|
1291
|
+
// -------------------------------------------------------------------------
|
|
1086
1292
|
// Promotions (Solo Y)
|
|
1087
1293
|
// -------------------------------------------------------------------------
|
|
1088
1294
|
/**
|