Fix payment / PayPal problems (#2889)

* Fix payment / PayPal problems

* Update Guest.php

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Adam Daley <admdly@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
authored and GitHub committed 2025-09-06 13:03:58 -07:00
1 parent c9de05cc70
commit c4a19916fd
3 files changed
+8 -5

No files matched your search

+1 -1
View File
@@ -184,7 +184,7 @@ class Payment_Adapter_PayPalEmail extends Payment_AdapterAbstract implements FOS
$d = [
'id' => $id,
'error' => '',
'error_code' => '',
'error_code' => null,
'status' => 'processed',
'updated_at' => date('Y-m-d H:i:s'),
];
+3 -1
View File
@@ -35,8 +35,10 @@ class Guest extends \Api_Abstract
if (!$model) {
throw new \FOSSBilling\Exception('Invoice was not found');
}
$service = $this->getService();
$service->checkInvoiceAuth($model->client_id);
return $this->getService()->toApiArray($model, true, $this->getIdentity());
return $service->toApiArray($model, true, $this->getIdentity());
}
/**
+4 -3
View File
@@ -139,8 +139,6 @@ class Service implements InjectionAwareInterface
public function toApiArray(\Model_Invoice $invoice, $deep = true, $identity = null): array
{
$this->checkInvoiceAuth($invoice->client_id);
$row = $this->di['db']->toArray($invoice);
$items = $this->di['db']->find('InvoiceItem', 'invoice_id = :iid', ['iid' => $row['id']]);
@@ -1238,10 +1236,13 @@ class Service implements InjectionAwareInterface
$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 \FOSSBilling\Exception('Invoice not found');
}
$this->checkInvoiceAuth($invoice->client_id);
if (isset($invoice->currency)) {
$currencyCode = $invoice->currency;
} else {
@@ -1498,7 +1499,7 @@ class Service implements InjectionAwareInterface
return $this->di['table_export_csv']('invoice', 'invoices.csv', $headers);
}
private function checkInvoiceAuth(?int $invoiceClientId)
public function checkInvoiceAuth(?int $invoiceClientId)
{
if ($invoiceClientId === null) {
return;