From 1bbd8172f55b174e799c65de2677596efe08b65f Mon Sep 17 00:00:00 2001 From: Max Kurapov Date: Thu, 28 Sep 2023 18:32:22 +0200 Subject: [PATCH] Revert "feat: add methods (ilp payment method), remove references to connection (#284)" (#309) This reverts commit 73bd29c19d4406f4672f19c0fbef744f912db2df. --- .changeset/sixty-trainers-ring.md | 5 - openapi/resource-server.yaml | 113 ++++-------------- .../src/client/incoming-payment.test.ts | 19 ++- .../src/client/incoming-payment.ts | 27 ++--- packages/open-payments/src/client/index.ts | 2 +- .../open-payments/src/client/quote.test.ts | 12 +- packages/open-payments/src/index.ts | 4 - .../generated/resource-server-types.ts | 33 ++--- packages/open-payments/src/test/helpers.ts | 37 +----- packages/open-payments/src/types.ts | 8 -- 10 files changed, 58 insertions(+), 202 deletions(-) delete mode 100644 .changeset/sixty-trainers-ring.md diff --git a/.changeset/sixty-trainers-ring.md b/.changeset/sixty-trainers-ring.md deleted file mode 100644 index 0fdb0c64..00000000 --- a/.changeset/sixty-trainers-ring.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@interledger/open-payments': major ---- - -BREAKING: Introducing the concept of payment methods (on incoming payments) which allow returing a list of possible payment methods to pay into. For now, only one payment method is supported: ILP. Quote creation requires specifying a payment method for which to quote on. diff --git a/openapi/resource-server.yaml b/openapi/resource-server.yaml index 1a25378e..66deb3d4 100644 --- a/openapi/resource-server.yaml +++ b/openapi/resource-server.yaml @@ -1,14 +1,14 @@ openapi: 3.1.0 info: title: Open Payments - version: '1.4' + version: '1.3' license: name: Apache 2.0 identifier: Apache-2.0 description: |- - The Open Payments API is a simple REST API with 4 resource types: **wallet address**, **quote**, **incoming payment** and **outgoing payment**. + The Open Payments API is a simple REST API with 5 resource types: **wallet address**, **quote**, **connection**, **incoming payment** and **outgoing payment**. - The *service endpoint* for the API is always the URL of the wallet address resource and all other resources are sub-resources of the wallet address. + The *service endpoint* for the API is always the URL of the wallet address resource and all other resources (except connections) are sub-resources of the wallet address. An incoming payment defines meta data that is automatically attached to payments made into the wallet address under that incoming payment. This facilitates automation of processes like reconciliation of payment into the wallet address with external systems. @@ -16,6 +16,8 @@ info: A quote is a commitment from the Account Servicing Entity to deliver a particular amount to a receiver when sending a particular amount from the wallet address. It is only valid for a limited time. + For privacy reasons a connection resource is not a sub-resource of a wallet address. + All resource and collection resource representations use JSON and the media-type `application/json`. The `wallet address` resource has three collections of sub-resources: @@ -23,13 +25,15 @@ info: 2. `/outgoing-payments` contains the **outgoing payment** sub-resources 3. `/quotes` contains the **quote** sub-resources + There is no normative path for **connection** resources. In this documentation we use the path `/connections` but implementations may use any arbitrary path. + Access to resources and permission to execute the methods exposed by the API is determined by the grants given to the client represented by an access token used in API requests. summary: An API for open access to financial accounts to send and receive payments. contact: email: tech@interledger.org servers: - url: '/' - description: 'Server for wallet address subresources (ie https://openpayments.guide/alice)' + description: 'Server for wallet address subresources or Connection resources (ie https://openpayments.guide/alice)' tags: - name: wallet-address description: wallet address operations @@ -39,6 +43,8 @@ tags: description: outgoing payment operations - name: quote description: quote operations + - name: stream-connection + description: interledger STREAM connections paths: /: get: @@ -101,7 +107,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/incoming-payment-with-methods' + $ref: '#/components/schemas/incoming-payment' examples: New Incoming Payment for $25: value: @@ -121,10 +127,7 @@ paths: externalRef: INV2022-02-0137 createdAt: '2022-03-12T23:20:50.52Z' updatedAt: '2022-04-01T10:24:36.11Z' - methods: - - type: ilp - ilpAddress: g.ilp.iwuyge987y.98y08y - sharedSecret: 1c7eaXa4rd2fFOBl1iydvCT1tV5TbM3RW1WLCafu_JA'401' + '401': $ref: '#/components/responses/401' '403': $ref: '#/components/responses/403' @@ -514,7 +517,6 @@ paths: value: '2198' assetCode: EUR assetScale: 2 - method: ilp createdAt: '2022-03-12T23:20:50.52Z' expiresAt: '2022-04-12T23:20:50.52Z' '400': @@ -527,22 +529,16 @@ paths: content: application/json: examples: - Create quote for an `receiver` that is an Incoming Payment with an `incomingAmount`: - value: - receiver: 'https://openpayments.guide/incoming-payments/37a0d0ee-26dc-4c66-89e0-01fbf93156f7' - method: ilp - Create fixed-send amount quote for $25: + Create fixed-send-amount quote for $25 to an ILP STREAM connection: value: - receiver: 'https://openpayments.guide/incoming-payments/37a0d0ee-26dc-4c66-89e0-01fbf93156f7' - method: ilp + receiver: 'https://openpayments.guide/connections/45a0d0ee-26dc-4c66-89e0-01fbf93156f7' debitAmount: value: '2500' assetCode: USD assetScale: 2 - Create fixed-receive amount quote for $25: + Create fixed-receive-amount quote for $25: value: receiver: 'https://openpayments.guide/incoming-payments/37a0d0ee-26dc-4c66-89e0-01fbf93156f7' - method: ilp receiveAmount: value: '2500' assetCode: USD @@ -553,38 +549,29 @@ paths: properties: receiver: $ref: ./schemas.yaml#/components/schemas/receiver - method: - $ref: '#/components/schemas/payment-method' required: - receiver - - method additionalProperties: false - description: Create a quote with a fixed-receive amount properties: receiver: $ref: ./schemas.yaml#/components/schemas/receiver - method: - $ref: '#/components/schemas/payment-method' receiveAmount: description: The fixed amount that would be paid into the receiving wallet address given a successful outgoing payment. $ref: ./schemas.yaml#/components/schemas/amount required: - receiver - - method - receiveAmount additionalProperties: false - - description: Create a quote with a fixed-send amount + - description: Create a quote with a fixed send amount properties: receiver: $ref: ./schemas.yaml#/components/schemas/receiver - method: - $ref: '#/components/schemas/payment-method' debitAmount: description: The fixed amount that would be sent from the sending wallet address given a successful outgoing payment. $ref: ./schemas.yaml#/components/schemas/amount required: - receiver - - method - debitAmount additionalProperties: false description: |- @@ -610,7 +597,7 @@ paths: application/json: schema: anyOf: - - $ref: '#/components/schemas/incoming-payment-with-methods' + - $ref: '#/components/schemas/incoming-payment' - $ref: '#/components/schemas/public-incoming-payment' examples: Incoming Payment for $25 with $12.34 received so far: @@ -632,10 +619,6 @@ paths: metadata: description: Thanks for the flowers! externalRef: INV-12876 - methods: - - type: ilp - ilpAddress: g.ilp.iwuyge987y.98y08y - sharedSecret: 1c7eaXa4rd2fFOBl1iydvCT1tV5TbM3RW1WLCafu_JA '401': $ref: '#/components/responses/401' '403': @@ -773,7 +756,6 @@ paths: value: '2198' assetCode: EUR assetScale: 2 - method: ilp createdAt: '2022-03-12T23:20:50.52Z' expiresAt: '2022-04-12T23:20:50.52Z' '401': @@ -925,32 +907,15 @@ components: - receivedAmount - createdAt - updatedAt - incoming-payment-with-methods: - title: Incoming Payment with payment methods - description: An **incoming payment** resource with public details. - allOf: - - $ref: '#/components/schemas/incoming-payment' - - type: object - properties: - methods: - description: The list of payment methods supported by this incoming payment. - type: array - uniqueItems: true - minItems: 0 - items: - anyOf: - - $ref: '#/components/schemas/ilp-payment-method' - required: - - methods public-incoming-payment: title: Public Incoming Payment description: An **incoming payment** resource with public details. type: object examples: - receivedAmount: - value: '0' - assetCode: USD - assetScale: 2 + value: '0' + assetCode: USD + assetScale: 2 properties: receiveAmount: $ref: ./schemas.yaml#/components/schemas/amount @@ -1021,7 +986,7 @@ components: default: false receiver: $ref: ./schemas.yaml#/components/schemas/receiver - description: The URL of the incoming payment that is being paid. + description: The URL of the incoming payment or ILP STREAM Connection that is being paid. receiveAmount: $ref: ./schemas.yaml#/components/schemas/amount description: The total amount that should be received by the receiver when this outgoing payment has been paid. @@ -1071,7 +1036,6 @@ components: value: '2500' assetCode: USD assetScale: 2 - method: ilp createdAt: '2022-03-12T23:20:50.52Z' expiresAt: '2022-04-12T23:20:50.52Z' - id: 'https://openpayments.guide/quotes/8c68d3cc-0a0f-4216-98b4-4fa44a6c88cf' @@ -1085,7 +1049,6 @@ components: value: '7026' assetCode: USD assetScale: 2 - method: ilp createdAt: '2022-03-12T23:20:50.52Z' expiresAt: '2022-04-12T23:20:50.52Z' additionalProperties: false @@ -1102,15 +1065,13 @@ components: readOnly: true receiver: $ref: ./schemas.yaml#/components/schemas/receiver - description: The URL of the incoming payment that the quote is created for. + description: The URL of the incoming payment or ILP STREAM Connection that the quote is created for. receiveAmount: $ref: ./schemas.yaml#/components/schemas/amount description: The total amount that should be received by the receiver when the corresponding outgoing payment has been paid. debitAmount: $ref: ./schemas.yaml#/components/schemas/amount description: "The total amount that should be deducted from the sender's account when the corresponding outgoing payment has been paid. " - method: - $ref: '#/components/schemas/payment-method' expiresAt: type: string description: The date and time when the calculated `debitAmount` is no longer valid. @@ -1126,7 +1087,6 @@ components: - receiveAmount - debitAmount - createdAt - - method page-info: description: '' type: object @@ -1199,35 +1159,6 @@ components: kty: OKP crv: Ed25519 x: oy0L_vTygNE4IogRyn_F5GmHXdqYVjIXkWs2jky7zsI - payment-method: - type: string - enum: - - ilp - ilp-payment-method: - type: object - additionalProperties: false - properties: - type: - type: string - enum: - - ilp - ilpAddress: - type: string - maxLength: 1023 - pattern: '^(g|private|example|peer|self|test[1-3]?|local)([.][a-zA-Z0-9_~-]+)+$' - description: The ILP address to use when establishing a STREAM connection. - sharedSecret: - type: string - pattern: '^[a-zA-Z0-9-_]+$' - description: The base64 url-encoded shared secret to use when establishing a STREAM connection. - required: - - type - - ilpAddress - - sharedSecret - examples: - - type: string - ilpAddress: string - sharedSecret: string securitySchemes: GNAP: name: Authorization diff --git a/packages/open-payments/src/client/incoming-payment.test.ts b/packages/open-payments/src/client/incoming-payment.test.ts index 99b64490..f84d93ca 100644 --- a/packages/open-payments/src/client/incoming-payment.test.ts +++ b/packages/open-payments/src/client/incoming-payment.test.ts @@ -13,7 +13,6 @@ import { defaultAxiosInstance, mockIncomingPayment, mockIncomingPaymentPaginationResult, - mockIncomingPaymentWithPaymentMethods, mockOpenApiResponseValidators, silentLogger } from '../test/helpers' @@ -49,7 +48,7 @@ describe('incoming-payment', (): void => { describe('getIncomingPayment', (): void => { test('returns incoming payment if passes validation', async (): Promise => { - const incomingPayment = mockIncomingPaymentWithPaymentMethods() + const incomingPayment = mockIncomingPayment() nock(walletAddress) .get('/incoming-payments/1') @@ -67,7 +66,7 @@ describe('incoming-payment', (): void => { }) test('throws if incoming payment does not pass validation', async (): Promise => { - const incomingPayment = mockIncomingPaymentWithPaymentMethods({ + const incomingPayment = mockIncomingPayment({ incomingAmount: { assetCode: 'USD', assetScale: 2, @@ -100,7 +99,7 @@ describe('incoming-payment', (): void => { }) test('throws if incoming payment does not pass open api validation', async (): Promise => { - const incomingPayment = mockIncomingPaymentWithPaymentMethods() + const incomingPayment = mockIncomingPayment() nock(walletAddress) .get('/incoming-payments/1') @@ -130,7 +129,7 @@ describe('incoming-payment', (): void => { `( 'returns the incoming payment on success', async ({ incomingAmount, expiresAt, metadata }): Promise => { - const incomingPayment = mockIncomingPaymentWithPaymentMethods({ + const incomingPayment = mockIncomingPayment({ incomingAmount, expiresAt, metadata @@ -163,7 +162,7 @@ describe('incoming-payment', (): void => { value: '10' } - const incomingPayment = mockIncomingPaymentWithPaymentMethods({ + const incomingPayment = mockIncomingPayment({ incomingAmount: amount, receivedAmount: amount, completed: false @@ -185,7 +184,7 @@ describe('incoming-payment', (): void => { }) test('throws if the created incoming payment does not pass open api validation', async (): Promise => { - const incomingPayment = mockIncomingPaymentWithPaymentMethods() + const incomingPayment = mockIncomingPayment() const scope = nock(walletAddress) .post('/incoming-payments') @@ -523,7 +522,7 @@ describe('incoming-payment', (): void => { describe('validateCreatedIncomingPayment', (): void => { test('returns the created incoming payment if it passes validation', async (): Promise => { - const incomingPayment = mockIncomingPaymentWithPaymentMethods({ + const incomingPayment = mockIncomingPayment({ incomingAmount: { assetCode: 'USD', assetScale: 2, @@ -542,7 +541,7 @@ describe('incoming-payment', (): void => { }) test('throws if received amount is a non-zero value for a newly created incoming payment', async (): Promise => { - const incomingPayment = mockIncomingPaymentWithPaymentMethods({ + const incomingPayment = mockIncomingPayment({ receivedAmount: { assetCode: 'USD', assetScale: 2, @@ -556,7 +555,7 @@ describe('incoming-payment', (): void => { }) test('throws if the created incoming payment is completed', async (): Promise => { - const incomingPayment = mockIncomingPaymentWithPaymentMethods({ + const incomingPayment = mockIncomingPayment({ completed: true }) diff --git a/packages/open-payments/src/client/incoming-payment.ts b/packages/open-payments/src/client/incoming-payment.ts index 057e5ac3..19c2f274 100644 --- a/packages/open-payments/src/client/incoming-payment.ts +++ b/packages/open-payments/src/client/incoming-payment.ts @@ -10,19 +10,16 @@ import { getRSPath, CreateIncomingPaymentArgs, PaginationArgs, - IncomingPaymentPaginationResult, - IncomingPaymentWithPaymentMethods + IncomingPaymentPaginationResult } from '../types' import { get, post } from './requests' -type AnyIncomingPayment = IncomingPayment | IncomingPaymentWithPaymentMethods - export interface IncomingPaymentRoutes { - get(args: ResourceRequestArgs): Promise + get(args: ResourceRequestArgs): Promise create( args: CollectionRequestArgs, createArgs: CreateIncomingPaymentArgs - ): Promise + ): Promise complete(args: ResourceRequestArgs): Promise list( args: CollectionRequestArgs, @@ -36,13 +33,13 @@ export const createIncomingPaymentRoutes = ( const { axiosInstance, openApi, logger } = deps const getIncomingPaymentOpenApiValidator = - openApi.createResponseValidator({ + openApi.createResponseValidator({ path: getRSPath('/incoming-payments/{id}'), method: HttpMethod.GET }) const createIncomingPaymentOpenApiValidator = - openApi.createResponseValidator({ + openApi.createResponseValidator({ path: getRSPath('/incoming-payments'), method: HttpMethod.POST }) @@ -95,7 +92,7 @@ export const createIncomingPaymentRoutes = ( export const getIncomingPayment = async ( deps: BaseDeps, args: ResourceRequestArgs, - validateOpenApiResponse: ResponseValidator + validateOpenApiResponse: ResponseValidator ) => { const { axiosInstance, logger } = deps const { url } = args @@ -122,7 +119,7 @@ export const getIncomingPayment = async ( export const createIncomingPayment = async ( deps: BaseDeps, requestArgs: CollectionRequestArgs, - validateOpenApiResponse: ResponseValidator, + validateOpenApiResponse: ResponseValidator, createArgs: CreateIncomingPaymentArgs ) => { const { axiosInstance, logger } = deps @@ -218,9 +215,9 @@ export const listIncomingPayment = async ( return incomingPayments } -export const validateIncomingPayment = ( - payment: T -): T => { +export const validateIncomingPayment = ( + payment: IncomingPayment +): IncomingPayment => { if (payment.incomingAmount) { const { incomingAmount, receivedAmount } = payment if ( @@ -245,8 +242,8 @@ export const validateIncomingPayment = ( } export const validateCreatedIncomingPayment = ( - payment: IncomingPaymentWithPaymentMethods -): IncomingPaymentWithPaymentMethods => { + payment: IncomingPayment +): IncomingPayment => { const { receivedAmount, completed } = payment if (BigInt(receivedAmount.value) !== BigInt(0)) { diff --git a/packages/open-payments/src/client/index.ts b/packages/open-payments/src/client/index.ts index 716745b9..04630bee 100644 --- a/packages/open-payments/src/client/index.ts +++ b/packages/open-payments/src/client/index.ts @@ -110,7 +110,7 @@ export interface UnauthenticatedClient { } /** - * Creates an OpenPayments client that is only able to make requests to get wallet addresses, and wallet address keys. + * Creates an OpenPayments client that is only able to make requests to get wallet addresses, wallet address keys, and ILP connections. */ export const createUnauthenticatedClient = async ( args: CreateUnauthenticatedClientArgs diff --git a/packages/open-payments/src/client/quote.test.ts b/packages/open-payments/src/client/quote.test.ts index 7d5421c8..17b38b97 100644 --- a/packages/open-payments/src/client/quote.test.ts +++ b/packages/open-payments/src/client/quote.test.ts @@ -86,7 +86,7 @@ describe('quote', (): void => { accessToken }, openApiValidators.successfulValidator, - { receiver: quote.receiver, method: 'ilp' } + { receiver: quote.receiver } ) expect(result).toStrictEqual(quote) scope.done() @@ -105,7 +105,7 @@ describe('quote', (): void => { accessToken }, openApiValidators.failedValidator, - { receiver: quote.receiver, method: 'ilp' } + { receiver: quote.receiver } ) ).rejects.toThrowError() scope.done() @@ -172,7 +172,7 @@ describe('quote', (): void => { walletAddress, accessToken }, - { receiver: quote.receiver, method: 'ilp' } + { receiver: quote.receiver } ) expect(postSpy).toHaveBeenCalledWith( @@ -180,11 +180,7 @@ describe('quote', (): void => { axiosInstance, logger }, - { - url, - accessToken, - body: { receiver: quote.receiver, method: 'ilp' } - }, + { url, accessToken, body: { receiver: quote.receiver } }, true ) }) diff --git a/packages/open-payments/src/index.ts b/packages/open-payments/src/index.ts index aa9ef28f..bbd7265c 100644 --- a/packages/open-payments/src/index.ts +++ b/packages/open-payments/src/index.ts @@ -2,8 +2,6 @@ export { GrantRequest, GrantContinuationRequest, IncomingPayment, - IncomingPaymentWithPaymentMethods, - IlpPaymentMethod, Quote, OutgoingPayment, PendingGrant, @@ -29,8 +27,6 @@ export { export { mockWalletAddress, mockIncomingPayment, - mockIncomingPaymentWithPaymentMethods, - mockIlpPaymentMethod, mockOutgoingPayment, mockIncomingPaymentPaginationResult, mockOutgoingPaymentPaginationResult, diff --git a/packages/open-payments/src/openapi/generated/resource-server-types.ts b/packages/open-payments/src/openapi/generated/resource-server-types.ts index d1c95758..2e302cdc 100644 --- a/packages/open-payments/src/openapi/generated/resource-server-types.ts +++ b/packages/open-payments/src/openapi/generated/resource-server-types.ts @@ -166,14 +166,6 @@ export interface components { */ updatedAt: string; }; - /** - * Incoming Payment with payment methods - * @description An **incoming payment** resource with public details. - */ - "incoming-payment-with-methods": components["schemas"]["incoming-payment"] & { - /** @description The list of payment methods supported by this incoming payment. */ - methods: Partial[]; - }; /** * Public Incoming Payment * @description An **incoming payment** resource with public details. @@ -203,7 +195,7 @@ export interface components { quoteId?: string; /** @description Describes whether the payment failed to send its full amount. */ failed?: boolean; - /** @description The URL of the incoming payment that is being paid. */ + /** @description The URL of the incoming payment or ILP STREAM Connection that is being paid. */ receiver: external["schemas.yaml"]["components"]["schemas"]["receiver"]; /** @description The total amount that should be received by the receiver when this outgoing payment has been paid. */ receiveAmount: external["schemas.yaml"]["components"]["schemas"]["amount"]; @@ -239,13 +231,12 @@ export interface components { * @description The URL of the wallet address from which this quote's payment would be sent. */ walletAddress: string; - /** @description The URL of the incoming payment that the quote is created for. */ + /** @description The URL of the incoming payment or ILP STREAM Connection that the quote is created for. */ receiver: external["schemas.yaml"]["components"]["schemas"]["receiver"]; /** @description The total amount that should be received by the receiver when the corresponding outgoing payment has been paid. */ receiveAmount: external["schemas.yaml"]["components"]["schemas"]["amount"]; /** @description The total amount that should be deducted from the sender's account when the corresponding outgoing payment has been paid. */ debitAmount: external["schemas.yaml"]["components"]["schemas"]["amount"]; - method: components["schemas"]["payment-method"]; /** @description The date and time when the calculated `debitAmount` is no longer valid. */ expiresAt?: string; /** @@ -278,14 +269,6 @@ export interface components { /** @description The base64 url-encoded public key. */ x: string; }; - "payment-method": "ilp"; - "ilp-payment-method": { - type: "ilp"; - /** @description The ILP address to use when establishing a STREAM connection. */ - ilpAddress: string; - /** @description The base64 url-encoded shared secret to use when establishing a STREAM connection. */ - sharedSecret: string; - }; }; responses: { /** Authorization required */ @@ -402,7 +385,12 @@ export interface operations { }; responses: { /** Incoming Payment Created */ - 201: components["responses"]["401"]; + 201: { + content: { + "application/json": components["schemas"]["incoming-payment"]; + }; + }; + 401: components["responses"]["401"]; 403: components["responses"]["403"]; }; /** @@ -533,17 +521,14 @@ export interface operations { "application/json": | { receiver: external["schemas.yaml"]["components"]["schemas"]["receiver"]; - method: components["schemas"]["payment-method"]; } | { receiver: external["schemas.yaml"]["components"]["schemas"]["receiver"]; - method: components["schemas"]["payment-method"]; /** @description The fixed amount that would be paid into the receiving wallet address given a successful outgoing payment. */ receiveAmount: external["schemas.yaml"]["components"]["schemas"]["amount"]; } | { receiver: external["schemas.yaml"]["components"]["schemas"]["receiver"]; - method: components["schemas"]["payment-method"]; /** @description The fixed amount that would be sent from the sending wallet address given a successful outgoing payment. */ debitAmount: external["schemas.yaml"]["components"]["schemas"]["amount"]; }; @@ -569,7 +554,7 @@ export interface operations { 200: { content: { "application/json": Partial< - components["schemas"]["incoming-payment-with-methods"] + components["schemas"]["incoming-payment"] > & Partial; }; diff --git a/packages/open-payments/src/test/helpers.ts b/packages/open-payments/src/test/helpers.ts index 8b34dba3..ed0a6d62 100644 --- a/packages/open-payments/src/test/helpers.ts +++ b/packages/open-payments/src/test/helpers.ts @@ -13,13 +13,10 @@ import { Quote, IncomingPaymentPaginationResult, PendingGrant, - Grant, - IncomingPaymentWithPaymentMethods, - IlpPaymentMethod + Grant } from '../types' import { v4 as uuid } from 'uuid' import { ResponseValidator } from '@interledger/openapi' -import base64url from 'base64url' export const silentLogger = createLogger({ level: 'silent' @@ -100,37 +97,6 @@ export const mockIncomingPayment = ( ...overrides }) -export const mockIncomingPaymentWithPaymentMethods = ( - overrides?: Partial -): IncomingPaymentWithPaymentMethods => ({ - id: `https://example.com/.well-known/pay/incoming-payments/${uuid()}`, - walletAddress: 'https://example.com/.well-known/pay', - completed: false, - incomingAmount: { - assetCode: 'USD', - assetScale: 2, - value: '10' - }, - receivedAmount: { - assetCode: 'USD', - assetScale: 2, - value: '0' - }, - createdAt: new Date().toISOString(), - updatedAt: new Date().toISOString(), - methods: [mockIlpPaymentMethod()], - ...overrides -}) - -export const mockIlpPaymentMethod = ( - overrides?: Partial -): IlpPaymentMethod => ({ - type: 'ilp', - sharedSecret: base64url('sharedSecret'), - ilpAddress: 'test.ilpAddress', - ...overrides -}) - export const mockIncomingPaymentPaginationResult = ( overrides?: Partial ): IncomingPaymentPaginationResult => { @@ -301,6 +267,5 @@ export const mockQuote = (overrides?: Partial): Quote => ({ }, createdAt: new Date().toISOString(), expiresAt: new Date(Date.now() + 60_000).toISOString(), - method: 'ilp', ...overrides }) diff --git a/packages/open-payments/src/types.ts b/packages/open-payments/src/types.ts index d8bcec61..18c9d39b 100644 --- a/packages/open-payments/src/types.ts +++ b/packages/open-payments/src/types.ts @@ -13,13 +13,6 @@ export const getRSPath =

(path: P): string => path as string export type IncomingPayment = RSComponents['schemas']['incoming-payment'] - -export type IlpPaymentMethod = RSComponents['schemas']['ilp-payment-method'] -type PaymentMethods = IlpPaymentMethod - -export type IncomingPaymentWithPaymentMethods = IncomingPayment & { - methods: PaymentMethods[] -} export type CreateIncomingPaymentArgs = RSOperations['create-incoming-payment']['requestBody']['content']['application/json'] export type IncomingPaymentPaginationResult = PaginationResult @@ -50,7 +43,6 @@ export type JWKS = RSComponents['schemas']['json-web-key-set'] export type Quote = RSComponents['schemas']['quote'] type QuoteArgsBase = { receiver: RSOperations['create-quote']['requestBody']['content']['application/json']['receiver'] - method: RSComponents['schemas']['payment-method'] } type QuoteArgsWithDebitAmount = QuoteArgsBase & { debitAmount?: RSComponents['schemas']['quote']['debitAmount']