Subversion Repositories SmartDukaan

Rev

Rev 37156 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 37156 Rev 37168
Line 453... Line 453...
453
                throw new ProfitMandiBusinessException("Closed store exists", store.getCode(),
453
                throw new ProfitMandiBusinessException("Closed store exists", store.getCode(),
454
                        "Old store " + store.getCode() + " is closed. Re-onboard using the partner's existing email "
454
                        "Old store " + store.getCode() + " is closed. Re-onboard using the partner's existing email "
455
                                + byMobile.getEmailId() + " and a new code will be issued automatically.");
455
                                + byMobile.getEmailId() + " and a new code will be issued automatically.");
456
            }
456
            }
457
        }
457
        }
-
 
458
        // Same GST is normal (one GSTIN per entity per state; parallel outlets share it).
-
 
459
        // Block only when a sibling store is in limbo: dormant (REVIVAL) or deactivated
-
 
460
        // without being closed — the signature of a revival being forked instead of the
458
        if (!updateRetailerRequest.isAllowAdditionalOutlet()) {
461
        // old code being closed or revived in place.
459
            List<FofoStore> openGstStores = fofoStoreRepository.selectAllOpenByGstNumber(updateRetailerRequest.getGstNumber());
462
        List<FofoStore> limboGstStores = fofoStoreRepository.selectAllOpenByGstNumber(updateRetailerRequest.getGstNumber())
-
 
463
                .stream()
-
 
464
                .filter(s -> !s.isInternal())
-
 
465
                .filter(s -> s.getActivationType() == ActivationType.REVIVAL || !s.isActive())
-
 
466
                .collect(Collectors.toList());
460
            if (!openGstStores.isEmpty()) {
467
        if (!limboGstStores.isEmpty()) {
461
                String codes = openGstStores.stream().map(FofoStore::getCode).collect(Collectors.joining(", "));
468
            String codes = limboGstStores.stream().map(FofoStore::getCode).collect(Collectors.joining(", "));
462
                throw new ProfitMandiBusinessException("Open store exists for GST", codes,
469
            throw new ProfitMandiBusinessException("Dormant store exists for GST", codes,
463
                        "GST " + updateRetailerRequest.getGstNumber() + " already has open store(s) " + codes
470
                    "GST " + updateRetailerRequest.getGstNumber() + " has store(s) " + codes
464
                                + ". Close the old store first, or tick 'Additional outlet for same GST' if this is genuinely a new outlet.");
471
                            + " that are dormant or deactivated but not closed. Close them or revive them on the same code before creating a new store.");
465
            }
-
 
466
        }
472
        }
467
    }
473
    }
468
 
474
 
469
    private void takeoverClosedStoreIdentity(FofoStore oldStore, Map<String, Object> map) {
475
    private void takeoverClosedStoreIdentity(FofoStore oldStore, Map<String, Object> map) {
470
        // Mandate: closed stores are never reopened. Re-onboarding with the partner's
476
        // Mandate: closed stores are never reopened. Re-onboarding with the partner's