<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://ohcnwiki.tellmey.fyi/index.php?action=history&amp;feed=atom&amp;title=References%2FPayment_Reconciliation</id>
	<title>References/Payment Reconciliation - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://ohcnwiki.tellmey.fyi/index.php?action=history&amp;feed=atom&amp;title=References%2FPayment_Reconciliation"/>
	<link rel="alternate" type="text/html" href="https://ohcnwiki.tellmey.fyi/index.php?title=References/Payment_Reconciliation&amp;action=history"/>
	<updated>2026-07-06T07:11:33Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.4</generator>
	<entry>
		<id>https://ohcnwiki.tellmey.fyi/index.php?title=References/Payment_Reconciliation&amp;diff=439&amp;oldid=prev</id>
		<title>Admin: Automated edit (via update-page on MediaWiki MCP Server)</title>
		<link rel="alternate" type="text/html" href="https://ohcnwiki.tellmey.fyi/index.php?title=References/Payment_Reconciliation&amp;diff=439&amp;oldid=prev"/>
		<updated>2026-07-06T04:12:32Z</updated>

		<summary type="html">&lt;p&gt;Automated edit (via update-page on MediaWiki MCP Server)&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 09:42, 6 July 2026&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 280:&lt;/td&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 280:&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* Send &amp;lt;code&amp;gt;tendered_amount&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;returned_amount&amp;lt;/code&amp;gt; (both required); the server derives &amp;lt;code&amp;gt;amount&amp;lt;/code&amp;gt;, so any value you send for it is ignored.&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* Send &amp;lt;code&amp;gt;tendered_amount&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;returned_amount&amp;lt;/code&amp;gt; (both required); the server derives &amp;lt;code&amp;gt;amount&amp;lt;/code&amp;gt;, so any value you send for it is ignored.&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* &amp;lt;code&amp;gt;extensions&amp;lt;/code&amp;gt; holds custom key-value data without a schema migration, validated against registered handlers.&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* &amp;lt;code&amp;gt;extensions&amp;lt;/code&amp;gt; holds custom key-value data without a schema migration, validated against registered handlers.&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-empty diff-side-deleted&quot;&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-empty diff-side-deleted&quot;&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{Navbox billing}}&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{Related}}&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{Related}}&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-empty diff-side-deleted&quot;&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Wiki: ohcnwiki.tellmey.fyi&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;

&lt;!-- diff cache key mediawiki:diff:1.41:old-136:rev-439:wikidiff2=table:1.14.2:bc2a06be --&gt;
&lt;/table&gt;</summary>
		<author><name>Admin</name></author>
	</entry>
	<entry>
		<id>https://ohcnwiki.tellmey.fyi/index.php?title=References/Payment_Reconciliation&amp;diff=136&amp;oldid=prev</id>
		<title>Admin: OHC identity seed</title>
		<link rel="alternate" type="text/html" href="https://ohcnwiki.tellmey.fyi/index.php?title=References/Payment_Reconciliation&amp;diff=136&amp;oldid=prev"/>
		<updated>2026-07-04T22:44:13Z</updated>

		<summary type="html">&lt;p&gt;OHC identity seed&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Doc header&lt;br /&gt;
