Refund coupon editing
The refund index page exposes a coupon editor for Bon achat refunds that already have a local mz_refund.code_coupon.
Routes​
GET /refund/coupon/{id}/details(refund_coupon_details) loads coupon details from Menzzo/Magento throughGET rest/V1/logidav-api/coupon/{couponCode}.POST /refund/coupon/{id}/update(refund_coupon_update) updates one coupon throughPOST rest/V1/logidav-api/coupon/{couponCode}.POST /refund/coupon/bulk-update(refund_coupon_bulk_update) applies common fields to selected refund coupons one by one through the same Menzzo endpoint.POST /refund/coupon/import-csv(refund_coupon_import_csv) imports a CSV file from the refund index and updates matching coupons one by one through the same Menzzo endpoint.GET /refund/coupon/import-csv/template(refund_coupon_import_csv_template) returns a CSV template for operators.
All write routes require a refund coupon CSRF token, reuse the refund index menu access check for the current sale source, and reject non-Bon achat refunds or refunds without a coupon code. Before any update, Logidav also reloads the coupon from Menzzo and verifies that the returned coupon code matches mz_refund.code_coupon, the local refund message contains the generated coupon code, and the Menzzo coupon amount matches the refund amount. This prevents editing manual/shared coupons through the refund coupon workflow. Manual and batch updates use csrf_token('refund_coupon_update'); CSV import uses csrf_token('refund_coupon_import_csv').
Batch editing​
The batch modal is opened from the refund index selection. It does not allow coupon code changes because each refund keeps its own coupon code. The operator must explicitly tick each field to apply: active status, validity dates, uses_per_coupon, or uses_per_customer.
Unchecked fields are not sent to Menzzo, so an empty form value cannot silently erase an existing Magento limit. Selected usage limits must be strictly positive integers, and selected date ranges must satisfy to_date >= from_date. uses_per_customer is a final replacement value, not an increment.
The batch endpoint returns a result per refund/coupon with success, message, and the refreshed Menzzo values when available. A failure for one coupon does not stop reporting for the other selected coupons.
CSV import​
The CSV import modal accepts .csv and .txt files up to 2 MB. The first row must be a header with coupon_code and may include uses_per_coupon, uses_per_customer, from_date, to_date, and is_active. Both comma and semicolon delimiters are supported, and the UTF-8 BOM is stripped from the first header cell.
Rows are matched locally through mz_refund.code_coupon; only refunds whose type is exactly Bon achat are processed. coupon_code is used only as the lookup key, so the import never renames coupons and never updates mz_refund.code_coupon.
Optional empty fields are ignored and therefore keep the existing Magento values. Non-empty usage limits must be strictly positive integers. Dates must use Y-m-d, and the effective end date cannot be before the effective start date. is_active accepts 1, 0, true, false, oui, non, yes, no, vrai, faux, actif, inactif, active, inactive, enabled, and disabled.
uses_per_customer is the final value to save, not an increment. Example: if Magento currently allows 1 use per customer and the CSV contains uses_per_customer=2, the final saved value is 2.
Each row reads the current Menzzo coupon details before updating, refuses uses_per_coupon lower than times_used when that value is available, updates through CartRuleApi::updateCouponDetails(), then reads the coupon again to verify that the intended fields were applied.
The JSON response contains total, updated, failed, and a results entry per CSV line with the line number, coupon code, status, message, and Menzzo before/after values when available. A failed row does not stop the remaining rows.
Local updates​
Logidav no longer changes mz_refund.code_coupon from this editor. If Menzzo rejects an update, returns an error, or reports an unexpected coupon code change, the local refund row is left unchanged and the modal displays the error.
CSV/XLS exports keep the coupon column as plain text.