Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ body:graphql {
value
}
state
senderWalletAddress
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ body:graphql {
}
metadata
createdAt
senderWalletAddress
}
}
}
Expand Down
5 changes: 5 additions & 0 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.

Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* @param { import("knex").Knex } knex
* @returns { Promise<void> }
*/
exports.up = function (knex) {
return knex.schema.alterTable('incomingPayments', function (table) {
table.string('senderWalletAddress').nullable()
})
}

/**
* @param { import("knex").Knex } knex
* @returns { Promise<void> }
*/
exports.down = function (knex) {
return knex.schema.alterTable('incomingPayments', function (table) {
table.dropColumn('senderWalletAddress')
})
}
24 changes: 24 additions & 0 deletions packages/backend/src/graphql/generated/graphql.schema.json

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

5 changes: 5 additions & 0 deletions packages/backend/src/graphql/generated/graphql.ts

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

13 changes: 10 additions & 3 deletions packages/backend/src/graphql/resolvers/incoming_payment.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import {
import { Amount, serializeAmount } from '../../open_payments/amount'
import { GraphQLErrorCode } from '../errors'
import { createTenant } from '../../tests/tenant'
import { faker } from '@faker-js/faker'

describe('Incoming Payment Resolver', (): void => {
let deps: IocContract<AppServices>
Expand Down Expand Up @@ -100,6 +101,7 @@ describe('Incoming Payment Resolver', (): void => {

describe('Mutation.createIncomingPayment', (): void => {
let amount: Amount
let senderWalletAddress: string

beforeEach((): void => {
amount = {
Expand All @@ -108,6 +110,7 @@ describe('Incoming Payment Resolver', (): void => {
assetScale: asset.scale
}
client = 'incoming-payment-client-create'
senderWalletAddress = faker.internet.url()
})

test.each`
Expand All @@ -130,7 +133,8 @@ describe('Incoming Payment Resolver', (): void => {
expiresAt,
incomingAmount,
tenantId,
initiationReason: IncomingPaymentInitiationReason.Admin
initiationReason: IncomingPaymentInitiationReason.Admin,
senderWalletAddress
})

const createSpy = jest
Expand All @@ -141,7 +145,8 @@ describe('Incoming Payment Resolver', (): void => {
walletAddressId,
incomingAmount,
expiresAt,
metadata
metadata,
senderWalletAddress
}

const query = await appContainer.apolloClient
Expand All @@ -168,6 +173,7 @@ describe('Incoming Payment Resolver', (): void => {
}
metadata
createdAt
senderWalletAddress
}
}
}
Expand Down Expand Up @@ -205,7 +211,8 @@ describe('Incoming Payment Resolver', (): void => {
...serializeAmount(payment.receivedAmount)
},
metadata: metadata || null,
createdAt: payment.createdAt.toISOString()
createdAt: payment.createdAt.toISOString(),
senderWalletAddress
}
})
}
Expand Down
6 changes: 4 additions & 2 deletions packages/backend/src/graphql/resolvers/incoming_payment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ export const createIncomingPayment: MutationResolvers<ForTenantIdContext>['creat
initiationReason:
ctx.isOperator && args.input.isCardPayment
? IncomingPaymentInitiationReason.Card
: IncomingPaymentInitiationReason.Admin
: IncomingPaymentInitiationReason.Admin,
senderWalletAddress: args.input.senderWalletAddress
})
const config = await ctx.container.use('config')
if (isIncomingPaymentError(incomingPaymentOrError)) {
Expand Down Expand Up @@ -232,6 +233,7 @@ export function paymentToGraphql(
incomingAmount: payment.incomingAmount,
receivedAmount: payment.receivedAmount,
metadata: payment.metadata,
createdAt: new Date(+payment.createdAt).toISOString()
createdAt: new Date(+payment.createdAt).toISOString(),
senderWalletAddress: payment.senderWalletAddress
}
}
4 changes: 4 additions & 0 deletions packages/backend/src/graphql/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -959,6 +959,8 @@ type IncomingPayment implements BasePayment & Model {
createdAt: String!
"The tenant UUID associated with the incoming payment. If not provided, it will be obtained from the signature."
tenantId: String
"The sender's wallet address URL. Applicable only to card payments."
senderWalletAddress: String
}

type Receiver {
Expand Down Expand Up @@ -1283,6 +1285,8 @@ input CreateIncomingPaymentInput {
idempotencyKey: String
"Whether or not the incoming payment is being created for a card payment."
isCardPayment: Boolean
"The sender's wallet address URL. Applicable only to card payments."
senderWalletAddress: String
}

input CreateReceiverInput {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ export class IncomingPayment
private incomingAmountValue?: bigint | null
private receivedAmountValue?: bigint
public readonly tenantId!: string
public readonly senderWalletAddress?: string | null

public get completed(): boolean {
return this.state === IncomingPaymentState.Completed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export interface CreateIncomingPaymentOptions {
metadata?: Record<string, unknown>
tenantId: string
initiationReason: IncomingPaymentInitiationReason
senderWalletAddress?: string
}

export interface UpdateOptions {
Expand Down Expand Up @@ -146,7 +147,8 @@ async function createIncomingPayment(
incomingAmount,
metadata,
tenantId,
initiationReason
initiationReason,
senderWalletAddress
}: CreateIncomingPaymentOptions,
trx?: Knex.Transaction
): Promise<IncomingPayment | IncomingPaymentError> {
Expand Down Expand Up @@ -192,7 +194,8 @@ async function createIncomingPayment(
state: IncomingPaymentState.Pending,
processAt: expiresAt,
tenantId,
initiatedBy: initiationReason
initiatedBy: initiationReason,
senderWalletAddress
})

const asset = await deps.assetService.get(incomingPayment.assetId)
Expand Down
5 changes: 5 additions & 0 deletions packages/card-service/src/graphql/generated/graphql.ts

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

5 changes: 5 additions & 0 deletions packages/frontend/app/generated/graphql.ts

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

5 changes: 5 additions & 0 deletions packages/mock-account-service-lib/src/generated/graphql.ts

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

5 changes: 5 additions & 0 deletions packages/point-of-sale/src/graphql/generated/graphql.ts

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

5 changes: 5 additions & 0 deletions test/test-lib/src/generated/graphql.ts

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

Loading