public function __construct() { parent::__construct(); $this->startDate = $this->input('start_date', date('01-m-Y', strtotime('-1 month'))); $this->endDate = $this->input('end_date', date('t-m-Y', strtotime('-1 month'))); $this->currency = ModelSettings::getInstance()->getCurrency(); $this->organisations = ModelOrganisation::get(); }
return number_format($masterImagesPrice + $bandwidthPrice, 2); } function savePayment($organisationId, $amount, $periodDate = null, $transactionId = null) { $payment = new \NinjaImg\Model\ModelPayment(); $payment->organisation_id = $organisationId; $payment->amount = $amount; $payment->currency = 'usd'; $payment->transaction_id = $transactionId; $payment->period_date = $periodDate; $payment->save(); } $day = (int) date('j'); $day = 1; if ($day === 1) { $organisations = \NinjaImg\Model\ModelOrganisation::get(); if ($organisations->hasRows()) { foreach ($organisations as $organisation) { // TODO: calculate price from discount-percentage + free credits (if any) echo sprintf('[ %s ]', $organisation->name) . chr(10) . chr(10); if (\NinjaImg\Model\ModelPayment::hasPayed($organisation->id, date('Y-m-01', strtotime('-1 month')))) { echo ' + Has payed, skipping...' . chr(10) . chr(10); continue; } $currency = \NinjaImg\Model\ModelSettings::getInstance()->getCurrency(); $amount = calculatePrices($organisation); if ($amount <= 0) { echo ' + Nothing to pay for!' . chr(10) . chr(10); continue; } if (!$organisation->stripe_identifier_id) {