From b5980f5b460be1cdc6687d547791d3e76a3cf968 Mon Sep 17 00:00:00 2001 From: chick Date: Sat, 30 May 2026 22:06:35 +0800 Subject: [PATCH] fix: default SMS Bower country to Indonesia --- phone-sms/providers/sms-bower.js | 4 ++-- tests/sms-bower-provider.test.js | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/phone-sms/providers/sms-bower.js b/phone-sms/providers/sms-bower.js index 1e8dbd7..85666bf 100644 --- a/phone-sms/providers/sms-bower.js +++ b/phone-sms/providers/sms-bower.js @@ -6,8 +6,8 @@ const DEFAULT_BASE_URL = 'https://smsbower.page/stubs/handler_api.php'; const DEFAULT_SERVICE_CODE = 'ot'; const DEFAULT_SERVICE_LABEL = 'OpenAI'; - const DEFAULT_COUNTRY_ID = 52; - const DEFAULT_COUNTRY_LABEL = 'Thailand'; + const DEFAULT_COUNTRY_ID = 6; + const DEFAULT_COUNTRY_LABEL = 'Indonesia'; const DEFAULT_REQUEST_TIMEOUT_MS = 20000; const DEFAULT_POLL_TIMEOUT_MS = 180000; const DEFAULT_POLL_INTERVAL_MS = 5000; diff --git a/tests/sms-bower-provider.test.js b/tests/sms-bower-provider.test.js index 5af5b17..8d23122 100644 --- a/tests/sms-bower-provider.test.js +++ b/tests/sms-bower-provider.test.js @@ -14,6 +14,26 @@ function createTextResponse(payload, ok = true, status = ok ? 200 : 400, statusT }; } +test('SMS Bower provider defaults to Indonesia when no country is configured', async () => { + const requests = []; + const provider = api.createProvider({ + fetchImpl: async (url, options = {}) => { + const parsed = new URL(url); + requests.push({ url: parsed, options }); + if (parsed.searchParams.get('action') === 'getNumber') { + return createTextResponse('ACCESS_NUMBER:67890:6281234567890'); + } + throw new Error(`unexpected ${parsed.toString()}`); + }, + }); + + const activation = await provider.requestActivation({ smsBowerApiKey: 'demo-key' }); + + assert.equal(requests[0].url.searchParams.get('country'), '6'); + assert.equal(activation.countryId, 6); + assert.equal(activation.countryLabel, 'Indonesia'); +}); + test('SMS Bower provider uses handler API key query for balance and price catalog', async () => { const requests = []; const provider = api.createProvider({