Answer the question
In order to leave comments, you need to log in
Making work with the API of payment systems into traits, is it possible?
There is some kind of service that allows you to change the currency in one payment system to another. Would it be ok to put the logic of working with the payment systems API into traits and then use these traits in the exchange class?
trait PaymentSystem1 {
...
}
trait PaymentSystem2 {
...
}
trait PaymentSystem3 {
...
}
class ExchangerSystem1System2 {
use PaymentSystem1, PaymentSystem2;
...
}
class ExchangerSystem1System3 {
use PaymentSystem1, PaymentSystem3;
...
}
class ExchangerSystem2System3 {
use PaymentSystem2, PaymentSystem3;
...
}
Answer the question
In order to leave comments, you need to log in
Therefore, payment systems can be called the general concept of "payment systems" because they are designed to perform some similar operations. If you want to be able to replace them or combine them with each other in different combinations, you need to bring them to a common interface, and encapsulate all differences.
Just like that .. and this is a Big Mac)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question