Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

May be change hardcoded storages models? #9

Open
roquie opened this issue Mar 31, 2017 · 2 comments
Open

May be change hardcoded storages models? #9

roquie opened this issue Mar 31, 2017 · 2 comments

Comments

@roquie
Copy link
Contributor

roquie commented Mar 31, 2017

Hello,

I use eloquent storage for my payments and my tables have another name, another columns titles but fully compatible with Payum. I implement my models like as Recca0120\LaravelPayum\Model\Payment::class and I attempted to redeclare in my service provider
(loaded after your):

use Recca0120\LaravelPayum\Storage\EloquentStorage;

 /** @var PayumBuilder $builder */
$builder = $this->app->make(PayumBuilder::class);
$builder
      ->setTokenStorage(new EloquentStorage(\App\Token::class))
      ->addStorage(Payment::class, new EloquentStorage(\App\Payment::class))
      // add gateway factories
;

then I tried run this payment and receive that error: "table [payum_payments] not found in database". That speaks about this fact - models are hardcoded into library and I can't use custom.

Solution:

  1. LaravelPayumServiceProvider Add method, where I can set my $builder settings, and if they are not set, use by default from library. Then I extend ServiceProvider class and overwrite there him.
  2. Method getStorage of PayumService class hardcoded library EloquentPayment model. Change it.

What do you think? Maybe I create PR?

@recca0120
Copy link
Owner

recca0120 commented Mar 31, 2017

OK if you need it , you can create PR.
I'll merge it

In fact, this package isn't good enough.
I'll refactor it when I have time.

@roquie
Copy link
Contributor Author

roquie commented Mar 31, 2017

Okay, I send changes on next week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants