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:
co-authored by
Carlos R. L. Rodrigues
William Bouchard
parent
71d8a0031f
commit
ca471eb8f4
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@medusajs/core-flows": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
feat(core-flows): return type in createPaymentCollectionForCartWorkflow
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
import {
|
import {
|
||||||
CartDTO,
|
CartDTO,
|
||||||
CreatePaymentCollectionForCartWorkflowInputDTO,
|
CreatePaymentCollectionForCartWorkflowInputDTO,
|
||||||
|
PaymentCollectionDTO,
|
||||||
} from "@medusajs/framework/types"
|
} from "@medusajs/framework/types"
|
||||||
import { Modules } from "@medusajs/framework/utils"
|
import { Modules } from "@medusajs/framework/utils"
|
||||||
import {
|
import {
|
||||||
@@ -9,6 +10,7 @@ import {
|
|||||||
parallelize,
|
parallelize,
|
||||||
transform,
|
transform,
|
||||||
WorkflowData,
|
WorkflowData,
|
||||||
|
WorkflowResponse
|
||||||
} from "@medusajs/framework/workflows-sdk"
|
} from "@medusajs/framework/workflows-sdk"
|
||||||
import { createRemoteLinkStep } from "../../common/steps/create-remote-links"
|
import { createRemoteLinkStep } from "../../common/steps/create-remote-links"
|
||||||
import { useRemoteQueryStep } from "../../common/steps/use-remote-query"
|
import { useRemoteQueryStep } from "../../common/steps/use-remote-query"
|
||||||
@@ -85,7 +87,7 @@ export const createPaymentCollectionForCartWorkflow = createWorkflow(
|
|||||||
},
|
},
|
||||||
(
|
(
|
||||||
input: WorkflowData<CreatePaymentCollectionForCartWorkflowInputDTO>
|
input: WorkflowData<CreatePaymentCollectionForCartWorkflowInputDTO>
|
||||||
): WorkflowData<void> => {
|
): WorkflowResponse<PaymentCollectionDTO> => {
|
||||||
const cart = useRemoteQueryStep({
|
const cart = useRemoteQueryStep({
|
||||||
entry_point: "cart",
|
entry_point: "cart",
|
||||||
fields: [
|
fields: [
|
||||||
@@ -130,5 +132,7 @@ export const createPaymentCollectionForCartWorkflow = createWorkflow(
|
|||||||
createRemoteLinkStep(cartPaymentLink).config({
|
createRemoteLinkStep(cartPaymentLink).config({
|
||||||
name: "cart-payment-collection-link",
|
name: "cart-payment-collection-link",
|
||||||
})
|
})
|
||||||
|
|
||||||
|
return new WorkflowResponse(created[0])
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user