Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(backend): add metadata to payments #1522

Merged
merged 15 commits into from
Jul 3, 2023
Merged
Show file tree
Hide file tree
Changes from 9 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
7 changes: 2 additions & 5 deletions localenv/mock-account-servicing-entity/app/lib/requesters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,6 @@ export async function createPaymentPointerKey({

export async function getPaymentPointerPayments(
paymentPointerId: string
// TODO: pagination
): Promise<PaymentPointer> {
const query = gql`
query PaymentPointer($id: String!) {
Expand All @@ -250,8 +249,7 @@ export async function getPaymentPointerPayments(
assetCode
assetScale
}
description
externalRef
metadata
createdAt
}
cursor
Expand Down Expand Up @@ -280,8 +278,7 @@ export async function getPaymentPointerPayments(
assetScale
}
receiver
description
externalRef
metadata
sentAmount {
value
assetCode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ export enum TransactionType {

interface Transaction {
id: string
description: string
externalRef: string
metadata: Record<string, unknown>
createdAt: string
amountValue: string
assetCode: string
Expand Down Expand Up @@ -43,8 +42,7 @@ export async function getAccountTransactions(
const transactions = incomingPayments.edges.map(({ node }) => {
return {
id: node.id,
description: node.description,
externalRef: node.externalRef,
metadata: node.metadata,
incomingAmountValue: node.incomingAmount.value,
amountValue: node.receivedAmount.value,
assetCode: node.receivedAmount.assetCode,
Expand All @@ -59,8 +57,7 @@ export async function getAccountTransactions(
return {
id: node.id,
receiver: node.receiver,
description: node.description,
externalRef: node.externalRef,
metadata: node.metadata,
sendAmountValue: node.sendAmount.value,
amountValue: node.sentAmount.value,
receiveAmount: node.receiveAmount,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export default function Transactions() {
<th>Date</th>
<th>Type</th>
<th>Amount</th>
<th>Description</th>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I considered adding a metadata column here since it is replacing description but wasn't sure how important that would be, and wasn't sure how to handle styling in light of it being fairly large (or even very large, potentially). Just figured it wasn't that important but I can add it if we want.

Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest

<td><code>{JSON.stringify(trx.metadata)}</code></td>
Screenshot 2023-06-28 at 18 59 29

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added

</tr>
{transactions.map((trx) => (
<tr key={trx.id}>
Expand All @@ -33,7 +32,6 @@ export default function Transactions() {
{(Number(trx.amountValue) / 100).toFixed(trx.assetScale)}{' '}
{trx.assetCode}
</td>
<td>{trx.description}</td>
</tr>
))}
</table>
Expand Down
57 changes: 25 additions & 32 deletions localenv/mock-account-servicing-entity/generated/graphql.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading