Compatible Dish Categories for Payment Types
Tags:
v9
The API has added the property PaymentType.CompatibleCategories to retrieve dish categories compatible with the payment type.
This allows for custom checks of compatibility between payment types and dish categories (for example, bonuses can only be used to pay for certain categories).
Example Usage
var paymentType = PluginContext.Operations
.GetPaymentTypes()
.First(pt => pt.Name == "Bonuses");
var compatibleCategories = paymentType.CompatibleCategories;
// Check if the item can be paid for with this payment type
foreach (var item in order.Items.OfType<IOrderProductItem>())
{
if (!compatibleCategories.Contains(item.Product.Category))
{
// This payment type cannot be used for this category
}
}
See also
IPaymentTypeIProductCategory- Order validations before payment
- Preliminary checks in plugin UI