[IMP] Implements some checks on vals before cancel, better cancel log management and fixes some Flake8 on sale_cancel_purchase