diff options
-rw-r--r-- | packages/taler-integrationtests/src/merchantApiTypes.ts | 2 | ||||
-rw-r--r-- | packages/taler-wallet-core/src/util/codec.ts | 9 | ||||
-rw-r--r-- | pnpm-lock.yaml | 2 |
3 files changed, 10 insertions, 3 deletions
diff --git a/packages/taler-integrationtests/src/merchantApiTypes.ts b/packages/taler-integrationtests/src/merchantApiTypes.ts index 1806ab706..1cfc72db1 100644 --- a/packages/taler-integrationtests/src/merchantApiTypes.ts +++ b/packages/taler-integrationtests/src/merchantApiTypes.ts @@ -82,7 +82,7 @@ export const codecForCheckPaymentPaidResponse = (): Codec< CheckPaymentPaidResponse > => buildCodecForObject<CheckPaymentPaidResponse>() - .property("order_status_url", codecForConstString("paid")) + .property("order_status_url", codecForString()) .property("order_status", codecForConstString("paid")) .property("refunded", codecForBoolean()) .property("wired", codecForBoolean()) diff --git a/packages/taler-wallet-core/src/util/codec.ts b/packages/taler-wallet-core/src/util/codec.ts index 4654c8b93..8605ff335 100644 --- a/packages/taler-wallet-core/src/util/codec.ts +++ b/packages/taler-wallet-core/src/util/codec.ts @@ -341,10 +341,17 @@ export function codecForConstString<V extends string>(s: V): Codec<V> { if (x === s) { return x; } + if (typeof x !== "string") { + throw new DecodingError( + `expected string constant "${s}" at ${renderContext( + c, + )} but got ${typeof x}`, + ); + } throw new DecodingError( `expected string constant "${s}" at ${renderContext( c, - )} but got ${typeof x}`, + )} but got string value "${x}"`, ); }, }; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f8b236858..5bca329ce 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -233,7 +233,7 @@ importers: taler-wallet-core: 'workspace:*' tslib: ^2.0.1 typescript: ^3.9.7 -lockfileVersion: 5.1 +lockfileVersion: 5.2 packages: /@ava/typescript/1.1.1: dependencies: |