Skip to content
This repository was archived by the owner on Mar 8, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/services/basePayId.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export function formatPaymentInfo(
addressDetails: address.details,
}
}),
verifiedAddresses: [],
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now, this will just be an empty response.

...(payId && { payId }),
}

Expand Down
8 changes: 7 additions & 1 deletion src/types/publicAPI.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/* eslint-disable import/no-cycle --
Cycle between this file and types/verifiedAddress.ts. Should we combine these into one?
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently we have a types file for verified addresses, and one for the public API.

The other two type files are database types.

I'm thinking that the verified addresses types, and public api types, are really all just protocol types.

I'm thinking we should combine these into one file like (types/protocol.ts or types/address.ts). This would require a bit of a refactor to all the references to previous types files, so I would do that as a subsequent PR.

What do you think?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ya I'm into that, these have been calling for a refactor for a minute now

*/
import { VerifiedAddress } from './verifiedAddress'

/**
* Type of payment address in PaymentInformation.
*/
Expand Down Expand Up @@ -27,8 +32,9 @@ export interface FiatAddressDetails {
* case of a GET request to the base path /).
*/
export interface PaymentInformation {
readonly addresses: Address[]
readonly payId?: string
readonly addresses: Address[]
readonly verifiedAddresses: VerifiedAddress[]
readonly memo?: string
}

Expand Down
3 changes: 2 additions & 1 deletion src/types/verifiedAddress.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
/* eslint-disable import/no-cycle --
Cycle between this file and types/publicApi.ts. Should we combine these into one? */
import { Address } from './publicAPI'

/**
* Object containing address information alongside signatures.
*/
// eslint-disable-next-line import/no-unused-modules -- will disable in next PR
export interface VerifiedAddress {
readonly payload: VerifiedAddressPayload
readonly signatures: readonly VerifiedAddressSignature[]
Expand Down
4 changes: 4 additions & 0 deletions test/integration/e2e/public-api/basePayId.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ describe('E2E - publicAPIRouter - Base PayID', function (): void {
},
},
],
verifiedAddresses: [],
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updates a bunch of tests so they continue to pass.

payId: 'alice$127.0.0.1',
}

Expand Down Expand Up @@ -62,6 +63,7 @@ describe('E2E - publicAPIRouter - Base PayID', function (): void {
},
},
],
verifiedAddresses: [],
payId: 'alice$127.0.0.1',
}

Expand Down Expand Up @@ -93,6 +95,7 @@ describe('E2E - publicAPIRouter - Base PayID', function (): void {
},
},
],
verifiedAddresses: [],
payId: 'alice$127.0.0.1',
}

Expand Down Expand Up @@ -124,6 +127,7 @@ describe('E2E - publicAPIRouter - Base PayID', function (): void {
},
},
],
verifiedAddresses: [],
payId: 'alice$127.0.0.1',
}

Expand Down
4 changes: 4 additions & 0 deletions test/integration/e2e/public-api/contentNegotiation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ describe('E2E - publicAPIRouter - Content Negotiation', function (): void {
},
},
],
verifiedAddresses: [],
payId: 'alice$127.0.0.1',
}

Expand Down Expand Up @@ -68,6 +69,7 @@ describe('E2E - publicAPIRouter - Content Negotiation', function (): void {
},
},
],
verifiedAddresses: [],
payId: 'alice$127.0.0.1',
}

Expand Down Expand Up @@ -104,6 +106,7 @@ describe('E2E - publicAPIRouter - Content Negotiation', function (): void {
},
},
],
verifiedAddresses: [],
payId: 'alice$127.0.0.1',
}

Expand Down Expand Up @@ -141,6 +144,7 @@ describe('E2E - publicAPIRouter - Content Negotiation', function (): void {
},
},
],
verifiedAddresses: [],
payId: 'alice$127.0.0.1',
}

Expand Down
4 changes: 4 additions & 0 deletions test/unit/formatPaymentInfo.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ describe('Base PayID - formatPaymentInfo()', function (): void {
},
},
],
verifiedAddresses: [],
payId: 'alice$example.com',
}

Expand Down Expand Up @@ -75,6 +76,7 @@ describe('Base PayID - formatPaymentInfo()', function (): void {
},
},
],
verifiedAddresses: [],
}

// WHEN we format it and don't pass in a PayID
Expand Down Expand Up @@ -108,6 +110,7 @@ describe('Base PayID - formatPaymentInfo()', function (): void {
},
},
],
verifiedAddresses: [],
}

// WHEN we format it
Expand Down Expand Up @@ -141,6 +144,7 @@ describe('Base PayID - formatPaymentInfo()', function (): void {
},
},
],
verifiedAddresses: [],
payId: 'alice$example.com',
memo: 'memo',
}
Expand Down