Skip to content

Instantly share code, notes, and snippets.

@rverma-jm
Created January 10, 2020 07:52
Show Gist options
  • Save rverma-jm/8225b101923226f50e64c9d98d206e95 to your computer and use it in GitHub Desktop.
Save rverma-jm/8225b101923226f50e64c9d98d206e95 to your computer and use it in GitHub Desktop.
lending
openapi: 3.0.2
info:
title: Jupiter Money - OpenAPI 3.0
description: "This is jupiter's core banking server based on the OpenAPI 3.0 specification"
termsOfService: http://swagger.io/terms/
contact:
email: rohit.verma@jupiter.money
license:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
version: 1.0.0
servers:
- url: "https://api.dev.jupiter.money"
- url: "https://api.jupiter.money"
tags:
- name: lending
description: Operations about lending
- name: banking
description: Operations about user
- name: payments
description: Operations about payments
- name: eligiblity
description: Operations about eligiblity
paths:
/len/v1/users/{userId}/eligiblity:
parameters:
- name: userId
in: path
description: "ID of user to run operations"
required: true
schema:
type: string
get:
summary: Get Eligiblity
operationId: get-users-eligiblity
tags:
- eligiblity
responses:
'2XX':
description: "Is not idempotent since if the user has not accepted terms we would be returning defaults.
\n\nWill give different result if called at different time of frame"
content:
application/json:
schema:
$ref: '#/components/schemas/CreditWorthiness'
examples:
firstCall:
value: {
"forCustomer": "rohitverma",
"consent": false,
"debts": [
{
"identifier": "loan1",
"amount": "1000",
"params":{
"charge": [
{
"identifier": "clf",
"values": "10"
},
{
"identifier": "cll",
"values": "50"
}
],
"period": [
{
"identifier": "loanTerm",
"temporalUnit": "MONTH",
"maximum" : 10,
"minimum": 1
},
{
"identifier": "gracePeriod",
"temporalUnit": "DAYS",
"maximum": 9,
"minimum": 2
}
]
}
}
]
}
secondCall:
value: {
"forCustomer": "string",
"consent": true,
"debts": [
{
"identifier": "loan1",
"amount": "1000",
"params":{
"charge": [
{
"identifier": "clf",
"values": "10"
},
{
"identifier": "cll",
"values": "50"a
}
],
"period": [
{
"identifier": "loanTerm",
"temporalUnit": "MONTH",
"maximum": 10,
"minimum": 1
},
{
"identifier": "gracePeriod",
"temporalUnit": "DAYS",
"maximum": 9,
"minimum": 2
}
]
}
}
]
}
patch:
summary: Update eligiblity consent
tags:
- eligiblity
operationId: put-users-eligiblity-consent
responses:
'2XX':
description: "This is to toggle the user consent"
/len/v1/users/{userId}/cases:
parameters:
- name: userId
in: path
description: "ID of user to run operations"
required: true
schema:
type: string
get:
summary: Get loans
description: "Pass status=active/no query param to get all active loans.
\n\nFor inactive or all pass status=inactive,all"
parameters:
- in: query
name: status
required: false
schema:
type: string
description: ""
tags:
- lending
responses:
'2XX':
description: "Allow user to get all loans"
links:
caseRepository:
$ref: '#/components/links/CaseRepository'
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Case'
operationId: getCases
/len/v1/users/{userId}/cases/{caseId}:
parameters:
- name: userId
in: path
description: "ID of user to run operations"
required: true
schema:
type: string
- name: caseId
in: path
description: "ID of case to return"
required: true
schema:
type: integer
format: int64
post:
tags:
- lending
responses:
'2XX':
description: description
content:
application/json:
schema:
$ref: '#/components/schemas/Case'
get:
summary: "Allow user to get a particular loan"
tags:
- lending
responses:
'2XX':
description: description
content:
application/json:
schema:
$ref: '#/components/schemas/Case'
operationId: getCase
components:
links:
CaseRepository:
# returns '#/components/schemas/Case'
operationId: getCase
parameters:
caseId: $response.body#/identifier/
schemas:
Case:
title: Case
type: object
properties:
identifier:
type: string
createdOn:
type: string
format: 'date-time'
lastModifiedOn:
type: string
format: 'date-time'
currentState:
type: string
creditWorthinessSnapshots:
type: array
items:
"$ref": '#/components/schemas/CreditWorthiness'
terms:
$ref: '#/components/schemas/Period'
charges:
$ref: '#/components/schemas/Charge'
productIdentifier:
type: string
CreditWorthiness:
title: CreditWorthiness
type: object
properties:
forCustomer:
type: string
consent:
type: boolean
debts:
type: array
items:
type: object
properties:
identifier:
type: string
amount:
type: number
params:
allOf:
- $ref: '#/components/schemas/Period'
- $ref: '#/components/schemas/Charge'
Charge:
title: Charge
properties:
charges:
type: array
items:
type: object
properties:
identifier:
type: string
name:
type: string
Period:
title: Period
properties:
period:
type: array
items:
type: object
properties:
temporalUnit:
type: string
enum: [MONTH,DAY,WEEK]
identifier:
type: string
maximum:
type: integer
minimum:
type: integer
# Payment:
# type: object
# properties:
# costComponents:
# type: array
# items:
# type: object
# properties:
# chargeIdentifier:
# type: string
# amount:
# type: number
# balanceAdjustments:
# type: object
# properties:
# pfi:
# type: number
# ofi:
# type: number
# ey:
# type: number
# dfi:
# type: number
# clp:
# type: number
# clf:
# type: number
# date:
# type: string
# format: nullable
# balances:
# type: object
# properties:
# pfi:
# type: number
# ofi:
# type: number
# ey:
# type: number
# clp:
# type: number
# dfi:
# type: number
# clf:
# type: number
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment