Skip to content

armgit / sure

Public Imported from GitHub
0

The personal finance app for everyone (by everyone)

Ruby

docs(api): sync openapi.yaml with merchants import and transfer fee fields (#2961)

Brandon Wolf41d4db38dcb1
diff --git a/docs/api/openapi.yaml b/docs/api/openapi.yaml
index 73fabdd6b4..427db5cce2 100644
--- a/docs/api/openapi.yaml
+++ b/docs/api/openapi.yaml
@@ -1005,6 +1005,23 @@ components:
updated_at:
type: string
format: date-time
+ MerchantImportResult:
+ type: object
+ required:
+ - imported
+ - skipped
+ - merchants
+ properties:
+ imported:
+ type: integer
+ description: Number of merchants successfully created
+ skipped:
+ type: integer
+ description: Number of rows skipped (duplicates or invalid)
+ merchants:
+ type: array
+ items:
+ "$ref": "#/components/schemas/MerchantDetail"
Tag:
type: object
required:
@@ -1566,6 +1583,20 @@ components:
notes:
type: string
nullable: true
+ source_fee_amount:
+ type: string
+ nullable: true
+ description: Fee charged to the source account
+ source_fee_currency:
+ type: string
+ nullable: true
+ destination_fee_amount:
+ type: string
+ nullable: true
+ description: Fee deducted from the destination account
+ destination_fee_currency:
+ type: string
+ nullable: true
inflow_transaction:
"$ref": "#/components/schemas/TransferTransactionSide"
outflow_transaction:
@@ -5729,6 +5760,45 @@ paths:
type: array
items:
"$ref": "#/components/schemas/MerchantDetail"
+ post:
+ summary: Import merchants from CSV
+ tags:
+ - Merchants
+ security:
+ - apiKeyAuth: []
+ parameters: []
+ responses:
+ '201':
+ description: merchants imported
+ content:
+ application/json:
+ schema:
+ "$ref": "#/components/schemas/MerchantImportResult"
+ '401':
+ description: unauthorized
+ content:
+ application/json:
+ schema:
+ "$ref": "#/components/schemas/ErrorResponse"
+ '422':
+ description: missing file or invalid CSV
+ content:
+ application/json:
+ schema:
+ "$ref": "#/components/schemas/ErrorResponse"
+ requestBody:
+ content:
+ multipart/form-data:
+ schema:
+ type: object
+ required:
+ - file
+ properties:
+ file:
+ type: string
+ format: binary
+ required: true
+ description: 'CSV file with columns: name* (required), color, website_url'
"/api/v1/merchants/{id}":
parameters:
- name: id
diff --git a/spec/requests/api/v1/merchants_spec.rb b/spec/requests/api/v1/merchants_spec.rb
index 6d161256a8..76ebcded41 100644
--- a/spec/requests/api/v1/merchants_spec.rb
+++ b/spec/requests/api/v1/merchants_spec.rb
@@ -54,8 +54,15 @@ RSpec.describe 'API V1 Merchants', type: :request do
consumes 'multipart/form-data'
produces 'application/json'
- parameter name: :file, in: :formData, type: :file, required: true,
- description: 'CSV file with columns: name* (required), color, website_url'
+ parameter name: :file, in: :formData, required: true,
+ description: 'CSV file with columns: name* (required), color, website_url',
+ schema: {
+ type: :object,
+ required: [ 'file' ],
+ properties: {
+ file: { type: :string, format: :binary }
+ }
+ }
response '201', 'merchants imported' do
schema '$ref' => '#/components/schemas/MerchantImportResult'