{
  "openapi": "3.0.3",
  "info": {
    "version": "1.0.0",
    "title": "Terms",
    "description": "This is OpenAPI Spec APIs for external partners to invoke the checkout process updating the terms to the order.",
    "contact": {
      "name": "Omni API Support",
      "email": "DL-OmniAdapter@att.com"
    }
  },
  "servers": [
    {
      "url": "https://partner-omni-apis.att.com/omni-svcs"
    }
  ],
  "tags": [
    {
      "name": "sales-operations",
      "description": "Sales Operation"
    }
  ],
  "paths": {
    "/v1/order/{orderid}/terms": {
      "post": {
        "tags": [
          "sales-operations"
        ],
        "description": "Update terms consent for an order",
        "summary": "Terms consent updates on the order",
        "operationId": "patchTerms",
        "parameters": [
          {
            "name": "orderid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Order ID"
          }
        ],
        "requestBody": {
          "description": "Terms request body",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "agreements": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string",
                          "description": "Agreement name"
                        },
                        "extensions": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "name": {
                                "type": "string",
                                "description": "Extension name"
                              },
                              "value": {
                                "type": "string",
                                "description": "Extension value"
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/TermsResponse"
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/responses/TermsResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/terms": {
      "post": {
        "tags": [
          "omni-svcs-term"
        ],
        "description": "Retrieve terms",
        "summary": "Retreive terms",
        "operationId": "RetreiveTerms",
        "requestBody": {
          "description": "Terms request body",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "orderId": {
                    "type": "string",
                    "example": "10-689838051878453"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Authentication success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/responses/TermsResponse"
                },
                "examples": {
                  "TermsResponse": {
                    "value": {
                      "agreements": [
                        {
                          "name": "string",
                          "extensions": [
                            {
                              "name": "string",
                              "value": "string"
                            }
                          ]
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "validation": {
                      "$ref": "#/components/schemas/Validation"
                    },
                    "error": {
                      "$ref": "#/components/schemas/Error"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "requestBodies": {
      "TermsRequestBody": {
        "description": "Terms request body",
        "required": true,
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "agreements": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string",
                        "description": "Agreement name"
                      },
                      "extensions": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "name": {
                              "type": "string",
                              "description": "Extension name"
                            },
                            "value": {
                              "type": "string",
                              "description": "Extension value"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "TermsRequest": {
        "description": "Terms request body",
        "required": true,
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "orderId": {
                  "type": "string",
                  "example": "10-689838051878453"
                }
              }
            }
          }
        }
      }
    },
    "responses": {
      "TermsResponse": {
        "description": "Terms response",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "validation": {
                  "$ref": "#/components/schemas/Validation"
                },
                "error": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "errorCode": {
            "type": "string",
            "example": "<400-INVALID-REQUEST>"
          },
          "errorDescription": {
            "type": "string",
            "example": "Validation Failure"
          },
          "errorList": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "action": {
                  "type": "string",
                  "example": "terms",
                  "description": "Holds the action that is being perfomed causing the error"
                },
                "errorCode": {
                  "type": "string",
                  "example": "TERMS-XXX"
                },
                "errorDescription": {
                  "type": "string",
                  "example": "TERMS xxx"
                },
                "errorDetails": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "system": {
                        "type": "string",
                        "example": "DTAP"
                      },
                      "errorCode": {
                        "type": "string",
                        "example": "DTAPXXX"
                      },
                      "errorDescription": {
                        "type": "string",
                        "example": "DTAPXXX"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "Validation": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "description": "Status of the order"
          },
          "readyToSubmit": {
            "type": "boolean",
            "description": "Indicates if the order is ready to submit"
          },
          "validationMessage": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "text": {
                  "type": "string",
                  "description": "Validation message text"
                },
                "type": {
                  "type": "string",
                  "description": "Component type"
                },
                "parameter": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string",
                        "description": "Holds the value for any line level error ids"
                      },
                      "value": {
                        "type": "string",
                        "description": "Value of the parameter name"
                      }
                    }
                  }
                }
              }
            }
          },
          "configuration": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "description": "Configuration type"
                },
                "status": {
                  "type": "string",
                  "description": "Configuration status"
                },
                "required": {
                  "type": "boolean",
                  "description": "Indicates if the configuration is required"
                },
                "postOrderConfigurable": {
                  "type": "boolean",
                  "description": "Indicates if the configuration is post-order configurable"
                }
              }
            }
          }
        }
      }
    }
  }
}