# payment — fact_settlement_mode_out
# 消费 transforms 输出表 payment_rows(transforms.pick_first_nonzero 已推 payment_channel)
canonical: payment

emits:
  action: payment_received
  subjectType: payment
  occurredAtField: paidAt

primary:
  table: payment_rows
  key: id

field_mapping:
  externalId:        id
  patientExternalId: patient_id
  clinicId:          organization_id
  paidAt:            rq
  amount:            settlement_money   # FieldMapper.normalize 按 amount_unit=yuan 转 cents
  method:            payment_channel    # transforms.pick_first_nonzero 推断的主导支付通道
  orderExternalId:   registration_id
