<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: programmings 360</title>
    <description>The latest articles on DEV Community by programmings 360 (@programmings_360_091d4c5a).</description>
    <link>https://dev.to/programmings_360_091d4c5a</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3472830%2Fd688247b-593d-408f-bfa5-d95f4a291b56.jpg</url>
      <title>DEV Community: programmings 360</title>
      <link>https://dev.to/programmings_360_091d4c5a</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/programmings_360_091d4c5a"/>
    <language>en</language>
    <item>
      <title>What happens when an offline POS sale syncs twice?</title>
      <dc:creator>programmings 360</dc:creator>
      <pubDate>Fri, 20 Nov 2026 17:50:15 +0000</pubDate>
      <link>https://dev.to/programmings_360_091d4c5a/what-happens-when-an-offline-pos-sale-syncs-twice-338n</link>
      <guid>https://dev.to/programmings_360_091d4c5a/what-happens-when-an-offline-pos-sale-syncs-twice-338n</guid>
      <description>&lt;p&gt;A cashier completes a sale while the connection is down. Later, the server saves it, but the response never reaches the device. The app retries. Without a way to recognize the original request, the second attempt can create a second receipt and deduct stock again.&lt;/p&gt;

&lt;h2&gt;
  
  
  Give each sale a stable ID
&lt;/h2&gt;

&lt;p&gt;Generate a client sale ID when checkout starts. Save it with the completed sale and the pending sync entry in one local transaction. Keep that same ID through retries and app restarts.&lt;/p&gt;

&lt;h2&gt;
  
  
  Make the server retry-safe
&lt;/h2&gt;

&lt;p&gt;Use a unique database constraint scoped to the store and client sale ID. Commit the sale and its stock movements together. When the same ID arrives with the same payload, return the existing receipt. If the payload differs, return a conflict so the app can surface it for review.&lt;/p&gt;

&lt;h2&gt;
  
  
  Test the lost acknowledgement
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Complete a sale offline.&lt;/li&gt;
&lt;li&gt;Reconnect and let the server commit it, then simulate a dropped response.&lt;/li&gt;
&lt;li&gt;Restart the app and retry the pending sale.&lt;/li&gt;
&lt;li&gt;Verify that the receipt number is unchanged and inventory moved exactly once.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Treat a timeout as an unknown outcome. A stable ID gives the client a way to recover the receipt without guessing what happened.&lt;/p&gt;

&lt;p&gt;— &lt;a href="https://programmings360.vercel.app/" rel="noopener noreferrer"&gt;Programmings 360&lt;/a&gt;&lt;/p&gt;

</description>
      <category>architecture</category>
      <category>backend</category>
      <category>database</category>
    </item>
    <item>
      <title>Three checks for a retail POS when the network drops</title>
      <dc:creator>programmings 360</dc:creator>
      <pubDate>Fri, 20 Nov 2026 10:15:03 +0000</pubDate>
      <link>https://dev.to/programmings_360_091d4c5a/three-checks-for-a-retail-pos-when-the-network-drops-46ob</link>
      <guid>https://dev.to/programmings_360_091d4c5a/three-checks-for-a-retail-pos-when-the-network-drops-46ob</guid>
      <description>&lt;p&gt;A cashier can lose connectivity after submitting a sale. At that point, the app may have no response even though the server recorded the transaction. When I worked on Devify POS, the Android checkout and receipt flows made this a practical design question. Offline synchronization is still being developed. These are the checks I would use to verify it.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Retry the same sale
&lt;/h2&gt;

&lt;p&gt;Give each checkout attempt a stable ID. If the server already accepted that ID, a retry should return the existing sale. Test by dropping the connection after the server accepts the request, then submitting again. Check that there is one sale and one set of stock movements.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Keep stock movements tied to the sale
&lt;/h2&gt;

&lt;p&gt;At the API boundary, record the sale and its inventory movements in a single database transaction. Test with two variants of the same product. Sell one variant and verify that its stock changes exactly once and the other variant stays untouched.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Reprint without running checkout again
&lt;/h2&gt;

&lt;p&gt;A disconnected printer should leave the sale visible so the cashier can reprint it from the existing record. Test by turning off the printer during checkout and reconnecting it. Verify that the reprint uses the original sale reference.&lt;/p&gt;

&lt;p&gt;These checks apply to any Android checkout backed by a Laravel API. My web and mobile project work is available at &lt;a href="https://programmings360.vercel.app/" rel="noopener noreferrer"&gt;Programmings 360&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>android</category>
      <category>architecture</category>
      <category>mobile</category>
      <category>testing</category>
    </item>
  </channel>
</rss>
