Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FYLE-85ztpbya4-amex-enroll-api #352

Closed
wants to merge 2 commits into from
Closed
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
271 changes: 271 additions & 0 deletions reference/admin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8185,6 +8185,217 @@ components:
- matched_expenses
- last_user_matched_at
- metadata
amex_account_in:
type: object
additionalProperties: false
properties:
id:
$ref: '#/components/schemas/id_string'
example: amacwbl222wlg
nullable: true
created_at:
$ref: '#/components/schemas/created_at'
nullable: true
updated_at:
$ref: '#/components/schemas/updated_at'
nullable: true
user_id:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why we are using user_id and org_id in the request body... This should always be calculated from the auth token .

$ref: '#/components/schemas/user_id'
nullable: true
org_id:
$ref: '#/components/schemas/org_id'
nullable: true
business_name:
type: string
description: |
The name of the business.
example: Abcd Inc.
phone:
type: object
properties:
country_code:
type: string
description: |
The country code of the phone number.
example: '001'
number:
type: string
description: |
The phone number of the business.
example: '1232938490'
address:
type: object
properties:
line1:
type: string
description: |
The address of the organization.
example: 123 Main St.
line2:
type: string
description: |
The address line two of the organization, if applicable.
nullable: true
example: Suite A
city:
type: string
description: |
The city of the organzation's address.
example: San Francisco
state:
type: string
description: |
The state of the organzation's address.
example: CA
country:
type: string
description: |
The country of the organzation's address.
example: US
postal_code:
type: string
description: |
The postal code of the organzation's address.
example: '12345'
email_address:
type: string
description: |
The email address of the business.
example: [email protected]
amex_account_out:
type: object
additionalProperties: false
properties:
id:
$ref: '#/components/schemas/id_string'
example: amacwbl222wlg
created_at:
$ref: '#/components/schemas/created_at'
updated_at:
$ref: '#/components/schemas/updated_at'
user_id:
$ref: '#/components/schemas/user_id'
nullable: true
org_id:
$ref: '#/components/schemas/org_id'
nullable: true
business_name:
type: string
description: |
The name of the business.
example: Abcd Inc.
phone:
type: object
properties:
country_code:
type: string
description: |
The country code of the phone number.
example: '001'
number:
type: string
description: |
The phone number of the business.
example: '1232938490'
address:
type: object
properties:
line1:
type: string
description: |
The address of the organization.
example: 123 Main St.
line2:
type: string
description: |
The address line two of the organization, if applicable.
nullable: true
example: Suite A
city:
type: string
description: |
The city of the organzation's address.
example: San Francisco
state:
type: string
description: |
The state of the organzation's address.
example: CA
country:
type: string
description: |
The country of the organzation's address.
example: US
postal_code:
type: string
description: |
The postal code of the organzation's address.
example: '12345'
email_address:
type: string
description: |
The email address of the business.
example: [email protected]
buyer_id:
type: string
description: |
The unique buyer id created for the organization by Amex.
example: obasdfasdfasdfds
widget_url:
type: string
description: |
The url of the widget to be embedded in the client application.
example: https://amex.com/asdfdsf
account_last_synced_at:
$ref: '#/components/schemas/timestamptz_utc'
nullable: true
description: |
Signifies when this card account was last synced at.
primary_account_number:
type: string
nullable: true
description: |
The last 5 digits primary card account number.
example: '33456'
account_verified_at:
$ref: '#/components/schemas/timestamptz_utc'
nullable: true
description: |
Signifies when this card account was verified at.
account_status:
type: string
enum:
- PENDING
- SUCCESS
- UNINITIALIZED
- FAILED
- DELETED
description: |
The status of the card account.
example: ACTIVE
account_error_message:
type: string
nullable: true
description: |
The error description provided by Amex on unsuccessfull account enrollment.
example: Invalid credentials
account_id:
type: string
nullable: true
description: |
The unique id for the card account provided by Amex.
example: acwbl222wlg
account_error_code:
type: string
nullable: true
description: |
The error code provided by Amex on unsuccessfull account enrollment.
example: '1023'
account_failed_at:
$ref: '#/components/schemas/timestamptz_utc'
nullable: true
description: |
Signifies when this card account was failed on unsuccessfull account enrollment.
settlement_out:
type: object
additionalProperties: false
Expand Down Expand Up @@ -16516,6 +16727,66 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/404'
/admin/amex_account/enroll:
post:
tags:
- Amex account
summary: Enroll amex account for a card
description: |
Enroll amex account for a card
operationId: amex_account_enroll
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
data:
$ref: '#/components/schemas/amex_account_in'
required:
- data
additionalProperties: false
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
data:
$ref: '#/components/schemas/amex_account_out'
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/400'
'401':
description: Unauthorized request
content:
application/json:
schema:
$ref: '#/components/schemas/401'
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/403'
'404':
description: Not Found
content:
application/json:
schema:
$ref: '#/components/schemas/404'
'500':
description: API Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/500'
/admin/settlements:
get:
tags:
Expand Down
4 changes: 4 additions & 0 deletions src/admin/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,10 @@ paths:
/admin/corporate_card_transactions/unmatch:
$ref: paths/admin@[email protected]

# Amex Feed
/admin/amex_account/enroll:
$ref: paths/admin@[email protected]

# /admin/suggestions/expenses:
# $ref: paths/admin@[email protected]
# /admin/suggestions/corporate_card_transactions:
Expand Down
59 changes: 59 additions & 0 deletions src/admin/paths/admin@[email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
post:
tags:
- Amex account
summary: Enroll amex account for a card
description: |
Enroll amex account for a card
operationId: amex_account_enroll
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
data:
$ref: ../../components/schemas/amex_feed.yaml#/amex_account_in
required:
- data
additionalProperties: False
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
data:
$ref: '../../components/schemas/amex_feed.yaml#/amex_account_out'
'400':
description: Bad request
content:
application/json:
schema:
$ref: '../../components/schemas/400.yaml'
'401':
description: Unauthorized request
content:
application/json:
schema:
$ref: '../../components/schemas/401.yaml'
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '../../components/schemas/403.yaml'
'404':
description: Not Found
content:
application/json:
schema:
$ref: '../../components/schemas/404.yaml'
'500':
description: API Server Error
content:
application/json:
schema:
$ref: ../../components/schemas/500.yaml
Loading