diff options
author | Florian Dold <florian.dold@gmail.com> | 2020-01-17 21:59:47 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2020-01-17 21:59:47 +0100 |
commit | baab5b9d206169897b4c257ff6decf2c0b9fe1f6 (patch) | |
tree | 32867df58081954da78ed37cb5f72c24d6d99327 /src | |
parent | 21100c451bf967072756b5c0022839ddb0bb075b (diff) |
H_wire -> h_wire
Diffstat (limited to 'src')
-rw-r--r-- | src/headless/bank.ts | 16 | ||||
-rw-r--r-- | src/operations/pay.ts | 2 | ||||
-rw-r--r-- | src/types/talerTypes.ts | 4 | ||||
-rw-r--r-- | src/types/types-test.ts | 2 |
4 files changed, 14 insertions, 10 deletions
diff --git a/src/headless/bank.ts b/src/headless/bank.ts index 4a5379280..b82951f43 100644 --- a/src/headless/bank.ts +++ b/src/headless/bank.ts @@ -41,6 +41,14 @@ function makeId(length: number): string { return result; } +function makeAuth(username: string, password: string): string { + const auth = `${username}:${password}`; + const authEncoded: string = Buffer.from(auth).toString("base64"); + return `Basic ${authEncoded}`; +} + + + export class Bank { constructor(private bankBaseUrl: string) {} @@ -51,16 +59,13 @@ export class Bank { const reqUrl = new URL("api/withdraw-headless-uri", this.bankBaseUrl).href; - const auth = `${bankUser.username}:${bankUser.password}`; - const authEncoded: string = Buffer.from(auth).toString("base64") - const resp = await Axios({ method: "post", url: reqUrl, data: body, responseType: "json", headers: { - "Authorization": `Basic ${authEncoded}`, + "Authorization": makeAuth(bankUser.username, bankUser.password), }, }); @@ -97,8 +102,7 @@ export class Bank { data: body, responseType: "json", headers: { - "X-Taler-Bank-Username": bankUser.username, - "X-Taler-Bank-Password": bankUser.password, + "Authorization": makeAuth(bankUser.username, bankUser.password), }, }); diff --git a/src/operations/pay.ts b/src/operations/pay.ts index 43bdb2f44..098e6e18c 100644 --- a/src/operations/pay.ts +++ b/src/operations/pay.ts @@ -721,7 +721,7 @@ async function processDownloadProposalImpl( })), timestamp: parsedContractTerms.timestamp, wireMethod: parsedContractTerms.wire_method, - wireInfoHash: parsedContractTerms.H_wire, + wireInfoHash: parsedContractTerms.h_wire, maxDepositFee: Amounts.parseOrThrow(parsedContractTerms.max_fee), }, contractTermsRaw: JSON.stringify(proposalResp.contract_terms), diff --git a/src/types/talerTypes.ts b/src/types/talerTypes.ts index f8e449000..b1a864132 100644 --- a/src/types/talerTypes.ts +++ b/src/types/talerTypes.ts @@ -279,7 +279,7 @@ export class ContractTerms { /** * Hash of the merchant's wire details. */ - H_wire: string; + h_wire: string; /** * Hash of the merchant's wire details. @@ -791,7 +791,7 @@ export const codecForContractTerms = () => .property("order_id", codecForString) .property("fulfillment_url", codecForString) .property("merchant_base_url", codecForString) - .property("H_wire", codecForString) + .property("h_wire", codecForString) .property("auto_refund", makeCodecOptional(codecForDuration)) .property("wire_method", codecForString) .property("summary", codecForString) diff --git a/src/types/types-test.ts b/src/types/types-test.ts index 77ab2c4e4..67d379f7b 100644 --- a/src/types/types-test.ts +++ b/src/types/types-test.ts @@ -131,7 +131,7 @@ test("amount stringification", t => { test("contract terms validation", t => { const c = { nonce: "123123123", - H_wire: "123", + h_wire: "123", amount: "EUR:1.5", auditors: [], exchanges: [{ master_pub: "foo", url: "foo" }], |