wallet-core: fix tipping

This commit is contained in:
Florian Dold 2023-09-15 17:04:44 +02:00
parent a15eec55d3
commit 0ff189d229
No known key found for this signature in database
GPG Key ID: D2E4F00F29D02A4B
3 changed files with 10 additions and 4 deletions

View File

@ -269,7 +269,7 @@ export class MerchantApiClient {
} }
async giveTip(req: RewardCreateRequest): Promise<RewardCreateConfirmation> { async giveTip(req: RewardCreateRequest): Promise<RewardCreateConfirmation> {
const reqUrl = new URL(`private/tips`, this.baseUrl); const reqUrl = new URL(`private/rewards`, this.baseUrl);
const resp = await this.httpClient.fetch(reqUrl.href, { const resp = await this.httpClient.fetch(reqUrl.href, {
method: "POST", method: "POST",
body: req, body: req,

View File

@ -276,7 +276,10 @@ export async function depositCoin(args: {
merchant_pub: merchantPub, merchant_pub: merchantPub,
}; };
const url = new URL(`batch-deposit`, dp.exchange_url); const url = new URL(`batch-deposit`, dp.exchange_url);
const httpResp = await http.fetch(url.href, { body: requestBody }); const httpResp = await http.fetch(url.href, {
method: "POST",
body: requestBody,
});
await readSuccessResponseJsonOrThrow(httpResp, codecForBatchDepositSuccess()); await readSuccessResponseJsonOrThrow(httpResp, codecForBatchDepositSuccess());
} }

View File

@ -304,13 +304,16 @@ export async function processTip(
} }
const tipStatusUrl = new URL( const tipStatusUrl = new URL(
`tips/${tipRecord.merchantRewardId}/pickup`, `rewards/${tipRecord.merchantRewardId}/pickup`,
tipRecord.merchantBaseUrl, tipRecord.merchantBaseUrl,
); );
const req = { planchets: planchetsDetail }; const req = { planchets: planchetsDetail };
logger.trace(`sending tip request: ${j2s(req)}`); logger.trace(`sending tip request: ${j2s(req)}`);
const merchantResp = await ws.http.postJson(tipStatusUrl.href, req); const merchantResp = await ws.http.fetch(tipStatusUrl.href, {
method: "POST",
body: req,
});
logger.trace(`got tip response, status ${merchantResp.status}`); logger.trace(`got tip response, status ${merchantResp.status}`);