{
  "openapi": "3.0.4",
  "info": {
    "version": "1.0.0",
    "title": "Billing",
    "description": "This is OpenAPI Spec APIs for external partners to invoke the checkout process with the billing updates.",
    "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}/billing": {
      "post": {
        "tags": [
          "sales-operations"
        ],
        "description": "Billing updates for an order",
        "summary": "Billing updates on the order",
        "operationId": "updateBilling",
        "parameters": [
          {
            "name": "orderid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Order ID"
          }
        ],
        "requestBody": {
          "description": "Billing transaction request payload",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BillingRequest"
              },
              "examples": {
                "Billing_enrollment_withpaymentprofileid": {
                  "value": {
                    "enrollment": {
                      "autoPay": "enrolled",
                      "paperLess": "enrolled",
                      "paymentProfileId": ""
                    }
                  }
                },
                "Billing_enrollment_withoutautopaypayment": {
                  "value": {
                    "enrollment": {
                      "paperLess": "enrolled"
                    }
                  }
                },
                "Billing_enrollment_withautopay_createpaymentprofile": {
                  "value": {
                    "enrollment": {
                      "autoPay": "enrolled"
                    },
                    "payment": {
                      "paymentMethods": [
                        {
                          "id": "paymentmethod_1",
                          "amount": 1,
                          "Card": {
                            "cardNumber": 1234,
                            "cardHolderName": "",
                            "expireMonth": 12,
                            "expireYear": 2025,
                            "billingAddress": {
                              "zipCode": ""
                            }
                          },
                          "accountNumber": "123454",
                          "savePaymentProfile": true,
                          "storeTermsConditionConsent": true,
                          "tncId": "111",
                          "customerAgreement": "",
                          "profileOwnerId": "",
                          "profileName": ""
                        }
                      ]
                    }
                  }
                },
                "Billing_createpayment_withoutautopay_createpaymentprofile": {
                  "value": {
                    "payment": {
                      "paymentMethods": [
                        {
                          "id": "paymentmethod_1",
                          "amount": 1,
                          "Card": {
                            "cardNumber": 1234,
                            "cardHolderName": "",
                            "expireMonth": 12,
                            "expireYear": 2025,
                            "billingAddress": {
                              "zipCode": ""
                            }
                          },
                          "accountNumber": "123454",
                          "savePaymentProfile": true,
                          "storeTermsConditionConsent": true,
                          "tncId": "111",
                          "customerAgreement": "",
                          "profileOwnerId": "",
                          "profileName": ""
                        }
                      ]
                    }
                  }
                },
                "Billing_createpayment_withoutautopay_createpaymentbankaccount": {
                  "value": {
                    "payment": {
                      "paymentMethods": [
                        {
                          "id": "paymentmethod_1",
                          "amount": 1,
                          "bankAccount": {
                            "bankAccountNumber": 1234,
                            "accountHolderName": "",
                            "routingNumber": 12
                          },
                          "accountNumber": "123454",
                          "savePaymentProfile": true,
                          "storeTermsConditionConsent": true,
                          "tncId": "111",
                          "customerAgreement": "",
                          "profileOwnerId": "",
                          "profileName": ""
                        }
                      ]
                    }
                  }
                },
                "Billing_createpayment_withoutautopay_donotcreatepaymentprofile": {
                  "value": {
                    "payment": {
                      "paymentMethods": [
                        {
                          "id": "paymentmethod_1",
                          "amount": 1,
                          "Card": {
                            "cardNumber": 1234,
                            "cardHolderName": "",
                            "expireMonth": 12,
                            "expireYear": 2025,
                            "billingAddress": {
                              "zipCode": ""
                            }
                          },
                          "accountNumber": "123454",
                          "savePaymentProfile": false
                        }
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/BillingResponse"
          },
          "400": {
            "$ref": "#/components/responses/BillingErrorResponse"
          }
        }
      }
    }
  },
  "components": {
    "requestBodies": {
      "BillingRequest": {
        "description": "Billing transaction request payload",
        "required": true,
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/BillingRequest"
            },
            "examples": {
              "Billing_enrollment_withpaymentprofileid": {
                "value": {
                  "enrollment": {
                    "autoPay": "enrolled",
                    "paperLess": "enrolled",
                    "paymentProfileId": ""
                  }
                }
              },
              "Billing_enrollment_withoutautopaypayment": {
                "value": {
                  "enrollment": {
                    "paperLess": "enrolled"
                  }
                }
              },
              "Billing_enrollment_withautopay_createpaymentprofile": {
                "value": {
                  "enrollment": {
                    "autoPay": "enrolled"
                  },
                  "payment": {
                    "paymentMethods": [
                      {
                        "id": "paymentmethod_1",
                        "amount": 1,
                        "Card": {
                          "cardNumber": 1234,
                          "cardHolderName": "",
                          "expireMonth": 12,
                          "expireYear": 2025,
                          "billingAddress": {
                            "zipCode": ""
                          }
                        },
                        "accountNumber": "123454",
                        "savePaymentProfile": true,
                        "storeTermsConditionConsent": true,
                        "tncId": "111",
                        "customerAgreement": "",
                        "profileOwnerId": "",
                        "profileName": ""
                      }
                    ]
                  }
                }
              },
              "Billing_createpayment_withoutautopay_createpaymentprofile": {
                "value": {
                  "payment": {
                    "paymentMethods": [
                      {
                        "id": "paymentmethod_1",
                        "amount": 1,
                        "Card": {
                          "cardNumber": 1234,
                          "cardHolderName": "",
                          "expireMonth": 12,
                          "expireYear": 2025,
                          "billingAddress": {
                            "zipCode": ""
                          }
                        },
                        "accountNumber": "123454",
                        "savePaymentProfile": true,
                        "storeTermsConditionConsent": true,
                        "tncId": "111",
                        "customerAgreement": "",
                        "profileOwnerId": "",
                        "profileName": ""
                      }
                    ]
                  }
                }
              },
              "Billing_createpayment_withoutautopay_createpaymentbankaccount": {
                "value": {
                  "payment": {
                    "paymentMethods": [
                      {
                        "id": "paymentmethod_1",
                        "amount": 1,
                        "bankAccount": {
                          "bankAccountNumber": 1234,
                          "accountHolderName": "",
                          "routingNumber": 12
                        },
                        "accountNumber": "123454",
                        "savePaymentProfile": true,
                        "storeTermsConditionConsent": true,
                        "tncId": "111",
                        "customerAgreement": "",
                        "profileOwnerId": "",
                        "profileName": ""
                      }
                    ]
                  }
                }
              },
              "Billing_createpayment_withoutautopay_donotcreatepaymentprofile": {
                "value": {
                  "payment": {
                    "paymentMethods": [
                      {
                        "id": "paymentmethod_1",
                        "amount": 1,
                        "Card": {
                          "cardNumber": 1234,
                          "cardHolderName": "",
                          "expireMonth": 12,
                          "expireYear": 2025,
                          "billingAddress": {
                            "zipCode": ""
                          }
                        },
                        "accountNumber": "123454",
                        "savePaymentProfile": false
                      }
                    ]
                  }
                }
              }
            }
          }
        }
      }
    },
    "responses": {
      "BillingResponse": {
        "description": "Billing transaction update response ",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/BillingResponse"
            },
            "examples": {
              "Billing_enrollment_withoutautopaypayment_paperlessenrollment_response": {
                "value": {
                  "enrollment": {
                    "paperLess": "enrolled"
                  }
                }
              },
              "Billing_enrollment_withautopay_paperless_response": {
                "value": {
                  "enrollment": {
                    "paperLess": "enrolled",
                    "autoPay": "enrolled"
                  }
                }
              },
              "Billing_enrollment_withautopay_payment": {
                "value": {
                  "enrollment": {
                    "paperLess": "enrolled",
                    "autoPay": "enrolled"
                  },
                  "paymentResponse": [
                    {
                      "status": "success",
                      "paymentMethodId": "xxx"
                    }
                  ]
                }
              }
            }
          }
        }
      },
      "BillingErrorResponse": {
        "description": "Error Response body for Billing transaction",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "validation": {
                  "$ref": "#/components/schemas/Validation"
                },
                "error": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "schemas": {
      "BillingRequest": {
        "type": "object",
        "properties": {
          "enrollment": {
            "$ref": "#/components/schemas/Enrollment"
          },
          "payment": {
            "$ref": "#/components/schemas/Payment"
          }
        }
      },
      "BillingResponse": {
        "type": "object",
        "properties": {
          "enrollment": {
            "$ref": "#/components/schemas/Enrollment"
          },
          "payment": {
            "$ref": "#/components/schemas/PaymentResponse"
          }
        }
      },
      "Enrollment": {
        "type": "object",
        "properties": {
          "paymentMethodId": {
            "type": "string"
          },
          "paymentProfileId": {
            "type": "string"
          },
          "autoPay": {
            "type": "string"
          },
          "paperLess": {
            "type": "string"
          }
        }
      },
      "PaymentItemRequest": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "amount": {
              "type": "number"
            },
            "accountNumber": {
              "type": "string"
            },
            "rootBundleProductOrderItemId": {
              "type": "string",
              "description": "Item id for which payment is created"
            },
            "action": {
              "type": "string",
              "description": "Holds the value for which payment is made either debt,payup,payoff"
            }
          }
        }
      },
      "Payment": {
        "type": "object",
        "properties": {
          "paymentMethods": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "amount": {
                  "type": "number"
                },
                "storeTermsConditionConsent": {
                  "type": "boolean"
                },
                "tncId": {
                  "type": "string"
                },
                "customerAgreement": {
                  "type": "string"
                },
                "profileOwnerId": {
                  "type": "string"
                },
                "profileName": {
                  "type": "string"
                },
                "Card": {
                  "type": "object",
                  "properties": {
                    "cardNumber": {
                      "type": "number"
                    },
                    "expireMonth": {
                      "type": "integer"
                    },
                    "expireYear": {
                      "type": "integer"
                    },
                    "securityCode": {
                      "type": "integer"
                    },
                    "cardHolderName": {
                      "type": "string"
                    },
                    "verifyCardIndicator": {
                      "type": "boolean"
                    },
                    "billingAddress": {
                      "type": "object",
                      "properties": {
                        "zipCode": {
                          "type": "string"
                        }
                      }
                    }
                  }
                },
                "bankAccount": {
                  "type": "object",
                  "properties": {
                    "bankAccountNumber": {
                      "type": "integer"
                    },
                    "accountHolderName": {
                      "type": "string"
                    },
                    "routingNumber": {
                      "type": "integer"
                    },
                    "accountType": {
                      "type": "string"
                    }
                  }
                },
                "accountNumber": {
                  "type": "string"
                },
                "savePaymentProfile": {
                  "type": "boolean"
                },
                "paymentItemRequest": {
                  "$ref": "#/components/schemas/PaymentItemRequest"
                }
              }
            }
          }
        }
      },
      "PaymentResponse": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "paymentMethodId": {
              "type": "string"
            },
            "paymentProfileId": {
              "type": "string"
            },
            "status": {
              "type": "string"
            }
          }
        }
      },
      "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": "payment",
                  "description": "Holds the action that is being perfomed causing the error"
                },
                "errorCode": {
                  "type": "string",
                  "example": "Payment-XXX"
                },
                "errorDescription": {
                  "type": "string",
                  "example": "Payment xxx"
                },
                "errorDetails": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "system": {
                        "type": "string",
                        "example": "Payment"
                      },
                      "errorCode": {
                        "type": "string",
                        "example": "Payment"
                      },
                      "errorDescription": {
                        "type": "string",
                        "example": "Payment"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "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"
                }
              }
            }
          }
        }
      }
    }
  }
}