diff --git a/src/library/Payment/Adapter/Custom.php b/src/library/Payment/Adapter/Custom.php index ee366d7af..ef69b5cf5 100644 --- a/src/library/Payment/Adapter/Custom.php +++ b/src/library/Payment/Adapter/Custom.php @@ -108,7 +108,7 @@ class Payment_Adapter_Custom // Store the updated transaction and use it's return to indicate a sucsess or failure. return $this->di['db']->store($tx); - } catch (\Exception $e) { + } catch (\Exception) { return false; } } diff --git a/src/modules/Client/Api/Admin.php b/src/modules/Client/Api/Admin.php index e6958f18b..8e720fb93 100644 --- a/src/modules/Client/Api/Admin.php +++ b/src/modules/Client/Api/Admin.php @@ -530,7 +530,6 @@ class Admin extends \Api_Abstract * Update client group. * * @optional string $title - new group title - * */ public function group_update($data) { @@ -552,7 +551,6 @@ class Admin extends \Api_Abstract * Delete client group. * * @return bool - * */ public function group_delete($data) { @@ -576,7 +574,6 @@ class Admin extends \Api_Abstract * Get client group details. * * @return array - * */ public function group_get($data) { diff --git a/src/modules/Currency/Service.php b/src/modules/Currency/Service.php index 761a1eef5..50a74f42b 100644 --- a/src/modules/Currency/Service.php +++ b/src/modules/Currency/Service.php @@ -11,7 +11,6 @@ namespace Box\Mod\Currency; use FOSSBilling\InjectionAwareInterface; -use PhpCsFixer\Fixer\FunctionNotation\VoidReturnFixer; use Symfony\Component\HttpClient\HttpClient; class Service implements InjectionAwareInterface @@ -521,7 +520,7 @@ class Service implements InjectionAwareInterface * @todo use HTTPClient instead of simplexml_load_file() * * @param string $from Short code for the base currency - * @param string $to Short code for the target currency + * @param string $to Short code for the target currency * * @return float Exchange rate */ diff --git a/src/modules/Email/Api/Admin.php b/src/modules/Email/Api/Admin.php index 0ea516f3d..9b360c7b0 100644 --- a/src/modules/Email/Api/Admin.php +++ b/src/modules/Email/Api/Admin.php @@ -248,7 +248,7 @@ class Admin extends \Api_Abstract * @return bool * * @throws \Box_Exception -= */ + * = */ public function template_update($data) { $required = [ diff --git a/src/modules/Formbuilder/Api/Admin.php b/src/modules/Formbuilder/Api/Admin.php index 1c7f21dca..73c14e59e 100644 --- a/src/modules/Formbuilder/Api/Admin.php +++ b/src/modules/Formbuilder/Api/Admin.php @@ -202,7 +202,8 @@ class Admin extends \Api_Abstract /** * Update form field. * - * @param array $data - An array containing the field data. + * @param array $data - An array containing the field data + * * @optional string $data['label'] - The label of the field to be displayed. Default is "Type X," where X is the number of fields in the form (e.g., "Checkbox 2"). * @optional string $data['name'] - The name of the field. Default is "new_type_X," where X is the number of fields in the form (e.g., "new_checkbox_2"). * @optional bool $data['hide_label'] - Specifies whether to hide the field label. @@ -220,7 +221,7 @@ class Admin extends \Api_Abstract * @optional bool $data['show_suffix'] - Specifies whether to show the suffix. * @optional int $data['text_size'] - The preferred text size. * - * @return int - The ID of the updated field. + * @return int - The ID of the updated field * * @throws \Box_Exception */ diff --git a/src/modules/Invoice/Api/Admin.php b/src/modules/Invoice/Api/Admin.php index 868163039..8878d5b1e 100644 --- a/src/modules/Invoice/Api/Admin.php +++ b/src/modules/Invoice/Api/Admin.php @@ -64,7 +64,7 @@ class Admin extends \Api_Abstract $execute = true; } $invoice = $this->_getInvoice($data); - $gateway_id = [ 'id' => $invoice->gateway_id ]; + $gateway_id = ['id' => $invoice->gateway_id]; $payGateway = $this->gateway_get($gateway_id); $charge = false; @@ -73,22 +73,20 @@ class Admin extends \Api_Abstract // create transaction $transactionService = $this->di['mod_service']('Invoice', 'Transaction'); $newtx = $transactionService->create([ - 'invoice_id' => $invoice->id, - 'bb_invoice_id' => $invoice->id, - 'gateway_id' => $invoice->gateway_id, - 'bb_gateway_id' => $invoice->gateway_id, - 'currency' => $invoice->currency, - 'status' => 'received', - 'txn_id' => $data['transactionId'], + 'invoice_id' => $invoice->id, + 'bb_invoice_id' => $invoice->id, + 'gateway_id' => $invoice->gateway_id, + 'bb_gateway_id' => $invoice->gateway_id, + 'currency' => $invoice->currency, + 'status' => 'received', + 'txn_id' => $data['transactionId'], ]); - + try { return $transactionService->processTransaction($newtx); - } catch (\Exception $e) - { - $this->di['logger']->info('Error processing transaction: '.$e->getMessage()); + } catch (\Exception $e) { + $this->di['logger']->info('Error processing transaction: ' . $e->getMessage()); } - } return $this->getService()->markAsPaid($invoice, $charge, $execute); @@ -576,7 +574,7 @@ class Admin extends \Api_Abstract /** * Return existing module but not activated. - * + * * @return array */ public function gateway_get_available(array $data) diff --git a/src/modules/Invoice/Controller/Client.php b/src/modules/Invoice/Controller/Client.php index f153c7643..7fd715627 100644 --- a/src/modules/Invoice/Controller/Client.php +++ b/src/modules/Invoice/Controller/Client.php @@ -58,6 +58,7 @@ class Client implements \FOSSBilling\InjectionAwareInterface if (!$this->di['auth']->isAdminLoggedIn() && $hash_access === '0') { $this->redirectIfNotInvoiceBuyer($app, $invoice); } + return $app->render('mod_invoice_invoice', ['invoice' => $invoice]); } @@ -75,6 +76,7 @@ class Client implements \FOSSBilling\InjectionAwareInterface if (!$this->di['auth']->isAdminLoggedIn() && $hash_access === '0') { $this->redirectIfNotInvoiceBuyer($app, $invoice); } + return $app->render('mod_invoice_print', ['invoice' => $invoice]); } @@ -119,15 +121,16 @@ class Client implements \FOSSBilling\InjectionAwareInterface if (!$this->di['auth']->isAdminLoggedIn() && $hash_access === '0') { $this->redirectIfNotInvoiceBuyer($app, $invoice); } - return $app->render('mod_invoice_pdf', ['invoice' => $invoice]); - } - public function redirectIfNotInvoiceBuyer($app, $invoice) { + return $app->render('mod_invoice_pdf', ['invoice' => $invoice]); + } + + public function redirectIfNotInvoiceBuyer($app, $invoice) + { $client = $this->di['loggedin_client']; if ($invoice['client']['id'] != $client->id) { // redirect to client invoices/invoice')); return $app->redirect('/invoice'); } } - } diff --git a/src/modules/Invoice/Service.php b/src/modules/Invoice/Service.php index 4e3723dde..eaec25871 100644 --- a/src/modules/Invoice/Service.php +++ b/src/modules/Invoice/Service.php @@ -376,8 +376,6 @@ class Service implements InjectionAwareInterface $systemService = $this->di['mod_service']('system'); $ctable = $this->di['mod_service']('Currency'); - - $invoice->serie = $systemService->getParamValue('invoice_series_paid'); $invoice->approved = true; $invoice->currency_rate = $ctable->getRateByCode($invoice->currency); @@ -390,8 +388,6 @@ class Service implements InjectionAwareInterface $this->di['events_manager']->fire(['event' => 'onAfterAdminInvoicePaymentReceived', 'params' => ['id' => $invoice->id]]); - - if ($execute) { foreach ($invoiceItems as $item) { try { @@ -1186,7 +1182,7 @@ class Service implements InjectionAwareInterface $systemService = $this->di['mod_service']('system'); $c = $systemService->getCompany(); $document_format = $systemService->getParamValue('invoice_document_format', 'Letter'); - + $invoice = $this->di['db']->findOne('Invoice', 'hash = :hash', [':hash' => $hash]); if (!$invoice instanceof \Model_Invoice) { throw new \Box_Exception('Invoice not found'); @@ -1202,8 +1198,6 @@ class Service implements InjectionAwareInterface $invoice = $this->toApiArray($invoice, false, $identity); $company = $this->di['mod_service']('System')->getCompany(); - - $CSS = $this->getPdfCss(); $pdf = new Dompdf(); @@ -1540,7 +1534,6 @@ class Service implements InjectionAwareInterface private function getFooterInfo(array $company) { - $sourceData = [ 'company_name' => $company['name'], 'bank_name' => $company['bank_name'], @@ -1556,7 +1549,6 @@ class Service implements InjectionAwareInterface 'address_1' => $company['address_1'], 'address_2' => $company['address_2'], 'address_3' => $company['address_3'], - ]; foreach ($sourceData as $label => $data) { diff --git a/src/modules/Invoice/ServiceTransaction.php b/src/modules/Invoice/ServiceTransaction.php index df70d54d6..4ca932ff8 100644 --- a/src/modules/Invoice/ServiceTransaction.php +++ b/src/modules/Invoice/ServiceTransaction.php @@ -363,6 +363,7 @@ class ServiceTransaction implements InjectionAwareInterface } $ipn = json_decode($tx->ipn, 1); + return $adapter->processTransaction($this->di['api_system'], $id, $ipn, $tx->gateway_id); }