swag-payments/swagger.yaml
2016-09-09 16:20:38 +03:00

1293 lines
28 KiB
YAML

swagger: '2.0'
info:
version: 1.0.0
title: RBK Money Common API
description: "An API that implements System's entry point"
termsOfService: 'http://rbkmoney.com/'
contact:
name: Anton Kuranda
email: a.kuranda@rbkmoney.com
url: 'https://api.rbkmoney.com'
host: api.rbkmoney.com
basePath: /v1
schemes:
- https
consumes:
- application/json
produces:
- application/json
securityDefinitions:
bearer:
type: apiKey
name: Authorization
in: header
description: JWT token
security:
- bearer: []
responses:
NotFound:
description: Entity not found
schema:
$ref: '#/definitions/GeneralError'
BadRequest:
description: Illegal input for operation.
schema:
$ref: '#/definitions/LogicError'
parameters:
requestID:
name: X-Request-ID
in: header
description: Unique request identifier
required: true
type: string
paths:
'/processing/me':
get:
description: Get my party
operationId: getMyParty
tags:
- Parties
parameters:
- $ref: '#/parameters/requestID'
responses:
'200':
description: My party
schema:
$ref: '#/definitions/Party'
'/processing/me/suspend':
put:
description: Suspend my party
operationId: suspendMyParty
tags:
- Parties
parameters:
- $ref: '#/parameters/requestID'
responses:
'202':
description: Claim registered
schema:
type: object
required:
- claimID
properties:
claimID:
type: string
'/processing/me/activate':
put:
description: Activate my party
operationId: activateMyParty
tags:
- Parties
parameters:
- $ref: '#/parameters/requestID'
responses:
'202':
description: Claim registered
schema:
type: object
required:
- claimID
properties:
claimID:
type: string
'/processing/claims/{claimID}':
get:
description: Get claim by ID
operationId: getClaimByID
tags:
- Claims
parameters:
- $ref: '#/parameters/requestID'
- name: claimID
in: path
description: Claim ID
required: true
type: string
responses:
'200':
description: Claim found
schema:
$ref: '#/definitions/Claim'
'404':
$ref: '#/responses/NotFound'
'/processing/shops':
post:
description: Claim for creating a shop
operationId: createShop
tags:
- Shops
parameters:
- $ref: '#/parameters/requestID'
- name: createShopArgs
in: body
description: New shop params
required: true
schema:
$ref: '#/definitions/CreateShopArgs'
responses:
'202':
description: Claim registered
schema:
type: object
required:
- claimID
properties:
claimID:
type: string
'404':
$ref: '#/responses/NotFound'
'/processing/shops/{shopID}':
post:
description: Claim for updating the shop
operationId: updateShop
tags:
- Shops
parameters:
- $ref: '#/parameters/requestID'
- name: shopID
in: path
description: Shop ID
required: true
type: string
- name: updateShopArgs
in: body
description: Shop params for an update
required: true
schema:
$ref: '#/definitions/UpdateShopArgs'
responses:
'202':
description: Claim registered
schema:
type: object
required:
- claimID
properties:
claimID:
type: string
'404':
$ref: '#/responses/NotFound'
'400':
$ref: '#/responses/BadRequest'
'/processing/shops/{shopID}/suspend':
put:
description: Suspend shop
operationId: suspendShop
tags:
- Shops
parameters:
- $ref: '#/parameters/requestID'
- name: shopID
in: path
description: Shop ID
required: true
type: string
responses:
'202':
description: Claim registered
schema:
type: object
required:
- claimID
properties:
claimID:
type: string
'404':
$ref: '#/responses/NotFound'
'/processing/shops/{shopID}/activate':
put:
description: Activate shop
operationId: activateShop
tags:
- Shops
parameters:
- $ref: '#/parameters/requestID'
- name: shopID
in: path
description: Shop ID
required: true
type: string
responses:
'202':
description: Claim registered
schema:
type: object
required:
- claimID
properties:
claimID:
type: string
'404':
$ref: '#/responses/NotFound'
'/processing/accounts/{accountID}/balance':
get:
description: Get actual account balance
operationId: getAccountBalance
tags:
- Accounts
parameters:
- $ref: '#/parameters/requestID'
- name: accountID
in: path
description: Account ID
required: true
type: string
responses:
'200':
description: Account balance
schema:
$ref: '#/definitions/Balance'
'404':
$ref: '#/responses/NotFound'
'/processing/invoices':
post:
description: Create new invoice
tags:
- Invoices
operationId: createInvoice
parameters:
- $ref: '#/parameters/requestID'
- name: createInvoiceArgs
description: New invoice params
in: body
required: true
schema:
$ref: '#/definitions/CreateInvoiceArgs'
responses:
'201':
description: Invoice created
schema:
type: object
required:
- id
properties:
id:
type: string
'400':
$ref: '#/responses/BadRequest'
'/processing/invoices/{invoiceID}':
get:
description: Returns invoice information by ID
tags:
- Invoices
operationId: getInvoiceByID
parameters:
- $ref: '#/parameters/requestID'
- name: invoiceID
in: path
description: Invoice ID
required: true
type: string
responses:
'200':
description: Invoice object
schema:
$ref: '#/definitions/Invoice'
'404':
$ref: '#/responses/NotFound'
'400':
$ref: '#/responses/BadRequest'
'/processing/invoices/{invoiceID}/fulfill':
post:
description: Fullfill invoice
tags:
- Invoices
operationId: fulfillInvoice
parameters:
- $ref: '#/parameters/requestID'
- name: invoiceID
in: path
description: Invoice ID
required: true
type: string
- name: fulfillInvoice
in: body
description: Fulfill invoice params
required: true
schema:
$ref: '#/definitions/FulfillInvoice'
responses:
'200':
description: Invoice fullfilled
'400':
$ref: '#/responses/BadRequest'
'404':
$ref: '#/responses/NotFound'
'/processing/invoices/{invoiceID}/rescind':
post:
description: Rescind invoice
tags:
- Invoices
operationId: rescindInvoice
parameters:
- $ref: '#/parameters/requestID'
- name: invoiceID
in: path
description: Invoice ID
required: true
type: string
- name: rescindInvoice
in: body
description: Rescind invoice params
required: true
schema:
$ref: '#/definitions/RescindInvoice'
responses:
'200':
description: Invoice rescinded
'400':
$ref: '#/responses/BadRequest'
'404':
$ref: '#/responses/NotFound'
'/processing/invoices/{invoiceID}/events':
get:
description: Returns invoice events
tags:
- Invoices
operationId: getInvoiceEvents
parameters:
- $ref: '#/parameters/requestID'
- name: invoiceID
in: path
description: Invoice ID
required: true
type: string
- name: limit
in: query
description: Events limit
required: true
type: integer
format: int32
- name: eventID
in: query
description: Last seen event id
required: false
type: string
responses:
'200':
description: List of invoice events
schema:
type: array
items:
$ref: '#/definitions/Event'
'404':
$ref: '#/responses/NotFound'
'400':
$ref: '#/responses/BadRequest'
'/processing/invoices/{invoiceID}/payments':
post:
description: Start new payment
tags:
- Payments
operationId: createPayment
parameters:
- $ref: '#/parameters/requestID'
- name: invoiceID
in: path
description: Invoice ID
required: true
type: string
- name: createPaymentArgs
description: Invoice initiation request
in: body
required: true
schema:
$ref: '#/definitions/CreatePaymentArgs'
responses:
'201':
description: Payment created
schema:
type: object
required:
- id
properties:
id:
type: string
'404':
$ref: '#/responses/NotFound'
'400':
$ref: '#/responses/BadRequest'
'/processing/invoices/{invoiceID}/payments/{paymentID}':
get:
description: Get payment info
tags:
- Payments
operationId: getPaymentByID
parameters:
- $ref: '#/parameters/requestID'
- name: invoiceID
in: path
description: Invoice ID
required: true
type: string
- name: paymentID
in: path
description: Payment ID
required: true
type: string
responses:
'200':
description: Payment object
schema:
$ref: '#/definitions/Payment'
'404':
$ref: '#/responses/NotFound'
'400':
$ref: '#/responses/BadRequest'
'/processing/payment_tools':
post:
description: Create new card data token
tags:
- Tokens
operationId: createPaymentToolToken
parameters:
- $ref: '#/parameters/requestID'
- name: paymentTool
description: Payment tool args
in: body
required: true
schema:
$ref: '#/definitions/CreatePaymentToolTokenArgs'
responses:
'201':
description: Token created
schema:
type: object
required:
- token
- session
properties:
token:
type: string
session:
type: string
'400':
$ref: '#/responses/BadRequest'
'/analytics/shops/{shopID}/invoices':
get:
description: Search invoices
tags:
- Analytics
operationId: getInvoices
parameters:
- $ref: '#/parameters/requestID'
- name: shopID
in: path
description: Shop ID
required: true
type: string
- name: limit
in: query
description: Invoices selection limit
required: false
type: integer
- name: offset
in: query
description: Invoices selection offset (inclusive)
required: false
type: integer
- name: fromTime
in: query
description: Invoices created time from
required: false
type: string
format: date-time
- name: toTime
in: query
description: Invoices created time to
required: false
type: string
format: date-time
- name: status
in: query
description: Invoices statuses (disjunction)
required: false
type: array
items:
type: string
enum:
- unpaid
- cancelled
- paid
- refunded
- fulfilled
- name: invoiceID
in: query
description: Invoice ID
required: false
type: string
responses:
'200':
description: List of invoices
schema:
type: object
properties:
totalCount:
type: integer
invoices:
type: array
items:
$ref: '#/definitions/Invoice'
'404':
$ref: '#/responses/NotFound'
'400':
$ref: '#/responses/BadRequest'
'/analytics/shops/{shopID}/payments/stats/conversion':
get:
description: Get payments conversion info
tags:
- Analytics
operationId: getPaymentConversionStats
parameters:
- $ref: '#/parameters/requestID'
- name: shopID
in: path
description: Shop ID
required: true
type: string
- name: fromTime
in: query
description: Selection starting time
required: true
type: string
format: date-time
- name: toTime
in: query
description: Selecting ending time
required: true
type: string
format: date-time
- name: splitUnit
in: query
description: Split unit
required: true
type: string
enum:
- minute
- hour
- day
- week
- month
- year
- name: splitSize
in: query
description: Split interval size (must be positive)
required: true
type: integer
format: int32
responses:
'201':
description: List of payment conversion stats
schema:
type: array
items:
$ref: '#/definitions/PaymentConversionStat'
'404':
$ref: '#/responses/NotFound'
'400':
$ref: '#/responses/BadRequest'
'/analytics/shops/{shopID}/payments/stats/revenue':
get:
description: Get payments revenue info
tags:
- Analytics
operationId: getPaymentRevenueStats
parameters:
- $ref: '#/parameters/requestID'
- name: shopID
in: path
description: Shop ID
required: true
type: string
- name: fromTime
in: query
description: Selection starting time
required: true
type: string
format: date-time
- name: toTime
in: query
description: Selecting ending time
required: true
type: string
format: date-time
- name: splitUnit
in: query
description: Split unit
required: true
type: string
enum:
- minute
- hour
- day
- week
- month
- year
- name: splitSize
in: query
description: Split interval size (must be positive)
required: true
type: integer
format: int32
responses:
'201':
description: List of payment revenue stats
schema:
type: array
items:
$ref: '#/definitions/PaymentRevenueStat'
'404':
$ref: '#/responses/NotFound'
'400':
$ref: '#/responses/BadRequest'
'/analytics/shops/{shopID}/payments/stats/geo':
get:
description: Get payments geo info
tags:
- Analytics
operationId: getPaymentGeoStats
parameters:
- $ref: '#/parameters/requestID'
- name: shopID
in: path
description: Shop ID
required: true
type: string
- name: fromTime
in: query
description: Selection starting time
required: true
type: string
format: date-time
- name: toTime
in: query
description: Selecting ending time
required: true
type: string
format: date-time
- name: splitUnit
in: query
description: Split unit
required: true
type: string
enum:
- minute
- hour
- day
- week
- month
- year
- name: splitSize
in: query
description: Split interval size (must be positive)
required: true
type: integer
format: int32
responses:
'201':
description: List of payment geo stats
schema:
type: array
items:
$ref: '#/definitions/PaymentGeoStat'
'404':
$ref: '#/responses/NotFound'
'400':
$ref: '#/responses/BadRequest'
'/analytics/shops/{shopID}/customers/stats/rate':
get:
description: Get payments rate info
tags:
- Analytics
operationId: getPaymentRateStats
parameters:
- $ref: '#/parameters/requestID'
- name: shopID
in: path
description: Shop ID
required: true
type: string
- name: fromTime
in: query
description: Selection starting time
required: true
type: string
format: date-time
- name: toTime
in: query
description: Selecting ending time
required: true
type: string
format: date-time
responses:
'201':
description: Payment rate stats
schema:
$ref: '#/definitions/PaymentRateStat'
'404':
$ref: '#/responses/NotFound'
'400':
$ref: '#/responses/BadRequest'
definitions:
FulfillInvoice:
type: object
required:
- reason
properties:
reason:
type: string
RescindInvoice:
type: object
required:
- reason
properties:
reason:
type: string
Claim:
type: object
required:
- id
- status
- changeset
properties:
id:
type: string
status:
$ref: '#/definitions/ClaimStatus'
changeset:
$ref: '#/definitions/PartyChangeset'
PartyChangeset:
type: array
items:
$ref: '#/definitions/PartyModification'
PartyModification:
type: object
discriminator: modificationType
required:
- modificationType
properties:
modificationType:
type: string
PartySuspension:
type: object
allOf:
- $ref: '#/definitions/PartyModification'
- type: object
required:
- details
properties:
details:
$ref: '#/definitions/Suspension'
ShopCreation:
type: object
allOf:
- $ref: '#/definitions/PartyModification'
- type: object
required:
- shop
properties:
shop:
$ref: '#/definitions/Shop'
ShopModificationUnit:
type: object
allOf:
- $ref: '#/definitions/PartyModification'
- type: object
required:
- shopID
- details
properties:
shopID:
type: string
details:
$ref: '#/definitions/ShopModification'
ShopModification:
type: object
discriminator: modificationType
required:
- modificationType
properties:
modificationType:
type: string
ShopSuspension:
type: object
allOf:
- $ref: '#/definitions/ShopModification'
- type: object
required:
- details
properties:
details:
$ref: '#/definitions/Suspension'
ShopUpdate:
type: object
allOf:
- $ref: '#/definitions/ShopModification'
- type: object
required:
- details
properties:
details:
$ref: '#/definitions/UpdateShopArgs'
Suspension:
type: object
required:
- suspensionType
properties:
suspensionType:
type: string
enum:
- active
- suspended
ClaimStatus:
type: object
discriminator: status
required:
- status
properties:
status:
type: string
ClaimPending:
type: object
allOf:
- $ref: '#/definitions/ClaimStatus'
ClaimApproved:
type: object
allOf:
- $ref: '#/definitions/ClaimStatus'
ClaimDenied:
type: object
allOf:
- $ref: '#/definitions/ClaimStatus'
- type: object
required:
- reason
properties:
reason:
type: string
CreateShopArgs:
type: object
required:
- category
- shopDetails
properties:
category:
$ref: '#/definitions/Category'
shopDetails:
$ref: '#/definitions/ShopDetails'
contractor:
$ref: '#/definitions/Contractor'
ShopDetails:
type: object
required:
- name
properties:
name:
type: string
description:
type: string
location:
type: string
UpdateShopArgs:
properties:
category:
$ref: '#/definitions/Category'
contractor:
$ref: '#/definitions/Contractor'
shopDetails:
$ref: '#/definitions/ShopDetails'
Contractor:
type: object
required:
- registeredName
- legalEntity
properties:
registeredName:
type: string
legalEntity:
type: string
Category:
type: object
required:
- name
properties:
name:
type: string
description:
type: string
Party:
type: object
required:
- partyID
- isBlocked
- isSuspended
- shops
properties:
partyID:
type: string
isBlocked:
type: boolean
isSuspended:
type: boolean
shops:
type: array
items:
$ref: '#/definitions/Shop'
Shop:
type: object
required:
- shopID
- isBlocked
- isSuspended
- categoryRef
- shopDetails
- contractor
properties:
shopID:
type: string
isBlocked:
type: boolean
isSuspended:
type: boolean
categoryRef:
type: integer
format: int32
shopDetails:
$ref: '#/definitions/ShopDetails'
contractor:
$ref: '#/definitions/Contractor'
contract:
$ref: '#/definitions/ShopContract'
ShopContract:
type: object
required:
- number
- systemContractorRef
- concludedAt
- validSince
- validUntil
properties:
number:
type: string
systemContractorRef:
type: string
concludedAt:
type: string
format: date-time
validSince:
type: string
format: date-time
validUntil:
type: string
format: date-time
terminatedAt:
type: string
format: date-time
PaymentConversionStat:
type: object
required:
- offset
- successfulCount
- totalCount
- conversion
properties:
offset:
type: integer
successfulCount:
type: integer
totalCount:
type: integer
conversion:
type: number
PaymentRateStat:
type: object
required:
- uniqueCount
properties:
uniqueCount:
type: integer
PaymentGeoStat:
type: object
required:
- offset
- cityName
- currency
- profit
- revenue
properties:
offset:
type: integer
cityName:
type: string
currency:
type: string
profit:
type: integer
revenue:
type: integer
PaymentRevenueStat:
type: object
required:
- offset
- currency
- profit
- revenue
properties:
offset:
type: integer
currency:
type: string
profit:
type: integer
revenue:
type: integer
Balance:
type: object
required:
- balance
properties:
balance:
type: integer
CreatePaymentToolTokenArgs:
type: object
required:
- paymentTool
- clientInfo
properties:
paymentTool:
$ref: '#/definitions/PaymentTool'
clientInfo:
$ref: '#/definitions/ClientInfo'
PaymentTool:
type: object
discriminator: paymentToolType
properties:
paymentToolType:
type: string
required:
- paymentToolType
CardData:
type: object
allOf:
- $ref: '#/definitions/PaymentTool'
- type: object
required:
- cardNumber
- expDate
- cvv
properties:
cardHolder:
type: string
cardNumber:
type: string
pattern: ^\d{10,19}$
expDate:
type: string
pattern: ^\d{2}\/\d{2}$
cvv:
type: string
pattern: ^\d{3,4}$
Invoice:
type: object
required:
- shopID
- amount
- currency
- context
- product
properties:
id:
type: string
shopID:
type: string
amount:
type: integer
format: int64
currency:
type: string
context:
$ref: '#/definitions/InvoiceContext'
dueDate:
type: string
format: date-time
status:
type: string
enum:
- unpaid
- cancelled
- paid
- refunded
- fulfilled
product:
type: string
description:
type: string
CreateInvoiceArgs:
type: object
required:
- shopID
- amount
- currency
- product
properties:
shopID:
type: string
amount:
type: integer
format: int64
currency:
type: string
context:
$ref: '#/definitions/InvoiceContext'
dueDate:
type:
string
format:
date-time
product:
type: string
description:
type: string
CreatePaymentArgs:
type: object
required:
- paymentToolToken
- paymentSession
properties:
paymentToolToken:
type: string
paymentSession:
type: string
Payment:
type: object
required:
- id
- invoiceID
- createdAt
- status
- paymentToolToken
properties:
id:
type: string
invoiceID:
type: string
createdAt:
type: string
format: date-time
status:
type: string
enum:
- pending
- succeeded
- failed
paymentToolToken:
type: string
Event:
type: object
discriminator: eventType
required:
- id
- createdAt
- eventType
properties:
id:
type: integer
createdAt:
type: string
format: date-time
eventType:
type: string
EventInvoiceStatusChanged:
type: object
allOf:
- $ref: '#/definitions/Event'
- type: object
required:
- status
properties:
status:
type: string
enum:
- unpaid
- cancelled
- paid
- refunded
- fulfilled
EventPaymentStatusChanged:
type: object
allOf:
- $ref: '#/definitions/Event'
- type: object
required:
- status
- paymentID
properties:
paymentID:
type: string
status:
type: string
enum:
- pending
- succeeded
- failed
EventInvoiceCreated:
type: object
allOf:
- $ref: '#/definitions/Event'
- type: object
required:
- invoice
properties:
invoice:
$ref: '#/definitions/Invoice'
EventPaymentStarted:
type: object
allOf:
- $ref: '#/definitions/Event'
- type: object
required:
- payment
properties:
payment:
$ref: '#/definitions/Payment'
EventPaymentBound:
type: object
allOf:
- $ref: '#/definitions/Event'
- type: object
required:
- paymentID
properties:
paymentID:
type: string
GeneralError:
type: object
required:
- message
properties:
message:
type: string
LogicError:
type: object
required:
- code
- message
properties:
code:
type: string
message:
type: string
InvoiceContext:
type: object
maxLength: 512
ClientInfo:
type: object
required:
- fingerprint
- ipAddress
properties:
fingerprint:
type: string
ipAddress:
type: string