fix CheckPaymentPaidResponse schema

This commit is contained in:
Florian Dold 2020-11-03 13:46:44 +01:00
parent 7008de598d
commit e259d109ef
No known key found for this signature in database
GPG Key ID: D2E4F00F29D02A4B
3 changed files with 10 additions and 3 deletions

View File

@ -82,7 +82,7 @@ export const codecForCheckPaymentPaidResponse = (): Codec<
CheckPaymentPaidResponse CheckPaymentPaidResponse
> => > =>
buildCodecForObject<CheckPaymentPaidResponse>() buildCodecForObject<CheckPaymentPaidResponse>()
.property("order_status_url", codecForConstString("paid")) .property("order_status_url", codecForString())
.property("order_status", codecForConstString("paid")) .property("order_status", codecForConstString("paid"))
.property("refunded", codecForBoolean()) .property("refunded", codecForBoolean())
.property("wired", codecForBoolean()) .property("wired", codecForBoolean())

View File

@ -341,10 +341,17 @@ export function codecForConstString<V extends string>(s: V): Codec<V> {
if (x === s) { if (x === s) {
return x; return x;
} }
if (typeof x !== "string") {
throw new DecodingError(
`expected string constant "${s}" at ${renderContext(
c,
)} but got ${typeof x}`,
);
}
throw new DecodingError( throw new DecodingError(
`expected string constant "${s}" at ${renderContext( `expected string constant "${s}" at ${renderContext(
c, c,
)} but got ${typeof x}`, )} but got string value "${x}"`,
); );
}, },
}; };

View File

@ -233,7 +233,7 @@ importers:
taler-wallet-core: 'workspace:*' taler-wallet-core: 'workspace:*'
tslib: ^2.0.1 tslib: ^2.0.1
typescript: ^3.9.7 typescript: ^3.9.7
lockfileVersion: 5.1 lockfileVersion: 5.2
packages: packages:
/@ava/typescript/1.1.1: /@ava/typescript/1.1.1:
dependencies: dependencies: