{
  "openapi": "3.0.4",
  "info": {
    "version": "1.0.0",
    "title": "Fulfillment",
    "description": "This is OpenAPI Spec APIs for external partners to invoke the checkout process updating the fulfillment 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}/fulfillment": {
      "post": {
        "tags": [
          "sales-operations"
        ],
        "description": "Update fulfillment for an order",
        "summary": "Fulfillment selection",
        "operationId": "patchFulfillment",
        "parameters": [
          {
            "name": "orderid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Order ID"
          }
        ],
        "requestBody": {
          "required": true,
          "description": "Request body for the fulfillment selection",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "placeid": {
                    "type": "string",
                    "description": "Optional if not provided; defaults to ppuaddress on account"
                  },
                  "selectedOptions": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "productOrderItemId": {
                          "type": "string",
                          "description": "ID of the mobile device (e.g., first or second mobile)"
                        },
                        "productOffering": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "description": "ID of the product offering from the get fulfillment call"
                            },
                            "name": {
                              "type": "string",
                              "example": "Standard Shipping",
                              "description": "Holds the shipping method value"
                            },
                            "productOfferingType": {
                              "type": "string",
                              "example": "Delivery_Method",
                              "description": "Denotes that delivery method is the product offering type "
                            }
                          },
                          "required": [
                            "id",
                            "name",
                            "productOfferingType"
                          ]
                        },
                        "product": {
                          "type": "object",
                          "properties": {
                            "place": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string",
                                    "example": "D11211",
                                    "description": "Holds the value of the store for any click to store orders"
                                  },
                                  "role": {
                                    "type": "string",
                                    "example": "store"
                                  }
                                },
                                "required": [
                                  "id",
                                  "role"
                                ]
                              }
                            }
                          }
                        }
                      },
                      "required": [
                        "productOrderItemId",
                        "productOffering"
                      ]
                    }
                  }
                },
                "required": [
                  "selectedOptions"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/FulfillmentResponse"
          },
          "400": {
            "$ref": "#/components/responses/FulfillmentErrorResponse"
          }
        }
      }
    },
    "/v1/fulfillment-options": {
      "post": {
        "servers": [
          {
            "url": "https://partner.att.com/omni-svcs"
          }
        ],
        "tags": [
          "omni-svcs-fulfillment"
        ],
        "description": "Retreive eligible fulfillment options.",
        "summary": "Inquire fulfillment options.",
        "operationId": "RetrievefulfillmentOptions",
        "requestBody": {
          "required": true,
          "description": "Request body for the fulfillment selection",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "orderId": {
                    "type": "string",
                    "example": "10-689838051878453"
                  },
                  "placeid": {
                    "type": "string",
                    "description": "This is placeid of the address to get Fulfillment details.",
                    "example": "fdcdd712-98a6-45b0-a8ee-c9b904de2208_1"
                  }
                },
                "required": [
                  "orderId"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/FulfillmentOptionsResponse"
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "validation": {
                      "$ref": "#/components/schemas/Validation"
                    },
                    "error": {
                      "$ref": "#/components/schemas/Error"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "requestBodies": {
      "FulfillmentRequest": {
        "required": true,
        "description": "Request body for the fulfillment selection",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "placeid": {
                  "type": "string",
                  "description": "Optional if not provided; defaults to ppuaddress on account"
                },
                "selectedOptions": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "productOrderItemId": {
                        "type": "string",
                        "description": "ID of the mobile device (e.g., first or second mobile)"
                      },
                      "productOffering": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "ID of the product offering from the get fulfillment call"
                          },
                          "name": {
                            "type": "string",
                            "example": "Standard Shipping",
                            "description": "Holds the shipping method value"
                          },
                          "productOfferingType": {
                            "type": "string",
                            "example": "Delivery_Method",
                            "description": "Denotes that delivery method is the product offering type "
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "productOfferingType"
                        ]
                      },
                      "product": {
                        "type": "object",
                        "properties": {
                          "place": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "example": "D11211",
                                  "description": "Holds the value of the store for any click to store orders"
                                },
                                "role": {
                                  "type": "string",
                                  "example": "store"
                                }
                              },
                              "required": [
                                "id",
                                "role"
                              ]
                            }
                          }
                        }
                      }
                    },
                    "required": [
                      "productOrderItemId",
                      "productOffering"
                    ]
                  }
                }
              },
              "required": [
                "selectedOptions"
              ]
            }
          }
        }
      },
      "FulfillmentOptionsRequest": {
        "required": true,
        "description": "Request body for the fulfillment selection",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "orderId": {
                  "type": "string",
                  "example": "10-689838051878453"
                },
                "placeid": {
                  "type": "string",
                  "description": "This is placeid of the address to get Fulfillment details.",
                  "example": "fdcdd712-98a6-45b0-a8ee-c9b904de2208_1"
                }
              },
              "required": [
                "orderId"
              ]
            }
          }
        }
      }
    },
    "responses": {
      "FulfillmentResponse": {
        "description": "Response body for fulfillment selection",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "selectedOptions": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "productOrderItemId": {
                        "type": "string",
                        "description": "ID of the mobile device"
                      },
                      "productOffering": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "ID returned from GET call"
                          },
                          "name": {
                            "type": "string",
                            "example": "Standard Shipping",
                            "description": "Indicates the delivery method type"
                          },
                          "productOfferingType": {
                            "type": "string",
                            "example": "Delivery_Method",
                            "description": "Indicates that the product offering is the delivery method"
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "productOfferingType"
                        ]
                      },
                      "product": {
                        "type": "object",
                        "properties": {
                          "place": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "example": "string",
                                  "description": "Indicates the store value the storeid"
                                },
                                "role": {
                                  "type": "string",
                                  "example": "store",
                                  "description": "Indicates the delivery method associated with the selected option. For example, if the delivery method is Click to Store, the role will be store to represent in-store pickup."
                                }
                              },
                              "required": [
                                "id",
                                "role"
                              ]
                            }
                          }
                        }
                      },
                      "status": {
                        "type": "string",
                        "example": "success"
                      }
                    },
                    "required": [
                      "productOrderItemId",
                      "productOffering",
                      "status"
                    ]
                  }
                },
                "validation": {
                  "$ref": "#/components/schemas/Validation"
                }
              },
              "required": [
                "selectedOptions"
              ]
            }
          }
        }
      },
      "FulfillmentOptionsResponse": {
        "description": "Response body for fulfillment selection",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "selectedOptions": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "options": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "productOrderItemId": {
                              "type": "string"
                            },
                            "fulfillmentOptions": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "dates": {
                                    "type": "object",
                                    "properties": {
                                      "shipmentDates": {
                                        "type": "object",
                                        "properties": {
                                          "dateFrom": {
                                            "type": "string",
                                            "format": "date"
                                          },
                                          "dateTo": {
                                            "type": "string",
                                            "format": "date"
                                          }
                                        }
                                      },
                                      "deliveryDates": {
                                        "type": "object",
                                        "properties": {
                                          "dateFrom": {
                                            "type": "string",
                                            "format": "date"
                                          },
                                          "dateTo": {
                                            "type": "string",
                                            "format": "date"
                                          }
                                        }
                                      }
                                    }
                                  },
                                  "productOffering": {
                                    "type": "object",
                                    "properties": {
                                      "id": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      },
                                      "productOfferingType": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "finalPrice": {
                                    "type": "object",
                                    "properties": {
                                      "dutyFreeAmount": {
                                        "type": "object",
                                        "properties": {
                                          "unit": {
                                            "type": "string"
                                          },
                                          "value": {
                                            "type": "number"
                                          }
                                        }
                                      }
                                    }
                                  },
                                  "product": {
                                    "type": "object",
                                    "properties": {
                                      "place": {
                                        "type": "array",
                                        "items": {
                                          "type": "object",
                                          "properties": {
                                            "id": {
                                              "type": "string"
                                            },
                                            "role": {
                                              "type": "string"
                                            }
                                          }
                                        }
                                      }
                                    }
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    },
                    "required": [
                      "productOrderItemId",
                      "productOffering",
                      "status"
                    ]
                  }
                },
                "validation": {
                  "$ref": "#/components/schemas/Validation"
                }
              },
              "required": [
                "selectedOptions"
              ]
            }
          }
        }
      },
      "FulfillmentErrorResponse": {
        "description": "Error Response body for fulfillment selection",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "validation": {
                  "$ref": "#/components/schemas/Validation"
                },
                "error": {
                  "$ref": "#/components/schemas/Error"
                }
              },
              "required": [
                ""
              ]
            }
          }
        }
      }
    },
    "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": "fulfillment",
                  "description": "Holds the action that is being perfomed causing the error"
                },
                "errorCode": {
                  "type": "string",
                  "example": "FULFILLMENT-XXX"
                },
                "errorDescription": {
                  "type": "string",
                  "example": "FULFILLMENT xxx"
                },
                "errorDetails": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "system": {
                        "type": "string",
                        "example": "FULFILLMENT"
                      },
                      "errorCode": {
                        "type": "string",
                        "example": "FULFILLMENTXXX"
                      },
                      "errorDescription": {
                        "type": "string",
                        "example": "FULFILLMENTXXX"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "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"
                }
              }
            }
          }
        }
      }
    }
  }
}