mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 21:22:58 +01:00
commit
c9d94804de
@ -109,6 +109,8 @@ class CompanySettings extends BaseSettings
|
|||||||
public $reset_counter_date = '';
|
public $reset_counter_date = '';
|
||||||
public $counter_padding = 4;
|
public $counter_padding = 4;
|
||||||
|
|
||||||
|
public $auto_bill = 'off'; //off,always,optin,optout
|
||||||
|
|
||||||
public $design = 'views/pdf/design1.blade.php';
|
public $design = 'views/pdf/design1.blade.php';
|
||||||
|
|
||||||
public $invoice_terms = '';
|
public $invoice_terms = '';
|
||||||
@ -238,6 +240,7 @@ class CompanySettings extends BaseSettings
|
|||||||
public $client_portal_enable_uploads = false;
|
public $client_portal_enable_uploads = false;
|
||||||
|
|
||||||
public static $casts = [
|
public static $casts = [
|
||||||
|
'auto_bill' => 'string',
|
||||||
'lock_invoices' => 'string',
|
'lock_invoices' => 'string',
|
||||||
'client_portal_terms' => 'string',
|
'client_portal_terms' => 'string',
|
||||||
'client_portal_privacy_policy' => 'string',
|
'client_portal_privacy_policy' => 'string',
|
||||||
|
@ -37,6 +37,9 @@ class Handler extends ExceptionHandler
|
|||||||
*/
|
*/
|
||||||
protected $dontReport = [
|
protected $dontReport = [
|
||||||
\PDOException::class,
|
\PDOException::class,
|
||||||
|
\Swift_TransportException::class,
|
||||||
|
\Illuminate\Queue\MaxAttemptsExceededException::class,
|
||||||
|
\Symfony\Component\Console\Exception\CommandNotFoundException::class
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -147,6 +147,8 @@ class MigrationController extends BaseController
|
|||||||
{
|
{
|
||||||
|
|
||||||
$company->clients()->delete();
|
$company->clients()->delete();
|
||||||
|
$company->products()->delete();
|
||||||
|
|
||||||
$company->save();
|
$company->save();
|
||||||
|
|
||||||
return response()->json(['message' => 'Settings preserved'], 200);
|
return response()->json(['message' => 'Settings preserved'], 200);
|
||||||
|
@ -60,7 +60,7 @@ class EmailQuote implements ShouldQueue
|
|||||||
return $this->logMailError(Mail::failures());
|
return $this->logMailError(Mail::failures());
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->quote_invitation->quote->markSent()->save();
|
$this->quote_invitation->quote->service()->markSent()->save();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -460,7 +460,8 @@ class Client extends BaseModel implements HasLocalePreference
|
|||||||
|
|
||||||
$company_gateways = $this->getSetting('company_gateway_ids');
|
$company_gateways = $this->getSetting('company_gateway_ids');
|
||||||
|
|
||||||
if ($company_gateways) {
|
if ($company_gateways || $company_gateways == "0") { //we need to check for "0" here as we disable a payment gateway for a client with the number "0"
|
||||||
|
|
||||||
$transformed_ids = $this->transformKeys(explode(",", $company_gateways));
|
$transformed_ids = $this->transformKeys(explode(",", $company_gateways));
|
||||||
$gateways = $this->company
|
$gateways = $this->company
|
||||||
->company_gateways
|
->company_gateways
|
||||||
|
@ -43,6 +43,7 @@ class CompanyGateway extends BaseModel
|
|||||||
'custom_value2',
|
'custom_value2',
|
||||||
'custom_value3',
|
'custom_value3',
|
||||||
'custom_value4',
|
'custom_value4',
|
||||||
|
'token_billing',
|
||||||
];
|
];
|
||||||
|
|
||||||
public static $credit_cards = [
|
public static $credit_cards = [
|
||||||
@ -270,8 +271,9 @@ class CompanyGateway extends BaseModel
|
|||||||
info("fee after adding fee tax 3 = {$fee}");
|
info("fee after adding fee tax 3 = {$fee}");
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO CALCULATE FEE CAP HERE
|
if($fees_and_limits->fee_cap > 0 && ($fee > $fees_and_limits->fee_cap))
|
||||||
|
$fee = $fees_and_limits->fee_cap;
|
||||||
|
|
||||||
return $fee;
|
return $fee;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@ class Document extends BaseModel
|
|||||||
*/
|
*/
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'is_default',
|
'is_default',
|
||||||
|
'is_public',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
@ -268,7 +268,7 @@ class BasePaymentDriver
|
|||||||
$payment->currency_id = $this->client->getSetting('currency_id');
|
$payment->currency_id = $this->client->getSetting('currency_id');
|
||||||
$payment->date = Carbon::now();
|
$payment->date = Carbon::now();
|
||||||
|
|
||||||
return $payment;
|
return $payment->service()->applyNumber()->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -160,7 +160,7 @@ class Charge
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
$payment_method_type = $response->charges->data[0]->payment_method_details->card->brand;
|
$payment_method_type = $response->charges->data[0]->payment_method_details->card->brand;
|
||||||
info($payment_method_type);
|
//info($payment_method_type);
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'gateway_type_id' => $cgt->gateway_type_id,
|
'gateway_type_id' => $cgt->gateway_type_id,
|
||||||
|
@ -393,9 +393,8 @@ class StripePaymentDriver extends BasePaymentDriver
|
|||||||
$payment->date = Carbon::now();
|
$payment->date = Carbon::now();
|
||||||
$payment->transaction_reference = $data['transaction_reference'];
|
$payment->transaction_reference = $data['transaction_reference'];
|
||||||
$payment->amount = $amount;
|
$payment->amount = $amount;
|
||||||
$payment->client->getNextPaymentNumber($this->client);
|
|
||||||
$payment->save();
|
$payment->save();
|
||||||
|
|
||||||
return $payment;
|
return $payment->service()->applyNumber()->save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -69,6 +69,7 @@ class ActivityRepository extends BaseRepository
|
|||||||
if (get_class($entity) == Invoice::class || get_class($entity) == Quote::class || get_class($entity) == Credit::class){
|
if (get_class($entity) == Invoice::class || get_class($entity) == Quote::class || get_class($entity) == Credit::class){
|
||||||
$contact = $entity->client->primary_contact()->first();
|
$contact = $entity->client->primary_contact()->first();
|
||||||
$backup->html_backup = $this->generateEntityHtml($entity->getEntityDesigner(), $entity, $contact);
|
$backup->html_backup = $this->generateEntityHtml($entity->getEntityDesigner(), $entity, $contact);
|
||||||
|
$backup->amount = $entity->amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
$backup->activity_id = $activity->id;
|
$backup->activity_id = $activity->id;
|
||||||
|
@ -71,8 +71,6 @@ class PaymentRepository extends BaseRepository
|
|||||||
private function applyPayment(array $data, Payment $payment): ?Payment
|
private function applyPayment(array $data, Payment $payment): ?Payment
|
||||||
{
|
{
|
||||||
|
|
||||||
info(print_r($data,1));
|
|
||||||
|
|
||||||
//check currencies here and fill the exchange rate data if necessary
|
//check currencies here and fill the exchange rate data if necessary
|
||||||
if (!$payment->id) {
|
if (!$payment->id) {
|
||||||
$this->processExchangeRates($data, $payment);
|
$this->processExchangeRates($data, $payment);
|
||||||
@ -149,10 +147,10 @@ info(print_r($data,1));
|
|||||||
|
|
||||||
event(new PaymentWasCreated($payment, $payment->company, Ninja::eventVars()));
|
event(new PaymentWasCreated($payment, $payment->company, Ninja::eventVars()));
|
||||||
|
|
||||||
/*info("invoice totals = {$invoice_totals}");
|
/*info("invoice totals = {$invoice_totals}");
|
||||||
info("credit totals = {$credit_totals}");
|
info("credit totals = {$credit_totals}");
|
||||||
info("applied totals = " . array_sum(array_column($data['invoices'], 'amount')));
|
info("applied totals = " . array_sum(array_column($data['invoices'], 'amount')));
|
||||||
*/
|
*/
|
||||||
//$invoice_totals -= $credit_totals;
|
//$invoice_totals -= $credit_totals;
|
||||||
|
|
||||||
////$payment->amount = $invoice_totals; //creates problems when setting amount like this.
|
////$payment->amount = $invoice_totals; //creates problems when setting amount like this.
|
||||||
|
@ -39,7 +39,7 @@ class SendEmail
|
|||||||
* @param string $this->reminder_template The template name ie reminder1
|
* @param string $this->reminder_template The template name ie reminder1
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function run(): array
|
public function run()
|
||||||
{
|
{
|
||||||
if (!$this->reminder_template) {
|
if (!$this->reminder_template) {
|
||||||
$this->reminder_template = $this->quote->calculateTemplate();
|
$this->reminder_template = $this->quote->calculateTemplate();
|
||||||
@ -52,5 +52,7 @@ class SendEmail
|
|||||||
EmailQuote::dispatchNow($email_builder, $invitation);
|
EmailQuote::dispatchNow($email_builder, $invitation);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$this->quote->service()->markSent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,6 @@ class CreditTransformer extends EntityTransformer
|
|||||||
protected $defaultIncludes = [
|
protected $defaultIncludes = [
|
||||||
'invitations',
|
'invitations',
|
||||||
'documents',
|
'documents',
|
||||||
'history',
|
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $availableIncludes = [
|
protected $availableIncludes = [
|
||||||
@ -136,6 +135,7 @@ class CreditTransformer extends EntityTransformer
|
|||||||
'custom_surcharge_tax4' => (bool) $credit->custom_surcharge_tax4,
|
'custom_surcharge_tax4' => (bool) $credit->custom_surcharge_tax4,
|
||||||
'line_items' => $credit->line_items ?: (array)[],
|
'line_items' => $credit->line_items ?: (array)[],
|
||||||
'entity_type' => 'credit',
|
'entity_type' => 'credit',
|
||||||
|
'exchange_rate' => (float)$credit->exchange_rate,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,7 @@ class InvoiceHistoryTransformer extends EntityTransformer
|
|||||||
'activity_id' => $this->encodePrimaryKey($backup->activity_id),
|
'activity_id' => $this->encodePrimaryKey($backup->activity_id),
|
||||||
'json_backup' => (string) $backup->json_backup ?: '',
|
'json_backup' => (string) $backup->json_backup ?: '',
|
||||||
'html_backup' => (string) $backup->html_backup ?: '',
|
'html_backup' => (string) $backup->html_backup ?: '',
|
||||||
|
'amount' => (float) $backup->amount,
|
||||||
'created_at' => (int)$backup->created_at,
|
'created_at' => (int)$backup->created_at,
|
||||||
'updated_at' => (int)$backup->updated_at,
|
'updated_at' => (int)$backup->updated_at,
|
||||||
];
|
];
|
||||||
|
@ -135,6 +135,7 @@ class InvoiceTransformer extends EntityTransformer
|
|||||||
'custom_surcharge2' => (float)$invoice->custom_surcharge2,
|
'custom_surcharge2' => (float)$invoice->custom_surcharge2,
|
||||||
'custom_surcharge3' => (float)$invoice->custom_surcharge3,
|
'custom_surcharge3' => (float)$invoice->custom_surcharge3,
|
||||||
'custom_surcharge4' => (float)$invoice->custom_surcharge4,
|
'custom_surcharge4' => (float)$invoice->custom_surcharge4,
|
||||||
|
'exchange_rate' => (float)$invoice->exchange_rate,
|
||||||
'custom_surcharge_tax1' => (bool) $invoice->custom_surcharge_tax1,
|
'custom_surcharge_tax1' => (bool) $invoice->custom_surcharge_tax1,
|
||||||
'custom_surcharge_tax2' => (bool) $invoice->custom_surcharge_tax2,
|
'custom_surcharge_tax2' => (bool) $invoice->custom_surcharge_tax2,
|
||||||
'custom_surcharge_tax3' => (bool) $invoice->custom_surcharge_tax3,
|
'custom_surcharge_tax3' => (bool) $invoice->custom_surcharge_tax3,
|
||||||
|
@ -27,7 +27,6 @@ class QuoteTransformer extends EntityTransformer
|
|||||||
protected $defaultIncludes = [
|
protected $defaultIncludes = [
|
||||||
'invitations',
|
'invitations',
|
||||||
'documents',
|
'documents',
|
||||||
'history'
|
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $availableIncludes = [
|
protected $availableIncludes = [
|
||||||
@ -135,7 +134,7 @@ class QuoteTransformer extends EntityTransformer
|
|||||||
'custom_surcharge_taxes' => (bool) $quote->custom_surcharge_taxes,
|
'custom_surcharge_taxes' => (bool) $quote->custom_surcharge_taxes,
|
||||||
'line_items' => $quote->line_items ?: (array)[],
|
'line_items' => $quote->line_items ?: (array)[],
|
||||||
'entity_type' => 'quote',
|
'entity_type' => 'quote',
|
||||||
|
'exchange_rate' => (float)$quote->exchange_rate,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -122,7 +122,9 @@ class HtmlEngine
|
|||||||
$data['$number'] = ['value' => $this->entity->number ?: ' ', 'label' => ctrans('texts.invoice_number')];
|
$data['$number'] = ['value' => $this->entity->number ?: ' ', 'label' => ctrans('texts.invoice_number')];
|
||||||
$data['$entity.terms'] = ['value' => $this->entity->terms ?: ' ', 'label' => ctrans('texts.invoice_terms')];
|
$data['$entity.terms'] = ['value' => $this->entity->terms ?: ' ', 'label' => ctrans('texts.invoice_terms')];
|
||||||
$data['$terms'] = &$data['$entity.terms'];
|
$data['$terms'] = &$data['$entity.terms'];
|
||||||
$data['$view_link'] = ['value' => '<a href="' .$this->invitation->getLink() .'">'. ctrans('texts.view_invoice').'</a>', 'label' => ctrans('texts.view_invoice')];
|
// $data['$view_link'] = ['value' => '<a href="' .$this->invitation->getLink() .'">'. ctrans('texts.view_invoice').'</a>', 'label' => ctrans('texts.view_invoice')];
|
||||||
|
$data['$view_link'] = ['value' => $this->invitation->getLink(), 'label' => ctrans('texts.view_invoice')];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->entity_string == 'quote') {
|
if ($this->entity_string == 'quote') {
|
||||||
@ -130,7 +132,8 @@ class HtmlEngine
|
|||||||
$data['$number'] = ['value' => $this->entity->number ?: ' ', 'label' => ctrans('texts.quote_number')];
|
$data['$number'] = ['value' => $this->entity->number ?: ' ', 'label' => ctrans('texts.quote_number')];
|
||||||
$data['$entity.terms'] = ['value' => $this->entity->terms ?: ' ', 'label' => ctrans('texts.quote_terms')];
|
$data['$entity.terms'] = ['value' => $this->entity->terms ?: ' ', 'label' => ctrans('texts.quote_terms')];
|
||||||
$data['$terms'] = &$data['$entity.terms'];
|
$data['$terms'] = &$data['$entity.terms'];
|
||||||
$data['$view_link'] = ['value' => '<a href="' .$this->invitation->getLink() .'">'. ctrans('texts.view_quote').'</a>', 'label' => ctrans('texts.view_quote')];
|
// $data['$view_link'] = ['value' => '<a href="' .$this->invitation->getLink() .'">'. ctrans('texts.view_quote').'</a>', 'label' => ctrans('texts.view_quote')];
|
||||||
|
$data['$view_link'] = ['value' => $this->invitation->getLink(), 'label' => ctrans('texts.view_quote')];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->entity_string == 'credit') {
|
if ($this->entity_string == 'credit') {
|
||||||
@ -138,7 +141,8 @@ class HtmlEngine
|
|||||||
$data['$number'] = ['value' => $this->entity->number ?: ' ', 'label' => ctrans('texts.credit_number')];
|
$data['$number'] = ['value' => $this->entity->number ?: ' ', 'label' => ctrans('texts.credit_number')];
|
||||||
$data['$entity.terms'] = ['value' => $this->entity->terms ?: ' ', 'label' => ctrans('texts.credit_terms')];
|
$data['$entity.terms'] = ['value' => $this->entity->terms ?: ' ', 'label' => ctrans('texts.credit_terms')];
|
||||||
$data['$terms'] = &$data['$entity.terms'];
|
$data['$terms'] = &$data['$entity.terms'];
|
||||||
$data['$view_link'] = ['value' => '<a href="' .$this->invitation->getLink() .'">'. ctrans('texts.view_credit').'</a>', 'label' => ctrans('texts.view_credit')];
|
// $data['$view_link'] = ['value' => '<a href="' .$this->invitation->getLink() .'">'. ctrans('texts.view_credit').'</a>', 'label' => ctrans('texts.view_credit')];
|
||||||
|
$data['$view_link'] = ['value' => $this->invitation->getLink(), 'label' => ctrans('texts.view_credit')];
|
||||||
}
|
}
|
||||||
|
|
||||||
$data['$entity_number'] = &$data['$number'];
|
$data['$entity_number'] = &$data['$number'];
|
||||||
|
@ -82,12 +82,12 @@ class SystemHealth
|
|||||||
exec('node -v', $foo, $exitCode);
|
exec('node -v', $foo, $exitCode);
|
||||||
|
|
||||||
if ($exitCode === 0) {
|
if ($exitCode === 0) {
|
||||||
return $foo[0];
|
return empty($foo[0]) ? 'Found node, but no version information' : $foo[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -98,12 +98,11 @@ class SystemHealth
|
|||||||
exec('npm -v', $foo, $exitCode);
|
exec('npm -v', $foo, $exitCode);
|
||||||
|
|
||||||
if ($exitCode === 0) {
|
if ($exitCode === 0) {
|
||||||
return $foo[0];
|
return empty($foo[0]) ? 'Found npm, but no version information' : $foo[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
}catch (\Exception $e) {
|
}catch (\Exception $e) {
|
||||||
|
return false;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -215,7 +215,8 @@ trait MakesInvoiceValues
|
|||||||
$data['$number'] = ['value' => $this->number ?: ' ', 'label' => ctrans('texts.invoice_number')];
|
$data['$number'] = ['value' => $this->number ?: ' ', 'label' => ctrans('texts.invoice_number')];
|
||||||
$data['$entity.terms'] = ['value' => $this->terms ?: ' ', 'label' => ctrans('texts.invoice_terms')];
|
$data['$entity.terms'] = ['value' => $this->terms ?: ' ', 'label' => ctrans('texts.invoice_terms')];
|
||||||
$data['$terms'] = &$data['$entity.terms'];
|
$data['$terms'] = &$data['$entity.terms'];
|
||||||
$data['$view_link'] = ['value' => '<a href="' .$invitation->getLink() .'">'. ctrans('texts.view_invoice').'</a>', 'label' => ctrans('texts.view_invoice')];
|
//$data['$view_link'] = ['value' => '<a href="' .$invitation->getLink() .'">'. ctrans('texts.view_invoice').'</a>', 'label' => ctrans('texts.view_invoice')];
|
||||||
|
$data['$view_link'] = ['value' => $invitation->getLink(), 'label' => ctrans('texts.view_invoice')];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this instanceof Quote) {
|
if ($this instanceof Quote) {
|
||||||
@ -223,7 +224,8 @@ trait MakesInvoiceValues
|
|||||||
$data['$number'] = ['value' => $this->number ?: ' ', 'label' => ctrans('texts.quote_number')];
|
$data['$number'] = ['value' => $this->number ?: ' ', 'label' => ctrans('texts.quote_number')];
|
||||||
$data['$entity.terms'] = ['value' => $this->terms ?: ' ', 'label' => ctrans('texts.quote_terms')];
|
$data['$entity.terms'] = ['value' => $this->terms ?: ' ', 'label' => ctrans('texts.quote_terms')];
|
||||||
$data['$terms'] = &$data['$entity.terms'];
|
$data['$terms'] = &$data['$entity.terms'];
|
||||||
$data['$view_link'] = ['value' => '<a href="' .$invitation->getLink() .'">'. ctrans('texts.view_quote').'</a>', 'label' => ctrans('texts.view_quote')];
|
// $data['$view_link'] = ['value' => '<a href="' .$invitation->getLink() .'">'. ctrans('texts.view_quote').'</a>', 'label' => ctrans('texts.view_quote')];
|
||||||
|
$data['$view_link'] = ['value' => $invitation->getLink(), 'label' => ctrans('texts.view_quote')];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this instanceof Credit) {
|
if ($this instanceof Credit) {
|
||||||
@ -231,7 +233,8 @@ trait MakesInvoiceValues
|
|||||||
$data['$number'] = ['value' => $this->number ?: ' ', 'label' => ctrans('texts.credit_number')];
|
$data['$number'] = ['value' => $this->number ?: ' ', 'label' => ctrans('texts.credit_number')];
|
||||||
$data['$entity.terms'] = ['value' => $this->terms ?: ' ', 'label' => ctrans('texts.credit_terms')];
|
$data['$entity.terms'] = ['value' => $this->terms ?: ' ', 'label' => ctrans('texts.credit_terms')];
|
||||||
$data['$terms'] = &$data['$entity.terms'];
|
$data['$terms'] = &$data['$entity.terms'];
|
||||||
$data['$view_link'] = ['value' => '<a href="' .$invitation->getLink() .'">'. ctrans('texts.view_credit').'</a>', 'label' => ctrans('texts.view_credit')];
|
// $data['$view_link'] = ['value' => '<a href="' .$invitation->getLink() .'">'. ctrans('texts.view_credit').'</a>', 'label' => ctrans('texts.view_credit')];
|
||||||
|
$data['$view_link'] = ['value' => $invitation->getLink(), 'label' => ctrans('texts.view_credit')];
|
||||||
}
|
}
|
||||||
|
|
||||||
$data['$entity_number'] = &$data['$number'];
|
$data['$entity_number'] = &$data['$number'];
|
||||||
|
@ -30,6 +30,7 @@ return [
|
|||||||
'phantomjs_key' => env('PHANTOMJS_KEY', false),
|
'phantomjs_key' => env('PHANTOMJS_KEY', false),
|
||||||
'phantomjs_secret' => env('PHANTOMJS_SECRET', false),
|
'phantomjs_secret' => env('PHANTOMJS_SECRET', false),
|
||||||
|
|
||||||
|
'sentry_dsn' => env('SENTRY_LARAVEL_DSN', 'https://b36c3ae4f26b45689bc3d4e3774fb303@sentry.invoicing.co/4'),
|
||||||
'environment' => env('NINJA_ENVIRONMENT', 'selfhost'), // 'hosted', 'development', 'selfhost', 'reseller'
|
'environment' => env('NINJA_ENVIRONMENT', 'selfhost'), // 'hosted', 'development', 'selfhost', 'reseller'
|
||||||
|
|
||||||
// Settings used by invoiceninja.com
|
// Settings used by invoiceninja.com
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
return [
|
return [
|
||||||
|
|
||||||
'dsn' => env('SENTRY_LARAVEL_DSN', env('SENTRY_DSN')),
|
//'dsn' => env('SENTRY_LARAVEL_DSN', env('SENTRY_DSN')),
|
||||||
|
'dsn' => config('ninja.sentry_dsn'),
|
||||||
// capture release as git sha
|
// capture release as git sha
|
||||||
// 'release' => trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD')),
|
// 'release' => trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD')),
|
||||||
|
|
||||||
|
10
database/factories/QuoteInvitationFactory.php
Normal file
10
database/factories/QuoteInvitationFactory.php
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Faker\Generator as Faker;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
|
$factory->define(App\Models\QuoteInvitation::class, function (Faker $faker) {
|
||||||
|
return [
|
||||||
|
'key' => Str::random(40),
|
||||||
|
];
|
||||||
|
});
|
@ -13,9 +13,18 @@ class AddIsPublicToDocumentsTable extends Migration
|
|||||||
*/
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
|
|
||||||
Schema::table('documents', function (Blueprint $table) {
|
Schema::table('documents', function (Blueprint $table) {
|
||||||
$table->boolean('is_public')->default(false);
|
$table->boolean('is_public')->default(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Schema::table('backups', function (Blueprint $table) {
|
||||||
|
$table->decimal('amount', 16, 4);
|
||||||
|
});
|
||||||
|
|
||||||
|
Schema::table('company_gateways', function (Blueprint $table) {
|
||||||
|
$table->enum('token_billing', ['off', 'always','optin','optout'])->default('off');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -25,8 +34,6 @@ class AddIsPublicToDocumentsTable extends Migration
|
|||||||
*/
|
*/
|
||||||
public function down()
|
public function down()
|
||||||
{
|
{
|
||||||
Schema::table('documents', function (Blueprint $table) {
|
|
||||||
$table->dropColumn('is_public');
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@ use Tests\TestCase;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
|
* @covers App\Models\CompanyGateway
|
||||||
*/
|
*/
|
||||||
class CompanyGatewayApiTest extends TestCase
|
class CompanyGatewayApiTest extends TestCase
|
||||||
{
|
{
|
||||||
@ -352,4 +353,42 @@ class CompanyGatewayApiTest extends TestCase
|
|||||||
|
|
||||||
$this->assertEquals(12, $company_gateway->calcGatewayFee(10));
|
$this->assertEquals(12, $company_gateway->calcGatewayFee(10));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function testFeesAndLimitsFeePercentAndAmountAndDoubleTaxCalcuationWithFeeCap()
|
||||||
|
{
|
||||||
|
//{"1":{"min_limit":1,"max_limit":1000000,"fee_amount":10,"fee_percent":2,"fee_tax_name1":"","fee_tax_name2":"","fee_tax_name3":"","fee_tax_rate1":0,"fee_tax_rate2":0,"fee_tax_rate3":0,"fee_cap":10,"adjust_fee_percent":true}}
|
||||||
|
$fee = new FeesAndLimits;
|
||||||
|
$fee->fee_amount = 10;
|
||||||
|
// $fee->fee_percent = 2;
|
||||||
|
$fee->fee_tax_name1 = 'GST';
|
||||||
|
$fee->fee_tax_rate1 = '10.0';
|
||||||
|
$fee->fee_tax_name2 = 'GST';
|
||||||
|
$fee->fee_tax_rate2 = '10.0';
|
||||||
|
$fee->fee_cap = 1;
|
||||||
|
|
||||||
|
$fee_arr[1] = (array)$fee;
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'config' => 'random config',
|
||||||
|
'gateway_key' => '3b6621f970ab18887c4f6dca78d3f8bb',
|
||||||
|
'fees_and_limits' => $fee_arr,
|
||||||
|
];
|
||||||
|
|
||||||
|
/* POST */
|
||||||
|
$response = $this->withHeaders([
|
||||||
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
|
'X-API-TOKEN' => $this->token
|
||||||
|
])->post('/api/v1/company_gateways', $data);
|
||||||
|
|
||||||
|
|
||||||
|
$response->assertStatus(200);
|
||||||
|
|
||||||
|
$arr = $response->json();
|
||||||
|
$id = $this->decodePrimaryKey($arr['data']['id']);
|
||||||
|
|
||||||
|
$company_gateway = CompanyGateway::find($id);
|
||||||
|
|
||||||
|
$this->assertEquals(1, $company_gateway->calcGatewayFee(10));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -204,7 +204,8 @@ class MultiDBUserTest extends TestCase
|
|||||||
$response = $this->withHeaders([
|
$response = $this->withHeaders([
|
||||||
'X-API-SECRET' => config('ninja.api_secret'),
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
'X-API-TOKEN' => $this->token,
|
'X-API-TOKEN' => $this->token,
|
||||||
])->post('/api/v1/users?include=company_user', $data);
|
'X-API-PASSWORD' => 'ALongAndBriliantPassword',
|
||||||
|
])->post('/api/v1/users?include=company_user', $data);
|
||||||
} catch (ValidationException $e) {
|
} catch (ValidationException $e) {
|
||||||
\Log::error('in the validator');
|
\Log::error('in the validator');
|
||||||
$message = json_decode($e->validator->getMessageBag(), 1);
|
$message = json_decode($e->validator->getMessageBag(), 1);
|
||||||
|
@ -154,7 +154,7 @@ trait MockAccountData
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
||||||
$contact = factory(\App\Models\ClientContact::class, 1)->create([
|
$contact = factory(\App\Models\ClientContact::class)->create([
|
||||||
'user_id' => $this->user->id,
|
'user_id' => $this->user->id,
|
||||||
'client_id' => $this->client->id,
|
'client_id' => $this->client->id,
|
||||||
'company_id' => $this->company->id,
|
'company_id' => $this->company->id,
|
||||||
@ -162,12 +162,13 @@ trait MockAccountData
|
|||||||
'send_email' => true,
|
'send_email' => true,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$contact2 = factory(\App\Models\ClientContact::class, 1)->create([
|
$contact2 = factory(\App\Models\ClientContact::class)->create([
|
||||||
'user_id' => $this->user->id,
|
'user_id' => $this->user->id,
|
||||||
'client_id' => $this->client->id,
|
'client_id' => $this->client->id,
|
||||||
'company_id' => $this->company->id,
|
'company_id' => $this->company->id,
|
||||||
'send_email' => true
|
'send_email' => true
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
||||||
// $rels = collect($contact, $contact2);
|
// $rels = collect($contact, $contact2);
|
||||||
// $this->client->setRelation('contacts', $rels);
|
// $this->client->setRelation('contacts', $rels);
|
||||||
@ -211,7 +212,24 @@ trait MockAccountData
|
|||||||
|
|
||||||
$this->invoice->save();
|
$this->invoice->save();
|
||||||
|
|
||||||
$this->invoice->service()->createInvitations()->markSent();
|
//$this->invoice->service()->createInvitations()->markSent();
|
||||||
|
//$this->invoice->service()->createInvitations();
|
||||||
|
|
||||||
|
factory(\App\Models\InvoiceInvitation::class)->create([
|
||||||
|
'user_id' => $this->user->id,
|
||||||
|
'company_id' => $this->company->id,
|
||||||
|
'client_contact_id' => $contact->id,
|
||||||
|
'invoice_id' => $this->invoice->id,
|
||||||
|
]);
|
||||||
|
|
||||||
|
factory(\App\Models\InvoiceInvitation::class)->create([
|
||||||
|
'user_id' => $this->user->id,
|
||||||
|
'company_id' => $this->company->id,
|
||||||
|
'client_contact_id' => $contact2->id,
|
||||||
|
'invoice_id' => $this->invoice->id,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->invoice->service()->markSent();
|
||||||
|
|
||||||
$this->quote = factory(\App\Models\Quote::class)->create([
|
$this->quote = factory(\App\Models\Quote::class)->create([
|
||||||
'user_id' => $this->user->id,
|
'user_id' => $this->user->id,
|
||||||
@ -229,8 +247,24 @@ trait MockAccountData
|
|||||||
|
|
||||||
$this->quote = $this->quote_calc->getQuote();
|
$this->quote = $this->quote_calc->getQuote();
|
||||||
|
|
||||||
|
$this->quote->status_id = Quote::STATUS_SENT;
|
||||||
$this->quote->number = $this->getNextQuoteNumber($this->client);
|
$this->quote->number = $this->getNextQuoteNumber($this->client);
|
||||||
$this->quote->service()->createInvitations()->markSent();
|
|
||||||
|
//$this->quote->service()->createInvitations()->markSent();
|
||||||
|
|
||||||
|
factory(\App\Models\QuoteInvitation::class)->create([
|
||||||
|
'user_id' => $this->user->id,
|
||||||
|
'company_id' => $this->company->id,
|
||||||
|
'client_contact_id' => $contact->id,
|
||||||
|
'quote_id' => $this->quote->id,
|
||||||
|
]);
|
||||||
|
|
||||||
|
factory(\App\Models\QuoteInvitation::class)->create([
|
||||||
|
'user_id' => $this->user->id,
|
||||||
|
'company_id' => $this->company->id,
|
||||||
|
'client_contact_id' => $contact2->id,
|
||||||
|
'quote_id' => $this->quote->id,
|
||||||
|
]);
|
||||||
|
|
||||||
$this->quote->setRelation('client', $this->client);
|
$this->quote->setRelation('client', $this->client);
|
||||||
$this->quote->setRelation('company', $this->company);
|
$this->quote->setRelation('company', $this->company);
|
||||||
|
Loading…
Reference in New Issue
Block a user