package merrors import "strings" const ReasonPaymentExecutionNotAccepted = "PAYMENT_EXECUTION_NOT_ACCEPTED" var ErrPaymentExecutionNotAccepted = Define("payment.execution_not_accepted") type paymentExecutionNotAcceptedError struct { classifiedError cause error } func (e paymentExecutionNotAcceptedError) Unwrap() []error { causes := e.classifiedError.Unwrap() if e.cause != nil { causes = append(causes, e.cause) } return causes } // PaymentExecutionNotAccepted reports that the orchestrator proved an // execution request did not create or reuse any payment. Callers may release // request-side reservations only for this outcome; ordinary transport and // internal errors have an ambiguous ownership result. func PaymentExecutionNotAccepted(msg string) error { return PaymentExecutionNotAcceptedWrap(nil, msg) } // PaymentExecutionNotAcceptedWrap adds the definitive rejection // classification while retaining the underlying cause for diagnostics. func PaymentExecutionNotAcceptedWrap(cause error, msg string) error { msg = strings.TrimSpace(msg) if msg == "" { msg = "payment execution was not accepted before a payment was created" } return paymentExecutionNotAcceptedError{ classifiedError: classifiedError{ base: ErrFailedPrecondition, code: ErrPaymentExecutionNotAccepted, msg: msg, reason: ReasonPaymentExecutionNotAccepted, publicMessage: true, }, cause: cause, } }