Skip to content

Instantly share code, notes, and snippets.

@eakmotion
Last active May 18, 2022 20:09
Show Gist options
  • Save eakmotion/5d5d04ca8a6ce7bbec5c5bdc4ccd8264 to your computer and use it in GitHub Desktop.
Save eakmotion/5d5d04ca8a6ce7bbec5c5bdc4ccd8264 to your computer and use it in GitHub Desktop.
openapi: 3.0.0
info:
title: Affiliate API
description: The Affiliate REST-based API. The API includes the following capabilities and operations...
version: '2.0'
servers:
- url: '{apiRoot}'
variables:
apiRoot:
default: https://affiliate-api.dev.mogo.dev
description: apiRoot
security:
- bearerAuth: []
paths:
/affiliates/offers:
get:
summary: Returns an affiliate offer
description: Provides an affiliate offer based on the affiliate code provided
operationId: AffiliateSignup
tags:
- Affiliates
parameters:
- name: affiliate_code
in: query
required: true
description: Unique ID of the affiliate offer
schema:
type: string
example: 5faac72b-c165-41ba-b19e-b61c1b3694b6
responses:
200:
description: Success
headers: {}
content:
application/json:
schema:
type: object
$ref: '#/components/schemas/AffiliateSignupResponse'
401:
description: Request failed. Received when a request is made with invalid JWT API credentials...
content:
application/json:
schema:
type: object
$ref: '#/components/schemas/UnauthorizedResponse'
post:
summary: Returns an affiliate offer
description: Create a new affiliate offer based on the JSON body properties provided...
operationId: AffiliatesOffers
tags:
- Affiliates
requestBody:
content:
application/json:
schema:
type: object
properties:
user:
$ref: '#/components/schemas/User'
employment:
$ref: '#/components/schemas/Employment'
banking:
$ref: '#/components/schemas/Banking'
required: true
responses:
200:
description: Success
content:
application/json:
schema:
type: object
$ref: '#/components/schemas/AffiliatesOffersResponse'
400:
description: Bad request.
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/AlreadyAMemberResponse'
- $ref: '#/components/schemas/AlreadyAnAffiliateError'
- $ref: '#/components/schemas/FailedToFindAffiliateResponse'
401:
description: Request failed. Received when a request is made with invalid JWT API credentials...
content:
application/json:
schema:
type: object
$ref: '#/components/schemas/UnauthorizedResponse'
components:
securitySchemes:
bearerAuth:
type: http
scheme: bearer
bearerFormat: JWT
schemas:
User:
type: object
required:
- first_name
- last_name
- email_address
- birth_date
- street_number
- street_name
- city
- province
- postal_code
- phone_number
- residential_status
- residential_monthly_costs
- requested_credit_amount
- credit_purpose"
properties:
first_name:
type: string
maximum: 25
description: The first_name schema
pattern: ^[A-Za-z\\-'.éàèùçâêîôûëöüœ ]+$
example: John
last_name:
type: string
maximum: 25
description: The first_name schema
pattern: ^[A-Za-z\\-'.éàèùçâêîôûëöüœ ]+$
example: Doe
email_address:
type: string
description: The email_address schema
example: johndoe@outlook.com
birth_date:
type: string
pattern: ^[0-9]{4}-[0-9]{2}-[0-9]{2}$
description: The birth_date schema
example: '2001-12-25'
suite:
type: string
minimum: 1
description: The suite schema
example: A4
street_number:
type: string
minimum: 1
description: The street_number schema
example: 555
street_name:
type: string
minimum: 1
description: The street_name schema
example: 'Dennis Street'
city:
type: string
minimum: 1
description: The city schema
example: 'SomeWhere'
province:
type: string
description: The province schema
enum: [
AB,
BC,
MB,
NB,
NL,
NT,
NS,
NU,
ON,
PE,
SK,
YT
]
example: ON
postal_code:
type: string
description: The postal_code schema
pattern: ^[ABCEGHJKLMNPRSTVXY]\\d[ABCEGHJKLMNPRSTVWXYZ]( )?\\d[ABCEGHJKLMNPRSTVWXYZ]\\d$
example: N0N0N0
phone_number:
type: string
description: The phone schema
pattern: ^\\d{10}$
example: 5555555555
residential_status:
type: string
description: The residential_status schema
enum: [
Rent,
Own,
Living with parents
]
example: Own
residential_monthly_costs:
type: number
description: The residential_monthly_cost schema
example: 250
requested_credit_amount:
type: integer
description: The requested_credit_amount schema
minimum: 1
example: 1000.0
credit_purpose:
type: string
description: The credit_purpose schema
enum: [
Credit Card Refinancing/Pay Off Credit Cards,
Debt Consolidation,
Home Improvements/Moving Expenses,
Car Financing/Loan,
Small Business Expense,
Vacation/Travel,
Tuition/Student Loans,
Emergency Loan,
Medical/Dental Expenses,
Household Expenses,
Other Purpose
]
example: Debt Consolidation
Employment:
type: object
description: The employment schema
required:
- name
- employment_type
- months_employed
- salary_type
- salary_frequency
- average_paycheck_amount
- last_pay_date
- next_pay_date
properties:
name:
type: string
minimum: 2
description: The name schema
example: Great Place to Work
employment_type:
type: string
description: The employment_type schema
enum: [
Part-Time,
Full-Time,
Contract,
Self-Employed,
Fixed Income,
Other
]
example: Full-Time
months_employed:
type: integer
description: The months_employed schema
minimum: 1
example: 22
salary_type:
type: string
description: The salary_type schema
enum: [
Salary,
Hourly
]
example: Hourly
salary_frequency:
type: string
description: The salary_frequency schema
enum: [
bi_weekly,
semi_monthly,
monthly,
weekly
]
example: bi_weekly
average_paycheck_amount:
type: number
description: The average_paycheck_amount schema
minimum: 1
example: 1373.4
last_pay_date:
type: string
description: The last_pay_date schema
example: '2022-01-27'
next_pay_date:
type: string
description: The next_pay_date schema
example: '2022-02-10'
Banking:
type: object
description: The banking schema
properties:
attributesRaw:
type: object
description: The attributesRaw schema
properties:
Card:
type: object
description: The Card schema
required:
- count_employer_income_30_days
- average_monthly_pension_income_complex
- average_monthly_debit
- sum_bankruptcy_payments
- sum_loan_deposits_30_days
- count_mortgage_payments_90_days
- average_monthly_custom_income
- count_nsf_30_days
- account_age_days
properties:
count_employer_income_30_days:
type: number
description: The count_employer_income_30_days schema
example: 4
average_monthly_pension_income_complex:
type: number
description: The average_monthly_pension_income_complex schema
example: 0
average_monthly_debit:
type: number
description: The average_monthly_debit schema
example: 25266.31
sum_bankruptcy_payments:
type: number
description: The sum_bankruptcy_payments schema
example: 0
sum_loan_deposits_30_days:
type: number
description: The sum_loan_deposits_30_days schema
example: 1100
count_mortgage_payments_90_days:
type: number
description: The count_mortgage_payments_90_days schema
example: 0
average_monthly_custom_income:
type: number
description: The average_monthly_custom_income schema
example: 36751.63
count_nsf_30_days:
type: number
description: The count_nsf_30_days schema
example: 0
account_age_days:
type: number
description: The account_age_days schema
example: 91
AffiliateSignupResponse:
title: AffiliateSignupResponse
type: object
properties:
email_address:
type: string
description: The email schema
example: person@gmail.com
first_name:
type: string
description: The first_name schema
example: John
last_name:
type: string
description: The last_name schema
example: Doe
offer:
type: object
properties:
amount:
type: number
description: The amount schema
example: 1000.0
apr:
type: number
description: The apr schema
example: 1
terms:
type: number
description: The terms schema
example: 1
estimated_payments:
type: number
description: The estimated_payments schema
example: 18.19
payment_frequency:
type: string
description: The payment_frequency schema
example: weekly
expires_at:
type: string
description: The expires_at schema
example: '2022-04-14T07:21:39.000Z'
is_expired:
type: boolean
description: The is_expired schema
example: false
AffiliatesOffersResponse:
title: AffiliatesOffersResponse
type: object
properties:
offer_available:
type: boolean
description: The offer_available schema
example: false
affiliate_code:
type: string
description: The affiliate_code schema
example: 3589a31d-d150-43d7-90c8-6c6d47a4a432
signup_url:
type: string
description: The signup_url schema
example: '{apiRoot}/affiliates/offers?affiliate_code=3589a31d-d150-43d7-90c8-6c6d47a4a432'
expires_at:
type: string
description: The expires_at schema
example: '2022-04-14T07:21:39.000Z'
offer:
type: object
properties:
amount:
type: number
description: The amount schema
example: 1000.0
estimated_payments:
type: number
description: The estimated_payments schema
example: 18.19
payment_frequency:
type: string
description: The payment_frequency schema
example: weekly
UnauthorizedResponse:
title: UnauthorizedResponse
type: object
properties:
code:
type: string
example: GN-000004
message:
type: string
example: Unauthorized
AlreadyAMemberResponse:
title: AlreadyAMemberResponse
type: object
properties:
code:
type: string
example: GN-000013
message:
type: string
example: Email address already associated to a Mogo member
AlreadyAnAffiliateError:
title: AlreadyAnAffiliateError
type: object
properties:
code:
type: string
example: GN-000015
message:
type: string
example: Email address already associated to an Affiliate offer
FailedToFindAffiliateResponse:
title: FailedToFindAffiliateResponse
type: object
properties:
code:
type: string
example: GN-000011
message:
type: string
example: Affiliate does not exist or an error occurred while retrieving it
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment