@thorprovider/medusa-extended 1.13.3 → 1.14.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.d.mts +11 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/dropshipper.test.ts +14 -0
- package/src/dropshipper.ts +25 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thorprovider/medusa-extended",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.14.0",
|
|
4
4
|
"description": "Thor Commerce multi-tenant admin extensions for Medusa v2",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@thorprovider/adapters": "^5.0.8",
|
|
28
|
-
"@thorprovider/types": "^5.7.
|
|
28
|
+
"@thorprovider/types": "^5.7.8"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"msw": "^2.12.3",
|
package/src/dropshipper.test.ts
CHANGED
|
@@ -262,6 +262,18 @@ describe('DropshipperClient.getOrder', () => {
|
|
|
262
262
|
totals: { subtotal: 5000, shipping_total: 0, discount_total: 0, total: 5000, cost_total: 2000, profit: 3000, margin_percent: 60 },
|
|
263
263
|
payment_collected_by: 'dropshipper',
|
|
264
264
|
settlement_status: 'unsettled',
|
|
265
|
+
financial_summary: {
|
|
266
|
+
paid_total: 0,
|
|
267
|
+
refunded_total: 0,
|
|
268
|
+
pending_difference: 5000,
|
|
269
|
+
current_order_total: 5000,
|
|
270
|
+
original_order_total: 5000,
|
|
271
|
+
transaction_total: 0,
|
|
272
|
+
accounting_total: 5000,
|
|
273
|
+
credit_line_total: 0,
|
|
274
|
+
effective: { paid_total: 0, pending_difference: 5000 },
|
|
275
|
+
},
|
|
276
|
+
credit_lines: [],
|
|
265
277
|
timeline: [],
|
|
266
278
|
},
|
|
267
279
|
})
|
|
@@ -271,6 +283,8 @@ describe('DropshipperClient.getOrder', () => {
|
|
|
271
283
|
const result = await client().getOrder('ord_1')
|
|
272
284
|
expect(result.order.id).toBe('ord_1')
|
|
273
285
|
expect(result.order.totals.profit).toBe(3000)
|
|
286
|
+
expect(result.order.financial_summary.credit_line_total).toBe(0)
|
|
287
|
+
expect(result.order.credit_lines).toEqual([])
|
|
274
288
|
})
|
|
275
289
|
})
|
|
276
290
|
|
package/src/dropshipper.ts
CHANGED
|
@@ -67,6 +67,9 @@ import type {
|
|
|
67
67
|
ConvertDropshipperDraftOrderBody,
|
|
68
68
|
ConvertDropshipperDraftOrderResponse,
|
|
69
69
|
DeleteDropshipperDraftOrderResponse,
|
|
70
|
+
// Order totals preview
|
|
71
|
+
PreviewDropshipperOrderTotalsBody,
|
|
72
|
+
PreviewDropshipperOrderTotalsResponse,
|
|
70
73
|
// Dropshipper Addresses
|
|
71
74
|
DropshipperAddressBody,
|
|
72
75
|
DropshipperAddressResponse,
|
|
@@ -869,6 +872,28 @@ export class DropshipperClient {
|
|
|
869
872
|
);
|
|
870
873
|
}
|
|
871
874
|
|
|
875
|
+
/**
|
|
876
|
+
* Preview order totals (including taxes) without creating the order.
|
|
877
|
+
*
|
|
878
|
+
* Replicates the creation pipeline (pricing honoring `unit_price`, region,
|
|
879
|
+
* shipping groups) and computes tax lines with the Medusa tax module, so the
|
|
880
|
+
* totals match what the created order will produce.
|
|
881
|
+
*
|
|
882
|
+
* `POST /admin/thor/dropshipper/orders/preview-totals`
|
|
883
|
+
*/
|
|
884
|
+
async previewOrderTotals(
|
|
885
|
+
body: PreviewDropshipperOrderTotalsBody,
|
|
886
|
+
): Promise<PreviewDropshipperOrderTotalsResponse> {
|
|
887
|
+
return this.request<PreviewDropshipperOrderTotalsResponse>(
|
|
888
|
+
'POST',
|
|
889
|
+
'/admin/thor/dropshipper/orders/preview-totals',
|
|
890
|
+
{
|
|
891
|
+
...body,
|
|
892
|
+
currency_code: body.currency_code.toLowerCase(),
|
|
893
|
+
},
|
|
894
|
+
);
|
|
895
|
+
}
|
|
896
|
+
|
|
872
897
|
/**
|
|
873
898
|
* Set who collects payment for an order (Solo X).
|
|
874
899
|
*
|