aboutsummaryrefslogtreecommitdiff
path: root/src/wallet.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2018-01-18 02:50:18 +0100
committerFlorian Dold <florian.dold@gmail.com>2018-01-18 02:50:18 +0100
commit2f68e9e50e83c55ca46e9d4d72956d6525d0fa8c (patch)
treebfe94c2e0af1f3777765d37b35eeb76ed4e221be /src/wallet.ts
parent82d9c2a7cd2e343866997438d44aa5422190a028 (diff)
fix handling of resource_url
Diffstat (limited to 'src/wallet.ts')
-rw-r--r--src/wallet.ts14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/wallet.ts b/src/wallet.ts
index aa974369a..7c2914926 100644
--- a/src/wallet.ts
+++ b/src/wallet.ts
@@ -96,6 +96,7 @@ import {
CreateReserveRequest,
CreateReserveResponse,
HistoryRecord,
+ NextUrlResult,
Notifier,
PayCoinInfo,
QueryPaymentResult,
@@ -312,7 +313,7 @@ export class Wallet {
private processPreCoinThrottle: {[url: string]: number} = {};
private timerGroup: TimerGroup;
private speculativePayData: SpeculativePayData | undefined;
- private cachedNextUrl: { [fulfillmentUrl: string]: string } = {};
+ private cachedNextUrl: { [fulfillmentUrl: string]: NextUrlResult } = {};
/**
* Set of identifiers for running operations.
@@ -652,6 +653,7 @@ export class Wallet {
contractTermsHash: proposal.contractTermsHash,
finished: false,
lastSessionSig: undefined,
+ lastSessionId: undefined,
merchantSig: proposal.merchantSig,
payReq,
refundsDone: {},
@@ -735,14 +737,14 @@ export class Wallet {
const fu = new URI(purchase.contractTerms.fulfillment_url);
fu.addSearch("order_id", purchase.contractTerms.order_id);
if (merchantResp.session_sig) {
- fu.addSearch("session_sig", merchantResp.session_sig);
purchase.lastSessionSig = merchantResp.session_sig;
- console.log("updating session sig", purchase);
+ purchase.lastSessionId = sessionId;
+ fu.addSearch("session_sig", merchantResp.session_sig);
await this.q().put(Stores.purchases, purchase).finish();
}
await this.paymentSucceeded(purchase.contractTermsHash, merchantResp.sig);
const nextUrl = fu.href();
- this.cachedNextUrl[purchase.contractTerms.fulfillment_url] = nextUrl;
+ this.cachedNextUrl[purchase.contractTerms.fulfillment_url] = { nextUrl, lastSessionId: sessionId };
return { nextUrl };
}
@@ -899,6 +901,7 @@ export class Wallet {
contractTerms: t.contractTerms,
contractTermsHash: t.contractTermsHash,
found: true,
+ lastSessionId: t.lastSessionId,
lastSessionSig: t.lastSessionSig,
payReq: t.payReq,
};
@@ -925,6 +928,7 @@ export class Wallet {
contractTermsHash: t.contractTermsHash,
found: true,
lastSessionSig: t.lastSessionSig,
+ lastSessionId: t.lastSessionId,
payReq: t.payReq,
};
}
@@ -2891,7 +2895,7 @@ export class Wallet {
* payed for, or if it is not cached anymore. Use the asynchronous
* queryPaymentByFulfillmentUrl to avoid false negatives.
*/
- getNextUrlFromResourceUrl(resourceUrl: string): string | undefined {
+ getNextUrlFromResourceUrl(resourceUrl: string): NextUrlResult | undefined {
return this.cachedNextUrl[resourceUrl];
}