@mercurjs/core 2.2.0-canary.17 → 2.2.0-canary.19
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/.medusa/server/src/api/admin/commission-rates/query-config.js +6 -4
- package/.medusa/server/src/api/admin/commission-rates/validators.d.ts +49 -22
- package/.medusa/server/src/api/admin/commission-rates/validators.js +11 -8
- package/.medusa/server/src/api/admin/orders/[id]/commission-lines/route.d.ts +7 -0
- package/.medusa/server/src/api/admin/orders/[id]/commission-lines/route.js +17 -0
- package/.medusa/server/src/api/admin/sellers/validators.d.ts +6 -7
- package/.medusa/server/src/api/admin/sellers/validators.js +3 -4
- package/.medusa/server/src/api/utils/order-commission-lines.d.ts +18 -0
- package/.medusa/server/src/api/utils/order-commission-lines.js +78 -0
- package/.medusa/server/src/api/vendor/customer-groups/[id]/customers/route.d.ts +4 -0
- package/.medusa/server/src/api/vendor/customer-groups/[id]/customers/route.js +20 -0
- package/.medusa/server/src/api/vendor/customer-groups/[id]/route.d.ts +6 -0
- package/.medusa/server/src/api/vendor/customer-groups/[id]/route.js +43 -0
- package/.medusa/server/src/api/vendor/customer-groups/helpers.d.ts +3 -0
- package/.medusa/server/src/api/vendor/customer-groups/helpers.js +38 -0
- package/.medusa/server/src/api/vendor/customer-groups/middlewares.d.ts +2 -0
- package/.medusa/server/src/api/vendor/customer-groups/middlewares.js +62 -0
- package/.medusa/server/src/api/vendor/customer-groups/query-config.d.ts +11 -0
- package/.medusa/server/src/api/vendor/customer-groups/query-config.js +22 -0
- package/.medusa/server/src/api/vendor/customer-groups/route.d.ts +5 -0
- package/.medusa/server/src/api/vendor/customer-groups/route.js +35 -0
- package/.medusa/server/src/api/vendor/customer-groups/validators.d.ts +157 -0
- package/.medusa/server/src/api/vendor/customer-groups/validators.js +35 -0
- package/.medusa/server/src/api/vendor/customers/[id]/customer-groups/route.d.ts +4 -0
- package/.medusa/server/src/api/vendor/customers/[id]/customer-groups/route.js +28 -0
- package/.medusa/server/src/api/vendor/customers/[id]/route.js +15 -1
- package/.medusa/server/src/api/vendor/customers/middlewares.js +9 -1
- package/.medusa/server/src/api/vendor/customers/validators.d.ts +14 -0
- package/.medusa/server/src/api/vendor/customers/validators.js +9 -2
- package/.medusa/server/src/api/vendor/middlewares.js +69 -67
- package/.medusa/server/src/api/vendor/orders/[id]/commission-lines/route.d.ts +7 -0
- package/.medusa/server/src/api/vendor/orders/[id]/commission-lines/route.js +18 -0
- package/.medusa/server/src/api/vendor/sellers/route.js +9 -2
- package/.medusa/server/src/api/vendor/sellers/validators.d.ts +3 -3
- package/.medusa/server/src/api/vendor/sellers/validators.js +5 -2
- package/.medusa/server/src/links/seller-customer-group-link.js +10 -0
- package/.medusa/server/src/migration-scripts/drop-fulfillment-global-unique-indexes.js +6 -1
- package/.medusa/server/src/modules/commission/index.d.ts +14 -0
- package/.medusa/server/src/modules/commission/index.js +3 -1
- package/.medusa/server/src/modules/commission/loaders/seed-default-commission-rate.d.ts +11 -0
- package/.medusa/server/src/modules/commission/loaders/seed-default-commission-rate.js +35 -0
- package/.medusa/server/src/modules/commission/migrations/Migration20260615120000.d.ts +5 -0
- package/.medusa/server/src/modules/commission/migrations/Migration20260615120000.js +46 -0
- package/.medusa/server/src/modules/commission/models/commission-line.d.ts +2 -1
- package/.medusa/server/src/modules/commission/models/commission-line.js +3 -2
- package/.medusa/server/src/modules/commission/models/commission-rate-value.d.ts +25 -0
- package/.medusa/server/src/modules/commission/models/commission-rate-value.js +17 -0
- package/.medusa/server/src/modules/commission/models/commission-rate.d.ts +9 -4
- package/.medusa/server/src/modules/commission/models/commission-rate.js +9 -6
- package/.medusa/server/src/modules/commission/models/commission-rule.d.ts +8 -3
- package/.medusa/server/src/modules/commission/models/index.d.ts +1 -0
- package/.medusa/server/src/modules/commission/models/index.js +4 -2
- package/.medusa/server/src/modules/commission/service.d.ts +74 -9
- package/.medusa/server/src/modules/commission/service.js +147 -114
- package/.medusa/server/src/modules/seller/migrations/Migration20260616120000.d.ts +5 -0
- package/.medusa/server/src/modules/seller/migrations/Migration20260616120000.js +16 -0
- package/.medusa/server/src/modules/seller/models/address.d.ts +2 -2
- package/.medusa/server/src/modules/seller/models/member-invite.d.ts +2 -2
- package/.medusa/server/src/modules/seller/models/member.d.ts +2 -2
- package/.medusa/server/src/modules/seller/models/payment-details.d.ts +2 -2
- package/.medusa/server/src/modules/seller/models/payment-details.js +3 -3
- package/.medusa/server/src/modules/seller/models/professional-details.d.ts +2 -2
- package/.medusa/server/src/modules/seller/models/seller-member.d.ts +4 -4
- package/.medusa/server/src/modules/seller/models/seller.d.ts +2 -2
- package/.medusa/server/src/modules/seller/service.d.ts +16 -16
- package/.medusa/server/src/subscribers/order-edit-confirmed.d.ts +9 -2
- package/.medusa/server/src/subscribers/order-edit-confirmed.js +18 -6
- package/.medusa/server/src/workflows/commission/steps/create-commission-rates.d.ts +13 -4
- package/.medusa/server/src/workflows/commission/steps/create-commission-rules.d.ts +13 -4
- package/.medusa/server/src/workflows/commission/steps/index.d.ts +1 -0
- package/.medusa/server/src/workflows/commission/steps/index.js +2 -1
- package/.medusa/server/src/workflows/commission/steps/update-commission-rates.d.ts +13 -4
- package/.medusa/server/src/workflows/commission/steps/update-commission-rules.d.ts +13 -4
- package/.medusa/server/src/workflows/commission/steps/upsert-commission-lines.d.ts +6 -2
- package/.medusa/server/src/workflows/commission/steps/upsert-commission-lines.js +5 -1
- package/.medusa/server/src/workflows/commission/steps/validate-commission-rates-deletable.d.ts +5 -0
- package/.medusa/server/src/workflows/commission/steps/validate-commission-rates-deletable.js +22 -0
- package/.medusa/server/src/workflows/commission/workflows/create-commission-rates.d.ts +13 -4
- package/.medusa/server/src/workflows/commission/workflows/delete-commission-rates.js +3 -1
- package/.medusa/server/src/workflows/commission/workflows/refresh-order-commission-lines.js +2 -1
- package/.medusa/server/src/workflows/commission/workflows/update-commission-rates.d.ts +13 -4
- package/.medusa/server/src/workflows/customer-group/index.d.ts +2 -0
- package/.medusa/server/src/workflows/customer-group/index.js +19 -0
- package/.medusa/server/src/workflows/customer-group/steps/index.d.ts +1 -0
- package/.medusa/server/src/workflows/customer-group/steps/index.js +18 -0
- package/.medusa/server/src/workflows/customer-group/steps/link-seller-customer-group.d.ts +6 -0
- package/.medusa/server/src/workflows/customer-group/steps/link-seller-customer-group.js +36 -0
- package/.medusa/server/src/workflows/customer-group/workflows/create-seller-customer-groups.d.ts +7 -0
- package/.medusa/server/src/workflows/customer-group/workflows/create-seller-customer-groups.js +20 -0
- package/.medusa/server/src/workflows/customer-group/workflows/index.d.ts +1 -0
- package/.medusa/server/src/workflows/customer-group/workflows/index.js +18 -0
- package/.medusa/server/src/workflows/index.d.ts +1 -0
- package/.medusa/server/src/workflows/index.js +2 -1
- package/.medusa/server/src/workflows/payout/workflows/create-payout.js +21 -8
- package/.medusa/server/src/workflows/seller/steps/create-seller-member.d.ts +4 -4
- package/.medusa/server/src/workflows/seller/steps/update-member.d.ts +2 -2
- package/.medusa/server/src/workflows/seller/steps/update-seller-member.d.ts +4 -4
- package/.medusa/server/src/workflows/seller/workflows/add-seller-member.d.ts +4 -4
- package/.medusa/server/src/workflows/seller/workflows/update-member.d.ts +2 -2
- package/package.json +1 -1
- package/.medusa/server/src/links/line-item-commission-line-link.js +0 -21
- /package/.medusa/server/src/links/{line-item-commission-line-link.d.ts → seller-customer-group-link.d.ts} +0 -0
|
@@ -42,8 +42,8 @@ declare const SellerAddress: import("@medusajs/framework/utils").DmlEntity<impor
|
|
|
42
42
|
address: import("@medusajs/framework/utils").HasOne<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder</*elided*/ any>, "SellerAddress">>;
|
|
43
43
|
payment_details: import("@medusajs/framework/utils").HasOne<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
|
|
44
44
|
id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
|
|
45
|
-
country_code: import("@medusajs/framework/utils").TextProperty
|
|
46
|
-
holder_name: import("@medusajs/framework/utils").TextProperty
|
|
45
|
+
country_code: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
46
|
+
holder_name: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
47
47
|
bank_name: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
48
48
|
iban: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
49
49
|
bic: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
@@ -50,8 +50,8 @@ declare const MemberInvite: import("@medusajs/framework/utils").DmlEntity<import
|
|
|
50
50
|
}>, "SellerAddress">>;
|
|
51
51
|
payment_details: import("@medusajs/framework/utils").HasOne<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
|
|
52
52
|
id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
|
|
53
|
-
country_code: import("@medusajs/framework/utils").TextProperty
|
|
54
|
-
holder_name: import("@medusajs/framework/utils").TextProperty
|
|
53
|
+
country_code: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
54
|
+
holder_name: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
55
55
|
bank_name: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
56
56
|
iban: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
57
57
|
bic: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
@@ -50,8 +50,8 @@ declare const Member: import("@medusajs/framework/utils").DmlEntity<import("@med
|
|
|
50
50
|
}>, "SellerAddress">>;
|
|
51
51
|
payment_details: import("@medusajs/framework/utils").HasOne<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
|
|
52
52
|
id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
|
|
53
|
-
country_code: import("@medusajs/framework/utils").TextProperty
|
|
54
|
-
holder_name: import("@medusajs/framework/utils").TextProperty
|
|
53
|
+
country_code: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
54
|
+
holder_name: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
55
55
|
bank_name: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
56
56
|
iban: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
57
57
|
bic: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
declare const PaymentDetails: import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
|
|
2
2
|
id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
|
|
3
|
-
country_code: import("@medusajs/framework/utils").TextProperty
|
|
4
|
-
holder_name: import("@medusajs/framework/utils").TextProperty
|
|
3
|
+
country_code: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
4
|
+
holder_name: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
5
5
|
bank_name: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
6
6
|
iban: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
7
7
|
bic: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
@@ -7,8 +7,8 @@ const utils_1 = require("@medusajs/framework/utils");
|
|
|
7
7
|
const seller_1 = __importDefault(require("./seller"));
|
|
8
8
|
const PaymentDetails = utils_1.model.define("PaymentDetails", {
|
|
9
9
|
id: utils_1.model.id({ prefix: "selpaydet" }).primaryKey(),
|
|
10
|
-
country_code: utils_1.model.text(),
|
|
11
|
-
holder_name: utils_1.model.text(),
|
|
10
|
+
country_code: utils_1.model.text().nullable(),
|
|
11
|
+
holder_name: utils_1.model.text().nullable(),
|
|
12
12
|
bank_name: utils_1.model.text().nullable(),
|
|
13
13
|
iban: utils_1.model.text().nullable(),
|
|
14
14
|
bic: utils_1.model.text().nullable(),
|
|
@@ -19,4 +19,4 @@ const PaymentDetails = utils_1.model.define("PaymentDetails", {
|
|
|
19
19
|
}),
|
|
20
20
|
});
|
|
21
21
|
exports.default = PaymentDetails;
|
|
22
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
22
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGF5bWVudC1kZXRhaWxzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vc3JjL21vZHVsZXMvc2VsbGVyL21vZGVscy9wYXltZW50LWRldGFpbHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFBQSxxREFBaUQ7QUFDakQsc0RBQTZCO0FBRTdCLE1BQU0sY0FBYyxHQUFHLGFBQUssQ0FBQyxNQUFNLENBQUMsZ0JBQWdCLEVBQUU7SUFDcEQsRUFBRSxFQUFFLGFBQUssQ0FBQyxFQUFFLENBQUMsRUFBRSxNQUFNLEVBQUUsV0FBVyxFQUFFLENBQUMsQ0FBQyxVQUFVLEVBQUU7SUFDbEQsWUFBWSxFQUFFLGFBQUssQ0FBQyxJQUFJLEVBQUUsQ0FBQyxRQUFRLEVBQUU7SUFDckMsV0FBVyxFQUFFLGFBQUssQ0FBQyxJQUFJLEVBQUUsQ0FBQyxRQUFRLEVBQUU7SUFDcEMsU0FBUyxFQUFFLGFBQUssQ0FBQyxJQUFJLEVBQUUsQ0FBQyxRQUFRLEVBQUU7SUFDbEMsSUFBSSxFQUFFLGFBQUssQ0FBQyxJQUFJLEVBQUUsQ0FBQyxRQUFRLEVBQUU7SUFDN0IsR0FBRyxFQUFFLGFBQUssQ0FBQyxJQUFJLEVBQUUsQ0FBQyxRQUFRLEVBQUU7SUFDNUIsY0FBYyxFQUFFLGFBQUssQ0FBQyxJQUFJLEVBQUUsQ0FBQyxRQUFRLEVBQUU7SUFDdkMsY0FBYyxFQUFFLGFBQUssQ0FBQyxJQUFJLEVBQUUsQ0FBQyxRQUFRLEVBQUU7SUFDdkMsTUFBTSxFQUFFLGFBQUssQ0FBQyxTQUFTLENBQUMsR0FBRyxFQUFFLENBQUMsZ0JBQU0sRUFBRTtRQUNwQyxRQUFRLEVBQUUsaUJBQWlCO0tBQzVCLENBQUM7Q0FDSCxDQUFDLENBQUE7QUFFRixrQkFBZSxjQUFjLENBQUEifQ==
|
|
@@ -42,8 +42,8 @@ declare const ProfessionalDetails: import("@medusajs/framework/utils").DmlEntity
|
|
|
42
42
|
}>, "SellerAddress">>;
|
|
43
43
|
payment_details: import("@medusajs/framework/utils").HasOne<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
|
|
44
44
|
id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
|
|
45
|
-
country_code: import("@medusajs/framework/utils").TextProperty
|
|
46
|
-
holder_name: import("@medusajs/framework/utils").TextProperty
|
|
45
|
+
country_code: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
46
|
+
holder_name: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
47
47
|
bank_name: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
48
48
|
iban: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
49
49
|
bic: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
@@ -45,8 +45,8 @@ declare const SellerMember: import("@medusajs/framework/utils").DmlEntity<import
|
|
|
45
45
|
}>, "SellerAddress">>;
|
|
46
46
|
payment_details: import("@medusajs/framework/utils").HasOne<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
|
|
47
47
|
id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
|
|
48
|
-
country_code: import("@medusajs/framework/utils").TextProperty
|
|
49
|
-
holder_name: import("@medusajs/framework/utils").TextProperty
|
|
48
|
+
country_code: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
49
|
+
holder_name: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
50
50
|
bank_name: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
51
51
|
iban: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
52
52
|
bic: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
@@ -128,8 +128,8 @@ declare const SellerMember: import("@medusajs/framework/utils").DmlEntity<import
|
|
|
128
128
|
}>, "SellerAddress">>;
|
|
129
129
|
payment_details: import("@medusajs/framework/utils").HasOne<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
|
|
130
130
|
id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
|
|
131
|
-
country_code: import("@medusajs/framework/utils").TextProperty
|
|
132
|
-
holder_name: import("@medusajs/framework/utils").TextProperty
|
|
131
|
+
country_code: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
132
|
+
holder_name: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
133
133
|
bank_name: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
134
134
|
iban: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
135
135
|
bic: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
@@ -44,8 +44,8 @@ declare const Seller: import("@medusajs/framework/utils").DmlEntity<import("@med
|
|
|
44
44
|
}>, "SellerAddress">>;
|
|
45
45
|
payment_details: import("@medusajs/framework/utils").HasOne<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
|
|
46
46
|
id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
|
|
47
|
-
country_code: import("@medusajs/framework/utils").TextProperty
|
|
48
|
-
holder_name: import("@medusajs/framework/utils").TextProperty
|
|
47
|
+
country_code: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
48
|
+
holder_name: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
49
49
|
bank_name: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
50
50
|
iban: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
51
51
|
bic: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
@@ -51,8 +51,8 @@ declare const SellerModuleService_base: import("@medusajs/framework/utils").Medu
|
|
|
51
51
|
}>, "SellerAddress">>;
|
|
52
52
|
payment_details: import("@medusajs/framework/utils").HasOne<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
|
|
53
53
|
id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
|
|
54
|
-
country_code: import("@medusajs/framework/utils").TextProperty
|
|
55
|
-
holder_name: import("@medusajs/framework/utils").TextProperty
|
|
54
|
+
country_code: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
55
|
+
holder_name: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
56
56
|
bank_name: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
57
57
|
iban: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
58
58
|
bic: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
@@ -126,8 +126,8 @@ declare const SellerModuleService_base: import("@medusajs/framework/utils").Medu
|
|
|
126
126
|
}>, "SellerAddress">>;
|
|
127
127
|
payment_details: import("@medusajs/framework/utils").HasOne<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
|
|
128
128
|
id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
|
|
129
|
-
country_code: import("@medusajs/framework/utils").TextProperty
|
|
130
|
-
holder_name: import("@medusajs/framework/utils").TextProperty
|
|
129
|
+
country_code: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
130
|
+
holder_name: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
131
131
|
bank_name: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
132
132
|
iban: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
133
133
|
bic: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
@@ -202,8 +202,8 @@ declare const SellerModuleService_base: import("@medusajs/framework/utils").Medu
|
|
|
202
202
|
address: import("@medusajs/framework/utils").HasOne<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder</*elided*/ any>, "SellerAddress">>;
|
|
203
203
|
payment_details: import("@medusajs/framework/utils").HasOne<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
|
|
204
204
|
id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
|
|
205
|
-
country_code: import("@medusajs/framework/utils").TextProperty
|
|
206
|
-
holder_name: import("@medusajs/framework/utils").TextProperty
|
|
205
|
+
country_code: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
206
|
+
holder_name: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
207
207
|
bank_name: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
208
208
|
iban: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
209
209
|
bic: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
@@ -236,8 +236,8 @@ declare const SellerModuleService_base: import("@medusajs/framework/utils").Medu
|
|
|
236
236
|
}>, "SellerAddress">;
|
|
237
237
|
readonly PaymentDetails: import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
|
|
238
238
|
id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
|
|
239
|
-
country_code: import("@medusajs/framework/utils").TextProperty
|
|
240
|
-
holder_name: import("@medusajs/framework/utils").TextProperty
|
|
239
|
+
country_code: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
240
|
+
holder_name: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
241
241
|
bank_name: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
242
242
|
iban: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
243
243
|
bic: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
@@ -362,8 +362,8 @@ declare const SellerModuleService_base: import("@medusajs/framework/utils").Medu
|
|
|
362
362
|
}>, "SellerAddress">>;
|
|
363
363
|
payment_details: import("@medusajs/framework/utils").HasOne<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
|
|
364
364
|
id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
|
|
365
|
-
country_code: import("@medusajs/framework/utils").TextProperty
|
|
366
|
-
holder_name: import("@medusajs/framework/utils").TextProperty
|
|
365
|
+
country_code: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
366
|
+
holder_name: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
367
367
|
bank_name: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
368
368
|
iban: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
369
369
|
bic: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
@@ -433,8 +433,8 @@ declare const SellerModuleService_base: import("@medusajs/framework/utils").Medu
|
|
|
433
433
|
}>, "SellerAddress">>;
|
|
434
434
|
payment_details: import("@medusajs/framework/utils").HasOne<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
|
|
435
435
|
id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
|
|
436
|
-
country_code: import("@medusajs/framework/utils").TextProperty
|
|
437
|
-
holder_name: import("@medusajs/framework/utils").TextProperty
|
|
436
|
+
country_code: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
437
|
+
holder_name: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
438
438
|
bank_name: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
439
439
|
iban: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
440
440
|
bic: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
@@ -516,8 +516,8 @@ declare const SellerModuleService_base: import("@medusajs/framework/utils").Medu
|
|
|
516
516
|
}>, "SellerAddress">>;
|
|
517
517
|
payment_details: import("@medusajs/framework/utils").HasOne<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
|
|
518
518
|
id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
|
|
519
|
-
country_code: import("@medusajs/framework/utils").TextProperty
|
|
520
|
-
holder_name: import("@medusajs/framework/utils").TextProperty
|
|
519
|
+
country_code: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
520
|
+
holder_name: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
521
521
|
bank_name: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
522
522
|
iban: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
523
523
|
bic: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
@@ -596,8 +596,8 @@ declare const SellerModuleService_base: import("@medusajs/framework/utils").Medu
|
|
|
596
596
|
}>, "SellerAddress">>;
|
|
597
597
|
payment_details: import("@medusajs/framework/utils").HasOne<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
|
|
598
598
|
id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
|
|
599
|
-
country_code: import("@medusajs/framework/utils").TextProperty
|
|
600
|
-
holder_name: import("@medusajs/framework/utils").TextProperty
|
|
599
|
+
country_code: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
600
|
+
holder_name: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
601
601
|
bank_name: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
602
602
|
iban: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
603
603
|
bic: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { SubscriberArgs, SubscriberConfig } from "@medusajs/framework";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Recompute an order's commission lines whenever its composition changes —
|
|
4
|
+
* order edits, returns, claims, and exchanges — so the seller's commission
|
|
5
|
+
* tracks what the customer actually kept. The refresh is idempotent
|
|
6
|
+
* (delete-then-insert), so re-running on follow-up events is safe.
|
|
7
|
+
*/
|
|
8
|
+
export default function orderCommissionRefreshHandler({ event, container, }: SubscriberArgs<{
|
|
9
|
+
order_id?: string;
|
|
10
|
+
id?: string;
|
|
4
11
|
}>): Promise<void>;
|
|
5
12
|
export declare const config: SubscriberConfig;
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.config = void 0;
|
|
4
|
-
exports.default =
|
|
4
|
+
exports.default = orderCommissionRefreshHandler;
|
|
5
5
|
const utils_1 = require("@medusajs/framework/utils");
|
|
6
6
|
const refresh_order_commission_lines_1 = require("../workflows/commission/workflows/refresh-order-commission-lines");
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Recompute an order's commission lines whenever its composition changes —
|
|
9
|
+
* order edits, returns, claims, and exchanges — so the seller's commission
|
|
10
|
+
* tracks what the customer actually kept. The refresh is idempotent
|
|
11
|
+
* (delete-then-insert), so re-running on follow-up events is safe.
|
|
12
|
+
*/
|
|
13
|
+
async function orderCommissionRefreshHandler({ event, container, }) {
|
|
14
|
+
// Different events surface the order id under different keys.
|
|
15
|
+
const orderId = event.data.order_id ?? event.data.id;
|
|
9
16
|
if (!orderId) {
|
|
10
17
|
return;
|
|
11
18
|
}
|
|
@@ -14,9 +21,14 @@ async function orderEditConfirmedHandler({ event, container, }) {
|
|
|
14
21
|
});
|
|
15
22
|
}
|
|
16
23
|
exports.config = {
|
|
17
|
-
event:
|
|
24
|
+
event: [
|
|
25
|
+
utils_1.OrderEditWorkflowEvents.CONFIRMED,
|
|
26
|
+
utils_1.OrderWorkflowEvents.RETURN_RECEIVED,
|
|
27
|
+
utils_1.OrderWorkflowEvents.CLAIM_CREATED,
|
|
28
|
+
utils_1.OrderWorkflowEvents.EXCHANGE_CREATED,
|
|
29
|
+
],
|
|
18
30
|
context: {
|
|
19
|
-
subscriberId: "order-
|
|
31
|
+
subscriberId: "order-commission-refresh-handler",
|
|
20
32
|
},
|
|
21
33
|
};
|
|
22
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
34
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3JkZXItZWRpdC1jb25maXJtZWQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvc3Vic2NyaWJlcnMvb3JkZXItZWRpdC1jb25maXJtZWQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBY0EsZ0RBY0M7QUE1QkQscURBR2tDO0FBR2xDLHFIQUFzSDtBQUV0SDs7Ozs7R0FLRztBQUNZLEtBQUssVUFBVSw2QkFBNkIsQ0FBQyxFQUMxRCxLQUFLLEVBQ0wsU0FBUyxHQUMwQztJQUNuRCw4REFBOEQ7SUFDOUQsTUFBTSxPQUFPLEdBQUcsS0FBSyxDQUFDLElBQUksQ0FBQyxRQUFRLElBQUksS0FBSyxDQUFDLElBQUksQ0FBQyxFQUFFLENBQUE7SUFFcEQsSUFBSSxDQUFDLE9BQU8sRUFBRSxDQUFDO1FBQ2IsT0FBTTtJQUNSLENBQUM7SUFFRCxNQUFNLElBQUEsb0VBQW1DLEVBQUMsU0FBUyxDQUFDLENBQUMsR0FBRyxDQUFDO1FBQ3ZELEtBQUssRUFBRSxFQUFFLFNBQVMsRUFBRSxDQUFDLE9BQU8sQ0FBQyxFQUFFO0tBQ2hDLENBQUMsQ0FBQTtBQUNKLENBQUM7QUFFWSxRQUFBLE1BQU0sR0FBcUI7SUFDdEMsS0FBSyxFQUFFO1FBQ0wsK0JBQXVCLENBQUMsU0FBUztRQUNqQywyQkFBbUIsQ0FBQyxlQUFlO1FBQ25DLDJCQUFtQixDQUFDLGFBQWE7UUFDakMsMkJBQW1CLENBQUMsZ0JBQWdCO0tBQ3JDO0lBQ0QsT0FBTyxFQUFFO1FBQ1AsWUFBWSxFQUFFLGtDQUFrQztLQUNqRDtDQUNGLENBQUEifQ==
|
|
@@ -3,15 +3,14 @@ export declare const createCommissionRatesStepId = "create-commission-rates-step
|
|
|
3
3
|
export declare const createCommissionRatesStep: import("@medusajs/framework/workflows-sdk").StepFunction<CreateCommissionRateDTO[], {
|
|
4
4
|
id: string;
|
|
5
5
|
is_enabled: boolean;
|
|
6
|
-
|
|
6
|
+
is_default: boolean;
|
|
7
7
|
currency_code: string | null;
|
|
8
8
|
name: string;
|
|
9
9
|
code: string;
|
|
10
10
|
type: import("@mercurjs/types").CommissionRateType;
|
|
11
|
-
target: import("@mercurjs/types").CommissionRateTarget;
|
|
12
11
|
value: number;
|
|
13
|
-
min_amount: number | null;
|
|
14
12
|
include_tax: boolean;
|
|
13
|
+
include_shipping: boolean;
|
|
15
14
|
rules: {
|
|
16
15
|
id: string;
|
|
17
16
|
reference: string;
|
|
@@ -22,8 +21,18 @@ export declare const createCommissionRatesStep: import("@medusajs/framework/work
|
|
|
22
21
|
deleted_at: Date | null;
|
|
23
22
|
commission_rate_id: string;
|
|
24
23
|
}[];
|
|
24
|
+
values: {
|
|
25
|
+
id: string;
|
|
26
|
+
currency_code: string;
|
|
27
|
+
amount: number;
|
|
28
|
+
commission_rate: /*elided*/ any;
|
|
29
|
+
raw_amount: Record<string, unknown>;
|
|
30
|
+
created_at: Date;
|
|
31
|
+
updated_at: Date;
|
|
32
|
+
deleted_at: Date | null;
|
|
33
|
+
commission_rate_id: string;
|
|
34
|
+
}[];
|
|
25
35
|
raw_value: Record<string, unknown>;
|
|
26
|
-
raw_min_amount: Record<string, unknown> | null;
|
|
27
36
|
created_at: Date;
|
|
28
37
|
updated_at: Date;
|
|
29
38
|
deleted_at: Date | null;
|
|
@@ -11,18 +11,27 @@ export declare const createCommissionRulesStep: import("@medusajs/framework/work
|
|
|
11
11
|
commission_rate: {
|
|
12
12
|
id: string;
|
|
13
13
|
is_enabled: boolean;
|
|
14
|
-
|
|
14
|
+
is_default: boolean;
|
|
15
15
|
currency_code: string | null;
|
|
16
16
|
name: string;
|
|
17
17
|
code: string;
|
|
18
18
|
type: import("@mercurjs/types").CommissionRateType;
|
|
19
|
-
target: import("@mercurjs/types").CommissionRateTarget;
|
|
20
19
|
value: number;
|
|
21
|
-
min_amount: number | null;
|
|
22
20
|
include_tax: boolean;
|
|
21
|
+
include_shipping: boolean;
|
|
23
22
|
rules: /*elided*/ any[];
|
|
23
|
+
values: {
|
|
24
|
+
id: string;
|
|
25
|
+
currency_code: string;
|
|
26
|
+
amount: number;
|
|
27
|
+
commission_rate: /*elided*/ any;
|
|
28
|
+
raw_amount: Record<string, unknown>;
|
|
29
|
+
created_at: Date;
|
|
30
|
+
updated_at: Date;
|
|
31
|
+
deleted_at: Date | null;
|
|
32
|
+
commission_rate_id: string;
|
|
33
|
+
}[];
|
|
24
34
|
raw_value: Record<string, unknown>;
|
|
25
|
-
raw_min_amount: Record<string, unknown> | null;
|
|
26
35
|
created_at: Date;
|
|
27
36
|
updated_at: Date;
|
|
28
37
|
deleted_at: Date | null;
|
|
@@ -22,4 +22,5 @@ __exportStar(require("./create-commission-rules"), exports);
|
|
|
22
22
|
__exportStar(require("./update-commission-rules"), exports);
|
|
23
23
|
__exportStar(require("./delete-commission-rules"), exports);
|
|
24
24
|
__exportStar(require("./delete-commission-rates"), exports);
|
|
25
|
-
|
|
25
|
+
__exportStar(require("./validate-commission-rates-deletable"), exports);
|
|
26
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9zcmMvd29ya2Zsb3dzL2NvbW1pc3Npb24vc3RlcHMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7OztBQUFBLHlEQUFzQztBQUN0Qyw0REFBeUM7QUFDekMsNERBQXlDO0FBQ3pDLDREQUF5QztBQUN6Qyw0REFBeUM7QUFDekMsNERBQXlDO0FBQ3pDLDREQUF5QztBQUN6Qyw0REFBeUM7QUFDekMsd0VBQXFEIn0=
|
|
@@ -3,15 +3,14 @@ export declare const updateCommissionRatesStepId = "update-commission-rates-step
|
|
|
3
3
|
export declare const updateCommissionRatesStep: import("@medusajs/framework/workflows-sdk").StepFunction<UpdateCommissionRateDTO[], {
|
|
4
4
|
id: string;
|
|
5
5
|
is_enabled: boolean;
|
|
6
|
-
|
|
6
|
+
is_default: boolean;
|
|
7
7
|
currency_code: string | null;
|
|
8
8
|
name: string;
|
|
9
9
|
code: string;
|
|
10
10
|
type: import("@mercurjs/types").CommissionRateType;
|
|
11
|
-
target: import("@mercurjs/types").CommissionRateTarget;
|
|
12
11
|
value: number;
|
|
13
|
-
min_amount: number | null;
|
|
14
12
|
include_tax: boolean;
|
|
13
|
+
include_shipping: boolean;
|
|
15
14
|
rules: {
|
|
16
15
|
id: string;
|
|
17
16
|
reference: string;
|
|
@@ -22,8 +21,18 @@ export declare const updateCommissionRatesStep: import("@medusajs/framework/work
|
|
|
22
21
|
deleted_at: Date | null;
|
|
23
22
|
commission_rate_id: string;
|
|
24
23
|
}[];
|
|
24
|
+
values: {
|
|
25
|
+
id: string;
|
|
26
|
+
currency_code: string;
|
|
27
|
+
amount: number;
|
|
28
|
+
commission_rate: /*elided*/ any;
|
|
29
|
+
raw_amount: Record<string, unknown>;
|
|
30
|
+
created_at: Date;
|
|
31
|
+
updated_at: Date;
|
|
32
|
+
deleted_at: Date | null;
|
|
33
|
+
commission_rate_id: string;
|
|
34
|
+
}[];
|
|
25
35
|
raw_value: Record<string, unknown>;
|
|
26
|
-
raw_min_amount: Record<string, unknown> | null;
|
|
27
36
|
created_at: Date;
|
|
28
37
|
updated_at: Date;
|
|
29
38
|
deleted_at: Date | null;
|
|
@@ -7,18 +7,27 @@ export declare const updateCommissionRulesStep: import("@medusajs/framework/work
|
|
|
7
7
|
commission_rate: {
|
|
8
8
|
id: string;
|
|
9
9
|
is_enabled: boolean;
|
|
10
|
-
|
|
10
|
+
is_default: boolean;
|
|
11
11
|
currency_code: string | null;
|
|
12
12
|
name: string;
|
|
13
13
|
code: string;
|
|
14
14
|
type: import("@mercurjs/types").CommissionRateType;
|
|
15
|
-
target: import("@mercurjs/types").CommissionRateTarget;
|
|
16
15
|
value: number;
|
|
17
|
-
min_amount: number | null;
|
|
18
16
|
include_tax: boolean;
|
|
17
|
+
include_shipping: boolean;
|
|
19
18
|
rules: /*elided*/ any[];
|
|
19
|
+
values: {
|
|
20
|
+
id: string;
|
|
21
|
+
currency_code: string;
|
|
22
|
+
amount: number;
|
|
23
|
+
commission_rate: /*elided*/ any;
|
|
24
|
+
raw_amount: Record<string, unknown>;
|
|
25
|
+
created_at: Date;
|
|
26
|
+
updated_at: Date;
|
|
27
|
+
deleted_at: Date | null;
|
|
28
|
+
commission_rate_id: string;
|
|
29
|
+
}[];
|
|
20
30
|
raw_value: Record<string, unknown>;
|
|
21
|
-
raw_min_amount: Record<string, unknown> | null;
|
|
22
31
|
created_at: Date;
|
|
23
32
|
updated_at: Date;
|
|
24
33
|
deleted_at: Date | null;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import { CommissionLineDTO, CreateCommissionLineDTO
|
|
1
|
+
import { CommissionLineDTO, CreateCommissionLineDTO } from "@mercurjs/types";
|
|
2
2
|
type UpsertCommissionLinesStepInput = {
|
|
3
|
-
commission_lines:
|
|
3
|
+
commission_lines: CreateCommissionLineDTO[];
|
|
4
4
|
};
|
|
5
5
|
export declare const upsertCommissionLinesStepId = "upsert-commission-lines";
|
|
6
|
+
/**
|
|
7
|
+
* Idempotent refresh: `upsertCommissionLines` replaces lines keyed on their
|
|
8
|
+
* item/shipping anchor, so re-running never accumulates duplicates.
|
|
9
|
+
*/
|
|
6
10
|
export declare const upsertCommissionLinesStep: import("@medusajs/framework/workflows-sdk").StepFunction<UpsertCommissionLinesStepInput, CommissionLineDTO[]>;
|
|
7
11
|
export {};
|
|
@@ -4,9 +4,13 @@ exports.upsertCommissionLinesStep = exports.upsertCommissionLinesStepId = void 0
|
|
|
4
4
|
const workflows_sdk_1 = require("@medusajs/framework/workflows-sdk");
|
|
5
5
|
const types_1 = require("@mercurjs/types");
|
|
6
6
|
exports.upsertCommissionLinesStepId = "upsert-commission-lines";
|
|
7
|
+
/**
|
|
8
|
+
* Idempotent refresh: `upsertCommissionLines` replaces lines keyed on their
|
|
9
|
+
* item/shipping anchor, so re-running never accumulates duplicates.
|
|
10
|
+
*/
|
|
7
11
|
exports.upsertCommissionLinesStep = (0, workflows_sdk_1.createStep)(exports.upsertCommissionLinesStepId, async (input, { container }) => {
|
|
8
12
|
const service = container.resolve(types_1.MercurModules.COMMISSION);
|
|
9
13
|
const commissionLines = await service.upsertCommissionLines(input.commission_lines);
|
|
10
14
|
return new workflows_sdk_1.StepResponse(commissionLines);
|
|
11
15
|
});
|
|
12
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
16
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXBzZXJ0LWNvbW1pc3Npb24tbGluZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9zcmMvd29ya2Zsb3dzL2NvbW1pc3Npb24vc3RlcHMvdXBzZXJ0LWNvbW1pc3Npb24tbGluZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEscUVBQTRFO0FBQzVFLDJDQUl3QjtBQVFYLFFBQUEsMkJBQTJCLEdBQUcseUJBQXlCLENBQUE7QUFFcEU7OztHQUdHO0FBQ1UsUUFBQSx5QkFBeUIsR0FBRyxJQUFBLDBCQUFVLEVBQ2pELG1DQUEyQixFQUMzQixLQUFLLEVBQ0gsS0FBcUMsRUFDckMsRUFBRSxTQUFTLEVBQUUsRUFDK0IsRUFBRTtJQUM5QyxNQUFNLE9BQU8sR0FBRyxTQUFTLENBQUMsT0FBTyxDQUMvQixxQkFBYSxDQUFDLFVBQVUsQ0FDekIsQ0FBQTtJQUVELE1BQU0sZUFBZSxHQUFHLE1BQU0sT0FBTyxDQUFDLHFCQUFxQixDQUN6RCxLQUFLLENBQUMsZ0JBQWdCLENBQ3ZCLENBQUE7SUFFRCxPQUFPLElBQUksNEJBQVksQ0FBQyxlQUFlLENBQUMsQ0FBQTtBQUMxQyxDQUFDLENBQ0YsQ0FBQSJ9
|
package/.medusa/server/src/workflows/commission/steps/validate-commission-rates-deletable.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const validateCommissionRatesDeletableStepId = "validate-commission-rates-deletable-step";
|
|
2
|
+
/**
|
|
3
|
+
* Rejects deletion of the Global Commission (the `is_default` rate).
|
|
4
|
+
*/
|
|
5
|
+
export declare const validateCommissionRatesDeletableStep: import("@medusajs/framework/workflows-sdk").StepFunction<string[], unknown>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateCommissionRatesDeletableStep = exports.validateCommissionRatesDeletableStepId = void 0;
|
|
4
|
+
const workflows_sdk_1 = require("@medusajs/framework/workflows-sdk");
|
|
5
|
+
const utils_1 = require("@medusajs/framework/utils");
|
|
6
|
+
const types_1 = require("@mercurjs/types");
|
|
7
|
+
exports.validateCommissionRatesDeletableStepId = "validate-commission-rates-deletable-step";
|
|
8
|
+
/**
|
|
9
|
+
* Rejects deletion of the Global Commission (the `is_default` rate).
|
|
10
|
+
*/
|
|
11
|
+
exports.validateCommissionRatesDeletableStep = (0, workflows_sdk_1.createStep)(exports.validateCommissionRatesDeletableStepId, async (ids, { container }) => {
|
|
12
|
+
if (!ids?.length) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
const commissionService = container.resolve(types_1.MercurModules.COMMISSION);
|
|
16
|
+
const rates = await commissionService.listCommissionRates({ id: ids });
|
|
17
|
+
const defaultRate = rates.find((rate) => rate.is_default);
|
|
18
|
+
if (defaultRate) {
|
|
19
|
+
throw new utils_1.MedusaError(utils_1.MedusaError.Types.NOT_ALLOWED, "The global (default) commission rate cannot be deleted");
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmFsaWRhdGUtY29tbWlzc2lvbi1yYXRlcy1kZWxldGFibGUuanMiLCJzb3VyY2V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issionRatesWorkflowId = "create-commission-rates"
|
|
|
3
3
|
export declare const createCommissionRatesWorkflow: import("@medusajs/framework/workflows-sdk").ReturnWorkflow<CreateCommissionRateDTO[], {
|
|
4
4
|
id: string;
|
|
5
5
|
is_enabled: boolean;
|
|
6
|
-
|
|
6
|
+
is_default: boolean;
|
|
7
7
|
currency_code: string | null;
|
|
8
8
|
name: string;
|
|
9
9
|
code: string;
|
|
10
10
|
type: import("@mercurjs/types").CommissionRateType;
|
|
11
|
-
target: import("@mercurjs/types").CommissionRateTarget;
|
|
12
11
|
value: number;
|
|
13
|
-
min_amount: number | null;
|
|
14
12
|
include_tax: boolean;
|
|
13
|
+
include_shipping: boolean;
|
|
15
14
|
rules: {
|
|
16
15
|
id: string;
|
|
17
16
|
reference: string;
|
|
@@ -22,8 +21,18 @@ export declare const createCommissionRatesWorkflow: import("@medusajs/framework/
|
|
|
22
21
|
deleted_at: Date | null;
|
|
23
22
|
commission_rate_id: string;
|
|
24
23
|
}[];
|
|
24
|
+
values: {
|
|
25
|
+
id: string;
|
|
26
|
+
currency_code: string;
|
|
27
|
+
amount: number;
|
|
28
|
+
commission_rate: /*elided*/ any;
|
|
29
|
+
raw_amount: Record<string, unknown>;
|
|
30
|
+
created_at: Date;
|
|
31
|
+
updated_at: Date;
|
|
32
|
+
deleted_at: Date | null;
|
|
33
|
+
commission_rate_id: string;
|
|
34
|
+
}[];
|
|
25
35
|
raw_value: Record<string, unknown>;
|
|
26
|
-
raw_min_amount: Record<string, unknown> | null;
|
|
27
36
|
created_at: Date;
|
|
28
37
|
updated_at: Date;
|
|
29
38
|
deleted_at: Date | null;
|
|
@@ -3,8 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.deleteCommissionRatesWorkflow = exports.deleteCommissionRatesWorkflowId = void 0;
|
|
4
4
|
const workflows_sdk_1 = require("@medusajs/framework/workflows-sdk");
|
|
5
5
|
const delete_commission_rates_1 = require("../steps/delete-commission-rates");
|
|
6
|
+
const validate_commission_rates_deletable_1 = require("../steps/validate-commission-rates-deletable");
|
|
6
7
|
exports.deleteCommissionRatesWorkflowId = "delete-commission-rates";
|
|
7
8
|
exports.deleteCommissionRatesWorkflow = (0, workflows_sdk_1.createWorkflow)(exports.deleteCommissionRatesWorkflowId, (input) => {
|
|
9
|
+
(0, validate_commission_rates_deletable_1.validateCommissionRatesDeletableStep)(input.ids);
|
|
8
10
|
const deletedCommissionRates = (0, delete_commission_rates_1.deleteCommissionRatesStep)(input.ids);
|
|
9
11
|
const commissionRatesDeleted = (0, workflows_sdk_1.createHook)("commissionRatesDeleted", {
|
|
10
12
|
ids: input.ids,
|
|
@@ -13,4 +15,4 @@ exports.deleteCommissionRatesWorkflow = (0, workflows_sdk_1.createWorkflow)(expo
|
|
|
13
15
|
hooks: [commissionRatesDeleted],
|
|
14
16
|
});
|
|
15
17
|
});
|
|
16
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
18
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGVsZXRlLWNvbW1pc3Npb24tcmF0ZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9zcmMvd29ya2Zsb3dzL2NvbW1pc3Npb24vd29ya2Zsb3dzL2RlbGV0ZS1jb21taXNzaW9uLXJhdGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLHFFQUswQztBQUUxQyw4RUFBNEU7QUFDNUUsc0dBQW1HO0FBTXRGLFFBQUEsK0JBQStCLEdBQUcseUJBQXlCLENBQUE7QUFFM0QsUUFBQSw2QkFBNkIsR0FBRyxJQUFBLDhCQUFjLEVBQ3pELHVDQUErQixFQUMvQixDQUFDLEtBQXVELEVBQUUsRUFBRTtJQUMxRCxJQUFBLDBFQUFvQyxFQUFDLEtBQUssQ0FBQyxHQUFHLENBQUMsQ0FBQTtJQUUvQyxNQUFNLHNCQUFzQixHQUFHLElBQUEsbURBQXlCLEVBQUMsS0FBSyxDQUFDLEdBQUcsQ0FBQyxDQUFBO0lBRW5FLE1BQU0sc0JBQXNCLEdBQUcsSUFBQSwwQkFBVSxFQUFDLHdCQUF3QixFQUFFO1FBQ2xFLEdBQUcsRUFBRSxLQUFLLENBQUMsR0FBRztLQUNmLENBQUMsQ0FBQTtJQUVGLE9BQU8sSUFBSSxnQ0FBZ0IsQ0FBQyxzQkFBc0IsRUFBRTtRQUNsRCxLQUFLLEVBQUUsQ0FBQyxzQkFBc0IsQ0FBQztLQUNoQyxDQUFDLENBQUE7QUFDSixDQUFDLENBQ0YsQ0FBQSJ9
|
|
@@ -20,6 +20,7 @@ const orderFields = [
|
|
|
20
20
|
"subtotal",
|
|
21
21
|
"items.*",
|
|
22
22
|
"items.subtotal",
|
|
23
|
+
"items.tax_total",
|
|
23
24
|
"items.product.id",
|
|
24
25
|
"items.product.collection_id",
|
|
25
26
|
"items.product.categories.id",
|
|
@@ -78,4 +79,4 @@ exports.refreshOrderCommissionLinesWorkflow = (0, workflows_sdk_1.createWorkflow
|
|
|
78
79
|
});
|
|
79
80
|
return new workflows_sdk_1.WorkflowResponse(upsertedCommissionLines);
|
|
80
81
|
});
|
|
81
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
82
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVmcmVzaC1vcmRlci1jb21taXNzaW9uLWxpbmVzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vc3JjL3dvcmtmbG93cy9jb21taXNzaW9uL3dvcmtmbG93cy9yZWZyZXNoLW9yZGVyLWNvbW1pc3Npb24tbGluZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEscUVBSzBDO0FBQzFDLDREQUErRDtBQUcvRCxvQ0FBNEU7QUFFNUUsTUFBTSxXQUFXLEdBQUc7SUFDbE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