@medusajs/js-sdk 2.0.1 → 2.0.2-snapshot-20241104135243

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.
Files changed (41) hide show
  1. package/dist/admin/notification.d.ts +80 -0
  2. package/dist/admin/notification.d.ts.map +1 -1
  3. package/dist/admin/notification.js +80 -0
  4. package/dist/admin/notification.js.map +1 -1
  5. package/dist/admin/order-edit.d.ts +166 -1
  6. package/dist/admin/order-edit.d.ts.map +1 -1
  7. package/dist/admin/order-edit.js +165 -0
  8. package/dist/admin/order-edit.js.map +1 -1
  9. package/dist/admin/order.d.ts +248 -22
  10. package/dist/admin/order.d.ts.map +1 -1
  11. package/dist/admin/order.js +240 -0
  12. package/dist/admin/order.js.map +1 -1
  13. package/dist/admin/payment-collection.d.ts +55 -0
  14. package/dist/admin/payment-collection.d.ts.map +1 -1
  15. package/dist/admin/payment-collection.js +55 -0
  16. package/dist/admin/payment-collection.js.map +1 -1
  17. package/dist/admin/payment.d.ts +162 -1
  18. package/dist/admin/payment.d.ts.map +1 -1
  19. package/dist/admin/payment.js +161 -0
  20. package/dist/admin/payment.js.map +1 -1
  21. package/dist/esm/admin/notification.d.ts +80 -0
  22. package/dist/esm/admin/notification.d.ts.map +1 -1
  23. package/dist/esm/admin/notification.js +80 -0
  24. package/dist/esm/admin/notification.js.map +1 -1
  25. package/dist/esm/admin/order-edit.d.ts +166 -1
  26. package/dist/esm/admin/order-edit.d.ts.map +1 -1
  27. package/dist/esm/admin/order-edit.js +165 -0
  28. package/dist/esm/admin/order-edit.js.map +1 -1
  29. package/dist/esm/admin/order.d.ts +248 -22
  30. package/dist/esm/admin/order.d.ts.map +1 -1
  31. package/dist/esm/admin/order.js +240 -0
  32. package/dist/esm/admin/order.js.map +1 -1
  33. package/dist/esm/admin/payment-collection.d.ts +55 -0
  34. package/dist/esm/admin/payment-collection.d.ts.map +1 -1
  35. package/dist/esm/admin/payment-collection.js +55 -0
  36. package/dist/esm/admin/payment-collection.js.map +1 -1
  37. package/dist/esm/admin/payment.d.ts +162 -1
  38. package/dist/esm/admin/payment.d.ts.map +1 -1
  39. package/dist/esm/admin/payment.js +161 -0
  40. package/dist/esm/admin/payment.js.map +1 -1
  41. package/package.json +2 -2
