fix(order): summary raw totals (#11712)
This commit is contained in:
1 parent
cc829185f4
commit
7dbec10b3b
3 files changed
+17
-11
No files matched your search
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"@medusajs/order": patch
|
||||
"@medusajs/core-flows": patch
|
||||
---
|
||||
|
||||
fix(order): summary raw totals
|
||||
@@ -56,12 +56,11 @@ export type ValidateRefundStepInput = {
|
||||
*/
|
||||
export const validateRefundStep = createStep(
|
||||
"validate-refund-step",
|
||||
async function ({
|
||||
order,
|
||||
payment,
|
||||
amount,
|
||||
}: ValidateRefundStepInput) {
|
||||
const pendingDifference = order.summary?.raw_pending_difference!
|
||||
async function ({ order, payment, amount }: ValidateRefundStepInput) {
|
||||
const pendingDifference =
|
||||
order.summary?.raw_pending_difference! ??
|
||||
order.summary?.pending_difference! ??
|
||||
0
|
||||
|
||||
if (MathBN.gte(pendingDifference, 0)) {
|
||||
throw new MedusaError(
|
||||
@@ -122,9 +121,7 @@ export const refundPaymentWorkflowId = "refund-payment-workflow"
|
||||
*/
|
||||
export const refundPaymentWorkflow = createWorkflow(
|
||||
refundPaymentWorkflowId,
|
||||
(
|
||||
input: WorkflowData<RefundPaymentWorkflowInput>
|
||||
) => {
|
||||
(input: WorkflowData<RefundPaymentWorkflowInput>) => {
|
||||
const payment = useRemoteQueryStep({
|
||||
entry_point: "payment",
|
||||
fields: [
|
||||
|
||||
@@ -144,14 +144,17 @@ export async function applyChangesToOrder(
|
||||
}
|
||||
|
||||
const orderSummary = order.summary
|
||||
summariesToUpsert.push({
|
||||
const upsertSummary = {
|
||||
id: orderSummary?.version === version ? orderSummary.id : undefined,
|
||||
order_id: order.id,
|
||||
version,
|
||||
totals: calculated.getSummaryFromOrder(
|
||||
calculated.order as unknown as OrderDTO
|
||||
),
|
||||
})
|
||||
}
|
||||
|
||||
createRawPropertiesFromBigNumber(upsertSummary)
|
||||
summariesToUpsert.push(upsertSummary)
|
||||
|
||||
if (Object.keys(orderAttributes).length > 0) {
|
||||
orderToUpdate.push({
|
||||
|
||||
Reference in new issue
Block a user