Giter Site home page Giter Site logo

Comments (11)

hrach avatar hrach commented on September 25, 2024

Yes, I know about this. This will require deeper refactoring, use 2.0.0 stable in the mean time.

from gopay.

hranicka avatar hranicka commented on September 25, 2024

I temporary use somethink like this immediatelly before the payment process call:

    /**
     * @param Markette\Gopay\Service $goPay
     * @throws Markette\Gopay\GopayFatalException
     */
    private function setChannels(Markette\Gopay\Service $goPay)
    {
        $goPay->addChannel($goPay::METHOD_GOPAY, 'GoPay');
        $goPay->addChannel($goPay::METHOD_CARD_CESKAS, 'Platba kartou - ČS');
        $goPay->addChannel($goPay::METHOD_CARD_UNICREDITB, 'Platba kartou - Unicredit');
        $goPay->addChannel($goPay::METHOD_SUPERCASH, 'SuperCash');
        $goPay->addChannel($goPay::METHOD_PREMIUMSMS, 'Premium SMS');
        $goPay->addChannel($goPay::METHOD_MPLATBA, 'mPlatba');
        $goPay->addChannel($goPay::METHOD_KOMERCNIB, 'KB');
        $goPay->addChannel($goPay::METHOD_RAIFFEISENB, 'Raiffeisen bank');
        $goPay->addChannel($goPay::METHOD_MBANK, 'mBank');
        $goPay->addChannel($goPay::METHOD_FIOB, 'FIO banka');
        $goPay->addChannel($goPay::METHOD_UNICREDITB, 'Unicredit');
        $goPay->addChannel($goPay::METHOD_SLOVENSKAS, 'Slovenská spořitelna');
        $goPay->addChannel($goPay::METHOD_TRANSFER, 'Bankovní převod');
    }

Tag 2.0.0 is OK at all.

In master instead of ::allowChannel could be called ::addChannel from the Extension class . Or no?

from gopay.

haltuf avatar haltuf commented on September 25, 2024

Sorry for that - didn't realize it will bump here, please ignore.

Do you have any ideas how to solve this bug once for all?
Approaches I was considering:

  • bring back GopaySoap::paymentMethodList() call, just cache its results for a long time
  • load list of methods from constants defined in Service.php - the problem is, PHP reflection cannot read phpdoc of these constants, so you lose information about human-readable name of the payment method ($title)
  • load list in a way @hranicka suggests, just with the possibility for user to edit/rewrite this specification if needed (so the method probably shouldn't be private)

Seems to me, list of payment methods is quite stable, is even specified in API docs, but changes from time to time.

from gopay.

f3l1x avatar f3l1x commented on September 25, 2024

I vote for caching. And also for load list as @hranicka suggested. There could be quite more options to set it.

from gopay.

hrach avatar hrach commented on September 25, 2024

Personally, I would totaly remove getting channels. They are not specific for users, it's just something, which tells you which channel is available. Something like xml documentation. Obivously, you have to allow them "manually", so I would implemented only adding channels manually.

from gopay.

f3l1x avatar f3l1x commented on September 25, 2024

So, user have to add/allow channel before pay method is called. Am I right? I'll change it in master then.

from gopay.

haltuf avatar haltuf commented on September 25, 2024

Does it mean not adding then via config.neon?

from gopay.

f3l1x avatar f3l1x commented on September 25, 2024

@hrach Did you mean stg like this? https://github.com/f3l1x/Gopay/commit/5691899f3a484b2a105bbd759911d2c56462b70e

Removed:

  • allowChannel
  • denyChannel
  • addRowChannel
  • $fetchedChannels

Added:

  • onBeforePay - events that allow you to set channels & etc..

from gopay.

hrach avatar hrach commented on September 25, 2024

Rather not. I think:

  • remove allow/deny
  • rework addRowChannel to addChannel($code, $name, $logo, $offline, $description)

If you would you only event, it wouldn't be possible to bind buttons to form, would be?

from gopay.

f3l1x avatar f3l1x commented on September 25, 2024

@hrach
https://github.com/f3l1x/Gopay/commit/685fd3f6ae99326c7b714e33c5b6ee8f7d13ea8f - Is it better now?
https://github.com/f3l1x/Gopay/commit/7e096d74eb1b4435880974fad387f6351d24e36c - And do you think about pass channels via extension. I removed it.

from gopay.

hrach avatar hrach commented on September 25, 2024

yeah, it's seems to be the right way. about extension - dunno. maybe it should stay. in any cas, try it on your project and validate if the attitude is right :)

from gopay.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.