PHP 8.2.31
Preview: TotalPaymentsVolumeProcessor.php Size: 1.76 KB
/home/nshryvcy/himaltourism.com/wp-content/plugins/woocommerce/src/Admin/RemoteInboxNotifications/TotalPaymentsVolumeProcessor.php

<?php
/**
 * Rule processor that passes when a store's payments volume exceeds a provided amount.
 */

namespace Automattic\WooCommerce\Admin\RemoteInboxNotifications;

defined( 'ABSPATH' ) || exit;

use Automattic\WooCommerce\Admin\API\Reports\Revenue\Query as RevenueQuery;
use Automattic\WooCommerce\Admin\API\Reports\TimeInterval;

/**
 * Rule processor that passes when a store's payments volume exceeds a provided amount.
 */
class TotalPaymentsVolumeProcessor implements RuleProcessorInterface {
	/**
	 * Compare against the store's total payments volume.
	 *
	 * @param object $rule         The rule being processed by this rule processor.
	 * @param object $stored_state Stored state.
	 *
	 * @return bool The result of the operation.
	 */
	public function process( $rule, $stored_state ) {
		$dates      = TimeInterval::get_timeframe_dates( $rule->timeframe );
		$reports_revenue = new RevenueQuery(
			array(
				'before' => $dates['end'],
				'after'  => $dates['start'],
				'interval' => 'year',
				'fields' => array( 'total_sales' ),
			)
		);
		$report_data    = $reports_revenue->get_data();
		$value          = $report_data->totals->total_sales;

		return ComparisonOperation::compare(
			$value,
			$rule->value,
			$rule->operation
		);
	}

	/**
	 * Validates the rule.
	 *
	 * @param object $rule The rule to validate.
	 *
	 * @return bool Pass/fail.
	 */
	public function validate( $rule ) {
		$allowed_timeframes = array(
			'last_week',
			'last_month',
			'last_quarter',
			'last_6_months',
			'last_year',
		);

		if ( ! isset( $rule->timeframe ) || ! in_array( $rule->timeframe, $allowed_timeframes, true ) ) {
			return false;
		}

		if ( ! isset( $rule->value ) ) {
			return false;
		}

		if ( ! isset( $rule->operation ) ) {
			return false;
		}

		return true;
	}
}

Directory Contents

Dirs: 1 × Files: 34

Name Size Perms Modified Actions
- drwxr-xr-x 2026-03-03 06:10:19
Edit Download
1.58 KB lrw-r--r-- 2026-03-03 06:10:19
Edit Download
1.17 KB lrw-r--r-- 2026-03-03 06:10:19
Edit Download
1.13 KB lrw-r--r-- 2026-03-03 06:10:19
Edit Download
5.20 KB lrw-r--r-- 2026-03-03 06:10:19
Edit Download
1.52 KB lrw-r--r-- 2026-03-03 06:10:19
Edit Download
1.73 KB lrw-r--r-- 2026-03-03 06:10:19
Edit Download
689 B lrw-r--r-- 2026-03-03 06:10:19
Edit Download
1.97 KB lrw-r--r-- 2026-03-03 06:10:19
Edit Download
1.11 KB lrw-r--r-- 2026-03-03 06:10:19
Edit Download
1.29 KB lrw-r--r-- 2026-03-03 06:10:19
Edit Download
1.21 KB lrw-r--r-- 2026-03-03 06:10:19
Edit Download
1.38 KB lrw-r--r-- 2026-03-03 06:10:19
Edit Download
2.22 KB lrw-r--r-- 2026-03-03 06:10:19
Edit Download
1.22 KB lrw-r--r-- 2026-03-03 06:10:19
Edit Download
703 B lrw-r--r-- 2026-03-03 06:10:19
Edit Download
1.39 KB lrw-r--r-- 2026-03-03 06:10:19
Edit Download
775 B lrw-r--r-- 2026-03-03 06:10:19
Edit Download
1.48 KB lrw-r--r-- 2026-03-03 06:10:19
Edit Download
1.75 KB lrw-r--r-- 2026-03-03 06:10:19
Edit Download
1.48 KB lrw-r--r-- 2026-03-03 06:10:19
Edit Download
1.26 KB lrw-r--r-- 2026-03-03 06:10:19
Edit Download
1.26 KB lrw-r--r-- 2026-03-03 06:10:19
Edit Download
6.13 KB lrw-r--r-- 2026-03-03 06:10:19
Edit Download
2.21 KB lrw-r--r-- 2026-03-03 06:10:19
Edit Download
657 B lrw-r--r-- 2026-03-03 06:10:19
Edit Download
4.60 KB lrw-r--r-- 2026-03-03 06:10:19
Edit Download
1.22 KB lrw-r--r-- 2026-03-03 06:10:19
Edit Download
3.63 KB lrw-r--r-- 2026-03-03 06:10:19
Edit Download
1.76 KB lrw-r--r-- 2026-03-03 06:10:19
Edit Download
788 B lrw-r--r-- 2026-03-03 06:10:19
Edit Download
1.98 KB lrw-r--r-- 2026-03-03 06:10:19
Edit Download
503 B lrw-r--r-- 2026-03-03 06:10:19
Edit Download
1.60 KB lrw-r--r-- 2026-03-03 06:10:19
Edit Download
881 B lrw-r--r-- 2026-03-03 06:10:19
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).