|type=reference&lt;br /&gt;
|domain=billing&lt;br /&gt;
|title=Payment Reconciliation&lt;br /&gt;
|order=5&lt;br /&gt;
|introduced=3.0&lt;br /&gt;
|model=PaymentReconciliation&lt;br /&gt;
|reference=References/Base models &amp;amp;amp; conventions&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;code&amp;gt;PaymentReconciliation&amp;lt;/code&amp;gt; is a single payment recorded against an &amp;lt;code&amp;gt;Account&amp;lt;/code&amp;gt;, and optionally allocated to one &amp;lt;code&amp;gt;Invoice&amp;lt;/code&amp;gt;. It captures how much was paid, by what method, when, and by whom — mirroring the FHIR [&amp;lt;nowiki/&amp;gt;https://build.fhir.org/paymentreconciliation.html &amp;lt;code&amp;gt;PaymentReconciliation&amp;lt;/code&amp;gt;] resource. Reach for it whenever you post a payment, refund, credit note, or adjustment to a patient or insurer account.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Source:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
* Model: [&amp;lt;nowiki/&amp;gt;https://github.com/ohcnetwork/care/blob/develop/care/emr/models/payment_reconciliation.py &amp;lt;code&amp;gt;care/emr/models/payment_reconciliation.py&amp;lt;/code&amp;gt;]&lt;br /&gt;
* Resource spec: [&amp;lt;nowiki/&amp;gt;https://github.com/ohcnetwork/care/blob/develop/care/emr/resources/payment_reconciliation/spec.py &amp;lt;code&amp;gt;care/emr/resources/payment_reconciliation/spec.py&amp;lt;/code&amp;gt;]&lt;br /&gt;
&lt;br /&gt;
The model is thin storage: enum-constrained fields are plain &amp;lt;code&amp;gt;CharField&amp;lt;/code&amp;gt;s and &amp;lt;code&amp;gt;extensions&amp;lt;/code&amp;gt; is an opaque &amp;lt;code&amp;gt;JSONField&amp;lt;/code&amp;gt;. The behaviour you integrate against — enum constraints, amount computation, validation, and the read/write schema split — lives in the Pydantic resource specs (&amp;lt;code&amp;gt;care/emr/resources/payment_reconciliation/spec.py&amp;lt;/code&amp;gt;), built on &amp;lt;code&amp;gt;EMRResource&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Models ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Model&lt;br /&gt;
! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;PaymentReconciliation&amp;lt;/code&amp;gt;&lt;br /&gt;
| A single payment (or credit note / adjustment) recorded against an account or invoice&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The model extends &amp;lt;code&amp;gt;EMRBaseModel&amp;lt;/code&amp;gt;, the shared Care EMR base supplying &amp;lt;code&amp;gt;external_id&amp;lt;/code&amp;gt;, audit fields, and soft-delete semantics — see [[References/Base models &amp;amp;amp; conventions|Base model]].&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;code&amp;gt;PaymentReconciliation&amp;lt;/code&amp;gt; fields ==&lt;br /&gt;
&lt;br /&gt;
=== Relationships ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Notes&lt;br /&gt;
{{Field|model=PaymentReconciliation|section=Relationships|name=facility|type=FK → Facility (PROTECT)|notes=Facility where the payment is recorded}}&lt;br /&gt;
{{Field|model=PaymentReconciliation|section=Relationships|name=target_invoice|type=FK → Invoice (PROTECT)|notes=The invoice this payment is allocated to. Nullable (&amp;lt;code&amp;gt;default=None&amp;lt;/code&amp;gt;); one allocation per record. On write, pass the invoice &amp;lt;code&amp;gt;external_id&amp;lt;/code&amp;gt; (UUID)}}&lt;br /&gt;
{{Field|model=PaymentReconciliation|section=Relationships|name=account|type=FK → Account (PROTECT)|notes=The account being paid. Required even when &amp;lt;code&amp;gt;target_invoice&amp;lt;/code&amp;gt; is set. On write, pass the account &amp;lt;code&amp;gt;external_id&amp;lt;/code&amp;gt; (UUID)}}&lt;br /&gt;
{{Field|model=PaymentReconciliation|section=Relationships|name=location|type=FK → FacilityLocation (PROTECT)|notes=Physical location (e.g. the counter) where payment was taken. Nullable. On write, pass the location &amp;lt;code&amp;gt;external_id&amp;lt;/code&amp;gt; (UUID)}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Classification ===&lt;br /&gt;
&lt;br /&gt;
Six columns map to fixed enums defined in the resource spec. Each is stored as a free-form &amp;lt;code&amp;gt;CharField(100)&amp;lt;/code&amp;gt;; the enum is enforced at the schema/API layer, not by the database. Full value lists are under [[#enum-values|enum values]].&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Spec enum&lt;br /&gt;
! Notes&lt;br /&gt;
{{Field|model=PaymentReconciliation|section=Classification|name=reconciliation_type|type=CharField(100)|notes=&amp;lt;code&amp;gt;PaymentReconciliationTypeOptions&amp;lt;/code&amp;gt;}}&lt;br /&gt;
{{Field|model=PaymentReconciliation|section=Classification|name=status|type=CharField(100)|notes=&amp;lt;code&amp;gt;PaymentReconciliationStatusOptions&amp;lt;/code&amp;gt;}}&lt;br /&gt;
{{Field|model=PaymentReconciliation|section=Classification|name=kind|type=CharField(100)|notes=&amp;lt;code&amp;gt;PaymentReconciliationKindOptions&amp;lt;/code&amp;gt;}}&lt;br /&gt;
{{Field|model=PaymentReconciliation|section=Classification|name=issuer_type|type=CharField(100)|notes=&amp;lt;code&amp;gt;PaymentReconciliationIssuerTypeOptions&amp;lt;/code&amp;gt;}}&lt;br /&gt;
{{Field|model=PaymentReconciliation|section=Classification|name=outcome|type=CharField(100)|notes=&amp;lt;code&amp;gt;PaymentReconciliationOutcomeOptions&amp;lt;/code&amp;gt;}}&lt;br /&gt;
{{Field|model=PaymentReconciliation|section=Classification|name=method|type=CharField(100)|notes=&amp;lt;code&amp;gt;PaymentReconciliationPaymentMethodOptions&amp;lt;/code&amp;gt;}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Payment details ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Notes&lt;br /&gt;
{{Field|model=PaymentReconciliation|section=Payment details|name=payment_datetime|type=DateTimeField → datetime | None|notes=When the payment was issued. Optional (default &amp;lt;code&amp;gt;None&amp;lt;/code&amp;gt;)}}&lt;br /&gt;
{{Field|model=PaymentReconciliation|section=Payment details|name=reference_number|type=CharField(1024) → str | None|notes=Cheque number or payment reference. Optional}}&lt;br /&gt;
{{Field|model=PaymentReconciliation|section=Payment details|name=authorization|type=CharField(1024) → str | None|notes=Authorization number. Optional}}&lt;br /&gt;
{{Field|model=PaymentReconciliation|section=Payment details|name=disposition|type=TextField → str | None|notes=Message describing the outcome. Optional}}&lt;br /&gt;
{{Field|model=PaymentReconciliation|section=Payment details|name=note|type=TextField → str | None|notes=Free-text note. Optional}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Amounts ===&lt;br /&gt;
&lt;br /&gt;
Every amount is a &amp;lt;code&amp;gt;DecimalField(max_digits=20, decimal_places=6)&amp;lt;/code&amp;gt;. Six decimal places allow sub-currency precision.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Notes&lt;br /&gt;
{{Field|model=PaymentReconciliation|section=Amounts|name=tendered_amount|type=Decimal(20, 6)|notes=Required on write. Amount offered by the issuer}}&lt;br /&gt;
{{Field|model=PaymentReconciliation|section=Amounts|name=returned_amount|type=Decimal(20, 6)|notes=Required on write. Amount returned to the issuer (e.g. change). Must be strictly less than &amp;lt;code&amp;gt;tendered_amount&amp;lt;/code&amp;gt;, or the write is rejected}}&lt;br /&gt;
{{Field|model=PaymentReconciliation|section=Amounts|name=amount|type=Decimal(20, 6)|notes=Net payment, computed server-side as &amp;lt;code&amp;gt;tendered_amount - returned_amount&amp;lt;/code&amp;gt;. A client-supplied value is always overwritten}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Flags &amp;amp;amp; extensions ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Notes&lt;br /&gt;
{{Field|model=PaymentReconciliation|section=Flags &amp;amp;amp; extensions|name=is_credit_note|type=BooleanField → bool|notes=Default &amp;lt;code&amp;gt;False&amp;lt;/code&amp;gt;. Marks the record as a credit note rather than an inbound payment}}&lt;br /&gt;
{{Field|model=PaymentReconciliation|section=Flags &amp;amp;amp; extensions|name=extensions|type=JSONField → dict|notes=Default &amp;lt;code&amp;gt;{}&amp;lt;/code&amp;gt;. Open extension bag. On write, each key is validated against the registered handler for resource type &amp;lt;code&amp;gt;payment_reconciliation&amp;lt;/code&amp;gt; — unknown keys are currently dropped. On retrieve, rendered through those handlers}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Enum values ==&lt;br /&gt;
&lt;br /&gt;
All enums are &amp;lt;code&amp;gt;str, Enum&amp;lt;/code&amp;gt; classes in [&amp;lt;nowiki/&amp;gt;https://github.com/ohcnetwork/care/blob/develop/care/emr/resources/payment_reconciliation/spec.py &amp;lt;code&amp;gt;spec.py&amp;lt;/code&amp;gt;].&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;PaymentReconciliationTypeOptions&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;reconciliation_type&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Value&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;payment&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;adjustment&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;advance&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;PaymentReconciliationStatusOptions&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;status&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Value&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;active&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;cancelled&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;draft&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;entered_in_error&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;PaymentReconciliationKindOptions&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;kind&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Value&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;deposit&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;periodic_payment&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;online&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;kiosk&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;PaymentReconciliationIssuerTypeOptions&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;issuer_type&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Value&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;patient&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;insurer&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;PaymentReconciliationOutcomeOptions&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;outcome&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Value&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;queued&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;complete&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;error&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;partial&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;PaymentReconciliationPaymentMethodOptions&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;method&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
HL7 v2-0570 payment-method codes.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Value&lt;br /&gt;
! HL7 meaning&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;cash&amp;lt;/code&amp;gt;&lt;br /&gt;
| Cash&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;ccca&amp;lt;/code&amp;gt;&lt;br /&gt;
| Credit card&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;cchk&amp;lt;/code&amp;gt;&lt;br /&gt;
| Cashier&amp;#039;s check&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;cdac&amp;lt;/code&amp;gt;&lt;br /&gt;
| Credit/debit account&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;chck&amp;lt;/code&amp;gt;&lt;br /&gt;
| Check&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;ddpo&amp;lt;/code&amp;gt;&lt;br /&gt;
| Direct deposit&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;debc&amp;lt;/code&amp;gt;&lt;br /&gt;
| Debit card&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Resource specs (API schema) ==&lt;br /&gt;
&lt;br /&gt;
Defined in [&amp;lt;nowiki/&amp;gt;https://github.com/ohcnetwork/care/blob/develop/care/emr/resources/payment_reconciliation/spec.py &amp;lt;code&amp;gt;care/emr/resources/payment_reconciliation/spec.py&amp;lt;/code&amp;gt;]. All extend &amp;lt;code&amp;gt;EMRResource&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;serialize&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;de_serialize&amp;lt;/code&amp;gt;, with &amp;lt;code&amp;gt;perform_extra_serialization&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;perform_extra_deserialization&amp;lt;/code&amp;gt; hooks). See [[References/Base models &amp;amp;amp; conventions|Base model]].&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Spec class&lt;br /&gt;
! Role&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;BasePaymentReconciliationSpec&amp;lt;/code&amp;gt;&lt;br /&gt;
| shared base&lt;br /&gt;
| Holds &amp;lt;code&amp;gt;id&amp;lt;/code&amp;gt;, the six enum fields, &amp;lt;code&amp;gt;disposition&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;payment_datetime&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;method&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;reference_number&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;authorization&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;note&amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt;__exclude__ = [&amp;amp;quot;target_invoice&amp;amp;quot;, &amp;amp;quot;account&amp;amp;quot;]&amp;lt;/code&amp;gt; (FKs handled in hooks). &amp;lt;code&amp;gt;___extension_resource_type__ = payment_reconciliation&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;PaymentReconciliationWriteSpec&amp;lt;/code&amp;gt;&lt;br /&gt;
| write · create &amp;amp;amp; update&lt;br /&gt;
| Adds &amp;lt;code&amp;gt;target_invoice&amp;lt;/code&amp;gt; (UUID, optional), &amp;lt;code&amp;gt;account&amp;lt;/code&amp;gt; (UUID, required), &amp;lt;code&amp;gt;tendered_amount&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;returned_amount&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;amount&amp;lt;/code&amp;gt; (optional), &amp;lt;code&amp;gt;is_credit_note&amp;lt;/code&amp;gt; (default &amp;lt;code&amp;gt;False&amp;lt;/code&amp;gt;), &amp;lt;code&amp;gt;location&amp;lt;/code&amp;gt; (UUID, optional). Mixes in &amp;lt;code&amp;gt;ExtensionValidator&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;PaymentReconciliationMinimalReadSpec&amp;lt;/code&amp;gt;&lt;br /&gt;
| read · list&lt;br /&gt;
| Adds &amp;lt;code&amp;gt;amount&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;tendered_amount&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;returned_amount&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;is_credit_note&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;created_date&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;modified_date&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;PaymentReconciliationReadSpec&amp;lt;/code&amp;gt;&lt;br /&gt;
| read · detail (nested)&lt;br /&gt;
| Extends minimal read; adds &amp;lt;code&amp;gt;account: dict&amp;lt;/code&amp;gt; (serialized via &amp;lt;code&amp;gt;AccountReadSpec&amp;lt;/code&amp;gt;) and &amp;lt;code&amp;gt;target_invoice: dict | None&amp;lt;/code&amp;gt; (serialized via &amp;lt;code&amp;gt;InvoiceReadSpec&amp;lt;/code&amp;gt;)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;PaymentReconciliationRetrieveSpec&amp;lt;/code&amp;gt;&lt;br /&gt;
| read · full retrieve&lt;br /&gt;
| Extends read; adds &amp;lt;code&amp;gt;location: dict | None&amp;lt;/code&amp;gt; (via &amp;lt;code&amp;gt;FacilityLocationListSpec&amp;lt;/code&amp;gt;), &amp;lt;code&amp;gt;extensions: dict&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;created_by&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;updated_by&amp;lt;/code&amp;gt;. Also injects &amp;lt;code&amp;gt;account.patient&amp;lt;/code&amp;gt; via &amp;lt;code&amp;gt;PatientRetrieveSpec&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Write validation &amp;amp;amp; side effects ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;PaymentReconciliationWriteSpec&amp;lt;/code&amp;gt; runs three steps:&lt;br /&gt;
&lt;br /&gt;
* The amount validator (&amp;lt;code&amp;gt;model_validator(mode=&amp;amp;quot;after&amp;amp;quot;)&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;check_amount_or_factor&amp;lt;/code&amp;gt;) raises &amp;lt;code&amp;gt;&amp;amp;quot;Returned amount cannot be greater than tendered amount&amp;amp;quot;&amp;lt;/code&amp;gt; when &amp;lt;code&amp;gt;returned_amount &amp;amp;gt;= tendered_amount&amp;lt;/code&amp;gt;, then sets &amp;lt;code&amp;gt;amount = tendered_amount - returned_amount&amp;lt;/code&amp;gt;. The spec&amp;#039;s &amp;lt;code&amp;gt;amount&amp;lt;/code&amp;gt; field is advisory and always recomputed.&lt;br /&gt;
* &amp;lt;code&amp;gt;perform_extra_deserialization(is_update, obj)&amp;lt;/code&amp;gt; resolves the FK UUIDs to model instances:&lt;br /&gt;
** &amp;lt;code&amp;gt;target_invoice&amp;lt;/code&amp;gt; (if provided) → &amp;lt;code&amp;gt;Invoice.objects.get(external_id=...)&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;account&amp;lt;/code&amp;gt; (required) → &amp;lt;code&amp;gt;Account.objects.get(external_id=...)&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;location&amp;lt;/code&amp;gt; (if provided) → &amp;lt;code&amp;gt;FacilityLocation.objects.get(external_id=...)&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;ExtensionValidator.validate_extensions&amp;lt;/code&amp;gt; checks &amp;lt;code&amp;gt;extensions&amp;lt;/code&amp;gt; against the &amp;lt;code&amp;gt;payment_reconciliation&amp;lt;/code&amp;gt; extension registry before save.&lt;br /&gt;
&lt;br /&gt;
=== Read serialization side effects ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;PaymentReconciliationMinimalReadSpec.perform_extra_serialization&amp;lt;/code&amp;gt; maps &amp;lt;code&amp;gt;id&amp;lt;/code&amp;gt; ← &amp;lt;code&amp;gt;obj.external_id&amp;lt;/code&amp;gt;.&lt;br /&gt;
* &amp;lt;code&amp;gt;PaymentReconciliationReadSpec&amp;lt;/code&amp;gt; serializes the related &amp;lt;code&amp;gt;account&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;AccountReadSpec&amp;lt;/code&amp;gt;) and, when present, &amp;lt;code&amp;gt;target_invoice&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;InvoiceReadSpec&amp;lt;/code&amp;gt;) into nested objects.&lt;br /&gt;
* &amp;lt;code&amp;gt;PaymentReconciliationRetrieveSpec&amp;lt;/code&amp;gt; additionally nests the account&amp;#039;s &amp;lt;code&amp;gt;patient&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;PatientRetrieveSpec&amp;lt;/code&amp;gt;, scoped to the account&amp;#039;s facility), the &amp;lt;code&amp;gt;location&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;FacilityLocationListSpec&amp;lt;/code&amp;gt;), the raw &amp;lt;code&amp;gt;extensions&amp;lt;/code&amp;gt;, and audit users (&amp;lt;code&amp;gt;created_by&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;updated_by&amp;lt;/code&amp;gt; via &amp;lt;code&amp;gt;serialize_audit_users&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
== Related models ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;PaymentReconciliation&amp;lt;/code&amp;gt; is self-contained; its foreign keys reach into the billing and facility domains:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;text&amp;quot;&amp;gt;facility       → FK Facility (PROTECT)&lt;br /&gt;
target_invoice → FK Invoice (PROTECT, nullable)&lt;br /&gt;
account        → FK Account (PROTECT)&lt;br /&gt;
location       → FK FacilityLocation (PROTECT, nullable)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Each foreign key uses &amp;lt;code&amp;gt;on_delete=PROTECT&amp;lt;/code&amp;gt;, so a payment record blocks deletion of the facility, invoice, account, or location it references.&lt;br /&gt;
&lt;br /&gt;
== Methods &amp;amp;amp; save behaviour ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;PaymentReconciliation&amp;lt;/code&amp;gt; defines no custom &amp;lt;code&amp;gt;save()&amp;lt;/code&amp;gt;; it inherits &amp;lt;code&amp;gt;EMRBaseModel&amp;lt;/code&amp;gt; behaviour (audit fields, &amp;lt;code&amp;gt;external_id&amp;lt;/code&amp;gt;, soft delete). Everything below happens in the write spec, not the model:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;amount&amp;lt;/code&amp;gt; is derived, not stored as sent. On every create and update the write spec computes &amp;lt;code&amp;gt;amount = tendered_amount - returned_amount&amp;lt;/code&amp;gt; and rejects &amp;lt;code&amp;gt;returned_amount &amp;amp;gt;= tendered_amount&amp;lt;/code&amp;gt;.&lt;br /&gt;
* FK resolution happens in &amp;lt;code&amp;gt;perform_extra_deserialization&amp;lt;/code&amp;gt;: &amp;lt;code&amp;gt;external_id&amp;lt;/code&amp;gt; UUIDs for &amp;lt;code&amp;gt;account&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;target_invoice&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;location&amp;lt;/code&amp;gt; resolve to instances at de-serialization time.&lt;br /&gt;
* &amp;lt;code&amp;gt;extensions&amp;lt;/code&amp;gt; are validated against the &amp;lt;code&amp;gt;payment_reconciliation&amp;lt;/code&amp;gt; registry on write and rendered through registered handlers on retrieve.&lt;br /&gt;
&lt;br /&gt;
== API integration notes ==&lt;br /&gt;
&lt;br /&gt;
* Create and update use &amp;lt;code&amp;gt;PaymentReconciliationWriteSpec&amp;lt;/code&amp;gt;; list responses use &amp;lt;code&amp;gt;PaymentReconciliationMinimalReadSpec&amp;lt;/code&amp;gt;; detail and retrieve responses use &amp;lt;code&amp;gt;PaymentReconciliationReadSpec&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;PaymentReconciliationRetrieveSpec&amp;lt;/code&amp;gt;.&lt;br /&gt;
* &amp;lt;code&amp;gt;account&amp;lt;/code&amp;gt; is always required; &amp;lt;code&amp;gt;target_invoice&amp;lt;/code&amp;gt; is optional and allocates the payment to one invoice. Pass &amp;lt;code&amp;gt;account&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;target_invoice&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;location&amp;lt;/code&amp;gt; as &amp;lt;code&amp;gt;external_id&amp;lt;/code&amp;gt; UUIDs.&lt;br /&gt;
* The Pydantic schema constrains the six classification fields (&amp;lt;code&amp;gt;reconciliation_type&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;status&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;kind&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;issuer_type&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;outcome&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;method&amp;lt;/code&amp;gt;) to the enums above and rejects invalid values, even though each column is a plain &amp;lt;code&amp;gt;CharField&amp;lt;/code&amp;gt;.&lt;br /&gt;
* Send &amp;lt;code&amp;gt;tendered_amount&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;returned_amount&amp;lt;/code&amp;gt; (both required); the server derives &amp;lt;code&amp;gt;amount&amp;lt;/code&amp;gt;, so any value you send for it is ignored.&lt;br /&gt;
* &amp;lt;code&amp;gt;extensions&amp;lt;/code&amp;gt; holds custom key-value data without a schema migration, validated against registered handlers.&lt;br /&gt;
&lt;br /&gt;
{{Related}}&lt;/div&gt;</summary>
		<author><name>Admin</name></author>
	</entry>
</feed>