diff options
author | Florian Dold <florian@dold.me> | 2021-11-27 20:56:58 +0100 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2021-11-27 20:57:07 +0100 |
commit | 5c4c25516df9d65d29dc7f3f38b5a2a1a8e9e374 (patch) | |
tree | 4665e79a6033ab949de211fd9de8de8ca681c2e0 /packages/taler-wallet-core/src/operations/merchants.ts | |
parent | 403de8170ef538ef74505859b1c04e3542cad9fb (diff) | |
download | wallet-core-5c4c25516df9d65d29dc7f3f38b5a2a1a8e9e374.tar.xz |
wallet: support both protocol versions
Diffstat (limited to 'packages/taler-wallet-core/src/operations/merchants.ts')
-rw-r--r-- | packages/taler-wallet-core/src/operations/merchants.ts | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/packages/taler-wallet-core/src/operations/merchants.ts b/packages/taler-wallet-core/src/operations/merchants.ts index d12417c7c..fd628fa98 100644 --- a/packages/taler-wallet-core/src/operations/merchants.ts +++ b/packages/taler-wallet-core/src/operations/merchants.ts @@ -52,15 +52,13 @@ export async function getMerchantInfo( `merchant "${canonBaseUrl}" reports protocol ${configResp.version}"`, ); + const parsedVersion = LibtoolVersion.parseVersion(configResp.version); + if (!parsedVersion) { + throw Error("invalid merchant version"); + } + const merchantInfo: MerchantInfo = { - supportsMerchantProtocolV1: !!LibtoolVersion.compare( - "1:0:0", - configResp.version, - )?.compatible, - supportsMerchantProtocolV2: !!LibtoolVersion.compare( - "2:0:0", - configResp.version, - )?.compatible, + protocolVersionCurrent: parsedVersion.current, }; ws.merchantInfoCache[canonBaseUrl] = merchantInfo; |