diff options
author | Florian Dold <florian.dold@gmail.com> | 2020-08-18 12:58:02 +0530 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2020-08-18 12:58:02 +0530 |
commit | f6d81037a723ec7f89165811153544c5ec18e2ec (patch) | |
tree | 4be12127a3b08ad645a7f3ac29a9775664e43fea | |
parent | 2aeff3a9136afcbb6b9c83677abc5f362f2b05e1 (diff) |
fixes for test-paywall-flow
-rw-r--r-- | packages/taler-integrationtests/src/test-paywall-flow.ts | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/packages/taler-integrationtests/src/test-paywall-flow.ts b/packages/taler-integrationtests/src/test-paywall-flow.ts index 0671fecbe..5214acc4f 100644 --- a/packages/taler-integrationtests/src/test-paywall-flow.ts +++ b/packages/taler-integrationtests/src/test-paywall-flow.ts @@ -82,14 +82,14 @@ runTest(async (t: GlobalTestState) => { ); } - let pubUnpaidStatusResp = codecForMerchantOrderStatusUnpaid().decode( + let pubUnpaidStatus = codecForMerchantOrderStatusUnpaid().decode( publicOrderStatusResp.data, ); - console.log(pubUnpaidStatusResp); + console.log(pubUnpaidStatus); let preparePayResp = await wallet.preparePay({ - talerPayUri: pubUnpaidStatusResp.taler_pay_uri, + talerPayUri: pubUnpaidStatus.taler_pay_uri, }); t.assertTrue(preparePayResp.status === PreparePayResultType.PaymentPossible); @@ -106,7 +106,7 @@ runTest(async (t: GlobalTestState) => { ); } - let pubUnpaidStatus = codecForMerchantOrderStatusUnpaid().decode( + pubUnpaidStatus = codecForMerchantOrderStatusUnpaid().decode( publicOrderStatusResp.data, ); @@ -120,10 +120,12 @@ runTest(async (t: GlobalTestState) => { validateStatus: () => true, }); - if (publicOrderStatusResp.status != 410) { + console.log(publicOrderStatusResp.data); + + if (publicOrderStatusResp.status != 202) { console.log(publicOrderStatusResp.data); throw Error( - `expected status 410 (after paying), but got ${publicOrderStatusResp.status}`, + `expected status 202 (after paying), but got ${publicOrderStatusResp.status}`, ); } @@ -190,6 +192,17 @@ runTest(async (t: GlobalTestState) => { t.assertTrue(preparePayResp.status === PreparePayResultType.AlreadyConfirmed); t.assertTrue(preparePayResp.paid); + // The first order should now be paid under "mysession-three", + // as the wallet did re-purchase detection + orderStatus = await merchant.queryPrivateOrderStatus({ + orderId: firstOrderId, + sessionId: "mysession-three", + }); + + t.assertTrue(orderStatus.order_status === "paid"); + + // Now check if the public status of the new order is correct. + console.log("requesting public status", publicOrderStatusUrl); // Ask the order status of the claimed-but-unpaid order @@ -197,9 +210,9 @@ runTest(async (t: GlobalTestState) => { validateStatus: () => true, }); - if (publicOrderStatusResp.status != 403) { + if (publicOrderStatusResp.status != 402) { throw Error( - `expected status 403, but got ${publicOrderStatusResp.status}`, + `expected status 402, but got ${publicOrderStatusResp.status}`, ); } @@ -207,5 +220,7 @@ runTest(async (t: GlobalTestState) => { publicOrderStatusResp.data, ); - t.assertTrue(pubUnpaidStatusResp.already_paid_order_id === firstOrderId); + console.log(publicOrderStatusResp.data); + + t.assertTrue(pubUnpaidStatus.already_paid_order_id === firstOrderId); }); |