From c62ba4986fbfcb8637a3befadf3d3eddbd5348ca Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Wed, 17 Jan 2018 03:49:54 +0100 Subject: implement new mobile-compatible payment logic --- src/webex/wxApi.ts | 63 ++++++++++++++---------------------------------------- 1 file changed, 16 insertions(+), 47 deletions(-) (limited to 'src/webex/wxApi.ts') diff --git a/src/webex/wxApi.ts b/src/webex/wxApi.ts index 2f7a13c48..efebf21d1 100644 --- a/src/webex/wxApi.ts +++ b/src/webex/wxApi.ts @@ -217,8 +217,8 @@ export function checkPay(proposalId: number): Promise { /** * Pay for a proposal. */ -export function confirmPay(proposalId: number): Promise { - return callBackend("confirm-pay", { proposalId }); +export function confirmPay(proposalId: number, sessionId: string | undefined): Promise { + return callBackend("confirm-pay", { proposalId, sessionId }); } /** @@ -228,15 +228,6 @@ export function hashContract(contract: object): Promise { return callBackend("hash-contract", { contract }); } - -/** - * Save a proposal in the wallet. Returns the proposal id that - * the proposal is stored under. - */ -export function saveProposal(proposal: any): Promise { - return callBackend("save-proposal", { proposal }); -} - /** * Mark a reserve as confirmed. */ @@ -251,36 +242,6 @@ export function queryPayment(url: string): Promise { return callBackend("query-payment", { url }); } -/** - * Mark a payment as succeeded. - */ -export function paymentSucceeded(contractTermsHash: string, merchantSig: string): Promise { - return callBackend("payment-succeeded", { contractTermsHash, merchantSig }); -} - -/** - * Mark a payment as succeeded. - */ -export function paymentFailed(contractTermsHash: string): Promise { - return callBackend("payment-failed", { contractTermsHash }); -} - -/** - * Get the payment cookie for the current tab, or undefined if no payment - * cookie was set. - */ -export function getTabCookie(): Promise { - return callBackend("get-tab-cookie", { }); -} - -/** - * Generate a contract nonce (EdDSA key pair), store it in the wallet's - * database and return the public key. - */ -export function generateNonce(): Promise { - return callBackend("generate-nonce", { }); -} - /** * Check upgrade information */ @@ -344,12 +305,6 @@ export function getReport(reportUid: string): Promise { return callBackend("get-report", { reportUid }); } -/** - * Apply a refund that we got from the merchant. - */ -export function acceptRefund(refundData: any): Promise { - return callBackend("accept-refund", refundData); -} /** * Look up a purchase in the wallet database from @@ -407,3 +362,17 @@ export function processTipResponse(merchantDomain: string, tipId: string, tipRes export function clearNotification(): Promise { return callBackend("clear-notification", { }); } + +/** + * Trigger taler payment processing (for payment, tipping and refunds). + */ +export function talerPay(msg: any): Promise { + return callBackend("taler-pay", msg); +} + +/** + * Download a contract. + */ +export function downloadProposal(url: string): Promise { + return callBackend("download-proposal", { url }); +} -- cgit v1.2.3