diff options
Diffstat (limited to 'packages/taler-harness/src/integrationtests/test-denom-unoffered.ts')
-rw-r--r-- | packages/taler-harness/src/integrationtests/test-denom-unoffered.ts | 88 |
1 files changed, 40 insertions, 48 deletions
diff --git a/packages/taler-harness/src/integrationtests/test-denom-unoffered.ts b/packages/taler-harness/src/integrationtests/test-denom-unoffered.ts index 5b3aec551..27c336ea6 100644 --- a/packages/taler-harness/src/integrationtests/test-denom-unoffered.ts +++ b/packages/taler-harness/src/integrationtests/test-denom-unoffered.ts @@ -55,54 +55,46 @@ export async function runDenomUnofferedTest(t: GlobalTestState) { fulfillment_url: "taler://fulfillment-success/thx", }; - const orderResp = await MerchantPrivateApi.createOrder( - merchant, - "default", - { - order: order, - }, - ); - - let orderStatus = await MerchantPrivateApi.queryPrivateOrderStatus( - merchant, - { - orderId: orderResp.order_id, - }, - ); - - t.assertTrue(orderStatus.order_status === "unpaid"); - - // Make wallet pay for the order - - const preparePayResult = await wallet.client.call( - WalletApiOperation.PreparePayForUri, - { - talerPayUri: orderStatus.taler_pay_uri, - }, - ); - - t.assertTrue( - preparePayResult.status === PreparePayResultType.PaymentPossible, - ); - - const confirmResp = await wallet.client.call(WalletApiOperation.ConfirmPay, { - proposalId: preparePayResult.proposalId, - }); - - const tx = await wallet.client.call(WalletApiOperation.GetTransactionById, { - transactionId: confirmResp.transactionId, - }); - - t.assertTrue( - tx.error?.code === TalerErrorCode.WALLET_UNEXPECTED_REQUEST_ERROR - ); - - const merchantErrorCode = ((tx.error as any).errorResponse as any) - .code; - t.assertDeepEqual( - merchantErrorCode, - TalerErrorCode.MERCHANT_POST_ORDERS_ID_PAY_DENOMINATION_KEY_NOT_FOUND, - ); + const orderResp = await MerchantPrivateApi.createOrder(merchant, "default", { + order: order, + }); + + let orderStatus = await MerchantPrivateApi.queryPrivateOrderStatus(merchant, { + orderId: orderResp.order_id, + }); + + t.assertTrue(orderStatus.order_status === "unpaid"); + + // Make wallet pay for the order + + const preparePayResult = await wallet.client.call( + WalletApiOperation.PreparePayForUri, + { + talerPayUri: orderStatus.taler_pay_uri, + }, + ); + + t.assertTrue( + preparePayResult.status === PreparePayResultType.PaymentPossible, + ); + + const confirmResp = await wallet.client.call(WalletApiOperation.ConfirmPay, { + proposalId: preparePayResult.proposalId, + }); + + const tx = await wallet.client.call(WalletApiOperation.GetTransactionById, { + transactionId: confirmResp.transactionId, + }); + + t.assertTrue( + tx.error?.code === TalerErrorCode.WALLET_UNEXPECTED_REQUEST_ERROR, + ); + + const merchantErrorCode = ((tx.error as any).errorResponse as any).code; + t.assertDeepEqual( + merchantErrorCode, + TalerErrorCode.MERCHANT_POST_ORDERS_ID_PAY_DENOMINATION_KEY_NOT_FOUND, + ); await wallet.client.call(WalletApiOperation.AddExchange, { exchangeBaseUrl: exchange.baseUrl, |