Adjustments for when deleting invoices paid with a credit
This commit is contained in:
parent
4f4ab9d02b
commit
68109972df
|
|
@ -322,7 +322,7 @@ class Client extends BaseModel implements HasLocalePreference
|
|||
|
||||
public function locations(): \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
{
|
||||
return $this->hasMany(Location::class)->withTrashed();
|
||||
return $this->hasMany(Location::class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -56,6 +56,13 @@ class BaseDriver extends AbstractPaymentDriver
|
|||
/* The Invitation */
|
||||
public $invitation;
|
||||
|
||||
/**
|
||||
* Indicates if returning responses should be headless or classic redirect.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public bool $headless = false;
|
||||
|
||||
/**
|
||||
* The Client
|
||||
*
|
||||
|
|
@ -173,6 +180,13 @@ class BaseDriver extends AbstractPaymentDriver
|
|||
return $fields;
|
||||
}
|
||||
|
||||
public function setHeadless($headless): self
|
||||
{
|
||||
$this->headless = $headless;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Authorize a payment method.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -106,13 +106,6 @@ class StripePaymentDriver extends BaseDriver
|
|||
|
||||
public const SYSTEM_LOG_TYPE = SystemLog::TYPE_STRIPE;
|
||||
|
||||
/**
|
||||
* Indicates if returning responses should be headless or classic redirect.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public bool $headless = false;
|
||||
|
||||
/**
|
||||
* Initializes the Stripe API.
|
||||
* @return self
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ namespace App\Services\Invoice;
|
|||
|
||||
use App\Events\Invoice\InvoiceWasDeleted;
|
||||
use App\Jobs\Inventory\AdjustProductInventory;
|
||||
use App\Models\Credit;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\Quote;
|
||||
use App\Services\AbstractService;
|
||||
|
|
@ -199,6 +200,16 @@ class MarkInvoiceDeleted extends AbstractService
|
|||
->where('paymentable_type', '=', 'invoices')
|
||||
->where('paymentable_id', $this->invoice->id)
|
||||
->update(['deleted_at' => now()]);
|
||||
|
||||
$pp = \App\Models\Paymentable::where('payment_id', $payment->id)
|
||||
->where('paymentable_type', \App\Models\Credit::class)
|
||||
->where('amount', $this->invoice->amount)
|
||||
->first();
|
||||
|
||||
if($pp) {
|
||||
$pp->delete();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
return $this;
|
||||
|
|
|
|||
|
|
@ -64,7 +64,6 @@
|
|||
"hyvor/php-json-exporter": "^0.0.3",
|
||||
"imdhemy/laravel-purchases": "^1.7",
|
||||
"intervention/image": "^2.5",
|
||||
"invoiceninja/admin-api": "dev-main",
|
||||
"invoiceninja/einvoice": "dev-main",
|
||||
"invoiceninja/inspector": "^3.0",
|
||||
"invoiceninja/ubl_invoice": "^2",
|
||||
|
|
@ -225,8 +224,9 @@
|
|||
"url": "https://github.com/turbo124/snappdf"
|
||||
},
|
||||
{
|
||||
"type": "vcs",
|
||||
"url": "https://github.com/invoiceninja/admin-api"
|
||||
"type": "path",
|
||||
"url": "../admin-api"
|
||||
|
||||
}
|
||||
],
|
||||
"minimum-stability": "dev",
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "d7f18cbb363582cea71dd4423f38539e",
|
||||
"content-hash": "2937b569c924dcc633b94288887c722c",
|
||||
"packages": [
|
||||
{
|
||||
"name": "adrienrn/php-mimetyper",
|
||||
|
|
@ -4511,74 +4511,6 @@
|
|||
],
|
||||
"time": "2022-05-21T17:30:32+00:00"
|
||||
},
|
||||
{
|
||||
"name": "invoiceninja/admin-api",
|
||||
"version": "dev-main",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "git@github.com:invoiceninja/admin-api.git",
|
||||
"reference": "20e652814f85db0f1825236843bb168b363859ee"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/invoiceninja/admin-api/zipball/20e652814f85db0f1825236843bb168b363859ee",
|
||||
"reference": "20e652814f85db0f1825236843bb168b363859ee",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"afosto/yaac": "^1.5",
|
||||
"asm/php-ansible": "dev-main",
|
||||
"ext-curl": "*",
|
||||
"ext-dom": "*",
|
||||
"ext-json": "*",
|
||||
"ext-libxml": "*",
|
||||
"ext-simplexml": "*",
|
||||
"illuminate/database": "^11",
|
||||
"illuminate/support": "^11",
|
||||
"imdhemy/laravel-purchases": "^1.7",
|
||||
"php": "^8.2|^8.3|^8.4"
|
||||
},
|
||||
"require-dev": {
|
||||
"larastan/larastan": "^3.0",
|
||||
"orchestra/testbench": "^9.0",
|
||||
"phpstan/phpstan": "^2.0",
|
||||
"phpunit/phpunit": "^11.0"
|
||||
},
|
||||
"default-branch": true,
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"InvoiceNinja\\AdminApi\\Providers\\AdminApiServiceProvider"
|
||||
]
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"InvoiceNinja\\AdminApi\\": "src/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"InvoiceNinja\\AdminApi\\Tests\\": "tests/"
|
||||
}
|
||||
},
|
||||
"license": [
|
||||
"Elastic"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "David Bomba",
|
||||
"email": "turbo124@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "API endpoints for the admin interface",
|
||||
"support": {
|
||||
"source": "https://github.com/invoiceninja/admin-api/tree/main",
|
||||
"issues": "https://github.com/invoiceninja/admin-api/issues"
|
||||
},
|
||||
"time": "2025-03-05T05:43:36+00:00"
|
||||
},
|
||||
{
|
||||
"name": "invoiceninja/einvoice",
|
||||
"version": "dev-main",
|
||||
|
|
@ -17340,16 +17272,16 @@
|
|||
},
|
||||
{
|
||||
"name": "brianium/paratest",
|
||||
"version": "v7.8.2",
|
||||
"version": "v7.8.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/paratestphp/paratest.git",
|
||||
"reference": "22c45ae560825291f11b32455878b89e718e758c"
|
||||
"reference": "a585c346ddf1bec22e51e20b5387607905604a71"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/paratestphp/paratest/zipball/22c45ae560825291f11b32455878b89e718e758c",
|
||||
"reference": "22c45ae560825291f11b32455878b89e718e758c",
|
||||
"url": "https://api.github.com/repos/paratestphp/paratest/zipball/a585c346ddf1bec22e51e20b5387607905604a71",
|
||||
"reference": "a585c346ddf1bec22e51e20b5387607905604a71",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
|
@ -17360,19 +17292,19 @@
|
|||
"fidry/cpu-core-counter": "^1.2.0",
|
||||
"jean85/pretty-package-versions": "^2.1.0",
|
||||
"php": "~8.2.0 || ~8.3.0 || ~8.4.0",
|
||||
"phpunit/php-code-coverage": "^11.0.8 || ^12",
|
||||
"phpunit/php-code-coverage": "^11.0.9 || ^12.0.4",
|
||||
"phpunit/php-file-iterator": "^5.1.0 || ^6",
|
||||
"phpunit/php-timer": "^7.0.1 || ^8",
|
||||
"phpunit/phpunit": "^11.5.7 || ^12.0.1",
|
||||
"phpunit/phpunit": "^11.5.11 || ^12.0.6",
|
||||
"sebastian/environment": "^7.2.0 || ^8",
|
||||
"symfony/console": "^6.4.17 || ^7.2.1",
|
||||
"symfony/process": "^6.4.15 || ^7.2.0"
|
||||
"symfony/process": "^6.4.19 || ^7.2.4"
|
||||
},
|
||||
"require-dev": {
|
||||
"doctrine/coding-standard": "^12.0.0",
|
||||
"ext-pcov": "*",
|
||||
"ext-posix": "*",
|
||||
"phpstan/phpstan": "^2.1.5",
|
||||
"phpstan/phpstan": "^2.1.6",
|
||||
"phpstan/phpstan-deprecation-rules": "^2.0.1",
|
||||
"phpstan/phpstan-phpunit": "^2.0.4",
|
||||
"phpstan/phpstan-strict-rules": "^2.0.3",
|
||||
|
|
@ -17417,7 +17349,7 @@
|
|||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/paratestphp/paratest/issues",
|
||||
"source": "https://github.com/paratestphp/paratest/tree/v7.8.2"
|
||||
"source": "https://github.com/paratestphp/paratest/tree/v7.8.3"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
|
@ -17429,7 +17361,7 @@
|
|||
"type": "paypal"
|
||||
}
|
||||
],
|
||||
"time": "2025-02-19T07:26:44+00:00"
|
||||
"time": "2025-03-05T08:29:11+00:00"
|
||||
},
|
||||
{
|
||||
"name": "clue/ndjson-react",
|
||||
|
|
@ -19041,16 +18973,16 @@
|
|||
},
|
||||
{
|
||||
"name": "phpunit/phpunit",
|
||||
"version": "11.5.10",
|
||||
"version": "11.5.11",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
||||
"reference": "d5df2b32d729562ff8db634678d71085ee579006"
|
||||
"reference": "3946ac38410be7440186c6e74584f31b15107fc7"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/d5df2b32d729562ff8db634678d71085ee579006",
|
||||
"reference": "d5df2b32d729562ff8db634678d71085ee579006",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3946ac38410be7440186c6e74584f31b15107fc7",
|
||||
"reference": "3946ac38410be7440186c6e74584f31b15107fc7",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
|
@ -19064,7 +18996,7 @@
|
|||
"phar-io/manifest": "^2.0.4",
|
||||
"phar-io/version": "^3.2.1",
|
||||
"php": ">=8.2",
|
||||
"phpunit/php-code-coverage": "^11.0.8",
|
||||
"phpunit/php-code-coverage": "^11.0.9",
|
||||
"phpunit/php-file-iterator": "^5.1.0",
|
||||
"phpunit/php-invoker": "^5.0.1",
|
||||
"phpunit/php-text-template": "^4.0.1",
|
||||
|
|
@ -19122,7 +19054,7 @@
|
|||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
|
||||
"security": "https://github.com/sebastianbergmann/phpunit/security/policy",
|
||||
"source": "https://github.com/sebastianbergmann/phpunit/tree/11.5.10"
|
||||
"source": "https://github.com/sebastianbergmann/phpunit/tree/11.5.11"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
|
@ -19138,7 +19070,7 @@
|
|||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2025-02-25T06:11:48+00:00"
|
||||
"time": "2025-03-05T07:36:02+00:00"
|
||||
},
|
||||
{
|
||||
"name": "react/cache",
|
||||
|
|
@ -21281,7 +21213,6 @@
|
|||
"asm/php-ansible": 20,
|
||||
"beganovich/snappdf": 20,
|
||||
"horstoeko/orderx": 20,
|
||||
"invoiceninja/admin-api": 20,
|
||||
"invoiceninja/einvoice": 20,
|
||||
"socialiteproviders/apple": 20
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue