aboutsummaryrefslogtreecommitdiff
path: root/src/wallet.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2018-01-04 13:22:23 +0100
committerFlorian Dold <florian.dold@gmail.com>2018-01-04 13:22:23 +0100
commit09c7be80fd53318c9d3287b9952d70714d415e21 (patch)
tree7e4757c5cb710548a054e2c320949f3eb8d9397a /src/wallet.ts
parent202d51c6a2aea6c24af00605dd76b4fc37e42630 (diff)
downloadwallet-core-09c7be80fd53318c9d3287b9952d70714d415e21.tar.xz
fix /pay API
Diffstat (limited to 'src/wallet.ts')
-rw-r--r--src/wallet.ts10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/wallet.ts b/src/wallet.ts
index b3ef3bf31..8a63e45e2 100644
--- a/src/wallet.ts
+++ b/src/wallet.ts
@@ -629,8 +629,8 @@ export class Wallet {
chosenExchange: string): Promise<void> {
const payReq: PayReq = {
coins: payCoinInfo.sigs,
- exchange: chosenExchange,
merchant_pub: proposal.contractTerms.merchant_pub,
+ mode: "pay",
order_id: proposal.contractTerms.order_id,
};
const t: PurchaseRecord = {
@@ -1693,7 +1693,9 @@ export class Wallet {
if (t.finished) {
return balance;
}
- addTo(balance, "pendingIncoming", t.contractTerms.amount, t.payReq.exchange);
+ for (const c of t.payReq.coins) {
+ addTo(balance, "pendingIncoming", c.contribution, c.exchange_url);
+ }
return balance;
}
@@ -2526,7 +2528,9 @@ export class Wallet {
for (const pk of pendingKeys) {
const perm = purchase.refundsPending[pk];
console.log("sending refund permission", perm);
- const reqUrl = (new URI("refund")).absoluteTo(purchase.payReq.exchange);
+ // FIXME: not correct once we support multiple exchanges per payment
+ const exchangeUrl = purchase.payReq.coins[0].exchange_url;
+ const reqUrl = (new URI("refund")).absoluteTo(exchangeUrl);
const resp = await this.http.postJson(reqUrl.href(), perm);
if (resp.status !== 200) {
console.error("refund failed", resp);