@thorprovider/types 3.7.0 → 3.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/index.d.mts +463 -4
- package/dist/index.d.ts +463 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/admin/DropshippingAdmin.ts +629 -0
- package/src/index.ts +35 -5
|
@@ -313,6 +313,10 @@ export interface DropshipperShippingOption {
|
|
|
313
313
|
export interface GetDropshipperShippingOptionsParams {
|
|
314
314
|
currency_code: string;
|
|
315
315
|
country_code?: string;
|
|
316
|
+
/** Province/state code for granular geo‑zone filtering */
|
|
317
|
+
province?: string;
|
|
318
|
+
/** City for granular geo‑zone filtering */
|
|
319
|
+
city?: string;
|
|
316
320
|
}
|
|
317
321
|
|
|
318
322
|
/** Response for `GET /admin/thor/dropshipper/orders/shipping-options` */
|
|
@@ -1133,3 +1137,628 @@ export interface GetDropshipperAddressesResponse {
|
|
|
1133
1137
|
export interface GetStorefrontDropshipperCategoriesResponse {
|
|
1134
1138
|
categories: DropshipperCategory[];
|
|
1135
1139
|
}
|
|
1140
|
+
|
|
1141
|
+
// ============================================================
|
|
1142
|
+
// Financial Endpoints — Group A (Endpoints 1-7)
|
|
1143
|
+
// ============================================================
|
|
1144
|
+
|
|
1145
|
+
/** Settlement status values for orders */
|
|
1146
|
+
export type SettlementStatus =
|
|
1147
|
+
| 'pending'
|
|
1148
|
+
| 'partial'
|
|
1149
|
+
| 'settled'
|
|
1150
|
+
| 'guaranteed'
|
|
1151
|
+
| 'refund_pending'
|
|
1152
|
+
| 'compensated'
|
|
1153
|
+
| 'recovery_pending'
|
|
1154
|
+
| 'en_garantia'
|
|
1155
|
+
| 'refunded';
|
|
1156
|
+
|
|
1157
|
+
/** Financial movement types */
|
|
1158
|
+
export type FinancialMovementType =
|
|
1159
|
+
| 'cobro'
|
|
1160
|
+
| 'pago'
|
|
1161
|
+
| 'ajuste'
|
|
1162
|
+
| 'compensacion'
|
|
1163
|
+
| 'devolucion'
|
|
1164
|
+
| 'reverso'
|
|
1165
|
+
| 'garantia';
|
|
1166
|
+
|
|
1167
|
+
/** Financial movement statuses */
|
|
1168
|
+
export type FinancialMovementStatus =
|
|
1169
|
+
| 'pendiente'
|
|
1170
|
+
| 'confirmado'
|
|
1171
|
+
| 'revertido'
|
|
1172
|
+
| 'anulado';
|
|
1173
|
+
|
|
1174
|
+
/** Impact direction of a financial movement */
|
|
1175
|
+
export type Impact =
|
|
1176
|
+
| 'ds_debe_mas'
|
|
1177
|
+
| 'ds_debe_menos'
|
|
1178
|
+
| 'thor_debe_mas'
|
|
1179
|
+
| 'thor_debe_menos'
|
|
1180
|
+
| 'neutro';
|
|
1181
|
+
|
|
1182
|
+
/** Ajuste subtype values */
|
|
1183
|
+
export type AjusteSubtype =
|
|
1184
|
+
| 'bonificacion_comercial'
|
|
1185
|
+
| 'penalizacion_general'
|
|
1186
|
+
| 'credito_manual'
|
|
1187
|
+
| 'debito_manual'
|
|
1188
|
+
| 'correccion_saldo_inicial'
|
|
1189
|
+
| 'error_migracion'
|
|
1190
|
+
| 'compensacion_administrativa'
|
|
1191
|
+
| 'aumento_comision'
|
|
1192
|
+
| 'disminucion_comision'
|
|
1193
|
+
| 'aumento_costo'
|
|
1194
|
+
| 'disminucion_costo'
|
|
1195
|
+
| 'diferencia_precio'
|
|
1196
|
+
| 'penalizacion_orden'
|
|
1197
|
+
| 'descuento_orden'
|
|
1198
|
+
| 'ajuste_garantia'
|
|
1199
|
+
| 'ajuste_devolucion'
|
|
1200
|
+
| 'otro';
|
|
1201
|
+
|
|
1202
|
+
/** Balance snapshot used in before/after projections */
|
|
1203
|
+
export interface BalanceSnapshot {
|
|
1204
|
+
ds_debe: number;
|
|
1205
|
+
thor_debe: number;
|
|
1206
|
+
retenidos_total: number;
|
|
1207
|
+
retenidos_thor: number;
|
|
1208
|
+
retenidos_ds: number;
|
|
1209
|
+
balance_neto: number;
|
|
1210
|
+
}
|
|
1211
|
+
|
|
1212
|
+
/** An order applied to a financial movement */
|
|
1213
|
+
export interface OrderAppliedEntry {
|
|
1214
|
+
order_id: string;
|
|
1215
|
+
amount_applied: number;
|
|
1216
|
+
display_id?: number | null;
|
|
1217
|
+
}
|
|
1218
|
+
|
|
1219
|
+
/** An account adjustment paid within a financial movement */
|
|
1220
|
+
export interface AccountAdjustmentPaidEntry {
|
|
1221
|
+
adjustment_id: string;
|
|
1222
|
+
amount_applied: number;
|
|
1223
|
+
side?: 'ds' | 'thor';
|
|
1224
|
+
}
|
|
1225
|
+
|
|
1226
|
+
/** A full financial movement record */
|
|
1227
|
+
export interface FinancialMovement {
|
|
1228
|
+
id: string;
|
|
1229
|
+
reference: string;
|
|
1230
|
+
type: FinancialMovementType;
|
|
1231
|
+
subtype: string | null;
|
|
1232
|
+
amount: number;
|
|
1233
|
+
currency_code: string;
|
|
1234
|
+
impact: Impact;
|
|
1235
|
+
status: FinancialMovementStatus;
|
|
1236
|
+
payment_method: string | null;
|
|
1237
|
+
payment_reference: string | null;
|
|
1238
|
+
orders_applied: OrderAppliedEntry[];
|
|
1239
|
+
orders_applied_count: number;
|
|
1240
|
+
account_adjustments_paid: AccountAdjustmentPaidEntry[];
|
|
1241
|
+
adjustment_paid_amount: number;
|
|
1242
|
+
adjustment_payment_status: string | null;
|
|
1243
|
+
balance_before: BalanceSnapshot | null;
|
|
1244
|
+
balance_after: BalanceSnapshot | null;
|
|
1245
|
+
reason: string;
|
|
1246
|
+
note: string | null;
|
|
1247
|
+
created_by_admin_name: string;
|
|
1248
|
+
confirmed_by_admin_name: string | null;
|
|
1249
|
+
confirmed_at: string | null;
|
|
1250
|
+
created_at: string;
|
|
1251
|
+
}
|
|
1252
|
+
|
|
1253
|
+
/** An order entry in a compensation request */
|
|
1254
|
+
export interface CompensacionOrderEntry {
|
|
1255
|
+
order_id: string;
|
|
1256
|
+
amount_to_compensate: number;
|
|
1257
|
+
}
|
|
1258
|
+
|
|
1259
|
+
/** An adjustment entry in a compensation request */
|
|
1260
|
+
export interface CompensacionAdjustmentEntry {
|
|
1261
|
+
adjustment_id: string;
|
|
1262
|
+
amount_to_compensate: number;
|
|
1263
|
+
}
|
|
1264
|
+
|
|
1265
|
+
// ------------------------------------------------------------
|
|
1266
|
+
// 1. GET /admin/thor/dropshipper/account/balance
|
|
1267
|
+
// ------------------------------------------------------------
|
|
1268
|
+
|
|
1269
|
+
/** Balance breakdown for the authenticated dropshipper */
|
|
1270
|
+
export interface DropshipperAccountBalance {
|
|
1271
|
+
ds_debe: number;
|
|
1272
|
+
ds_debe_orders_count: number;
|
|
1273
|
+
thor_debe: number;
|
|
1274
|
+
thor_debe_orders_count: number;
|
|
1275
|
+
retenidos_total: number;
|
|
1276
|
+
retenidos_thor: number;
|
|
1277
|
+
retenidos_ds: number;
|
|
1278
|
+
retenidos_orders_count: number;
|
|
1279
|
+
balance_neto: number;
|
|
1280
|
+
balance_direction: 'ds_debe' | 'thor_debe' | 'equilibrado';
|
|
1281
|
+
currency_code: string;
|
|
1282
|
+
}
|
|
1283
|
+
|
|
1284
|
+
/** Response for `GET /admin/thor/dropshipper/account/balance` */
|
|
1285
|
+
export interface GetDropshipperAccountBalanceResponse {
|
|
1286
|
+
balance: DropshipperAccountBalance;
|
|
1287
|
+
account: {
|
|
1288
|
+
id: string;
|
|
1289
|
+
provider_name: string;
|
|
1290
|
+
payment_terms_days: number;
|
|
1291
|
+
};
|
|
1292
|
+
}
|
|
1293
|
+
|
|
1294
|
+
// ------------------------------------------------------------
|
|
1295
|
+
// 2. GET /admin/thor/dropshipper/account/orders
|
|
1296
|
+
// ------------------------------------------------------------
|
|
1297
|
+
|
|
1298
|
+
/** A financial order row in the dropshipper's own view */
|
|
1299
|
+
export interface DropshipperFinancialOrder {
|
|
1300
|
+
id: string;
|
|
1301
|
+
display_id: number;
|
|
1302
|
+
created_at: string;
|
|
1303
|
+
customer_name: string | null;
|
|
1304
|
+
quien_cobro: 'dropshipper' | 'provider' | null;
|
|
1305
|
+
sale_total: number;
|
|
1306
|
+
cost_total: number;
|
|
1307
|
+
commission: number;
|
|
1308
|
+
base_amount: number;
|
|
1309
|
+
settled_amount: number;
|
|
1310
|
+
pending_amount: number;
|
|
1311
|
+
settlement_status: SettlementStatus;
|
|
1312
|
+
retained_by: string | null;
|
|
1313
|
+
due_date: string;
|
|
1314
|
+
days_overdue: number;
|
|
1315
|
+
is_overdue: boolean;
|
|
1316
|
+
currency_code: string;
|
|
1317
|
+
}
|
|
1318
|
+
|
|
1319
|
+
/** Options for `GET /admin/thor/dropshipper/account/orders` */
|
|
1320
|
+
export interface GetDropshipperAccountOrdersOptions {
|
|
1321
|
+
tab?: 'all' | 'thor_cobro' | 'ds_cobro' | 'garantias';
|
|
1322
|
+
status?: SettlementStatus;
|
|
1323
|
+
limit?: number;
|
|
1324
|
+
offset?: number;
|
|
1325
|
+
q?: string;
|
|
1326
|
+
}
|
|
1327
|
+
|
|
1328
|
+
/** Response for `GET /admin/thor/dropshipper/account/orders` */
|
|
1329
|
+
export interface GetDropshipperAccountOrdersResponse {
|
|
1330
|
+
orders: DropshipperFinancialOrder[];
|
|
1331
|
+
count: number;
|
|
1332
|
+
offset: number;
|
|
1333
|
+
limit: number;
|
|
1334
|
+
}
|
|
1335
|
+
|
|
1336
|
+
// ------------------------------------------------------------
|
|
1337
|
+
// 3. GET /admin/thor/dropshipper/admin/accounts/:id/orders
|
|
1338
|
+
// ------------------------------------------------------------
|
|
1339
|
+
|
|
1340
|
+
/** A financial order row in the admin view (extends dropshipper view) */
|
|
1341
|
+
export interface AdminDropshipperFinancialOrder extends DropshipperFinancialOrder {
|
|
1342
|
+
adjustment_applied_amount: number;
|
|
1343
|
+
recovery_type: string | null;
|
|
1344
|
+
recovery_amount: number;
|
|
1345
|
+
}
|
|
1346
|
+
|
|
1347
|
+
/** Response for `GET /admin/thor/dropshipper/admin/accounts/:id/orders` */
|
|
1348
|
+
export interface GetAdminDropshipperAccountOrdersResponse {
|
|
1349
|
+
orders: AdminDropshipperFinancialOrder[];
|
|
1350
|
+
count: number;
|
|
1351
|
+
offset: number;
|
|
1352
|
+
limit: number;
|
|
1353
|
+
}
|
|
1354
|
+
|
|
1355
|
+
// ------------------------------------------------------------
|
|
1356
|
+
// 4. GET /admin/thor/dropshipper/admin/accounts/:id/settlements
|
|
1357
|
+
// ------------------------------------------------------------
|
|
1358
|
+
|
|
1359
|
+
/** Options for `GET /admin/thor/dropshipper/admin/accounts/:id/settlements` */
|
|
1360
|
+
export interface GetAdminDropshipperAccountSettlementsOptions {
|
|
1361
|
+
type?: FinancialMovementType;
|
|
1362
|
+
status?: FinancialMovementStatus;
|
|
1363
|
+
limit?: number;
|
|
1364
|
+
offset?: number;
|
|
1365
|
+
}
|
|
1366
|
+
|
|
1367
|
+
/** Response for `GET /admin/thor/dropshipper/admin/accounts/:id/settlements` */
|
|
1368
|
+
export interface GetAdminDropshipperAccountSettlementsResponse {
|
|
1369
|
+
settlements: FinancialMovement[];
|
|
1370
|
+
count: number;
|
|
1371
|
+
offset: number;
|
|
1372
|
+
limit: number;
|
|
1373
|
+
}
|
|
1374
|
+
|
|
1375
|
+
// ------------------------------------------------------------
|
|
1376
|
+
// 5. POST /admin/thor/dropshipper/admin/accounts/:id/guarantee/:order_id
|
|
1377
|
+
// ------------------------------------------------------------
|
|
1378
|
+
|
|
1379
|
+
/** Body for `POST /admin/thor/dropshipper/admin/accounts/:id/guarantee/:order_id` */
|
|
1380
|
+
export interface ResolveGuaranteeBody {
|
|
1381
|
+
resolution: 'close' | 'close_with_refund';
|
|
1382
|
+
amount?: number;
|
|
1383
|
+
reason: string;
|
|
1384
|
+
note?: string;
|
|
1385
|
+
}
|
|
1386
|
+
|
|
1387
|
+
/** Response for `POST /admin/thor/dropshipper/admin/accounts/:id/guarantee/:order_id` */
|
|
1388
|
+
export interface ResolveGuaranteeResponse {
|
|
1389
|
+
order_id: string;
|
|
1390
|
+
status: SettlementStatus;
|
|
1391
|
+
resolution: 'close' | 'close_with_refund';
|
|
1392
|
+
financial_movement?: {
|
|
1393
|
+
reference: string;
|
|
1394
|
+
amount: number;
|
|
1395
|
+
impact: Impact;
|
|
1396
|
+
type: FinancialMovementType;
|
|
1397
|
+
};
|
|
1398
|
+
message: string;
|
|
1399
|
+
}
|
|
1400
|
+
|
|
1401
|
+
// ------------------------------------------------------------
|
|
1402
|
+
// 6. POST /admin/thor/dropshipper/admin/accounts/:id/settlements/compensacion
|
|
1403
|
+
// ------------------------------------------------------------
|
|
1404
|
+
|
|
1405
|
+
/** Body for `POST /admin/thor/dropshipper/admin/accounts/:id/settlements/compensacion` */
|
|
1406
|
+
export interface CreateCompensacionBody {
|
|
1407
|
+
ds_orders: CompensacionOrderEntry[];
|
|
1408
|
+
thor_orders: CompensacionOrderEntry[];
|
|
1409
|
+
ds_adjustments?: CompensacionAdjustmentEntry[];
|
|
1410
|
+
thor_adjustments?: CompensacionAdjustmentEntry[];
|
|
1411
|
+
reason: string;
|
|
1412
|
+
note?: string;
|
|
1413
|
+
}
|
|
1414
|
+
|
|
1415
|
+
/** Compensation preview in the response */
|
|
1416
|
+
export interface CompensacionPreview {
|
|
1417
|
+
before: BalanceSnapshot;
|
|
1418
|
+
after: BalanceSnapshot;
|
|
1419
|
+
total_ds: number;
|
|
1420
|
+
total_thor: number;
|
|
1421
|
+
monto_compensar: number;
|
|
1422
|
+
compensation_type: 'total' | 'parcial';
|
|
1423
|
+
}
|
|
1424
|
+
|
|
1425
|
+
/** Response for `POST /admin/thor/dropshipper/admin/accounts/:id/settlements/compensacion` */
|
|
1426
|
+
export interface CreateCompensacionResponse {
|
|
1427
|
+
movement: {
|
|
1428
|
+
id: string;
|
|
1429
|
+
reference: string;
|
|
1430
|
+
type: 'compensacion';
|
|
1431
|
+
amount: number;
|
|
1432
|
+
currency_code: string;
|
|
1433
|
+
status: FinancialMovementStatus;
|
|
1434
|
+
orders_applied: OrderAppliedEntry[];
|
|
1435
|
+
reason: string;
|
|
1436
|
+
created_at: string;
|
|
1437
|
+
};
|
|
1438
|
+
preview: CompensacionPreview;
|
|
1439
|
+
}
|
|
1440
|
+
|
|
1441
|
+
// ------------------------------------------------------------
|
|
1442
|
+
// 7. POST /admin/thor/dropshipper/admin/accounts/:id/settlements/ajuste
|
|
1443
|
+
// ------------------------------------------------------------
|
|
1444
|
+
|
|
1445
|
+
/** Body for `POST /admin/thor/dropshipper/admin/accounts/:id/settlements/ajuste` */
|
|
1446
|
+
export interface CreateAjusteBody {
|
|
1447
|
+
subtype: AjusteSubtype;
|
|
1448
|
+
impact: Impact;
|
|
1449
|
+
amount: number;
|
|
1450
|
+
reason: string;
|
|
1451
|
+
note?: string;
|
|
1452
|
+
evidence?: string[];
|
|
1453
|
+
order_id?: string;
|
|
1454
|
+
}
|
|
1455
|
+
|
|
1456
|
+
/** Response for `POST /admin/thor/dropshipper/admin/accounts/:id/settlements/ajuste` */
|
|
1457
|
+
export interface CreateAjusteResponse {
|
|
1458
|
+
movement: {
|
|
1459
|
+
id: string;
|
|
1460
|
+
reference: string;
|
|
1461
|
+
type: 'ajuste';
|
|
1462
|
+
subtype: AjusteSubtype;
|
|
1463
|
+
impact: Impact;
|
|
1464
|
+
amount: number;
|
|
1465
|
+
currency_code: string;
|
|
1466
|
+
status: FinancialMovementStatus;
|
|
1467
|
+
order_id: string | null;
|
|
1468
|
+
reason: string;
|
|
1469
|
+
created_at: string;
|
|
1470
|
+
};
|
|
1471
|
+
balance_before: BalanceSnapshot;
|
|
1472
|
+
balance_after_projected: BalanceSnapshot;
|
|
1473
|
+
}
|
|
1474
|
+
|
|
1475
|
+
// ============================================================
|
|
1476
|
+
// Financial Endpoints — Group B (Endpoints 8-14)
|
|
1477
|
+
// ============================================================
|
|
1478
|
+
|
|
1479
|
+
/** Payment method for cobro/pago movements */
|
|
1480
|
+
export type PaymentMethod =
|
|
1481
|
+
| 'transferencia'
|
|
1482
|
+
| 'stripe'
|
|
1483
|
+
| 'cheque'
|
|
1484
|
+
| 'efectivo'
|
|
1485
|
+
| 'otro';
|
|
1486
|
+
|
|
1487
|
+
// ------------------------------------------------------------
|
|
1488
|
+
// 8. POST /admin/thor/dropshipper/admin/accounts/:id/settlements/cobro
|
|
1489
|
+
// ------------------------------------------------------------
|
|
1490
|
+
|
|
1491
|
+
/** Body for `POST /admin/thor/dropshipper/admin/accounts/:id/settlements/cobro` */
|
|
1492
|
+
export interface CreateCobroBody {
|
|
1493
|
+
orders_applied: OrderAppliedEntry[];
|
|
1494
|
+
account_adjustments_paid?: AccountAdjustmentPaidEntry[];
|
|
1495
|
+
payment_method: PaymentMethod;
|
|
1496
|
+
payment_reference: string;
|
|
1497
|
+
reason: string;
|
|
1498
|
+
note?: string;
|
|
1499
|
+
evidence?: string[];
|
|
1500
|
+
}
|
|
1501
|
+
|
|
1502
|
+
/** Response for `POST /admin/thor/dropshipper/admin/accounts/:id/settlements/cobro` */
|
|
1503
|
+
export interface CreateCobroResponse {
|
|
1504
|
+
movement: FinancialMovement;
|
|
1505
|
+
balance_before: BalanceSnapshot;
|
|
1506
|
+
balance_after_projected: BalanceSnapshot;
|
|
1507
|
+
}
|
|
1508
|
+
|
|
1509
|
+
// ------------------------------------------------------------
|
|
1510
|
+
// 9. POST /admin/thor/dropshipper/admin/accounts/:id/settlements/pago
|
|
1511
|
+
// ------------------------------------------------------------
|
|
1512
|
+
|
|
1513
|
+
/** Body for `POST /admin/thor/dropshipper/admin/accounts/:id/settlements/pago` */
|
|
1514
|
+
export interface CreatePagoBody {
|
|
1515
|
+
orders_applied: OrderAppliedEntry[];
|
|
1516
|
+
account_adjustments_paid?: AccountAdjustmentPaidEntry[];
|
|
1517
|
+
payment_method: PaymentMethod;
|
|
1518
|
+
payment_reference: string;
|
|
1519
|
+
reason: string;
|
|
1520
|
+
note?: string;
|
|
1521
|
+
evidence?: string[];
|
|
1522
|
+
}
|
|
1523
|
+
|
|
1524
|
+
/** Response for `POST /admin/thor/dropshipper/admin/accounts/:id/settlements/pago` */
|
|
1525
|
+
export interface CreatePagoResponse {
|
|
1526
|
+
movement: FinancialMovement;
|
|
1527
|
+
balance_before: BalanceSnapshot;
|
|
1528
|
+
balance_after_projected: BalanceSnapshot;
|
|
1529
|
+
}
|
|
1530
|
+
|
|
1531
|
+
// ------------------------------------------------------------
|
|
1532
|
+
// 10. POST /admin/thor/dropshipper/admin/accounts/:id/settlements/:mov_id/reverso
|
|
1533
|
+
// ------------------------------------------------------------
|
|
1534
|
+
|
|
1535
|
+
/** Body for `POST /admin/thor/dropshipper/admin/accounts/:id/settlements/:mov_id/reverso` */
|
|
1536
|
+
export interface CreateReversoBody {
|
|
1537
|
+
reversion_reason: string;
|
|
1538
|
+
note?: string;
|
|
1539
|
+
}
|
|
1540
|
+
|
|
1541
|
+
/** Reversal movement summary */
|
|
1542
|
+
export interface ReversoMovementSummary {
|
|
1543
|
+
id: string;
|
|
1544
|
+
reference: string;
|
|
1545
|
+
type: 'reverso';
|
|
1546
|
+
impact: Impact;
|
|
1547
|
+
amount: number;
|
|
1548
|
+
status: 'confirmado';
|
|
1549
|
+
reverts_movement_id: string;
|
|
1550
|
+
confirmed_at: string;
|
|
1551
|
+
}
|
|
1552
|
+
|
|
1553
|
+
/** Original movement summary after reversal */
|
|
1554
|
+
export interface OriginalMovementSummary {
|
|
1555
|
+
id: string;
|
|
1556
|
+
reference: string;
|
|
1557
|
+
type: FinancialMovementType;
|
|
1558
|
+
status: 'revertido';
|
|
1559
|
+
reverted_at: string;
|
|
1560
|
+
}
|
|
1561
|
+
|
|
1562
|
+
/** Response for `POST /admin/thor/dropshipper/admin/accounts/:id/settlements/:mov_id/reverso` */
|
|
1563
|
+
export interface CreateReversoResponse {
|
|
1564
|
+
reverso: ReversoMovementSummary;
|
|
1565
|
+
original: OriginalMovementSummary;
|
|
1566
|
+
balance_before: BalanceSnapshot;
|
|
1567
|
+
balance_after: BalanceSnapshot;
|
|
1568
|
+
}
|
|
1569
|
+
|
|
1570
|
+
// ------------------------------------------------------------
|
|
1571
|
+
// 11. POST /admin/thor/dropshipper/admin/accounts/:id/settlements/:mov_id/confirm
|
|
1572
|
+
// ------------------------------------------------------------
|
|
1573
|
+
|
|
1574
|
+
/** Body for `POST /admin/thor/dropshipper/admin/accounts/:id/settlements/:mov_id/confirm` */
|
|
1575
|
+
export interface ConfirmMovementBody {
|
|
1576
|
+
note?: string;
|
|
1577
|
+
}
|
|
1578
|
+
|
|
1579
|
+
/** Confirmed movement summary */
|
|
1580
|
+
export interface ConfirmedMovementSummary {
|
|
1581
|
+
id: string;
|
|
1582
|
+
reference: string;
|
|
1583
|
+
type: FinancialMovementType;
|
|
1584
|
+
status: 'confirmado';
|
|
1585
|
+
confirmed_at: string;
|
|
1586
|
+
}
|
|
1587
|
+
|
|
1588
|
+
/** Response for `POST /admin/thor/dropshipper/admin/accounts/:id/settlements/:mov_id/confirm` */
|
|
1589
|
+
export interface ConfirmMovementResponse {
|
|
1590
|
+
movement: ConfirmedMovementSummary;
|
|
1591
|
+
balance_before: BalanceSnapshot;
|
|
1592
|
+
balance_after: BalanceSnapshot;
|
|
1593
|
+
}
|
|
1594
|
+
|
|
1595
|
+
// ------------------------------------------------------------
|
|
1596
|
+
// 12. POST /admin/thor/dropshipper/admin/accounts/:id/settlements/:mov_id/cancel
|
|
1597
|
+
// ------------------------------------------------------------
|
|
1598
|
+
|
|
1599
|
+
/** Body for `POST /admin/thor/dropshipper/admin/accounts/:id/settlements/:mov_id/cancel` */
|
|
1600
|
+
export interface CancelMovementBody {
|
|
1601
|
+
reason: string;
|
|
1602
|
+
}
|
|
1603
|
+
|
|
1604
|
+
/** Cancelled movement summary */
|
|
1605
|
+
export interface CancelledMovementSummary {
|
|
1606
|
+
id: string;
|
|
1607
|
+
reference: string;
|
|
1608
|
+
type: FinancialMovementType;
|
|
1609
|
+
status: 'anulado';
|
|
1610
|
+
reason: string;
|
|
1611
|
+
}
|
|
1612
|
+
|
|
1613
|
+
/** Response for `POST /admin/thor/dropshipper/admin/accounts/:id/settlements/:mov_id/cancel` */
|
|
1614
|
+
export interface CancelMovementResponse {
|
|
1615
|
+
movement: CancelledMovementSummary;
|
|
1616
|
+
}
|
|
1617
|
+
|
|
1618
|
+
// ------------------------------------------------------------
|
|
1619
|
+
// 13. GET /admin/thor/dropshipper/admin/orders/:id/financial-analysis
|
|
1620
|
+
// ------------------------------------------------------------
|
|
1621
|
+
|
|
1622
|
+
/** A single item in the financial analysis breakdown */
|
|
1623
|
+
export interface FinancialAnalysisItem {
|
|
1624
|
+
id: string;
|
|
1625
|
+
product_title: string;
|
|
1626
|
+
variant_title: string;
|
|
1627
|
+
variant_id: string;
|
|
1628
|
+
sku: string | null;
|
|
1629
|
+
quantity: number;
|
|
1630
|
+
sale_price: number;
|
|
1631
|
+
cost_thor: number;
|
|
1632
|
+
commission: number;
|
|
1633
|
+
margin: number;
|
|
1634
|
+
margin_percent: number;
|
|
1635
|
+
expected_cost_thor: number;
|
|
1636
|
+
current_cost_thor: number;
|
|
1637
|
+
expected_commission: number;
|
|
1638
|
+
current_commission: number;
|
|
1639
|
+
difference: number;
|
|
1640
|
+
validation: string;
|
|
1641
|
+
}
|
|
1642
|
+
|
|
1643
|
+
/** A settlement movement applied to an order in financial analysis */
|
|
1644
|
+
export interface FinancialAnalysisSettlementMovement {
|
|
1645
|
+
movement_id: string;
|
|
1646
|
+
reference: string;
|
|
1647
|
+
type: FinancialMovementType;
|
|
1648
|
+
impact: Impact;
|
|
1649
|
+
amount_applied: number;
|
|
1650
|
+
confirmed_at: string | null;
|
|
1651
|
+
confirmed_by: string | null;
|
|
1652
|
+
}
|
|
1653
|
+
|
|
1654
|
+
/** Settlement details within financial analysis */
|
|
1655
|
+
export interface FinancialAnalysisSettlementDetails {
|
|
1656
|
+
settled_amount: number;
|
|
1657
|
+
adjustment_applied_amount: number;
|
|
1658
|
+
base_amount: number;
|
|
1659
|
+
effective_settled: number;
|
|
1660
|
+
movements: FinancialAnalysisSettlementMovement[];
|
|
1661
|
+
}
|
|
1662
|
+
|
|
1663
|
+
/** Financial summary for an order */
|
|
1664
|
+
export interface FinancialAnalysisSummary {
|
|
1665
|
+
ds_owes_to_thor: number;
|
|
1666
|
+
thor_owes_to_ds: number;
|
|
1667
|
+
total_sale: number;
|
|
1668
|
+
total_cost_thor: number;
|
|
1669
|
+
total_commission_ds: number;
|
|
1670
|
+
total_margin: number;
|
|
1671
|
+
total_margin_percent: number;
|
|
1672
|
+
}
|
|
1673
|
+
|
|
1674
|
+
/** Dropshipper info within financial analysis */
|
|
1675
|
+
export interface FinancialAnalysisDropshipper {
|
|
1676
|
+
account_id: string;
|
|
1677
|
+
name: string;
|
|
1678
|
+
payment_terms_days: number;
|
|
1679
|
+
}
|
|
1680
|
+
|
|
1681
|
+
/** Full financial analysis for a single order */
|
|
1682
|
+
export interface FinancialAnalysis {
|
|
1683
|
+
order_id: string;
|
|
1684
|
+
display_id: number;
|
|
1685
|
+
currency_code: string;
|
|
1686
|
+
dropshipper: FinancialAnalysisDropshipper;
|
|
1687
|
+
payment_collected_by: string | null;
|
|
1688
|
+
settlement_status: SettlementStatus;
|
|
1689
|
+
settlement_id: null;
|
|
1690
|
+
summary: FinancialAnalysisSummary;
|
|
1691
|
+
items: FinancialAnalysisItem[];
|
|
1692
|
+
items_with_issues: number;
|
|
1693
|
+
items_total: number;
|
|
1694
|
+
settlement_details: FinancialAnalysisSettlementDetails;
|
|
1695
|
+
}
|
|
1696
|
+
|
|
1697
|
+
/** Response for `GET /admin/thor/dropshipper/admin/orders/:id/financial-analysis` */
|
|
1698
|
+
export interface GetFinancialAnalysisResponse {
|
|
1699
|
+
financial_analysis: FinancialAnalysis;
|
|
1700
|
+
}
|
|
1701
|
+
|
|
1702
|
+
// ------------------------------------------------------------
|
|
1703
|
+
// 14. POST /admin/thor/dropshipper/orders/:id/payment
|
|
1704
|
+
// ------------------------------------------------------------
|
|
1705
|
+
|
|
1706
|
+
/** Body for `POST /admin/thor/dropshipper/orders/:id/payment` */
|
|
1707
|
+
export interface RegisterPaymentBody {
|
|
1708
|
+
paid_amount: number;
|
|
1709
|
+
due_date?: string;
|
|
1710
|
+
payment_provider_id?: string;
|
|
1711
|
+
force_collector?: boolean;
|
|
1712
|
+
}
|
|
1713
|
+
|
|
1714
|
+
/** Payment record in the register payment response */
|
|
1715
|
+
export interface RegisterPaymentRecord {
|
|
1716
|
+
id: string;
|
|
1717
|
+
amount: number;
|
|
1718
|
+
provider_id: string;
|
|
1719
|
+
status: string;
|
|
1720
|
+
created_at: string;
|
|
1721
|
+
}
|
|
1722
|
+
|
|
1723
|
+
/** Response for `POST /admin/thor/dropshipper/orders/:id/payment` */
|
|
1724
|
+
export interface RegisterPaymentResponse {
|
|
1725
|
+
order_id: string;
|
|
1726
|
+
payment: RegisterPaymentRecord;
|
|
1727
|
+
paid_amount_total: number;
|
|
1728
|
+
remaining: number;
|
|
1729
|
+
payment_status: string;
|
|
1730
|
+
payment_collected_by: string | null;
|
|
1731
|
+
due_date: string | null;
|
|
1732
|
+
}
|
|
1733
|
+
|
|
1734
|
+
// ============================================================
|
|
1735
|
+
// Dashboard Capabilities
|
|
1736
|
+
// ============================================================
|
|
1737
|
+
|
|
1738
|
+
/**
|
|
1739
|
+
* Flat boolean map telling the dropshipper dashboard which features
|
|
1740
|
+
* the backend currently supports. Consumed via
|
|
1741
|
+
* `GET /admin/thor/dropshipper/capabilities`.
|
|
1742
|
+
*/
|
|
1743
|
+
export interface DropshipperDashboardCapabilities {
|
|
1744
|
+
/** Core navigation — always expected to be true */
|
|
1745
|
+
dashboard: boolean;
|
|
1746
|
+
orders: boolean;
|
|
1747
|
+
products: boolean;
|
|
1748
|
+
prices: boolean;
|
|
1749
|
+
customers: boolean;
|
|
1750
|
+
configuration: boolean;
|
|
1751
|
+
|
|
1752
|
+
/** Feature modules (may be disabled per-tenant or in development) */
|
|
1753
|
+
financialSettlements: boolean;
|
|
1754
|
+
promotions: boolean;
|
|
1755
|
+
shipping: boolean;
|
|
1756
|
+
reports: boolean;
|
|
1757
|
+
|
|
1758
|
+
/** Settings sub-pages (may be disabled per-tenant or in development) */
|
|
1759
|
+
paymentSettings: boolean;
|
|
1760
|
+
notifications: boolean;
|
|
1761
|
+
security: boolean;
|
|
1762
|
+
integrations: boolean;
|
|
1763
|
+
team: boolean;
|
|
1764
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -377,11 +377,41 @@ export type {
|
|
|
377
377
|
AddOrderEditItemBody,
|
|
378
378
|
AddOrderEditItemResponse,
|
|
379
379
|
ConfirmOrderEditResponse,
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
380
|
+
// Dropshipper addresses (channel-scoped)
|
|
381
|
+
DropshipperAddressBody,
|
|
382
|
+
DropshipperAddressResponse,
|
|
383
|
+
GetDropshipperAddressesResponse,
|
|
384
|
+
// Financial Endpoints — Group A
|
|
385
|
+
SettlementStatus,
|
|
386
|
+
GetDropshipperAccountBalanceResponse,
|
|
387
|
+
GetDropshipperAccountOrdersOptions,
|
|
388
|
+
GetDropshipperAccountOrdersResponse,
|
|
389
|
+
GetAdminDropshipperAccountOrdersResponse,
|
|
390
|
+
GetAdminDropshipperAccountSettlementsOptions,
|
|
391
|
+
GetAdminDropshipperAccountSettlementsResponse,
|
|
392
|
+
ResolveGuaranteeBody,
|
|
393
|
+
ResolveGuaranteeResponse,
|
|
394
|
+
CreateCompensacionBody,
|
|
395
|
+
CreateCompensacionResponse,
|
|
396
|
+
CreateAjusteBody,
|
|
397
|
+
CreateAjusteResponse,
|
|
398
|
+
// Financial Endpoints — Group B
|
|
399
|
+
CreateCobroBody,
|
|
400
|
+
CreateCobroResponse,
|
|
401
|
+
CreatePagoBody,
|
|
402
|
+
CreatePagoResponse,
|
|
403
|
+
CreateReversoBody,
|
|
404
|
+
CreateReversoResponse,
|
|
405
|
+
ConfirmMovementBody,
|
|
406
|
+
ConfirmMovementResponse,
|
|
407
|
+
CancelMovementBody,
|
|
408
|
+
CancelMovementResponse,
|
|
409
|
+
GetFinancialAnalysisResponse,
|
|
410
|
+
RegisterPaymentBody,
|
|
411
|
+
RegisterPaymentResponse,
|
|
412
|
+
// Dashboard Capabilities
|
|
413
|
+
DropshipperDashboardCapabilities,
|
|
414
|
+
} from './admin';
|
|
385
415
|
|
|
386
416
|
// ============================================
|
|
387
417
|
// Header Configuration Types
|