@@ -14,6 +14,24 @@ export class PaymentCollection {
14
14
  constructor(client) {
15
15
  this.client = client;
16
16
  }
17
+ /**
18
+ * This method creates a payment collection. It sends a request to the
19
+ * [Create Payment Collection](https://docs.medusajs.com/api/admin#payment-collections_postpaymentcollections)
20
+ * API route.
21
+ *
22
+ * @param body - The details of the payment collection to create.
23
+ * @param query - Configure the fields to retrieve in the payment collection.
24
+ * @param headers - Headers to pass in the request
25
+ * @returns The payment collection's details.
26
+ *
27
+ * @example
28
+ * sdk.admin.paymentCollection.create({
29
+ * order_id: "order_123"
30
+ * })
31
+ * .then(({ payment_collection }) => {
32
+ * console.log(payment_collection)
33
+ * })
34
+ */
17
35
  create(body, query, headers) {
18
36
  return __awaiter(this, void 0, void 0, function* () {
19
37
  return yield this.client.fetch(`/admin/payment-collections`, {
@@ -24,6 +42,21 @@ export class PaymentCollection {
24
42
  });
25
43
  });
26
44
  }
45
+ /**
46
+ * This method deletes a payment collection. It sends a request to the
47
+ * [Delete Payment Collection](https://docs.medusajs.com/api/admin#payment-collections_deletepaymentcollectionsid)
48
+ * API route.
49
+ *
50
+ * @param id - The payment collection's ID.
51
+ * @param headers - Headers to pass in the request
52
+ * @returns The deletion's details.
53
+ *
54
+ * @example
55
+ * sdk.admin.paymentCollection.delete("paycol_123")
56
+ * .then(({ deleted }) => {
57
+ * console.log(deleted)
58
+ * })
59
+ */
27
60
  delete(id, headers) {
28
61
  return __awaiter(this, void 0, void 0, function* () {
29
62
  return yield this.client.fetch(`/admin/payment-collections/${id}`, {
@@ -32,6 +65,28 @@ export class PaymentCollection {
32
65
  });
33
66
  });
34
67
  }
68
+ /**
69
+ * This method marks a payment collection as paid. It sends a request to the
70
+ * [Mark as Paid](https://docs.medusajs.com/api/admin#payment-collections_postpaymentcollectionsidmarkaspaid)
71
+ * API route.
72
+ *
73
+ * The API route creates and authorizes a payment session, then capture its payment,
74
+ * using the manual payment provider.
75
+ *
76
+ * @param id - The payment collection to mark as paid.
77
+ * @param body - The details to mark the payment collection as paid.
78
+ * @param query - Configure the fields to retrieve in the payment collection.
79
+ * @param headers - Headers to pass in the request.
80
+ * @returns The payment collection's details.
81
+ *
82
+ * @example
83
+ * sdk.admin.paymentCollection.markAsPaid("paycol_123", {
84
+ * order_id: "order_123"
85
+ * })
86
+ * .then(({ payment_collection }) => {
87
+ * console.log(payment_collection)
88
+ * })
89
+ */
35
90
  markAsPaid(id, body, query, headers) {
36
91
  return __awaiter(this, void 0, void 0, function* () {
37
92
  return yield this.client.fetch(`/admin/payment-collections/${id}/mark-as-paid`, {
@@ -1 +1 @@
1
- {"version":3,"file":"payment-collection.js","sourceRoot":"","sources":["../../../src/admin/payment-collection.ts"],"names":[],"mappings":";;;;;;;;;AAIA,MAAM,OAAO,iBAAiB;IAK5B;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAEK,MAAM,CACV,IAA4C,EAC5C,KAAoB,EACpB,OAAuB;;YAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,4BAA4B,EAC5B;gBACE,MAAM,EAAE,MAAM;gBACd,OAAO;gBACP,IAAI;gBACJ,KAAK;aACN,CACF,CAAA;QACH,CAAC;KAAA;IAEK,MAAM,CAAC,EAAU,EAAE,OAAuB;;YAC9C,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,8BAA8B,EAAE,EAAE,EAClC;gBACE,MAAM,EAAE,QAAQ;gBAChB,OAAO;aACR,CACF,CAAA;QACH,CAAC;KAAA;IAEK,UAAU,CACd,EAAU,EACV,IAAgD,EAChD,KAAoB,EACpB,OAAuB;;YAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,8BAA8B,EAAE,eAAe,EAC/C;gBACE,MAAM,EAAE,MAAM;gBACd,OAAO;gBACP,IAAI;gBACJ,KAAK;aACN,CACF,CAAA;QACH,CAAC;KAAA;CACF"}
1
+ {"version":3,"file":"payment-collection.js","sourceRoot":"","sources":["../../../src/admin/payment-collection.ts"],"names":[],"mappings":";;;;;;;;;AAIA,MAAM,OAAO,iBAAiB;IAK5B;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACG,MAAM,CACV,IAA4C,EAC5C,KAAoB,EACpB,OAAuB;;YAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,4BAA4B,EAC5B;gBACE,MAAM,EAAE,MAAM;gBACd,OAAO;gBACP,IAAI;gBACJ,KAAK;aACN,CACF,CAAA;QACH,CAAC;KAAA;IAED;;;;;;;;;;;;;;OAcG;IACG,MAAM,CAAC,EAAU,EAAE,OAAuB;;YAC9C,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,8BAA8B,EAAE,EAAE,EAClC;gBACE,MAAM,EAAE,QAAQ;gBAChB,OAAO;aACR,CACF,CAAA;QACH,CAAC;KAAA;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IACG,UAAU,CACd,EAAU,EACV,IAAgD,EAChD,KAAoB,EACpB,OAAuB;;YAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,8BAA8B,EAAE,eAAe,EAC/C;gBACE,MAAM,EAAE,MAAM;gBACd,OAAO;gBACP,IAAI;gBACJ,KAAK;aACN,CACF,CAAA;QACH,CAAC;KAAA;CACF"}
@@ -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
- retrieve(id: string, query?: HttpTypes.AdminPaymentFilters, headers?: ClientHeaders): Promise<HttpTypes.AdminPaymentResponse>;
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;IAIpB,IAAI,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC,mBAAmB,EAAE,OAAO,CAAC,EAAE,aAAa;IAUnE,oBAAoB,CACxB,KAAK,CAAC,EAAE,SAAS,CAAC,8BAA8B,EAChD,OAAO,CAAC,EAAE,aAAa;IAWnB,QAAQ,CACZ,EAAE,EAAE,MAAM,EACV,KAAK,CAAC,EAAE,SAAS,CAAC,mBAAmB,EACrC,OAAO,CAAC,EAAE,aAAa;IAWnB,OAAO,CACX,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,SAAS,CAAC,mBAAmB,EACnC,KAAK,CAAC,EAAE,YAAY,EACpB,OAAO,CAAC,EAAE,aAAa;IAanB,MAAM,CACV,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,SAAS,CAAC,kBAAkB,EAClC,KAAK,CAAC,EAAE,YAAY,EACpB,OAAO,CAAC,EAAE,aAAa;CAY1B"}
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"}
@@ -14,6 +14,52 @@ export class Payment {
14
14
  constructor(client) {
15
15
  this.client = client;
16
16
  }
17
+ /**
18
+ * This method retrieves a paginated list of payments. It sends a request to the
19
+ * [List Payments](https://docs.medusajs.com/api/admin#payments_getpayments) API route.
20
+ *
21
+ * @param query - Filters and pagination configurations.
22
+ * @param headers - Headers to pass in the request.
23
+ * @returns The paginated list of payments.
24
+ *
25
+ * @example
26
+ * To retrieve the list of payments:
27
+ *
28
+ * ```ts
29
+ * sdk.admin.payment.list()
30
+ * .then(({ payments, count, limit, offset }) => {
31
+ * console.log(payments)
32
+ * })
33
+ * ```
34
+ *
35
+ * To configure the pagination, pass the `limit` and `offset` query parameters.
36
+ *
37
+ * For example, to retrieve only 10 items and skip 10 items:
38
+ *
39
+ * ```ts
40
+ * sdk.admin.payment.list({
41
+ * limit: 10,
42
+ * offset: 10
43
+ * })
44
+ * .then(({ payments, count, limit, offset }) => {
45
+ * console.log(payments)
46
+ * })
47
+ * ```
48
+ *
49
+ * Using the `fields` query parameter, you can specify the fields and relations to retrieve
50
+ * in each payment:
51
+ *
52
+ * ```ts
53
+ * sdk.admin.payment.list({
54
+ * fields: "id,*payment_collection"
55
+ * })
56
+ * .then(({ payments, count, limit, offset }) => {
57
+ * console.log(payments)
58
+ * })
59
+ * ```
60
+ *
61
+ * Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).
62
+ */
17
63
  list(query, headers) {
18
64
  return __awaiter(this, void 0, void 0, function* () {
19
65
  return yield this.client.fetch(`/admin/payments`, {
@@ -22,6 +68,52 @@ export class Payment {
22
68
  });
23
69
  });
24
70
  }
71
+ /**
72
+ * This method retrieves a paginated list of payment providers. It sends a request to the
73
+ * [List Payment Providers](https://docs.medusajs.com/api/admin#payments_getpaymentspaymentproviders) API route.
74
+ *
75
+ * @param query - Filters and pagination configurations.
76
+ * @param headers - Headers to pass in the request.
77
+ * @returns The paginated list of payment providers.
78
+ *
79
+ * @example
80
+ * To retrieve the list of payment providers:
81
+ *
82
+ * ```ts
83
+ * sdk.admin.payment.listPaymentProviders()
84
+ * .then(({ payment_providers, count, limit, offset }) => {
85
+ * console.log(payment_providers)
86
+ * })
87
+ * ```
88
+ *
89
+ * To configure the pagination, pass the `limit` and `offset` query parameters.
90
+ *
91
+ * For example, to retrieve only 10 items and skip 10 items:
92
+ *
93
+ * ```ts
94
+ * sdk.admin.payment.listPaymentProviders({
95
+ * limit: 10,
96
+ * offset: 10
97
+ * })
98
+ * .then(({ payment_providers, count, limit, offset }) => {
99
+ * console.log(payment_providers)
100
+ * })
101
+ * ```
102
+ *
103
+ * Using the `fields` query parameter, you can specify the fields and relations to retrieve
104
+ * in each payment provider:
105
+ *
106
+ * ```ts
107
+ * sdk.admin.payment.listPaymentProviders({
108
+ * fields: "id,is_enabled"
109
+ * })
110
+ * .then(({ payment_providers, count, limit, offset }) => {
111
+ * console.log(payment_providers)
112
+ * })
113
+ * ```
114
+ *
115
+ * Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).
116
+ */
25
117
  listPaymentProviders(query, headers) {
26
118
  return __awaiter(this, void 0, void 0, function* () {
27
119
  return yield this.client.fetch(`/admin/payments/payment-providers`, {
@@ -30,6 +122,39 @@ export class Payment {
30
122
  });
31
123
  });
32
124
  }
125
+ /**
126
+ * This method retrieves a payment's details. It sends a request to the
127
+ * [Get Payment](https://docs.medusajs.com/api/admin#payments_getpaymentsid)
128
+ * API route.
129
+ *
130
+ * @param id - The payment's ID.
131
+ * @param query - Configure the fields to retrieve in the payment.
132
+ * @param headers - Headers to pass in the request
133
+ * @returns The payment's details.
134
+ *
135
+ * @example
136
+ * To retrieve a payment by its ID:
137
+ *
138
+ * ```ts
139
+ * sdk.admin.payment.retrieve("pay_123")
140
+ * .then(({ payment }) => {
141
+ * console.log(payment)
142
+ * })
143
+ * ```
144
+ *
145
+ * To specify the fields and relations to retrieve:
146
+ *
147
+ * ```ts
148
+ * sdk.admin.payment.retrieve("pay_123", {
149
+ * fields: "id,*payment_collection"
150
+ * })
151
+ * .then(({ payment }) => {
152
+ * console.log(payment)
153
+ * })
154
+ * ```
155
+ *
156
+ * Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).
157
+ */
33
158
  retrieve(id, query, headers) {
34
159
  return __awaiter(this, void 0, void 0, function* () {
35
160
  return yield this.client.fetch(`/admin/payments/${id}`, {
@@ -38,6 +163,24 @@ export class Payment {
38
163
  });
39
164
  });
40
165
  }
166
+ /**
167
+ * This method captures a payment. It sends a request to the
168
+ * [Capture Payment](https://docs.medusajs.com/api/admin#payments_postpaymentsidcapture) API route.
169
+ *
170
+ * The API route uses the `capturePayment` method of the payment provider associated with the payment's collection.
171
+ *
172
+ * @param id - The payment's ID.
173
+ * @param body - The capture's details.
174
+ * @param query - Configure the fields to retrieve in the payment.
175
+ * @param headers - Headers to pass in the request
176
+ * @returns The payment's details.
177
+ *
178
+ * @example
179
+ * sdk.admin.payment.capture("paycol_123", {})
180
+ * .then(({ payment }) => {
181
+ * console.log(payment)
182
+ * })
183
+ */
41
184
  capture(id, body, query, headers) {
42
185
  return __awaiter(this, void 0, void 0, function* () {
43
186
  return yield this.client.fetch(`/admin/payments/${id}/capture`, {
@@ -48,6 +191,24 @@ export class Payment {
48
191
  });
49
192
  });
50
193
  }
194
+ /**
195
+ * This method refunds a payment. It sends a request to the
196
+ * [Refund Payment](https://docs.medusajs.com/api/admin#payments_postpaymentsidrefund) API route.
197
+ *
198
+ * The API route uses the `refundPayment` method of the payment provider associated with the payment's collection.
199
+ *
200
+ * @param id - The payment's ID.
201
+ * @param body - The refund's details.
202
+ * @param query - Configure the fields to retrieve in the payment.
203
+ * @param headers - Headers to pass in the request
204
+ * @returns The payment's details.
205
+ *
206
+ * @example
207
+ * sdk.admin.payment.refund("paycol_123", {})
208
+ * .then(({ payment }) => {
209
+ * console.log(payment)
210
+ * })
211
+ */
51
212
  refund(id, body, query, headers) {
52
213
  return __awaiter(this, void 0, void 0, function* () {
53
214
  return yield this.client.fetch(`/admin/payments/${id}/refund`, {
@@ -1 +1 @@
1
- {"version":3,"file":"payment.js","sourceRoot":"","sources":["../../../src/admin/payment.ts"],"names":[],"mappings":";;;;;;;;;AAIA,MAAM,OAAO,OAAO;IAKlB;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAEK,IAAI,CAAC,KAAqC,EAAE,OAAuB;;YACvE,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,iBAAiB,EACjB;gBACE,KAAK;gBACL,OAAO;aACR,CACF,CAAA;QACH,CAAC;KAAA;IAEK,oBAAoB,CACxB,KAAgD,EAChD,OAAuB;;YAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,mCAAmC,EACnC;gBACE,KAAK;gBACL,OAAO;aACR,CACF,CAAA;QACH,CAAC;KAAA;IAEK,QAAQ,CACZ,EAAU,EACV,KAAqC,EACrC,OAAuB;;YAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,mBAAmB,EAAE,EAAE,EACvB;gBACE,KAAK;gBACL,OAAO;aACR,CACF,CAAA;QACH,CAAC;KAAA;IAEK,OAAO,CACX,EAAU,EACV,IAAmC,EACnC,KAAoB,EACpB,OAAuB;;YAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,mBAAmB,EAAE,UAAU,EAC/B;gBACE,MAAM,EAAE,MAAM;gBACd,OAAO;gBACP,IAAI;gBACJ,KAAK;aACN,CACF,CAAA;QACH,CAAC;KAAA;IAEK,MAAM,CACV,EAAU,EACV,IAAkC,EAClC,KAAoB,EACpB,OAAuB;;YAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,mBAAmB,EAAE,SAAS,EAC9B;gBACE,MAAM,EAAE,MAAM;gBACd,OAAO;gBACP,IAAI;gBACJ,KAAK;aACN,CACF,CAAA;QACH,CAAC;KAAA;CACF"}
1
+ {"version":3,"file":"payment.js","sourceRoot":"","sources":["../../../src/admin/payment.ts"],"names":[],"mappings":";;;;;;;;;AAIA,MAAM,OAAO,OAAO;IAKlB;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6CG;IACG,IAAI,CAAC,KAAqC,EAAE,OAAuB;;YACvE,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,iBAAiB,EACjB;gBACE,KAAK;gBACL,OAAO;aACR,CACF,CAAA;QACH,CAAC;KAAA;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6CG;IACG,oBAAoB,CACxB,KAAgD,EAChD,OAAuB;;YAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,mCAAmC,EACnC;gBACE,KAAK;gBACL,OAAO;aACR,CACF,CAAA;QACH,CAAC;KAAA;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACG,QAAQ,CACZ,EAAU,EACV,KAAoB,EACpB,OAAuB;;YAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,mBAAmB,EAAE,EAAE,EACvB;gBACE,KAAK;gBACL,OAAO;aACR,CACF,CAAA;QACH,CAAC;KAAA;IAED;;;;;;;;;;;;;;;;;OAiBG;IACG,OAAO,CACX,EAAU,EACV,IAAmC,EACnC,KAAoB,EACpB,OAAuB;;YAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,mBAAmB,EAAE,UAAU,EAC/B;gBACE,MAAM,EAAE,MAAM;gBACd,OAAO;gBACP,IAAI;gBACJ,KAAK;aACN,CACF,CAAA;QACH,CAAC;KAAA;IAED;;;;;;;;;;;;;;;;;OAiBG;IACG,MAAM,CACV,EAAU,EACV,IAAkC,EAClC,KAAoB,EACpB,OAAuB;;YAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,mBAAmB,EAAE,SAAS,EAC9B;gBACE,MAAM,EAAE,MAAM;gBACd,OAAO;gBACP,IAAI;gBACJ,KAAK;aACN,CACF,CAAA;QACH,CAAC;KAAA;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medusajs/js-sdk",
3
- "version": "2.0.1",
3
+ "version": "2.0.2-snapshot-20241104135243",
4
4
  "description": "SDK for the Medusa API",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -35,7 +35,7 @@
35
35
  "typescript": "^5.6.2"
36
36
  },
37
37
  "dependencies": {
38
- "@medusajs/types": "^2.0.1",
38
+ "@medusajs/types": "2.0.2-snapshot-20241104135243",
39
39
  "fetch-event-stream": "^0.1.5",
40
40
  "qs": "^6.12.1"
41
41
  },