diff --git a/app/Models/Client.php b/app/Models/Client.php index 0c7bbb3d84f9..48ce8d6c8c84 100644 --- a/app/Models/Client.php +++ b/app/Models/Client.php @@ -529,17 +529,17 @@ class Client extends BaseModel implements HasLocalePreference } - if ($this->currency()->code == 'EUR' && in_array(GatewayType::SEPA, array_column($pms, 'gateway_type_id'))) { - foreach ($pms as $pm) { - if ($pm['gateway_type_id'] == GatewayType::SEPA) { - $cg = CompanyGateway::find($pm['company_gateway_id']); + // if ($this->currency()->code == 'EUR' && in_array(GatewayType::SEPA, array_column($pms, 'gateway_type_id'))) { + // foreach ($pms as $pm) { + // if ($pm['gateway_type_id'] == GatewayType::SEPA) { + // $cg = CompanyGateway::find($pm['company_gateway_id']); - if ($cg && $cg->fees_and_limits->{GatewayType::SEPA}->is_enabled) { - return $cg; - } - } - } - } + // if ($cg && $cg->fees_and_limits->{GatewayType::SEPA}->is_enabled) { + // return $cg; + // } + // } + // } + // } if ($this->country && $this->country->iso_3166_3 == 'GBR' && in_array(GatewayType::DIRECT_DEBIT, array_column($pms, 'gateway_type_id'))) { foreach ($pms as $pm) { diff --git a/app/PaymentDrivers/Stripe/SEPA.php b/app/PaymentDrivers/Stripe/SEPA.php index afa218097f61..54578a039040 100644 --- a/app/PaymentDrivers/Stripe/SEPA.php +++ b/app/PaymentDrivers/Stripe/SEPA.php @@ -34,6 +34,12 @@ class SEPA public function authorizeView($data) { + $data['gateway'] = $this->stripe; + $data['payment_method_id'] = GatewayType::SEPA; + $data['client'] = $this->stripe->client; + $data['country'] = $this->stripe->client->country->iso_3166_2; + $data['currency'] = $this->stripe->client->currency(); + return render('gateways.stripe.sepa.authorize', $data); } diff --git a/app/Services/Invoice/InvoiceService.php b/app/Services/Invoice/InvoiceService.php index 555432e87d49..f38e588fab3d 100644 --- a/app/Services/Invoice/InvoiceService.php +++ b/app/Services/Invoice/InvoiceService.php @@ -362,6 +362,8 @@ class InvoiceService if(!collect($this->invoice->line_items)->contains('type_id', 3)) return $this; + $pre_count = count($this->invoice->line_items); + $this->invoice->line_items = collect($this->invoice->line_items) ->reject(function ($item) { return $item->type_id == '3'; @@ -372,7 +374,7 @@ class InvoiceService /* 24-03-2022 */ $new_balance = $this->invoice->balance; - if(floatval($balance) - floatval($new_balance) != 0) + if($pre_count != count($this->invoice->line_items)) { $adjustment = $balance - $new_balance; diff --git a/app/Services/Invoice/MarkPaid.php b/app/Services/Invoice/MarkPaid.php index 5ea33b4b5cc9..83cd30e3a8bd 100644 --- a/app/Services/Invoice/MarkPaid.php +++ b/app/Services/Invoice/MarkPaid.php @@ -96,17 +96,10 @@ class MarkPaid extends AbstractService $payment->ledger() ->updatePaymentBalance($payment->amount * -1); - // $client = $this->invoice->client->fresh(); - // $client->paid_to_date += $payment->amount; - // $client->balance += $payment->amount * -1; - // $client->save(); - - $this->invoice - ->client - ->service() - ->updateBalance($payment->amount * -1) - ->updatePaidToDate($payment->amount) - ->save(); + $client = $this->invoice->client->fresh(); + $client->paid_to_date += $payment->amount; + $client->balance += $payment->amount * -1; + $client->save(); $this->invoice = $this->invoice ->service() diff --git a/database/migrations/2022_03_29_014025_reverse_apple_domain_for_hosted.php b/database/migrations/2022_03_29_014025_reverse_apple_domain_for_hosted.php new file mode 100644 index 000000000000..a1174083a37d --- /dev/null +++ b/database/migrations/2022_03_29_014025_reverse_apple_domain_for_hosted.php @@ -0,0 +1,41 @@ +fields = '{"account_id":""}'; + $stripe_connect->save(); + } + } + + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + // + } +} diff --git a/resources/views/portal/ninja2020/layout/app.blade.php b/resources/views/portal/ninja2020/layout/app.blade.php index fcda5464af1a..2549dca38b7d 100644 --- a/resources/views/portal/ninja2020/layout/app.blade.php +++ b/resources/views/portal/ninja2020/layout/app.blade.php @@ -31,7 +31,7 @@ @endif - @if(isset($account) && !$account->isPaid()) + @if(isset($company->account) && !$company->account->isPaid())