Skip to content

Instantly share code, notes, and snippets.

@arvindkgs
Created April 12, 2021 06:15
Show Gist options
  • Save arvindkgs/727dfb2055afeef79b6cc6cfb5f6328b to your computer and use it in GitHub Desktop.
Save arvindkgs/727dfb2055afeef79b6cc6cfb5f6328b to your computer and use it in GitHub Desktop.
swagger
---
openapi: 3.0.2
info:
title: billing
version: 1.0.0
description: Billing Service APIs
servers:
- url: http://localhost:8080/v1
description: Localhost
paths:
/customer:
post:
operationId: createBillingCustomer
summary: Path used to create new billing customer
description: Create new `billing customer` entity
tags:
- billing customer
requestBody:
description: Billing customer to be created
required: true
content:
application/json:
schema:
allOf:
- $ref: '#/components/schemas/BillingCustomer'
- type: object
required:
- user_id
- currency
- tenant_id
example:
user_id: 8c20738f-0fca-428f-b094-dfef23b24622
currency: USD
tenant_id: 8c20738f-0fca-428f-b094-dfef23zxc123
responses:
"201":
description: id of newly created billing customer
content:
application/json:
schema:
type: string
description: newly created billing customer id
/customer/{tenantId}:
summary: Path used to manage billing customer for given `tenantId`.
description: The REST endpoint/path used to list and update a `billing customer`
entities. This path contains a `GET` and `POST` operation to perform the list
and update tasks, respectively.
get:
operationId: getBillingCustomer
summary: Get Billing Customer
description: Gets a `billing customer` entity associated to given `tenantId`
tags:
- billing customer
parameters:
- name: tenantId
description: Tenant ID of billing customer
required: true
schema:
type: string
in: path
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/BillingCustomer'
description: Successful response - returns `BillingCustomer` associated with given tenant
put:
operationId: updateBillingCustomer
summary: Update Billing Customer
description: Update `BillingCustomer` associated with the given `tenantId`.
parameters:
- name: tenantId
description: Tenant ID of billing customer
required: true
schema:
type: string
in: path
requestBody:
description: Update `billing customer`
content:
application/json:
schema:
$ref: '#/components/schemas/BillingCustomer'
example:
user_id: 8c20738f-0fca-428f-b094-dfef23b24622
address_id: 8c20738f-0fca-428f-b094-dfef23qwe213
shipping_address_id: 8c20738f-0fca-428f-b094-dfef23qwe213
currency: USD
external_customer_id: 1234123412341234
tenant_id: 8c20738f-0fca-428f-b094-dfef23zxc123
subscription_id: 8c20738f-0fca-428f-b094-dfef23mnb098
external_default_payment_method_id: 1234123412341234
required: true
tags:
- billing customer
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/BillingCustomer'
description: Update successful response.
components:
schemas:
BillingCustomer:
title: Billing Customer
description: Billing customer DTO
type: object
properties:
id:
type: string
readOnly: true
user_id:
type: string
address_id:
type: string
shipping_address_id:
type: string
currency:
type: string
external_customer_id:
type: string
tenant_id:
type: string
subscription_id:
type: string
external_default_payment_method_id:
type: string
example:
id: 8c20738f-0fca-428f-b094-dfef23b24622
user_id: 8c20738f-0fca-428f-b094-dfef23b24622
address_id: 8c20738f-0fca-428f-b094-dfef23qwe213
shipping_address_id: 8c20738f-0fca-428f-b094-dfef23qwe213
currency: USD
external_customer_id: 1234123412341234
tenant_id: 8c20738f-0fca-428f-b094-dfef23zxc123
subscription_id: 8c20738f-0fca-428f-b094-dfef23mnb098
external_default_payment_method_id: 1234123412341234
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment