diff --git a/app/Http/ViewComposers/Components/RotessaComponents.php b/app/Http/ViewComposers/Components/RotessaComponents.php index 2af96e9f0fd7..b984d0bb2339 100644 --- a/app/Http/ViewComposers/Components/RotessaComponents.php +++ b/app/Http/ViewComposers/Components/RotessaComponents.php @@ -5,18 +5,24 @@ namespace App\Http\ViewComposers\Components; use App\DataProviders\CAProvinces; use App\DataProviders\USStates; use Illuminate\View\Component; +use App\Models\ClientContact; use Illuminate\Support\Arr; use Illuminate\View\View; + // Contact Component class ContactComponent extends Component { - public array $contact; - - public function __construct(array $contact) { - $this->contact = $contact; - $this->attributes = $this->newAttributeBag(Arr::only($this->contact, $this->fields) ); + public function __construct(ClientContact $contact) { + $contact = collect($contact->client->contacts->firstWhere('is_primary', 1)->toArray())->merge([ + 'home_phone' =>$contact->client->phone, + 'custom_identifier' => $contact->client->number, + 'name' =>$contact->client->name, + 'id' => null + ] )->all(); + + $this->attributes = $this->newAttributeBag(Arr::only($contact, $this->fields) ); } private $fields = [ @@ -37,7 +43,7 @@ class ContactComponent extends Component public function render() { - return $this->view('rotessa::components.contact', $this->attributes->getAttributes(), $this->defaults ); + return render('gateways.rotessa.components.contact', array_merge($this->defaults, $this->attributes->getAttributes() ) ); } } @@ -75,8 +81,7 @@ class AddressComponent extends Component public function render() { - - return $this->view('rotessa::components.address', $this->attributes->getAttributes(), $this->defaults ); + return render('gateways.rotessa.components.address',array_merge( $this->defaults, $this->attributes->getAttributes() ) ); } } @@ -113,6 +118,6 @@ class AccountComponent extends Component public function render() { - return $this->view('rotessa::components.account', $this->attributes->getAttributes(), $this->defaults ); + return render('gateways.rotessa.components.account', array_merge($this->attributes->getAttributes(), $this->defaults) ); } } diff --git a/app/Http/ViewComposers/RotessaComposer.php b/app/Http/ViewComposers/RotessaComposer.php index 5501fac81207..493d955267b4 100644 --- a/app/Http/ViewComposers/RotessaComposer.php +++ b/app/Http/ViewComposers/RotessaComposer.php @@ -4,13 +4,13 @@ use Illuminate\Support\Facades\View; use App\DataProviders\CAProvinces; use App\DataProviders\USStates; -View::composer(['rotessa::components.address','rotessa::components.banks.US.bank','rotessa::components.dropdowns.country.US'], function ($view) { +View::composer(['*.rotessa.components.address','*.rotessa.components.banks.US.bank','*.rotessa.components.dropdowns.country.US'], function ($view) { $states = USStates::get(); $view->with('states', $states); }); // CAProvinces View Composer -View::composer(['rotessa::components.address','rotessa::components.banks.CA.bank','rotessa::components.dropdowns.country.CA'], function ($view) { +View::composer(['*.rotessa.components.address','*.rotessa.components.banks.CA.bank','*.rotessa.components.dropdowns.country.CA'], function ($view) { $provinces = CAProvinces::get(); $view->with('provinces', $provinces); }); \ No newline at end of file diff --git a/app/PaymentDrivers/Rotessa/PaymentMethod.php b/app/PaymentDrivers/Rotessa/PaymentMethod.php index 903b681f70fe..b52c2423bf7e 100755 --- a/app/PaymentDrivers/Rotessa/PaymentMethod.php +++ b/app/PaymentDrivers/Rotessa/PaymentMethod.php @@ -67,7 +67,7 @@ class PaymentMethod implements MethodInterface ]; $data['address'] = collect($data['client']->toArray())->merge(['country' => $data['client']->country->iso_3166_2 ])->all(); - return view('rotessa::bank_transfer.authorize', $data); + return render('gateways.rotessa.bank_transfer.authorize', $data ); } /** * Handle the authorization page for Rotessa. @@ -128,7 +128,7 @@ class PaymentMethod implements MethodInterface $data['frequency'] = Frequencies::getOnePayment(); $data['installments'] = 1; $data['invoice_nums'] = $data['invoices']->pluck('invoice_number')->join(', '); - return view('rotessa::bank_transfer.pay', $data ); + return render('gateways.rotessa.bank_transfer.pay', $data ); } /** diff --git a/resources/views/portal/ninja2020/gateways/rotessa/components/account.blade.php b/resources/views/portal/ninja2020/gateways/rotessa/components/account.blade.php index c42672255b00..d39c2d88544e 100644 --- a/resources/views/portal/ninja2020/gateways/rotessa/components/account.blade.php +++ b/resources/views/portal/ninja2020/gateways/rotessa/components/account.blade.php @@ -28,4 +28,4 @@ -@include("rotessa::components.banks.$country.bank", compact('bank_account_type','routing_number','institution_number','transit_number')) \ No newline at end of file +@include("portal.ninja2020.gateways.rotessa.components.banks.$country.bank", compact('bank_account_type','routing_number','institution_number','transit_number')) \ No newline at end of file diff --git a/resources/views/portal/ninja2020/gateways/rotessa/components/address.blade.php b/resources/views/portal/ninja2020/gateways/rotessa/components/address.blade.php index 2db721cd4e28..68cbb97c6a79 100644 --- a/resources/views/portal/ninja2020/gateways/rotessa/components/address.blade.php +++ b/resources/views/portal/ninja2020/gateways/rotessa/components/address.blade.php @@ -59,4 +59,4 @@ - @include("rotessa::components.dropdowns.country.$country",compact('province_code')) \ No newline at end of file + @include("portal.ninja2020.gateways.rotessa.components.dropdowns.country.$country",compact('province_code')) \ No newline at end of file