From c32f172e76cd2fab457af104dc2f764ba2ff5ce4 Mon Sep 17 00:00:00 2001 From: Nathan Lie Date: Wed, 20 Sep 2023 05:58:29 -0700 Subject: [PATCH 1/8] feat: remove payment pointer from resource url --- openapi/resource-server.yaml | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/openapi/resource-server.yaml b/openapi/resource-server.yaml index ad5e3121..63d93f17 100644 --- a/openapi/resource-server.yaml +++ b/openapi/resource-server.yaml @@ -32,16 +32,8 @@ info: contact: email: tech@interledger.org servers: - - url: '{walletAddress}' - description: 'Server for when Wallet Address has a pathname (ie https://openpayments.guide/alice)' - variables: - walletAddress: - default: https://openpayments.guide/alice - - url: '{walletAddress}/.well-known/pay' - description: 'Server for when Wallet Address has no pathname (ie https://openpayments.guide)' - variables: - walletAddress: - default: https://openpayments.guide + - url: '/' + description: 'Server for Payment Pointer subresources or Connection resources (ie https://openpayments.guide/alice)' tags: - name: wallet-address description: wallet address operations From 2460d272ccd366a2734aa0d533c7f52052209fb0 Mon Sep 17 00:00:00 2001 From: Nathan Lie Date: Thu, 21 Sep 2023 00:10:12 -0700 Subject: [PATCH 2/8] feat: remove wallet address from examples, update tests --- openapi/resource-server.yaml | 53 +++++++++++++------------ openapi/schemas.yaml | 2 +- packages/openapi/src/middleware.test.ts | 2 +- 3 files changed, 30 insertions(+), 27 deletions(-) diff --git a/openapi/resource-server.yaml b/openapi/resource-server.yaml index 63d93f17..c55a0958 100644 --- a/openapi/resource-server.yaml +++ b/openapi/resource-server.yaml @@ -111,7 +111,7 @@ paths: examples: New Incoming Payment for $25: value: - id: 'https://openpayments.guide/alice/incoming-payments/08394f02-7b7b-45e2-b645-51d04e7c330c' + id: 'https://openpayments.guide/incoming-payments/08394f02-7b7b-45e2-b645-51d04e7c330c' walletAddress: 'https://openpayments.guide/alice/' incomingAmount: value: '2500' @@ -210,7 +210,7 @@ paths: hasPreviousPage: false hasNextPage: true result: - - id: 'https://openpayments.guide/alice/incoming-payments/016da9d5-c9a4-4c80-a354-86b915a04ff8' + - id: 'https://openpayments.guide/incoming-payments/016da9d5-c9a4-4c80-a354-86b915a04ff8' walletAddress: 'https://openpayments.guide/alice/' incomingAmount: value: '250' @@ -228,7 +228,7 @@ paths: description: 'Hi Mo, this is for the cappuccino I bought for you the other day.' externalRef: Coffee w/ Mo on 10 March 22 completed: true - - id: 'https://openpayments.guide/alice/incoming-payments/32abc219-3dc3-44ec-a225-790cacfca8fa' + - id: 'https://openpayments.guide/incoming-payments/32abc219-3dc3-44ec-a225-790cacfca8fa' walletAddress: 'https://openpayments.guide/alice/' receivedAmount: value: '100' @@ -249,7 +249,7 @@ paths: hasPreviousPage: true hasNextPage: false result: - - id: 'https://openpayments.guide/alice/incoming-payments/32abc219-3dc3-44ec-a225-790cacfca8fa' + - id: 'https://openpayments.guide/incoming-payments/32abc219-3dc3-44ec-a225-790cacfca8fa' walletAddress: 'https://openpayments.guide/alice/' receivedAmount: value: '100' @@ -262,8 +262,9 @@ paths: updatedAt: '2022-04-01T10:24:36.11Z' metadata: description: 'I love your website, Alice! Thanks for the great content' - - id: 'https://openpayments.guide/alice/incoming-payments/016da9d5-c9a4-4c80-a354-86b915a04ff8' + - id: 'https://openpayments.guide/incoming-payments/016da9d5-c9a4-4c80-a354-86b915a04ff8' walletAddress: 'https://openpayments.guide/alice/' + paymentPointer: 'https://openpayments.guide/alice/' incomingAmount: value: '250' assetCode: USD @@ -309,7 +310,7 @@ paths: examples: New Fixed Send Outgoing Payment for $25: value: - id: 'https://openpayments.guide/alice/outgoing-payments/8c68d3cc-0a0f-4216-98b4-4fa44a6c88cf' + id: 'https://openpayments.guide/outgoing-payments/8c68d3cc-0a0f-4216-98b4-4fa44a6c88cf' walletAddress: 'https://openpayments.guide/alice/' failed: false receiver: 'https://openpayments.guide/bob/incoming-payments/48884225-b393-4872-90de-1b737e2491c2' @@ -339,7 +340,7 @@ paths: examples: Create an outgoing payment based on a quote: value: - quoteId: 'https://openpayments.guide/alice/quotes/ab03296b-0c8b-4776-b94e-7ee27d868d4d' + quoteId: 'https://openpayments.guide/quotes/ab03296b-0c8b-4776-b94e-7ee27d868d4d' metadata: externalRef: INV2022-02-0137 schema: @@ -395,8 +396,9 @@ paths: hasPreviousPage: false hasNextPage: true result: - - id: 'https://openpayments.guide/alice/outgoing-payments/8c68d3cc-0a0f-4216-98b4-4fa44a6c88cf' + - id: 'https://openpayments.guide/outgoing-payments/8c68d3cc-0a0f-4216-98b4-4fa44a6c88cf' walletAddress: 'https://openpayments.guide/alice/' + paymentPointer: 'https://openpayments.guide/alice/' failed: false receiver: 'https://openpayments.guide/aplusvideo/incoming-payments/45d495ad-b763-4882-88d7-aa14d261686e' receiveAmount: @@ -416,7 +418,7 @@ paths: metadata: description: APlusVideo subscription externalRef: 'customer: 847458475' - - id: 'https://openpayments.guide/alice/outgoing-payments/0cffa5a4-58fd-4cc8-8e01-7145c72bf07c' + - id: 'https://openpayments.guide/outgoing-payments/0cffa5a4-58fd-4cc8-8e01-7145c72bf07c' walletAddress: 'https://openpayments.guide/alice/' failed: false receiver: 'https://openpayments.guide/shoeshop/incoming-payments/2fe92c6f-ef0d-487c-8759-3784eae6bce9' @@ -445,7 +447,7 @@ paths: hasPreviousPage: true hasNextPage: false result: - - id: 'https://openpayments.guide/alice/outgoing-payments/0cffa5a4-58fd-4cc8-8e01-7145c72bf07c' + - id: 'https://openpayments.guide/outgoing-payments/0cffa5a4-58fd-4cc8-8e01-7145c72bf07c' walletAddress: 'https://openpayments.guide/alice/' failed: false receiver: 'https://openpayments.guide/shoeshop/incoming-payments/2fe92c6f-ef0d-487c-8759-3784eae6bce9' @@ -466,7 +468,7 @@ paths: metadata: description: Thank you for your purchase at ShoeShop! externalRef: INV2022-8943756 - - id: 'https://openpayments.guide/alice/outgoing-payments/8c68d3cc-0a0f-4216-98b4-4fa44a6c88cf' + - id: 'https://openpayments.guide/outgoing-payments/8c68d3cc-0a0f-4216-98b4-4fa44a6c88cf' walletAddress: 'https://openpayments.guide/alice/' failed: false receiver: 'https://openpayments.guide/aplusvideo/incoming-payments/45d495ad-b763-4882-88d7-aa14d261686e' @@ -516,7 +518,7 @@ paths: examples: New Fixed Send Quote for $25: value: - id: 'https://openpayments.guide/alice/quotes/8c68d3cc-0a0f-4216-98b4-4fa44a6c88cf' + id: 'https://openpayments.guide/quotes/8c68d3cc-0a0f-4216-98b4-4fa44a6c88cf' walletAddress: 'https://openpayments.guide/alice/' receiver: 'https://openpayments.guide/aplusvideo/incoming-payments/45d495ad-b763-4882-88d7-aa14d261686e' debitAmount: @@ -548,7 +550,7 @@ paths: assetScale: 2 Create fixed-receive-amount quote for $25: value: - receiver: 'https://openpayments.guide/alice/incoming-payments/37a0d0ee-26dc-4c66-89e0-01fbf93156f7' + receiver: 'https://openpayments.guide/incoming-payments/37a0d0ee-26dc-4c66-89e0-01fbf93156f7' receiveAmount: value: '2500' assetCode: USD @@ -612,7 +614,7 @@ paths: examples: Incoming Payment for $25 with $12.34 received so far: value: - id: 'https://openpayments.guide/alice/incoming-payments/2f1b0150-db73-49e8-8713-628baa4a17ff' + id: 'https://openpayments.guide/incoming-payments/2f1b0150-db73-49e8-8713-628baa4a17ff' walletAddress: 'https://openpayments.guide/alice/' incomingAmount: value: '2500' @@ -664,7 +666,7 @@ paths: examples: Completed Incoming Payment: value: - id: 'https://openpayments.guide/alice/incoming-payments/016da9d5-c9a4-4c80-a354-86b915a04ff8' + id: 'https://openpayments.guide/incoming-payments/016da9d5-c9a4-4c80-a354-86b915a04ff8' walletAddress: 'https://openpayments.guide/alice/' incomingAmount: value: '250' @@ -715,7 +717,7 @@ paths: id: 'https://openpayments.guide/bob/outgoing-payments/3859b39e-4666-4ce5-8745-72f1864c5371' walletAddress: 'https://openpayments.guide/bob/' failed: false - receiver: 'https://openpayments.guide/alice/incoming-payments/2f1b0150-db73-49e8-8713-628baa4a17ff' + receiver: 'https://openpayments.guide/incoming-payments/2f1b0150-db73-49e8-8713-628baa4a17ff' debitAmount: value: '2500' assetCode: USD @@ -763,7 +765,7 @@ paths: value: id: 'https://openpayments.guide/bob/quotes/3859b39e-4666-4ce5-8745-72f1864c5371' walletAddress: 'https://openpayments.guide/bob/' - receiver: 'https://openpayments.guide/alice/incoming-payments/2f1b0150-db73-49e8-8713-628baa4a17ff' + receiver: 'https://openpayments.guide/incoming-payments/2f1b0150-db73-49e8-8713-628baa4a17ff' debitAmount: value: '2500' assetCode: USD @@ -885,7 +887,7 @@ components: description: 'An **incoming payment** resource represents a payment that will be, is currently being, or has been received by the account.' type: object examples: - - id: 'https://openpayments.guide/alice/incoming-payments/016da9d5-c9a4-4c80-a354-86b915a04ff8' + - id: 'https://openpayments.guide/incoming-payments/016da9d5-c9a4-4c80-a354-86b915a04ff8' walletAddress: 'https://openpayments.guide/alice/' incomingAmount: value: '250' @@ -902,8 +904,9 @@ components: metadata: description: 'Hi Mo, this is for the cappuccino I bought for you the other day.' externalRef: Coffee w/ Mo on 10 March 22 - - id: 'https://openpayments.guide/alice/incoming-payments/456da9d5-c9a4-4c80-a354-86b915a04ff8' + - id: 'https://openpayments.guide/incoming-payments/456da9d5-c9a4-4c80-a354-86b915a04ff8' walletAddress: 'https://openpayments.guide/alice/' + paymentPointer: 'https://openpayments.guide/alice/' incomingAmount: value: '2500' assetCode: USD @@ -963,7 +966,7 @@ components: description: An **incoming payment** resource with the Interledger STREAM Connection to use to pay into the wallet address under this incoming payment. type: object examples: - - id: 'https://openpayments.guide/alice/incoming-payments/016da9d5-c9a4-4c80-a354-86b915a04ff8' + - id: 'https://openpayments.guide/incoming-payments/016da9d5-c9a4-4c80-a354-86b915a04ff8' walletAddress: 'https://openpayments.guide/alice/' incomingAmount: value: '250' @@ -996,7 +999,7 @@ components: description: An **incoming payment** resource with the url for the Interledger STREAM Connection resource to use to pay into the wallet address under this incoming payment. type: object examples: - - id: 'https://openpayments.guide/alice/incoming-payments/456da9d5-c9a4-4c80-a354-86b915a04ff8' + - id: 'https://openpayments.guide/incoming-payments/456da9d5-c9a4-4c80-a354-86b915a04ff8' walletAddress: 'https://openpayments.guide/alice/' incomingAmount: value: '2500' @@ -1039,7 +1042,7 @@ components: description: 'An **outgoing payment** resource represents a payment that will be, is currently being, or has previously been, sent from the wallet address.' type: object examples: - - id: 'https://openpayments.guide/alice/outgoing-payments/8c68d3cc-0a0f-4216-98b4-4fa44a6c88cf' + - id: 'https://openpayments.guide/outgoing-payments/8c68d3cc-0a0f-4216-98b4-4fa44a6c88cf' walletAddress: 'https://openpayments.guide/alice/' failed: false receiver: 'https://openpayments.guide/aplusvideo/incoming-payments/45d495ad-b763-4882-88d7-aa14d261686e' @@ -1060,7 +1063,7 @@ components: metadata: description: APlusVideo subscription externalRef: 'customer: 847458475' - - id: 'https://openpayments.guide/alice/outgoing-payments/0cffa5a4-58fd-4cc8-8e01-7145c72bf07c' +] - id: 'https://openpayments.guide/outgoing-payments/0cffa5a4-58fd-4cc8-8e01-7145c72bf07c' walletAddress: 'https://openpayments.guide/alice/' failed: false receiver: 'https://openpayments.guide/shoeshop/2fe92c6f-ef0d-487c-8759-3784eae6bce9' @@ -1135,7 +1138,7 @@ components: description: A **quote** resource represents the quoted amount details with which an Outgoing Payment may be created. type: object examples: - - id: 'https://openpayments.guide/alice/quotes/ab03296b-0c8b-4776-b94e-7ee27d868d4d' + - id: 'https://openpayments.guide/quotes/ab03296b-0c8b-4776-b94e-7ee27d868d4d' walletAddress: 'https://openpayments.guide/alice/' receiver: 'https://openpayments.guide/shoeshop/incoming-payments/2fe92c6f-ef0d-487c-8759-3784eae6bce9' receiveAmount: @@ -1152,7 +1155,7 @@ components: assetScale: 2 createdAt: '2022-03-12T23:20:50.52Z' expiresAt: '2022-04-12T23:20:50.52Z' - - id: 'https://openpayments.guide/alice/quotes/8c68d3cc-0a0f-4216-98b4-4fa44a6c88cf' + - id: 'https://openpayments.guide/quotes/8c68d3cc-0a0f-4216-98b4-4fa44a6c88cf' walletAddress: 'https://openpayments.guide/alice/' receiver: 'https://openpayments.guide/aplusvideo/incoming-payments/45d495ad-b763-4882-88d7-aa14d261686e' debitAmount: diff --git a/openapi/schemas.yaml b/openapi/schemas.yaml index 8a14d434..a31d1ac5 100644 --- a/openapi/schemas.yaml +++ b/openapi/schemas.yaml @@ -44,5 +44,5 @@ components: format: uri pattern: '^https://(.+)/(incoming-payments|connections)/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$' examples: - - 'https://openpayments.guide/alice/incoming-payments/08394f02-7b7b-45e2-b645-51d04e7c330c' + - 'https://openpayments.guide/incoming-payments/08394f02-7b7b-45e2-b645-51d04e7c330c' - 'https://openpayments.guide/connections/016da9d5-c9a4-4c80-a354-86b915a04ff8' diff --git a/packages/openapi/src/middleware.test.ts b/packages/openapi/src/middleware.test.ts index 2827385a..2cf73b20 100644 --- a/packages/openapi/src/middleware.test.ts +++ b/packages/openapi/src/middleware.test.ts @@ -34,7 +34,7 @@ export function createContext( return ctx as T } -const PATH = '/{accountId}/incoming-payments' +const PATH = '/incoming-payments' const SPEC = 'https://github.com/interledger/open-payments/raw/3930448672cfc678ec2bc02938566a316d83871c/open-api-spec.yaml' From 46ddbd883004ce8a072bd53e97db61b43f47dacb Mon Sep 17 00:00:00 2001 From: Nathan Lie Date: Thu, 21 Sep 2023 00:15:02 -0700 Subject: [PATCH 3/8] feat: add changeset --- .changeset/moody-students-greet.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/moody-students-greet.md diff --git a/.changeset/moody-students-greet.md b/.changeset/moody-students-greet.md new file mode 100644 index 00000000..f2774d37 --- /dev/null +++ b/.changeset/moody-students-greet.md @@ -0,0 +1,5 @@ +--- +'@interledger/openapi': minor +--- + +Removed payment pointer/wallet address from resource urls From d6a7fc6147fd538011b2acc905d5e71e121d7253 Mon Sep 17 00:00:00 2001 From: Nathan Lie Date: Thu, 21 Sep 2023 00:51:49 -0700 Subject: [PATCH 4/8] feat: remove accountId from most tests --- packages/openapi/src/middleware.test.ts | 47 ++++--------------------- 1 file changed, 6 insertions(+), 41 deletions(-) diff --git a/packages/openapi/src/middleware.test.ts b/packages/openapi/src/middleware.test.ts index 2cf73b20..50c11c0f 100644 --- a/packages/openapi/src/middleware.test.ts +++ b/packages/openapi/src/middleware.test.ts @@ -66,29 +66,6 @@ describe('OpenAPI Validator', (): void => { next = jest.fn() }) - test.each` - accountId | message | description - ${undefined} | ${"must have required property 'accountId'"} | ${'missing'} - ${2} | ${'accountId must be string'} | ${'invalid'} - `( - 'returns 400 on $description path parameter', - async ({ accountId, message }): Promise => { - const ctx = createContext( - { - headers: { Accept: 'application/json' } - }, - { - accountId - } - ) - await expect(validateListMiddleware(ctx, next)).rejects.toMatchObject({ - status: 400, - message - }) - expect(next).not.toHaveBeenCalled() - } - ) - test('coerces query parameter type', async (): Promise => { const first = 5 const next = jest.fn().mockImplementation(() => { @@ -100,9 +77,7 @@ describe('OpenAPI Validator', (): void => { headers: { Accept: 'application/json' }, url: `${PATH}?first=${first}` }, - { - accountId - } + {} ) await expect(validateListMiddleware(ctx, next)).resolves.toBeUndefined() expect(next).toHaveBeenCalled() @@ -114,9 +89,7 @@ describe('OpenAPI Validator', (): void => { headers: { Accept: 'application/json' }, url: `${PATH}?first=NaN` }, - { - accountId - } + {} ) await expect(validateListMiddleware(ctx, next)).rejects.toMatchObject({ status: 400, @@ -136,9 +109,7 @@ describe('OpenAPI Validator', (): void => { { headers }, - { - accountId - } + {} ) await expect(validatePostMiddleware(ctx, next)).rejects.toMatchObject({ status, @@ -167,9 +138,7 @@ describe('OpenAPI Validator', (): void => { 'Content-Type': 'application/json' } }, - { - accountId - } + {} ) ctx.request.body = body await expect(validatePostMiddleware(ctx, next)).rejects.toMatchObject({ @@ -187,9 +156,7 @@ describe('OpenAPI Validator', (): void => { Accept: 'application/json' } }, - { - accountId - } + {} ) const next = jest.fn().mockImplementation(() => { expect(ctx.request.query).toEqual({ @@ -228,9 +195,7 @@ describe('OpenAPI Validator', (): void => { 'Content-Type': 'application/json' } }, - { - accountId - } + {} ) ctx.request.body = {} const next = jest.fn().mockImplementation(() => { From d688337b99747909df412cd06f1737a562f96d7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96mer=20Talha=20=C3=96zdemir?= Date: Thu, 21 Sep 2023 15:59:16 +0300 Subject: [PATCH 5/8] fix(spec): disallow additional properties in the response --- openapi/resource-server.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/openapi/resource-server.yaml b/openapi/resource-server.yaml index c55a0958..5c97d920 100644 --- a/openapi/resource-server.yaml +++ b/openapi/resource-server.yaml @@ -886,6 +886,7 @@ components: title: Incoming Payment description: 'An **incoming payment** resource represents a payment that will be, is currently being, or has been received by the account.' type: object + additionalProperties: false examples: - id: 'https://openpayments.guide/incoming-payments/016da9d5-c9a4-4c80-a354-86b915a04ff8' walletAddress: 'https://openpayments.guide/alice/' From 9438c4ff20327a344161e972af5e850d8fca1a47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96mer=20Talha=20=C3=96zdemir?= Date: Thu, 21 Sep 2023 16:02:28 +0300 Subject: [PATCH 6/8] feat(spec): set default and maximum values for pagination --- openapi/resource-server.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/openapi/resource-server.yaml b/openapi/resource-server.yaml index 5c97d920..df5a394a 100644 --- a/openapi/resource-server.yaml +++ b/openapi/resource-server.yaml @@ -1308,6 +1308,8 @@ components: schema: type: integer minimum: 1 + maximum: 100 + default: 10 name: first in: query description: The number of items to return after the cursor. @@ -1315,6 +1317,8 @@ components: schema: type: integer minimum: 1 + maximum: 100 + default: 10 name: last in: query description: The number of items to return before the cursor. From e0834ce55da906e453400f54bd902184ba3fd07f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96mer=20Talha=20=C3=96zdemir?= Date: Thu, 21 Sep 2023 16:08:09 +0300 Subject: [PATCH 7/8] feat(tests): bump resource server spec version --- packages/openapi/src/middleware.test.ts | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/packages/openapi/src/middleware.test.ts b/packages/openapi/src/middleware.test.ts index 50c11c0f..638d26a7 100644 --- a/packages/openapi/src/middleware.test.ts +++ b/packages/openapi/src/middleware.test.ts @@ -4,6 +4,7 @@ import { v4 as uuid } from 'uuid' import { createOpenAPI, OpenAPI, HttpMethod } from './' import { createValidatorMiddleware } from './middleware' +import * as path from 'path' declare module 'koa' { interface Request { @@ -35,8 +36,7 @@ export function createContext( } const PATH = '/incoming-payments' -const SPEC = - 'https://github.com/interledger/open-payments/raw/3930448672cfc678ec2bc02938566a316d83871c/open-api-spec.yaml' +const SPEC = path.resolve(__dirname, '../../../openapi/resource-server.yaml') describe('OpenAPI Validator', (): void => { let openApi: OpenAPI @@ -79,6 +79,7 @@ describe('OpenAPI Validator', (): void => { }, {} ) + addTestSignatureHeaders(ctx) await expect(validateListMiddleware(ctx, next)).resolves.toBeUndefined() expect(next).toHaveBeenCalled() }) @@ -91,6 +92,7 @@ describe('OpenAPI Validator', (): void => { }, {} ) + addTestSignatureHeaders(ctx) await expect(validateListMiddleware(ctx, next)).rejects.toMatchObject({ status: 400, message: 'first must be integer' @@ -111,6 +113,7 @@ describe('OpenAPI Validator', (): void => { }, {} ) + addTestSignatureHeaders(ctx) await expect(validatePostMiddleware(ctx, next)).rejects.toMatchObject({ status, message @@ -140,6 +143,7 @@ describe('OpenAPI Validator', (): void => { }, {} ) + addTestSignatureHeaders(ctx) ctx.request.body = body await expect(validatePostMiddleware(ctx, next)).rejects.toMatchObject({ status: 400, @@ -152,12 +156,11 @@ describe('OpenAPI Validator', (): void => { test('sets default query params and calls next on valid request', async (): Promise => { const ctx = createContext( { - headers: { - Accept: 'application/json' - } + headers: { Accept: 'application/json' } }, {} ) + addTestSignatureHeaders(ctx) const next = jest.fn().mockImplementation(() => { expect(ctx.request.query).toEqual({ first: 10, @@ -171,7 +174,7 @@ describe('OpenAPI Validator', (): void => { const body = { id: `https://${accountId}/incoming-payments/${uuid()}`, - accountId: `https://${accountId}`, + paymentPointer: 'https://openpayments.guide/alice', receivedAmount: { value: '0', assetCode: 'USD', @@ -183,8 +186,8 @@ describe('OpenAPI Validator', (): void => { test.each` status | body | message | description ${202} | ${{}} | ${'An unknown status code was used and no default was provided.'} | ${'status code'} - ${201} | ${{ ...body, invalid: 'field' }} | ${'response must NOT have additional properties: invalid'} | ${'body'} - ${201} | ${{ ...body, receivedAmount: { ...body.receivedAmount, value: '-1' } }} | ${'response.receivedAmount.value must match format "uint64"'} | ${'body'} + ${201} | ${{ ...body, invalid: 'field' }} | ${'response must NOT have additional properties: invalid'} | ${'body with additional property'} + ${201} | ${{ ...body, receivedAmount: { ...body.receivedAmount, value: '-1' } }} | ${'response.receivedAmount.value must match format "uint64"'} | ${'body with invalid type'} `( 'returns 500 on invalid response $description', async ({ status, body, message }): Promise => { @@ -197,6 +200,7 @@ describe('OpenAPI Validator', (): void => { }, {} ) + addTestSignatureHeaders(ctx) ctx.request.body = {} const next = jest.fn().mockImplementation(() => { ctx.status = status @@ -211,3 +215,8 @@ describe('OpenAPI Validator', (): void => { ) }) }) + +function addTestSignatureHeaders(ctx: Koa.Context) { + ctx.request.headers['Signature-Input'] = 'test signature input' + ctx.request.headers['Signature'] = 'test signature' +} From 5e5ec2c341052fc60b088da3b66622bd16e8229c Mon Sep 17 00:00:00 2001 From: Nathan Lie Date: Fri, 22 Sep 2023 00:21:32 -0700 Subject: [PATCH 8/8] feat: remove paymentPointer --- openapi/resource-server.yaml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/openapi/resource-server.yaml b/openapi/resource-server.yaml index df5a394a..75c8bda7 100644 --- a/openapi/resource-server.yaml +++ b/openapi/resource-server.yaml @@ -264,7 +264,6 @@ paths: description: 'I love your website, Alice! Thanks for the great content' - id: 'https://openpayments.guide/incoming-payments/016da9d5-c9a4-4c80-a354-86b915a04ff8' walletAddress: 'https://openpayments.guide/alice/' - paymentPointer: 'https://openpayments.guide/alice/' incomingAmount: value: '250' assetCode: USD @@ -398,7 +397,6 @@ paths: result: - id: 'https://openpayments.guide/outgoing-payments/8c68d3cc-0a0f-4216-98b4-4fa44a6c88cf' walletAddress: 'https://openpayments.guide/alice/' - paymentPointer: 'https://openpayments.guide/alice/' failed: false receiver: 'https://openpayments.guide/aplusvideo/incoming-payments/45d495ad-b763-4882-88d7-aa14d261686e' receiveAmount: @@ -886,7 +884,6 @@ components: title: Incoming Payment description: 'An **incoming payment** resource represents a payment that will be, is currently being, or has been received by the account.' type: object - additionalProperties: false examples: - id: 'https://openpayments.guide/incoming-payments/016da9d5-c9a4-4c80-a354-86b915a04ff8' walletAddress: 'https://openpayments.guide/alice/' @@ -1064,7 +1061,7 @@ components: metadata: description: APlusVideo subscription externalRef: 'customer: 847458475' -] - id: 'https://openpayments.guide/outgoing-payments/0cffa5a4-58fd-4cc8-8e01-7145c72bf07c' + - id: 'https://openpayments.guide/outgoing-payments/0cffa5a4-58fd-4cc8-8e01-7145c72bf07c' walletAddress: 'https://openpayments.guide/alice/' failed: false receiver: 'https://openpayments.guide/shoeshop/2fe92c6f-ef0d-487c-8759-3784eae6bce9' @@ -1308,8 +1305,6 @@ components: schema: type: integer minimum: 1 - maximum: 100 - default: 10 name: first in: query description: The number of items to return after the cursor. @@ -1317,8 +1312,6 @@ components: schema: type: integer minimum: 1 - maximum: 100 - default: 10 name: last in: query description: The number of items to return before the cursor.