
For resolving and improving the code base we can add a class Give_Payment_Gateways which will handle registration and dependency logic and more. For example:
/**
* Returns a list of all available gateways.
*
* @since 1.0
* @return array $gateways All the available gateways
*/
function give_get_payment_gateways() {
// Default, built-in gateways
$gateways = array(
'paypal' => array(
'admin_label' => __( 'PayPal Standard', 'give' ),
'checkout_label' => __( 'PayPal', 'give' ),
),
'manual' => array(
'admin_label' => __( 'Test Donation', 'give' ),
'checkout_label' => __( 'Test Donation', 'give' )
),
);
return apply_filters( 'give_payment_gateways', $gateways );
}
// For backward compatibility, we can update give_get_payment_gateways fx.
function give_get_payment_gateways() {
// Default, built-in gateways
$gateways = array(
'paypal' => array(
'admin_label' => __( 'PayPal Standard', 'give' ),
'checkout_label' => __( 'PayPal', 'give' ),
// 'currencies' => array()
// This param will accept array or string
),
'manual' => array(
'admin_label' => __( 'Test Donation', 'give' ),
'checkout_label' => __( 'Test Donation', 'give' )
),
);
foreach( $gateways as $gateway ){
Give_Payment_Gateways::register( $gateway );
}
return Give_Payment_Gateways::get();
}
Give_Payment_Gateways::register array (to register single payment gateway )
@ravinderk can you expand on your thoughts here? How will this work in your mind? What does it look like? How does it integrate with our current gateway add-ons, the future Currency Switcher add-on, etc. Until this gets more required detail I'm bumping off @mehul0810
@mehul0810 @DevinWalker Issue description updated. Let me know if you have any question.
That's a much better description @ravinderk thank you - makes much more sense now. However, this is something I believe we can push until after 2.0 so I'm bumping it.
Due to the nature of payment gateways adding and removing supported currencies and the fact that many users don't update in a timely fashion we can't be responsible for maintaining a wide list like this.
Most helpful comment
@mehul0810 @DevinWalker Issue description updated. Let me know if you have any question.