Subversion Repositories SmartDukaan

Rev

Rev 37794 | View as "text/plain" | Blame | Compare with Previous | Last modification | View Log | RSS feed

package com.spice.profitmandi.service;

import com.spice.profitmandi.common.enumuration.MessageType;
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
import com.spice.profitmandi.common.model.NotificationTargetCriteria;
import com.spice.profitmandi.common.model.SendNotificationModel;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Set;

@Service
public interface NotificationService {
        void sendNotification(SendNotificationModel sendNotificationModel) throws ProfitMandiBusinessException;

    void dispatchScheduled(int scheduleId) throws ProfitMandiBusinessException;

    int dispatchDueScheduled(int batchSize) throws ProfitMandiBusinessException;

    boolean cancelSchedule(int scheduleId);

    int addScheduleForCampaign(int campaignId, LocalDateTime scheduledAt) throws ProfitMandiBusinessException;

    int resolveAudienceSize(NotificationTargetCriteria criteria) throws ProfitMandiBusinessException;

    Set<Integer> resolveTargetUserIds(NotificationTargetCriteria criteria) throws ProfitMandiBusinessException;

        void sendNotificationToAll(SendNotificationModel sendNotificationModel) throws ProfitMandiBusinessException;

        void sendNotificationToSystemUsers(SendNotificationModel sendNotificationModel) throws ProfitMandiBusinessException;

        void sendNotification(int fofoId, String campaignName, MessageType messageType, String title, String message) throws ProfitMandiBusinessException;

        void sendNotification(int fofoId, String campaignName, MessageType messageType, String title, String message, String Url) throws ProfitMandiBusinessException;

        // ── WhatsApp ──────────────────────────────────────────────────────────────
        // One method per business event, each taking the template's variables rather than a rendered
        // message. The gateway is template-first: Meta needs the variables separately, and rejects any
        // parameter containing a newline — so a formatted string cannot be passed through here at all.
        // The message wording itself lives in the approved Meta template, not in the caller.

        boolean shouldSendWhatsappMessage(String mobile);

        boolean sendWhatsappInvoice(int customerId, int fofoId, String invoiceNumber, String whatsAppNo) throws Exception;

        boolean sendPaymentLink(String mobile, String paymentLink) throws Exception;

        boolean sendOfferAnnouncement(String mobile, String offerName, String schemeType, String startDate,
                                                                  String endDate, String imageUrl) throws Exception;

        /**
         * One line per lot. The approved template has three variables, so at most three lots go out per
         * send; anything beyond that is dropped and logged rather than silently trimmed.
         */
        boolean sendBiddingLive(String mobile, List<String> lots, String mediaUrl) throws Exception;

        /** Days in default and the penalty rate are fixed copy in the template, so only these two vary. */
        boolean sendLoanDefaultAlert(String mobile, String name, String outstandingAmount) throws Exception;

        boolean sendOrderDelivered(String mobile, String airwayBillNumber) throws Exception;

        /** Post-purchase protection upsell. The approved template attaches the invoice PDF and names it. */
        boolean sendADLDWhatsappMessage(String mobile, String invoiceNumber, String mediaUrl, String fileName)
                        throws Exception;

        /**
         * Admin catalog update digest — one WhatsApp per HO user summarising a
         * finance operator's selection of offers and schemes. Offers and schemes are
         * combined into a single {@code programsAdded} count because the approved
         * Utility-category template on Meta uses neutral operational wording
         * ("Programs added") rather than the "Offers / Schemes" split — the "offer"
         * and "scheme" keywords trigger Meta's Marketing reclassifier.
         *
         * @param mobile         recipient's mobile (E.164 or bare 10-digit — the gateway normalises)
         * @param regionSummary  human-readable region field for {{1}} — either "All India" or "N region(s)"
         * @param programsAdded  combined count of newly-published offers + schemes ({{2}})
         * @param revisions      count of items that revise an already-running offer or scheme ({{3}})
         * @param endingSoon     count of selected items whose endDate is within 7 days of today ({{4}})
         */
        boolean sendOfferRadar(String mobile, String regionSummary, int programsAdded,
                                                   int revisions, int endingSoon) throws Exception;

}