Is there a test for qualified residents? When is the test applied (e.g., date of payment, date of services, date of claim, etc.)? How is it proven?

Can a local company be used to qualify goods and services that are unavailable or do not originate within the jurisdiction as eligible spend? If so, what requirements must be met?