mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Working on credit payments
This commit is contained in:
parent
1338a5e558
commit
2d01bc1e27
@ -93,7 +93,7 @@ class PaymentRepository extends BaseRepository
|
|||||||
|
|
||||||
$_credit_totals = array_sum(array_column($data['credits'], 'amount'));
|
$_credit_totals = array_sum(array_column($data['credits'], 'amount'));
|
||||||
|
|
||||||
$data['amount'] -= $_credit_totals;
|
//$data['amount'] -= $_credit_totals;
|
||||||
|
|
||||||
$client->service()->updatePaidToDate($_credit_totals)->save();
|
$client->service()->updatePaidToDate($_credit_totals)->save();
|
||||||
|
|
||||||
@ -161,23 +161,10 @@ class PaymentRepository extends BaseRepository
|
|||||||
if(!$is_existing_payment)
|
if(!$is_existing_payment)
|
||||||
event(new PaymentWasCreated($payment, $payment->company, Ninja::eventVars()));
|
event(new PaymentWasCreated($payment, $payment->company, Ninja::eventVars()));
|
||||||
|
|
||||||
/*info("invoice totals = {$invoice_totals}");
|
|
||||||
info("credit totals = {$credit_totals}");
|
|
||||||
info("applied totals = " . array_sum(array_column($data['invoices'], 'amount')));
|
|
||||||
*/
|
|
||||||
//$invoice_totals -= $credit_totals;
|
|
||||||
|
|
||||||
////$payment->amount = $invoice_totals; //creates problems when setting amount like this.
|
|
||||||
|
|
||||||
// if($credit_totals == $payment->amount){
|
$payment->applied += ($invoice_totals - $credit_totals); //wont work because - check tests
|
||||||
// $payment->applied += $credit_totals;
|
// $payment->applied += $invoice_totals; //wont work because - check tests
|
||||||
// } elseif ($invoice_totals == $payment->amount) {
|
|
||||||
// $payment->applied += $payment->amount;
|
|
||||||
// } elseif ($invoice_totals < $payment->amount) {
|
|
||||||
// $payment->applied += $invoice_totals;
|
|
||||||
// }
|
|
||||||
|
|
||||||
$payment->applied += ($invoice_totals - $credit_totals); //wont work because - check tests
|
|
||||||
|
|
||||||
$payment->save();
|
$payment->save();
|
||||||
|
|
||||||
|
81
composer.lock
generated
81
composer.lock
generated
@ -4,7 +4,7 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "08ae0ebd522fae2599454303710f08b1",
|
"content-hash": "152c174ecc48f87a2c7fd00335c6fc86",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "asgrim/ofxparser",
|
"name": "asgrim/ofxparser",
|
||||||
@ -6497,85 +6497,6 @@
|
|||||||
],
|
],
|
||||||
"time": "2019-11-12T09:31:26+00:00"
|
"time": "2019-11-12T09:31:26+00:00"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "swooletw/laravel-swoole",
|
|
||||||
"version": "v2.6.68",
|
|
||||||
"source": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/swooletw/laravel-swoole.git",
|
|
||||||
"reference": "4167206bfbaea752264c814cac5c2172e72a400a"
|
|
||||||
},
|
|
||||||
"dist": {
|
|
||||||
"type": "zip",
|
|
||||||
"url": "https://api.github.com/repos/swooletw/laravel-swoole/zipball/4167206bfbaea752264c814cac5c2172e72a400a",
|
|
||||||
"reference": "4167206bfbaea752264c814cac5c2172e72a400a",
|
|
||||||
"shasum": ""
|
|
||||||
},
|
|
||||||
"require": {
|
|
||||||
"illuminate/console": "~5.4|~6.0|~7.0|~8.0",
|
|
||||||
"illuminate/contracts": "~5.4|~6.0|~7.0|~8.0",
|
|
||||||
"illuminate/http": "~5.4|~6.0|~7.0|~8.0",
|
|
||||||
"illuminate/support": "~5.4|~6.0|~7.0|~8.0",
|
|
||||||
"php": "^7.2",
|
|
||||||
"predis/predis": "^1.1"
|
|
||||||
},
|
|
||||||
"require-dev": {
|
|
||||||
"codedungeon/phpunit-result-printer": "^0.14.0",
|
|
||||||
"laravel/lumen-framework": "~5.4|~6.0|~7.0|~8.0",
|
|
||||||
"mockery/mockery": "~1.0",
|
|
||||||
"php-coveralls/php-coveralls": "^2.1",
|
|
||||||
"php-mock/php-mock": "^2.0",
|
|
||||||
"phpunit/php-code-coverage": "^6.1",
|
|
||||||
"phpunit/phpunit": "^7.5",
|
|
||||||
"swoole/ide-helper": "@dev"
|
|
||||||
},
|
|
||||||
"type": "library",
|
|
||||||
"extra": {
|
|
||||||
"laravel": {
|
|
||||||
"providers": [
|
|
||||||
"SwooleTW\\Http\\LaravelServiceProvider"
|
|
||||||
],
|
|
||||||
"aliases": {
|
|
||||||
"Server": "SwooleTW\\Http\\Server\\Facades\\Server",
|
|
||||||
"Table": "SwooleTW\\Http\\Server\\Facades\\Table",
|
|
||||||
"Room": "SwooleTW\\Http\\Websocket\\Facades\\Room",
|
|
||||||
"Websocket": "SwooleTW\\Http\\Websocket\\Facades\\Websocket"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"autoload": {
|
|
||||||
"files": [
|
|
||||||
"src/Server/helpers.php"
|
|
||||||
],
|
|
||||||
"psr-4": {
|
|
||||||
"SwooleTW\\Http\\": "src"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
|
||||||
"license": [
|
|
||||||
"MIT"
|
|
||||||
],
|
|
||||||
"authors": [
|
|
||||||
{
|
|
||||||
"name": "Albert Chen",
|
|
||||||
"email": "albert@unisharp.com"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Huang Yi",
|
|
||||||
"email": "coodeer@163.com"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"description": "High performance HTTP server based on Swoole. Speed up your Laravel and Lumen applications.",
|
|
||||||
"keywords": [
|
|
||||||
"http",
|
|
||||||
"laravel",
|
|
||||||
"lumen",
|
|
||||||
"performance",
|
|
||||||
"server",
|
|
||||||
"swoole"
|
|
||||||
],
|
|
||||||
"time": "2020-09-21T10:06:50+00:00"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "symfony/console",
|
"name": "symfony/console",
|
||||||
"version": "v5.1.7",
|
"version": "v5.1.7",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user