Subversion Repositories SmartDukaan

Rev

Blame | Last modification | View Log | RSS feed

package com.spice.profitmandi.service.pricing;

import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;

/**
 * Price-hike under-charge recovery. Two entry points, sharing one idempotent core:
 *
 * 1. {@link #applyHikeDeductionOnGrn} — called from the partner GRN flow, just before schemes.
 *    For the purchase's serialized items whose order was billed at the OLD price inside a hike's
 *    [affected_on, created_on] window, writes an APPROVED price_drop_imei row (with the item's real
 *    inventory_item_id) and debits the partner. Runs inside the GRN transaction. Drops are ignored.
 *
 * 2. {@link #triggerHikeDeduction} — on-demand for a whole hike: finds the billed partners/IMEIs,
 *    then processes each partner in the background executor, one transaction per retailer.
 *
 * Both paths are idempotent per (hike, imei): a re-run, or the two paths overlapping on the same
 * unit, does nothing the second time.
 */
public interface PriceHikeService {

    void applyHikeDeductionOnGrn(int purchaseId, int fofoId) throws ProfitMandiBusinessException;

    void triggerHikeDeduction(int priceDropId);
}