From 1c3346cd534143f4dd56a625b963a1a3acfa83d1 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 29 May 2017 16:27:53 +0200 Subject: less ad-hoc messaging, fix some lint warnings --- src/webex/wxApi.ts | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'src/webex/wxApi.ts') diff --git a/src/webex/wxApi.ts b/src/webex/wxApi.ts index e5a502406..c120f34e7 100644 --- a/src/webex/wxApi.ts +++ b/src/webex/wxApi.ts @@ -24,10 +24,13 @@ */ import { AmountJson, + CheckPayResult, + ConfirmPayResult, CoinRecord, CurrencyRecord, DenominationRecord, ExchangeRecord, + OfferRecord, PreCoinRecord, ReserveCreationInfo, ReserveRecord, @@ -172,3 +175,26 @@ export async function refresh(coinPub: string): Promise { export async function payback(coinPub: string): Promise { return await callBackend("payback-coin", { coinPub }); } + +/** + * Get an offer stored in the wallet by its offer id. + * Note that the numeric offer id is not to be confused with + * the string order_id from the contract terms. + */ +export async function getOffer(offerId: number) { + return await callBackend("get-offer", { offerId }); +} + +/** + * Check if payment is possible or already done. + */ +export async function checkPay(offer: OfferRecord): Promise { + return await callBackend("check-pay", { offer }); +} + +/** + * Pay for an offer. + */ +export async function confirmPay(offer: OfferRecord): Promise { + return await callBackend("confirm-pay", { offer }); +} -- cgit v1.2.3