open-dollar / od-app

https://app.dev.opendollar.com
6 stars 4 forks source link

Issue #656 (app PR): country.is failure #660

Closed jahabeebs closed 2 months ago

jahabeebs commented 2 months ago

closes #656

bot PR is here: https://github.com/open-dollar/od-bot/pull/128

^ depends on https://github.com/open-dollar/od-bot/pull/128

Description

Screenshots

Works locally

https://github.com/user-attachments/assets/c6db37f5-cad5-470b-9024-16aa073e8f28

vercel[bot] commented 2 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
od-app ✅ Ready (Inspect) Visit Preview Jul 24, 2024 10:08pm
od-app-hai ✅ Ready (Inspect) Visit Preview Jul 24, 2024 10:08pm
od-app-testnet ✅ Ready (Inspect) Visit Preview Jul 24, 2024 10:08pm
jahabeebs commented 2 months ago

@pi0neerpat I made the following changes based on our discussion today: 1) I moved the geoblock logic into the /screen endpoint in the bot repo (see this PR: https://github.com/open-dollar/od-bot/pull/128). We also now use Vercel's request headers to get the country so there's no API call needed to an external API 2) In the app I consolidated sanctionsCheck() and geoBlockCheck() into a single function and we only ever make 1 API call at most to our bot /screen endpoint

Screenshots

Testing locally the geoblock logic is working and I logged the country in Vercel to be sure it was identifying the right country and blocking properly (I added 'CO' to the block list temporarily to test)

Screenshot 2024-07-24 at 4 23 32 PM