With #22, we show the Stellar payment method only when the Stellar account accepts the currency for the transaction; however, we're polling the API every time checkout is loaded.
There's a couple of issues with this:
currencies probably won't change that often, so we should cache them in the WP database rather than polling the server every time someone hits the checkout; and
if the Stellard we check against is down, then the API request will return a WP error, which means Stellar won't be available as a payment method, so even though the transaction might be for a valid currency, the customer can't place the order because Stellard is down (and it does seem to go down quite a bit atm). Using a cached copy of the allowed currencies (in in the payment gateway options) prevents this.
I think we can safely request the account's currencies only when the WC Stellar settings are saved or updated (e.g. the WooCommerce > Settings > Checkout > Stellar from is submitted).
We can also display the valid currencies on the WooCommerce > Settings > Checkout > Stellar settings page so an admin knows what currencies are supported on that store (and we can prompt them to update their settings if they have added new currencies).
With #22, we show the Stellar payment method only when the Stellar account accepts the currency for the transaction; however, we're polling the API every time checkout is loaded.
There's a couple of issues with this:
I think we can safely request the account's currencies only when the WC Stellar settings are saved or updated (e.g. the WooCommerce > Settings > Checkout > Stellar from is submitted).
We can also display the valid currencies on the WooCommerce > Settings > Checkout > Stellar settings page so an admin knows what currencies are supported on that store (and we can prompt them to update their settings if they have added new currencies).