mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 13:12:50 +01:00
Fixes for tests
This commit is contained in:
parent
d1b55a6081
commit
e4fc7fa55a
@ -85,8 +85,6 @@ class HostedMigrations extends Command
|
||||
}
|
||||
|
||||
$path = public_path('storage/migrations/import');
|
||||
|
||||
nlog(public_path('storage/migrations/import'));
|
||||
|
||||
$directory = new DirectoryIterator($path);
|
||||
|
||||
|
@ -79,8 +79,6 @@ class ImportMigrations extends Command
|
||||
$this->buildCache();
|
||||
|
||||
$path = $this->option('path') ?? public_path('storage/migrations/import');
|
||||
|
||||
nlog(public_path('storage/migrations/import'));
|
||||
|
||||
$directory = new DirectoryIterator($path);
|
||||
|
||||
|
@ -46,7 +46,6 @@ class BaseSettings
|
||||
return is_null($value) ? '' : (string) $value;
|
||||
case 'bool':
|
||||
case 'boolean':
|
||||
nlog($value);
|
||||
return boolval($value);
|
||||
case 'object':
|
||||
return json_decode($value);
|
||||
|
@ -54,10 +54,7 @@ class ProRata
|
||||
{
|
||||
$days = $from_date->copy()->diffInDays($to_date);
|
||||
$days_in_frequency = $this->getDaysInFrequency($frequency);
|
||||
nlog($from_date->format('Y-m-d'));
|
||||
nlog($days);
|
||||
nlog($days_in_frequency);
|
||||
nlog($amount);
|
||||
|
||||
return round( (($days/$days_in_frequency) * $amount),2);
|
||||
}
|
||||
|
||||
|
@ -75,12 +75,6 @@ class PaymentAmountsBalanceRule implements Rule
|
||||
return true;
|
||||
}
|
||||
|
||||
// nlog(request()->input('invoices'));
|
||||
// nlog($payment_amounts);
|
||||
// nlog($invoice_amounts);
|
||||
// nlog(request()->all());
|
||||
nlog($payment_amounts ." >= " . $invoice_amounts);
|
||||
|
||||
return round($payment_amounts,2) >= round($invoice_amounts,2);
|
||||
|
||||
}
|
||||
|
@ -74,7 +74,6 @@ class BaseTransformer
|
||||
->where('id_number', $client_name);
|
||||
|
||||
if ($client_id_search->count() >= 1) {
|
||||
// nlog("found via id number => {$client_id_search->first()->id}");
|
||||
return $client_id_search->first()->id;
|
||||
}
|
||||
|
||||
@ -83,7 +82,6 @@ class BaseTransformer
|
||||
->where('name', $client_name);
|
||||
|
||||
if ($client_name_search->count() >= 1) {
|
||||
// nlog("found via name {$client_name_search->first()->id}");
|
||||
return $client_name_search->first()->id;
|
||||
}
|
||||
}
|
||||
@ -94,13 +92,10 @@ class BaseTransformer
|
||||
)->where('email', $client_email);
|
||||
|
||||
if ($contacts->count() >= 1) {
|
||||
// nlog("found via contact {$contacts->first()->client_id}");
|
||||
return $contacts->first()->client_id;
|
||||
}
|
||||
}
|
||||
|
||||
// nlog("did not find client");
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -66,14 +66,12 @@ class BaseTransformer
|
||||
|
||||
if ( $client_id_search->count() >= 1 ) {
|
||||
return $client_id_search->first()->id;
|
||||
nlog("found via id number");
|
||||
}
|
||||
|
||||
$client_name_search = $clients->where( 'name', $client_name );
|
||||
|
||||
if ( $client_name_search->count() >= 1 ) {
|
||||
return $client_name_search->first()->id;
|
||||
nlog("found via name");
|
||||
}
|
||||
|
||||
if ( ! empty( $client_email ) ) {
|
||||
@ -82,10 +80,8 @@ class BaseTransformer
|
||||
|
||||
if ( $contacts->count() >= 1 ) {
|
||||
return $contacts->first()->client_id;
|
||||
nlog("found via contact");
|
||||
}
|
||||
}
|
||||
// nlog("did not find client");
|
||||
|
||||
return null;
|
||||
}
|
||||
|
@ -483,8 +483,6 @@ class CompanyImport implements ShouldQueue
|
||||
$tmp_company->db = config('database.default');
|
||||
$tmp_company->account_id = $this->account->id;
|
||||
|
||||
nlog($tmp_company);
|
||||
|
||||
if(Ninja::isHosted())
|
||||
$tmp_company->subdomain = MultiDB::randomSubdomainGenerator();
|
||||
else
|
||||
|
@ -255,9 +255,6 @@ class CreditCard
|
||||
|
||||
$response = $this->eway_driver->init()->eway->createTransaction(\Eway\Rapid\Enum\ApiMethod::DIRECT, $transaction);
|
||||
|
||||
nlog('eway');
|
||||
nlog($response);
|
||||
|
||||
$response_status = ErrorCode::getStatus($response->ResponseMessage);
|
||||
|
||||
if(!$response_status['success']){
|
||||
|
@ -151,8 +151,6 @@ class PayFastPaymentDriver extends BaseDriver
|
||||
if($this->company_gateway->getConfigField('passphrase'))
|
||||
$fields['passphrase'] = $this->company_gateway->getConfigField('passphrase');
|
||||
|
||||
nlog(http_build_query($fields));
|
||||
|
||||
return md5(http_build_query($fields));
|
||||
}
|
||||
|
||||
|
@ -41,70 +41,15 @@ class HandleRestore extends AbstractService
|
||||
|
||||
foreach ($this->invoice->payments as $payment) {
|
||||
//restore the payment record
|
||||
// $payment->restore();
|
||||
$this->invoice->restore();
|
||||
|
||||
// //determine the paymentable amount before paymentable restoration
|
||||
// $pre_restore_amount = $payment->paymentables()
|
||||
// ->where('paymentable_type', '=', 'invoices')
|
||||
// ->sum(\DB::raw('amount'));
|
||||
|
||||
// nlog("first pre restore amount = {$pre_restore_amount}");
|
||||
|
||||
// $pre_restore_amount -= $payment->paymentables()
|
||||
// ->where('paymentable_type', '=', 'invoices')
|
||||
// ->sum(\DB::raw('refunded'));
|
||||
|
||||
// nlog("second pre restore amount = {$pre_restore_amount}");
|
||||
|
||||
|
||||
//restore the paymentables
|
||||
// $payment->paymentables()
|
||||
// ->where('paymentable_type', '=', 'invoices')
|
||||
// ->where('paymentable_id', $this->invoice->id)
|
||||
// ->restore();
|
||||
|
||||
//determine the post restore paymentable amount (we need to increment the payment amount by the difference between pre and post)
|
||||
// $payment_amount = $payment->paymentables()
|
||||
// ->where('paymentable_type', '=', 'invoices')
|
||||
// ->sum(\DB::raw('amount'));
|
||||
|
||||
// nlog("first payment_amount = {$payment_amount}");
|
||||
|
||||
// $payment_amount -= $payment->paymentables()
|
||||
// ->where('paymentable_type', '=', 'invoices')
|
||||
// ->sum(\DB::raw('refunded'));
|
||||
|
||||
// nlog("second payment_amount = {$payment_amount}");
|
||||
|
||||
// nlog($payment->amount . " == " . $payment_amount);
|
||||
|
||||
// if ($payment->amount == $payment_amount) {
|
||||
// $payment->is_deleted = false;
|
||||
// $payment->save();
|
||||
|
||||
// $this->payment_total += $payment_amount;
|
||||
// } else {
|
||||
// $payment->is_deleted = false;
|
||||
// $payment->amount += ($payment_amount - $pre_restore_amount);
|
||||
// $payment->applied += ($payment_amount - $pre_restore_amount);
|
||||
// $payment->save();
|
||||
|
||||
// $this->payment_total += ($payment_amount - $pre_restore_amount);
|
||||
// }
|
||||
}
|
||||
|
||||
//adjust ledger balance
|
||||
$this->invoice->ledger()->updateInvoiceBalance($this->invoice->balance, "Restored invoice {$this->invoice->number}")->save();
|
||||
|
||||
//adjust paid to dates
|
||||
// $this->invoice->client->service()->updatePaidToDate($this->payment_total)->save();
|
||||
|
||||
$this->invoice->client->service()->updateBalance($this->invoice->balance)->save();
|
||||
|
||||
// you only need to touch the ledger ONCE per transaction.
|
||||
// $this->invoice->ledger()->updatePaymentBalance($this->payment_total*-1, "Restored payment for invoice {$this->invoice->number}")->save();
|
||||
|
||||
$this->windBackInvoiceNumber();
|
||||
|
||||
$this->invoice->is_deleted = false;
|
||||
|
Loading…
Reference in New Issue
Block a user