feat: Remove fields from payment models that were leftovers from v1 (#10987)
This commit is contained in:
@@ -9,13 +9,6 @@ import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk"
|
||||
* The details of the payment collections to create.
|
||||
*/
|
||||
export type CreatePaymentCollectionCartStepInput = {
|
||||
/**
|
||||
* The ID of the region that the payment collection belongs to.
|
||||
*/
|
||||
region_id: string
|
||||
/**
|
||||
* The payment collection's curency code.
|
||||
*/
|
||||
currency_code: string
|
||||
/**
|
||||
* The payment collection's amount.
|
||||
@@ -30,10 +23,9 @@ export type CreatePaymentCollectionCartStepInput = {
|
||||
export const createPaymentCollectionsStepId = "create-payment-collections"
|
||||
/**
|
||||
* This step creates payment collections in a cart.
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* const data = createPaymentCollectionsStep([{
|
||||
* "region_id": "region_123",
|
||||
* "currency_code": "usd",
|
||||
* "amount": 40
|
||||
* }])
|
||||
|
||||
@@ -28,13 +28,13 @@ export type ValidateExistingPaymentCollectionStepInput = {
|
||||
/**
|
||||
* This step validates that a cart doesn't have a payment collection.
|
||||
* If the cart has a payment collection, the step throws an error.
|
||||
*
|
||||
*
|
||||
* :::tip
|
||||
*
|
||||
*
|
||||
* You can use the {@link retrieveCartStep} to retrieve a cart's details.
|
||||
*
|
||||
*
|
||||
* :::
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* const data = validateExistingPaymentCollectionStep({
|
||||
* cart: {
|
||||
@@ -58,11 +58,11 @@ export const validateExistingPaymentCollectionStep = createStep(
|
||||
export const createPaymentCollectionForCartWorkflowId =
|
||||
"create-payment-collection-for-cart"
|
||||
/**
|
||||
* This workflow creates a payment collection for a cart. It's executed by the
|
||||
* This workflow creates a payment collection for a cart. It's executed by the
|
||||
* [Create Payment Collection Store API Route](https://docs.medusajs.com/api/store#payment-collections_postpaymentcollections).
|
||||
*
|
||||
*
|
||||
* You can use this workflow within your own custom workflows, allowing you to wrap custom logic around adding creating a payment collection for a cart.
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* const { result } = await createPaymentCollectionForCartWorkflow(container)
|
||||
* .run({
|
||||
@@ -73,9 +73,9 @@ export const createPaymentCollectionForCartWorkflowId =
|
||||
* }
|
||||
* }
|
||||
* })
|
||||
*
|
||||
*
|
||||
* @summary
|
||||
*
|
||||
*
|
||||
* Create payment collection for cart.
|
||||
*/
|
||||
export const createPaymentCollectionForCartWorkflow = createWorkflow(
|
||||
@@ -87,7 +87,6 @@ export const createPaymentCollectionForCartWorkflow = createWorkflow(
|
||||
entry_point: "cart",
|
||||
fields: [
|
||||
"id",
|
||||
"region_id",
|
||||
"completed_at",
|
||||
"currency_code",
|
||||
"total",
|
||||
@@ -106,10 +105,8 @@ export const createPaymentCollectionForCartWorkflow = createWorkflow(
|
||||
|
||||
const paymentData = transform({ cart }, ({ cart }) => {
|
||||
return {
|
||||
cart_id: cart.id,
|
||||
currency_code: cart.currency_code,
|
||||
amount: cart.raw_total,
|
||||
region_id: cart.region_id,
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -108,7 +108,6 @@ export const refreshPaymentCollectionForCartWorkflow = createWorkflow(
|
||||
update: {
|
||||
amount: cart.total,
|
||||
currency_code: cart.currency_code,
|
||||
region_id: cart.region_id,
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
@@ -63,7 +63,6 @@ export const createOrderPaymentCollectionWorkflow = createWorkflow(
|
||||
return {
|
||||
currency_code: order.currency_code,
|
||||
amount: input.amount,
|
||||
region_id: order.region_id,
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user