public function register() { $this->app->bind(PayPartsInterface::class, function() { $settings = new PaySettings(['store_id'=>config('payparts.store_id'), 'password'=>config('payparts.password')]);
public function __construct(array $setting) { $this->setting = $setting;
if(empty($setting['store_id'])){ throw new \InvalidArgumentException('store_id is empty'); } if(empty($setting['password'])){ throw new \InvalidArgumentException('password is empty'); } } }
use PayParts\PayParts; use App\DTO\PaySettingsDTO;
class PayPartsService implements PayPartsInterface { private $payParts;
public function __construct(PaySettingsDTO $settings) { $this->payParts = new PayParts($settings->setting['store_id'], $settings->setting['password']); }
public function setOptions(array $options) { return $this->payParts->setOptions($options); }
public function create(string $method) { return $this->payParts->create($method); } }
public function __construct(array $setting) { $this->setting = $setting;
if(empty($setting['store_id'])){ throw new \InvalidArgumentException('store_id is empty'); } if(empty($setting['password'])){ throw new \InvalidArgumentException('password is empty'); } } }