aboutsummaryrefslogtreecommitdiff
path: root/src/wallet.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2019-08-31 11:49:36 +0200
committerFlorian Dold <florian.dold@gmail.com>2019-08-31 11:49:36 +0200
commit5a7269b20db0371535669c0faa7f1814d967b5ca (patch)
treec757d7b441875b745e3d83e8a543785e7b82fc9b /src/wallet.ts
parent5ec344290efd937fa82c0704bc7c204a0bf14c78 (diff)
downloadwallet-core-5a7269b20db0371535669c0faa7f1814d967b5ca.tar.xz
cli refunds
Diffstat (limited to 'src/wallet.ts')
-rw-r--r--src/wallet.ts17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/wallet.ts b/src/wallet.ts
index fd1be5293..00a82f92c 100644
--- a/src/wallet.ts
+++ b/src/wallet.ts
@@ -109,7 +109,7 @@ import {
AcceptWithdrawalResponse,
} from "./walletTypes";
import { openPromise } from "./promiseUtils";
-import { parsePayUri, parseWithdrawUri, parseTipUri } from "./taleruri";
+import { parsePayUri, parseWithdrawUri, parseTipUri, parseRefundUri } from "./taleruri";
interface SpeculativePayData {
payCoinInfo: PayCoinInfo;
@@ -3109,7 +3109,7 @@ export class Wallet {
}
}
- async acceptRefundResponse(
+ private async acceptRefundResponse(
refundResponse: MerchantRefundResponse,
): Promise<string> {
const refundPermissions = refundResponse.refund_permissions;
@@ -3149,8 +3149,7 @@ export class Wallet {
.finish();
this.notifier.notify();
- // Start submitting it but don't wait for it here.
- this.submitRefunds(hc);
+ await this.submitRefunds(hc);
return hc;
}
@@ -3159,7 +3158,15 @@ export class Wallet {
* Accept a refund, return the contract hash for the contract
* that was involved in the refund.
*/
- async acceptRefund(refundUrl: string): Promise<string> {
+ async applyRefund(talerRefundUri: string): Promise<string> {
+ const parseResult = parseRefundUri(talerRefundUri);
+
+ if (!parseResult) {
+ throw Error("invalid refund URI");
+ }
+
+ const refundUrl = parseResult.refundUrl;
+
Wallet.enableTracing && console.log("processing refund");
let resp;
try {