Skip to content

Commit ca471eb

Browse files
gladius882carlos-r-l-rodrigueswillbouch
authored
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>
1 parent 71d8a00 commit ca471eb

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

.changeset/tasty-ghosts-work.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@medusajs/core-flows": patch
3+
---
4+
5+
feat(core-flows): return type in createPaymentCollectionForCartWorkflow

packages/core/core-flows/src/cart/workflows/create-payment-collection-for-cart.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {
22
CartDTO,
33
CreatePaymentCollectionForCartWorkflowInputDTO,
4+
PaymentCollectionDTO,
45
} from "@medusajs/framework/types"
56
import { Modules } from "@medusajs/framework/utils"
67
import {
@@ -9,6 +10,7 @@ import {
910
parallelize,
1011
transform,
1112
WorkflowData,
13+
WorkflowResponse
1214
} from "@medusajs/framework/workflows-sdk"
1315
import { createRemoteLinkStep } from "../../common/steps/create-remote-links"
1416
import { useRemoteQueryStep } from "../../common/steps/use-remote-query"
@@ -85,7 +87,7 @@ export const createPaymentCollectionForCartWorkflow = createWorkflow(
8587
},
8688
(
8789
input: WorkflowData<CreatePaymentCollectionForCartWorkflowInputDTO>
88-
): WorkflowData<void> => {
90+
): WorkflowResponse<PaymentCollectionDTO> => {
8991
const cart = useRemoteQueryStep({
9092
entry_point: "cart",
9193
fields: [
@@ -130,5 +132,7 @@ export const createPaymentCollectionForCartWorkflow = createWorkflow(
130132
createRemoteLinkStep(cartPaymentLink).config({
131133
name: "cart-payment-collection-link",
132134
})
135+
136+
return new WorkflowResponse(created[0])
133137
}
134138
)

0 commit comments

Comments
 (0)