strangerstudios / pmpro-payfast

Add the South African payment processing service PayFast as a gateway option for Paid Memberships Pro.
https://www.paidmembershipspro.com/add-ons/payfast-payment-gateway/
5 stars 13 forks source link

Gateway is Ready Checks #59

Closed JarrydLong closed 4 years ago

JarrydLong commented 4 years ago

Checks to see if the gateway's credentials have been filled out. If not, display the Gateway setup notice

image

dparker1005 commented 4 years ago

I think there may be an issue with this fix if the PMPro PayFast plugin is installed but the site is not actively using the PayFast gateway and the PayFast credentials are not filled out. In this case, the gateway setup notice would still be shown even if the chosen gateway is set up correctly.

This code also ignores the global $pmpro_gateway_ready variable, which should be updated by the result of this function in case there is other code that uses that variable later on.

Finally, the return value should be calculated by both the global $pmpro_gateway_ready and $pmpro_pages_ready variables in any function filtering pmpro_is_ready. This is where that is done in the core PMPro plugin:: https://github.com/strangerstudios/paid-memberships-pro/blob/c36365f23deaf1cabb81690940b68fe4adf490b5/includes/functions.php#L2601-L2606

Recommending changing this fix to something like this, but happy to talk through other solutions: https://gist.github.com/dparker1005/75e31af84603d4b04e1e88ad05fa8d39

dparker1005 commented 4 years ago

Also, PR for this already merged here: https://github.com/strangerstudios/pmpro-payfast/pull/57