fix(utils): medusa internal service returned data should match typings (#12715)
FIXES SUP-1824 **What** The medusa internal service update should always return the data in the expected shape described by the interface. The medusa service should not have to handle the reshapre
This commit is contained in:
@@ -359,15 +359,13 @@ export default class PaymentModuleService
|
||||
}
|
||||
)
|
||||
|
||||
paymentSession = (
|
||||
await this.paymentSessionService_.update(
|
||||
{
|
||||
id: paymentSession!.id,
|
||||
data: { ...input.data, ...providerPaymentSession.data },
|
||||
},
|
||||
sharedContext
|
||||
)
|
||||
)[0]
|
||||
paymentSession = await this.paymentSessionService_.update(
|
||||
{
|
||||
id: paymentSession!.id,
|
||||
data: { ...input.data, ...providerPaymentSession.data },
|
||||
},
|
||||
sharedContext
|
||||
)
|
||||
} catch (error) {
|
||||
if (providerPaymentSession) {
|
||||
await this.paymentProviderService_.deleteSession(input.provider_id, {
|
||||
@@ -440,7 +438,7 @@ export default class PaymentModuleService
|
||||
sharedContext
|
||||
)
|
||||
|
||||
return await this.baseRepository_.serialize(updated[0], { populate: true })
|
||||
return await this.baseRepository_.serialize(updated, { populate: true })
|
||||
}
|
||||
|
||||
@InjectManager()
|
||||
@@ -605,7 +603,7 @@ export default class PaymentModuleService
|
||||
// NOTE: currently there is no update with the provider but maybe data could be updated
|
||||
const result = await this.paymentService_.update(data, sharedContext)
|
||||
|
||||
return await this.baseRepository_.serialize<PaymentDTO>(result[0])
|
||||
return await this.baseRepository_.serialize<PaymentDTO>(result)
|
||||
}
|
||||
|
||||
// TODO: This method should return a capture, not a payment
|
||||
|
||||
Reference in New Issue
Block a user