summaryrefslogtreecommitdiff
path: root/packages/taler-integrationtests/src/test-payment.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2020-09-04 02:20:20 +0530
committerFlorian Dold <florian.dold@gmail.com>2020-09-04 02:20:20 +0530
commit9ec6018efef9b45ee42ccda33ed7093881534141 (patch)
tree3b7b0a8bb78cb959531f965152c8307607a05d92 /packages/taler-integrationtests/src/test-payment.ts
parent54c0d1c2589951be26a83575b77dbb80f3a08b79 (diff)
downloadwallet-core-9ec6018efef9b45ee42ccda33ed7093881534141.tar.gz
wallet-core-9ec6018efef9b45ee42ccda33ed7093881534141.tar.bz2
wallet-core-9ec6018efef9b45ee42ccda33ed7093881534141.zip
test recoup, fix bug in reserve state machine, fix bug in recoup-refresh
Diffstat (limited to 'packages/taler-integrationtests/src/test-payment.ts')
-rw-r--r--packages/taler-integrationtests/src/test-payment.ts57
1 files changed, 12 insertions, 45 deletions
diff --git a/packages/taler-integrationtests/src/test-payment.ts b/packages/taler-integrationtests/src/test-payment.ts
index a099e9f23..4f44fc146 100644
--- a/packages/taler-integrationtests/src/test-payment.ts
+++ b/packages/taler-integrationtests/src/test-payment.ts
@@ -20,14 +20,15 @@
import {
runTest,
GlobalTestState,
- MerchantPrivateApi,
- WalletCli,
} from "./harness";
-import { createSimpleTestkudosEnvironment, withdrawViaBank } from "./helpers";
-import { PreparePayResultType } from "taler-wallet-core";
+import {
+ createSimpleTestkudosEnvironment,
+ withdrawViaBank,
+ makeTestPayment,
+} from "./helpers";
/**
- * Run test for basic, bank-integrated withdrawal.
+ * Run test for basic, bank-integrated withdrawal and payment.
*/
runTest(async (t: GlobalTestState) => {
// Set up test environment
@@ -43,45 +44,11 @@ runTest(async (t: GlobalTestState) => {
await withdrawViaBank(t, { wallet, bank, exchange, amount: "TESTKUDOS:20" });
- // Set up order.
-
- const orderResp = await MerchantPrivateApi.createOrder(merchant, "default", {
- order: {
- summary: "Buy me!",
- amount: "TESTKUDOS:5",
- fulfillment_url: "taler://fulfillment-success/thx",
- },
- });
-
- 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.preparePay({
- talerPayUri: orderStatus.taler_pay_uri,
- });
-
- t.assertTrue(
- preparePayResult.status === PreparePayResultType.PaymentPossible,
- );
-
- const r2 = await wallet.apiRequest("confirmPay", {
- // FIXME: should be validated, don't cast!
- proposalId: preparePayResult.proposalId,
- });
- t.assertTrue(r2.type === "response");
-
- // Check if payment was successful.
-
- orderStatus = await MerchantPrivateApi.queryPrivateOrderStatus(merchant, {
- orderId: orderResp.order_id,
- });
-
- t.assertTrue(orderStatus.order_status === "paid");
+ const order = {
+ summary: "Buy me!",
+ amount: "TESTKUDOS:5",
+ fulfillment_url: "taler://fulfillment-success/thx",
+ };
- await t.shutdown();
+ await makeTestPayment(t, { wallet, merchant, order });
});