Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request for adding missing filters in PaymentMethods.php #51

Open
knit-pay opened this issue Jul 24, 2021 · 4 comments
Open

Request for adding missing filters in PaymentMethods.php #51

knit-pay opened this issue Jul 24, 2021 · 4 comments
Assignees

Comments

@knit-pay
Copy link
Contributor

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

return $payment_methods;

return $payment_methods;

@rvdsteege
Copy link
Member

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).

@knit-pay
Copy link
Contributor Author

Thanks for the information.

@knit-pay
Copy link
Contributor Author

@rvdsteege and @remcotolsma
Thanks for implementing pronamic/wp-pronamic-pay#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.

return $payment_methods;

@rvdsteege
Copy link
Member

@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

wp-pay-core/src/Plugin.php

Lines 334 to 392 in bd70730

/**
* Payment methods.
*/
$this->payment_methods = new PaymentMethodsCollection();
$this->payment_methods->add( new PaymentMethod( PaymentMethods::AFTERPAY_NL ) );
$this->payment_methods->add( new PaymentMethod( PaymentMethods::AFTERPAY_COM ) );
$this->payment_methods->add( new PaymentMethod( PaymentMethods::ALIPAY ) );
$this->payment_methods->add( new PaymentMethod( PaymentMethods::AMERICAN_EXPRESS ) );
$this->payment_methods->add( new PaymentMethod( PaymentMethods::APPLE_PAY ) );
$this->payment_methods->add( new PaymentMethod( PaymentMethods::BANCONTACT ) );
$this->payment_methods->add( new PaymentMethod( PaymentMethods::BANK_TRANSFER ) );
$this->payment_methods->add( new PaymentMethod( PaymentMethods::BELFIUS ) );
$this->payment_methods->add( new PaymentMethod( PaymentMethods::BILLINK ) );
$this->payment_methods->add( new PaymentMethod( PaymentMethods::BITCOIN ) );
$this->payment_methods->add( new PaymentMethod( PaymentMethods::BLIK ) );
$this->payment_methods->add( new PaymentMethod( PaymentMethods::BUNQ ) );
$this->payment_methods->add( new PaymentMethod( PaymentMethods::IN3 ) );
$this->payment_methods->add( new PaymentMethod( PaymentMethods::CAPAYABLE ) );
$this->payment_methods->add( new PaymentMethod( PaymentMethods::CREDIT_CARD ) );
$this->payment_methods->add( new PaymentMethod( PaymentMethods::DIRECT_DEBIT ) );
$this->payment_methods->add( new PaymentMethod( PaymentMethods::DIRECT_DEBIT_BANCONTACT ) );
$this->payment_methods->add( new PaymentMethod( PaymentMethods::DIRECT_DEBIT_IDEAL ) );
$this->payment_methods->add( new PaymentMethod( PaymentMethods::DIRECT_DEBIT_SOFORT ) );
$this->payment_methods->add( new PaymentMethod( PaymentMethods::EPS ) );
$this->payment_methods->add( new PaymentMethod( PaymentMethods::FOCUM ) );
$this->payment_methods->add( new PaymentMethod( PaymentMethods::IDEAL ) );
$this->payment_methods->add( new PaymentMethod( PaymentMethods::IDEALQR ) );
$this->payment_methods->add( new PaymentMethod( PaymentMethods::GIROPAY ) );
$this->payment_methods->add( new PaymentMethod( PaymentMethods::GOOGLE_PAY ) );
$this->payment_methods->add( new PaymentMethod( PaymentMethods::KBC ) );
$this->payment_methods->add( new PaymentMethod( PaymentMethods::KLARNA_PAY_LATER ) );
$this->payment_methods->add( new PaymentMethod( PaymentMethods::KLARNA_PAY_NOW ) );
$this->payment_methods->add( new PaymentMethod( PaymentMethods::KLARNA_PAY_OVER_TIME ) );
$this->payment_methods->add( new PaymentMethod( PaymentMethods::MAESTRO ) );
$this->payment_methods->add( new PaymentMethod( PaymentMethods::MASTERCARD ) );
$this->payment_methods->add( new PaymentMethod( PaymentMethods::MB_WAY ) );
$this->payment_methods->add( new PaymentMethod( PaymentMethods::PAYCONIQ ) );
$this->payment_methods->add( new PaymentMethod( PaymentMethods::PAYPAL ) );
$this->payment_methods->add( new PaymentMethod( PaymentMethods::PRZELEWY24 ) );
$this->payment_methods->add( new PaymentMethod( PaymentMethods::SANTANDER ) );
$this->payment_methods->add( new PaymentMethod( PaymentMethods::SOFORT ) );
$this->payment_methods->add( new PaymentMethod( PaymentMethods::SPRAYPAY ) );
$this->payment_methods->add( new PaymentMethod( PaymentMethods::SWISH ) );
$this->payment_methods->add( new PaymentMethod( PaymentMethods::TWINT ) );
$this->payment_methods->add( new PaymentMethod( PaymentMethods::V_PAY ) );
$this->payment_methods->add( new PaymentMethod( PaymentMethods::VIPPS ) );
$this->payment_methods->add( new PaymentMethod( PaymentMethods::VISA ) );
}
/**
* Get payment methods.
*
* @param array $args Query arguments.
* @return PaymentMethodsCollection
*/
public function get_payment_methods( $args = [] ) {
return $this->payment_methods->query( $args );
}
, 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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Todo
Status: Deferred
Development

No branches or pull requests

2 participants