From 41dcb7cf4ab1cea818b391f39dc3121252b95f8c Mon Sep 17 00:00:00 2001 From: David Bomba Date: Fri, 9 Dec 2022 12:35:37 +1100 Subject: [PATCH] Subscriptions v2 --- app/Http/Livewire/BillingPortalPurchasev2.php | 2 +- app/Import/Providers/Csv.php | 2 + app/Services/Bank/BankMatchingService.php | 2 + app/Services/Bank/ProcessBankRules.php | 7 ++ .../billing-portal-purchasev2.blade.php | 64 ++++++++++--------- 5 files changed, 45 insertions(+), 32 deletions(-) diff --git a/app/Http/Livewire/BillingPortalPurchasev2.php b/app/Http/Livewire/BillingPortalPurchasev2.php index dd8e89b7a447..1cfc3df365be 100644 --- a/app/Http/Livewire/BillingPortalPurchasev2.php +++ b/app/Http/Livewire/BillingPortalPurchasev2.php @@ -234,7 +234,7 @@ class BillingPortalPurchasev2 extends Component 'price' => Number::formatMoney($total, $this->subscription->company).' / '. RecurringInvoice::frequencyForKey($this->subscription->frequency_id), 'total' => $total, 'qty' => $qty, - 'is_recurring' => true + 'is_recurring' => true, ]); } diff --git a/app/Import/Providers/Csv.php b/app/Import/Providers/Csv.php index ecc1f15dce7e..4da3dad96184 100644 --- a/app/Import/Providers/Csv.php +++ b/app/Import/Providers/Csv.php @@ -107,6 +107,8 @@ class Csv extends BaseImport implements ImportInterface $this->transformer = new BankTransformer($this->company); $bank_transaction_count = $this->ingest($data, $entity_type); $this->entity_count['bank_transactions'] = $bank_transaction_count; + + nlog("bank matching co id = {$this->company->id}"); BankMatchingService::dispatchSync($this->company->id, $this->company->db); diff --git a/app/Services/Bank/BankMatchingService.php b/app/Services/Bank/BankMatchingService.php index 8afb84ff6737..00f1e1183c9f 100644 --- a/app/Services/Bank/BankMatchingService.php +++ b/app/Services/Bank/BankMatchingService.php @@ -37,6 +37,8 @@ class BankMatchingService implements ShouldQueue protected $db; + protected $middleware_key; + public function __construct($company_id, $db) { $this->company_id = $company_id; diff --git a/app/Services/Bank/ProcessBankRules.php b/app/Services/Bank/ProcessBankRules.php index 86743bcb366d..2a2c2bae63bb 100644 --- a/app/Services/Bank/ProcessBankRules.php +++ b/app/Services/Bank/ProcessBankRules.php @@ -46,6 +46,10 @@ class ProcessBankRules extends AbstractService $this->credit_rules = $this->bank_transaction->company->credit_rules(); + if(!is_array($this->credit_rules)) + return; + + $this->invoices = Invoice::where('company_id', $this->bank_transaction->company_id) ->whereIn('status_id', [1,2,3]) ->where('is_deleted', 0) @@ -81,6 +85,9 @@ class ProcessBankRules extends AbstractService $this->categories = collect(Cache::get('bank_categories')); + if(!is_array($this->debit_rules)) + return; + foreach($this->debit_rules as $bank_transaction_rule) { diff --git a/resources/views/portal/ninja2020/components/livewire/billing-portal-purchasev2.blade.php b/resources/views/portal/ninja2020/components/livewire/billing-portal-purchasev2.blade.php index 07d2096e3165..1eb309caae87 100644 --- a/resources/views/portal/ninja2020/components/livewire/billing-portal-purchasev2.blade.php +++ b/resources/views/portal/ninja2020/components/livewire/billing-portal-purchasev2.blade.php @@ -14,9 +14,9 @@ @if(!empty($subscription->recurring_product_ids)) @foreach($recurring_products as $index => $product)
  • - @if(false) -
    - Salmon orange fabric pouch with match zipper, gray zipper pull, and adjustable hip belt. + @if(filter_var($product->custom_value1, FILTER_VALIDATE_URL)) +
    +
    @endif
    @@ -52,9 +52,9 @@ @if(!empty($subscription->product_ids)) @foreach($products as $product)
  • - @if(false) + @if(filter_var($product->custom_value1, FILTER_VALIDATE_URL))
    - Salmon orange fabric pouch with match zipper, gray zipper pull, and adjustable hip belt. +
    @endif
    @@ -79,10 +79,11 @@
    + @if(!empty($subscription->optional_recurring_product_ids) || !empty($subscription->optional_product_ids))

    Optional products

    - + @endif
    @@ -90,11 +91,11 @@ @if(!empty($subscription->optional_recurring_product_ids)) @foreach($optional_recurring_products as $index => $product)
  • - @if(false) -
    - Salmon orange fabric pouch with match zipper, gray zipper pull, and adjustable hip belt. -
    - @endif + @if(filter_var($product->custom_value1, FILTER_VALIDATE_URL)) +
    + +
    + @endif
    @@ -104,19 +105,19 @@

    + @if(is_numeric($product->custom_value2))

    {{ ctrans('texts.qty') }}

    - +
    + @endif
    - - @error("data.{$index}.optional_recurring_qty") - - @enderror
  • @endforeach @@ -124,11 +125,11 @@ @if(!empty($subscription->optional_product_ids)) @foreach($optional_products as $index => $product)
  • - @if(false) -
    - Salmon orange fabric pouch with match zipper, gray zipper pull, and adjustable hip belt. -
    - @endif + @if(filter_var($product->custom_value1, FILTER_VALIDATE_URL)) +
    + +
    + @endif
    @@ -138,18 +139,19 @@

    + @if(is_numeric($product->custom_value2))

    {{ ctrans('texts.qty') }}

    - +
    + @endif
    - @error("data.{$index}.optional_qty") - - @enderror
  • @endforeach