<?xml version="1.0" encoding="utf-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>SmartDukaan &#x2013; /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/service/inventory/B2cRefundQuote.java</title><description>WebSVN RSS feed &#x2013; SmartDukaan</description><lastBuildDate>Wed, 07 Oct 2026 05:10:09 +0530</lastBuildDate><generator>WebSVN 2.8.6-DEV</generator><language>en</language><link>https://svn.smartdukaan.com/log.php?repname=SmartDukaan&amp;path=%2Ftrunk%2Fprofitmandi-dao%2Fsrc%2Fmain%2Fjava%2Fcom%2Fspice%2Fprofitmandi%2Fservice%2Finventory%2FB2cRefundQuote.java&amp;max=40&amp;</link><atom:link href="https://svn.smartdukaan.com/rss.php?path=%2Ftrunk%2Fprofitmandi-dao%2Fsrc%2Fmain%2Fjava%2Fcom%2Fspice%2Fprofitmandi%2Fservice%2Finventory%2FB2cRefundQuote.java&amp;repname=SmartDukaan" rel="self" type="application/rss+xml" />
<item><pubDate>Mon, 28 Sep 2026 14:34:01 +0530</pubDate><dc:creator>amit</dc:creator><title>Rev 37790 – Return refund as B2C when NIC refuses the buyer&apos;s GSTIN ...</title><description>&lt;div&gt;&lt;strong&gt;amit – 13 file(s) modified&lt;/strong&gt;&lt;br/&gt;Return refund as B2C when NIC refuses the buyer&apos;s GSTIN&lt;br /&gt;
&lt;br /&gt;
A return whose credit note NIC refuses because the BUYER&apos;s GSTIN is&lt;br /&gt;
cancelled or invalid could not be settled at all: the approval threw, and&lt;br /&gt;
with it went the refund, the stock and the return rows (NSUPDL5176, Mobile&lt;br /&gt;
Hub, GSTIN 08DCUPD7948K1ZP). Where the invoice itself had never been filed&lt;br /&gt;
the return was instead refunded with no credit note at all, leaving the&lt;br /&gt;
refund undocumented.&lt;br /&gt;
&lt;br /&gt;
Raising the note automatically is not the answer - it is Finance&apos;s call,&lt;br /&gt;
and the GST on a cancelled-GSTIN sale is not recoverable, so paying the&lt;br /&gt;
full value back loses it. Both flows therefore record the refusal and stop.&lt;br /&gt;
&lt;br /&gt;
GstProService: getIrnFailureReason (NIC&apos;s refusal for an invoice),&lt;br /&gt;
isInvalidBuyerGstin (that refusal is about the buyer&apos;s registration -&lt;br /&gt;
deliberately NOT a state-code mismatch, which is a data error to fix and&lt;br /&gt;
retry, nor anything naming our own seller GSTIN) and briefIrnReason (one&lt;br /&gt;
plain-ASCII line of 128 chars; credit_note is latin1 and sql_mode is empty,&lt;br /&gt;
so anything else would store as &apos;?&apos;).&lt;br /&gt;
&lt;br /&gt;
PurchaseReturnServiceImpl: both the invoice-return and the debit-note&lt;br /&gt;
refund detect that refusal, record it through ReturnIrnFailureRecorder and&lt;br /&gt;
throw ReturnIrnGstinFailureException. The recorder commits in REQUIRES_NEW&lt;br /&gt;
because the approval it records is about to roll back, and it only inserts -&lt;br /&gt;
return_irn_failure carries no foreign key on purpose, since an FK check&lt;br /&gt;
would take a shared lock on the very PurchaseReturnOrder row the dying&lt;br /&gt;
transaction may still hold.&lt;br /&gt;
&lt;br /&gt;
Finance may then settle the return as B2C for the rest of that calendar day:&lt;br /&gt;
refundAsB2c credits the value NET of GST in whole rupees (B2cRefundQuote,&lt;br /&gt;
HALF_UP per line, so the line table and the total always agree), restores&lt;br /&gt;
the stock and issues a local credit note for exactly that amount with no tax&lt;br /&gt;
on its lines, no IRN and NIC&apos;s reason recorded. The amount is fixed - the&lt;br /&gt;
caller must pass back the quoted figure - and a remark and explicit consent&lt;br /&gt;
are required. On a later day the option only reopens after a fresh approval&lt;br /&gt;
attempt is refused again, so NIC is always re-checked first.&lt;br /&gt;
&lt;br /&gt;
Mails: every refusal notifies Accounts L2 and above; the B2C settlement&lt;br /&gt;
notifies them and the partner&apos;s Warehouse L1/L2, both tabulated.&lt;br /&gt;
&lt;br /&gt;
The partner account statement is unaffected: it skips RETURNS notes and&lt;br /&gt;
credits returns from returnorderinfo, so the new notes cannot double-credit.&lt;br /&gt;
&lt;br /&gt;
DEPLOY ORDER: apply sql/add_return_b2c_refund_20260921.sql BEFORE any war&lt;br /&gt;
built from this dao. CreditNote now maps irn_skip_reason and b2c, so every&lt;br /&gt;
credit-note read in web, fofo and cron fails until the columns exist.&lt;br /&gt;
Untested beyond compilation.&lt;/div&gt;+ /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/dao/entity/fofo/ReturnIrnFailure.java&lt;br /&gt;~ /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/dao/entity/transaction/CreditNote.java&lt;br /&gt;+ /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/dao/repository/fofo/ReturnIrnFailureRepository.java&lt;br /&gt;+ /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/dao/repository/fofo/ReturnIrnFailureRepositoryImpl.java&lt;br /&gt;~ /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/service/integrations/gstpro/GstProService.java&lt;br /&gt;+ /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/service/inventory/B2cRefundQuote.java&lt;br /&gt;~ /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/service/inventory/PurchaseReturnNotificationService.java&lt;br /&gt;~ /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/service/inventory/PurchaseReturnNotificationServiceImpl.java&lt;br /&gt;~ /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/service/inventory/PurchaseReturnService.java&lt;br /&gt;~ /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/service/inventory/PurchaseReturnServiceImpl.java&lt;br /&gt;+ /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/service/inventory/ReturnIrnFailureRecorder.java&lt;br /&gt;+ /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/service/inventory/ReturnIrnGstinFailureException.java&lt;br /&gt;+ /trunk/profitmandi-dao/src/main/resources/sql/add_return_b2c_refund_20260921.sql&lt;br /&gt;</description><link>https://svn.smartdukaan.com/revision.php?repname=SmartDukaan&amp;path=%2Ftrunk%2Fprofitmandi-dao%2Fsrc%2Fmain%2Fjava%2Fcom%2Fspice%2Fprofitmandi%2Fservice%2Finventory%2FB2cRefundQuote.java&amp;rev=37790</link><guid>https://svn.smartdukaan.com/revision.php?repname=SmartDukaan&amp;path=%2Ftrunk%2Fprofitmandi-dao%2Fsrc%2Fmain%2Fjava%2Fcom%2Fspice%2Fprofitmandi%2Fservice%2Finventory%2FB2cRefundQuote.java&amp;rev=37790</guid></item>
</channel></rss>