| Line 9... |
Line 9... |
| 9 |
import com.spice.profitmandi.dao.entity.auth.AuthUser;
|
9 |
import com.spice.profitmandi.dao.entity.auth.AuthUser;
|
| 10 |
import com.spice.profitmandi.dao.entity.brandFee.BrandFee;
|
10 |
import com.spice.profitmandi.dao.entity.brandFee.BrandFee;
|
| 11 |
import com.spice.profitmandi.dao.entity.brandFee.BrandFeeCollection;
|
11 |
import com.spice.profitmandi.dao.entity.brandFee.BrandFeeCollection;
|
| 12 |
import com.spice.profitmandi.dao.entity.dtr.Otp;
|
12 |
import com.spice.profitmandi.dao.entity.dtr.Otp;
|
| 13 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
13 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
| - |
|
14 |
import com.spice.profitmandi.dao.entity.fofo.PartnerOnBoardingPanel;
|
| - |
|
15 |
import com.spice.profitmandi.dao.entity.fofo.PartnerOnboardingTrainingPanel;
|
| 14 |
import com.spice.profitmandi.dao.entity.fofo.PaymentOption;
|
16 |
import com.spice.profitmandi.dao.entity.fofo.PaymentOption;
|
| 15 |
import com.spice.profitmandi.dao.entity.onBoarding.*;
|
17 |
import com.spice.profitmandi.dao.entity.onBoarding.*;
|
| 16 |
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
|
18 |
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
|
| 17 |
import com.spice.profitmandi.dao.enumuration.dtr.OtpType;
|
19 |
import com.spice.profitmandi.dao.enumuration.dtr.OtpType;
|
| 18 |
import com.spice.profitmandi.dao.enumuration.dtr.StoreTimeline;
|
20 |
import com.spice.profitmandi.dao.enumuration.dtr.StoreTimeline;
|
| 19 |
import com.spice.profitmandi.dao.enumuration.onBorading.OnboardingType;
|
21 |
import com.spice.profitmandi.dao.enumuration.onBorading.OnboardingType;
|
| 20 |
import com.spice.profitmandi.dao.enumuration.onBorading.onBoardingFormEnums.FeePaymentStatus;
|
22 |
import com.spice.profitmandi.dao.enumuration.onBorading.onBoardingFormEnums.FeePaymentStatus;
|
| 21 |
import com.spice.profitmandi.dao.enumuration.onBorading.onBoardingFormEnums.LoiStatus;
|
23 |
import com.spice.profitmandi.dao.enumuration.onBorading.onBoardingFormEnums.LoiStatus;
|
| 22 |
import com.spice.profitmandi.dao.enumuration.onBorading.onBoardingFormEnums.StoreType;
|
24 |
import com.spice.profitmandi.dao.enumuration.onBorading.onBoardingFormEnums.StoreType;
|
| - |
|
25 |
import com.spice.profitmandi.dao.enumuration.transaction.PartnerOnBoardingStatus;
|
| 23 |
import com.spice.profitmandi.dao.model.LoiFormModel;
|
26 |
import com.spice.profitmandi.dao.model.LoiFormModel;
|
| 24 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
27 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
| 25 |
import com.spice.profitmandi.dao.repository.brandFee.BrandFeeCollectionRepository;
|
28 |
import com.spice.profitmandi.dao.repository.brandFee.BrandFeeCollectionRepository;
|
| 26 |
import com.spice.profitmandi.dao.repository.brandFee.BrandFeeRepository;
|
29 |
import com.spice.profitmandi.dao.repository.brandFee.BrandFeeRepository;
|
| 27 |
import com.spice.profitmandi.dao.repository.catalog.BrandCategoryRepository;
|
30 |
import com.spice.profitmandi.dao.repository.catalog.BrandCategoryRepository;
|
| Line 140... |
Line 143... |
| 140 |
|
143 |
|
| 141 |
@Autowired
|
144 |
@Autowired
|
| 142 |
AgreementEsignRepository agreementEsignRepository;
|
145 |
AgreementEsignRepository agreementEsignRepository;
|
| 143 |
|
146 |
|
| 144 |
@Autowired
|
147 |
@Autowired
|
| - |
|
148 |
PartnerDashboardTrainingRepository partnerDashboardTrainingRepository;
|
| - |
|
149 |
|
| - |
|
150 |
@Autowired
|
| 145 |
ResponseSender responseSender;
|
151 |
ResponseSender responseSender;
|
| 146 |
|
152 |
|
| 147 |
List<String> agreedBrandFeeChangerEmail = Arrays.asList("kamini.sharma@smartdukaan.com");
|
153 |
List<String> agreedBrandFeeChangerEmail = Arrays.asList("kamini.sharma@smartdukaan.com");
|
| 148 |
|
154 |
|
| 149 |
// Loi Form
|
155 |
// Loi Form
|
| Line 686... |
Line 692... |
| 686 |
}
|
692 |
}
|
| 687 |
|
693 |
|
| 688 |
// For a REVIVAL LOI whose brand-fee payment just got confirmed:
|
694 |
// For a REVIVAL LOI whose brand-fee payment just got confirmed:
|
| 689 |
// 1. Reactivate the FofoStore behind the old code so orders / wallet / inventory
|
695 |
// 1. Reactivate the FofoStore behind the old code so orders / wallet / inventory
|
| 690 |
// start honoring the store again.
|
696 |
// start honoring the store again.
|
| 691 |
// 2. Wipe the previous partner-life's AGREEMENT_ESIGN + PO_CREATION + PO_APPROVAL
|
697 |
// 2. Wipe all Store Setup + Launch timeline events (RECCE, WOD, FIN_CODE,
|
| - |
|
698 |
// WOD_FINANCE_MAPPING, BRANDING, ADVANCE_STOCK_PAYMENT, FULL_STOCK_PAYMENT,
|
| - |
|
699 |
// AGREEMENT_ESIGN, PO_CREATION, PO_APPROVAL, BILLING, INAUGRATION, TRAINING)
|
| - |
|
700 |
// plus RBM_ASSIGNMENT so the revived partner has to redo the full lifecycle.
|
| - |
|
701 |
// Kept from old life: ON_BOARDING, VERIFICATION, STORE_CODE_CREATED,
|
| - |
|
702 |
// DOCUMENTS, WELCOME_CALL — partner is already known + verified.
|
| - |
|
703 |
// 3. Reset the backing panel fields (billingStatus, inaugrationDate,
|
| - |
|
704 |
// deploymentDate, receeActual, status) and the training panel's
|
| 692 |
// timeline rows on the reused onboarding so the partner appears back on the
|
705 |
// appTraining / dashboardTraning flags so the events can actually re-fire.
|
| 693 |
// agreement-esign panel and gaurav.sharma can re-verify a freshly signed doc.
|
706 |
// 4. Wipe the AgreementEsign record so the upload widget starts blank.
|
| 694 |
// No-op for NEW and ANY_OTHER LOIs.
|
707 |
// No-op for NEW and ANY_OTHER LOIs.
|
| 695 |
private void applyRevivalPaymentHooks(LoiForm loi) throws ProfitMandiBusinessException {
|
708 |
private void applyRevivalPaymentHooks(LoiForm loi) throws ProfitMandiBusinessException {
|
| 696 |
if (loi == null || loi.getOnboardingType() != OnboardingType.REVIVAL) return;
|
709 |
if (loi == null || loi.getOnboardingType() != OnboardingType.REVIVAL) return;
|
| 697 |
String oldCode = loi.getOldStoreCode();
|
710 |
String oldCode = loi.getOldStoreCode();
|
| 698 |
if (oldCode != null && !oldCode.trim().isEmpty()) {
|
711 |
if (oldCode != null && !oldCode.trim().isEmpty()) {
|
| Line 704... |
Line 717... |
| 704 |
LOGGER.info("Revival PAYMENT_APPROVAL: reactivated FofoStore code=" + oldCode);
|
717 |
LOGGER.info("Revival PAYMENT_APPROVAL: reactivated FofoStore code=" + oldCode);
|
| 705 |
}
|
718 |
}
|
| 706 |
}
|
719 |
}
|
| 707 |
int onboardingId = loi.getOnBoardingId();
|
720 |
int onboardingId = loi.getOnBoardingId();
|
| 708 |
if (onboardingId > 0) {
|
721 |
if (onboardingId > 0) {
|
| - |
|
722 |
StoreTimeline[] revivalClearEvents = {
|
| - |
|
723 |
StoreTimeline.RECCE,
|
| - |
|
724 |
StoreTimeline.WOD,
|
| - |
|
725 |
StoreTimeline.FIN_CODE,
|
| - |
|
726 |
StoreTimeline.WOD_FINANCE_MAPPING,
|
| - |
|
727 |
StoreTimeline.BRANDING,
|
| - |
|
728 |
StoreTimeline.ADVANCE_STOCK_PAYMENT,
|
| - |
|
729 |
StoreTimeline.FULL_STOCK_PAYMENT,
|
| 709 |
storeTimelinetbRepository.deleteByOnboardingIdAndEvent(onboardingId, StoreTimeline.AGREEMENT_ESIGN);
|
730 |
StoreTimeline.AGREEMENT_ESIGN,
|
| 710 |
storeTimelinetbRepository.deleteByOnboardingIdAndEvent(onboardingId, StoreTimeline.PO_CREATION);
|
731 |
StoreTimeline.PO_CREATION,
|
| - |
|
732 |
StoreTimeline.PO_APPROVAL,
|
| - |
|
733 |
StoreTimeline.BILLING,
|
| - |
|
734 |
StoreTimeline.INAUGRATION,
|
| - |
|
735 |
StoreTimeline.TRAINING,
|
| - |
|
736 |
StoreTimeline.RBM_ASSIGNMENT
|
| - |
|
737 |
};
|
| - |
|
738 |
for (StoreTimeline ev : revivalClearEvents) {
|
| 711 |
storeTimelinetbRepository.deleteByOnboardingIdAndEvent(onboardingId, StoreTimeline.PO_APPROVAL);
|
739 |
storeTimelinetbRepository.deleteByOnboardingIdAndEvent(onboardingId, ev);
|
| - |
|
740 |
}
|
| 712 |
agreementEsignRepository.deleteByOnboardingId(onboardingId);
|
741 |
agreementEsignRepository.deleteByOnboardingId(onboardingId);
|
| - |
|
742 |
|
| - |
|
743 |
PartnerOnBoardingPanel panel = partnerOnBoardingPanelRepository.selectById(onboardingId);
|
| - |
|
744 |
if (panel != null) {
|
| - |
|
745 |
panel.setBillingStatus(0);
|
| - |
|
746 |
panel.setInaugrationDate(null);
|
| - |
|
747 |
panel.setDeploymentDate(null);
|
| - |
|
748 |
panel.setReceeActual(null);
|
| - |
|
749 |
panel.setStatus(PartnerOnBoardingStatus.pending);
|
| - |
|
750 |
panel.setUpdatedTimestamp(LocalDateTime.now());
|
| - |
|
751 |
partnerOnBoardingPanelRepository.persist(panel);
|
| - |
|
752 |
}
|
| - |
|
753 |
|
| - |
|
754 |
PartnerOnboardingTrainingPanel training = partnerDashboardTrainingRepository.selectByOnboardingId(onboardingId);
|
| - |
|
755 |
if (training != null) {
|
| - |
|
756 |
training.setAppTraining(null);
|
| - |
|
757 |
training.setDashboardTraning(null);
|
| - |
|
758 |
training.setDateCompleted(null);
|
| - |
|
759 |
training.setUpdateTimestamp(LocalDateTime.now());
|
| - |
|
760 |
partnerDashboardTrainingRepository.persist(training);
|
| - |
|
761 |
}
|
| - |
|
762 |
|
| - |
|
763 |
LOGGER.info("Revival PAYMENT_APPROVAL: cleared " + revivalClearEvents.length
|
| 713 |
LOGGER.info("Revival PAYMENT_APPROVAL: cleared AGREEMENT_ESIGN + PO_CREATION + PO_APPROVAL + AgreementEsign row for onboardingId=" + onboardingId);
|
764 |
+ " timeline events + AgreementEsign + reset panel/training state for onboardingId=" + onboardingId);
|
| 714 |
}
|
765 |
}
|
| 715 |
}
|
766 |
}
|
| 716 |
}
|
767 |
}
|