feat: Add return type in createPaymentCollectionForCartWorkflow (#13385)

* return created payment collection in createPaymentCollectionForCartWorkflow

* changeset

* Update .changeset/tasty-ghosts-work.md

Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>

* declare return type

* return single payment collection instead of array

---------

Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>
Co-authored-by: William Bouchard <46496014+willbouch@users.noreply.github.com>
This commit is contained in:
Patryk Spychalski
2025-09-07 19:24:09 +02:00
committed by GitHub
parent 71d8a0031f
commit ca471eb8f4
2 changed files with 10 additions and 1 deletions

View File

@@ -0,0 +1,5 @@
---
"@medusajs/core-flows": patch
---
feat(core-flows): return type in createPaymentCollectionForCartWorkflow

View File

@@ -1,6 +1,7 @@
import {
CartDTO,
CreatePaymentCollectionForCartWorkflowInputDTO,
PaymentCollectionDTO,
} from "@medusajs/framework/types"
import { Modules } from "@medusajs/framework/utils"
import {
@@ -9,6 +10,7 @@ import {
parallelize,
transform,
WorkflowData,
WorkflowResponse
} from "@medusajs/framework/workflows-sdk"
import { createRemoteLinkStep } from "../../common/steps/create-remote-links"
import { useRemoteQueryStep } from "../../common/steps/use-remote-query"
@@ -85,7 +87,7 @@ export const createPaymentCollectionForCartWorkflow = createWorkflow(
},
(
input: WorkflowData<CreatePaymentCollectionForCartWorkflowInputDTO>
): WorkflowData<void> => {
): WorkflowResponse<PaymentCollectionDTO> => {
const cart = useRemoteQueryStep({
entry_point: "cart",
fields: [
@@ -130,5 +132,7 @@ export const createPaymentCollectionForCartWorkflow = createWorkflow(
createRemoteLinkStep(cartPaymentLink).config({
name: "cart-payment-collection-link",
})
return new WorkflowResponse(created[0])
}
)