From 7288e5b641e207a525f671051df2b9b40f95b60d Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 27 Jun 2024 14:52:38 +1000 Subject: [PATCH] Adjust BTCPay for scoping --- app/Console/Commands/PostUpdate.php | 7 ------- app/PaymentDrivers/BTCPayPaymentDriver.php | 10 ++++++---- app/Services/Payment/UpdateInvoicePayment.php | 3 --- composer.lock | 12 ++++++------ 4 files changed, 12 insertions(+), 20 deletions(-) diff --git a/app/Console/Commands/PostUpdate.php b/app/Console/Commands/PostUpdate.php index 648ebb2d6966..bd590710ff8d 100644 --- a/app/Console/Commands/PostUpdate.php +++ b/app/Console/Commands/PostUpdate.php @@ -54,13 +54,6 @@ class PostUpdate extends Command info('finished migrating'); - $output = []; - - // exec('vendor/bin/composer install --no-dev -o', $output); - - info(print_r($output, 1)); - info('finished running composer install '); - try { // Artisan::call('optimize'); Artisan::call('config:clear'); diff --git a/app/PaymentDrivers/BTCPayPaymentDriver.php b/app/PaymentDrivers/BTCPayPaymentDriver.php index 6d4d7ec3dd51..b0cd695155b6 100644 --- a/app/PaymentDrivers/BTCPayPaymentDriver.php +++ b/app/PaymentDrivers/BTCPayPaymentDriver.php @@ -131,9 +131,11 @@ class BTCPayPaymentDriver extends BaseDriver $this->payment_hash = PaymentHash::whereRaw('BINARY `hash`= ?', [$btcpayRep->metadata->InvoiceNinjaPaymentHash])->firstOrFail(); $StatusId = Payment::STATUS_PENDING; if ($this->payment_hash->payment_id == null) { - //$_invoice = collect($this->payment_hash->data->invoices)->first(); - $_invoice = Invoice::query()->where('number', $btcpayRep->metadata->orderId)->first(); - $this->client = Client::find($_invoice->client_id); + + $_invoice = Invoice::with('client')->withTrashed()->find($this->payment_hash->fee_invoice_id); + + $this->client = $_invoice->client; + $dataPayment = [ 'payment_method' => $this->payment_method, 'payment_type' => PaymentType::CRYPTO, @@ -144,7 +146,7 @@ class BTCPayPaymentDriver extends BaseDriver $payment = $this->createPayment($dataPayment, $StatusId); } else { /** @var \App\Models\Payment $payment */ - $payment = Payment::find($this->payment_hash->payment_id); + $payment = Payment::withTrashed()->find($this->payment_hash->payment_id); $StatusId = $payment->status_id; } switch ($btcpayRep->type) { diff --git a/app/Services/Payment/UpdateInvoicePayment.php b/app/Services/Payment/UpdateInvoicePayment.php index 1000086b6985..84cc49b8aba8 100644 --- a/app/Services/Payment/UpdateInvoicePayment.php +++ b/app/Services/Payment/UpdateInvoicePayment.php @@ -127,8 +127,6 @@ class UpdateInvoicePayment return; } - - if (strlen($invoice->number) > 1 && str_starts_with($invoice->number, "####")) { $invoice->number = ''; } @@ -140,7 +138,6 @@ class UpdateInvoicePayment ->save(); } - /* Updates the company ledger */ $this->payment ->ledger() diff --git a/composer.lock b/composer.lock index 091e250c7ac5..4ff8320f9507 100644 --- a/composer.lock +++ b/composer.lock @@ -14820,16 +14820,16 @@ }, { "name": "turbo124/beacon", - "version": "v2.0.1", + "version": "v2.0.2", "source": { "type": "git", "url": "https://github.com/turbo124/beacon.git", - "reference": "cc0b6754a1a4ee36a531fe3364d8e5d2b7d5cc7a" + "reference": "95f3de3bdcbb786329cd7050f319520588920466" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/turbo124/beacon/zipball/cc0b6754a1a4ee36a531fe3364d8e5d2b7d5cc7a", - "reference": "cc0b6754a1a4ee36a531fe3364d8e5d2b7d5cc7a", + "url": "https://api.github.com/repos/turbo124/beacon/zipball/95f3de3bdcbb786329cd7050f319520588920466", + "reference": "95f3de3bdcbb786329cd7050f319520588920466", "shasum": "" }, "require": { @@ -14876,9 +14876,9 @@ "turbo124" ], "support": { - "source": "https://github.com/turbo124/beacon/tree/v2.0.1" + "source": "https://github.com/turbo124/beacon/tree/v2.0.2" }, - "time": "2024-06-27T01:19:25+00:00" + "time": "2024-06-27T01:23:05+00:00" }, { "name": "twig/intl-extra",