Skip to content
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

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

10 changes: 3 additions & 7 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.

2 changes: 1 addition & 1 deletion packages/backend/src/graphql/generated/graphql.ts

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

2 changes: 1 addition & 1 deletion packages/backend/src/graphql/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -1246,7 +1246,7 @@ input CreateOutgoingPaymentFromIncomingPaymentInput {
"Incoming payment URL to create the outgoing payment from."
incomingPayment: String!
"Amount to send (fixed send)."
debitAmount: AmountInput!
debitAmount: AmountInput
"Additional metadata associated with the outgoing payment."
metadata: JSONObject
"Unique key to ensure duplicate or retried requests are processed only once. For more information, refer to [idempotency](https://rafiki.dev/apis/graphql/admin-api-overview/#idempotency)."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ export interface CreateFromQuote extends BaseOptions {
}
export interface CreateFromIncomingPayment extends BaseOptions {
incomingPayment: string
debitAmount: Amount
debitAmount?: Amount
}

export type CancelOutgoingPaymentOptions = {
Expand All @@ -214,7 +214,7 @@ export type CreateOutgoingPaymentOptions =
export function isCreateFromIncomingPayment(
options: CreateOutgoingPaymentOptions
): options is CreateFromIncomingPayment {
return 'incomingPayment' in options && 'debitAmount' in options
return 'incomingPayment' in options
}

async function cancelOutgoingPayment(
Expand Down Expand Up @@ -284,11 +284,10 @@ async function createOutgoingPayment(
description: 'Time to create a quote in outgoing payment'
}
)
const { debitAmount, incomingPayment } = options
const quoteOrError = await deps.quoteService.create({
tenantId,
receiver: incomingPayment,
debitAmount,
receiver: options.incomingPayment,
debitAmount: options.debitAmount,
method: 'ilp',
walletAddressId
})
Expand Down
3 changes: 2 additions & 1 deletion packages/backend/src/open_payments/quote/service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ describe('QuoteService', (): void => {
if (!debitAmount && !receiveAmount && !incomingAmount) {
test('fails without receiver.incomingAmount', async (): Promise<void> => {
await expect(quoteService.create(options)).resolves.toMatchObject({
type: QuoteErrorCode.InvalidReceiver
type: QuoteErrorCode.InvalidAmount
})
})
} else {
Expand Down Expand Up @@ -552,6 +552,7 @@ describe('QuoteService', (): void => {

test.each`
debitAmount | receiveAmount | description
${undefined} | ${undefined} | ${'with undefined debitAmount and receiveAmount'}
${{ ...debitAmount, value: BigInt(0) }} | ${undefined} | ${'with debitAmount of zero'}
${{ ...debitAmount, value: BigInt(-1) }} | ${undefined} | ${'with negative debitAmount'}
${{ ...debitAmount, assetScale: 3 }} | ${undefined} | ${'with wrong debitAmount asset'}
Expand Down
4 changes: 2 additions & 2 deletions packages/backend/src/open_payments/quote/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -345,9 +345,9 @@ export async function resolveReceiver(
debitAmount: options.debitAmount,
incomingAmount: receiver.incomingAmount
},
'Could not create quote. debitAmount or incomingAmount required.'
'Could not create quote. One of receiveAmount, debitAmount or incomingAmount (on the incoming payment) is required.'
)
throw new QuoteError(QuoteErrorCode.InvalidReceiver)
throw new QuoteError(QuoteErrorCode.InvalidAmount)
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 thought InvalidAmount was more accurate here than InvalidReceiver

}
return receiver
}
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/app/generated/graphql.ts

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

2 changes: 1 addition & 1 deletion 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.

2 changes: 1 addition & 1 deletion 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