More Details on Unsuccessful Payment
In the API V8Preview7, it has become even more convenient to analyze payment errors.
The methods PayOrder and PayOrderAndPayOutOnUser
can generate the exception PaymentActionFailedException
if an error occurs during payment processing.
Previously, plugin developers only had the error message
Exception.Message,
which is inconvenient to work with and classify.
In the new version, the PaymentActionFailedException
has been enhanced with the property Reason
— a classified reason for the error, which cannot be null if the exception was thrown from the PayOrder or PayOrderAndPayOutOnUser methods.
The Reason
can take the following values from PaymentActionFailedExceptionReason:
/// <summary>
/// Reason for throwing <see cref="PaymentActionFailedException"/>.
/// </summary>
[PublicAPI]
public enum PaymentActionFailedExceptionReason
{
OrderNotFound,
CannotLockOrder,
OrderStatusIsNotOpened,
BanquetOrderNotSupported,
DeliveryOrderStatusIsUnconfirmed,
DeliveryOrderHasPurchases,
DeliveryOrderPrepayAndCloseOnDifferentTerminalNotSupported,
PayInTypeIsIncorrect,
PayOutTypeIsIncorrect,
PayOutOnUserFailed,
CafeSessionNotFound,
CashRegisterNotFound,
OnlyVirtualCashRegisterForPurchasesSupported,
UserNotFound,
UserPersonalSessionNotOpened,
NoUserPermissionsToPayAsWaiter,
NoUserPermissionsToPayOthersOrder,
NoUserPermissionsToApprovePointsAccural,
UserCashDrawerNotFound,
PaymentTypeNotSpecified,
PaymentTypeNotConfigured,
UncombinablePaymentTypes,
UncombinablePaymentTypesFiscalNonFiscal,
AutomaticPaymentTypeNotFound,
NotProcessedNotSilentPaymentsNotSupported,
PayOrderFailed,
CannotPrintOrder,
CannotEditStopList,
OrderBillOperationFailed,
PaymentsProcessingCanceled,
PaymentsProcessingFailed,
BeforeDoChequeOperationFailed,
ChequeTaskProcessorFailed,
CashRegisterOperationFailed,
MoreThanOnePaymentsWithChange,
ChangeSumEqualToPaymentsWithChangeSum,
ChangeSumGreaterThanPaymentsWithChangeSum,
PaymentSumNotEnough,
PaymentSumNotIntegral,
PaymentSumTooLarge,
CashForChangeNotEnough,
BillOrderBeforePayment,
SplitOrderBeforePayment,
CookingPlacesWithEmptyStores,
TimePayProductsInOrder,
ChequeSmsSendingNotSupported,
ChequeEmailSendingNotSupported,
ChequeSettlementPlaceNotSupported,
}
Among these, only
OrderBillOperationFailed,PaymentsProcessingCanceled,PaymentsProcessingFailed,BeforeDoChequeOperationFailed,ChequeTaskProcessorFailed,CashRegisterOperationFailed
have the newly specified property PaymentActionFailedException.Details,
which will contain the exception message generated by another plugin in