I have a class that is responseible for calling a 3rd party payment solution.
As a part of this, there are various merchant id/shared secret parameters. Theses will depend on who's logged into the application.
The class I'm working with takes this info in the constructor when the class is built. Is there a way to pass this in the service provider, perhaps like this:
$this->app->bind( 'App\BokaKanot\Interfaces\BillingInterface',function ($merchantId)
{
return new KlarnaBilling($merchantId);
} );
If so, is it still possible to do this through a constructor or do I need to manaully use App:make
. If I do have to use App::make
, how can I not hide this inside my calling class?
Or should I refactor the class I'm using to not need this in the constructor, and perhaps have an init method?