UNPKG

@medusajs/core-flows

Version:

Set of workflow definitions for Medusa

86 lines 2.37 kB
import { BigNumberInput, PaymentDTO } from "@medusajs/framework/types"; /** * The data to validate whether the refund is valid for the payment. */ export type ValidatePaymentsRefundStepInput = { /** * The payment details. */ payments: PaymentDTO[]; /** * The payments to refund. */ input: RefundPaymentsWorkflowInput; }; /** * This step validates that the refund is valid for the payment. * If the payment's refundable amount is less than the amount to be refunded, * the step throws an error. * * :::note * * You can retrieve a payment's details using [Query](https://docs.medusajs.com/learn/fundamentals/module-links/query), * or [useQueryGraphStep](https://docs.medusajs.com/resources/references/medusa-workflows/steps/useQueryGraphStep). * * ::: * * @example * const data = validatePaymentsRefundStep({ * payment: [{ * id: "payment_123", * // other payment details... * }], * input: [ * { * payment_id: "payment_123", * amount: 10, * } * ] * }) */ export declare const validatePaymentsRefundStep: import("@medusajs/framework/workflows-sdk").StepFunction<ValidatePaymentsRefundStepInput, unknown>; /** * The data to refund a payment. */ export type RefundPaymentsWorkflowInput = { /** * The ID of the payment to refund. */ payment_id: string; /** * The amount to refund. Must be less than the refundable amount of the payment. */ amount: BigNumberInput; /** * The ID of the user that's refunding the payment. */ created_by?: string; /** * The note to attach to the refund. */ note?: string; }[]; export declare const refundPaymentsWorkflowId = "refund-payments-workflow"; /** * This workflow refunds payments. * * You can use this workflow within your customizations or your own custom workflows, allowing you to * refund payments in your custom flow. * * @example * const { result } = await refundPaymentsWorkflow(container) * .run({ * input: [ * { * payment_id: "pay_123", * amount: 10, * } * ] * }) * * @summary * * Refund one or more payments. */ export declare const refundPaymentsWorkflow: import("@medusajs/framework/workflows-sdk").ReturnWorkflow<RefundPaymentsWorkflowInput, PaymentDTO[], []>; //# sourceMappingURL=refund-payments.d.ts.map