paascloud/paascloud-master · warning · OmcBizException

OMC10031011

OMC10031011

Error message

OMC10031011

What it means

OmcBizException with code OMC10031011 thrown by aliPayCallback when the order referenced by an Alipay callback already has status >= PAID. It is an idempotency guard: Alipay re-sends success notifications repeatedly until acknowledged, and processing an already-paid order again would double-apply payment state.

Solutions

  1. Treat as expected duplicate: log and immediately return ack ("success") to Alipay so retries stop
  2. Check why the first callback did not ack Alipay (exception after update, response lost) and fix the response path
  3. If the order is stuck below PAID but above expected, inspect the status enum values for mismatched ordering
  4. Do not retry the update blindly; verify payment records for the trade_no before manual correction

Example fix

// before
if (order.getStatus() >= OmcApiConstant.OrderStatusEnum.PAID.getCode()) {
    throw new OmcBizException(ErrorCodeEnum.OMC10031011);
}
// after
if (order.getStatus() >= OmcApiConstant.OrderStatusEnum.PAID.getCode()) {
    log.info("aliPayCallback - order {} already paid, ack duplicate notify", orderNo);
    return "success"; // idempotent ack instead of throwing
}
Defensive patterns

Strategy: validation

Validate before calling

if (order != null && order.getStatus() >= OmcApiConstant.OrderStatusEnum.PAID.getCode()) {
    return "success"; // idempotent ack for duplicate notifications
}

Type guard

if (order == null || order.getStatus() == null) { return "fail"; }

Try / catch

try { return aliPayCallback(params); } catch (OmcBizException e) { if ("OMC10031011".equals(e.getCode())) return "success"; return "fail"; }

Prevention

When it happens

Trigger: Alipay re-delivers a TRADE_SUCCESS notification for an order already marked PAID (retry until ack), duplicate notifications for the same trade, or a repeated manual notify triggered from the Alipay merchant console.

Common situations: Server processed the first callback but returned a non-ack response (network timeout, exception after marking paid) so Alipay retries; duplicate callback listeners registered; operator re-sending the notify from Alipay console.

Understand the failure class

Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.

Related errors


AI-assisted analysis of paascloud/paascloud-master@781281a950 (2026-09-10). Data as JSON: /api/errors/9a2ab5452e953748. Report an issue: GitHub.

Appendix: source

Thrown at paascloud-provider/paascloud-provider-omc/src/main/java/com/paascloud/provider/service/impl/PtcAlipayServiceImpl.java:259

				log.info(String.format("subCode:%s, subMsg:%s", response.getSubCode(),
						response.getSubMsg()));
			}
			log.info("body:" + response.getBody());
		}
	}

	@Override
	public Wrapper aliPayCallback(Map<String, String> params) {
		log.info("支付宝回调. - aliPayCallback. params={}", params);
		String orderNo = params.get("out_trade_no");
		String tradeNo = params.get("trade_no");
		String tradeStatus = params.get("trade_status");
		OrderDto order = omcOrderService.queryOrderDtoByOrderNo(orderNo);
		if (order == null) {
			throw new OmcBizException(ErrorCodeEnum.OMC10031010);
		}
		if (order.getStatus() >= OmcApiConstant.OrderStatusEnum.PAID.getCode()) {
			throw new OmcBizException(ErrorCodeEnum.OMC10031011);
		}
		if (PtcApiConstant.AlipayCallback.TRADE_STATUS_TRADE_SUCCESS.equals(tradeStatus)) {
			order.setPaymentTime(DateUtil.parseDate(params.get("gmt_payment")));
			order.setStatus(OmcApiConstant.OrderStatusEnum.PAID.getCode());
			ModelMapper modelMapper = new ModelMapper();
			OmcOrder omcOrder = modelMapper.map(order, OmcOrder.class);
			omcOrderService.update(omcOrder);
		}

		PtcPayInfo payInfo = new PtcPayInfo();
		payInfo.setUserId(order.getUserId());
		payInfo.setOrderNo(order.getOrderNo());
		payInfo.setPayPlatform(PtcApiConstant.PayPlatformEnum.ALIPAY.getCode());
		payInfo.setPlatformNumber(tradeNo);
		payInfo.setPlatformStatus(tradeStatus);
		payInfo.setUpdateTime(new Date());
		payInfo.setCreatedTime(new Date());
		payInfo.setCreator(order.getCreator());

View on GitHub (pinned to 781281a950)