diff options
Diffstat (limited to 'packages/taler-wallet-core')
-rw-r--r-- | packages/taler-wallet-core/src/wallet-api-types.ts | 126 | ||||
-rw-r--r-- | packages/taler-wallet-core/src/wallet.ts | 14 |
2 files changed, 68 insertions, 72 deletions
diff --git a/packages/taler-wallet-core/src/wallet-api-types.ts b/packages/taler-wallet-core/src/wallet-api-types.ts index 093a1b15c..f1d1441d6 100644 --- a/packages/taler-wallet-core/src/wallet-api-types.ts +++ b/packages/taler-wallet-core/src/wallet-api-types.ts @@ -29,8 +29,8 @@ import { AcceptExchangeTosRequest, AcceptManualWithdrawalRequest, AcceptManualWithdrawalResult, - AcceptPeerPullPaymentRequest, - AcceptPeerPushPaymentRequest, + AcceptPeerPullPaymentRequest as ConfirmPeerPullDebitRequest, + AcceptPeerPushPaymentRequest as ConfirmPeerPushCreditRequest, AcceptTipRequest, AcceptTipResponse, AcceptWithdrawalResponse, @@ -42,8 +42,8 @@ import { ApplyRefundResponse, BackupRecovery, BalancesResponse, - CheckPeerPullPaymentRequest, - CheckPeerPullPaymentResponse, + CheckPeerPullPaymentRequest as PreparePeerPullDebitRequest, + CheckPeerPullPaymentResponse as PreparePeerPullDebitResponse, CheckPeerPushPaymentRequest, CheckPeerPushPaymentResponse, CoinDumpJson, @@ -64,8 +64,8 @@ import { GetFeeForDepositRequest, GetWithdrawalDetailsForAmountRequest, GetWithdrawalDetailsForUriRequest, - InitiatePeerPullPaymentRequest, - InitiatePeerPullPaymentResponse, + InitiatePeerPullPaymentRequest as InitiatePeerPullCreditRequest, + InitiatePeerPullPaymentResponse as InitiatePeerPullCreditResponse, InitiatePeerPushPaymentRequest, InitiatePeerPushPaymentResponse, InitRequest, @@ -79,10 +79,10 @@ import { PreparePayRequest, PreparePayResult, PreparePayTemplateRequest, - PreparePeerPullPaymentRequest, - PreparePeerPullPaymentResponse, - PreparePeerPushPaymentRequest, - PreparePeerPushPaymentResponse, + PreparePeerPullPaymentRequest as CheckPeerPullCreditRequest, + PreparePeerPullPaymentResponse as CheckPeerPullCreditResponse, + PreparePeerPushPaymentRequest as CheckPeerPushDebitRequest, + PreparePeerPushPaymentResponse as CheckPeerPushDebitResponse, PrepareRefundRequest, PrepareRefundResult, PrepareTipRequest, @@ -183,14 +183,22 @@ export enum WalletApiOperation { WithdrawFakebank = "withdrawFakebank", ImportDb = "importDb", ExportDb = "exportDb", - PreparePeerPushPayment = "preparePeerPushPayment", - InitiatePeerPushPayment = "initiatePeerPushPayment", - CheckPeerPushPayment = "checkPeerPushPayment", - AcceptPeerPushPayment = "acceptPeerPushPayment", - PreparePeerPullPayment = "preparePeerPullPayment", - InitiatePeerPullPayment = "initiatePeerPullPayment", - CheckPeerPullPayment = "checkPeerPullPayment", - AcceptPeerPullPayment = "acceptPeerPullPayment", + // FIXME: Also rename enum value + CheckPeerPushDebit = "preparePeerPushPayment", + // FIXME: Also rename enum value + InitiatePeerPushDebit = "initiatePeerPushPayment", + // FIXME: Also rename enum value + PreparePeerPushCredit = "checkPeerPushPayment", + // FIXME: Also rename enum value + ConfirmPeerPushCredit = "acceptPeerPushPayment", + // FIXME: Also rename enum value + CheckPeerPullCredit = "preparePeerPullPayment", + // FIXME: Also rename enum value + InitiatePeerPullCredit = "initiatePeerPullPayment", + // FIXME: Also rename enum value + PreparePeerPullDebit = "checkPeerPullPayment", + // FIXME: Also rename enum value + ConfirmPeerPullDebit = "acceptPeerPullPayment", ClearDb = "clearDb", Recycle = "recycle", SetDevMode = "setDevMode", @@ -593,85 +601,73 @@ export type ExportBackupPlainOp = { /** * Check if initiating a peer push payment is possible * based on the funds in the wallet. - * - * FIXME: Rename to CheckPeerPushPaymentInitiation */ -export type PreparePeerPushPaymentOp = { - op: WalletApiOperation.PreparePeerPushPayment; - request: PreparePeerPushPaymentRequest; - response: PreparePeerPushPaymentResponse; +export type CheckPeerPushDebitOp = { + op: WalletApiOperation.CheckPeerPushDebit; + request: CheckPeerPushDebitRequest; + response: CheckPeerPushDebitResponse; }; /** * Initiate an outgoing peer push payment. */ -export type InitiatePeerPushPaymentOp = { - op: WalletApiOperation.InitiatePeerPushPayment; +export type InitiatePeerPushDebitOp = { + op: WalletApiOperation.InitiatePeerPushDebit; request: InitiatePeerPushPaymentRequest; response: InitiatePeerPushPaymentResponse; }; /** * Check an incoming peer push payment. - * - * FIXME: Rename to "PrepareIncomingPeerPushPayment" */ -export type CheckPeerPushPaymentOp = { - op: WalletApiOperation.CheckPeerPushPayment; +export type PreparePeerPushCreditOp = { + op: WalletApiOperation.PreparePeerPushCredit; request: CheckPeerPushPaymentRequest; response: CheckPeerPushPaymentResponse; }; /** * Accept an incoming peer push payment. - * - * FIXME: Rename to ConfirmIncomingPeerPushPayment */ -export type AcceptPeerPushPaymentOp = { - op: WalletApiOperation.AcceptPeerPushPayment; - request: AcceptPeerPushPaymentRequest; +export type ConfirmPeerPushCreditOp = { + op: WalletApiOperation.ConfirmPeerPushCredit; + request: ConfirmPeerPushCreditRequest; response: EmptyObject; }; /** - * Initiate an outgoing peer pull payment. - * - * FIXME: This does not check anything, so rename to CheckPeerPullPaymentInitiation + * Check fees for an outgoing peer pull payment. */ -export type PreparePeerPullPaymentOp = { - op: WalletApiOperation.PreparePeerPullPayment; - request: PreparePeerPullPaymentRequest; - response: PreparePeerPullPaymentResponse; +export type CheckPeerPullCreditOp = { + op: WalletApiOperation.CheckPeerPullCredit; + request: CheckPeerPullCreditRequest; + response: CheckPeerPullCreditResponse; }; /** * Initiate an outgoing peer pull payment. */ -export type InitiatePeerPullPaymentOp = { - op: WalletApiOperation.InitiatePeerPullPayment; - request: InitiatePeerPullPaymentRequest; - response: InitiatePeerPullPaymentResponse; +export type InitiatePeerPullCreditOp = { + op: WalletApiOperation.InitiatePeerPullCredit; + request: InitiatePeerPullCreditRequest; + response: InitiatePeerPullCreditResponse; }; /** * Prepare for an incoming peer pull payment. - * - * FIXME: Rename to "PrepareIncomingPeerPullPayment" */ -export type CheckPeerPullPaymentOp = { - op: WalletApiOperation.CheckPeerPullPayment; - request: CheckPeerPullPaymentRequest; - response: CheckPeerPullPaymentResponse; +export type PreparePeerPullDebitOp = { + op: WalletApiOperation.PreparePeerPullDebit; + request: PreparePeerPullDebitRequest; + response: PreparePeerPullDebitResponse; }; /** * Accept an incoming peer pull payment (i.e. pay the other party). - * - * FIXME: Rename to ConfirmIncomingPeerPullPayment */ -export type AcceptPeerPullPaymentOp = { - op: WalletApiOperation.AcceptPeerPullPayment; - request: AcceptPeerPullPaymentRequest; +export type ConfirmPeerPullDebitOp = { + op: WalletApiOperation.ConfirmPeerPullDebit; + request: ConfirmPeerPullDebitRequest; response: EmptyObject; }; @@ -915,14 +911,14 @@ export type WalletOperations = { [WalletApiOperation.TestPay]: TestPayOp; [WalletApiOperation.ExportDb]: ExportDbOp; [WalletApiOperation.ImportDb]: ImportDbOp; - [WalletApiOperation.PreparePeerPushPayment]: PreparePeerPushPaymentOp; - [WalletApiOperation.InitiatePeerPushPayment]: InitiatePeerPushPaymentOp; - [WalletApiOperation.CheckPeerPushPayment]: CheckPeerPushPaymentOp; - [WalletApiOperation.AcceptPeerPushPayment]: AcceptPeerPushPaymentOp; - [WalletApiOperation.PreparePeerPullPayment]: PreparePeerPullPaymentOp; - [WalletApiOperation.InitiatePeerPullPayment]: InitiatePeerPullPaymentOp; - [WalletApiOperation.CheckPeerPullPayment]: CheckPeerPullPaymentOp; - [WalletApiOperation.AcceptPeerPullPayment]: AcceptPeerPullPaymentOp; + [WalletApiOperation.CheckPeerPushDebit]: CheckPeerPushDebitOp; + [WalletApiOperation.InitiatePeerPushDebit]: InitiatePeerPushDebitOp; + [WalletApiOperation.PreparePeerPushCredit]: PreparePeerPushCreditOp; + [WalletApiOperation.ConfirmPeerPushCredit]: ConfirmPeerPushCreditOp; + [WalletApiOperation.CheckPeerPullCredit]: CheckPeerPullCreditOp; + [WalletApiOperation.InitiatePeerPullCredit]: InitiatePeerPullCreditOp; + [WalletApiOperation.PreparePeerPullDebit]: PreparePeerPullDebitOp; + [WalletApiOperation.ConfirmPeerPullDebit]: ConfirmPeerPullDebitOp; [WalletApiOperation.ClearDb]: ClearDbOp; [WalletApiOperation.Recycle]: RecycleOp; [WalletApiOperation.ApplyDevExperiment]: ApplyDevExperimentOp; diff --git a/packages/taler-wallet-core/src/wallet.ts b/packages/taler-wallet-core/src/wallet.ts index e3a34f0da..ade6493e1 100644 --- a/packages/taler-wallet-core/src/wallet.ts +++ b/packages/taler-wallet-core/src/wallet.ts @@ -1432,31 +1432,31 @@ async function dispatchRequestInternal<Op extends WalletApiOperation>( const req = codecForPreparePeerPushPaymentRequest().decode(payload); return await preparePeerPushPayment(ws, req); } - case WalletApiOperation.InitiatePeerPushPayment: { + case WalletApiOperation.InitiatePeerPushDebit: { const req = codecForInitiatePeerPushPaymentRequest().decode(payload); return await initiatePeerPushPayment(ws, req); } - case WalletApiOperation.CheckPeerPushPayment: { + case WalletApiOperation.PreparePeerPushCredit: { const req = codecForCheckPeerPushPaymentRequest().decode(payload); return await preparePeerPushCredit(ws, req); } - case WalletApiOperation.AcceptPeerPushPayment: { + case WalletApiOperation.ConfirmPeerPushCredit: { const req = codecForAcceptPeerPushPaymentRequest().decode(payload); return await acceptPeerPushPayment(ws, req); } - case WalletApiOperation.PreparePeerPullPayment: { + case WalletApiOperation.CheckPeerPullCredit: { const req = codecForPreparePeerPullPaymentRequest().decode(payload); return await checkPeerPullPaymentInitiation(ws, req); } - case WalletApiOperation.InitiatePeerPullPayment: { + case WalletApiOperation.InitiatePeerPullCredit: { const req = codecForInitiatePeerPullPaymentRequest().decode(payload); return await initiatePeerPullPayment(ws, req); } - case WalletApiOperation.CheckPeerPullPayment: { + case WalletApiOperation.PreparePeerPullDebit: { const req = codecForCheckPeerPullPaymentRequest().decode(payload); return await preparePeerPullCredit(ws, req); } - case WalletApiOperation.AcceptPeerPullPayment: { + case WalletApiOperation.ConfirmPeerPullDebit: { const req = codecForAcceptPeerPullPaymentRequest().decode(payload); return await acceptIncomingPeerPullPayment(ws, req); } |