<?php
namespace WHMCS\Module\Addon\ProxyCheap\Commands;

use WHMCS\Module\Addon\ProxyCheap\AbstractCommand;

class ProductBillingCycles extends AbstractCommand
{
    public function get()
    {
        $pid = (int)$_GET['pid'];

        include ROOTDIR . '/includes/orderfunctions.php';
        $pricing = getPricingInfo($pid);

        $userid = isset($_SESSION["uid"]) ? $_SESSION["uid"] : "";
        $currencyid = isset($_SESSION["currency"]) ? $_SESSION["currency"] : "";
        $currency = getCurrency($userid, $currencyid);

        $cycles = [];
        foreach($pricing['cycles'] as $key=>$cycle)
        {

            $cycles[$key] = (new \WHMCS\Billing\Cycles())->getPublicBillingCycle($key);
        }
        $pricing['cycles'] = $cycles;
        return ['pricing' => $pricing, 'currency' => $currency];
    }
}