mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 05:02:36 +01:00
Merge branch 'v5-develop' of https://github.com/invoiceninja/invoiceninja into feature-nordigen-payment-provider
This commit is contained in:
commit
166a370f80
@ -1 +1 @@
|
||||
5.7.59
|
||||
5.7.62
|
@ -12,7 +12,8 @@
|
||||
|
||||
namespace App\DataProviders;
|
||||
|
||||
class Domains {
|
||||
class Domains
|
||||
{
|
||||
|
||||
private static array $verify_domains = [
|
||||
'0-00.usa.cc',
|
||||
|
@ -181,9 +181,9 @@ class ClientExport extends BaseExport
|
||||
}
|
||||
}
|
||||
|
||||
return $entity;
|
||||
// return $entity;
|
||||
|
||||
// return $this->decorateAdvancedFields($client, $entity);
|
||||
return $this->decorateAdvancedFields($client, $entity);
|
||||
}
|
||||
|
||||
public function processMetaData(array $row, $resource): array
|
||||
@ -221,21 +221,21 @@ class ClientExport extends BaseExport
|
||||
$entity['client.assigned_user'] = $client->assigned_user ? $client->user->present()->name() : '';
|
||||
}
|
||||
|
||||
if (in_array('client.country_id', $this->input['report_keys'])) {
|
||||
$entity['client.country_id'] = $client->country ? ctrans("texts.country_{$client->country->name}") : '';
|
||||
}
|
||||
// if (in_array('client.country_id', $this->input['report_keys'])) {
|
||||
// $entity['client.country_id'] = $client->country ? ctrans("texts.country_{$client->country->name}") : '';
|
||||
// }
|
||||
|
||||
if (in_array('client.shipping_country_id', $this->input['report_keys'])) {
|
||||
$entity['client.shipping_country_id'] = $client->shipping_country ? ctrans("texts.country_{$client->shipping_country->name}") : '';
|
||||
}
|
||||
// if (in_array('client.shipping_country_id', $this->input['report_keys'])) {
|
||||
// $entity['client.shipping_country_id'] = $client->shipping_country ? ctrans("texts.country_{$client->shipping_country->name}") : '';
|
||||
// }
|
||||
|
||||
if (in_array('client.currency_id', $this->input['report_keys'])) {
|
||||
$entity['client.currency_id'] = $client->currency() ? $client->currency()->code : $client->company->currency()->code;
|
||||
}
|
||||
// if (in_array('client.currency_id', $this->input['report_keys'])) {
|
||||
// $entity['client.currency_id'] = $client->currency() ? $client->currency()->code : $client->company->currency()->code;
|
||||
// }
|
||||
|
||||
if (in_array('client.industry_id', $this->input['report_keys'])) {
|
||||
$entity['industry_id'] = $client->industry ? ctrans("texts.industry_{$client->industry->name}") : '';
|
||||
}
|
||||
// if (in_array('client.industry_id', $this->input['report_keys'])) {
|
||||
// $entity['industry_id'] = $client->industry ? ctrans("texts.industry_{$client->industry->name}") : '';
|
||||
// }
|
||||
|
||||
if (in_array('client.classification', $this->input['report_keys']) && isset($client->classification)) {
|
||||
$entity['client.classification'] = ctrans("texts.{$client->classification}") ?? '';
|
||||
|
@ -129,8 +129,8 @@ class ContactExport extends BaseExport
|
||||
|
||||
}
|
||||
}
|
||||
return $entity;
|
||||
// return $this->decorateAdvancedFields($contact->client, $entity);
|
||||
// return $entity;
|
||||
return $this->decorateAdvancedFields($contact->client, $entity);
|
||||
}
|
||||
|
||||
private function decorateAdvancedFields(Client $client, array $entity) :array
|
||||
@ -151,6 +151,15 @@ class ContactExport extends BaseExport
|
||||
$entity['industry_id'] = $client->industry ? ctrans("texts.industry_{$client->industry->name}") : '';
|
||||
}
|
||||
|
||||
if (in_array('client.user_id', $this->input['report_keys'])) {
|
||||
$entity['client.user_id'] = $client->user ? $client->user->present()->name() : '';
|
||||
}
|
||||
|
||||
if (in_array('client.assigned_user_id', $this->input['report_keys'])) {
|
||||
$entity['client.assigned_user_id'] = $client->assigned_user ? $client->assigned_user->present()->name() : '';
|
||||
}
|
||||
|
||||
|
||||
return $entity;
|
||||
}
|
||||
}
|
||||
|
@ -161,29 +161,29 @@ class CreditExport extends BaseExport
|
||||
|
||||
private function decorateAdvancedFields(Credit $credit, array $entity) :array
|
||||
{
|
||||
if (in_array('country_id', $this->input['report_keys'])) {
|
||||
$entity['country'] = $credit->client->country ? ctrans("texts.country_{$credit->client->country->name}") : '';
|
||||
}
|
||||
// if (in_array('country_id', $this->input['report_keys'])) {
|
||||
// $entity['country'] = $credit->client->country ? ctrans("texts.country_{$credit->client->country->name}") : '';
|
||||
// }
|
||||
|
||||
if (in_array('currency_id', $this->input['report_keys'])) {
|
||||
$entity['currency_id'] = $credit->client->currency() ? $credit->client->currency()->code : $credit->company->currency()->code;
|
||||
}
|
||||
// if (in_array('currency_id', $this->input['report_keys'])) {
|
||||
// $entity['currency_id'] = $credit->client->currency() ? $credit->client->currency()->code : $credit->company->currency()->code;
|
||||
// }
|
||||
|
||||
if (in_array('invoice_id', $this->input['report_keys'])) {
|
||||
$entity['invoice'] = $credit->invoice ? $credit->invoice->number : '';
|
||||
}
|
||||
// if (in_array('invoice_id', $this->input['report_keys'])) {
|
||||
// $entity['invoice'] = $credit->invoice ? $credit->invoice->number : '';
|
||||
// }
|
||||
|
||||
if (in_array('client_id', $this->input['report_keys'])) {
|
||||
$entity['client'] = $credit->client->present()->name();
|
||||
}
|
||||
// if (in_array('client_id', $this->input['report_keys'])) {
|
||||
// $entity['client'] = $credit->client->present()->name();
|
||||
// }
|
||||
|
||||
if (in_array('status_id', $this->input['report_keys'])) {
|
||||
$entity['status'] = $credit->stringStatus($credit->status_id);
|
||||
}
|
||||
// if (in_array('status_id', $this->input['report_keys'])) {
|
||||
// $entity['status'] = $credit->stringStatus($credit->status_id);
|
||||
// }
|
||||
|
||||
if(in_array('credit.status', $this->input['report_keys'])) {
|
||||
$entity['credit.status'] = $credit->stringStatus($credit->status_id);
|
||||
}
|
||||
// if(in_array('credit.status', $this->input['report_keys'])) {
|
||||
// $entity['credit.status'] = $credit->stringStatus($credit->status_id);
|
||||
// }
|
||||
|
||||
if (in_array('credit.assigned_user_id', $this->input['report_keys'])) {
|
||||
$entity['credit.assigned_user_id'] = $credit->assigned_user ? $credit->assigned_user->present()->name(): '';
|
||||
|
@ -126,35 +126,35 @@ class ExpenseExport extends BaseExport
|
||||
|
||||
}
|
||||
|
||||
return $entity;
|
||||
// return $this->decorateAdvancedFields($expense, $entity);
|
||||
// return $entity;
|
||||
return $this->decorateAdvancedFields($expense, $entity);
|
||||
}
|
||||
|
||||
private function decorateAdvancedFields(Expense $expense, array $entity) :array
|
||||
{
|
||||
if (in_array('expense.currency_id', $this->input['report_keys'])) {
|
||||
$entity['expense.currency_id'] = $expense->currency ? $expense->currency->code : '';
|
||||
}
|
||||
// if (in_array('expense.currency_id', $this->input['report_keys'])) {
|
||||
// $entity['expense.currency_id'] = $expense->currency ? $expense->currency->code : '';
|
||||
// }
|
||||
|
||||
if (in_array('expense.client_id', $this->input['report_keys'])) {
|
||||
$entity['expense.client'] = $expense->client ? $expense->client->present()->name() : '';
|
||||
}
|
||||
// if (in_array('expense.client_id', $this->input['report_keys'])) {
|
||||
// $entity['expense.client'] = $expense->client ? $expense->client->present()->name() : '';
|
||||
// }
|
||||
|
||||
if (in_array('expense.invoice_id', $this->input['report_keys'])) {
|
||||
$entity['expense.invoice_id'] = $expense->invoice ? $expense->invoice->number : '';
|
||||
}
|
||||
// if (in_array('expense.invoice_id', $this->input['report_keys'])) {
|
||||
// $entity['expense.invoice_id'] = $expense->invoice ? $expense->invoice->number : '';
|
||||
// }
|
||||
|
||||
if (in_array('expense.category', $this->input['report_keys'])) {
|
||||
$entity['expense.category'] = $expense->category ? $expense->category->name : '';
|
||||
}
|
||||
// if (in_array('expense.category', $this->input['report_keys'])) {
|
||||
// $entity['expense.category'] = $expense->category ? $expense->category->name : '';
|
||||
// }
|
||||
|
||||
if (in_array('expense.vendor_id', $this->input['report_keys'])) {
|
||||
$entity['expense.vendor'] = $expense->vendor ? $expense->vendor->name : '';
|
||||
}
|
||||
// if (in_array('expense.vendor_id', $this->input['report_keys'])) {
|
||||
// $entity['expense.vendor'] = $expense->vendor ? $expense->vendor->name : '';
|
||||
// }
|
||||
|
||||
if (in_array('expense.payment_type_id', $this->input['report_keys'])) {
|
||||
$entity['expense.payment_type_id'] = $expense->payment_type ? $expense->payment_type->name : '';
|
||||
}
|
||||
// if (in_array('expense.payment_type_id', $this->input['report_keys'])) {
|
||||
// $entity['expense.payment_type_id'] = $expense->payment_type ? $expense->payment_type->name : '';
|
||||
// }
|
||||
|
||||
if (in_array('expense.project_id', $this->input['report_keys'])) {
|
||||
$entity['expense.project_id'] = $expense->project ? $expense->project->name : '';
|
||||
|
@ -128,32 +128,32 @@ class InvoiceExport extends BaseExport
|
||||
|
||||
}
|
||||
|
||||
return $entity;
|
||||
// return $this->decorateAdvancedFields($invoice, $entity);
|
||||
// return $entity;
|
||||
return $this->decorateAdvancedFields($invoice, $entity);
|
||||
}
|
||||
|
||||
private function decorateAdvancedFields(Invoice $invoice, array $entity) :array
|
||||
{
|
||||
|
||||
if (in_array('invoice.country_id', $this->input['report_keys'])) {
|
||||
$entity['invoice.country_id'] = $invoice->client->country ? ctrans("texts.country_{$invoice->client->country->name}") : '';
|
||||
}
|
||||
// if (in_array('invoice.country_id', $this->input['report_keys'])) {
|
||||
// $entity['invoice.country_id'] = $invoice->client->country ? ctrans("texts.country_{$invoice->client->country->name}") : '';
|
||||
// }
|
||||
|
||||
if (in_array('invoice.currency_id', $this->input['report_keys'])) {
|
||||
$entity['invoice.currency_id'] = $invoice->client->currency() ? $invoice->client->currency()->code : $invoice->company->currency()->code;
|
||||
}
|
||||
// if (in_array('invoice.currency_id', $this->input['report_keys'])) {
|
||||
// $entity['invoice.currency_id'] = $invoice->client->currency() ? $invoice->client->currency()->code : $invoice->company->currency()->code;
|
||||
// }
|
||||
|
||||
if (in_array('invoice.client_id', $this->input['report_keys'])) {
|
||||
$entity['invoice.client_id'] = $invoice->client->present()->name();
|
||||
}
|
||||
// if (in_array('invoice.client_id', $this->input['report_keys'])) {
|
||||
// $entity['invoice.client_id'] = $invoice->client->present()->name();
|
||||
// }
|
||||
|
||||
if (in_array('invoice.status', $this->input['report_keys'])) {
|
||||
$entity['invoice.status'] = $invoice->stringStatus($invoice->status_id);
|
||||
}
|
||||
// if (in_array('invoice.status', $this->input['report_keys'])) {
|
||||
// $entity['invoice.status'] = $invoice->stringStatus($invoice->status_id);
|
||||
// }
|
||||
|
||||
if (in_array('invoice.recurring_id', $this->input['report_keys'])) {
|
||||
$entity['invoice.recurring_id'] = $invoice->recurring_invoice->number ?? '';
|
||||
}
|
||||
// if (in_array('invoice.recurring_id', $this->input['report_keys'])) {
|
||||
// $entity['invoice.recurring_id'] = $invoice->recurring_invoice->number ?? '';
|
||||
// }
|
||||
|
||||
if (in_array('invoice.auto_bill_enabled', $this->input['report_keys'])) {
|
||||
$entity['invoice.auto_bill_enabled'] = $invoice->auto_bill_enabled ? ctrans('texts.yes') : ctrans('texts.no');
|
||||
|
@ -196,43 +196,43 @@ class InvoiceItemExport extends BaseExport
|
||||
// $entity[$key] = $this->resolveKey($key, $invoice, $this->invoice_transformer);
|
||||
}
|
||||
}
|
||||
return $entity;
|
||||
// return $this->decorateAdvancedFields($invoice, $entity);
|
||||
// return $entity;
|
||||
return $this->decorateAdvancedFields($invoice, $entity);
|
||||
}
|
||||
|
||||
private function decorateAdvancedFields(Invoice $invoice, array $entity) :array
|
||||
{
|
||||
if (in_array('currency_id', $this->input['report_keys'])) {
|
||||
$entity['currency'] = $invoice->client->currency() ? $invoice->client->currency()->code : $invoice->company->currency()->code;
|
||||
}
|
||||
// if (in_array('currency_id', $this->input['report_keys'])) {
|
||||
// $entity['currency'] = $invoice->client->currency() ? $invoice->client->currency()->code : $invoice->company->currency()->code;
|
||||
// }
|
||||
|
||||
if(array_key_exists('type', $entity)) {
|
||||
$entity['type'] = $invoice->typeIdString($entity['type']);
|
||||
}
|
||||
// if(array_key_exists('type', $entity)) {
|
||||
// $entity['type'] = $invoice->typeIdString($entity['type']);
|
||||
// }
|
||||
|
||||
if(array_key_exists('tax_category', $entity)) {
|
||||
$entity['tax_category'] = $invoice->taxTypeString($entity['tax_category']);
|
||||
}
|
||||
// if(array_key_exists('tax_category', $entity)) {
|
||||
// $entity['tax_category'] = $invoice->taxTypeString($entity['tax_category']);
|
||||
// }
|
||||
|
||||
if (in_array('invoice.country_id', $this->input['report_keys'])) {
|
||||
$entity['invoice.country_id'] = $invoice->client->country ? ctrans("texts.country_{$invoice->client->country->name}") : '';
|
||||
}
|
||||
// if (in_array('invoice.country_id', $this->input['report_keys'])) {
|
||||
// $entity['invoice.country_id'] = $invoice->client->country ? ctrans("texts.country_{$invoice->client->country->name}") : '';
|
||||
// }
|
||||
|
||||
if (in_array('invoice.currency_id', $this->input['report_keys'])) {
|
||||
$entity['invoice.currency_id'] = $invoice->client->currency() ? $invoice->client->currency()->code : $invoice->company->currency()->code;
|
||||
}
|
||||
// if (in_array('invoice.currency_id', $this->input['report_keys'])) {
|
||||
// $entity['invoice.currency_id'] = $invoice->client->currency() ? $invoice->client->currency()->code : $invoice->company->currency()->code;
|
||||
// }
|
||||
|
||||
if (in_array('invoice.client_id', $this->input['report_keys'])) {
|
||||
$entity['invoice.client_id'] = $invoice->client->present()->name();
|
||||
}
|
||||
// if (in_array('invoice.client_id', $this->input['report_keys'])) {
|
||||
// $entity['invoice.client_id'] = $invoice->client->present()->name();
|
||||
// }
|
||||
|
||||
if (in_array('invoice.status', $this->input['report_keys'])) {
|
||||
$entity['invoice.status'] = $invoice->stringStatus($invoice->status_id);
|
||||
}
|
||||
// if (in_array('invoice.status', $this->input['report_keys'])) {
|
||||
// $entity['invoice.status'] = $invoice->stringStatus($invoice->status_id);
|
||||
// }
|
||||
|
||||
if (in_array('invoice.recurring_id', $this->input['report_keys'])) {
|
||||
$entity['invoice.recurring_id'] = $invoice->recurring_invoice->number ?? '';
|
||||
}
|
||||
// if (in_array('invoice.recurring_id', $this->input['report_keys'])) {
|
||||
// $entity['invoice.recurring_id'] = $invoice->recurring_invoice->number ?? '';
|
||||
// }
|
||||
|
||||
if (in_array('invoice.assigned_user_id', $this->input['report_keys'])) {
|
||||
$entity['invoice.assigned_user_id'] = $invoice->assigned_user ? $invoice->assigned_user->present()->name(): '';
|
||||
|
@ -125,55 +125,55 @@ class PaymentExport extends BaseExport
|
||||
|
||||
}
|
||||
|
||||
return $entity;
|
||||
// return $this->decorateAdvancedFields($payment, $entity);
|
||||
// return $entity;
|
||||
return $this->decorateAdvancedFields($payment, $entity);
|
||||
}
|
||||
|
||||
private function decorateAdvancedFields(Payment $payment, array $entity) :array
|
||||
{
|
||||
if (in_array('status_id', $this->input['report_keys'])) {
|
||||
$entity['status'] = $payment->stringStatus($payment->status_id);
|
||||
}
|
||||
// if (in_array('status_id', $this->input['report_keys'])) {
|
||||
// $entity['status'] = $payment->stringStatus($payment->status_id);
|
||||
// }
|
||||
|
||||
if (in_array('vendor_id', $this->input['report_keys'])) {
|
||||
$entity['vendor'] = $payment->vendor()->exists() ? $payment->vendor->name : '';
|
||||
}
|
||||
// if (in_array('vendor_id', $this->input['report_keys'])) {
|
||||
// $entity['vendor'] = $payment->vendor()->exists() ? $payment->vendor->name : '';
|
||||
// }
|
||||
|
||||
if (in_array('project_id', $this->input['report_keys'])) {
|
||||
$entity['project'] = $payment->project()->exists() ? $payment->project->name : '';
|
||||
}
|
||||
// if (in_array('project_id', $this->input['report_keys'])) {
|
||||
// $entity['project'] = $payment->project()->exists() ? $payment->project->name : '';
|
||||
// }
|
||||
|
||||
if (in_array('currency_id', $this->input['report_keys'])) {
|
||||
$entity['currency'] = $payment->currency()->exists() ? $payment->currency->code : '';
|
||||
}
|
||||
// if (in_array('currency_id', $this->input['report_keys'])) {
|
||||
// $entity['currency'] = $payment->currency()->exists() ? $payment->currency->code : '';
|
||||
// }
|
||||
|
||||
if (in_array('payment.currency', $this->input['report_keys'])) {
|
||||
$entity['payment.currency'] = $payment->currency()->exists() ? $payment->currency->code : '';
|
||||
}
|
||||
// if (in_array('payment.currency', $this->input['report_keys'])) {
|
||||
// $entity['payment.currency'] = $payment->currency()->exists() ? $payment->currency->code : '';
|
||||
// }
|
||||
|
||||
if (in_array('exchange_currency_id', $this->input['report_keys'])) {
|
||||
$entity['exchange_currency'] = $payment->exchange_currency()->exists() ? $payment->exchange_currency->code : '';
|
||||
}
|
||||
// if (in_array('exchange_currency_id', $this->input['report_keys'])) {
|
||||
// $entity['exchange_currency'] = $payment->exchange_currency()->exists() ? $payment->exchange_currency->code : '';
|
||||
// }
|
||||
|
||||
if (in_array('client_id', $this->input['report_keys'])) {
|
||||
$entity['client'] = $payment->client->present()->name();
|
||||
}
|
||||
// if (in_array('client_id', $this->input['report_keys'])) {
|
||||
// $entity['client'] = $payment->client->present()->name();
|
||||
// }
|
||||
|
||||
if (in_array('type_id', $this->input['report_keys'])) {
|
||||
$entity['type'] = $payment->translatedType();
|
||||
}
|
||||
// if (in_array('type_id', $this->input['report_keys'])) {
|
||||
// $entity['type'] = $payment->translatedType();
|
||||
// }
|
||||
|
||||
if (in_array('payment.method', $this->input['report_keys'])) {
|
||||
$entity['payment.method'] = $payment->translatedType();
|
||||
}
|
||||
// if (in_array('payment.method', $this->input['report_keys'])) {
|
||||
// $entity['payment.method'] = $payment->translatedType();
|
||||
// }
|
||||
|
||||
if (in_array('payment.status', $this->input['report_keys'])) {
|
||||
$entity['payment.status'] = $payment->stringStatus($payment->status_id);
|
||||
}
|
||||
// if (in_array('payment.status', $this->input['report_keys'])) {
|
||||
// $entity['payment.status'] = $payment->stringStatus($payment->status_id);
|
||||
// }
|
||||
|
||||
if (in_array('gateway_type_id', $this->input['report_keys'])) {
|
||||
$entity['gateway'] = $payment->gateway_type ? $payment->gateway_type->name : 'Unknown Type';
|
||||
}
|
||||
// if (in_array('gateway_type_id', $this->input['report_keys'])) {
|
||||
// $entity['gateway'] = $payment->gateway_type ? $payment->gateway_type->name : 'Unknown Type';
|
||||
// }
|
||||
|
||||
if (in_array('payment.assigned_user_id', $this->input['report_keys'])) {
|
||||
$entity['payment.assigned_user_id'] = $payment->assigned_user ? $payment->assigned_user->present()->name() : '';
|
||||
|
@ -173,8 +173,8 @@ class PurchaseOrderExport extends BaseExport
|
||||
|
||||
|
||||
}
|
||||
return $entity;
|
||||
// return $this->decorateAdvancedFields($purchase_order, $entity);
|
||||
// return $entity;
|
||||
return $this->decorateAdvancedFields($purchase_order, $entity);
|
||||
}
|
||||
|
||||
private function decorateAdvancedFields(PurchaseOrder $purchase_order, array $entity) :array
|
||||
@ -195,6 +195,15 @@ class PurchaseOrderExport extends BaseExport
|
||||
$entity['purchase_order.status'] = $purchase_order->stringStatus($purchase_order->status_id);
|
||||
}
|
||||
|
||||
if (in_array('purchase_order.user_id', $this->input['report_keys'])) {
|
||||
$entity['purchase_order.user_id'] = $purchase_order->user ? $purchase_order->user->present()->name() : '';
|
||||
}
|
||||
|
||||
if (in_array('purchase_order.assigned_user_id', $this->input['report_keys'])) {
|
||||
$entity['purchase_order.assigned_user_id'] = $purchase_order->assigned_user ? $purchase_order->assigned_user->present()->name() : '';
|
||||
}
|
||||
|
||||
|
||||
return $entity;
|
||||
}
|
||||
}
|
||||
|
@ -206,6 +206,16 @@ class PurchaseOrderItemExport extends BaseExport
|
||||
$entity['status'] = $purchase_order->stringStatus($purchase_order->status_id);
|
||||
}
|
||||
|
||||
if (in_array('purchase_order.user_id', $this->input['report_keys'])) {
|
||||
$entity['purchase_order.user_id'] = $purchase_order->user ? $purchase_order->user->present()->name() : '';
|
||||
}
|
||||
|
||||
if (in_array('purchase_order.assigned_user_id', $this->input['report_keys'])) {
|
||||
$entity['purchase_order.assigned_user_id'] = $purchase_order->assigned_user ? $purchase_order->assigned_user->present()->name() : '';
|
||||
}
|
||||
|
||||
|
||||
|
||||
return $entity;
|
||||
}
|
||||
|
||||
|
@ -133,8 +133,8 @@ class QuoteExport extends BaseExport
|
||||
}
|
||||
|
||||
}
|
||||
return $entity;
|
||||
// return $this->decorateAdvancedFields($quote, $entity);
|
||||
// return $entity;
|
||||
return $this->decorateAdvancedFields($quote, $entity);
|
||||
}
|
||||
|
||||
private function decorateAdvancedFields(Quote $quote, array $entity) :array
|
||||
|
@ -189,22 +189,22 @@ class QuoteItemExport extends BaseExport
|
||||
}
|
||||
}
|
||||
|
||||
return $entity;
|
||||
// return $this->decorateAdvancedFields($quote, $entity);
|
||||
// return $entity;
|
||||
return $this->decorateAdvancedFields($quote, $entity);
|
||||
}
|
||||
private function decorateAdvancedFields(Quote $quote, array $entity) :array
|
||||
{
|
||||
if (in_array('currency_id', $this->input['report_keys'])) {
|
||||
$entity['currency'] = $quote->client->currency() ? $quote->client->currency()->code : $quote->company->currency()->code;
|
||||
}
|
||||
// if (in_array('currency_id', $this->input['report_keys'])) {
|
||||
// $entity['currency'] = $quote->client->currency() ? $quote->client->currency()->code : $quote->company->currency()->code;
|
||||
// }
|
||||
|
||||
if (in_array('client_id', $this->input['report_keys'])) {
|
||||
$entity['client'] = $quote->client->present()->name();
|
||||
}
|
||||
// if (in_array('client_id', $this->input['report_keys'])) {
|
||||
// $entity['client'] = $quote->client->present()->name();
|
||||
// }
|
||||
|
||||
if (in_array('status_id', $this->input['report_keys'])) {
|
||||
$entity['status'] = $quote->stringStatus($quote->status_id);
|
||||
}
|
||||
// if (in_array('status_id', $this->input['report_keys'])) {
|
||||
// $entity['status'] = $quote->stringStatus($quote->status_id);
|
||||
// }
|
||||
|
||||
if (in_array('quote.assigned_user_id', $this->input['report_keys'])) {
|
||||
$entity['quote.assigned_user_id'] = $quote->assigned_user ? $quote->assigned_user->present()->name(): '';
|
||||
|
@ -109,8 +109,6 @@ class RecurringInvoiceExport extends BaseExport
|
||||
private function buildRow(RecurringInvoice $invoice) :array
|
||||
{
|
||||
$transformed_invoice = $this->invoice_transformer->transform($invoice);
|
||||
$transformed_invoice['frequency_id'] = $invoice->frequencyForKey($invoice->frequency_id); //need to inject this here because it is also a valid key
|
||||
// nlog($transformed_invoice);
|
||||
|
||||
$entity = [];
|
||||
|
||||
@ -131,36 +129,36 @@ class RecurringInvoiceExport extends BaseExport
|
||||
}
|
||||
|
||||
}
|
||||
// nlog($entity);
|
||||
return $entity;
|
||||
// return $this->decorateAdvancedFields($invoice, $entity);
|
||||
|
||||
// return $entity;
|
||||
return $this->decorateAdvancedFields($invoice, $entity);
|
||||
}
|
||||
|
||||
private function decorateAdvancedFields(RecurringInvoice $invoice, array $entity) :array
|
||||
{
|
||||
if (in_array('country_id', $this->input['report_keys'])) {
|
||||
$entity['country'] = $invoice->client->country ? ctrans("texts.country_{$invoice->client->country->name}") : '';
|
||||
}
|
||||
// if (in_array('country_id', $this->input['report_keys'])) {
|
||||
// $entity['country'] = $invoice->client->country ? ctrans("texts.country_{$invoice->client->country->name}") : '';
|
||||
// }
|
||||
|
||||
if (in_array('currency_id', $this->input['report_keys'])) {
|
||||
$entity['currency'] = $invoice->client->currency() ? $invoice->client->currency()->code : $invoice->company->currency()->code;
|
||||
}
|
||||
// if (in_array('currency_id', $this->input['report_keys'])) {
|
||||
// $entity['currency'] = $invoice->client->currency() ? $invoice->client->currency()->code : $invoice->company->currency()->code;
|
||||
// }
|
||||
|
||||
if (in_array('client_id', $this->input['report_keys'])) {
|
||||
$entity['client'] = $invoice->client->present()->name();
|
||||
}
|
||||
// if (in_array('client_id', $this->input['report_keys'])) {
|
||||
// $entity['client'] = $invoice->client->present()->name();
|
||||
// }
|
||||
|
||||
if (in_array('recurring_invoice.status', $this->input['report_keys'])) {
|
||||
$entity['recurring_invoice.status'] = $invoice->stringStatus($invoice->status_id);
|
||||
}
|
||||
// if (in_array('recurring_invoice.status', $this->input['report_keys'])) {
|
||||
// $entity['recurring_invoice.status'] = $invoice->stringStatus($invoice->status_id);
|
||||
// }
|
||||
|
||||
if (in_array('project_id', $this->input['report_keys'])) {
|
||||
$entity['project'] = $invoice->project ? $invoice->project->name : '';
|
||||
}
|
||||
// if (in_array('project_id', $this->input['report_keys'])) {
|
||||
// $entity['project'] = $invoice->project ? $invoice->project->name : '';
|
||||
// }
|
||||
|
||||
if (in_array('vendor_id', $this->input['report_keys'])) {
|
||||
$entity['vendor'] = $invoice->vendor ? $invoice->vendor->name : '';
|
||||
}
|
||||
// if (in_array('vendor_id', $this->input['report_keys'])) {
|
||||
// $entity['vendor'] = $invoice->vendor ? $invoice->vendor->name : '';
|
||||
// }
|
||||
|
||||
if (in_array('recurring_invoice.frequency_id', $this->input['report_keys']) || in_array('frequency_id', $this->input['report_keys'])) {
|
||||
$entity['recurring_invoice.frequency_id'] = $invoice->frequencyForKey($invoice->frequency_id);
|
||||
|
@ -197,7 +197,7 @@ class TaskExport extends BaseExport
|
||||
$entity['task.duration'] = $task->calcDuration();
|
||||
}
|
||||
|
||||
// $entity = $this->decorateAdvancedFields($task, $entity);
|
||||
$entity = $this->decorateAdvancedFields($task, $entity);
|
||||
|
||||
$this->storage_array[] = $entity;
|
||||
|
||||
@ -218,6 +218,15 @@ class TaskExport extends BaseExport
|
||||
$entity['task.project_id'] = $task->project()->exists() ? $task->project->name : '';
|
||||
}
|
||||
|
||||
if (in_array('task.user_id', $this->input['report_keys'])) {
|
||||
$entity['task.user_id'] = $task->user ? $task->user->present()->name() : '';
|
||||
}
|
||||
|
||||
if (in_array('task.assigned_user_id', $this->input['report_keys'])) {
|
||||
$entity['task.assigned_user_id'] = $task->assigned_user ? $task->assigned_user->present()->name() : '';
|
||||
}
|
||||
|
||||
|
||||
return $entity;
|
||||
}
|
||||
}
|
||||
|
@ -126,15 +126,14 @@ class VendorExport extends BaseExport
|
||||
} elseif (is_array($parts) && $parts[0] == 'vendor_contact' && isset($transformed_contact[$parts[1]])) {
|
||||
$entity[$key] = $transformed_contact[$parts[1]];
|
||||
} else {
|
||||
// nlog($key);
|
||||
|
||||
$entity[$key] = $this->decorator->transform($key, $vendor);
|
||||
|
||||
// $entity[$key] = $this->resolveKey($key, $vendor, $this->vendor_transformer);
|
||||
}
|
||||
}
|
||||
|
||||
return $entity;
|
||||
// return $this->decorateAdvancedFields($vendor, $entity);
|
||||
// return $entity;
|
||||
return $this->decorateAdvancedFields($vendor, $entity);
|
||||
}
|
||||
|
||||
private function decorateAdvancedFields(Vendor $vendor, array $entity) :array
|
||||
@ -151,6 +150,15 @@ class VendorExport extends BaseExport
|
||||
$entity['vendor.classification'] = ctrans("texts.{$vendor->classification}") ?? '';
|
||||
}
|
||||
|
||||
if (in_array('vendor.user_id', $this->input['report_keys'])) {
|
||||
$entity['vendor.user_id'] = $vendor->user ? $vendor->user->present()->name() : '';
|
||||
}
|
||||
|
||||
if (in_array('vendor.assigned_user_id', $this->input['report_keys'])) {
|
||||
$entity['vendor.assigned_user_id'] = $vendor->assigned_user ? $vendor->assigned_user->present()->name() : '';
|
||||
}
|
||||
|
||||
|
||||
// $entity['status'] = $this->calculateStatus($vendor);
|
||||
|
||||
return $entity;
|
||||
|
@ -146,16 +146,26 @@ class InvoiceFilters extends QueryFilters
|
||||
*/
|
||||
public function upcoming(): Builder
|
||||
{
|
||||
return $this->builder->whereIn('status_id', [Invoice::STATUS_PARTIAL, Invoice::STATUS_SENT])
|
||||
->whereNull('due_date')
|
||||
|
||||
return $this->builder->where(function ($query) {
|
||||
$query->whereIn('status_id', [Invoice::STATUS_PARTIAL, Invoice::STATUS_SENT])
|
||||
->where('is_deleted', 0)
|
||||
->where('balance', '>', 0)
|
||||
->where(function ($query) {
|
||||
|
||||
$query->whereNull('due_date')
|
||||
->orWhere(function ($q) {
|
||||
$q->where('due_date', '>=', now()->startOfDay()->subSecond())->where('partial', 0);
|
||||
})
|
||||
->orWhere(function ($q) {
|
||||
$q->where('partial_due_date', '>=', now()->startOfDay()->subSecond())->where('partial', '>', 0);
|
||||
})
|
||||
->orderByRaw('ISNULL(due_date), due_date '. 'desc')
|
||||
->orderByRaw('ISNULL(partial_due_date), partial_due_date '. 'desc');
|
||||
->orWhere(function ($q) {
|
||||
$q->where('partial_due_date', '>=', now()->startOfDay()->subSecond())->where('partial', '>', 0);
|
||||
});
|
||||
|
||||
})
|
||||
->orderByRaw('ISNULL(due_date), due_date ' . 'desc')
|
||||
->orderByRaw('ISNULL(partial_due_date), partial_due_date ' . 'desc');
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -165,13 +175,18 @@ class InvoiceFilters extends QueryFilters
|
||||
*/
|
||||
public function overdue(): Builder
|
||||
{
|
||||
return $this->builder->whereIn('status_id', [Invoice::STATUS_SENT, Invoice::STATUS_PARTIAL])
|
||||
return $this->builder->where(function ($query) {
|
||||
|
||||
$query->whereIn('status_id', [Invoice::STATUS_SENT, Invoice::STATUS_PARTIAL])
|
||||
->where('is_deleted', 0)
|
||||
->where('balance', '>', 0)
|
||||
->where(function ($query) {
|
||||
$query->where('due_date', '<', now())
|
||||
->orWhere('partial_due_date', '<', now());
|
||||
})
|
||||
->orderBy('due_date', 'ASC');
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -155,6 +155,7 @@ class PaymentController extends BaseController
|
||||
$user = auth()->user();
|
||||
|
||||
$payment = PaymentFactory::create($user->company()->id, $user->id);
|
||||
$payment->date = now()->addSeconds($user->company()->utc_offset())->format('Y-m-d');
|
||||
|
||||
return $this->itemResponse($payment);
|
||||
}
|
||||
|
@ -30,6 +30,12 @@ class SubdomainController extends BaseController
|
||||
return response()->json(['message' => ctrans('texts.subdomain_is_not_available')], 401);
|
||||
}
|
||||
|
||||
|
||||
if (!preg_match('/^[A-Za-z0-9](?:[A-Za-z0-9\-]{0,61}[A-Za-z0-9])?$/', request()->input('subdomain'))) {
|
||||
return response()->json(['message' => ctrans('texts.subdomain_is_not_available')], 401);
|
||||
}
|
||||
|
||||
|
||||
return response()->json(['message' => 'Domain available'], 200);
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,12 @@ use Twilio\Rest\Client;
|
||||
|
||||
class TwilioController extends BaseController
|
||||
{
|
||||
|
||||
private array $invalid_codes = [
|
||||
'+21',
|
||||
'+17152567760',
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
@ -38,6 +44,10 @@ class TwilioController extends BaseController
|
||||
|
||||
$account = $user->company()->account;
|
||||
|
||||
if(!$this->checkPhoneValidity($request->phone)) {
|
||||
return response()->json(['message' => 'This phone number is not supported'], 400);
|
||||
}
|
||||
|
||||
if (MultiDB::hasPhoneNumber($request->phone)) {
|
||||
return response()->json(['message' => 'This phone number has already been verified with another account'], 400);
|
||||
}
|
||||
@ -65,6 +75,19 @@ class TwilioController extends BaseController
|
||||
return response()->json(['message' => 'Code sent.'], 200);
|
||||
}
|
||||
|
||||
private function checkPhoneValidity($phone)
|
||||
{
|
||||
foreach($this->invalid_codes as $code){
|
||||
|
||||
if(stripos($phone, $code) !== false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
|
@ -60,7 +60,7 @@ class UpdateCreditRequest extends Request
|
||||
$rules['file'] = $this->file_validation;
|
||||
}
|
||||
|
||||
$rules['number'] = ['bail', 'sometimes', Rule::unique('credits')->where('company_id', $user->company()->id)->ignore($this->credit->id)];
|
||||
$rules['number'] = ['bail', 'sometimes', 'nullable', Rule::unique('credits')->where('company_id', $user->company()->id)->ignore($this->credit->id)];
|
||||
|
||||
$rules['client_id'] = ['bail', 'sometimes',Rule::in([$this->credit->client_id])];
|
||||
|
||||
|
@ -37,7 +37,17 @@ class ImportRequest extends Request
|
||||
'column_map' => 'required_with:hash|array',
|
||||
'skip_header' => 'required_with:hash|boolean',
|
||||
'files.*' => 'file|mimes:csv,txt',
|
||||
'bank_integration_id' => 'bail|required_if:column_map,bank_transaction|min:2'
|
||||
'bank_integration_id' => 'bail|required_with:column_map.bank_transaction|min:2'
|
||||
];
|
||||
}
|
||||
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
if(!isset($input['column_map']['bank_transaction']) && array_key_exists('bank_integration_id',$input))
|
||||
unset($input['bank_integration_id']);
|
||||
|
||||
$this->replace($input);
|
||||
}
|
||||
}
|
||||
|
@ -59,9 +59,8 @@ class UpdateInvoiceRequest extends Request
|
||||
|
||||
$rules['id'] = new LockedInvoiceRule($this->invoice);
|
||||
|
||||
$rules['number'] = ['bail', 'sometimes', Rule::unique('invoices')->where('company_id', $user->company()->id)->ignore($this->invoice->id)];
|
||||
$rules['number'] = ['bail', 'sometimes', 'nullable', Rule::unique('invoices')->where('company_id', $user->company()->id)->ignore($this->invoice->id)];
|
||||
|
||||
|
||||
$rules['is_amount_discount'] = ['boolean'];
|
||||
$rules['client_id'] = ['bail', 'sometimes', Rule::in([$this->invoice->client_id])];
|
||||
$rules['line_items'] = 'array';
|
||||
|
@ -23,7 +23,10 @@ class StoreProductRequest extends Request
|
||||
*/
|
||||
public function authorize() : bool
|
||||
{
|
||||
return auth()->user()->can('create', Product::class);
|
||||
/** @var \App\Models\User $user */
|
||||
$user = auth()->user();
|
||||
|
||||
return $user->can('create', Product::class);
|
||||
}
|
||||
|
||||
public function rules()
|
||||
@ -54,7 +57,7 @@ class StoreProductRequest extends Request
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
if (! isset($input['quantity']) || $input['quantity'] < 1) {
|
||||
if (! isset($input['quantity'])) {
|
||||
$input['quantity'] = 1;
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ class UpdateProductRequest extends Request
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
if (! isset($input['quantity']) || $input['quantity'] < 1) {
|
||||
if (! isset($input['quantity'])) {
|
||||
$input['quantity'] = 1;
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ class UpdatePurchaseOrderRequest extends Request
|
||||
|
||||
$rules = [];
|
||||
|
||||
$rules['number'] = ['bail', 'sometimes', Rule::unique('purchase_orders')->where('company_id', $user->company()->id)->ignore($this->purchase_order->id)];
|
||||
$rules['number'] = ['bail', 'sometimes', 'nullable', Rule::unique('purchase_orders')->where('company_id', $user->company()->id)->ignore($this->purchase_order->id)];
|
||||
$rules['vendor_id'] = ['bail', 'sometimes', Rule::in([$this->purchase_order->vendor_id])];
|
||||
|
||||
$rules['line_items'] = 'array';
|
||||
|
@ -55,7 +55,7 @@ class UpdateQuoteRequest extends Request
|
||||
}
|
||||
|
||||
|
||||
$rules['number'] = ['bail', 'sometimes', Rule::unique('quotes')->where('company_id', $user->company()->id)->ignore($this->quote->id)];
|
||||
$rules['number'] = ['bail', 'sometimes', 'nullable', Rule::unique('quotes')->where('company_id', $user->company()->id)->ignore($this->quote->id)];
|
||||
|
||||
$rules['client_id'] = ['bail', 'sometimes', Rule::in([$this->quote->client_id])];
|
||||
|
||||
@ -73,6 +73,8 @@ class UpdateQuoteRequest extends Request
|
||||
|
||||
$input = $this->decodePrimaryKeys($input);
|
||||
|
||||
$input['id'] = $this->quote->id;
|
||||
|
||||
if (isset($input['line_items'])) {
|
||||
$input['line_items'] = isset($input['line_items']) ? $this->cleanItems($input['line_items']) : [];
|
||||
}
|
||||
@ -85,7 +87,6 @@ class UpdateQuoteRequest extends Request
|
||||
$input['exchange_rate'] = 1;
|
||||
}
|
||||
|
||||
$input['id'] = $this->quote->id;
|
||||
|
||||
$this->replace($input);
|
||||
}
|
||||
|
@ -42,14 +42,14 @@ class StoreSchedulerRequest extends Request
|
||||
'template' => 'bail|required|string',
|
||||
'parameters' => 'bail|array',
|
||||
'parameters.clients' => ['bail','sometimes', 'array', new ValidClientIds()],
|
||||
'parameters.date_range' => 'bail|sometimes|string|in:last7_days,last30_days,last365_days,this_month,last_month,this_quarter,last_quarter,this_year,last_year,all_time,custom',
|
||||
'parameters.date_range' => 'bail|sometimes|string|in:last7_days,last30_days,last365_days,this_month,last_month,this_quarter,last_quarter,this_year,last_year,all_time,custom,all',
|
||||
'parameters.start_date' => ['bail', 'sometimes', 'date:Y-m-d', 'required_if:parameters.date_rate,custom'],
|
||||
'parameters.end_date' => ['bail', 'sometimes', 'date:Y-m-d', 'required_if:parameters.date_rate,custom', 'after_or_equal:parameters.start_date'],
|
||||
'parameters.entity' => ['bail', 'sometimes', 'string', 'in:invoice,credit,quote,purchase_order'],
|
||||
'parameters.entity_id' => ['bail', 'sometimes', 'string'],
|
||||
'parameters.report_name' => ['bail','sometimes', 'string', 'required_if:template,email_report','in:ar_detailed,ar_summary,client_balance,tax_summary,profitloss,client_sales,user_sales,product_sales,clients,client_contacts,credits,documents,expenses,invoices,invoice_items,quotes,quote_items,recurring_invoices,payments,products,tasks'],
|
||||
'parameters.report_name' => ['bail','sometimes', 'string', 'required_if:template,email_report','in:ar_detailed,ar_summary,client_balance,tax_summary,profitloss,client_sales,user_sales,product_sales,activity,client,contact,client_contact,credit,document,expense,invoice,invoice_item,quote,quote_item,recurring_invoice,payment,product,task'],
|
||||
'parameters.date_key' => ['bail','sometimes', 'string'],
|
||||
'parameters.status' => ['bail','sometimes', 'string', 'in:all,draft,paid,unpaid,overdue'],
|
||||
'parameters.status' => ['bail','sometimes', 'string'],
|
||||
];
|
||||
|
||||
return $rules;
|
||||
@ -67,6 +67,18 @@ class StoreSchedulerRequest extends Request
|
||||
$input['frequency_id'] = 0;
|
||||
}
|
||||
|
||||
if(isset($input['parameters']) && !isset($input['parameters']['clients'])) {
|
||||
$input['parameters']['clients'] = [];
|
||||
}
|
||||
|
||||
if(isset($input['parameters']['status'])) {
|
||||
|
||||
$input['parameters']['status'] = collect(explode(",", $input['parameters']['status']))
|
||||
->filter(function($status) {
|
||||
return in_array($status, ['all','draft','paid','unpaid','overdue']);
|
||||
})->implode(",") ?? '';
|
||||
}
|
||||
|
||||
$this->replace($input);
|
||||
}
|
||||
}
|
||||
|
@ -39,13 +39,14 @@ class UpdateSchedulerRequest extends Request
|
||||
'template' => 'bail|required|string',
|
||||
'parameters' => 'bail|array',
|
||||
'parameters.clients' => ['bail','sometimes', 'array', new ValidClientIds()],
|
||||
'parameters.date_range' => 'bail|sometimes|string|in:last7_days,last30_days,last365_days,this_month,last_month,this_quarter,last_quarter,this_year,last_year,all_time,custom',
|
||||
'parameters.date_range' => 'bail|sometimes|string|in:last7_days,last30_days,last365_days,this_month,last_month,this_quarter,last_quarter,this_year,last_year,all_time,custom,all',
|
||||
'parameters.start_date' => ['bail', 'sometimes', 'date:Y-m-d', 'required_if:parameters.date_rate,custom'],
|
||||
'parameters.end_date' => ['bail', 'sometimes', 'date:Y-m-d', 'required_if:parameters.date_rate,custom', 'after_or_equal:parameters.start_date'],
|
||||
'parameters.entity' => ['bail', 'sometimes', 'string', 'in:invoice,credit,quote,purchase_order'],
|
||||
'parameters.entity_id' => ['bail', 'sometimes', 'string'],
|
||||
'parameters.report_name' => ['bail','sometimes', 'string', 'required_if:template,email_report', 'in:ar_detailed,ar_summary,client_balance,tax_summary,profitloss,client_sales,user_sales,product_sales,clients,client_contacts,credits,documents,expenses,invoices,invoice_items,quotes,quote_items,recurring_invoices,payments,products,tasks'],
|
||||
'parameters.report_name' => ['bail','sometimes', 'string', 'required_if:template,email_report', 'in:ar_detailed,ar_summary,client_balance,tax_summary,profitloss,client_sales,user_sales,product_sales,client,client_contact,credit,document,expense,invoice,invoice_item,quote,quote_item,recurring_invoice,payment,product,task'],
|
||||
'parameters.date_key' => ['bail','sometimes', 'string'],
|
||||
'parameters.status' => ['bail','sometimes', 'string'],
|
||||
];
|
||||
|
||||
return $rules;
|
||||
@ -63,6 +64,19 @@ class UpdateSchedulerRequest extends Request
|
||||
$input['frequency_id'] = 0;
|
||||
}
|
||||
|
||||
if(isset($input['parameters']) && !isset($input['parameters']['clients'])) {
|
||||
$input['parameters']['clients'] = [];
|
||||
}
|
||||
|
||||
if(isset($input['parameters']['status'])) {
|
||||
|
||||
$input['parameters']['status'] = collect(explode(",", $input['parameters']['status']))
|
||||
->filter(function ($status) {
|
||||
return in_array($status, ['all','draft','paid','unpaid','overdue']);
|
||||
})->implode(",") ?? '';
|
||||
}
|
||||
|
||||
|
||||
$this->replace($input);
|
||||
|
||||
|
||||
|
@ -387,19 +387,19 @@ class CompanyExport implements ShouldQueue
|
||||
})->all();
|
||||
|
||||
|
||||
$this->export_data['bank_integrations'] = $this->company->bank_integrations()->orderBy('id', 'ASC')->cursor()->map(function ($bank_integration) {
|
||||
$this->export_data['bank_integrations'] = $this->company->bank_integrations()->withTrashed()->orderBy('id', 'ASC')->cursor()->map(function ($bank_integration) {
|
||||
$bank_integration = $this->transformArrayOfKeys($bank_integration, ['account_id','company_id', 'user_id']);
|
||||
|
||||
return $bank_integration->makeVisible(['id','user_id','company_id','account_id']);
|
||||
return $bank_integration->makeVisible(['id','user_id','company_id','account_id','hashed_id']);
|
||||
})->all();
|
||||
|
||||
$this->export_data['bank_transactions'] = $this->company->bank_transactions()->orderBy('id', 'ASC')->cursor()->map(function ($bank_transaction) {
|
||||
$bank_transaction = $this->transformArrayOfKeys($bank_transaction, ['company_id', 'user_id','bank_integration_id','expense_id','category_id','ninja_category_id','vendor_id']);
|
||||
$this->export_data['bank_transactions'] = $this->company->bank_transactions()->withTrashed()->orderBy('id', 'ASC')->cursor()->map(function ($bank_transaction) {
|
||||
$bank_transaction = $this->transformArrayOfKeys($bank_transaction, ['company_id', 'user_id','bank_integration_id','expense_id','ninja_category_id','vendor_id']);
|
||||
|
||||
return $bank_transaction->makeVisible(['id','user_id','company_id']);
|
||||
})->all();
|
||||
|
||||
$this->export_data['schedulers'] = $this->company->schedulers()->orderBy('id', 'ASC')->cursor()->map(function ($scheduler) {
|
||||
$this->export_data['schedulers'] = $this->company->schedulers()->withTrashed()->orderBy('id', 'ASC')->cursor()->map(function ($scheduler) {
|
||||
$scheduler = $this->transformArrayOfKeys($scheduler, ['company_id', 'user_id']);
|
||||
|
||||
return $scheduler->makeVisible(['id','user_id','company_id']);
|
||||
|
@ -63,14 +63,12 @@ use App\Utils\Ninja;
|
||||
use App\Utils\TempFile;
|
||||
use App\Utils\Traits\GeneratesCounter;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use function GuzzleHttp\json_encode;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Str;
|
||||
use JsonMachine\JsonDecoder\ExtJsonDecoder;
|
||||
@ -142,7 +140,6 @@ class CompanyImport implements ShouldQueue
|
||||
'recurring_expenses',
|
||||
'expenses',
|
||||
'tasks',
|
||||
'payments',
|
||||
'company_ledger',
|
||||
'designs',
|
||||
'documents',
|
||||
@ -569,7 +566,7 @@ class CompanyImport implements ShouldQueue
|
||||
['expenses' => 'expense_id'],
|
||||
['vendors' => 'vendor_id'],
|
||||
['expense_categories' => 'ninja_category_id'],
|
||||
['expense_categories' => 'category_id'],
|
||||
// ['expense_categories' => 'category_id'],
|
||||
['bank_integrations' => 'bank_integration_id']
|
||||
],
|
||||
'bank_transactions',
|
||||
@ -1143,7 +1140,34 @@ class CompanyImport implements ShouldQueue
|
||||
continue;
|
||||
}
|
||||
|
||||
$storage_url = (object)$this->getObject('storage_url', true);
|
||||
|
||||
if (!Storage::exists($document->url) && is_string($storage_url)) {
|
||||
$url = $storage_url . $document->url;
|
||||
|
||||
$file = @file_get_contents($url);
|
||||
|
||||
|
||||
if ($file) {
|
||||
try {
|
||||
Storage::disk(config('filesystems.default'))->put($document->url, $file);
|
||||
|
||||
|
||||
} catch(\Exception $e) {
|
||||
nlog($e->getMessage());
|
||||
nlog("I could not upload {$document->url}");
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
continue;
|
||||
|
||||
}
|
||||
else
|
||||
continue;
|
||||
|
||||
$new_document = new Document();
|
||||
$new_document->disk = config('filesystems.default');
|
||||
$new_document->user_id = $this->transformId('users', $document->user_id);
|
||||
$new_document->assigned_user_id = $this->transformId('users', $document->assigned_user_id);
|
||||
$new_document->company_id = $this->company->id;
|
||||
@ -1169,26 +1193,6 @@ class CompanyImport implements ShouldQueue
|
||||
|
||||
$new_document->save(['timestamps' => false]);
|
||||
|
||||
$storage_url = (object)$this->getObject('storage_url', true);
|
||||
|
||||
if (!Storage::exists($new_document->url) && is_string($storage_url)) {
|
||||
$url = $storage_url . $new_document->url;
|
||||
|
||||
$file = @file_get_contents($url);
|
||||
|
||||
if ($file) {
|
||||
try {
|
||||
Storage::disk(config('filesystems.default'))->put($new_document->url, $file);
|
||||
|
||||
$new_document->disk = config('filesystems.default');
|
||||
$new_document->save();
|
||||
} catch(\Exception $e) {
|
||||
nlog($e->getMessage());
|
||||
nlog("I could not upload {$new_document->url}");
|
||||
$new_document->forceDelete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
@ -1727,7 +1731,9 @@ class CompanyImport implements ShouldQueue
|
||||
*/
|
||||
private function transformId(string $resource, ?string $old): ?int
|
||||
{
|
||||
if (empty($old)) {
|
||||
|
||||
// WjnegYbwZ1 == 0 return null;
|
||||
if (empty($old) || $old == 'WjnegYbwZ1') {
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -1736,6 +1742,7 @@ class CompanyImport implements ShouldQueue
|
||||
}
|
||||
|
||||
if (! array_key_exists($resource, $this->ids)) {
|
||||
|
||||
$this->sendImportMail("The Import failed due to missing data in the import file. Resource {$resource} not available.");
|
||||
|
||||
throw new \Exception("Resource {$resource} not available.");
|
||||
@ -1744,16 +1751,12 @@ class CompanyImport implements ShouldQueue
|
||||
if (! array_key_exists("{$old}", $this->ids[$resource])) {
|
||||
// nlog($this->ids[$resource]);
|
||||
nlog("searching for {$old} in {$resource}");
|
||||
|
||||
nlog("If we are missing a user - default to the company owner");
|
||||
|
||||
if ($resource == 'users') {
|
||||
return $this->company_owner->id;
|
||||
}
|
||||
|
||||
$this->sendImportMail("The Import failed due to missing data in the import file. Resource {$resource} not available.");
|
||||
|
||||
nlog($this->ids[$resource]);
|
||||
$this->sendImportMail("The Import failed due to missing data in the import file. Key {$old} not found in {$resource}.");
|
||||
|
||||
throw new \Exception("Missing {$resource} key: {$old}");
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ class CreateCompany
|
||||
$company->settings = $settings;
|
||||
$company->db = config('database.default');
|
||||
$company->enabled_modules = config('ninja.enabled_modules');
|
||||
$company->subdomain = isset($this->request['subdomain']) ? $this->request['subdomain'] : '';
|
||||
$company->subdomain = isset($this->request['subdomain']) ? $this->request['subdomain'] : MultiDB::randomSubdomainGenerator();
|
||||
$company->custom_fields = new \stdClass;
|
||||
$company->default_password_timeout = 1800000;
|
||||
$company->client_registration_fields = ClientRegistrationFields::generate();
|
||||
|
@ -105,7 +105,7 @@ class PaymentFailedMailer implements ShouldQueue
|
||||
});
|
||||
|
||||
//add client payment failures here.
|
||||
//
|
||||
|
||||
if ($this->client->contacts()->whereNotNull('email')->exists() && $this->payment_hash) {
|
||||
$contact = $this->client->contacts()->whereNotNull('email')->first();
|
||||
|
||||
|
@ -305,14 +305,20 @@ class ProcessPostmarkWebhook implements ShouldQueue
|
||||
|
||||
if($sl) {
|
||||
$this->updateSystemLog($sl, $data);
|
||||
|
||||
if (config('ninja.notification.slack')) {
|
||||
$this->invitation->company->notification(new EmailSpamNotification($this->invitation->company->account))->ninja();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
(new SystemLogger($data, SystemLog::CATEGORY_MAIL, SystemLog::EVENT_MAIL_SPAM_COMPLAINT, SystemLog::TYPE_WEBHOOK_RESPONSE, $this->invitation->contact->client, $this->invitation->company))->handle();
|
||||
|
||||
if (config('ninja.notification.slack')) {
|
||||
$this->invitation->company->notification(new EmailSpamNotification($this->invitation->company->account))->ninja();
|
||||
}
|
||||
if (config('ninja.notification.slack')) {
|
||||
$this->invitation->company->notification(new EmailSpamNotification($this->invitation->company->account))->ninja();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function discoverInvitation($message_id)
|
||||
|
@ -307,8 +307,6 @@ class ReminderJob implements ShouldQueue
|
||||
/**Refresh Invoice values*/
|
||||
$invoice = $invoice->calc()->getInvoice();
|
||||
|
||||
// nlog('adjusting client balance and invoice balance by #'.$invoice->number.' '.($invoice->balance - $temp_invoice_balance));
|
||||
// $invoice->client->service()->updateBalance($invoice->balance - $temp_invoice_balance);
|
||||
$invoice->ledger()->updateInvoiceBalance($invoice->balance - $temp_invoice_balance, "Late Fee Adjustment for invoice {$invoice->number}");
|
||||
$invoice->client->service()->calculateBalance();
|
||||
|
||||
|
@ -568,7 +568,8 @@ class BaseDriver extends AbstractPaymentDriver
|
||||
$error = array_key_exists('error', $response) ? $response['error'] : 'Undefined Error';
|
||||
$error_code = array_key_exists('error_code', $response) ? $response['error_code'] : 'Undefined Error Code';
|
||||
|
||||
$this->unWindGatewayFees($this->payment_hash);
|
||||
if($this->payment_hash)
|
||||
$this->unWindGatewayFees($this->payment_hash);
|
||||
|
||||
$this->sendFailureMail($error);
|
||||
|
||||
@ -579,10 +580,6 @@ class BaseDriver extends AbstractPaymentDriver
|
||||
|
||||
$invoices = Invoice::query()->whereIn('id', $this->transformKeys(array_column($this->payment_hash->invoices(), 'invoice_id')))->withTrashed()->get();
|
||||
|
||||
// $invoices->each(function ($invoice) {
|
||||
// $invoice->service()->deletePdf();
|
||||
// });
|
||||
|
||||
$invoices->first()->invitations->each(function ($invitation) use ($nmo) {
|
||||
if (! $invitation->contact->trashed()) {
|
||||
$nmo->to_user = $invitation->contact;
|
||||
|
@ -113,6 +113,10 @@ class InstantBankPay implements MethodInterface
|
||||
return $this->processSuccessfulPayment($payment);
|
||||
}
|
||||
|
||||
if ($billing_request->status === 'submitted') {
|
||||
return $this->processPendingPayment($payment);
|
||||
}
|
||||
|
||||
return $this->processUnsuccessfulPayment($payment);
|
||||
} catch (\Exception $exception) {
|
||||
throw new PaymentFailed(
|
||||
@ -125,7 +129,40 @@ class InstantBankPay implements MethodInterface
|
||||
/**
|
||||
* Handle pending payments for Instant Bank Transfer.
|
||||
*
|
||||
* @param ResourcesPayment $payment
|
||||
* @param \GoCardlessPro\Resources\Payment $payment
|
||||
* @param array $data
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
public function processPendingPayment(\GoCardlessPro\Resources\Payment $payment, array $data = [])
|
||||
{
|
||||
$data = [
|
||||
'payment_method' => $payment->links->mandate, //@phpstan-ignore tag
|
||||
'payment_type' => PaymentType::INSTANT_BANK_PAY,
|
||||
'amount' => $this->go_cardless->payment_hash->data->amount_with_fee,
|
||||
'transaction_reference' => $payment->id, //@phpstan-ignore tag
|
||||
'gateway_type_id' => GatewayType::INSTANT_BANK_PAY,
|
||||
];
|
||||
|
||||
$payment = $this->go_cardless->createPayment($data, Payment::STATUS_PENDING);
|
||||
|
||||
SystemLogger::dispatch(
|
||||
['response' => $payment, 'data' => $data],
|
||||
SystemLog::CATEGORY_GATEWAY_RESPONSE,
|
||||
SystemLog::EVENT_GATEWAY_SUCCESS,
|
||||
SystemLog::TYPE_GOCARDLESS,
|
||||
$this->go_cardless->client,
|
||||
$this->go_cardless->client->company,
|
||||
);
|
||||
|
||||
return redirect()->route('client.payments.show', ['payment' => $this->go_cardless->encodePrimaryKey($payment->id)]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Handle pending payments for Instant Bank Transfer.
|
||||
*
|
||||
* @param \GoCardlessPro\Resources\Payment $payment
|
||||
* @param array $data
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
@ -163,12 +200,12 @@ class InstantBankPay implements MethodInterface
|
||||
{
|
||||
PaymentFailureMailer::dispatch($this->go_cardless->client, $payment->status, $this->go_cardless->client->company, $this->go_cardless->payment_hash->data->amount_with_fee);
|
||||
|
||||
PaymentFailureMailer::dispatch(
|
||||
$this->go_cardless->client,
|
||||
$payment,
|
||||
$this->go_cardless->client->company,
|
||||
$payment->amount
|
||||
);
|
||||
// PaymentFailureMailer::dispatch(
|
||||
// $this->go_cardless->client,
|
||||
// $payment,
|
||||
// $this->go_cardless->client->company,
|
||||
// $payment->amount
|
||||
// );
|
||||
|
||||
$message = [
|
||||
'server_response' => $payment,
|
||||
|
@ -165,7 +165,7 @@ class GoCardlessPaymentDriver extends BaseDriver
|
||||
],
|
||||
]);
|
||||
|
||||
if ($payment->status === 'pending_submission') {
|
||||
if (in_array($payment->status, ['submitted', 'pending_submission'])) {
|
||||
$this->confirmGatewayFee();
|
||||
|
||||
$data = [
|
||||
|
@ -70,7 +70,7 @@ class EmailReport
|
||||
'report_keys' => []
|
||||
];
|
||||
|
||||
if (count($this->scheduler->parameters['clients']) >= 1) {
|
||||
if (isset($this->scheduler->parameters['clients']) && count($this->scheduler->parameters['clients']) >= 1) {
|
||||
$data['clients'] = $this->transformKeys($this->scheduler->parameters['clients']);
|
||||
}
|
||||
|
||||
@ -84,20 +84,20 @@ class EmailReport
|
||||
'client_balance' => $export = (new ClientBalanceReport($this->scheduler->company, $data)),
|
||||
'client_sales' => $export = (new ClientSalesReport($this->scheduler->company, $data)),
|
||||
'user_sales' => $export = (new UserSalesReport($this->scheduler->company, $data)),
|
||||
'clients' => $export = (new ClientExport($this->scheduler->company, $data)),
|
||||
'client_contacts' => $export = (new ContactExport($this->scheduler->company, $data)),
|
||||
'credits' => $export = (new CreditExport($this->scheduler->company, $data)),
|
||||
'documents' => $export = (new DocumentExport($this->scheduler->company, $data)),
|
||||
'expenses' => $export = (new ExpenseExport($this->scheduler->company, $data)),
|
||||
'invoices' => $export = (new InvoiceExport($this->scheduler->company, $data)),
|
||||
'invoice_items' => $export = (new InvoiceItemExport($this->scheduler->company, $data)),
|
||||
'quotes' => $export = (new QuoteExport($this->scheduler->company, $data)),
|
||||
'quote_items' => $export = (new QuoteItemExport($this->scheduler->company, $data)),
|
||||
'recurring_invoices' => $export = (new RecurringInvoiceExport($this->scheduler->company, $data)),
|
||||
'payments' => $export = (new PaymentExport($this->scheduler->company, $data)),
|
||||
'products' => $export = (new ProductExport($this->scheduler->company, $data)),
|
||||
'tasks' => $export = (new TaskExport($this->scheduler->company, $data)),
|
||||
'profitloss' => $export = (new ProfitLoss($this->scheduler->company, $data)),
|
||||
'client' => $export = (new ClientExport($this->scheduler->company, $data)),
|
||||
'client_contact' => $export = (new ContactExport($this->scheduler->company, $data)),
|
||||
'credit' => $export = (new CreditExport($this->scheduler->company, $data)),
|
||||
'document' => $export = (new DocumentExport($this->scheduler->company, $data)),
|
||||
'expense' => $export = (new ExpenseExport($this->scheduler->company, $data)),
|
||||
'invoice' => $export = (new InvoiceExport($this->scheduler->company, $data)),
|
||||
'invoice_item' => $export = (new InvoiceItemExport($this->scheduler->company, $data)),
|
||||
'quote' => $export = (new QuoteExport($this->scheduler->company, $data)),
|
||||
'quote_item' => $export = (new QuoteItemExport($this->scheduler->company, $data)),
|
||||
'recurring_invoice' => $export = (new RecurringInvoiceExport($this->scheduler->company, $data)),
|
||||
'payment' => $export = (new PaymentExport($this->scheduler->company, $data)),
|
||||
'product' => $export = (new ProductExport($this->scheduler->company, $data)),
|
||||
'task' => $export = (new TaskExport($this->scheduler->company, $data)),
|
||||
default => $export = false,
|
||||
};
|
||||
|
||||
|
@ -98,6 +98,11 @@ class ActivityTransformer extends EntityTransformer
|
||||
|
||||
public function includeClient(Activity $activity)
|
||||
{
|
||||
|
||||
if (!$activity->client) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$transformer = new ClientTransformer($this->serializer);
|
||||
|
||||
return $this->includeItem($activity->client, $transformer, Client::class);
|
||||
@ -105,6 +110,10 @@ class ActivityTransformer extends EntityTransformer
|
||||
|
||||
public function includeVendor(Activity $activity)
|
||||
{
|
||||
if (!$activity->vendor) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$transformer = new VendorTransformer($this->serializer);
|
||||
|
||||
return $this->includeItem($activity->vendor, $transformer, Vendor::class);
|
||||
@ -112,6 +121,11 @@ class ActivityTransformer extends EntityTransformer
|
||||
|
||||
public function includeContact(Activity $activity)
|
||||
{
|
||||
|
||||
if (!$activity->contact) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$transformer = new ClientContactTransformer($this->serializer);
|
||||
|
||||
return $this->includeItem($activity->contact, $transformer, ClientContact::class);
|
||||
@ -119,6 +133,11 @@ class ActivityTransformer extends EntityTransformer
|
||||
|
||||
public function includeVendorContact(Activity $activity)
|
||||
{
|
||||
|
||||
if (!$activity->vendor_contact) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$transformer = new VendorContactTransformer($this->serializer);
|
||||
|
||||
return $this->includeItem($activity->vendor_contact, $transformer, VendorContact::class);
|
||||
@ -126,6 +145,11 @@ class ActivityTransformer extends EntityTransformer
|
||||
|
||||
public function includeRecurringInvoice(Activity $activity)
|
||||
{
|
||||
|
||||
if (!$activity->recurring_invoice) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$transformer = new RecurringInvoiceTransformer($this->serializer);
|
||||
|
||||
return $this->includeItem($activity->recurring_invoice, $transformer, RecurringInvoice::class);
|
||||
@ -133,14 +157,24 @@ class ActivityTransformer extends EntityTransformer
|
||||
|
||||
public function includePurchaseOrder(Activity $activity)
|
||||
{
|
||||
|
||||
if (!$activity->purchase_order) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$transformer = new PurchaseOrderTransformer($this->serializer);
|
||||
|
||||
return $this->includeItem($activity->purchase_order(), $transformer, PurchaseOrder::class);
|
||||
return $this->includeItem($activity->purchase_order, $transformer, PurchaseOrder::class);
|
||||
}
|
||||
|
||||
|
||||
public function includeQuote(Activity $activity)
|
||||
{
|
||||
|
||||
if (!$activity->quote) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$transformer = new RecurringInvoiceTransformer($this->serializer);
|
||||
|
||||
return $this->includeItem($activity->quote, $transformer, Quote::class);
|
||||
@ -148,6 +182,10 @@ class ActivityTransformer extends EntityTransformer
|
||||
|
||||
public function includeInvoice(Activity $activity)
|
||||
{
|
||||
if (!$activity->invoice) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$transformer = new InvoiceTransformer($this->serializer);
|
||||
|
||||
return $this->includeItem($activity->invoice, $transformer, Invoice::class);
|
||||
@ -155,6 +193,10 @@ class ActivityTransformer extends EntityTransformer
|
||||
|
||||
public function includeCredit(Activity $activity)
|
||||
{
|
||||
if (!$activity->credit) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$transformer = new CreditTransformer($this->serializer);
|
||||
|
||||
return $this->includeItem($activity->credit, $transformer, Credit::class);
|
||||
@ -162,6 +204,10 @@ class ActivityTransformer extends EntityTransformer
|
||||
|
||||
public function includePayment(Activity $activity)
|
||||
{
|
||||
if (!$activity->payment) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$transformer = new PaymentTransformer($this->serializer);
|
||||
|
||||
return $this->includeItem($activity->payment, $transformer, Payment::class);
|
||||
@ -169,6 +215,10 @@ class ActivityTransformer extends EntityTransformer
|
||||
|
||||
public function includeUser(Activity $activity)
|
||||
{
|
||||
if (!$activity->user) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$transformer = new UserTransformer($this->serializer);
|
||||
|
||||
return $this->includeItem($activity->user, $transformer, User::class);
|
||||
@ -176,6 +226,10 @@ class ActivityTransformer extends EntityTransformer
|
||||
|
||||
public function includeExpense(Activity $activity)
|
||||
{
|
||||
if (!$activity->expense) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$transformer = new ExpenseTransformer($this->serializer);
|
||||
|
||||
return $this->includeItem($activity->expense, $transformer, Expense::class);
|
||||
@ -183,6 +237,10 @@ class ActivityTransformer extends EntityTransformer
|
||||
|
||||
public function includeTask(Activity $activity)
|
||||
{
|
||||
if (!$activity->task) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$transformer = new TaskTransformer($this->serializer);
|
||||
|
||||
return $this->includeItem($activity->task, $transformer, Task::class);
|
||||
|
@ -74,7 +74,7 @@ class ProductTransformer extends EntityTransformer
|
||||
'notes' => $product->notes ?: '',
|
||||
'cost' => (float) $product->cost ?: 0,
|
||||
'price' => (float) $product->price ?: 0,
|
||||
'quantity' => (float) $product->quantity ?: 1.0,
|
||||
'quantity' => is_numeric($product->quantity) ? (float) $product->quantity : (float) 1.0,
|
||||
'tax_name1' => $product->tax_name1 ?: '',
|
||||
'tax_rate1' => (float) $product->tax_rate1 ?: 0,
|
||||
'tax_name2' => $product->tax_name2 ?: '',
|
||||
|
2455
composer.lock
generated
2455
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@ -17,8 +17,8 @@ return [
|
||||
'require_https' => env('REQUIRE_HTTPS', true),
|
||||
'app_url' => rtrim(env('APP_URL', ''), '/'),
|
||||
'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
|
||||
'app_version' => env('APP_VERSION', '5.7.59'),
|
||||
'app_tag' => env('APP_TAG', '5.7.59'),
|
||||
'app_version' => env('APP_VERSION', '5.7.62'),
|
||||
'app_tag' => env('APP_TAG', '5.7.62'),
|
||||
'minimum_client_version' => '5.0.16',
|
||||
'terms_version' => '1.0.1',
|
||||
'api_secret' => env('API_SECRET', false),
|
||||
|
@ -28,4 +28,5 @@ parameters:
|
||||
- '#Array has 2 duplicate keys with value#'
|
||||
- '#Call to an undefined method#'
|
||||
- '#makeHidden#'
|
||||
- '#Socialite#'
|
||||
- '#Socialite#'
|
||||
- '#Access to protected property#'
|
@ -28,13 +28,13 @@
|
||||
@endsection
|
||||
|
||||
@push('footer')
|
||||
<script src="https://www.paypal.com/sdk/js?enable-funding={!! $funding_options !!}&disable-funding=credit&components=buttons,hosted-fields,funding-eligibility&intent=capture&client-id={!! $client_id !!}" data-client-token="{!! $token !!}">
|
||||
<script src="https://www.paypal.com/sdk/js?enable-funding={!! $funding_options !!}&disable-funding=credit&components=buttons,hosted-fields,funding-eligibility&intent=capture&client-id={!! $client_id !!}&buyer-country=US¤cy=USD" data-client-token="{!! $token !!}">
|
||||
</script>
|
||||
|
||||
<script>
|
||||
|
||||
paypal.Buttons({
|
||||
|
||||
fundingSource: "{{ $funding_options }}",
|
||||
env: "{{ $gateway->company_gateway->getConfigField('testMode') ? 'sandbox' : 'production' }}",
|
||||
client: {
|
||||
@if($gateway->company_gateway->getConfigField('testMode'))
|
||||
@ -60,7 +60,12 @@
|
||||
console.log(err);
|
||||
}
|
||||
|
||||
}).render('#paypal-button-container');
|
||||
}).render('#paypal-button-container').catch(function(err) {
|
||||
|
||||
document.getElementById('errors').textContent = err;
|
||||
document.getElementById('errors').hidden = false;
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
||||
|
||||
@push('footer')
|
||||
|
||||
<script src="https://www.paypal.com/sdk/js?client-id={!! $client_id !!}¤cy={!! $currency !!}&merchant-id={!! $merchantId !!}&components=buttons,funding-eligibility&intent=capture" data-partner-attribution-id="invoiceninja_SP_PPCP"></script>
|
||||
<script src="https://www.paypal.com/sdk/js?client-id={!! $client_id !!}¤cy={!! $currency !!}&merchant-id={!! $merchantId !!}&components=buttons,funding-eligibility&intent=capture&enable-funding={!! $funding_source !!}" data-partner-attribution-id="invoiceninja_SP_PPCP"></script>
|
||||
<div id="paypal-button-container"></div>
|
||||
<script>
|
||||
|
||||
@ -67,7 +67,13 @@
|
||||
document.getElementById("server_response").submit();
|
||||
}
|
||||
|
||||
}).render('#paypal-button-container');
|
||||
}).render('#paypal-button-container').catch(function(err) {
|
||||
|
||||
document.getElementById('errors').textContent = err;
|
||||
document.getElementById('errors').hidden = false;
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
@endpush
|
@ -445,17 +445,11 @@ class SchedulerTest extends TestCase
|
||||
];
|
||||
|
||||
$response = false;
|
||||
|
||||
try {
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson('/api/v1/task_schedulers', $data);
|
||||
} catch (ValidationException $e) {
|
||||
$message = json_decode($e->validator->getMessageBag(), 1);
|
||||
nlog($message);
|
||||
}
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson('/api/v1/task_schedulers', $data);
|
||||
|
||||
$response->assertStatus(200);
|
||||
|
||||
$data = $response->json();
|
||||
@ -509,19 +503,13 @@ class SchedulerTest extends TestCase
|
||||
|
||||
$response = false;
|
||||
|
||||
try {
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson('/api/v1/task_schedulers', $data);
|
||||
} catch (ValidationException $e) {
|
||||
$message = json_decode($e->validator->getMessageBag(), 1);
|
||||
nlog($message);
|
||||
}
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson('/api/v1/task_schedulers', $data);
|
||||
|
||||
$response->assertStatus(200);
|
||||
|
||||
|
||||
|
||||
$data = [
|
||||
'name' => 'A single Client',
|
||||
'frequency_id' => RecurringInvoice::FREQUENCY_MONTHLY,
|
||||
|
@ -28,8 +28,20 @@ class DomainCheckTest extends TestCase
|
||||
public function testDomainCheck()
|
||||
{
|
||||
|
||||
$this->assertTrue(in_array('yopmail.com', Domains::getDomains()));
|
||||
$this->assertFalse(in_array('invoiceninja.com', Domains::getDomains()));
|
||||
$this->assertTrue(in_array('yopmail.com', \App\DataProviders\Domains::getDomains()));
|
||||
$this->assertFalse(in_array('invoiceninja.com', \App\DataProviders\Domains::getDomains()));
|
||||
|
||||
}
|
||||
|
||||
public function testSubdomainValidation()
|
||||
{
|
||||
$this->assertFalse($this->checker('invoiceninja'));
|
||||
$this->assertFalse($this->checker('hello'));
|
||||
$this->assertTrue($this->checker('nasty.pasty'));
|
||||
}
|
||||
|
||||
public function checker($subdomain)
|
||||
{
|
||||
return (!preg_match('/^[A-Za-z0-9](?:[A-Za-z0-9\-]{0,61}[A-Za-z0-9])?$/', $subdomain));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user