dimanche 18 octobre 2020

Abstract class or Interface with multiple providers [closed]

I am working on a wiretransfer API gateway with mulitple providers behind it. I thought about architecture, and i came up with this idea but will like your advice:

/Wiretransfers
    AbstractWiretransferProvider.php
    /Providers
        PaypalProvider.php
        TransferwiseProvider.php
        BitcoinProvider.php

Each of providers extends of the AbstractClass (I use abstract class instead of interface because the three providers will have a common function) Some of it will have special functionality (Like reload wallet for paypal...), i thought to created interface for it and implements it in each providers who need it.

And in my code i will initiate the class provider by the name of type of wiretransfer (Maybe i need to use a factory ?)

DO you think it is the right way to manage a multiple providers ?

Thanks in advance

Aucun commentaire:

Enregistrer un commentaire