I'm using activemerchant
as a payment gateway plugin for Spree and I'm trying to use two different payment gateways (The implementation is the same but the credentials are different and they connect to different merchants) based on credit card type/brand? Is there a easy way to to this or where can I find the entrypoint method/class to add this logic?
I end up duplicating payment methods using different credentials and passing down the payments to front-end and redirect credit cards with specific companies to mapped payment methods.
1-Duplicate the payment method with different merchant credentials
2-Pass down the payment details in Rails views e.g. payment_methods: payment_methods
in partial
3-Use erb evaluation to embed payment methods with their associated credit card companies e.g {stripe01: 1, stripe02: 2}
4-Check against credit card number which in this case is masked maskedCardInfo
to get the company name
5-Return which payment method id is meant to be used for a specific credit card company
6-Replace form inputs/fields names before submit
DONE