summaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2020-11-03 13:46:44 +0100
committerFlorian Dold <florian@dold.me>2020-11-03 13:47:02 +0100
commite259d109efd998d0ff6197123a47b83bfe274680 (patch)
tree29e4d7d9f1dca803252acd10316ca71f1c4cf90e /packages
parent7008de598db1088f5f6b23b9aafb1e406b66ada2 (diff)
downloadwallet-core-e259d109efd998d0ff6197123a47b83bfe274680.tar.gz
wallet-core-e259d109efd998d0ff6197123a47b83bfe274680.tar.bz2
wallet-core-e259d109efd998d0ff6197123a47b83bfe274680.zip
fix CheckPaymentPaidResponse schema
Diffstat (limited to 'packages')
-rw-r--r--packages/taler-integrationtests/src/merchantApiTypes.ts2
-rw-r--r--packages/taler-wallet-core/src/util/codec.ts9
2 files changed, 9 insertions, 2 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}"`,
);
},
};