@final-commerce/command-frame 0.4.1-preprod.1 → 0.4.1-preprod.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,4 @@
1
1
  import { MOCK_ORDERS, mockPublishEvent } from '../../demo/database';
2
- // Payment states in which an order is refundable
3
- const REFUNDABLE_PAYMENT_STATES = ['paid', 'partially_refunded'];
4
2
  // Track refunded amounts per order to enforce remaining capacity gate
5
3
  const mockRefundedAmounts = {};
6
4
  export const mockRedeemRefund = async (params) => {
@@ -18,10 +16,8 @@ export const mockRedeemRefund = async (params) => {
18
16
  throw new Error(`Order with ID ${params.orderId} not found`);
19
17
  }
20
18
  const orderId = order._id;
21
- // Check if order is in a refundable state
22
- if (!REFUNDABLE_PAYMENT_STATES.includes(order.paymentState)) {
23
- throw new Error(`ORDER_NOT_REFUNDABLE: order ${orderId} is '${order.paymentState}' — only 'paid' or 'partially_refunded' orders can be refunded`);
24
- }
19
+ // NO payment-state gate the runtime has none (partially_paid orders are
20
+ // refundable too); mirroring it here would teach devs a phantom error class.
25
21
  // Track refunded amounts and check remaining capacity
26
22
  const refundedSoFar = mockRefundedAmounts[orderId] || 0;
27
23
  const remainingCapacity = order.summary.total - refundedSoFar;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@final-commerce/command-frame",
3
- "version": "0.4.1-preprod.1",
3
+ "version": "0.4.1-preprod.2",
4
4
  "description": "Commands Frame library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",