commit 654d6203e774a7fe62fb9cb93e78ae629b43c30d
parent 78551844be75f9009947e153ce5678362199bfa5
Author: Christian Grothoff <christian@grothoff.org>
Date: Wed, 5 Aug 2026 00:16:08 +0200
fix test as bug #11538 is being addressed and attempted amount overrides are now deadly (409)
Diffstat:
1 file changed, 19 insertions(+), 27 deletions(-)
diff --git a/packages/taler-harness/src/integrationtests/test-merchant-templates.ts b/packages/taler-harness/src/integrationtests/test-merchant-templates.ts
@@ -19,6 +19,7 @@
*/
import {
AmountString,
+ HttpStatusCode,
TalerMerchantInstanceHttpClient,
TemplateType,
codecForMerchantContractTerms,
@@ -84,36 +85,27 @@ export async function runMerchantTemplatesTest(t: GlobalTestState) {
}),
);
console.log(j2s(orderResp));
- }
-
- {
- const templateResp = succeedOrThrow(
- await client.useTemplateCreateOrder("p1", {
- summary: "foo",
- template_type: TemplateType.PAIVANA,
- paivana_id: "4321-6hvIP7UnmNDVjp5Intuf9jFK7MzW0ycEyxf5Mszl3xs=",
- website: "https://example.com/",
- amount: "TESTKUDOS:42",
- }),
- );
- console.log(j2s(templateResp));
- const noncePair = createEddsaKeyPair();
- const orderResp = succeedOrThrow(
- await client.claimOrder({
- orderId: templateResp.order_id,
- body: {
- nonce: encodeCrock(noncePair.eddsaPub),
- token: templateResp.token,
- },
- }),
- );
- console.log(j2s(orderResp));
const ct = codecForMerchantContractTerms().decode(orderResp.contract_terms);
t.assertDeepEqual(ct.version, 1);
- // Despite the override, the paivana template
- // keeps the fixed amount.
- // This might change in the future, see https://bugs.taler.net/n/11538
t.assertAmountEquals(ct.choices[0].amount, "TESTKUDOS:1");
+ // The "website" of the request becomes the fulfillment URL.
+ t.assertDeepEqual(ct.fulfillment_url, "https://example.com/");
+ }
+
+ {
+ // The only choice of the template has a fixed amount, so the
+ // client may not override it: amounts can only be chosen for
+ // choices marked "editable_amount".
+ // See https://bugs.taler.net/n/11538 (protocol **v34**).
+ const res = await client.useTemplateCreateOrder("p1", {
+ summary: "foo",
+ template_type: TemplateType.PAIVANA,
+ paivana_id: "4321-6hvIP7UnmNDVjp5Intuf9jFK7MzW0ycEyxf5Mszl3xs=",
+ website: "https://example.com/",
+ amount: "TESTKUDOS:42" as AmountString,
+ });
+ t.assertTrue(res.type === "fail");
+ t.assertTrue(res.case === HttpStatusCode.Conflict);
}
}