Skip to main content

Service contracts

Overview​

EasyQuote keeps its quote actions in five services under MageMe\EasyQuote\Api. The admin buttons and the storefront pages call the same services, so your code gets the same checks, status changes, history entries and emails. All service and data interfaces under Api/ are marked @api; the one exception is Api/Utility/IsProductSalableForRequestedQtyInterface, an internal compatibility helper for Magento Inventory. Inject the interface in your constructor; etc/di.xml maps it to the implementation in Model/Service/.

None of these services has a REST or GraphQL route.

Operations​

RequestToQuoteInterface​

public function convert(int $requestId, int $adminUserId): QuoteInterface;

Turns a quote request into a Pending quote. It uses the customer account found by the request's email, or creates one when there is none, copies the request cart into the quote, links the request to the quote, writes the status history and removes the request cart. $adminUserId is recorded as the author; pass 0 for none. It dispatches mm_easyquote_quote_prepare_save, see Events, plugins and extension points.

Throws When
MageMe\EasyQuote\Exception\RequestAlreadyConvertedException The request already has a quote: "Request #%1 has already been converted to Quote #%2."
LocalizedException "Invalid request. No products." The request has no lines
LocalizedException "Customer Email required." (or Lastname, Firstname) No customer and not enough data to create one

QuoteDuplicatorInterface​

public function duplicate(int $quoteId, DuplicateOptionsInterface $options): QuoteInterface;

Copies a quote, with its items and quantity tiers, into a new quote. The copy is Draft when Enable Quote Proposals is on for the store view of the original, and Pending when it's off. The options decide who the copy is for. When customerId points to no customer, the customer repository throws Magento's NoSuchEntityException. For a copy that isn't a guest copy, the customer also gets the New Quote email when Enable Customer Notification and the New Quote type are on, proposals are off for the store view and the copy isn't internal. A failed email is only logged.

DuplicateOptionsInterface​

MageMe\EasyQuote\Api\Data\DuplicateOptionsInterface, a data object with getters and setters:

Option Type Default Effect
customerId ?int null Customer the copy is assigned to. null keeps the original customer.
asInternal bool false The copy is an internal quote
asGuest bool false Guest copy: no customer, no addresses, no shipping. customerId is ignored.
adminUserId ?int null Author of the copy's history. It also manages the copy when the original has no manager. null uses the signed-in admin user, if any.

The defaults are read from Model/Data/DuplicateOptions.

ProposalSenderInterface​

public function send(int $quoteId, int $adminUserId): void;

Sends a proposal. The quote moves to Awaiting Customer Review, gets its proposal dates from the Quote Proposals settings, and, when Enable Customer Notification and the New Proposal type are on, the customer gets the proposal email. $adminUserId = 0 takes the author from the admin session.

Throws When
MageMe\EasyQuote\Exception\ProposalDisabledException Enable Quote Proposals is off for the quote's store view
StateException "A proposal cannot be sent from this quote status." Status is Approved, Purchased or Cancelled
StateException "This is an internal quote. Turn off Internal Quote and save the quote before sending a proposal." Internal quote
MageMe\EasyQuote\Exception\CustomerNotificationException The proposal was sent, but the email failed

QuoteAcceptanceInterface​

public function accept(int $quoteId, int $customerId, array $selectedQtyTiers, bool $checkout): ?CartInterface;
public function decline(int $quoteId, int $customerId, string $reason): void;

The customer's answer to a proposal. Both methods work on the shopping cart of the current customer session, so they suit storefront controllers, not cron jobs or REST. $selectedQtyTiers maps quote item ID to the chosen tier. $checkout = true empties the cart before the quote items go in.

accept() returns the cart when Auto-approve When Customer Accepts is on: the quote is approved and its items are in the cart at the quoted prices. Otherwise it returns null and the quote waits for admin approval. decline() removes the quote items from the cart, sets Proposal Declined with the reason, and emails the admin when admin notifications are on.

Throws When
LocalizedException "The quote is already added to the cart." accept(): a line of this quote is in the cart
ProposalDisabledException "The quote is not enabled." accept(): proposals are off for the store view
StateException "The quote has wrong status." accept(): status is not Awaiting Customer Review
MageMe\EasyQuote\Exception\QuoteExpiredException accept(): the proposal or the quote has expired
StateException "The quote is not approved." decline(): status is not Awaiting Customer Review
LocalizedException "The reason for decline is required." decline() with an empty reason
LocalizedException "This quote includes products that are no longer available: %1. Contact us to update the quote." accept(): a quoted product was deleted
LocalizedException "The quote is not available for your account." Not this customer's quote

QuoteApprovalInterface​

public function approve(int $quoteId, int $adminUserId): void;

Approves a quote and, when Enable Customer Notification and the Quote Approved type are on for its store view and the quote isn't internal, emails the customer. The status check and the status write run on a locked row in one transaction.

Throws When
StateException "This quote cannot be approved from its current status." The status doesn't allow approval in the workflow of the quote's store view, by the same rule as the Approve button: Draft, Pending or Expired with proposals off and for guest quotes; with proposals on, Proposal Accepted only while Auto-approve When Customer Accepts is No
CustomerNotificationException Approved, but the email failed

Repositories and management interfaces​

Interface Purpose
QuoteRepositoryInterface Load (getById, getByLinkHash, getByCheckoutHash), save, delete, getList, plus the REST data methods
QuoteItemRepositoryInterface, QuoteAddressRepositoryInterface, QtyTierRepositoryInterface Quote lines, addresses and quantity tiers
QuoteStatusHistoryRepositoryInterface Status history entries
RequestRepositoryInterface Quote requests, plus the REST data and submit methods
RequestMessageRepositoryInterface, RequestMessageFileRepositoryInterface, RequestMessageFileTmpRepositoryInterface Request messages and their attachments
QuoteManagementInterface The customer REST methods: addToCart, getItems, getQuotes

QuoteRepositoryInterface::save() only saves the record through the resource model. It doesn't run the status checks or send the emails of the services above, so use the services for actions.

Interfaces without a route​

RequestManagementInterface::submitRequest(int $cartId) and GuestRequestManagementInterface::submitRequest(string $cartId) are @api but have no REST route in 1.7.5.

What's next​

Applies to EasyQuote 1Last reviewed November 28, 2026