aboutsummaryrefslogtreecommitdiff
path: root/src/headless
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2019-12-19 20:42:49 +0100
committerFlorian Dold <florian.dold@gmail.com>2019-12-19 20:42:49 +0100
commit0c9358c1b2bd80e25940022e86bd8daef8184ad7 (patch)
treea8c8ca0134bd886d8151633aff4c85e9513ad32c /src/headless
parent49e3b3e5b9bbf1ce356ef68f301d50c689ceecb9 (diff)
new date format, replace checkable annotations with codecs
Diffstat (limited to 'src/headless')
-rw-r--r--src/headless/merchant.ts9
-rw-r--r--src/headless/taler-wallet-cli.ts4
2 files changed, 7 insertions, 6 deletions
diff --git a/src/headless/merchant.ts b/src/headless/merchant.ts
index 6a2d0ad2e..1da5d5f03 100644
--- a/src/headless/merchant.ts
+++ b/src/headless/merchant.ts
@@ -23,7 +23,7 @@
* Imports.
*/
import axios from "axios";
-import { CheckPaymentResponse } from "../types/talerTypes";
+import { CheckPaymentResponse, codecForCheckPaymentResponse } from "../types/talerTypes";
/**
* Connection to the *internal* merchant backend.
@@ -96,8 +96,8 @@ export class MerchantBackendConnection {
amount,
summary,
fulfillment_url: fulfillmentUrl,
- refund_deadline: `/Date(${t})/`,
- wire_transfer_deadline: `/Date(${t})/`,
+ refund_deadline: { t_ms: t * 1000 },
+ wire_transfer_deadline: { t_ms: t * 1000 },
},
};
const resp = await axios({
@@ -133,6 +133,7 @@ export class MerchantBackendConnection {
if (resp.status != 200) {
throw Error("failed to check payment");
}
- return CheckPaymentResponse.checked(resp.data);
+
+ return codecForCheckPaymentResponse().decode(resp.data);
}
}
diff --git a/src/headless/taler-wallet-cli.ts b/src/headless/taler-wallet-cli.ts
index 610990ae4..12f729be4 100644
--- a/src/headless/taler-wallet-cli.ts
+++ b/src/headless/taler-wallet-cli.ts
@@ -50,7 +50,7 @@ async function doPay(
return;
}
if (result.status === "insufficient-balance") {
- console.log("contract", result.contractTerms!);
+ console.log("contract", result.contractTermsRaw);
console.error("insufficient balance");
process.exit(1);
return;
@@ -65,7 +65,7 @@ async function doPay(
} else {
throw Error("not reached");
}
- console.log("contract", result.contractTerms!);
+ console.log("contract", result.contractTermsRaw);
let pay;
if (options.alwaysYes) {
pay = true;