Skip to content

Commit 698a520

Browse files
authored
chore(types): change payment provider types to interfaces (#11597)
* chore(types): change payment provider types to interfaces * add changeset
1 parent 3f2dcb2 commit 698a520

File tree

3 files changed

+34
-100
lines changed

3 files changed

+34
-100
lines changed

.changeset/brown-buttons-buy.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@medusajs/types": patch
3+
---
4+
5+
chore(types): change payment provider types to interfaces

packages/core/types/src/http/inventory-level/admin/payloads.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,6 @@ export interface AdminBatchCreateInventoryItemLocationLevels {
2828
incoming_quantity?: number
2929
}
3030

31-
export interface AdminBatchCreateInventoryItemLocationLevels {
32-
/**
33-
* The ID of the associated stock location.
34-
*/
35-
location_id: string
36-
/**
37-
* The associated inventory item's stocked quantity in the
38-
* associated stock location.
39-
*/
40-
stocked_quantity?: number
41-
/**
42-
* The associated inventory item's incoming quantity in the
43-
* associated stock location.
44-
*/
45-
incoming_quantity?: number
46-
}
47-
4831
export interface AdminBatchUpdateInventoryItemLocationLevels
4932
extends AdminBatchCreateInventoryItemLocationLevels {
5033
/**

packages/core/types/src/payment/provider.ts

Lines changed: 29 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,10 @@ export type PaymentProviderInput = {
9595
}
9696

9797
/**
98-
* @interface
99-
*
10098
* The data used initiate a payment in a provider when a payment
10199
* session is created.
102100
*/
103-
export type InitiatePaymentInput = PaymentProviderInput & {
101+
export interface InitiatePaymentInput extends PaymentProviderInput {
104102
/**
105103
* The amount to be authorized.
106104
*/
@@ -113,11 +111,9 @@ export type InitiatePaymentInput = PaymentProviderInput & {
113111
}
114112

115113
/**
116-
* @interface
117-
*
118114
* The attributes to update a payment related to a payment session in a provider.
119115
*/
120-
export type UpdatePaymentInput = PaymentProviderInput & {
116+
export interface UpdatePaymentInput extends PaymentProviderInput {
121117
/**
122118
* The payment session's amount.
123119
*/
@@ -130,58 +126,44 @@ export type UpdatePaymentInput = PaymentProviderInput & {
130126
}
131127

132128
/**
133-
* @interface
134-
*
135129
* The data to delete a payment.
136130
*/
137-
export type DeletePaymentInput = PaymentProviderInput
131+
export interface DeletePaymentInput extends PaymentProviderInput {}
138132

139133
/**
140-
* @interface
141-
*
142134
* The data to authorize a payment.
143135
*/
144-
export type AuthorizePaymentInput = PaymentProviderInput
136+
export interface AuthorizePaymentInput extends PaymentProviderInput {}
145137

146138
/**
147-
* @interface
148-
*
149139
* The data to capture a payment.
150140
*/
151-
export type CapturePaymentInput = PaymentProviderInput
141+
export interface CapturePaymentInput extends PaymentProviderInput {}
152142

153143
/**
154-
* @interface
155-
*
156144
* The data to refund a payment.
157145
*/
158-
export type RefundPaymentInput = PaymentProviderInput & {
146+
export interface RefundPaymentInput extends PaymentProviderInput {
159147
/**
160148
* The amount to refund.
161149
*/
162150
amount: BigNumberInput
163151
}
164152

165153
/**
166-
* @interface
167-
*
168154
* The data to retrieve a payment.
169155
*/
170-
export type RetrievePaymentInput = PaymentProviderInput
156+
export interface RetrievePaymentInput extends PaymentProviderInput {}
171157

172158
/**
173-
* @interface
174-
*
175159
* The data to cancel a payment.
176160
*/
177-
export type CancelPaymentInput = PaymentProviderInput
161+
export interface CancelPaymentInput extends PaymentProviderInput {}
178162

179163
/**
180-
* @interface
181-
*
182164
* The data to create an account holder.
183165
*/
184-
export type CreateAccountHolderInput = PaymentProviderInput & {
166+
export interface CreateAccountHolderInput extends PaymentProviderInput {
185167
/**
186168
* The context of creating the account holder.
187169
*/
@@ -193,7 +175,7 @@ export type CreateAccountHolderInput = PaymentProviderInput & {
193175
}
194176
}
195177

196-
export type UpdateAccountHolderInput = PaymentProviderInput & {
178+
export interface UpdateAccountHolderInput extends PaymentProviderInput {
197179
/**
198180
* The context of updating the account holder.
199181
*/
@@ -206,11 +188,9 @@ export type UpdateAccountHolderInput = PaymentProviderInput & {
206188
}
207189

208190
/**
209-
* @interface
210-
*
211191
* The data to delete an account holder.
212192
*/
213-
export type DeleteAccountHolderInput = PaymentProviderInput & {
193+
export interface DeleteAccountHolderInput extends Omit<PaymentProviderInput, "context"> {
214194
/**
215195
* The context of deleting the account holder.
216196
*/
@@ -223,25 +203,19 @@ export type DeleteAccountHolderInput = PaymentProviderInput & {
223203
}
224204

225205
/**
226-
* @interface
227-
*
228206
* The data to list payment methods.
229207
*/
230-
export type ListPaymentMethodsInput = PaymentProviderInput
208+
export interface ListPaymentMethodsInput extends PaymentProviderInput {}
231209

232210
/**
233-
* @interface
234-
*
235211
* The data to save a payment method.
236212
*/
237-
export type SavePaymentMethodInput = PaymentProviderInput
213+
export interface SavePaymentMethodInput extends PaymentProviderInput {}
238214

239215
/**
240-
* @interface
241-
*
242216
* The data to get the payment status.
243217
*/
244-
export type GetPaymentStatusInput = PaymentProviderInput
218+
export interface GetPaymentStatusInput extends PaymentProviderInput {}
245219

246220
/**
247221
* @interface
@@ -256,78 +230,60 @@ export type PaymentProviderOutput = {
256230
}
257231

258232
/**
259-
* @interface
260-
*
261233
* The successful result of initiating a payment session using a third-party payment provider.
262234
*/
263-
export type InitiatePaymentOutput = PaymentProviderOutput & {
235+
export interface InitiatePaymentOutput extends PaymentProviderOutput {
264236
/**
265237
* The ID of the payment session in the payment provider.
266238
*/
267239
id: string
268240
}
269241

270242
/**
271-
* @interface
272-
*
273243
* The successful result of authorizing a payment session using a payment provider.
274244
*/
275-
export type AuthorizePaymentOutput = PaymentProviderOutput & {
245+
export interface AuthorizePaymentOutput extends PaymentProviderOutput {
276246
/**
277247
* The status of the payment, which will be stored in the payment session's `status` field.
278248
*/
279249
status: PaymentSessionStatus
280250
}
281251

282252
/**
283-
* @interface
284-
*
285253
* The result of updating a payment.
286254
*/
287-
export type UpdatePaymentOutput = PaymentProviderOutput
255+
export interface UpdatePaymentOutput extends PaymentProviderOutput {}
288256

289257
/**
290-
* @interface
291-
*
292258
* The result of deleting a payment.
293259
*/
294-
export type DeletePaymentOutput = PaymentProviderOutput
260+
export interface DeletePaymentOutput extends PaymentProviderOutput {}
295261

296262
/**
297-
* @interface
298-
*
299263
* The result of capturing the payment.
300264
*/
301-
export type CapturePaymentOutput = PaymentProviderOutput
265+
export interface CapturePaymentOutput extends PaymentProviderOutput {}
302266

303267
/**
304-
* @interface
305-
*
306268
* The result of refunding the payment.
307269
*/
308-
export type RefundPaymentOutput = PaymentProviderOutput
270+
export interface RefundPaymentOutput extends PaymentProviderOutput {}
309271

310272
/**
311-
* @interface
312-
*
313273
* The result of retrieving the payment.
314274
*/
315-
export type RetrievePaymentOutput = PaymentProviderOutput
275+
export interface RetrievePaymentOutput extends PaymentProviderOutput {}
316276

317277
/**
318-
* @interface
319-
*
320278
* The result of canceling the payment.
321279
*/
322-
export type CancelPaymentOutput = PaymentProviderOutput
280+
export interface CancelPaymentOutput extends PaymentProviderOutput {}
323281

324282
/**
325-
* @interface
326-
*
327283
* The result of creating an account holder in the third-party payment provider. The `data`
328284
* property is stored as-is in Medusa's account holder's `data` property.
329285
*/
330-
export type CreateAccountHolderOutput = PaymentProviderOutput & {
286+
export interface CreateAccountHolderOutput extends PaymentProviderOutput {
331287
/**
332288
* The ID of the account holder in the payment provider.
333289
* This is stored in Medusa's account holder in the `external_id` property.
@@ -336,50 +292,40 @@ export type CreateAccountHolderOutput = PaymentProviderOutput & {
336292
}
337293

338294
/**
339-
* @interface
340-
*
341295
* The result of updating an account holder in the third-party payment provider. The `data`
342296
* property is stored as-is in Medusa's account holder's `data` property.
343297
*/
344-
export type UpdateAccountHolderOutput = PaymentProviderOutput
298+
export interface UpdateAccountHolderOutput extends PaymentProviderOutput {}
345299

346300
/**
347-
* @interface
348-
*
349301
* The result of deleting an account holder in the third-party payment provider.
350302
*/
351-
export type DeleteAccountHolderOutput = PaymentProviderOutput
303+
export interface DeleteAccountHolderOutput extends PaymentProviderOutput {}
352304

353305
/**
354-
* @interface
355-
*
356306
* The result of listing payment methods for an account holder in the third-party payment provider.
357307
*/
358-
export type ListPaymentMethodsOutput = (PaymentProviderOutput & {
308+
export interface ListPaymentMethodsOutput extends Array<PaymentProviderOutput & {
359309
/**
360310
* The ID of the payment method in the payment provider.
361311
*/
362312
id: string
363-
})[]
313+
}> {}
364314

365315
/**
366-
* @interface
367-
*
368316
* The result of saving a payment method.
369317
*/
370-
export type SavePaymentMethodOutput = PaymentProviderOutput & {
318+
export interface SavePaymentMethodOutput extends PaymentProviderOutput {
371319
/**
372320
* The ID of the payment method in the payment provider.
373321
*/
374322
id: string
375323
}
376324

377325
/**
378-
* @interface
379-
*
380326
* The result of getting the payment status.
381327
*/
382-
export type GetPaymentStatusOutput = PaymentProviderOutput & {
328+
export interface GetPaymentStatusOutput extends PaymentProviderOutput {
383329
/**
384330
* The status of the payment, which will be stored in the payment session's `status` field.
385331
*/

0 commit comments

Comments
 (0)