@medusajs/js-sdk 2.0.1 → 2.0.2-snapshot-20241104135243
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/admin/notification.d.ts +80 -0
- package/dist/admin/notification.d.ts.map +1 -1
- package/dist/admin/notification.js +80 -0
- package/dist/admin/notification.js.map +1 -1
- package/dist/admin/order-edit.d.ts +166 -1
- package/dist/admin/order-edit.d.ts.map +1 -1
- package/dist/admin/order-edit.js +165 -0
- package/dist/admin/order-edit.js.map +1 -1
- package/dist/admin/order.d.ts +248 -22
- package/dist/admin/order.d.ts.map +1 -1
- package/dist/admin/order.js +240 -0
- package/dist/admin/order.js.map +1 -1
- package/dist/admin/payment-collection.d.ts +55 -0
- package/dist/admin/payment-collection.d.ts.map +1 -1
- package/dist/admin/payment-collection.js +55 -0
- package/dist/admin/payment-collection.js.map +1 -1
- package/dist/admin/payment.d.ts +162 -1
- package/dist/admin/payment.d.ts.map +1 -1
- package/dist/admin/payment.js +161 -0
- package/dist/admin/payment.js.map +1 -1
- package/dist/esm/admin/notification.d.ts +80 -0
- package/dist/esm/admin/notification.d.ts.map +1 -1
- package/dist/esm/admin/notification.js +80 -0
- package/dist/esm/admin/notification.js.map +1 -1
- package/dist/esm/admin/order-edit.d.ts +166 -1
- package/dist/esm/admin/order-edit.d.ts.map +1 -1
- package/dist/esm/admin/order-edit.js +165 -0
- package/dist/esm/admin/order-edit.js.map +1 -1
- package/dist/esm/admin/order.d.ts +248 -22
- package/dist/esm/admin/order.d.ts.map +1 -1
- package/dist/esm/admin/order.js +240 -0
- package/dist/esm/admin/order.js.map +1 -1
- package/dist/esm/admin/payment-collection.d.ts +55 -0
- package/dist/esm/admin/payment-collection.d.ts.map +1 -1
- package/dist/esm/admin/payment-collection.js +55 -0
- package/dist/esm/admin/payment-collection.js.map +1 -1
- package/dist/esm/admin/payment.d.ts +162 -1
- package/dist/esm/admin/payment.d.ts.map +1 -1
- package/dist/esm/admin/payment.js +161 -0
- package/dist/esm/admin/payment.js.map +1 -1
- package/package.json +2 -2
@@ -8,6 +8,24 @@ class PaymentCollection {
|
|
8
8
|
constructor(client) {
|
9
9
|
this.client = client;
|
10
10
|
}
|
11
|
+
/**
|
12
|
+
* This method creates a payment collection. It sends a request to the
|
13
|
+
* [Create Payment Collection](https://docs.medusajs.com/api/admin#payment-collections_postpaymentcollections)
|
14
|
+
* API route.
|
15
|
+
*
|
16
|
+
* @param body - The details of the payment collection to create.
|
17
|
+
* @param query - Configure the fields to retrieve in the payment collection.
|
18
|
+
* @param headers - Headers to pass in the request
|
19
|
+
* @returns The payment collection's details.
|
20
|
+
*
|
21
|
+
* @example
|
22
|
+
* sdk.admin.paymentCollection.create({
|
23
|
+
* order_id: "order_123"
|
24
|
+
* })
|
25
|
+
* .then(({ payment_collection }) => {
|
26
|
+
* console.log(payment_collection)
|
27
|
+
* })
|
28
|
+
*/
|
11
29
|
async create(body, query, headers) {
|
12
30
|
return await this.client.fetch(`/admin/payment-collections`, {
|
13
31
|
method: "POST",
|
@@ -16,12 +34,49 @@ class PaymentCollection {
|
|
16
34
|
query,
|
17
35
|
});
|
18
36
|
}
|
37
|
+
/**
|
38
|
+
* This method deletes a payment collection. It sends a request to the
|
39
|
+
* [Delete Payment Collection](https://docs.medusajs.com/api/admin#payment-collections_deletepaymentcollectionsid)
|
40
|
+
* API route.
|
41
|
+
*
|
42
|
+
* @param id - The payment collection's ID.
|
43
|
+
* @param headers - Headers to pass in the request
|
44
|
+
* @returns The deletion's details.
|
45
|
+
*
|
46
|
+
* @example
|
47
|
+
* sdk.admin.paymentCollection.delete("paycol_123")
|
48
|
+
* .then(({ deleted }) => {
|
49
|
+
* console.log(deleted)
|
50
|
+
* })
|
51
|
+
*/
|
19
52
|
async delete(id, headers) {
|
20
53
|
return await this.client.fetch(`/admin/payment-collections/${id}`, {
|
21
54
|
method: "DELETE",
|
22
55
|
headers,
|
23
56
|
});
|
24
57
|
}
|
58
|
+
/**
|
59
|
+
* This method marks a payment collection as paid. It sends a request to the
|
60
|
+
* [Mark as Paid](https://docs.medusajs.com/api/admin#payment-collections_postpaymentcollectionsidmarkaspaid)
|
61
|
+
* API route.
|
62
|
+
*
|
63
|
+
* The API route creates and authorizes a payment session, then capture its payment,
|
64
|
+
* using the manual payment provider.
|
65
|
+
*
|
66
|
+
* @param id - The payment collection to mark as paid.
|
67
|
+
* @param body - The details to mark the payment collection as paid.
|
68
|
+
* @param query - Configure the fields to retrieve in the payment collection.
|
69
|
+
* @param headers - Headers to pass in the request.
|
70
|
+
* @returns The payment collection's details.
|
71
|
+
*
|
72
|
+
* @example
|
73
|
+
* sdk.admin.paymentCollection.markAsPaid("paycol_123", {
|
74
|
+
* order_id: "order_123"
|
75
|
+
* })
|
76
|
+
* .then(({ payment_collection }) => {
|
77
|
+
* console.log(payment_collection)
|
78
|
+
* })
|
79
|
+
*/
|
25
80
|
async markAsPaid(id, body, query, headers) {
|
26
81
|
return await this.client.fetch(`/admin/payment-collections/${id}/mark-as-paid`, {
|
27
82
|
method: "POST",
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"payment-collection.js","sourceRoot":"","sources":["../../src/admin/payment-collection.ts"],"names":[],"mappings":";;;AAIA,MAAa,iBAAiB;IAK5B;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED,KAAK,CAAC,MAAM,CACV,IAA4C,EAC5C,KAAoB,EACpB,OAAuB;QAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,4BAA4B,EAC5B;YACE,MAAM,EAAE,MAAM;YACd,OAAO;YACP,IAAI;YACJ,KAAK;SACN,CACF,CAAA;IACH,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,EAAU,EAAE,OAAuB;QAC9C,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,8BAA8B,EAAE,EAAE,EAClC;YACE,MAAM,EAAE,QAAQ;YAChB,OAAO;SACR,CACF,CAAA;IACH,CAAC;IAED,KAAK,CAAC,UAAU,CACd,EAAU,EACV,IAAgD,EAChD,KAAoB,EACpB,OAAuB;QAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,8BAA8B,EAAE,eAAe,EAC/C;YACE,MAAM,EAAE,MAAM;YACd,OAAO;YACP,IAAI;YACJ,KAAK;SACN,CACF,CAAA;IACH,CAAC;CACF;
|
1
|
+
{"version":3,"file":"payment-collection.js","sourceRoot":"","sources":["../../src/admin/payment-collection.ts"],"names":[],"mappings":";;;AAIA,MAAa,iBAAiB;IAK5B;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,KAAK,CAAC,MAAM,CACV,IAA4C,EAC5C,KAAoB,EACpB,OAAuB;QAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,4BAA4B,EAC5B;YACE,MAAM,EAAE,MAAM;YACd,OAAO;YACP,IAAI;YACJ,KAAK;SACN,CACF,CAAA;IACH,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,KAAK,CAAC,MAAM,CAAC,EAAU,EAAE,OAAuB;QAC9C,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,8BAA8B,EAAE,EAAE,EAClC;YACE,MAAM,EAAE,QAAQ;YAChB,OAAO;SACR,CACF,CAAA;IACH,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,KAAK,CAAC,UAAU,CACd,EAAU,EACV,IAAgD,EAChD,KAAoB,EACpB,OAAuB;QAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,8BAA8B,EAAE,eAAe,EAC/C;YACE,MAAM,EAAE,MAAM;YACd,OAAO;YACP,IAAI;YACJ,KAAK;SACN,CACF,CAAA;IACH,CAAC;CACF;AA7GD,8CA6GC"}
|
package/dist/admin/payment.d.ts
CHANGED
@@ -10,10 +10,171 @@ export declare class Payment {
|
|
10
10
|
* @ignore
|
11
11
|
*/
|
12
12
|
constructor(client: Client);
|
13
|
+
/**
|
14
|
+
* This method retrieves a paginated list of payments. It sends a request to the
|
15
|
+
* [List Payments](https://docs.medusajs.com/api/admin#payments_getpayments) API route.
|
16
|
+
*
|
17
|
+
* @param query - Filters and pagination configurations.
|
18
|
+
* @param headers - Headers to pass in the request.
|
19
|
+
* @returns The paginated list of payments.
|
20
|
+
*
|
21
|
+
* @example
|
22
|
+
* To retrieve the list of payments:
|
23
|
+
*
|
24
|
+
* ```ts
|
25
|
+
* sdk.admin.payment.list()
|
26
|
+
* .then(({ payments, count, limit, offset }) => {
|
27
|
+
* console.log(payments)
|
28
|
+
* })
|
29
|
+
* ```
|
30
|
+
*
|
31
|
+
* To configure the pagination, pass the `limit` and `offset` query parameters.
|
32
|
+
*
|
33
|
+
* For example, to retrieve only 10 items and skip 10 items:
|
34
|
+
*
|
35
|
+
* ```ts
|
36
|
+
* sdk.admin.payment.list({
|
37
|
+
* limit: 10,
|
38
|
+
* offset: 10
|
39
|
+
* })
|
40
|
+
* .then(({ payments, count, limit, offset }) => {
|
41
|
+
* console.log(payments)
|
42
|
+
* })
|
43
|
+
* ```
|
44
|
+
*
|
45
|
+
* Using the `fields` query parameter, you can specify the fields and relations to retrieve
|
46
|
+
* in each payment:
|
47
|
+
*
|
48
|
+
* ```ts
|
49
|
+
* sdk.admin.payment.list({
|
50
|
+
* fields: "id,*payment_collection"
|
51
|
+
* })
|
52
|
+
* .then(({ payments, count, limit, offset }) => {
|
53
|
+
* console.log(payments)
|
54
|
+
* })
|
55
|
+
* ```
|
56
|
+
*
|
57
|
+
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).
|
58
|
+
*/
|
13
59
|
list(query?: HttpTypes.AdminPaymentFilters, headers?: ClientHeaders): Promise<HttpTypes.AdminPaymentsResponse>;
|
60
|
+
/**
|
61
|
+
* This method retrieves a paginated list of payment providers. It sends a request to the
|
62
|
+
* [List Payment Providers](https://docs.medusajs.com/api/admin#payments_getpaymentspaymentproviders) API route.
|
63
|
+
*
|
64
|
+
* @param query - Filters and pagination configurations.
|
65
|
+
* @param headers - Headers to pass in the request.
|
66
|
+
* @returns The paginated list of payment providers.
|
67
|
+
*
|
68
|
+
* @example
|
69
|
+
* To retrieve the list of payment providers:
|
70
|
+
*
|
71
|
+
* ```ts
|
72
|
+
* sdk.admin.payment.listPaymentProviders()
|
73
|
+
* .then(({ payment_providers, count, limit, offset }) => {
|
74
|
+
* console.log(payment_providers)
|
75
|
+
* })
|
76
|
+
* ```
|
77
|
+
*
|
78
|
+
* To configure the pagination, pass the `limit` and `offset` query parameters.
|
79
|
+
*
|
80
|
+
* For example, to retrieve only 10 items and skip 10 items:
|
81
|
+
*
|
82
|
+
* ```ts
|
83
|
+
* sdk.admin.payment.listPaymentProviders({
|
84
|
+
* limit: 10,
|
85
|
+
* offset: 10
|
86
|
+
* })
|
87
|
+
* .then(({ payment_providers, count, limit, offset }) => {
|
88
|
+
* console.log(payment_providers)
|
89
|
+
* })
|
90
|
+
* ```
|
91
|
+
*
|
92
|
+
* Using the `fields` query parameter, you can specify the fields and relations to retrieve
|
93
|
+
* in each payment provider:
|
94
|
+
*
|
95
|
+
* ```ts
|
96
|
+
* sdk.admin.payment.listPaymentProviders({
|
97
|
+
* fields: "id,is_enabled"
|
98
|
+
* })
|
99
|
+
* .then(({ payment_providers, count, limit, offset }) => {
|
100
|
+
* console.log(payment_providers)
|
101
|
+
* })
|
102
|
+
* ```
|
103
|
+
*
|
104
|
+
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).
|
105
|
+
*/
|
14
106
|
listPaymentProviders(query?: HttpTypes.AdminGetPaymentProvidersParams, headers?: ClientHeaders): Promise<HttpTypes.AdminPaymentProviderListResponse>;
|
15
|
-
|
107
|
+
/**
|
108
|
+
* This method retrieves a payment's details. It sends a request to the
|
109
|
+
* [Get Payment](https://docs.medusajs.com/api/admin#payments_getpaymentsid)
|
110
|
+
* API route.
|
111
|
+
*
|
112
|
+
* @param id - The payment's ID.
|
113
|
+
* @param query - Configure the fields to retrieve in the payment.
|
114
|
+
* @param headers - Headers to pass in the request
|
115
|
+
* @returns The payment's details.
|
116
|
+
*
|
117
|
+
* @example
|
118
|
+
* To retrieve a payment by its ID:
|
119
|
+
*
|
120
|
+
* ```ts
|
121
|
+
* sdk.admin.payment.retrieve("pay_123")
|
122
|
+
* .then(({ payment }) => {
|
123
|
+
* console.log(payment)
|
124
|
+
* })
|
125
|
+
* ```
|
126
|
+
*
|
127
|
+
* To specify the fields and relations to retrieve:
|
128
|
+
*
|
129
|
+
* ```ts
|
130
|
+
* sdk.admin.payment.retrieve("pay_123", {
|
131
|
+
* fields: "id,*payment_collection"
|
132
|
+
* })
|
133
|
+
* .then(({ payment }) => {
|
134
|
+
* console.log(payment)
|
135
|
+
* })
|
136
|
+
* ```
|
137
|
+
*
|
138
|
+
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).
|
139
|
+
*/
|
140
|
+
retrieve(id: string, query?: SelectParams, headers?: ClientHeaders): Promise<HttpTypes.AdminPaymentResponse>;
|
141
|
+
/**
|
142
|
+
* This method captures a payment. It sends a request to the
|
143
|
+
* [Capture Payment](https://docs.medusajs.com/api/admin#payments_postpaymentsidcapture) API route.
|
144
|
+
*
|
145
|
+
* The API route uses the `capturePayment` method of the payment provider associated with the payment's collection.
|
146
|
+
*
|
147
|
+
* @param id - The payment's ID.
|
148
|
+
* @param body - The capture's details.
|
149
|
+
* @param query - Configure the fields to retrieve in the payment.
|
150
|
+
* @param headers - Headers to pass in the request
|
151
|
+
* @returns The payment's details.
|
152
|
+
*
|
153
|
+
* @example
|
154
|
+
* sdk.admin.payment.capture("paycol_123", {})
|
155
|
+
* .then(({ payment }) => {
|
156
|
+
* console.log(payment)
|
157
|
+
* })
|
158
|
+
*/
|
16
159
|
capture(id: string, body: HttpTypes.AdminCapturePayment, query?: SelectParams, headers?: ClientHeaders): Promise<HttpTypes.AdminPaymentResponse>;
|
160
|
+
/**
|
161
|
+
* This method refunds a payment. It sends a request to the
|
162
|
+
* [Refund Payment](https://docs.medusajs.com/api/admin#payments_postpaymentsidrefund) API route.
|
163
|
+
*
|
164
|
+
* The API route uses the `refundPayment` method of the payment provider associated with the payment's collection.
|
165
|
+
*
|
166
|
+
* @param id - The payment's ID.
|
167
|
+
* @param body - The refund's details.
|
168
|
+
* @param query - Configure the fields to retrieve in the payment.
|
169
|
+
* @param headers - Headers to pass in the request
|
170
|
+
* @returns The payment's details.
|
171
|
+
*
|
172
|
+
* @example
|
173
|
+
* sdk.admin.payment.refund("paycol_123", {})
|
174
|
+
* .then(({ payment }) => {
|
175
|
+
* console.log(payment)
|
176
|
+
* })
|
177
|
+
*/
|
17
178
|
refund(id: string, body: HttpTypes.AdminRefundPayment, query?: SelectParams, headers?: ClientHeaders): Promise<HttpTypes.AdminPaymentResponse>;
|
18
179
|
}
|
19
180
|
//# sourceMappingURL=payment.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"payment.d.ts","sourceRoot":"","sources":["../../src/admin/payment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExC,qBAAa,OAAO;IAClB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAQ;IACtB;;OAEG;gBACS,MAAM,EAAE,MAAM;
|
1
|
+
{"version":3,"file":"payment.d.ts","sourceRoot":"","sources":["../../src/admin/payment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExC,qBAAa,OAAO;IAClB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAQ;IACtB;;OAEG;gBACS,MAAM,EAAE,MAAM;IAI1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6CG;IACG,IAAI,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC,mBAAmB,EAAE,OAAO,CAAC,EAAE,aAAa;IAUzE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6CG;IACG,oBAAoB,CACxB,KAAK,CAAC,EAAE,SAAS,CAAC,8BAA8B,EAChD,OAAO,CAAC,EAAE,aAAa;IAWzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACG,QAAQ,CACZ,EAAE,EAAE,MAAM,EACV,KAAK,CAAC,EAAE,YAAY,EACpB,OAAO,CAAC,EAAE,aAAa;IAWzB;;;;;;;;;;;;;;;;;OAiBG;IACG,OAAO,CACX,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,SAAS,CAAC,mBAAmB,EACnC,KAAK,CAAC,EAAE,YAAY,EACpB,OAAO,CAAC,EAAE,aAAa;IAazB;;;;;;;;;;;;;;;;;OAiBG;IACG,MAAM,CACV,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,SAAS,CAAC,kBAAkB,EAClC,KAAK,CAAC,EAAE,YAAY,EACpB,OAAO,CAAC,EAAE,aAAa;CAY1B"}
|
package/dist/admin/payment.js
CHANGED
@@ -8,24 +8,167 @@ class Payment {
|
|
8
8
|
constructor(client) {
|
9
9
|
this.client = client;
|
10
10
|
}
|
11
|
+
/**
|
12
|
+
* This method retrieves a paginated list of payments. It sends a request to the
|
13
|
+
* [List Payments](https://docs.medusajs.com/api/admin#payments_getpayments) API route.
|
14
|
+
*
|
15
|
+
* @param query - Filters and pagination configurations.
|
16
|
+
* @param headers - Headers to pass in the request.
|
17
|
+
* @returns The paginated list of payments.
|
18
|
+
*
|
19
|
+
* @example
|
20
|
+
* To retrieve the list of payments:
|
21
|
+
*
|
22
|
+
* ```ts
|
23
|
+
* sdk.admin.payment.list()
|
24
|
+
* .then(({ payments, count, limit, offset }) => {
|
25
|
+
* console.log(payments)
|
26
|
+
* })
|
27
|
+
* ```
|
28
|
+
*
|
29
|
+
* To configure the pagination, pass the `limit` and `offset` query parameters.
|
30
|
+
*
|
31
|
+
* For example, to retrieve only 10 items and skip 10 items:
|
32
|
+
*
|
33
|
+
* ```ts
|
34
|
+
* sdk.admin.payment.list({
|
35
|
+
* limit: 10,
|
36
|
+
* offset: 10
|
37
|
+
* })
|
38
|
+
* .then(({ payments, count, limit, offset }) => {
|
39
|
+
* console.log(payments)
|
40
|
+
* })
|
41
|
+
* ```
|
42
|
+
*
|
43
|
+
* Using the `fields` query parameter, you can specify the fields and relations to retrieve
|
44
|
+
* in each payment:
|
45
|
+
*
|
46
|
+
* ```ts
|
47
|
+
* sdk.admin.payment.list({
|
48
|
+
* fields: "id,*payment_collection"
|
49
|
+
* })
|
50
|
+
* .then(({ payments, count, limit, offset }) => {
|
51
|
+
* console.log(payments)
|
52
|
+
* })
|
53
|
+
* ```
|
54
|
+
*
|
55
|
+
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).
|
56
|
+
*/
|
11
57
|
async list(query, headers) {
|
12
58
|
return await this.client.fetch(`/admin/payments`, {
|
13
59
|
query,
|
14
60
|
headers,
|
15
61
|
});
|
16
62
|
}
|
63
|
+
/**
|
64
|
+
* This method retrieves a paginated list of payment providers. It sends a request to the
|
65
|
+
* [List Payment Providers](https://docs.medusajs.com/api/admin#payments_getpaymentspaymentproviders) API route.
|
66
|
+
*
|
67
|
+
* @param query - Filters and pagination configurations.
|
68
|
+
* @param headers - Headers to pass in the request.
|
69
|
+
* @returns The paginated list of payment providers.
|
70
|
+
*
|
71
|
+
* @example
|
72
|
+
* To retrieve the list of payment providers:
|
73
|
+
*
|
74
|
+
* ```ts
|
75
|
+
* sdk.admin.payment.listPaymentProviders()
|
76
|
+
* .then(({ payment_providers, count, limit, offset }) => {
|
77
|
+
* console.log(payment_providers)
|
78
|
+
* })
|
79
|
+
* ```
|
80
|
+
*
|
81
|
+
* To configure the pagination, pass the `limit` and `offset` query parameters.
|
82
|
+
*
|
83
|
+
* For example, to retrieve only 10 items and skip 10 items:
|
84
|
+
*
|
85
|
+
* ```ts
|
86
|
+
* sdk.admin.payment.listPaymentProviders({
|
87
|
+
* limit: 10,
|
88
|
+
* offset: 10
|
89
|
+
* })
|
90
|
+
* .then(({ payment_providers, count, limit, offset }) => {
|
91
|
+
* console.log(payment_providers)
|
92
|
+
* })
|
93
|
+
* ```
|
94
|
+
*
|
95
|
+
* Using the `fields` query parameter, you can specify the fields and relations to retrieve
|
96
|
+
* in each payment provider:
|
97
|
+
*
|
98
|
+
* ```ts
|
99
|
+
* sdk.admin.payment.listPaymentProviders({
|
100
|
+
* fields: "id,is_enabled"
|
101
|
+
* })
|
102
|
+
* .then(({ payment_providers, count, limit, offset }) => {
|
103
|
+
* console.log(payment_providers)
|
104
|
+
* })
|
105
|
+
* ```
|
106
|
+
*
|
107
|
+
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).
|
108
|
+
*/
|
17
109
|
async listPaymentProviders(query, headers) {
|
18
110
|
return await this.client.fetch(`/admin/payments/payment-providers`, {
|
19
111
|
query,
|
20
112
|
headers,
|
21
113
|
});
|
22
114
|
}
|
115
|
+
/**
|
116
|
+
* This method retrieves a payment's details. It sends a request to the
|
117
|
+
* [Get Payment](https://docs.medusajs.com/api/admin#payments_getpaymentsid)
|
118
|
+
* API route.
|
119
|
+
*
|
120
|
+
* @param id - The payment's ID.
|
121
|
+
* @param query - Configure the fields to retrieve in the payment.
|
122
|
+
* @param headers - Headers to pass in the request
|
123
|
+
* @returns The payment's details.
|
124
|
+
*
|
125
|
+
* @example
|
126
|
+
* To retrieve a payment by its ID:
|
127
|
+
*
|
128
|
+
* ```ts
|
129
|
+
* sdk.admin.payment.retrieve("pay_123")
|
130
|
+
* .then(({ payment }) => {
|
131
|
+
* console.log(payment)
|
132
|
+
* })
|
133
|
+
* ```
|
134
|
+
*
|
135
|
+
* To specify the fields and relations to retrieve:
|
136
|
+
*
|
137
|
+
* ```ts
|
138
|
+
* sdk.admin.payment.retrieve("pay_123", {
|
139
|
+
* fields: "id,*payment_collection"
|
140
|
+
* })
|
141
|
+
* .then(({ payment }) => {
|
142
|
+
* console.log(payment)
|
143
|
+
* })
|
144
|
+
* ```
|
145
|
+
*
|
146
|
+
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).
|
147
|
+
*/
|
23
148
|
async retrieve(id, query, headers) {
|
24
149
|
return await this.client.fetch(`/admin/payments/${id}`, {
|
25
150
|
query,
|
26
151
|
headers,
|
27
152
|
});
|
28
153
|
}
|
154
|
+
/**
|
155
|
+
* This method captures a payment. It sends a request to the
|
156
|
+
* [Capture Payment](https://docs.medusajs.com/api/admin#payments_postpaymentsidcapture) API route.
|
157
|
+
*
|
158
|
+
* The API route uses the `capturePayment` method of the payment provider associated with the payment's collection.
|
159
|
+
*
|
160
|
+
* @param id - The payment's ID.
|
161
|
+
* @param body - The capture's details.
|
162
|
+
* @param query - Configure the fields to retrieve in the payment.
|
163
|
+
* @param headers - Headers to pass in the request
|
164
|
+
* @returns The payment's details.
|
165
|
+
*
|
166
|
+
* @example
|
167
|
+
* sdk.admin.payment.capture("paycol_123", {})
|
168
|
+
* .then(({ payment }) => {
|
169
|
+
* console.log(payment)
|
170
|
+
* })
|
171
|
+
*/
|
29
172
|
async capture(id, body, query, headers) {
|
30
173
|
return await this.client.fetch(`/admin/payments/${id}/capture`, {
|
31
174
|
method: "POST",
|
@@ -34,6 +177,24 @@ class Payment {
|
|
34
177
|
query,
|
35
178
|
});
|
36
179
|
}
|
180
|
+
/**
|
181
|
+
* This method refunds a payment. It sends a request to the
|
182
|
+
* [Refund Payment](https://docs.medusajs.com/api/admin#payments_postpaymentsidrefund) API route.
|
183
|
+
*
|
184
|
+
* The API route uses the `refundPayment` method of the payment provider associated with the payment's collection.
|
185
|
+
*
|
186
|
+
* @param id - The payment's ID.
|
187
|
+
* @param body - The refund's details.
|
188
|
+
* @param query - Configure the fields to retrieve in the payment.
|
189
|
+
* @param headers - Headers to pass in the request
|
190
|
+
* @returns The payment's details.
|
191
|
+
*
|
192
|
+
* @example
|
193
|
+
* sdk.admin.payment.refund("paycol_123", {})
|
194
|
+
* .then(({ payment }) => {
|
195
|
+
* console.log(payment)
|
196
|
+
* })
|
197
|
+
*/
|
37
198
|
async refund(id, body, query, headers) {
|
38
199
|
return await this.client.fetch(`/admin/payments/${id}/refund`, {
|
39
200
|
method: "POST",
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"payment.js","sourceRoot":"","sources":["../../src/admin/payment.ts"],"names":[],"mappings":";;;AAIA,MAAa,OAAO;IAKlB;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,KAAqC,EAAE,OAAuB;QACvE,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,iBAAiB,EACjB;YACE,KAAK;YACL,OAAO;SACR,CACF,CAAA;IACH,CAAC;IAED,KAAK,CAAC,oBAAoB,CACxB,KAAgD,EAChD,OAAuB;QAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,mCAAmC,EACnC;YACE,KAAK;YACL,OAAO;SACR,CACF,CAAA;IACH,CAAC;IAED,KAAK,CAAC,QAAQ,CACZ,EAAU,EACV,
|
1
|
+
{"version":3,"file":"payment.js","sourceRoot":"","sources":["../../src/admin/payment.ts"],"names":[],"mappings":";;;AAIA,MAAa,OAAO;IAKlB;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6CG;IACH,KAAK,CAAC,IAAI,CAAC,KAAqC,EAAE,OAAuB;QACvE,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,iBAAiB,EACjB;YACE,KAAK;YACL,OAAO;SACR,CACF,CAAA;IACH,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6CG;IACH,KAAK,CAAC,oBAAoB,CACxB,KAAgD,EAChD,OAAuB;QAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,mCAAmC,EACnC;YACE,KAAK;YACL,OAAO;SACR,CACF,CAAA;IACH,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACH,KAAK,CAAC,QAAQ,CACZ,EAAU,EACV,KAAoB,EACpB,OAAuB;QAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,mBAAmB,EAAE,EAAE,EACvB;YACE,KAAK;YACL,OAAO;SACR,CACF,CAAA;IACH,CAAC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,KAAK,CAAC,OAAO,CACX,EAAU,EACV,IAAmC,EACnC,KAAoB,EACpB,OAAuB;QAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,mBAAmB,EAAE,UAAU,EAC/B;YACE,MAAM,EAAE,MAAM;YACd,OAAO;YACP,IAAI;YACJ,KAAK;SACN,CACF,CAAA;IACH,CAAC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,KAAK,CAAC,MAAM,CACV,EAAU,EACV,IAAkC,EAClC,KAAoB,EACpB,OAAuB;QAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,mBAAmB,EAAE,SAAS,EAC9B;YACE,MAAM,EAAE,MAAM;YACd,OAAO;YACP,IAAI;YACJ,KAAK;SACN,CACF,CAAA;IACH,CAAC;CACF;AAnPD,0BAmPC"}
|
@@ -10,7 +10,87 @@ export declare class Notification {
|
|
10
10
|
* @ignore
|
11
11
|
*/
|
12
12
|
constructor(client: Client);
|
13
|
+
/**
|
14
|
+
* This method retrieves a notification's details. It sends a request to the
|
15
|
+
* [Get Notification](https://docs.medusajs.com/api/admin#notifications_getnotificationsid)
|
16
|
+
* API route.
|
17
|
+
*
|
18
|
+
* @param id - The notification's ID.
|
19
|
+
* @param query - Configure the fields to retrieve in the notification.
|
20
|
+
* @param headers - Headers to pass in the request
|
21
|
+
* @returns The notification's details.
|
22
|
+
*
|
23
|
+
* @example
|
24
|
+
* To retrieve a notification by its ID:
|
25
|
+
*
|
26
|
+
* ```ts
|
27
|
+
* sdk.admin.notification.retrieve("notif_123")
|
28
|
+
* .then(({ notification }) => {
|
29
|
+
* console.log(notification)
|
30
|
+
* })
|
31
|
+
* ```
|
32
|
+
*
|
33
|
+
* To specify the fields and relations to retrieve:
|
34
|
+
*
|
35
|
+
* ```ts
|
36
|
+
* sdk.admin.notification.retrieve("notif_123", {
|
37
|
+
* fields: "id,to"
|
38
|
+
* })
|
39
|
+
* .then(({ notification }) => {
|
40
|
+
* console.log(notification)
|
41
|
+
* })
|
42
|
+
* ```
|
43
|
+
*
|
44
|
+
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).
|
45
|
+
*/
|
13
46
|
retrieve(id: string, query?: HttpTypes.AdminNotificationParams, headers?: ClientHeaders): Promise<HttpTypes.AdminNotificationResponse>;
|
47
|
+
/**
|
48
|
+
* This method retrieves a paginated list of notifications. It sends a request to the
|
49
|
+
* [List Notifications](https://docs.medusajs.com/api/admin#notifications_getnotifications)
|
50
|
+
* API route.
|
51
|
+
*
|
52
|
+
* @param query - Filters and pagination configurations.
|
53
|
+
* @param headers - Headers to pass in the request.
|
54
|
+
* @returns The paginated list of notifications.
|
55
|
+
*
|
56
|
+
* @example
|
57
|
+
* To retrieve the list of notifications:
|
58
|
+
*
|
59
|
+
* ```ts
|
60
|
+
* sdk.admin.notification.list()
|
61
|
+
* .then(({ notifications, count, limit, offset }) => {
|
62
|
+
* console.log(notifications)
|
63
|
+
* })
|
64
|
+
* ```
|
65
|
+
*
|
66
|
+
* To configure the pagination, pass the `limit` and `offset` query parameters.
|
67
|
+
*
|
68
|
+
* For example, to retrieve only 10 items and skip 10 items:
|
69
|
+
*
|
70
|
+
* ```ts
|
71
|
+
* sdk.admin.notification.list({
|
72
|
+
* limit: 10,
|
73
|
+
* offset: 10
|
74
|
+
* })
|
75
|
+
* .then(({ notifications, count, limit, offset }) => {
|
76
|
+
* console.log(notifications)
|
77
|
+
* })
|
78
|
+
* ```
|
79
|
+
*
|
80
|
+
* Using the `fields` query parameter, you can specify the fields and relations to retrieve
|
81
|
+
* in each notification:
|
82
|
+
*
|
83
|
+
* ```ts
|
84
|
+
* sdk.admin.notification.list({
|
85
|
+
* fields: "id,to"
|
86
|
+
* })
|
87
|
+
* .then(({ notifications, count, limit, offset }) => {
|
88
|
+
* console.log(notifications)
|
89
|
+
* })
|
90
|
+
* ```
|
91
|
+
*
|
92
|
+
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).
|
93
|
+
*/
|
14
94
|
list(query?: HttpTypes.AdminNotificationListParams, headers?: ClientHeaders): Promise<HttpTypes.AdminNotificationListResponse>;
|
15
95
|
}
|
16
96
|
//# sourceMappingURL=notification.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"notification.d.ts","sourceRoot":"","sources":["../../../src/admin/notification.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExC,qBAAa,YAAY;IACvB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAQ;IACtB;;OAEG;gBACS,MAAM,EAAE,MAAM;
|
1
|
+
{"version":3,"file":"notification.d.ts","sourceRoot":"","sources":["../../../src/admin/notification.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExC,qBAAa,YAAY;IACvB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAQ;IACtB;;OAEG;gBACS,MAAM,EAAE,MAAM;IAI1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACG,QAAQ,CACZ,EAAE,EAAE,MAAM,EACV,KAAK,CAAC,EAAE,SAAS,CAAC,uBAAuB,EACzC,OAAO,CAAC,EAAE,aAAa;IAYzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8CG;IACG,IAAI,CACR,KAAK,CAAC,EAAE,SAAS,CAAC,2BAA2B,EAC7C,OAAO,CAAC,EAAE,aAAa;CAW1B"}
|
@@ -14,6 +14,39 @@ export class Notification {
|
|
14
14
|
constructor(client) {
|
15
15
|
this.client = client;
|
16
16
|
}
|
17
|
+
/**
|
18
|
+
* This method retrieves a notification's details. It sends a request to the
|
19
|
+
* [Get Notification](https://docs.medusajs.com/api/admin#notifications_getnotificationsid)
|
20
|
+
* API route.
|
21
|
+
*
|
22
|
+
* @param id - The notification's ID.
|
23
|
+
* @param query - Configure the fields to retrieve in the notification.
|
24
|
+
* @param headers - Headers to pass in the request
|
25
|
+
* @returns The notification's details.
|
26
|
+
*
|
27
|
+
* @example
|
28
|
+
* To retrieve a notification by its ID:
|
29
|
+
*
|
30
|
+
* ```ts
|
31
|
+
* sdk.admin.notification.retrieve("notif_123")
|
32
|
+
* .then(({ notification }) => {
|
33
|
+
* console.log(notification)
|
34
|
+
* })
|
35
|
+
* ```
|
36
|
+
*
|
37
|
+
* To specify the fields and relations to retrieve:
|
38
|
+
*
|
39
|
+
* ```ts
|
40
|
+
* sdk.admin.notification.retrieve("notif_123", {
|
41
|
+
* fields: "id,to"
|
42
|
+
* })
|
43
|
+
* .then(({ notification }) => {
|
44
|
+
* console.log(notification)
|
45
|
+
* })
|
46
|
+
* ```
|
47
|
+
*
|
48
|
+
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).
|
49
|
+
*/
|
17
50
|
retrieve(id, query, headers) {
|
18
51
|
return __awaiter(this, void 0, void 0, function* () {
|
19
52
|
return yield this.client.fetch(`/admin/notifications/${id}`, {
|
@@ -23,6 +56,53 @@ export class Notification {
|
|
23
56
|
});
|
24
57
|
});
|
25
58
|
}
|
59
|
+
/**
|
60
|
+
* This method retrieves a paginated list of notifications. It sends a request to the
|
61
|
+
* [List Notifications](https://docs.medusajs.com/api/admin#notifications_getnotifications)
|
62
|
+
* API route.
|
63
|
+
*
|
64
|
+
* @param query - Filters and pagination configurations.
|
65
|
+
* @param headers - Headers to pass in the request.
|
66
|
+
* @returns The paginated list of notifications.
|
67
|
+
*
|
68
|
+
* @example
|
69
|
+
* To retrieve the list of notifications:
|
70
|
+
*
|
71
|
+
* ```ts
|
72
|
+
* sdk.admin.notification.list()
|
73
|
+
* .then(({ notifications, count, limit, offset }) => {
|
74
|
+
* console.log(notifications)
|
75
|
+
* })
|
76
|
+
* ```
|
77
|
+
*
|
78
|
+
* To configure the pagination, pass the `limit` and `offset` query parameters.
|
79
|
+
*
|
80
|
+
* For example, to retrieve only 10 items and skip 10 items:
|
81
|
+
*
|
82
|
+
* ```ts
|
83
|
+
* sdk.admin.notification.list({
|
84
|
+
* limit: 10,
|
85
|
+
* offset: 10
|
86
|
+
* })
|
87
|
+
* .then(({ notifications, count, limit, offset }) => {
|
88
|
+
* console.log(notifications)
|
89
|
+
* })
|
90
|
+
* ```
|
91
|
+
*
|
92
|
+
* Using the `fields` query parameter, you can specify the fields and relations to retrieve
|
93
|
+
* in each notification:
|
94
|
+
*
|
95
|
+
* ```ts
|
96
|
+
* sdk.admin.notification.list({
|
97
|
+
* fields: "id,to"
|
98
|
+
* })
|
99
|
+
* .then(({ notifications, count, limit, offset }) => {
|
100
|
+
* console.log(notifications)
|
101
|
+
* })
|
102
|
+
* ```
|
103
|
+
*
|
104
|
+
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).
|
105
|
+
*/
|
26
106
|
list(query, headers) {
|
27
107
|
return __awaiter(this, void 0, void 0, function* () {
|
28
108
|
return yield this.client.fetch(`/admin/notifications`, {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"notification.js","sourceRoot":"","sources":["../../../src/admin/notification.ts"],"names":[],"mappings":";;;;;;;;;AAIA,MAAM,OAAO,YAAY;IAKvB;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;
|
1
|
+
{"version":3,"file":"notification.js","sourceRoot":"","sources":["../../../src/admin/notification.ts"],"names":[],"mappings":";;;;;;;;;AAIA,MAAM,OAAO,YAAY;IAKvB;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACG,QAAQ,CACZ,EAAU,EACV,KAAyC,EACzC,OAAuB;;YAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,wBAAwB,EAAE,EAAE,EAC5B;gBACE,MAAM,EAAE,KAAK;gBACb,OAAO;gBACP,KAAK;aACN,CACF,CAAA;QACH,CAAC;KAAA;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8CG;IACG,IAAI,CACR,KAA6C,EAC7C,OAAuB;;YAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,sBAAsB,EACtB;gBACE,MAAM,EAAE,KAAK;gBACb,OAAO;gBACP,KAAK;aACN,CACF,CAAA;QACH,CAAC;KAAA;CACF"}
|