H_wire -> h_wire

This commit is contained in:
Florian Dold 2020-01-17 21:59:47 +01:00
parent 21100c451b
commit baab5b9d20
No known key found for this signature in database
GPG Key ID: D2E4F00F29D02A4B
4 changed files with 14 additions and 10 deletions

View File

@ -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),
},
});

View File

@ -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),

View File

@ -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)

View File

@ -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" }],