Help for integrating the Laravel package
Forum rules: Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
#5320 by Ahmad
31 Dec 2017, 17:29
I want to add a payment service like Paypal for banking online payments with multiple gateways (i have different bank gateway online payment providers)
The scenario is this customer can between Cash On Delivery or Online Payment, but for chose Online Payment service, customer must also choose through which bank payment port (gateway) wants to pay
Please see the attached photo to understand me.


the payment process is the same for each bank (Bank A, Bank B,...) but each one has different configs such as terminalId, userName, password, callbackUrl and for the payment request, each dedicated Web service must be called

I want to implement this in the correct way, please help me
Attachments
2017-12-31_20-02-49.jpg
This is what I want
2017-12-31_20-02-49.jpg (19.3 KiB) Viewed 261 times
#5321 by Travin
31 Dec 2017, 17:48
I think you should do only one Payment Provider for all banks. You can create <select> at the view and if user chose one or another Bank, you will change hidden fields with terminalId, userName, password, callbackUrl data by JS and so on. Or you can change just one field and another data will be changed by backend, or it may be text fields, not hidden. :?
#5324 by aimeos
02 Jan 2018, 00:03
If you want to add decorators to the payment provider implementation, you should implement each one as single service provider (especially as you've said the implementation is totally different). Otherwise, you need to implement them into one service provider, add three configurations for that and select the config and implementation based on the selected value of the customer. The first option is definitively easier and more flexible.

The suggestion by Travin has one major problem: If you use hidden fields for the config options in the frontend, you allow attackers to change this values like they want!
#5326 by Ahmad
02 Jan 2018, 07:58
aimeos wrote:If you want to add decorators to the payment provider implementation, you should implement each one as single service provider (especially as you've said the implementation is totally different). Otherwise, you need to implement them into one service provider, add three configurations for that and select the config and implementation based on the selected value of the customer. The first option is definitively easier and more flexible.

The suggestion by Travin has one major problem: If you use hidden fields for the config options in the frontend, you allow attackers to change this values like they want!

aimeos wrote:If you want to add decorators to the payment provider implementation, you should implement each one as single service provider (especially as you've said the implementation is totally different). Otherwise, you need to implement them into one service provider, add three configurations for that and select the config and implementation based on the selected value of the customer. The first option is definitively easier and more flexible.

The suggestion by Travin has one major problem: If you use hidden fields for the config options in the frontend, you allow attackers to change this values like they want!


I did not understand your description, What do you mean by decorators?
my payment process functions are similar each of banks payment APIs, but one bank payment request Url is different of another bank,

Is it possible that I add just one Service with type payment with the name "Online Payment" and provider OnlinePayment, and add choosable banks options?

Should I have added a Service with name: Bank A, type: payment, provider: OnilePayment, and another Service with name: Bank B, type: payment, provider: OnlinePayment, and another Service with name: Bank C, type: payment, provider: OnlinePayment?
or add just one Service with name: Online Payment, type: payment, provider OnlinePayment and add Bank A, Bank B, Bank C in options?

Consider this as I want to end up, have a picture similar to the picture that I attached below?
How should I act?
Attachments
2017-12-31_20-02-49.jpg
2017-12-31_20-02-49.jpg (19.3 KiB) Viewed 249 times