wallet-core: rename p2p requests to something more sensible

This commit is contained in:
Florian Dold 2023-02-20 01:16:31 +01:00
parent 30b3949d2b
commit 1747d3ac18
No known key found for this signature in database
GPG Key ID: D2E4F00F29D02A4B
6 changed files with 141 additions and 110 deletions

View File

@ -71,7 +71,7 @@ export async function runAgeRestrictionsPeerTest(t: GlobalTestState) {
); );
const initResp = await wallet.client.call( const initResp = await wallet.client.call(
WalletApiOperation.InitiatePeerPushPayment, WalletApiOperation.InitiatePeerPushDebit,
{ {
partialContractTerms: { partialContractTerms: {
summary: "Hello, World", summary: "Hello, World",
@ -84,13 +84,13 @@ export async function runAgeRestrictionsPeerTest(t: GlobalTestState) {
await wallet.runUntilDone(); await wallet.runUntilDone();
const checkResp = await walletTwo.client.call( const checkResp = await walletTwo.client.call(
WalletApiOperation.CheckPeerPushPayment, WalletApiOperation.PreparePeerPushCredit,
{ {
talerUri: initResp.talerUri, talerUri: initResp.talerUri,
}, },
); );
await walletTwo.client.call(WalletApiOperation.AcceptPeerPushPayment, { await walletTwo.client.call(WalletApiOperation.ConfirmPeerPushCredit, {
peerPushPaymentIncomingId: checkResp.peerPushPaymentIncomingId, peerPushPaymentIncomingId: checkResp.peerPushPaymentIncomingId,
}); });

View File

@ -53,7 +53,7 @@ export async function runPeerToPeerPullTest(t: GlobalTestState) {
); );
const resp = await wallet1.client.call( const resp = await wallet1.client.call(
WalletApiOperation.InitiatePeerPullPayment, WalletApiOperation.InitiatePeerPullCredit,
{ {
exchangeBaseUrl: exchange.baseUrl, exchangeBaseUrl: exchange.baseUrl,
partialContractTerms: { partialContractTerms: {
@ -69,7 +69,7 @@ export async function runPeerToPeerPullTest(t: GlobalTestState) {
await wallet1.runPending(); await wallet1.runPending();
const checkResp = await wallet2.client.call( const checkResp = await wallet2.client.call(
WalletApiOperation.CheckPeerPullPayment, WalletApiOperation.PreparePeerPullDebit,
{ {
talerUri: resp.talerUri, talerUri: resp.talerUri,
}, },
@ -78,7 +78,7 @@ export async function runPeerToPeerPullTest(t: GlobalTestState) {
console.log(`checkResp: ${j2s(checkResp)}`); console.log(`checkResp: ${j2s(checkResp)}`);
const acceptResp = await wallet2.client.call( const acceptResp = await wallet2.client.call(
WalletApiOperation.AcceptPeerPullPayment, WalletApiOperation.ConfirmPeerPullDebit,
{ {
peerPullPaymentIncomingId: checkResp.peerPullPaymentIncomingId, peerPullPaymentIncomingId: checkResp.peerPullPaymentIncomingId,
}, },

View File

@ -56,7 +56,7 @@ export async function runPeerToPeerPushTest(t: GlobalTestState) {
{ {
const resp = await wallet1.client.call( const resp = await wallet1.client.call(
WalletApiOperation.InitiatePeerPushPayment, WalletApiOperation.InitiatePeerPushDebit,
{ {
partialContractTerms: { partialContractTerms: {
summary: "Hello World 😁😇", summary: "Hello World 😁😇",
@ -69,7 +69,7 @@ export async function runPeerToPeerPushTest(t: GlobalTestState) {
console.log(resp); console.log(resp);
} }
const resp = await wallet1.client.call( const resp = await wallet1.client.call(
WalletApiOperation.InitiatePeerPushPayment, WalletApiOperation.InitiatePeerPushDebit,
{ {
partialContractTerms: { partialContractTerms: {
summary: "Hello World 🥺", summary: "Hello World 🥺",
@ -82,7 +82,7 @@ export async function runPeerToPeerPushTest(t: GlobalTestState) {
console.log(resp); console.log(resp);
const checkResp = await wallet2.client.call( const checkResp = await wallet2.client.call(
WalletApiOperation.CheckPeerPushPayment, WalletApiOperation.PreparePeerPushCredit,
{ {
talerUri: resp.talerUri, talerUri: resp.talerUri,
}, },
@ -91,7 +91,7 @@ export async function runPeerToPeerPushTest(t: GlobalTestState) {
console.log(checkResp); console.log(checkResp);
const acceptResp = await wallet2.client.call( const acceptResp = await wallet2.client.call(
WalletApiOperation.AcceptPeerPushPayment, WalletApiOperation.ConfirmPeerPushCredit,
{ {
peerPushPaymentIncomingId: checkResp.peerPushPaymentIncomingId, peerPushPaymentIncomingId: checkResp.peerPushPaymentIncomingId,
}, },
@ -115,7 +115,7 @@ export async function runPeerToPeerPushTest(t: GlobalTestState) {
console.log(`txn2: ${j2s(txn2)}`); console.log(`txn2: ${j2s(txn2)}`);
const ex1 = await t.assertThrowsTalerErrorAsync(async () => { const ex1 = await t.assertThrowsTalerErrorAsync(async () => {
await wallet1.client.call(WalletApiOperation.InitiatePeerPushPayment, { await wallet1.client.call(WalletApiOperation.InitiatePeerPushDebit, {
partialContractTerms: { partialContractTerms: {
summary: "(this will fail)", summary: "(this will fail)",
amount: "TESTKUDOS:15", amount: "TESTKUDOS:15",

View File

@ -925,13 +925,32 @@ depositCli
}); });
}); });
const advancedCli = walletCli.subcommand("advancedArgs", "advanced", { const peerCli = walletCli.subcommand("peerArgs", "p2p", {
help: "Subcommands for advanced operations (only use if you know what you're doing!).", help: "Subcommands for peer-to-peer payments.",
}); });
advancedCli peerCli
.subcommand("checkPayPull", "check-pay-pull", { .subcommand("checkPayPush", "check-push-debit", {
help: "Check fees for a peer-pull payment initiation.", help: "Check fees for starting a peer-push debit transaction.",
})
.requiredArgument("amount", clk.STRING, {
help: "Amount to pay",
})
.action(async (args) => {
await withWallet(args, async (wallet) => {
const resp = await wallet.client.call(
WalletApiOperation.CheckPeerPushDebit,
{
amount: args.checkPayPush.amount,
},
);
console.log(JSON.stringify(resp, undefined, 2));
});
});
peerCli
.subcommand("checkPayPull", "check-pull-credit", {
help: "Check fees for a starting peer-pull credit transaction.",
}) })
.requiredArgument("amount", clk.STRING, { .requiredArgument("amount", clk.STRING, {
help: "Amount to request", help: "Amount to request",
@ -939,7 +958,7 @@ advancedCli
.action(async (args) => { .action(async (args) => {
await withWallet(args, async (wallet) => { await withWallet(args, async (wallet) => {
const resp = await wallet.client.call( const resp = await wallet.client.call(
WalletApiOperation.PreparePeerPullPayment, WalletApiOperation.CheckPeerPullCredit,
{ {
amount: args.checkPayPull.amount, amount: args.checkPayPull.amount,
}, },
@ -948,13 +967,13 @@ advancedCli
}); });
}); });
advancedCli peerCli
.subcommand("prepareIncomingPayPull", "prepare-incoming-pay-pull") .subcommand("prepareIncomingPayPull", "prepare-pull-debit")
.requiredArgument("talerUri", clk.STRING) .requiredArgument("talerUri", clk.STRING)
.action(async (args) => { .action(async (args) => {
await withWallet(args, async (wallet) => { await withWallet(args, async (wallet) => {
const resp = await wallet.client.call( const resp = await wallet.client.call(
WalletApiOperation.CheckPeerPullPayment, WalletApiOperation.PreparePeerPullDebit,
{ {
talerUri: args.prepareIncomingPayPull.talerUri, talerUri: args.prepareIncomingPayPull.talerUri,
}, },
@ -963,13 +982,13 @@ advancedCli
}); });
}); });
advancedCli peerCli
.subcommand("confirmIncomingPayPull", "confirm-incoming-pay-pull") .subcommand("confirmIncomingPayPull", "confirm-pull-debit")
.requiredArgument("peerPullPaymentIncomingId", clk.STRING) .requiredArgument("peerPullPaymentIncomingId", clk.STRING)
.action(async (args) => { .action(async (args) => {
await withWallet(args, async (wallet) => { await withWallet(args, async (wallet) => {
const resp = await wallet.client.call( const resp = await wallet.client.call(
WalletApiOperation.AcceptPeerPullPayment, WalletApiOperation.ConfirmPeerPullDebit,
{ {
peerPullPaymentIncomingId: peerPullPaymentIncomingId:
args.confirmIncomingPayPull.peerPullPaymentIncomingId, args.confirmIncomingPayPull.peerPullPaymentIncomingId,
@ -979,8 +998,24 @@ advancedCli
}); });
}); });
advancedCli peerCli
.subcommand("initiatePayPull", "initiate-pay-pull", { .subcommand("confirmIncomingPayPush", "confirm-push-credit")
.requiredArgument("peerPushPaymentIncomingId", clk.STRING)
.action(async (args) => {
await withWallet(args, async (wallet) => {
const resp = await wallet.client.call(
WalletApiOperation.ConfirmPeerPushCredit,
{
peerPushPaymentIncomingId:
args.confirmIncomingPayPush.peerPushPaymentIncomingId,
},
);
console.log(JSON.stringify(resp, undefined, 2));
});
});
peerCli
.subcommand("initiatePayPull", "initiate-pull-credit", {
help: "Initiate a peer-pull payment.", help: "Initiate a peer-pull payment.",
}) })
.requiredArgument("amount", clk.STRING, { .requiredArgument("amount", clk.STRING, {
@ -993,7 +1028,7 @@ advancedCli
.action(async (args) => { .action(async (args) => {
await withWallet(args, async (wallet) => { await withWallet(args, async (wallet) => {
const resp = await wallet.client.call( const resp = await wallet.client.call(
WalletApiOperation.InitiatePeerPullPayment, WalletApiOperation.InitiatePeerPullCredit,
{ {
exchangeBaseUrl: args.initiatePayPull.exchangeBaseUrl, exchangeBaseUrl: args.initiatePayPull.exchangeBaseUrl,
partialContractTerms: { partialContractTerms: {
@ -1013,27 +1048,23 @@ advancedCli
}); });
}); });
advancedCli peerCli
.subcommand("checkPayPush", "check-pay-push", { .subcommand("preparePushCredit", "prepare-push-credit")
help: "Check fees for a peer-push payment.", .requiredArgument("talerUri", clk.STRING)
})
.requiredArgument("amount", clk.STRING, {
help: "Amount to pay",
})
.action(async (args) => { .action(async (args) => {
await withWallet(args, async (wallet) => { await withWallet(args, async (wallet) => {
const resp = await wallet.client.call( const resp = await wallet.client.call(
WalletApiOperation.PreparePeerPushPayment, WalletApiOperation.PreparePeerPushCredit,
{ {
amount: args.checkPayPush.amount, talerUri: args.preparePushCredit.talerUri,
}, },
); );
console.log(JSON.stringify(resp, undefined, 2)); console.log(JSON.stringify(resp, undefined, 2));
}); });
}); });
advancedCli peerCli
.subcommand("payPush", "initiate-pay-push", { .subcommand("payPush", "initiate-push-debit", {
help: "Initiate a peer-push payment.", help: "Initiate a peer-push payment.",
}) })
.requiredArgument("amount", clk.STRING, { .requiredArgument("amount", clk.STRING, {
@ -1045,7 +1076,7 @@ advancedCli
.action(async (args) => { .action(async (args) => {
await withWallet(args, async (wallet) => { await withWallet(args, async (wallet) => {
const resp = await wallet.client.call( const resp = await wallet.client.call(
WalletApiOperation.InitiatePeerPushPayment, WalletApiOperation.InitiatePeerPushDebit,
{ {
partialContractTerms: { partialContractTerms: {
amount: args.payPush.amount, amount: args.payPush.amount,
@ -1064,6 +1095,10 @@ advancedCli
}); });
}); });
const advancedCli = walletCli.subcommand("advancedArgs", "advanced", {
help: "Subcommands for advanced operations (only use if you know what you're doing!).",
});
advancedCli advancedCli
.subcommand("serve", "serve", { .subcommand("serve", "serve", {
help: "Serve the wallet API via a unix domain socket.", help: "Serve the wallet API via a unix domain socket.",

View File

@ -29,8 +29,8 @@ import {
AcceptExchangeTosRequest, AcceptExchangeTosRequest,
AcceptManualWithdrawalRequest, AcceptManualWithdrawalRequest,
AcceptManualWithdrawalResult, AcceptManualWithdrawalResult,
AcceptPeerPullPaymentRequest, AcceptPeerPullPaymentRequest as ConfirmPeerPullDebitRequest,
AcceptPeerPushPaymentRequest, AcceptPeerPushPaymentRequest as ConfirmPeerPushCreditRequest,
AcceptTipRequest, AcceptTipRequest,
AcceptTipResponse, AcceptTipResponse,
AcceptWithdrawalResponse, AcceptWithdrawalResponse,
@ -42,8 +42,8 @@ import {
ApplyRefundResponse, ApplyRefundResponse,
BackupRecovery, BackupRecovery,
BalancesResponse, BalancesResponse,
CheckPeerPullPaymentRequest, CheckPeerPullPaymentRequest as PreparePeerPullDebitRequest,
CheckPeerPullPaymentResponse, CheckPeerPullPaymentResponse as PreparePeerPullDebitResponse,
CheckPeerPushPaymentRequest, CheckPeerPushPaymentRequest,
CheckPeerPushPaymentResponse, CheckPeerPushPaymentResponse,
CoinDumpJson, CoinDumpJson,
@ -64,8 +64,8 @@ import {
GetFeeForDepositRequest, GetFeeForDepositRequest,
GetWithdrawalDetailsForAmountRequest, GetWithdrawalDetailsForAmountRequest,
GetWithdrawalDetailsForUriRequest, GetWithdrawalDetailsForUriRequest,
InitiatePeerPullPaymentRequest, InitiatePeerPullPaymentRequest as InitiatePeerPullCreditRequest,
InitiatePeerPullPaymentResponse, InitiatePeerPullPaymentResponse as InitiatePeerPullCreditResponse,
InitiatePeerPushPaymentRequest, InitiatePeerPushPaymentRequest,
InitiatePeerPushPaymentResponse, InitiatePeerPushPaymentResponse,
InitRequest, InitRequest,
@ -79,10 +79,10 @@ import {
PreparePayRequest, PreparePayRequest,
PreparePayResult, PreparePayResult,
PreparePayTemplateRequest, PreparePayTemplateRequest,
PreparePeerPullPaymentRequest, PreparePeerPullPaymentRequest as CheckPeerPullCreditRequest,
PreparePeerPullPaymentResponse, PreparePeerPullPaymentResponse as CheckPeerPullCreditResponse,
PreparePeerPushPaymentRequest, PreparePeerPushPaymentRequest as CheckPeerPushDebitRequest,
PreparePeerPushPaymentResponse, PreparePeerPushPaymentResponse as CheckPeerPushDebitResponse,
PrepareRefundRequest, PrepareRefundRequest,
PrepareRefundResult, PrepareRefundResult,
PrepareTipRequest, PrepareTipRequest,
@ -183,14 +183,22 @@ export enum WalletApiOperation {
WithdrawFakebank = "withdrawFakebank", WithdrawFakebank = "withdrawFakebank",
ImportDb = "importDb", ImportDb = "importDb",
ExportDb = "exportDb", ExportDb = "exportDb",
PreparePeerPushPayment = "preparePeerPushPayment", // FIXME: Also rename enum value
InitiatePeerPushPayment = "initiatePeerPushPayment", CheckPeerPushDebit = "preparePeerPushPayment",
CheckPeerPushPayment = "checkPeerPushPayment", // FIXME: Also rename enum value
AcceptPeerPushPayment = "acceptPeerPushPayment", InitiatePeerPushDebit = "initiatePeerPushPayment",
PreparePeerPullPayment = "preparePeerPullPayment", // FIXME: Also rename enum value
InitiatePeerPullPayment = "initiatePeerPullPayment", PreparePeerPushCredit = "checkPeerPushPayment",
CheckPeerPullPayment = "checkPeerPullPayment", // FIXME: Also rename enum value
AcceptPeerPullPayment = "acceptPeerPullPayment", 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", ClearDb = "clearDb",
Recycle = "recycle", Recycle = "recycle",
SetDevMode = "setDevMode", SetDevMode = "setDevMode",
@ -593,85 +601,73 @@ export type ExportBackupPlainOp = {
/** /**
* Check if initiating a peer push payment is possible * Check if initiating a peer push payment is possible
* based on the funds in the wallet. * based on the funds in the wallet.
*
* FIXME: Rename to CheckPeerPushPaymentInitiation
*/ */
export type PreparePeerPushPaymentOp = { export type CheckPeerPushDebitOp = {
op: WalletApiOperation.PreparePeerPushPayment; op: WalletApiOperation.CheckPeerPushDebit;
request: PreparePeerPushPaymentRequest; request: CheckPeerPushDebitRequest;
response: PreparePeerPushPaymentResponse; response: CheckPeerPushDebitResponse;
}; };
/** /**
* Initiate an outgoing peer push payment. * Initiate an outgoing peer push payment.
*/ */
export type InitiatePeerPushPaymentOp = { export type InitiatePeerPushDebitOp = {
op: WalletApiOperation.InitiatePeerPushPayment; op: WalletApiOperation.InitiatePeerPushDebit;
request: InitiatePeerPushPaymentRequest; request: InitiatePeerPushPaymentRequest;
response: InitiatePeerPushPaymentResponse; response: InitiatePeerPushPaymentResponse;
}; };
/** /**
* Check an incoming peer push payment. * Check an incoming peer push payment.
*
* FIXME: Rename to "PrepareIncomingPeerPushPayment"
*/ */
export type CheckPeerPushPaymentOp = { export type PreparePeerPushCreditOp = {
op: WalletApiOperation.CheckPeerPushPayment; op: WalletApiOperation.PreparePeerPushCredit;
request: CheckPeerPushPaymentRequest; request: CheckPeerPushPaymentRequest;
response: CheckPeerPushPaymentResponse; response: CheckPeerPushPaymentResponse;
}; };
/** /**
* Accept an incoming peer push payment. * Accept an incoming peer push payment.
*
* FIXME: Rename to ConfirmIncomingPeerPushPayment
*/ */
export type AcceptPeerPushPaymentOp = { export type ConfirmPeerPushCreditOp = {
op: WalletApiOperation.AcceptPeerPushPayment; op: WalletApiOperation.ConfirmPeerPushCredit;
request: AcceptPeerPushPaymentRequest; request: ConfirmPeerPushCreditRequest;
response: EmptyObject; response: EmptyObject;
}; };
/** /**
* Initiate an outgoing peer pull payment. * Check fees for an outgoing peer pull payment.
*
* FIXME: This does not check anything, so rename to CheckPeerPullPaymentInitiation
*/ */
export type PreparePeerPullPaymentOp = { export type CheckPeerPullCreditOp = {
op: WalletApiOperation.PreparePeerPullPayment; op: WalletApiOperation.CheckPeerPullCredit;
request: PreparePeerPullPaymentRequest; request: CheckPeerPullCreditRequest;
response: PreparePeerPullPaymentResponse; response: CheckPeerPullCreditResponse;
}; };
/** /**
* Initiate an outgoing peer pull payment. * Initiate an outgoing peer pull payment.
*/ */
export type InitiatePeerPullPaymentOp = { export type InitiatePeerPullCreditOp = {
op: WalletApiOperation.InitiatePeerPullPayment; op: WalletApiOperation.InitiatePeerPullCredit;
request: InitiatePeerPullPaymentRequest; request: InitiatePeerPullCreditRequest;
response: InitiatePeerPullPaymentResponse; response: InitiatePeerPullCreditResponse;
}; };
/** /**
* Prepare for an incoming peer pull payment. * Prepare for an incoming peer pull payment.
*
* FIXME: Rename to "PrepareIncomingPeerPullPayment"
*/ */
export type CheckPeerPullPaymentOp = { export type PreparePeerPullDebitOp = {
op: WalletApiOperation.CheckPeerPullPayment; op: WalletApiOperation.PreparePeerPullDebit;
request: CheckPeerPullPaymentRequest; request: PreparePeerPullDebitRequest;
response: CheckPeerPullPaymentResponse; response: PreparePeerPullDebitResponse;
}; };
/** /**
* Accept an incoming peer pull payment (i.e. pay the other party). * Accept an incoming peer pull payment (i.e. pay the other party).
*
* FIXME: Rename to ConfirmIncomingPeerPullPayment
*/ */
export type AcceptPeerPullPaymentOp = { export type ConfirmPeerPullDebitOp = {
op: WalletApiOperation.AcceptPeerPullPayment; op: WalletApiOperation.ConfirmPeerPullDebit;
request: AcceptPeerPullPaymentRequest; request: ConfirmPeerPullDebitRequest;
response: EmptyObject; response: EmptyObject;
}; };
@ -915,14 +911,14 @@ export type WalletOperations = {
[WalletApiOperation.TestPay]: TestPayOp; [WalletApiOperation.TestPay]: TestPayOp;
[WalletApiOperation.ExportDb]: ExportDbOp; [WalletApiOperation.ExportDb]: ExportDbOp;
[WalletApiOperation.ImportDb]: ImportDbOp; [WalletApiOperation.ImportDb]: ImportDbOp;
[WalletApiOperation.PreparePeerPushPayment]: PreparePeerPushPaymentOp; [WalletApiOperation.CheckPeerPushDebit]: CheckPeerPushDebitOp;
[WalletApiOperation.InitiatePeerPushPayment]: InitiatePeerPushPaymentOp; [WalletApiOperation.InitiatePeerPushDebit]: InitiatePeerPushDebitOp;
[WalletApiOperation.CheckPeerPushPayment]: CheckPeerPushPaymentOp; [WalletApiOperation.PreparePeerPushCredit]: PreparePeerPushCreditOp;
[WalletApiOperation.AcceptPeerPushPayment]: AcceptPeerPushPaymentOp; [WalletApiOperation.ConfirmPeerPushCredit]: ConfirmPeerPushCreditOp;
[WalletApiOperation.PreparePeerPullPayment]: PreparePeerPullPaymentOp; [WalletApiOperation.CheckPeerPullCredit]: CheckPeerPullCreditOp;
[WalletApiOperation.InitiatePeerPullPayment]: InitiatePeerPullPaymentOp; [WalletApiOperation.InitiatePeerPullCredit]: InitiatePeerPullCreditOp;
[WalletApiOperation.CheckPeerPullPayment]: CheckPeerPullPaymentOp; [WalletApiOperation.PreparePeerPullDebit]: PreparePeerPullDebitOp;
[WalletApiOperation.AcceptPeerPullPayment]: AcceptPeerPullPaymentOp; [WalletApiOperation.ConfirmPeerPullDebit]: ConfirmPeerPullDebitOp;
[WalletApiOperation.ClearDb]: ClearDbOp; [WalletApiOperation.ClearDb]: ClearDbOp;
[WalletApiOperation.Recycle]: RecycleOp; [WalletApiOperation.Recycle]: RecycleOp;
[WalletApiOperation.ApplyDevExperiment]: ApplyDevExperimentOp; [WalletApiOperation.ApplyDevExperiment]: ApplyDevExperimentOp;

View File

@ -1432,31 +1432,31 @@ async function dispatchRequestInternal<Op extends WalletApiOperation>(
const req = codecForPreparePeerPushPaymentRequest().decode(payload); const req = codecForPreparePeerPushPaymentRequest().decode(payload);
return await preparePeerPushPayment(ws, req); return await preparePeerPushPayment(ws, req);
} }
case WalletApiOperation.InitiatePeerPushPayment: { case WalletApiOperation.InitiatePeerPushDebit: {
const req = codecForInitiatePeerPushPaymentRequest().decode(payload); const req = codecForInitiatePeerPushPaymentRequest().decode(payload);
return await initiatePeerPushPayment(ws, req); return await initiatePeerPushPayment(ws, req);
} }
case WalletApiOperation.CheckPeerPushPayment: { case WalletApiOperation.PreparePeerPushCredit: {
const req = codecForCheckPeerPushPaymentRequest().decode(payload); const req = codecForCheckPeerPushPaymentRequest().decode(payload);
return await preparePeerPushCredit(ws, req); return await preparePeerPushCredit(ws, req);
} }
case WalletApiOperation.AcceptPeerPushPayment: { case WalletApiOperation.ConfirmPeerPushCredit: {
const req = codecForAcceptPeerPushPaymentRequest().decode(payload); const req = codecForAcceptPeerPushPaymentRequest().decode(payload);
return await acceptPeerPushPayment(ws, req); return await acceptPeerPushPayment(ws, req);
} }
case WalletApiOperation.PreparePeerPullPayment: { case WalletApiOperation.CheckPeerPullCredit: {
const req = codecForPreparePeerPullPaymentRequest().decode(payload); const req = codecForPreparePeerPullPaymentRequest().decode(payload);
return await checkPeerPullPaymentInitiation(ws, req); return await checkPeerPullPaymentInitiation(ws, req);
} }
case WalletApiOperation.InitiatePeerPullPayment: { case WalletApiOperation.InitiatePeerPullCredit: {
const req = codecForInitiatePeerPullPaymentRequest().decode(payload); const req = codecForInitiatePeerPullPaymentRequest().decode(payload);
return await initiatePeerPullPayment(ws, req); return await initiatePeerPullPayment(ws, req);
} }
case WalletApiOperation.CheckPeerPullPayment: { case WalletApiOperation.PreparePeerPullDebit: {
const req = codecForCheckPeerPullPaymentRequest().decode(payload); const req = codecForCheckPeerPullPaymentRequest().decode(payload);
return await preparePeerPullCredit(ws, req); return await preparePeerPullCredit(ws, req);
} }
case WalletApiOperation.AcceptPeerPullPayment: { case WalletApiOperation.ConfirmPeerPullDebit: {
const req = codecForAcceptPeerPullPaymentRequest().decode(payload); const req = codecForAcceptPeerPullPaymentRequest().decode(payload);
return await acceptIncomingPeerPullPayment(ws, req); return await acceptIncomingPeerPullPayment(ws, req);
} }