You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/core/types/src/tax/provider.ts
+43-11Lines changed: 43 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -57,7 +57,7 @@ export type ItemTaxCalculationLine = {
57
57
*
58
58
* ### constructor
59
59
*
60
-
* You can use the `constructor` of your tax provider to access the resources registered in the [Module Container](https://docs.medusajs.com/resources/medusa-container-resources#module-container-resources).
60
+
* You can use the `constructor` of your Tax Module Provider's service to access the resources registered in the [Module Container](https://docs.medusajs.com/resources/medusa-container-resources#module-container-resources).
61
61
*
62
62
* You can also use the constructor to initialize your integration with the third-party provider. For example, if you use a client to connect to the third-party provider’s APIs, you can initialize it in the constructor and use it in other methods in the service.
63
63
*
@@ -66,13 +66,34 @@ export type ItemTaxCalculationLine = {
66
66
* For example:
67
67
*
68
68
* ```ts
69
+
* import {
70
+
* ITaxProvider,
71
+
* Logger
72
+
* } from "@medusajs/framework/types"
73
+
*
74
+
* type InjectedDependencies = {
75
+
* logger: Logger
76
+
* }
77
+
*
78
+
* type Options = {
79
+
* apiKey: string
80
+
* }
81
+
*
69
82
* export default class MyTaxProvider implements ITaxProvider {
70
-
* // ...
71
-
* constructor(container, options) {
72
-
* // you can access options here
83
+
* static identifier = "my-tax"
84
+
* protected logger_: Logger
85
+
* protected options_: Options
86
+
* // assuming you're initializing a client
87
+
* protected client
88
+
*
89
+
* constructor (
90
+
* { logger }: InjectedDependencies,
91
+
* options: Options
92
+
* ) {
93
+
* this.logger_ = logger
94
+
* this.options_ = options
73
95
*
74
-
* // you can also initialize a client that
75
-
* // communicates with a third-party service.
96
+
* // assuming you're initializing a client
76
97
* this.client = new Client(options)
77
98
* }
78
99
* }
@@ -82,7 +103,18 @@ export type ItemTaxCalculationLine = {
82
103
*/
83
104
exportinterfaceITaxProvider{
84
105
/**
85
-
* @ignore
106
+
* This method is used to retrieve the unique identifier of the tax provider.
107
+
*
108
+
* @return {string} The unique identifier of the tax provider.
109
+
*
110
+
* @example
111
+
* export default class MyTaxProvider implements ITaxProvider {
0 commit comments