{
  "openapi": "3.1.2",
  "info": {
    "version": "1.0.1",
    "title": "extpartneromnisvcsms",
    "description": "This is OpenAPI Spec APIs for external partners to perform Payment Operations.",
    "contact": {
      "name": "Omni API Support",
      "email": "DL-OmniAdapter@att.com"
    }
  },
  "servers": [
    {
      "url": "https://partner.att.com/omni-svcs"
    }
  ],
  "security": [],
  "tags": [
    {
      "name": "Payment",
      "description": "Persist Payment Method Information"
    }
  ],
  "paths": {
    "/v1/payment-methods": {
      "post": {
        "tags": [
          "Payment"
        ],
        "description": "Allows external partners to register and securely tokenize a new payment method (e.g., credit card) during fiber order submission for future reuse in AT&T’s systems.",
        "summary": "Payment updates on the account",
        "operationId": "payment",
        "parameters": [
          {
            "$ref": "#/components/parameters/ParameterAppname"
          }
        ],
        "requestBody": {
          "description": "Payment transaction request payload",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Payment"
              },
              "examples": {
                "Payment__createpaymentprofile": {
                  "value": {
                    "paymentMethods": [
                      {
                        "id": "paymentmethod_1",
                        "amount": 1,
                        "accountNumber": "123454",
                        "savePaymentProfile": true,
                        "storeTermsConditionConsent": true,
                        "tncId": "111",
                        "customerAgreement": "TC20180810",
                        "cartId": "c4e73c60-0c58-11f1-b19a-f3d57f0f40d8",
                        "profileName": "23-7995788593397",
                        "encPaymentMethod": "<encrypted_payment_method>",
                        "paySource": {
                          "sourceSystem": "RTB",
                          "sourceLocation": "XX",
                          "sourceUser": "IDP"
                        }
                      }
                    ]
                  }
                },
                "Payment_createpaymentbankaccount": {
                  "value": {
                    "paymentMethods": [
                      {
                        "id": "paymentmethod_1",
                        "amount": 1,
                        "accountNumber": "123454",
                        "savePaymentProfile": true,
                        "storeTermsConditionConsent": true,
                        "tncId": "111",
                        "customerAgreement": "TC20180810",
                        "cartId": "c4e73c60-0c58-11f1-b19a-f3d57f0f40d8",
                        "profileName": "23-7995788593397",
                        "encPaymentMethod": "<encrypted_payment_method>",
                        "paySource": {
                          "sourceSystem": "RTB",
                          "sourceLocation": "XX",
                          "sourceUser": "IDP"
                        }
                      }
                    ]
                  }
                },
                "Payment_validate": {
                  "value": {
                    "paymentMethods": [
                      {
                        "id": "paymentmethod_1",
                        "amount": 0,
                        "accountNumber": "123454",
                        "savePaymentProfile": false,
                        "encPaymentMethod": "<encrypted_payment_method>",
                        "paySource": {
                          "sourceSystem": "RTB",
                          "sourceLocation": "XX",
                          "sourceUser": "IDP"
                        }
                      }
                    ]
                  }
                },
                "Payment_authorize": {
                  "value": {
                    "paymentMethods": [
                      {
                        "id": "paymentmethod_1",
                        "amount": 123,
                        "accountNumber": "123454",
                        "savePaymentProfile": false,
                        "encPaymentMethod": "<encrypted_payment_method>",
                        "paySource": {
                          "sourceSystem": "RTB",
                          "sourceLocation": "XX",
                          "sourceUser": "IDP"
                        }
                      }
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Payment transaction update response ",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentResponse"
                },
                "examples": {
                  "payment_authorize_payment_response": {
                    "value": {
                      "status": "success",
                      "paymentMethodId": ""
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Error Response body for Payment transaction",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WrappedPartnerServiceError"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WrappedPartnerServiceError"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Payment": {
        "type": "object",
        "description": "Payment request payload containing payment method details for registration, validation, or authorization.",
        "properties": {
          "paymentMethods": {
            "type": "array",
            "description": "List of payment methods to be processed.",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "description": "Unique identifier for the payment method."
                },
                "amount": {
                  "type": "number",
                  "description": "Payment amount to be authorized or processed."
                },
                "storeTermsConditionConsent": {
                  "type": "boolean",
                  "description": "Indicates if the customer has consented to store the payment profile under terms and conditions."
                },
                "tncId": {
                  "type": "string",
                  "description": "The id of the Terms and Agreement from TnC respository."
                },
                "customerAgreement": {
                  "type": "string",
                  "description": "Version number that matches to the T&C that the customer has to agree to before profile can be set up."
                },
                "cartId": {
                  "type": "string",
                  "description": "Shopping cart identifier associated with the payment."
                },
                "profileName": {
                  "type": "string",
                  "description": "Name of the payment profile to be saved. Customer may save payment profile for future where they can pass identifiable information eg. My Chase Account. If profile is temporary order number can be used."
                },
                "encPaymentMethod": {
                  "type": "string",
                  "description": "Encrypted payment method information (e.g., credit card details) in JWE format."
                },
                "accountNumber": {
                  "type": "string",
                  "description": "Customer billing account number associated with the payment."
                },
                "savePaymentProfile": {
                  "type": "boolean",
                  "description": "Indicates whether to save the payment method as a reusable profile."
                },
                "paySource": {
                  "type": "object",
                  "description": "Source information for payment processing and auditing sourced during onboarding to payment system.",
                  "properties": {
                    "sourceSystem": {
                      "type": "string",
                      "description": "System from which the payment request originated."
                    },
                    "sourceLocation": {
                      "type": "string",
                      "description": "Location or channel from which the payment request originated."
                    },
                    "sourceUser": {
                      "type": "string",
                      "description": "User or agent who initiated the payment request."
                    }
                  }
                }
              }
            }
          }
        }
      },
      "PaymentResponse": {
        "type": "object",
        "description": "Payment response payload containing the result of the payment operation.",
        "properties": {
          "paymentMethodId": {
            "type": "string",
            "description": "Unique identifier for the payment method returned after successful processing."
          },
          "paymentProfileId": {
            "type": "string",
            "description": "Unique identifier for the saved payment profile if the payment method was stored."
          },
          "status": {
            "type": "string",
            "description": "Status of the payment operation (e.g., success, failure)."
          }
        }
      },
      "PartnerServiceError": {
        "type": "object",
        "properties": {
          "errorId": {
            "type": "string",
            "example": "Top level error code"
          },
          "message": {
            "type": "string",
            "example": "Top level error message"
          },
          "errorSystemId": {
            "type": "string",
            "example": "System name"
          },
          "details": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "type": "string",
                  "example": "Detail code 1"
                },
                "message": {
                  "type": "string",
                  "example": "Detail message 1"
                }
              }
            }
          }
        }
      },
      "WrappedPartnerServiceError": {
        "type": "object",
        "properties": {
          "error": {
            "$ref": "#/components/schemas/PartnerServiceError"
          }
        }
      }
    },
    "parameters": {
      "ParameterAppname": {
        "name": "appname",
        "in": "header",
        "required": false,
        "schema": {
          "type": "string"
        },
        "description": "Application name making the request"
      }
    }
  }
}