wp-pay-core icon indicating copy to clipboard operation
wp-pay-core copied to clipboard

Request for adding missing filters in PaymentMethods.php

Open knit-pay opened this issue 3 years ago • 4 comments

Kindly add filters on these lines. So that new payment methods can be added without altering the core code.

https://github.com/pronamic/wp-pay-core/blob/96aa50e150f83d711afa781f87627348dea21f6b/src/Core/PaymentMethods.php#L348

https://github.com/pronamic/wp-pay-core/blob/96aa50e150f83d711afa781f87627348dea21f6b/src/Core/PaymentMethods.php#L447

knit-pay avatar Jul 24 '21 07:07 knit-pay

We're planning to update payment method registration later this year in pronamic/wp-pronamic-pay#154. That will resolve your issue (without using filters).

rvdsteege avatar Jul 28 '21 14:07 rvdsteege

Thanks for the information.

knit-pay avatar Jul 28 '21 14:07 knit-pay

@rvdsteege and @remcotolsma Thanks for implementing https://github.com/pronamic/wp-pronamic-pay/issues/154 it's a great enhancement. Using this we can introduce a new payment method for a gateway provider. In India, we have different payment methods which are not in other countries like Rupay cards, UPI, Bharat Pay, Netbanking etc. Using the functions introduced in #154 we can introduce these new payment methods for gateways but the name of these payment methods is still getting used by below array. It will be great help if you provide a filter to add new methods in this array or fetch the payment method names from gateways instead of this function in woocommerce and other plugins.

https://github.com/pronamic/wp-pay-core/blob/bd707301f7a3e792413163fa8b155c24e631b23d/src/Core/PaymentMethods.php#L473

knit-pay avatar Dec 16 '22 14:12 knit-pay

@knit-pay we understand the issue and were actually still struggling a bit with this, as for now we still needed some way of registering core payment methods (not only for the naming).

However, we do have some ideas and already did some work in https://github.com/pronamic/wp-pay-core/blob/bd707301f7a3e792413163fa8b155c24e631b23d/src/Plugin.php#L334-L392, but ideally this uses the payment methods registered by the gateway integrations. This needs some additional attention and I therefore re-open this issue.

(Once payment methods are registered in 'plugin space', we might also be able to then use that to for example add WooCommerce gateways, so essentially the available payment gateways in WooCommerce will then be registered based on the methods provided in the gateway integrations).

rvdsteege avatar Dec 16 '22 15:12 rvdsteege