@porulle/adapter-tax-manual 0.63.0 → 0.65.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.ts.map +1 -1
- package/dist/index.js +2 -1
- package/package.json +4 -4
- package/src/index.ts +2 -1
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAM,KAAK,UAAU,EAA6B,MAAM,eAAe,CAAC;AAE/E,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAM,KAAK,UAAU,EAA6B,MAAM,eAAe,CAAC;AAE/E,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAWD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,uBAAuB,GAAG,UAAU,CAqB7E"}
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Ok } from "@porulle/core";
|
|
2
2
|
function taxableSubtotal(params, shippingTaxable) {
|
|
3
3
|
const lineTaxable = params.lineItems.reduce((sum, lineItem) => sum + lineItem.unitPrice * lineItem.quantity - (lineItem.discount ?? 0), 0);
|
|
4
|
-
return lineTaxable
|
|
4
|
+
return Math.max(0, lineTaxable - (params.orderDiscount ?? 0)) +
|
|
5
|
+
(shippingTaxable ? params.shippingAmount : 0);
|
|
5
6
|
}
|
|
6
7
|
export function manualTaxAdapter(options) {
|
|
7
8
|
const rate = Math.max(0, options.rate);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@porulle/adapter-tax-manual",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.65.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -11,15 +11,15 @@
|
|
|
11
11
|
}
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@porulle/core": "0.
|
|
14
|
+
"@porulle/core": "0.65.0"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"@types/node": "^24.5.2",
|
|
18
18
|
"eslint": "^9.39.1",
|
|
19
19
|
"typescript": "5.9.2",
|
|
20
20
|
"vitest": "^3.2.4",
|
|
21
|
-
"@porulle/
|
|
22
|
-
"@porulle/
|
|
21
|
+
"@porulle/typescript-config": "0.1.0",
|
|
22
|
+
"@porulle/eslint-config": "0.1.0"
|
|
23
23
|
},
|
|
24
24
|
"publishConfig": {
|
|
25
25
|
"access": "public"
|
package/src/index.ts
CHANGED
|
@@ -10,7 +10,8 @@ function taxableSubtotal(params: TaxCalculationParams, shippingTaxable: boolean)
|
|
|
10
10
|
(sum, lineItem) => sum + lineItem.unitPrice * lineItem.quantity - (lineItem.discount ?? 0),
|
|
11
11
|
0,
|
|
12
12
|
);
|
|
13
|
-
return lineTaxable
|
|
13
|
+
return Math.max(0, lineTaxable - (params.orderDiscount ?? 0)) +
|
|
14
|
+
(shippingTaxable ? params.shippingAmount : 0);
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
export function manualTaxAdapter(options: ManualTaxAdapterOptions): TaxAdapter {
|