File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -136,6 +136,25 @@ Prepare a template that displays the form using its ``action`` and ``method``:
136
136
<p ><input type =" submit" value =" Proceed" /></p >
137
137
</form >
138
138
139
+ Mutating a `Payment ` instance
140
+ -----------------------------
141
+
142
+ When operating `BasePayment ` instances, care should be take to only save
143
+ changes atomically. If you were to load an instance into memory, mutate, and
144
+ then save it, you might overwrite fields that have been updated due to handling
145
+ a notification from the processor. Keep in mind that some processors implement
146
+ "at least once" notification delivery.
147
+
148
+ In general, you should either:
149
+
150
+ - Use atomic updates only specifying the relevant fields. For example, if the
151
+ application-local ``Payment `` class has a custom field named
152
+ ``discount_card_code ``, use
153
+ ``BasePayment.objects.filter(pk=payment_id).update(discount_card_code="123XYZ") ``.
154
+ This is the recommended approach.
155
+ - Lock the database row while mutating a python instance of ``BasePayment `` (may
156
+ negatively affect performance at scale).
157
+
139
158
.. _settings :
140
159
141
160
Additional Django settings
You can’t perform that action at this time.
0 commit comments