pronamic / wp-pay-core

Core components for the WordPress payment processing library. This library is used in the WordPress plugin Pronamic Pay: https://www.pronamicpay.com/, but also allows other plugin developers to set up a payment plugin.
https://www.wp-pay.org/
GNU General Public License v3.0
27 stars 3 forks source link

Duplicate code in `get_gateway( … )` functions? #157

Closed remcotolsma closed 9 months ago

remcotolsma commented 10 months ago

https://github.com/pronamic/wp-pay-core/blob/68e947335aaf02544109862c4f3c685bfa8df9a9/src/Plugin.php#L795-L828

https://github.com/pronamic/wp-pay-core/blob/68e947335aaf02544109862c4f3c685bfa8df9a9/src/Gateways/GatewaysDataStoreCPT.php#L43-L85

remcotolsma commented 9 months ago

This has to do with the fact that you can switch integrations within a configuration in the WordPress admin dashboard. In that case, the changed integration has not yet been saved within the configuration, but we do want to request the gateway from the chosen integration.

https://github.com/pronamic/wp-pay-core/blob/8d349ce1e61e7960aa6d384248b7a165bdb41f11/src/GatewayPostType.php#L235-L251