Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/geolocation-controller/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- Point `GeolocationApiService` at API Platform's `geolocation-api` service instead of the legacy Ramps-owned `on-ramp` geolocation endpoint, which is slated for deprecation ([#9415](https://github.com/MetaMask/core/pull/9415))
- UAT temporarily resolves to the production URL since API Platform has not yet provisioned a dedicated UAT deployment for this service
- Bump `@metamask/controller-utils` from `^12.0.0` to `^12.3.0` ([#8774](https://github.com/MetaMask/core/pull/8774), [#9058](https://github.com/MetaMask/core/pull/9058), [#9083](https://github.com/MetaMask/core/pull/9083), [#9218](https://github.com/MetaMask/core/pull/9218))
- Bump `@metamask/messenger` from `^1.2.0` to `^2.0.0` ([#9392](https://github.com/MetaMask/core/pull/9392))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ describe('GeolocationApiService', () => {
await rootMessenger.call('GeolocationApiService:fetchGeolocation');

expect(mockFetch).toHaveBeenCalledWith(
'https://on-ramp.api.cx.metamask.io/geolocation',
'https://geolocation.api.cx.metamask.io/v1/geolocation',
);
});

it('fetches from the UAT URL when env is UAT', async () => {
it('fetches from the production URL when env is UAT, since API Platform has not provisioned a dedicated UAT deployment', async () => {
const mockFetch = createMockFetch('FR');
const { rootMessenger } = getService({
options: { fetch: mockFetch, env: Env.UAT },
Expand All @@ -57,7 +57,7 @@ describe('GeolocationApiService', () => {
await rootMessenger.call('GeolocationApiService:fetchGeolocation');

expect(mockFetch).toHaveBeenCalledWith(
'https://on-ramp.uat-api.cx.metamask.io/geolocation',
'https://geolocation.api.cx.metamask.io/v1/geolocation',
);
});

Expand All @@ -70,7 +70,7 @@ describe('GeolocationApiService', () => {
await rootMessenger.call('GeolocationApiService:fetchGeolocation');

expect(mockFetch).toHaveBeenCalledWith(
'https://on-ramp.dev-api.cx.metamask.io/geolocation',
'https://geolocation.dev-api.cx.metamask.io/v1/geolocation',
);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import type { GeolocationApiServiceMethodActions } from './geolocation-api-servi

const DEFAULT_TTL_MS = 5 * 60 * 1000;

const ENDPOINT_PATH = '/geolocation';
const ENDPOINT_PATH = '/v1/geolocation';

// === GENERAL ===

Expand Down Expand Up @@ -68,12 +68,17 @@ export type GeolocationApiServiceMessenger = Messenger<
/**
* Returns the base URL for the geolocation API for the given environment.
*
* Served by API Platform's `geolocation-api` service, not the legacy
* Ramps-owned `on-ramp` endpoint this previously pointed to. API Platform has
* not yet provisioned a dedicated UAT deployment for this service, so UAT
* temporarily resolves to the production URL until one exists.
*
* @param env - The environment to get the URL for.
* @returns The full URL for the geolocation endpoint.
*/
function getGeolocationUrl(env: Env): string {
const envPrefix = env === Env.PRD ? '' : `${env}-`;
return `https://on-ramp.${envPrefix}api.cx.metamask.io${ENDPOINT_PATH}`;
const envPrefix = env === Env.DEV ? 'dev-' : '';
return `https://geolocation.${envPrefix}api.cx.metamask.io${ENDPOINT_PATH}`;
}

/**
Expand Down
Loading