4site-interactive-studios / engrid

The Unlicense
10 stars 4 forks source link

Add a "Test Gateway Warning" #287

Open bryancasler opened 9 months ago

bryancasler commented 9 months ago

With the new VGS fields EngagingNetworks.vault.environment will return live or sandbox which gives us an easy way to check if the page is configured with a testing or live gateway. While not guaranteed to cover 100% of scenarios, it could be a good safeguard to prevent clients from accidentally pushing live a page with a test gateway (something that happens from time to time).

We could add a before:body like we do withengridcss=false or expose the .page-alert section which has never been used. Or we could piggy back off the "debug" circle and create a visual representation there.

MichaelT372 commented 1 week ago

In addition, we can check all individual gateways available on the page and determine if they are in test mode.

For example, for Stripe, the presence of the substring "test" in the key indicates that it is a test gateway:

EngagingNetworks.paymentGateways.find(gateway => gateway.gateway === "stripe")?.key.includes("test");