Skip to content

Commit

Permalink
feat(backend): add metadata to payments (#1522)
Browse files Browse the repository at this point in the history
* feat(backend): add metadata to payments

* chore(backend): format

* feat(backend): change webhook event data to json

* feat(backend): rm description, externalref from payments

* chore(backend): format

* fix(backend): rm description usage

* chore(documentation): gen gql

* test(backend): psql jsonb array serialization

* chore(backend): format

* fix(documentation): gql generated out path

* fix(documentation): restore deleted file

* fix(documentation): format

* feat(backend): add metadata to inc payments table

* refactor(backend): move db changes to new migration

* chore(backend): format
  • Loading branch information
BlairCurrey authored Jul 3, 2023
1 parent 88eedab commit f5c1f66
Show file tree
Hide file tree
Showing 47 changed files with 977 additions and 700 deletions.
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 @@ -230,7 +230,6 @@ export async function createPaymentPointerKey({

export async function getPaymentPointerPayments(
paymentPointerId: string
// TODO: pagination
): Promise<PaymentPointer> {
const query = gql`
query PaymentPointer($id: String!) {
Expand All @@ -249,8 +248,7 @@ export async function getPaymentPointerPayments(
assetCode
assetScale
}
description
externalRef
metadata
createdAt
}
cursor
Expand Down Expand Up @@ -279,8 +277,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 @@ -48,8 +47,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 @@ -64,8 +62,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 @@ -22,18 +22,20 @@ export default function Transactions() {
<tr>
<th>Date</th>
<th>Type</th>
<th>Metadata</th>
<th>Amount</th>
<th>Description</th>
</tr>
{transactions.map((trx) => (
<tr key={trx.id}>
<td>{trx.createdAt}</td>
<td>{trx.type}</td>
<td>
<code>{JSON.stringify(trx.metadata)}</code>
</td>
<td>
{(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

0 comments on commit f5c1f66

Please sign in to comment.