protected function set_coupon( $order, $coupon, $action ) {

        // coupon amount must be positive float
        if ( isset( $coupon['amount'] ) && floatval( $coupon['amount'] ) < 0 ) {
            throw new WC_API_Exception( 'woocommerce_invalid_coupon_total', __( 'Coupon discount total must be a positive amount.', 'woocommerce' ), 400 );